More light stuff... most gameland lights should be working again now

git-svn-id: https://svn.eduke32.com/eduke32@1409 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-06-06 22:30:53 +00:00
parent 0688522507
commit 0744452216
10 changed files with 167 additions and 179 deletions

View file

@ -151,7 +151,7 @@ typedef struct s_prprogrambit {
} _prprogrambit; } _prprogrambit;
// LIGHTS // LIGHTS
#define PR_MAXLIGHTS 128 #define PR_MAXLIGHTS 256
#define SHADOW_DEPTH_OFFSET 30 #define SHADOW_DEPTH_OFFSET 30
#define PR_MAXLIGHTPRIORITY 6 #define PR_MAXLIGHTPRIORITY 6
@ -172,19 +172,16 @@ typedef struct s_prlight {
int32_t isinview : 1; int32_t isinview : 1;
} flags; } flags;
GLuint lightmap; GLuint lightmap;
void* myplanes[PR_MAXLIGHTS<<1];
int32_t planecnt;
} _prlight; } _prlight;
extern _prlight prlights[PR_MAXLIGHTS]; extern _prlight prlights[PR_MAXLIGHTS];
extern int32_t lightcount;
extern _prlight staticlights[PR_MAXLIGHTS];
extern int32_t staticlightcount;
extern _prlight gamelights[PR_MAXLIGHTS]; extern _prlight gamelights[PR_MAXLIGHTS];
extern int32_t gamelightcount; extern int32_t gamelightcount;
extern _prlight framelights[PR_MAXLIGHTS];
extern int32_t framelightcount;
// RENDER TARGETS // RENDER TARGETS
typedef struct s_prrt { typedef struct s_prrt {
GLenum target; GLenum target;
@ -338,7 +335,7 @@ static void polymer_updatelights(void);
static void polymer_resetlights(void); static void polymer_resetlights(void);
static void polymer_resetplanelights(_prplane* plane); static void polymer_resetplanelights(_prplane* plane);
static void polymer_addplanelight(_prplane* plane, int16_t lighti); 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 int32_t polymer_planeinlight(_prplane* plane, _prlight* light);
static void polymer_invalidateplanelights(_prplane* plane); static void polymer_invalidateplanelights(_prplane* plane);
static void polymer_invalidatesectorlights(int16_t sectnum); static void polymer_invalidatesectorlights(int16_t sectnum);

View file

@ -781,9 +781,6 @@ void editinput(void)
{ {
memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES);
memset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID)); memset(spritesmooth, 0, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID));
#ifdef POLYMER
staticlightcount = 0;
#endif
mhk=0; mhk=0;
initprintf("Maphacks disabled\n"); initprintf("Maphacks disabled\n");
keystatus[0x44] = 0; keystatus[0x44] = 0;

View file

@ -6731,10 +6731,6 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo
clearbufbyte(&sprite, sizeof(sprite), 0); clearbufbyte(&sprite, sizeof(sprite), 0);
*/ */
#ifdef POLYMER
staticlightcount = 0;
#endif // POLYMER
initspritelists(); initspritelists();

View file

@ -136,15 +136,9 @@ int32_t lightcount;
int32_t curlight; int32_t curlight;
int32_t curlightcount; int32_t curlightcount;
_prlight staticlights[PR_MAXLIGHTS];
int32_t staticlightcount;
_prlight gamelights[PR_MAXLIGHTS]; _prlight gamelights[PR_MAXLIGHTS];
int32_t gamelightcount; int32_t gamelightcount;
_prlight framelights[PR_MAXLIGHTS];
int32_t framelightcount;
static GLfloat shadowBias[] = static GLfloat shadowBias[] =
{ {
0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0,
@ -4152,38 +4146,20 @@ static void polymer_compileprogram(int32_t programbits)
static void polymer_removelight(int16_t lighti) static void polymer_removelight(int16_t lighti)
{ {
int32_t i; int32_t i;
_prsector *s;
_prwall *w;
// XXX: might need to store a list of affected planes in the light record // XXX: might need to store a list of affected planes in the light record
// if this loop ends up consuming too much cycles // if this loop ends up consuming too much cycles
i = 0; i = prlights[lighti].planecnt-1;
while (i < numsectors) while (i >= 0)
{ {
s = prsectors[i]; polymer_deleteplanelight(prlights[lighti].myplanes[i], lighti);
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_updatelights(void) static void polymer_updatelights(void)
{ {
int32_t i; int32_t i = 0;
while (i < PR_MAXLIGHTS) while (i < PR_MAXLIGHTS)
{ {
@ -4261,31 +4237,30 @@ static void polymer_addplanelight(_prplane* plane, int16_t lighti)
{ {
int16_t i; int16_t i;
if (plane->lightcount == PR_MAXLIGHTS) if (plane->lightcount == PR_MAXLIGHTS-1 || prlights[lighti].planecnt == (PR_MAXLIGHTS<<1)-1)
return; return;
i = 0; i = 0;
while (i < PR_MAXLIGHTS) 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; break;
if (plane->lights[i] == -1) 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->lights[i] = lighti;
plane->lightcount++; plane->lightcount++;
prlights[lighti].myplanes[prlights[lighti].planecnt] = plane;
prlights[lighti].planecnt++;
return; return;
} }
i++; 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; int16_t i;
@ -4294,7 +4269,9 @@ static void polymer_deleteplanelight(_prplane* plane, int16_t lighti)
{ {
if (plane->lights[i] == 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--; plane->lightcount--;
return; return;
} }
@ -4459,6 +4436,9 @@ static inline void polymer_culllight(int16_t lighti)
Bmemset(drawingstate, 0, sizeof(int16_t) * numsectors); Bmemset(drawingstate, 0, sizeof(int16_t) * numsectors);
drawingstate[light->sector] = 1; drawingstate[light->sector] = 1;
prlights[lighti].planecnt = 0;
Bmemset(prlights[lighti].myplanes, 0, sizeof(intptr_t) * (PR_MAXLIGHTS<<1));
sectorqueue[0] = light->sector; sectorqueue[0] = light->sector;
while (front != back) while (front != back)

View file

@ -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) inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority)
{ {
#ifdef POLYMER #ifdef POLYMER
@ -603,21 +606,24 @@ inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, i
mylight.priority = priority; mylight.priority = priority;
ActorExtra[srcsprite].lightId = polymer_addlight(&mylight); 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; return;
} }
s->z -= zoffset; s->z -= zoffset;
if (radius != prlights[ActorExtra[srcsprite].lightId].radius || if (Bmemcmp(&sprite[srcsprite], ActorExtra[srcsprite].lightptr, sizeof(int32_t) * 3))
range != prlights[ActorExtra[srcsprite].lightId].range ||
Bmemcmp(&sprite[srcsprite], ActorExtra[srcsprite].lightptr, sizeof(int32_t) * 3))
{ {
Bmemcpy(ActorExtra[srcsprite].lightptr, &sprite[srcsprite], sizeof(int32_t) * 3); Bmemcpy(ActorExtra[srcsprite].lightptr, &sprite[srcsprite], sizeof(int32_t) * 3);
ActorExtra[srcsprite].lightptr->sector = s->sectnum; 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->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; s->z += zoffset;
#else #else
@ -659,7 +665,7 @@ static void G_MoveZombieActors(void)
case FLOORFLAME__STATIC: case FLOORFLAME__STATIC:
case FIREBARREL__STATIC: case FIREBARREL__STATIC:
case FIREVASE__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; break;
case ATOMICHEALTH__STATIC: case ATOMICHEALTH__STATIC:
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME); 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 (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
if (s->z > ActorExtra[i].floorz+2048) 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; break;
case BURNING__STATIC: case BURNING__STATIC:
case BURNING2__STATIC: case BURNING2__STATIC:
@ -679,7 +685,7 @@ static void G_MoveZombieActors(void)
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
if (s->z > ActorExtra[i].floorz + 2048) 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; break;
case EXPLOSION2__STATIC: case EXPLOSION2__STATIC:
@ -2244,7 +2250,7 @@ CLEAR_THE_BOLT:
case FLOORFLAME__STATIC: case FLOORFLAME__STATIC:
case FIREBARREL__STATIC: case FIREBARREL__STATIC:
case FIREVASE__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 EXPLODINGBARREL__STATIC:
case WOODENHORSE__STATIC: case WOODENHORSE__STATIC:
case HORSEONSIDE__STATIC: case HORSEONSIDE__STATIC:
@ -3464,7 +3470,7 @@ static void G_MoveActors(void)
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
if (s->z > ActorExtra[i].floorz+2048) 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; break;
case DUCK__STATIC: case DUCK__STATIC:
@ -5219,7 +5225,7 @@ static void G_MoveMisc(void) // STATNUM 5
if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break;
if (s->z > ActorExtra[i].floorz + 2048) 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; break;
case EXPLOSION2__STATIC: case EXPLOSION2__STATIC:
@ -7627,7 +7633,8 @@ static void G_MoveEffectors(void) //STATNUM 3
mylight.priority = PR_LIGHT_PRIO_MAX; mylight.priority = PR_LIGHT_PRIO_MAX;
ActorExtra[i].lightId = polymer_addlight(&mylight); 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; break;
} }
@ -7680,7 +7687,8 @@ static void G_MoveEffectors(void) //STATNUM 3
mylight.priority = PR_LIGHT_PRIO_MAX; mylight.priority = PR_LIGHT_PRIO_MAX;
ActorExtra[i].lightId = polymer_addlight(&mylight); 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; break;
} }
@ -7910,7 +7918,6 @@ void G_MoveWorld(void)
G_MoveStandables(); //ST 6 G_MoveStandables(); //ST 6
if (apScriptGameEvent[EVENT_GAME])
{ {
int32_t i, p, j, k = MAXSTATUS-1, pl; int32_t i, p, j, k = MAXSTATUS-1, pl;
@ -7920,7 +7927,95 @@ void G_MoveWorld(void)
while (i >= 0) 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]; i = nextspritestat[i];
continue; continue;

View file

@ -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]) 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: case LASERLINE__STATIC:
if (sector[t->sectnum].lotag == 2) t->pal = 8; if (sector[t->sectnum].lotag == 2) t->pal = 8;
t->z = sprite[s->owner].z-(3<<8); t->z = sprite[s->owner].z-(3<<8);

View file

@ -4541,18 +4541,6 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
vm.g_t[3] = 0; 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()); while (!X_DoExecute());
if (vm.g_killitFlag == 1) if (vm.g_killitFlag == 1)

View file

@ -803,6 +803,24 @@ void onvideomodechange(int32_t newmode)
pal = g_player[screenpeek].ps->palette; 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); setbrightness(ud.brightness>>2, pal, 0);
g_restorePalette = 1; g_restorePalette = 1;
g_crosshairSum = 0; g_crosshairSum = 0;

View file

@ -2195,13 +2195,7 @@ void P_FireWeapon(DukePlayer_t *p)
#ifdef POLYMER #ifdef POLYMER
spritetype *s = &sprite[p->i]; spritetype *s = &sprite[p->i];
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7); 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->x += x;
s->y += y; s->y += y;
G_AddGameLight(0, p->i, PHEIGHT, 8192, aplWeaponFlashColor[p->curr_weapon][snum],PR_LIGHT_PRIO_MAX_GAME); 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++; gamelightcount++;
*/ */
#endif // POLYMER #endif // POLYMER
lastvisinc = totalclock+32;
p->visibility = 0;
} }
/* if( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_CHECKATRELOAD) && /* if( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_CHECKATRELOAD) &&

View file

@ -242,8 +242,8 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt; if (kdfread(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
#ifdef POLYMER #ifdef POLYMER
if (kdfread(&staticlightcount,sizeof(staticlightcount),1,fil) != 1) goto corrupt; if (kdfread(&lightcount,sizeof(lightcount),1,fil) != 1) goto corrupt;
if (kdfread(&staticlights[0],sizeof(_prlight),staticlightcount,fil) != staticlightcount) goto corrupt; if (kdfread(&prlights[0],sizeof(_prlight),lightcount,fil) != lightcount) goto corrupt;
#else #else
if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt; if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt;
#endif // POLYMER #endif // POLYMER
@ -688,8 +688,8 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil); dfwrite(&spriteext[0],sizeof(spriteext_t),MAXSPRITES,fil);
#ifdef POLYMER #ifdef POLYMER
dfwrite(&staticlightcount,sizeof(staticlightcount),1,fil); dfwrite(&lightcount,sizeof(lightcount),1,fil);
dfwrite(&staticlights[0],sizeof(_prlight),staticlightcount,fil); dfwrite(&prlights[0],sizeof(_prlight),lightcount,fil);
#else #else
i = 0; i = 0;
dfwrite(&i,sizeof(int32_t),1,fil); dfwrite(&i,sizeof(int32_t),1,fil);