Fix some WIND bugs

This commit is contained in:
Simon 2011-03-22 17:14:45 +00:00
commit 7d56b33589
4 changed files with 22 additions and 11 deletions

View File

@ -10,7 +10,7 @@
#define SAVE_VERSION 46 #define SAVE_VERSION 46
#define MINOR_VERSION 4 #define MINOR_VERSION 4
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
//#define BETA #define BETA
#define SERVER "powdertoy.co.uk" #define SERVER "powdertoy.co.uk"

View File

@ -6,8 +6,8 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1); parts[i].tmp = (int)((parts[i].temp-73.15f)/100+1);
if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1; if (parts[i].tmp>=CHANNELS) parts[i].tmp = CHANNELS-1;
else if (parts[i].tmp<0) parts[i].tmp = 0; else if (parts[i].tmp<0) parts[i].tmp = 0;
for (rx=1; rx>-2; rx--) for (rx=-1; rx<2; rx++)
for (ry=1; ry>-2; ry--) for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];

View File

@ -1451,8 +1451,8 @@ int main(int argc, char *argv[])
{ {
svf_admin = 0; svf_admin = 0;
svf_mod = 1; svf_mod = 1;
} }
} }
} }
else else
{ {
@ -2301,8 +2301,18 @@ int main(int argc, char *argv[])
svf_description[0] = 0; svf_description[0] = 0;
gravityMode = 0; gravityMode = 0;
airMode = 0; airMode = 0;
death = death2 = 0;
isplayer2 = 0; isplayer2 = 0;
isplayer = 0; isplayer = 0;
ISSPAWN1 = 0;
ISSPAWN2 = 0;
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
memset(fire_r, 0, sizeof(fire_r));
memset(fire_g, 0, sizeof(fire_g));
memset(fire_b, 0, sizeof(fire_b));
} }
if (x>=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476))) if (x>=(XRES+BARSIZE-(510-385)) && x<=(XRES+BARSIZE-(510-476)))
{ {
@ -2461,7 +2471,7 @@ int main(int argc, char *argv[])
{ {
if (sdl_mod & (KMOD_CAPS)) if (sdl_mod & (KMOD_CAPS))
c = 0; c = 0;
if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&c!=PT_WIND&&!REPLACE_MODE) if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE&&c!=PT_WIND)
flood_parts(x, y, c, -1, -1); flood_parts(x, y, c, -1, -1);
if (c==SPC_HEAT || c==SPC_COOL) if (c==SPC_HEAT || c==SPC_COOL)
create_parts(x, y, bsx, bsy, c); create_parts(x, y, bsx, bsy, c);
@ -2809,7 +2819,8 @@ int process_command(pixel *vid_buf,char *console,char *console_error) {
ny = 0; ny = 0;
j = 0; j = 0;
m = 0; m = 0;
console_parse_coords(console4, &nx , &ny, console_error); if(console4)
console_parse_coords(console4, &nx , &ny, console_error);
memset(pch,0,sizeof(pch)); memset(pch,0,sizeof(pch));
memset(fileread,0,sizeof(fileread)); memset(fileread,0,sizeof(fileread));
fread(fileread,1,5000,f); fread(fileread,1,5000,f);

View File

@ -1122,7 +1122,7 @@ int nearest_part(int ci, int t)
void update_particles_i(pixel *vid, int start, int inc) void update_particles_i(pixel *vid, int start, int inc)
{ {
int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors; int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors, createdsomething;
float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp, ctemph, ctempl; float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp, ctemph, ctempl;
int fin_x, fin_y, clear_x, clear_y; int fin_x, fin_y, clear_x, clear_y;
float fin_xf, fin_yf, clear_xf, clear_yf; float fin_xf, fin_yf, clear_xf, clear_yf;
@ -1329,14 +1329,14 @@ void update_particles_i(pixel *vid, int start, int inc)
if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !(r&0xFF)) || (r>>8)>=NPART) if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !(r&0xFF)) || (r>>8)>=NPART)
continue; continue;
for ( golnum = 1; golnum<=NGOL; golnum++) for ( golnum = 1; golnum<=NGOL; golnum++)
for ( goldelete = 0; goldelete<9; goldelete++)
{ {
if (neighbors==goldelete&&gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2) goldelete = neighbors;
if (gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2)
{ {
if (create_part(-1,nx,ny,goltype[golnum-1])) if (create_part(-1,nx,ny,goltype[golnum-1]))
createdsomething = 1; createdsomething = 1;
} }
else if (neighbors-1==goldelete&&gol[nx][ny]==golnum&&(grule[golnum][goldelete]==0||grule[golnum][goldelete]==2))//subtract 1 because it counted itself else if (gol[nx][ny]==golnum&&(grule[golnum][goldelete-1]==0||grule[golnum][goldelete-1]==2))//subtract 1 because it counted itself
{ {
if(parts[r>>8].tmp==grule[golnum][9]-1) if(parts[r>>8].tmp==grule[golnum][9]-1)
parts[r>>8].tmp --; parts[r>>8].tmp --;