mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
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:
parent
4e635849e1
commit
9973478a9d
3 changed files with 104 additions and 105 deletions
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
@ -7602,108 +7603,114 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
#ifdef POLYMER
|
||||
case 49:
|
||||
{
|
||||
if (ActorExtra[i].lightptr == NULL)
|
||||
if (getrendermode() == 4)
|
||||
{
|
||||
_prlight mylight;
|
||||
if (ActorExtra[i].lightptr == NULL)
|
||||
{
|
||||
_prlight mylight;
|
||||
|
||||
mylight.sector = SECT;
|
||||
mylight.x = SX;
|
||||
mylight.y = SY;
|
||||
mylight.z = SZ;
|
||||
mylight.range = SHT;
|
||||
if ((sprite[i].xvel | sprite[i].yvel | sprite[i].zvel) != 0)
|
||||
{
|
||||
mylight.color[0] = sprite[i].xvel;
|
||||
mylight.color[1] = sprite[i].yvel;
|
||||
mylight.color[2] = sprite[i].zvel;
|
||||
}
|
||||
else
|
||||
{
|
||||
mylight.color[0] = hictinting[PL].r;
|
||||
mylight.color[1] = hictinting[PL].g;
|
||||
mylight.color[2] = hictinting[PL].b;
|
||||
}
|
||||
mylight.radius = 0;
|
||||
mylight.angle = SA;
|
||||
mylight.horiz = SH;
|
||||
mylight.minshade = sprite[i].xoffset;
|
||||
mylight.maxshade = sprite[i].yoffset;
|
||||
|
||||
if (CS & 2)
|
||||
{
|
||||
if (CS & 512)
|
||||
mylight.priority = PR_LIGHT_PRIO_LOW;
|
||||
mylight.sector = SECT;
|
||||
mylight.x = SX;
|
||||
mylight.y = SY;
|
||||
mylight.z = SZ;
|
||||
mylight.range = SHT;
|
||||
if ((sprite[i].xvel | sprite[i].yvel | sprite[i].zvel) != 0)
|
||||
{
|
||||
mylight.color[0] = sprite[i].xvel;
|
||||
mylight.color[1] = sprite[i].yvel;
|
||||
mylight.color[2] = sprite[i].zvel;
|
||||
}
|
||||
else
|
||||
mylight.priority = PR_LIGHT_PRIO_HIGH;
|
||||
{
|
||||
mylight.color[0] = hictinting[PL].r;
|
||||
mylight.color[1] = hictinting[PL].g;
|
||||
mylight.color[2] = hictinting[PL].b;
|
||||
}
|
||||
mylight.radius = 0;
|
||||
mylight.angle = SA;
|
||||
mylight.horiz = SH;
|
||||
mylight.minshade = sprite[i].xoffset;
|
||||
mylight.maxshade = sprite[i].yoffset;
|
||||
|
||||
if (CS & 2)
|
||||
{
|
||||
if (CS & 512)
|
||||
mylight.priority = PR_LIGHT_PRIO_LOW;
|
||||
else
|
||||
mylight.priority = PR_LIGHT_PRIO_HIGH;
|
||||
}
|
||||
else
|
||||
mylight.priority = PR_LIGHT_PRIO_MAX;
|
||||
|
||||
ActorExtra[i].lightId = polymer_addlight(&mylight);
|
||||
if (ActorExtra[i].lightId >= 0)
|
||||
ActorExtra[i].lightptr = &prlights[ActorExtra[i].lightId];
|
||||
break;
|
||||
}
|
||||
else
|
||||
mylight.priority = PR_LIGHT_PRIO_MAX;
|
||||
|
||||
ActorExtra[i].lightId = polymer_addlight(&mylight);
|
||||
if (ActorExtra[i].lightId >= 0)
|
||||
ActorExtra[i].lightptr = &prlights[ActorExtra[i].lightId];
|
||||
break;
|
||||
}
|
||||
|
||||
if (Bmemcmp(&sprite[i], ActorExtra[i].lightptr, sizeof(int32_t) * 3))
|
||||
{
|
||||
Bmemcpy(ActorExtra[i].lightptr, &sprite[i], sizeof(int32_t) * 3);
|
||||
ActorExtra[i].lightptr->sector = sprite[i].sectnum;
|
||||
ActorExtra[i].lightptr->flags.invalidate = 1;
|
||||
if (Bmemcmp(&sprite[i], ActorExtra[i].lightptr, sizeof(int32_t) * 3))
|
||||
{
|
||||
Bmemcpy(ActorExtra[i].lightptr, &sprite[i], sizeof(int32_t) * 3);
|
||||
ActorExtra[i].lightptr->sector = sprite[i].sectnum;
|
||||
ActorExtra[i].lightptr->flags.invalidate = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 50:
|
||||
{
|
||||
if (ActorExtra[i].lightptr == NULL)
|
||||
if (getrendermode() == 4)
|
||||
{
|
||||
_prlight mylight;
|
||||
if (ActorExtra[i].lightptr == NULL)
|
||||
{
|
||||
_prlight mylight;
|
||||
|
||||
mylight.sector = SECT;
|
||||
mylight.x = SX;
|
||||
mylight.y = SY;
|
||||
mylight.z = SZ;
|
||||
mylight.range = SHT;
|
||||
if ((sprite[i].xvel | sprite[i].yvel | sprite[i].zvel) != 0)
|
||||
{
|
||||
mylight.color[0] = sprite[i].xvel;
|
||||
mylight.color[1] = sprite[i].yvel;
|
||||
mylight.color[2] = sprite[i].zvel;
|
||||
}
|
||||
else
|
||||
{
|
||||
mylight.color[0] = hictinting[PL].r;
|
||||
mylight.color[1] = hictinting[PL].g;
|
||||
mylight.color[2] = hictinting[PL].b;
|
||||
}
|
||||
mylight.radius = (256-(SS+128))<<1;
|
||||
mylight.faderadius = (int16_t)(mylight.radius * 0.75);
|
||||
mylight.angle = SA;
|
||||
mylight.horiz = SH;
|
||||
mylight.minshade = sprite[i].xoffset;
|
||||
mylight.maxshade = sprite[i].yoffset;
|
||||
|
||||
if (CS & 2)
|
||||
{
|
||||
if (CS & 512)
|
||||
mylight.priority = PR_LIGHT_PRIO_LOW;
|
||||
mylight.sector = SECT;
|
||||
mylight.x = SX;
|
||||
mylight.y = SY;
|
||||
mylight.z = SZ;
|
||||
mylight.range = SHT;
|
||||
if ((sprite[i].xvel | sprite[i].yvel | sprite[i].zvel) != 0)
|
||||
{
|
||||
mylight.color[0] = sprite[i].xvel;
|
||||
mylight.color[1] = sprite[i].yvel;
|
||||
mylight.color[2] = sprite[i].zvel;
|
||||
}
|
||||
else
|
||||
mylight.priority = PR_LIGHT_PRIO_HIGH;
|
||||
{
|
||||
mylight.color[0] = hictinting[PL].r;
|
||||
mylight.color[1] = hictinting[PL].g;
|
||||
mylight.color[2] = hictinting[PL].b;
|
||||
}
|
||||
mylight.radius = (256-(SS+128))<<1;
|
||||
mylight.faderadius = (int16_t)(mylight.radius * 0.75);
|
||||
mylight.angle = SA;
|
||||
mylight.horiz = SH;
|
||||
mylight.minshade = sprite[i].xoffset;
|
||||
mylight.maxshade = sprite[i].yoffset;
|
||||
|
||||
if (CS & 2)
|
||||
{
|
||||
if (CS & 512)
|
||||
mylight.priority = PR_LIGHT_PRIO_LOW;
|
||||
else
|
||||
mylight.priority = PR_LIGHT_PRIO_HIGH;
|
||||
}
|
||||
else
|
||||
mylight.priority = PR_LIGHT_PRIO_MAX;
|
||||
|
||||
ActorExtra[i].lightId = polymer_addlight(&mylight);
|
||||
if (ActorExtra[i].lightId >= 0)
|
||||
ActorExtra[i].lightptr = &prlights[ActorExtra[i].lightId];
|
||||
break;
|
||||
}
|
||||
else
|
||||
mylight.priority = PR_LIGHT_PRIO_MAX;
|
||||
|
||||
ActorExtra[i].lightId = polymer_addlight(&mylight);
|
||||
if (ActorExtra[i].lightId >= 0)
|
||||
ActorExtra[i].lightptr = &prlights[ActorExtra[i].lightId];
|
||||
break;
|
||||
}
|
||||
|
||||
if (Bmemcmp(&sprite[i], ActorExtra[i].lightptr, sizeof(int32_t) * 3))
|
||||
{
|
||||
Bmemcpy(ActorExtra[i].lightptr, &sprite[i], sizeof(int32_t) * 3);
|
||||
ActorExtra[i].lightptr->sector = sprite[i].sectnum;
|
||||
ActorExtra[i].lightptr->flags.invalidate = 1;
|
||||
if (Bmemcmp(&sprite[i], ActorExtra[i].lightptr, sizeof(int32_t) * 3))
|
||||
{
|
||||
Bmemcpy(ActorExtra[i].lightptr, &sprite[i], sizeof(int32_t) * 3);
|
||||
ActorExtra[i].lightptr->sector = sprite[i].sectnum;
|
||||
ActorExtra[i].lightptr->flags.invalidate = 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue