Merge ../forks into testing
This commit is contained in:
commit
e5bb3c9869
131
powder.c
131
powder.c
@ -151,8 +151,8 @@ float mheat = 0.0f;
|
||||
int do_open = 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 amd = 0;
|
||||
int death = 1, gravityd = 2, framerender = 0;
|
||||
int amd = 1;
|
||||
|
||||
unsigned char fire_r[YRES/CELL][XRES/CELL];
|
||||
unsigned char fire_g[YRES/CELL][XRES/CELL];
|
||||
@ -192,7 +192,7 @@ float fvx[YRES/CELL][XRES/CELL], fvy[YRES/CELL][XRES/CELL];
|
||||
#define VADV 0.3f
|
||||
#define VLOSS 0.999f
|
||||
#define PLOSS 0.9999f
|
||||
int numCores = 1;
|
||||
int numCores = 4;
|
||||
float kernel[9];
|
||||
void make_kernel(void)
|
||||
{
|
||||
@ -970,7 +970,7 @@ void kill_part(int i)
|
||||
pfree = i;
|
||||
}
|
||||
|
||||
#ifdef WIN32/
|
||||
#ifdef WIN32
|
||||
_inline int create_part(int p, int x, int y, int t)
|
||||
#else
|
||||
inline int create_part(int p, int x, int y, int t)
|
||||
@ -1409,7 +1409,16 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
t = parts[i].type;
|
||||
|
||||
if(sys_pause)
|
||||
{
|
||||
if(framerender)
|
||||
{
|
||||
sys_pause = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto justdraw;
|
||||
}
|
||||
}
|
||||
|
||||
if(parts[i].life && t!=PT_ACID && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM)
|
||||
{
|
||||
@ -1517,11 +1526,47 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
{
|
||||
parts[i].vx += ptypes[t].advection*vx[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];
|
||||
if(gravityd == 1)
|
||||
{
|
||||
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];
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2369,7 +2414,6 @@ killed:
|
||||
if(parts[i].type == PT_NONE)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(t==PT_STKM)
|
||||
{
|
||||
//Tempirature handling
|
||||
@ -2379,7 +2423,7 @@ killed:
|
||||
parts[i].temp += 1;
|
||||
|
||||
//Death
|
||||
if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind...
|
||||
if(parts[i].life<0 && (death == 1)) //If his HP is less that 0 or there is very big wind...
|
||||
{
|
||||
for(r=-2; r<=1; r++)
|
||||
{
|
||||
@ -2510,8 +2554,7 @@ killed:
|
||||
{
|
||||
if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART)
|
||||
continue;
|
||||
if(((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID || ptypes[pmap[ny+y][nx+x]&0xFF].falldown > 0) &&
|
||||
(pmap[ny+y][nx+x]&0xFF)!=PT_STKM
|
||||
if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM
|
||||
&& (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL)
|
||||
|| (pmap[ny+y][nx+x]&0xFF) == PT_LNTG)
|
||||
{
|
||||
@ -2564,8 +2607,8 @@ killed:
|
||||
}
|
||||
else
|
||||
{
|
||||
parts[r>>8].vy = -(player[1] == 0)*random;
|
||||
parts[r>>8].vx = (player[1]!=0)*(((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random;
|
||||
parts[r>>8].vy = 0;
|
||||
parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2623,9 +2666,6 @@ killed:
|
||||
//Collision checks
|
||||
for(ny = -2-(int)parts[i].vy; ny<=0; ny++)
|
||||
{
|
||||
if ((int)(ny+player[8])>=YRES)
|
||||
continue;
|
||||
|
||||
r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-)
|
||||
|
||||
//For left leg
|
||||
@ -2648,9 +2688,6 @@ killed:
|
||||
player[9] = player[7];
|
||||
}
|
||||
|
||||
if ((int)(ny+player[16])>=YRES)
|
||||
continue;
|
||||
|
||||
r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)];
|
||||
|
||||
//For right leg
|
||||
@ -2740,7 +2777,6 @@ killed:
|
||||
|
||||
isplayer = 1;
|
||||
}
|
||||
|
||||
if(t==PT_CLNE)
|
||||
{
|
||||
if(!parts[i].ctype)
|
||||
@ -3591,9 +3627,15 @@ justdraw:
|
||||
blendpixel(vid, nx-1, ny+1, R, G, B, 112);
|
||||
}
|
||||
|
||||
}
|
||||
if(framerender == 1)
|
||||
{
|
||||
sys_pause = 1;
|
||||
framerender= 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void drawblob(pixel *vid, int x, int y, unsigned char cr, unsigned char cg, unsigned char cb)
|
||||
{
|
||||
@ -4345,7 +4387,42 @@ int sdl_poll(void)
|
||||
{
|
||||
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)
|
||||
{
|
||||
player[0] = (int)(player[0])|0x04; //Jump command
|
||||
@ -10058,6 +10135,14 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(sdl_key=='d')
|
||||
{
|
||||
death = !(death);
|
||||
}
|
||||
if(sdl_key=='f')
|
||||
{
|
||||
framerender = 1;
|
||||
}
|
||||
if((sdl_key=='l' || sdl_key=='k') && stamps[0].name[0])
|
||||
{
|
||||
if(load_mode)
|
||||
@ -10205,8 +10290,8 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
bs += sdl_wheel;
|
||||
if(bs>16)
|
||||
bs = 16;
|
||||
if(bs>1224)
|
||||
bs = 1224;
|
||||
if(bs<0)
|
||||
bs = 0;
|
||||
sdl_wheel = 0;
|
||||
|
Reference in New Issue
Block a user