diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-26 16:10:21 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-10-26 16:10:21 (GMT) |
| commit | e2c9882692fabcd22a7d022ebd21fd3b36ad84b0 (patch) | |
| tree | 0afb6c4c35985625484d87adcdda40004910a3ff /src/main.c | |
| parent | 4742c1bcd9103e93751b67a831403a66dc411804 (diff) | |
| parent | 60de1cf5754d8132a7bf5b6868df34babe66397b (diff) | |
| download | powder-e2c9882692fabcd22a7d022ebd21fd3b36ad84b0.zip powder-e2c9882692fabcd22a7d022ebd21fd3b36ad84b0.tar.gz | |
Merge latest FIGH additions
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 52 |
1 files changed, 29 insertions, 23 deletions
@@ -977,21 +977,19 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char // no more particle properties to load, so we can change type here without messing up loading if (i && i<=NPART) { - if ((player[27] == 1 && ty==PT_STKM) || (player2[27] == 1 && ty==PT_STKM2)) + if ((player.spwn == 1 && ty==PT_STKM) || (player2.spwn == 1 && ty==PT_STKM2)) { parts[i-1].type = PT_NONE; } else if (parts[i-1].type == PT_STKM) { - //player[2] = PT_DUST; - STKM_init_legs(player, i-1); - player[27] = 1; + STKM_init_legs(&player, i-1); + player.spwn = 1; } else if (parts[i-1].type == PT_STKM2) { - //player2[2] = PT_DUST; - STKM_init_legs(player2, i-1); - player2[27] = 1; + STKM_init_legs(&player2, i-1); + player2.spwn = 1; } if (ver<48 && (ty==OLD_PT_WIND || (ty==PT_BRAY&&parts[i-1].life==0))) @@ -1110,9 +1108,11 @@ void clear_sim(void) memset(wireless, 0, sizeof(wireless)); memset(gol2, 0, sizeof(gol2)); memset(portalp, 0, sizeof(portalp)); + memset(fighters, 0, sizeof(fighters)); + fighcount = 0; ISSPAWN1 = ISSPAWN2 = 0; - player[27] = 0; - player2[27] = 0; + player.spwn = 0; + player2.spwn = 0; memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); memset(fire_r, 0, sizeof(fire_r)); memset(fire_g, 0, sizeof(fire_g)); @@ -1494,8 +1494,8 @@ int main(int argc, char *argv[]) pers_bg = calloc((XRES+BARSIZE)*YRES, PIXELSIZE); prepare_alpha(4, 1.0f); - player[2] = player2[2] = PT_DUST; - player[28] = player2[28] = 0; + player.elem = player2.elem = PT_DUST; + player.frames = player2.frames = 0; sprintf(ppmfilename, "%s.ppm", argv[2]); sprintf(ptifilename, "%s.pti", argv[2]); @@ -2152,7 +2152,7 @@ int main(int argc, char *argv[]) free(load_data); } } - if (sdl_key=='s' && ((sdl_mod & (KMOD_CTRL)) || !player2[27])) + if (sdl_key=='s' && ((sdl_mod & (KMOD_CTRL)) || !player2.spwn)) { if (it > 50) it = 50; @@ -2286,7 +2286,7 @@ int main(int argc, char *argv[]) bsy = 0; } } - if (sdl_key=='d' && ((sdl_mod & (KMOD_CTRL)) || !player2[27])) + if (sdl_key=='d' && ((sdl_mod & (KMOD_CTRL)) || !player2.spwn)) DEBUG_MODE = !DEBUG_MODE; if (sdl_key=='i') { @@ -2370,7 +2370,7 @@ int main(int argc, char *argv[]) } } - if (sdl_key=='w' && (!player2[27] || (sdl_mod & (KMOD_SHIFT)))) //Gravity, by Moach + if (sdl_key=='w' && (!player2.spwn || (sdl_mod & (KMOD_SHIFT)))) //Gravity, by Moach { ++gravityMode; // cycle gravity mode itc = 51; @@ -3123,7 +3123,7 @@ int main(int argc, char *argv[]) c = (b&1) ? sl : sr; //c is element to be spawned su = c; - if (c!=WL_SIGN+100) + if (c!=WL_SIGN+100 && c!=PT_FIGH) { if (!bq) for (signi=0; signi<MAXSIGNS; signi++) @@ -3152,6 +3152,12 @@ int main(int argc, char *argv[]) if (!bq) add_sign_ui(vid_buf, x, y); } + + if (c==PT_FIGH) + { + if (!bq) + create_part(-1, x, y, PT_FIGH); + } //for the click functions, lx and ly, are the positions of where the FIRST click happened. x,y are current mouse position. else if (lb)//lb means you are holding mouse down { @@ -3586,19 +3592,19 @@ int main(int argc, char *argv[]) sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE); //Setting an element for the stick man - if (player[27]==0) + if (player.spwn==0) { - if ((sr<PT_NUM && ptypes[sr].falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT) - player[2] = sr; + if ((sr<PT_NUM && ptypes[sr].falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT || sr == PT_LIGH) + player.elem = sr; else - player[2] = PT_DUST; + player.elem = PT_DUST; } - if (player2[27]==0) + if (player2.spwn==0) { - if ((sr<PT_NUM && ptypes[sr].falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT) - player2[2] = sr; + if ((sr<PT_NUM && ptypes[sr].falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT || sr == PT_LIGH) + player2.elem = sr; else - player2[2] = PT_DUST; + player2.elem = PT_DUST; } } SDL_CloseAudio(); |
