Fix rendmode != 4 SE light crashes

git-svn-id: https://svn.eduke32.com/eduke32@1423 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-06-08 00:31:53 +00:00
parent 4e635849e1
commit 9973478a9d
3 changed files with 104 additions and 105 deletions

View file

@ -338,7 +338,7 @@ static void polymer_compileprogram(int32_t programbits);
static void polymer_removelight(int16_t lighti);
static void polymer_updatelights(void);
static void polymer_resetlights(void);
static void polymer_resetplanelights(_prplane* plane);
static inline void polymer_resetplanelights(_prplane* plane);
static void polymer_addplanelight(_prplane* plane, int16_t lighti);
static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti);
static int32_t polymer_planeinlight(_prplane* plane, _prlight* light);

View file

@ -4275,17 +4275,9 @@ static void polymer_resetlights(void)
lightcount = 0;
}
static void polymer_resetplanelights(_prplane* plane)
static inline void polymer_resetplanelights(_prplane* plane)
{
int32_t i;
i = 0;
while (i < PR_MAXLIGHTS)
{
plane->lights[i] = -1;
i++;
}
Bmemset(&plane->lights[0], -1, sizeof(plane->lights[0]) * PR_MAXLIGHTS);
plane->lightcount = 0;
}
@ -4327,8 +4319,8 @@ static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti)
{
int16_t i;
i = 0;
while (i < plane->lightcount)
i = plane->lightcount-1;
while (i >= 0)
{
if (plane->lights[i] == lighti)
{
@ -4338,7 +4330,7 @@ static inline void polymer_deleteplanelight(_prplane* plane, int16_t lighti)
plane->lightcount--;
return;
}
i++;
i--;
}
}
@ -4517,7 +4509,7 @@ static inline void polymer_culllight(int16_t lighti)
zdiff = -zdiff;
zdiff >>= 4;
if (!light->radius && !sec->floorheinum) {
if (!light->radius && !(sec->floorstat & 1)) {
if (zdiff < light->range)
polymer_addplanelight(&s->floor, lighti);
} else if (polymer_planeinlight(&s->floor, light))
@ -4528,7 +4520,7 @@ static inline void polymer_culllight(int16_t lighti)
zdiff = -zdiff;
zdiff >>= 4;
if (!light->radius && !sec->ceilingheinum) {
if (!light->radius && !(sec->ceilingstat & 1)) {
if (zdiff < light->range)
polymer_addplanelight(&s->ceil, lighti);
} else if (polymer_planeinlight(&s->ceil, light))

View file

@ -588,10 +588,11 @@ static void ms(int32_t i)
inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority)
{
#ifdef POLYMER
if (rendmode != 4)
spritetype *s = &sprite[srcsprite];
if (getrendermode() != 4)
return;
spritetype *s = &sprite[srcsprite];
if (ActorExtra[srcsprite].lightptr == NULL)
{
_prlight mylight;
@ -7601,6 +7602,8 @@ static void G_MoveEffectors(void) //STATNUM 3
break;
#ifdef POLYMER
case 49:
{
if (getrendermode() == 4)
{
if (ActorExtra[i].lightptr == NULL)
{
@ -7651,9 +7654,12 @@ static void G_MoveEffectors(void) //STATNUM 3
ActorExtra[i].lightptr->sector = sprite[i].sectnum;
ActorExtra[i].lightptr->flags.invalidate = 1;
}
}
break;
}
case 50:
{
if (getrendermode() == 4)
{
if (ActorExtra[i].lightptr == NULL)
{
@ -7705,6 +7711,7 @@ static void G_MoveEffectors(void) //STATNUM 3
ActorExtra[i].lightptr->sector = sprite[i].sectnum;
ActorExtra[i].lightptr->flags.invalidate = 1;
}
}
break;
}