diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index a7746234e..59274023c 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -151,7 +151,7 @@ typedef struct s_prprogrambit { } _prprogrambit; // LIGHTS -#define PR_MAXLIGHTS 128 +#define PR_MAXLIGHTS 256 #define SHADOW_DEPTH_OFFSET 30 #define PR_MAXLIGHTPRIORITY 6 @@ -172,19 +172,16 @@ typedef struct s_prlight { int32_t isinview : 1; } flags; GLuint lightmap; + void* myplanes[PR_MAXLIGHTS<<1]; + int32_t planecnt; } _prlight; extern _prlight prlights[PR_MAXLIGHTS]; - -extern _prlight staticlights[PR_MAXLIGHTS]; -extern int32_t staticlightcount; +extern int32_t lightcount; extern _prlight gamelights[PR_MAXLIGHTS]; extern int32_t gamelightcount; -extern _prlight framelights[PR_MAXLIGHTS]; -extern int32_t framelightcount; - // RENDER TARGETS typedef struct s_prrt { GLenum target; @@ -338,7 +335,7 @@ static void polymer_updatelights(void); static void polymer_resetlights(void); static void polymer_resetplanelights(_prplane* plane); static void polymer_addplanelight(_prplane* plane, int16_t lighti); -static void polymer_deleteplanelight(_prplane* plane, int16_t lighti); +static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti); static int32_t polymer_planeinlight(_prplane* plane, _prlight* light); static void polymer_invalidateplanelights(_prplane* plane); static void polymer_invalidatesectorlights(int16_t sectnum); diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index a888cc04e..231784a56 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -781,9 +781,6 @@ void editinput(void) { memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID)); -#ifdef POLYMER - staticlightcount = 0; -#endif mhk=0; initprintf("Maphacks disabled\n"); keystatus[0x44] = 0; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 4dfe104b1..98a2f08c3 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -6731,10 +6731,6 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo clearbufbyte(&sprite, sizeof(sprite), 0); */ -#ifdef POLYMER - staticlightcount = 0; -#endif // POLYMER - initspritelists(); diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 63eaf22f0..019bca384 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -136,15 +136,9 @@ int32_t lightcount; int32_t curlight; int32_t curlightcount; -_prlight staticlights[PR_MAXLIGHTS]; -int32_t staticlightcount; - _prlight gamelights[PR_MAXLIGHTS]; int32_t gamelightcount; -_prlight framelights[PR_MAXLIGHTS]; -int32_t framelightcount; - static GLfloat shadowBias[] = { 0.5, 0.0, 0.0, 0.0, @@ -4149,41 +4143,23 @@ static void polymer_compileprogram(int32_t programbits) // LIGHTS -static void polymer_removelight(int16_t lighti) -{ - int32_t i; - _prsector *s; - _prwall *w; - - // XXX: might need to store a list of affected planes in the light record - // if this loop ends up consuming too much cycles - i = 0; - while (i < numsectors) - { - s = prsectors[i]; - - polymer_deleteplanelight(&s->floor, lighti); - polymer_deleteplanelight(&s->ceil, lighti); - - i++; - } - - i = 0; - while (i < numwalls) - { - w = prwalls[i]; - - polymer_deleteplanelight(&w->wall, lighti); - polymer_deleteplanelight(&w->over, lighti); - polymer_deleteplanelight(&w->mask, lighti); - - i++; - } -} +static void polymer_removelight(int16_t lighti) +{ + int32_t i; + + // XXX: might need to store a list of affected planes in the light record + // if this loop ends up consuming too much cycles + i = prlights[lighti].planecnt-1; + while (i >= 0) + { + polymer_deleteplanelight(prlights[lighti].myplanes[i], lighti); + i--; + } +} static void polymer_updatelights(void) { - int32_t i; + int32_t i = 0; while (i < PR_MAXLIGHTS) { @@ -4261,31 +4237,30 @@ static void polymer_addplanelight(_prplane* plane, int16_t lighti) { int16_t i; - if (plane->lightcount == PR_MAXLIGHTS) + if (plane->lightcount == PR_MAXLIGHTS-1 || prlights[lighti].planecnt == (PR_MAXLIGHTS<<1)-1) return; i = 0; while (i < PR_MAXLIGHTS) { - if ((plane->lights[i] != -1) && (prlights[plane->lights[i]].priority > prlights[lighti].priority)) + if ((plane->lights[i] != -1) && (prlights[plane->lights[i]].priority >= prlights[lighti].priority)) break; if (plane->lights[i] == -1) { + memmove(&plane->lights[i+1], &plane->lights[i], sizeof(int16_t) * (PR_MAXLIGHTS - (i+1))); + plane->lights[i] = lighti; plane->lightcount++; + prlights[lighti].myplanes[prlights[lighti].planecnt] = plane; + prlights[lighti].planecnt++; return; } i++; } - - memmove(&plane->lights[i+1], &plane->lights[i], sizeof(int16_t) * (PR_MAXLIGHTS - (i+1))); - - plane->lights[i] = lighti; - plane->lightcount++; } -static void polymer_deleteplanelight(_prplane* plane, int16_t lighti) +static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti) { int16_t i; @@ -4294,7 +4269,9 @@ static void polymer_deleteplanelight(_prplane* plane, int16_t lighti) { if (plane->lights[i] == lighti) { - plane->lights[i] = -1; + memmove(&plane->lights[i], &plane->lights[i+1], sizeof(int16_t) * (PR_MAXLIGHTS - (i))); + plane->lights[PR_MAXLIGHTS-1] = -1; + plane->lightcount--; return; } @@ -4459,6 +4436,9 @@ static inline void polymer_culllight(int16_t lighti) Bmemset(drawingstate, 0, sizeof(int16_t) * numsectors); drawingstate[light->sector] = 1; + prlights[lighti].planecnt = 0; + Bmemset(prlights[lighti].myplanes, 0, sizeof(intptr_t) * (PR_MAXLIGHTS<<1)); + sectorqueue[0] = light->sector; while (front != back) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 4b6538c6c..eb58574c6 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -582,6 +582,9 @@ static void ms(int32_t i) } } +// this is the same crap as in game.c's tspr manipulation. puke. +#define LIGHTRAD (s->yrepeat * tilesizy[s->picnum+(T5?(*(intptr_t *)T5) + *(((intptr_t *)T5)+2) * T4:0)]) + inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority) { #ifdef POLYMER @@ -603,21 +606,24 @@ inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, i mylight.priority = priority; ActorExtra[srcsprite].lightId = polymer_addlight(&mylight); - ActorExtra[srcsprite].lightptr = &prlights[ActorExtra[srcsprite].lightId]; + if (ActorExtra[srcsprite].lightId >= 0) + ActorExtra[srcsprite].lightptr = &prlights[ActorExtra[srcsprite].lightId]; return; } s->z -= zoffset; - if (radius != prlights[ActorExtra[srcsprite].lightId].radius || - range != prlights[ActorExtra[srcsprite].lightId].range || - Bmemcmp(&sprite[srcsprite], ActorExtra[srcsprite].lightptr, sizeof(int32_t) * 3)) + if (Bmemcmp(&sprite[srcsprite], ActorExtra[srcsprite].lightptr, sizeof(int32_t) * 3)) { Bmemcpy(ActorExtra[srcsprite].lightptr, &sprite[srcsprite], sizeof(int32_t) * 3); ActorExtra[srcsprite].lightptr->sector = s->sectnum; - ActorExtra[srcsprite].lightptr->radius = radius; - ActorExtra[srcsprite].lightptr->range = range; ActorExtra[srcsprite].lightptr->flags.invalidate = 1; } + + ActorExtra[srcsprite].lightptr->range = range; + ActorExtra[srcsprite].lightptr->color[0] = color&255; + ActorExtra[srcsprite].lightptr->color[1] = (color>>8)&255; + ActorExtra[srcsprite].lightptr->color[2] = (color>>16)&255; + s->z += zoffset; #else @@ -659,7 +665,7 @@ static void G_MoveZombieActors(void) case FLOORFLAME__STATIC: case FIREBARREL__STATIC: case FIREVASE__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 4096, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); break; case ATOMICHEALTH__STATIC: G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); @@ -671,7 +677,7 @@ static void G_MoveZombieActors(void) if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; if (s->z > ActorExtra[i].floorz+2048) break; */ - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->xrepeat, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); break; case BURNING__STATIC: case BURNING2__STATIC: @@ -679,7 +685,7 @@ static void G_MoveZombieActors(void) if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; if (s->z > ActorExtra[i].floorz + 2048) break; */ - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->xrepeat, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); break; case EXPLOSION2__STATIC: @@ -2244,7 +2250,7 @@ CLEAR_THE_BOLT: case FLOORFLAME__STATIC: case FIREBARREL__STATIC: case FIREVASE__STATIC: - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 4096, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); case EXPLODINGBARREL__STATIC: case WOODENHORSE__STATIC: case HORSEONSIDE__STATIC: @@ -3464,7 +3470,7 @@ static void G_MoveActors(void) if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; if (s->z > ActorExtra[i].floorz+2048) break; */ - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->xrepeat, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); break; case DUCK__STATIC: @@ -5219,7 +5225,7 @@ static void G_MoveMisc(void) // STATNUM 5 if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; if (s->z > ActorExtra[i].floorz + 2048) break; */ - G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME); break; case EXPLOSION2__STATIC: @@ -7627,7 +7633,8 @@ static void G_MoveEffectors(void) //STATNUM 3 mylight.priority = PR_LIGHT_PRIO_MAX; ActorExtra[i].lightId = polymer_addlight(&mylight); - ActorExtra[i].lightptr = &prlights[ActorExtra[i].lightId]; + if (ActorExtra[i].lightId >= 0) + ActorExtra[i].lightptr = &prlights[ActorExtra[i].lightId]; break; } @@ -7680,7 +7687,8 @@ static void G_MoveEffectors(void) //STATNUM 3 mylight.priority = PR_LIGHT_PRIO_MAX; ActorExtra[i].lightId = polymer_addlight(&mylight); - ActorExtra[i].lightptr = &prlights[ActorExtra[i].lightId]; + if (ActorExtra[i].lightId >= 0) + ActorExtra[i].lightptr = &prlights[ActorExtra[i].lightId]; break; } @@ -7910,7 +7918,6 @@ void G_MoveWorld(void) G_MoveStandables(); //ST 6 - if (apScriptGameEvent[EVENT_GAME]) { int32_t i, p, j, k = MAXSTATUS-1, pl; @@ -7920,7 +7927,95 @@ void G_MoveWorld(void) while (i >= 0) { - if (A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE)) +#ifdef POLYMER + if (getrendermode() == 4) + { + if(ActorExtra[i].lightptr != NULL && ActorExtra[i].lightcount) + { + if (!(--ActorExtra[i].lightcount)) + { + polymer_deletelight(ActorExtra[i].lightId); + ActorExtra[i].lightId = -1; + ActorExtra[i].lightptr = NULL; + } + } + + switch (DynamicTileMap[sprite[i].picnum-1]) + { + case DIPSWITCH__STATIC: + case DIPSWITCH2__STATIC: + case DIPSWITCH3__STATIC: + case PULLSWITCH__STATIC: + case SLOTDOOR__STATIC: + case LIGHTSWITCH__STATIC: + case SPACELIGHTSWITCH__STATIC: + case SPACEDOORSWITCH__STATIC: + case FRANKENSTINESWITCH__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case TECHSWITCH__STATIC: + case ACCESSSWITCH__STATIC: + case ACCESSSWITCH2__STATIC: + { + spritetype *s = &sprite[i]; + int32_t x, y; + + if (!inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) + break; + + x = ((sintable[(s->ang+512)&2047])>>7); + y = ((sintable[(s->ang)&2047])>>7); + + s->x += x; + s->y += y; + + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 48+(255<<8)+(48<<16),PR_LIGHT_PRIO_LOW_GAME); + s->x -= x; + s->y -= y; + } + break; + } + switch (DynamicTileMap[sprite[i].picnum]) + { + case DIPSWITCH__STATIC: + case DIPSWITCH2__STATIC: + case DIPSWITCH3__STATIC: + case PULLSWITCH__STATIC: + case SLOTDOOR__STATIC: + case LIGHTSWITCH__STATIC: + case SPACELIGHTSWITCH__STATIC: + case SPACEDOORSWITCH__STATIC: + case FRANKENSTINESWITCH__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case TECHSWITCH__STATIC: + case ACCESSSWITCH__STATIC: + case ACCESSSWITCH2__STATIC: + { + spritetype *s = &sprite[i]; + int32_t x, y; + + if (!inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum)) + break; + + x = ((sintable[(s->ang+512)&2047])>>7); + y = ((sintable[(s->ang)&2047])>>7); + + s->x += x; + s->y += y; + + G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 1024, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW_GAME); + s->x -= x; + s->y -= y; + } + break; + } + } +#endif + + if (!apScriptGameEvent[EVENT_GAME] || A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE)) { i = nextspritestat[i]; continue; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index b5f2a9ced..6f4fff043 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -7426,87 +7426,8 @@ PALONLY: } } -#ifdef POLYMER - switch (DynamicTileMap[s->picnum-1]) - { - case DIPSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case DIPSWITCH3__STATIC: - case PULLSWITCH__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - case TECHSWITCH__STATIC: - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - if (!inside(t->x+((sintable[(t->ang+512)&2047])>>9), t->y+((sintable[(t->ang)&2047])>>9), t->sectnum)) - break; - framelights[framelightcount & (PR_MAXLIGHTS-1)].radius = 0; - framelights[framelightcount & (PR_MAXLIGHTS-1)].sector = t->sectnum; - - framelights[framelightcount & (PR_MAXLIGHTS-1)].x = t->x+((sintable[(t->ang+512)&2047])>>7); - framelights[framelightcount & (PR_MAXLIGHTS-1)].y = t->y+((sintable[(t->ang)&2047])>>7); - framelights[framelightcount & (PR_MAXLIGHTS-1)].z = t->z-((t->yrepeat*tilesizy[t->picnum])<<1); - - framelights[framelightcount & (PR_MAXLIGHTS-1)].range = 1024; - - framelights[framelightcount & (PR_MAXLIGHTS-1)].color[0] = 48; - framelights[framelightcount & (PR_MAXLIGHTS-1)].color[1] = 255; - framelights[framelightcount & (PR_MAXLIGHTS-1)].color[2] = 48; - - framelights[framelightcount & (PR_MAXLIGHTS-1)].priority = PR_LIGHT_PRIO_LOW_GAME; - - if (framelightcount < PR_MAXLIGHTS) - framelightcount++; - - break; - } -#endif switch (DynamicTileMap[s->picnum]) { -#ifdef POLYMER - case DIPSWITCH__STATIC: - case DIPSWITCH2__STATIC: - case DIPSWITCH3__STATIC: - case PULLSWITCH__STATIC: - case SLOTDOOR__STATIC: - case LIGHTSWITCH__STATIC: - case SPACELIGHTSWITCH__STATIC: - case SPACEDOORSWITCH__STATIC: - case FRANKENSTINESWITCH__STATIC: - case POWERSWITCH1__STATIC: - case LOCKSWITCH1__STATIC: - case POWERSWITCH2__STATIC: - case TECHSWITCH__STATIC: - case ACCESSSWITCH__STATIC: - case ACCESSSWITCH2__STATIC: - if (!inside(t->x+((sintable[(t->ang+512)&2047])>>9), t->y+((sintable[(t->ang)&2047])>>9), t->sectnum)) - break; - framelights[framelightcount & (PR_MAXLIGHTS-1)].radius = 0; - framelights[framelightcount & (PR_MAXLIGHTS-1)].sector = t->sectnum; - - framelights[framelightcount & (PR_MAXLIGHTS-1)].x = t->x+((sintable[(t->ang+512)&2047])>>7); - framelights[framelightcount & (PR_MAXLIGHTS-1)].y = t->y+((sintable[(t->ang)&2047])>>7); - framelights[framelightcount & (PR_MAXLIGHTS-1)].z = t->z-((t->yrepeat*tilesizy[t->picnum])<<1); - - framelights[framelightcount & (PR_MAXLIGHTS-1)].range = 1024; - - framelights[framelightcount & (PR_MAXLIGHTS-1)].color[0] = 255; - framelights[framelightcount & (PR_MAXLIGHTS-1)].color[1] = 48; - framelights[framelightcount & (PR_MAXLIGHTS-1)].color[2] = 48; - - framelights[framelightcount & (PR_MAXLIGHTS-1)].priority = PR_LIGHT_PRIO_LOW_GAME; - - if (framelightcount < PR_MAXLIGHTS) - framelightcount++; - - break; -#endif case LASERLINE__STATIC: if (sector[t->sectnum].lotag == 2) t->pal = 8; t->z = sprite[s->owner].z-(3<<8); diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 08daab085..3eedc2a25 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -4541,18 +4541,6 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist) vm.g_t[3] = 0; } -#ifdef POLYMER - if (getrendermode() == 4 && ActorExtra[vm.g_i].lightptr != NULL && ActorExtra[vm.g_i].lightcount) - { - if (!(--ActorExtra[vm.g_i].lightcount)) - { - polymer_deletelight(ActorExtra[vm.g_i].lightId); - ActorExtra[vm.g_i].lightId = -1; - ActorExtra[vm.g_i].lightptr = NULL; - } - } -#endif - while (!X_DoExecute()); if (vm.g_killitFlag == 1) diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 89a717472..ad26d0946 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -803,6 +803,24 @@ void onvideomodechange(int32_t newmode) pal = g_player[screenpeek].ps->palette; } +#ifdef POLYMER + if (getrendermode() == 4) + { + int32_t i = 0; + + while (i < MAXSPRITES) + { + if (ActorExtra[i].lightptr) + { + polymer_deletelight(ActorExtra[i].lightId); + ActorExtra[i].lightptr = NULL; + ActorExtra[i].lightId = -1; + } + i++; + } + } +#endif + setbrightness(ud.brightness>>2, pal, 0); g_restorePalette = 1; g_crosshairSum = 0; diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index e3400480e..9585e93b3 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2195,13 +2195,7 @@ void P_FireWeapon(DukePlayer_t *p) #ifdef POLYMER spritetype *s = &sprite[p->i]; int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7); -#endif // POLYMER - - lastvisinc = totalclock+32; - p->visibility = 0; - -#ifdef POLYMER s->x += x; s->y += y; G_AddGameLight(0, p->i, PHEIGHT, 8192, aplWeaponFlashColor[p->curr_weapon][snum],PR_LIGHT_PRIO_MAX_GAME); @@ -2231,6 +2225,8 @@ void P_FireWeapon(DukePlayer_t *p) gamelightcount++; */ #endif // POLYMER + lastvisinc = totalclock+32; + p->visibility = 0; } /* if( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_CHECKATRELOAD) && diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index e82b853d6..74c9605e9 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -242,8 +242,8 @@ int32_t G_LoadPlayer(int32_t spot) if (kdfread(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt; #ifdef POLYMER - if (kdfread(&staticlightcount,sizeof(staticlightcount),1,fil) != 1) goto corrupt; - if (kdfread(&staticlights[0],sizeof(_prlight),staticlightcount,fil) != staticlightcount) goto corrupt; + if (kdfread(&lightcount,sizeof(lightcount),1,fil) != 1) goto corrupt; + if (kdfread(&prlights[0],sizeof(_prlight),lightcount,fil) != lightcount) goto corrupt; #else if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt; #endif // POLYMER @@ -688,8 +688,8 @@ int32_t G_SavePlayer(int32_t spot) dfwrite(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil); #ifdef POLYMER - dfwrite(&staticlightcount,sizeof(staticlightcount),1,fil); - dfwrite(&staticlights[0],sizeof(_prlight),staticlightcount,fil); + dfwrite(&lightcount,sizeof(lightcount),1,fil); + dfwrite(&prlights[0],sizeof(_prlight),lightcount,fil); #else i = 0; dfwrite(&i,sizeof(int32_t),1,fil);