From 24f59050204017c641749c59a69e40d53074c028 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Mon, 25 Apr 2011 13:05:35 -0400 Subject: [PATCH] portal now uses particles as storage, so it keeps everything. --- includes/powder.h | 5 ++--- src/elements/prti.c | 6 ++---- src/elements/prto.c | 34 ++++++++++++++++------------------ src/main.c | 2 +- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 3de04fe2e..eda39111d 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -777,9 +777,8 @@ static int lolzrule[9][9] = {0,1,0,0,0,0,0,1,0}, }; #define CHANNELS ((int)(MAX_TEMP-73.15f)/100+2) -int portal[CHANNELS][8][80]; -float portaltemp[CHANNELS][8][80]; -int portalctype[CHANNELS][8][80]; +particle portalp[CHANNELS][8][80]; +const particle emptyparticle; int wireless[CHANNELS][2]; extern int isplayer; diff --git a/src/elements/prti.c b/src/elements/prti.c index d21bf56a6..7205844ce 100644 --- a/src/elements/prti.c +++ b/src/elements/prti.c @@ -34,11 +34,9 @@ int update_PRTI(UPDATE_FUNC_ARGS) { continue; } for ( nnx=0; nnx<80; nnx++) - if (!portal[parts[i].tmp][count-1][nnx]) + if (!portalp[parts[i].tmp][count-1][nnx].type) { - portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type; - portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp; - portalctype[parts[i].tmp][count-1][nnx] = parts[r>>8].ctype; + portalp[parts[i].tmp][count-1][nnx] = parts[r>>8]; if ((r&0xFF)==PT_SPRK) part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype); else diff --git a/src/elements/prto.c b/src/elements/prto.c index 46c7250a9..4b6a57645 100644 --- a/src/elements/prto.c +++ b/src/elements/prto.c @@ -34,29 +34,27 @@ int update_PRTO(UPDATE_FUNC_ARGS) { randomness=1; if (randomness>8) randomness=8; - if (portal[parts[i].tmp][randomness-1][nnx]==PT_SPRK)// TODO: make it look better, spark creation + if (portalp[parts[i].tmp][randomness-1][nnx].type==PT_SPRK)// TODO: make it look better, spark creation { - create_part(-1,x+1,y,portal[parts[i].tmp][randomness-1][nnx]); - create_part(-1,x+1,y+1,portal[parts[i].tmp][randomness-1][nnx]); - create_part(-1,x+1,y-1,portal[parts[i].tmp][randomness-1][nnx]); - create_part(-1,x,y-1,portal[parts[i].tmp][randomness-1][nnx]); - create_part(-1,x,y+1,portal[parts[i].tmp][randomness-1][nnx]); - create_part(-1,x-1,y+1,portal[parts[i].tmp][randomness-1][nnx]); - create_part(-1,x-1,y,portal[parts[i].tmp][randomness-1][nnx]); - create_part(-1,x-1,y-1,portal[parts[i].tmp][randomness-1][nnx]); - portal[parts[i].tmp][randomness-1][nnx] = 0; - portaltemp[parts[i].tmp][randomness-1][nnx] = 0; + create_part(-1,x+1,y,PT_SPRK); + create_part(-1,x+1,y+1,PT_SPRK); + create_part(-1,x+1,y-1,PT_SPRK); + create_part(-1,x,y-1,PT_SPRK); + create_part(-1,x,y+1,PT_SPRK); + create_part(-1,x-1,y+1,PT_SPRK); + create_part(-1,x-1,y,PT_SPRK); + create_part(-1,x-1,y-1,PT_SPRK); + portalp[parts[i].tmp][randomness-1][nnx] = emptyparticle; break; } - else if (portal[parts[i].tmp][randomness-1][nnx]) + else if (portalp[parts[i].tmp][randomness-1][nnx].type) { - np = create_part(-1,x+rx,y+ry,portal[parts[i].tmp][randomness-1][nnx]); + np = create_part(-1,x+rx,y+ry,portalp[parts[i].tmp][randomness-1][nnx].type); if (np<0) continue; - parts[np].temp = portaltemp[parts[i].tmp][randomness-1][nnx]; - parts[np].ctype = portalctype[parts[i].tmp][randomness-1][nnx]; - portal[parts[i].tmp][randomness-1][nnx] = 0; - portaltemp[parts[i].tmp][randomness-1][nnx] = 0; - portalctype[parts[i].tmp][randomness-1][nnx] = 0; + parts[np] = portalp[parts[i].tmp][randomness-1][nnx]; + parts[np].x = x+rx; + parts[np].y = y+ry; + portalp[parts[i].tmp][randomness-1][nnx] = emptyparticle; break; } } diff --git a/src/main.c b/src/main.c index e40da3d3c..0271e55c9 100644 --- a/src/main.c +++ b/src/main.c @@ -932,7 +932,7 @@ void clear_sim(void) memset(photons, 0, sizeof(photons)); memset(wireless, 0, sizeof(wireless)); memset(gol2, 0, sizeof(gol2)); - memset(portal, 0, sizeof(portal)); + memset(portalp, 0, sizeof(portalp)); death = death2 = ISSPAWN1 = ISSPAWN2 = 0; memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); memset(fire_bg, 0, XRES*YRES*PIXELSIZE);