mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-21 07:31:26 +02:00
Fix everything
This commit is contained in:
114
powder.c
114
powder.c
@@ -151,7 +151,7 @@ float mheat = 0.0f;
|
|||||||
int do_open = 0;
|
int do_open = 0;
|
||||||
int sys_pause = 0;
|
int sys_pause = 0;
|
||||||
int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save.
|
int legacy_enable = 0; //Used to disable new features such as heat, will be set by commandline or save.
|
||||||
int death = 1, gravityd = 2, framerender = 0;
|
int death = 1, framerender = 0;
|
||||||
int amd = 1;
|
int amd = 1;
|
||||||
|
|
||||||
unsigned char fire_r[YRES/CELL][XRES/CELL];
|
unsigned char fire_r[YRES/CELL][XRES/CELL];
|
||||||
@@ -710,7 +710,7 @@ const struct part_state pstates[] =
|
|||||||
/* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
/* METL */ {ST_SOLID, PT_NONE, 0.0f, PT_LAVA, 1000.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||||
/* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
/* SPRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||||
/* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
/* SNOW */ {ST_SOLID, PT_NONE, 0.0f, PT_WATR, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||||
/* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_COAL, 300.0f, PT_FIRE, 600.0f},
|
/* WOOD */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 600.0f},
|
||||||
/* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
/* NEUT */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||||
/* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
/* PLUT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||||
/* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f},
|
/* PLNT */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 300.0f},
|
||||||
@@ -1411,17 +1411,8 @@ void update_particles_i(pixel *vid, int start, int inc)
|
|||||||
ly = parts[i].y;
|
ly = parts[i].y;
|
||||||
t = parts[i].type;
|
t = parts[i].type;
|
||||||
|
|
||||||
if(sys_pause)
|
if(sys_pause&&!framerender)
|
||||||
{
|
|
||||||
if(framerender)
|
|
||||||
{
|
|
||||||
sys_pause = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
goto justdraw;
|
goto justdraw;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM)
|
if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM)
|
||||||
{
|
{
|
||||||
@@ -1531,46 +1522,7 @@ void update_particles_i(pixel *vid, int start, int inc)
|
|||||||
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL];
|
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL];
|
||||||
} else {
|
} else {
|
||||||
parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL];
|
parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL];
|
||||||
if(gravityd == 1) //gravity control stuff
|
|
||||||
{
|
|
||||||
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
|
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
|
||||||
parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity;
|
|
||||||
}
|
|
||||||
if(gravityd == 2)
|
|
||||||
{
|
|
||||||
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
|
|
||||||
}
|
|
||||||
if(gravityd == 3)
|
|
||||||
{
|
|
||||||
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
|
|
||||||
parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity;
|
|
||||||
}
|
|
||||||
if(gravityd == 4)
|
|
||||||
{
|
|
||||||
parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity;
|
|
||||||
}
|
|
||||||
if(gravityd == 5)
|
|
||||||
{
|
|
||||||
parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL];
|
|
||||||
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL];
|
|
||||||
}
|
|
||||||
if(gravityd == 6)
|
|
||||||
{
|
|
||||||
parts[i].vx += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity;
|
|
||||||
}
|
|
||||||
if(gravityd == 7)
|
|
||||||
{
|
|
||||||
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity;
|
|
||||||
parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] - ptypes[t].gravity;
|
|
||||||
}
|
|
||||||
if(gravityd == 8)
|
|
||||||
{
|
|
||||||
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity;
|
|
||||||
}
|
|
||||||
if(gravityd == 9)
|
|
||||||
{
|
|
||||||
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] - ptypes[t].gravity;
|
|
||||||
parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + ptypes[t].gravity;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1640,27 +1592,19 @@ void update_particles_i(pixel *vid, int start, int inc)
|
|||||||
{
|
{
|
||||||
if(t==PT_WTRV && pv[y/CELL][x/CELL]>4.0f)
|
if(t==PT_WTRV && pv[y/CELL][x/CELL]>4.0f)
|
||||||
t = parts[i].type = PT_DSTW;
|
t = parts[i].type = PT_DSTW;
|
||||||
if(t==PT_OILL && pv[y/CELL][x/CELL]>8.0f)
|
|
||||||
t = parts[i].type = PT_PLAS;
|
|
||||||
if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f)
|
if(t==PT_DESL && pv[y/CELL][x/CELL]<-6.0f)
|
||||||
t = parts[i].type = PT_GASS;
|
t = parts[i].type = PT_GASS;
|
||||||
if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f)
|
if(t==PT_GASS && pv[y/CELL][x/CELL]>6.0f)
|
||||||
t = parts[i].type = PT_DESL;
|
t = parts[i].type = PT_DESL;
|
||||||
if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f)
|
if(t==PT_DESL && pv[y/CELL][x/CELL]>12.0f)
|
||||||
t = parts[i].type = PT_FIRE;
|
t = parts[i].type = PT_FIRE;
|
||||||
if(t==PT_WOOD && pv[y/CELL][x/CELL]>6.0f)
|
|
||||||
t = parts[i].type = PT_COAL;
|
|
||||||
}
|
}
|
||||||
if(t==PT_OILL && pv[y/CELL][x/CELL]>20.0f)
|
|
||||||
t = parts[i].type = PT_PLAS;
|
|
||||||
if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f)
|
if(t==PT_DESL && pv[y/CELL][x/CELL]<-20.0f)
|
||||||
t = parts[i].type = PT_GASS;
|
t = parts[i].type = PT_GASS;
|
||||||
if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it
|
if(t==PT_DESL && pv[y/CELL][x/CELL]>50.0f) // Only way I know to make it
|
||||||
t = parts[i].type = PT_FIRE; // combust under pressure.
|
t = parts[i].type = PT_FIRE; // combust under pressure.
|
||||||
if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f)
|
if(t==PT_GASS && pv[y/CELL][x/CELL]>20.0f)
|
||||||
t = parts[i].type = PT_DESL;
|
t = parts[i].type = PT_DESL;
|
||||||
if(t==PT_WOOD && pv[y/CELL][x/CELL]>30.0f)
|
|
||||||
t = parts[i].type = PT_COAL;
|
|
||||||
if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f)
|
if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f)
|
||||||
t = parts[i].type = PT_BRMT;
|
t = parts[i].type = PT_BRMT;
|
||||||
//if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f)
|
//if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f)
|
||||||
@@ -3048,7 +2992,7 @@ justdraw:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
blendpixel(vid, x, y, cr, cg, cb, 255);
|
blendpixel(vid, nx, ny, cr, cg, cb, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmode==4)
|
if(cmode==4)
|
||||||
@@ -3640,14 +3584,10 @@ justdraw:
|
|||||||
blendpixel(vid, nx+1, ny+1, R, G, B, 112);
|
blendpixel(vid, nx+1, ny+1, R, G, B, 112);
|
||||||
blendpixel(vid, nx-1, ny+1, R, G, B, 112);
|
blendpixel(vid, nx-1, ny+1, R, G, B, 112);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(framerender == 1)
|
if(framerender){
|
||||||
{
|
framerender = 0;
|
||||||
sys_pause = 1;
|
sys_pause = 1;
|
||||||
framerender= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3949,7 +3889,7 @@ void update_particles(pixel *vid)
|
|||||||
fire_b[y][x] = cb;
|
fire_b[y][x] = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(emap[y][x] && !sys_pause)
|
if(emap[y][x] && (!sys_pause||framerender))
|
||||||
emap[y][x] --;
|
emap[y][x] --;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4168,7 +4108,7 @@ void update_particles(pixel *vid)
|
|||||||
fire_b[y][x] = cb;
|
fire_b[y][x] = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(emap[y][x] && !sys_pause)
|
if(emap[y][x] && (!sys_pause||framerender))
|
||||||
emap[y][x] --;
|
emap[y][x] --;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4401,42 +4341,6 @@ int sdl_poll(void)
|
|||||||
{
|
{
|
||||||
player[0] = (int)(player[0])|0x08; //Go left command
|
player[0] = (int)(player[0])|0x08; //Go left command
|
||||||
}
|
}
|
||||||
if(event.key.keysym.sym == SDLK_KP1) //gravity direction commands
|
|
||||||
{
|
|
||||||
gravityd = 1;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_KP2)
|
|
||||||
{
|
|
||||||
gravityd = 2;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_KP3)
|
|
||||||
{
|
|
||||||
gravityd = 3;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_KP4)
|
|
||||||
{
|
|
||||||
gravityd = 4;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_KP5)
|
|
||||||
{
|
|
||||||
gravityd = 5;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_KP6)
|
|
||||||
{
|
|
||||||
gravityd = 6;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_KP7)
|
|
||||||
{
|
|
||||||
gravityd = 7;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_KP8)
|
|
||||||
{
|
|
||||||
gravityd = 8;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_KP9)
|
|
||||||
{
|
|
||||||
gravityd = 9;
|
|
||||||
}
|
|
||||||
if(event.key.keysym.sym == SDLK_UP && ((int)(player[0])&0x04)!=0x04)
|
if(event.key.keysym.sym == SDLK_UP && ((int)(player[0])&0x04)!=0x04)
|
||||||
{
|
{
|
||||||
player[0] = (int)(player[0])|0x04; //Jump command
|
player[0] = (int)(player[0])|0x04; //Jump command
|
||||||
@@ -10066,7 +9970,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!sys_pause)
|
if(!sys_pause||framerender)
|
||||||
{
|
{
|
||||||
#ifdef MT
|
#ifdef MT
|
||||||
if(numCores>2)
|
if(numCores>2)
|
||||||
|
@@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
#define SAVE_VERSION 41
|
#define SAVE_VERSION 41
|
||||||
#define MINOR_VERSION 3
|
#define MINOR_VERSION 3
|
||||||
#define IDENT_VERSION "A" //Change this if you're not Simon! It should be a single letter.
|
#define IDENT_VERSION "S" //Change this if you're not Simon! It should be a single letter.
|
||||||
|
|
||||||
#define MENUV3
|
#define MENUV3
|
||||||
#define BETA
|
//#define BETA
|
||||||
#define HEAT_ENABLE
|
#define HEAT_ENABLE
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user