mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- removed incomplete Polymer code from Blood.
Looks like this was abandoned - this was still mostly Duke3D code
This commit is contained in:
parent
218a9c84fd
commit
c7fca86cf5
1 changed files with 0 additions and 349 deletions
|
@ -6962,353 +6962,4 @@ void ActorLoadSaveConstruct(void)
|
|||
myLoadSave = new ActorLoadSave();
|
||||
}
|
||||
|
||||
#ifdef POLYMER
|
||||
|
||||
// this is the same crap as in game.c's tspr manipulation. puke.
|
||||
// XXX: may access tilesizy out-of-bounds by bad user code.
|
||||
#define LIGHTRAD(spriteNum, s) (s->yrepeat * tilesiz[s->picnum].y)
|
||||
#define LIGHTRAD2(spriteNum, s) ((s->yrepeat + ((rand() % s->yrepeat)>>2)) * tilesiz[s->picnum].y)
|
||||
|
||||
void G_AddGameLight(int lightRadius, int spriteNum, int zOffset, int lightRange, int lightColor, int lightPrio)
|
||||
{
|
||||
auto const s = &sprite[spriteNum];
|
||||
|
||||
if (videoGetRenderMode() != REND_POLYMER || pr_lighting != 1)
|
||||
return;
|
||||
|
||||
if (gPolymerLight[spriteNum].lightptr == NULL)
|
||||
{
|
||||
#pragma pack(push, 1)
|
||||
_prlight mylight;
|
||||
#pragma pack(pop)
|
||||
Bmemset(&mylight, 0, sizeof(mylight));
|
||||
|
||||
mylight.sector = s->sectnum;
|
||||
mylight.x = s->x;
|
||||
mylight.y = s->y;
|
||||
mylight.z = s->z - zOffset;
|
||||
mylight.color[0] = lightColor & 255;
|
||||
mylight.color[1] = (lightColor >> 8) & 255;
|
||||
mylight.color[2] = (lightColor >> 16) & 255;
|
||||
mylight.radius = lightRadius;
|
||||
gPolymerLight[spriteNum].lightmaxrange = mylight.range = lightRange;
|
||||
|
||||
mylight.priority = lightPrio;
|
||||
mylight.tilenum = 0;
|
||||
|
||||
mylight.publicflags.emitshadow = 1;
|
||||
mylight.publicflags.negative = 0;
|
||||
|
||||
gPolymerLight[spriteNum].lightId = polymer_addlight(&mylight);
|
||||
if (gPolymerLight[spriteNum].lightId >= 0)
|
||||
gPolymerLight[spriteNum].lightptr = &prlights[gPolymerLight[spriteNum].lightId];
|
||||
return;
|
||||
}
|
||||
|
||||
s->z -= zOffset;
|
||||
|
||||
if (lightRange<gPolymerLight[spriteNum].lightmaxrange>> 1)
|
||||
gPolymerLight[spriteNum].lightmaxrange = 0;
|
||||
|
||||
if (lightRange > gPolymerLight[spriteNum].lightmaxrange || lightPrio != gPolymerLight[spriteNum].lightptr->priority ||
|
||||
Bmemcmp(&sprite[spriteNum], gPolymerLight[spriteNum].lightptr, sizeof(int32_t) * 3))
|
||||
{
|
||||
if (lightRange > gPolymerLight[spriteNum].lightmaxrange)
|
||||
gPolymerLight[spriteNum].lightmaxrange = lightRange;
|
||||
|
||||
Bmemcpy(gPolymerLight[spriteNum].lightptr, &sprite[spriteNum], sizeof(int32_t) * 3);
|
||||
gPolymerLight[spriteNum].lightptr->sector = s->sectnum;
|
||||
gPolymerLight[spriteNum].lightptr->flags.invalidate = 1;
|
||||
}
|
||||
|
||||
gPolymerLight[spriteNum].lightptr->priority = lightPrio;
|
||||
gPolymerLight[spriteNum].lightptr->range = lightRange;
|
||||
gPolymerLight[spriteNum].lightptr->color[0] = lightColor & 255;
|
||||
gPolymerLight[spriteNum].lightptr->color[1] = (lightColor >> 8) & 255;
|
||||
gPolymerLight[spriteNum].lightptr->color[2] = (lightColor >> 16) & 255;
|
||||
|
||||
s->z += zOffset;
|
||||
}
|
||||
|
||||
void actDoLight(int nSprite)
|
||||
{
|
||||
auto const pSprite = &sprite[nSprite];
|
||||
int savedFires = 0;
|
||||
if (((sector[pSprite->sectnum].floorz - sector[pSprite->sectnum].ceilingz) < 16) || pSprite->z > sector[pSprite->sectnum].floorz)
|
||||
{
|
||||
if (gPolymerLight[nSprite].lightptr != NULL)
|
||||
DeleteLight(nSprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gPolymerLight[nSprite].lightptr != NULL && gPolymerLight[nSprite].lightcount)
|
||||
{
|
||||
if (!(--gPolymerLight[nSprite].lightcount))
|
||||
DeleteLight(nSprite);
|
||||
}
|
||||
|
||||
if (pr_lighting != 1)
|
||||
return;
|
||||
|
||||
switch (pSprite->statnum)
|
||||
{
|
||||
case kStatProjectile:
|
||||
switch (pSprite->type)
|
||||
{
|
||||
case kMissileTeslaRegular:
|
||||
{
|
||||
int32_t x = ((sintable[(pSprite->ang+512)&2047])>>6);
|
||||
int32_t y = ((sintable[(pSprite->ang)&2047])>>6);
|
||||
|
||||
pSprite->x -= x;
|
||||
pSprite->y -= y;
|
||||
|
||||
G_AddGameLight(0, nSprite, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 2048, 80+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
|
||||
pSprite->x += x;
|
||||
pSprite->y += y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case kStatExplosion:
|
||||
switch (pSprite->type)
|
||||
{
|
||||
default:
|
||||
if (!gPolymerLight[nSprite].lightcount)
|
||||
{
|
||||
// XXX: This block gets CODEDUP'd too much.
|
||||
int32_t x = ((sintable[(pSprite->ang+512)&2047])>>6);
|
||||
int32_t y = ((sintable[(pSprite->ang)&2047])>>6);
|
||||
|
||||
pSprite->x -= x;
|
||||
pSprite->y -= y;
|
||||
|
||||
G_AddGameLight(0, nSprite, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), LIGHTRAD(spriteNum, pSprite), 240+(160<<8)+(80<<16),
|
||||
pSprite->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME);
|
||||
|
||||
pSprite->x += x;
|
||||
pSprite->y += y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if (((sector[pSprite->sectnum].floorz - sector[pSprite->sectnum].ceilingz) < 16) || pSprite->z > sector[pSprite->sectnum].floorz || pSprite->z > actor[spriteNum].floorz ||
|
||||
(pSprite->picnum != SECTOREFFECTOR && ((pSprite->cstat & 32768) || pSprite->yrepeat < 4)) ||
|
||||
A_CheckSpriteFlags(spriteNum, SFLAG_NOLIGHT) || (A_CheckSpriteFlags(spriteNum, SFLAG_USEACTIVATOR) && sector[pSprite->sectnum].lotag & 16384))
|
||||
{
|
||||
if (actor[spriteNum].lightptr != NULL)
|
||||
A_DeleteLight(spriteNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actor[spriteNum].lightptr != NULL && actor[spriteNum].lightcount)
|
||||
{
|
||||
if (!(--actor[spriteNum].lightcount))
|
||||
A_DeleteLight(spriteNum);
|
||||
}
|
||||
|
||||
if (pr_lighting != 1)
|
||||
return;
|
||||
|
||||
#ifndef EDUKE32_STANDALONE
|
||||
for (int ii=0; ii<2; ii++)
|
||||
{
|
||||
if (pSprite->picnum <= 0) // oob safety
|
||||
break;
|
||||
|
||||
switch (DYNAMICTILEMAP(pSprite->picnum-1+ii))
|
||||
{
|
||||
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 ((pSprite->cstat & 32768) || A_CheckSpriteFlags(spriteNum, SFLAG_NOLIGHT))
|
||||
{
|
||||
if (actor[spriteNum].lightptr != NULL)
|
||||
A_DeleteLight(spriteNum);
|
||||
break;
|
||||
}
|
||||
|
||||
vec2_t const d = { sintable[(pSprite->ang+512)&2047]>>7, sintable[(pSprite->ang)&2047]>>7 };
|
||||
|
||||
pSprite->x += d.x;
|
||||
pSprite->y += d.y;
|
||||
|
||||
int16_t sectnum = pSprite->sectnum;
|
||||
updatesector(pSprite->x, pSprite->y, §num);
|
||||
|
||||
if ((unsigned) sectnum >= MAXSECTORS || pSprite->z > sector[sectnum].floorz || pSprite->z < sector[sectnum].ceilingz)
|
||||
goto POOP;
|
||||
|
||||
G_AddGameLight(0, spriteNum, (pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1, 512-ii*128,
|
||||
ii==0 ? (172+(200<<8)+(104<<16)) : 216+(52<<8)+(20<<16), PR_LIGHT_PRIO_LOW);
|
||||
|
||||
POOP:
|
||||
pSprite->x -= d.x;
|
||||
pSprite->y -= d.y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (DYNAMICTILEMAP(pSprite->picnum))
|
||||
{
|
||||
case ATOMICHEALTH__STATIC:
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), LIGHTRAD2(spriteNum, pSprite), 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case FIRE__STATIC:
|
||||
case FIRE2__STATIC:
|
||||
case BURNING__STATIC:
|
||||
case BURNING2__STATIC:
|
||||
{
|
||||
uint32_t color;
|
||||
int32_t jj;
|
||||
|
||||
static int32_t savedfires[32][4]; // sectnum x y z
|
||||
|
||||
/*
|
||||
if (Actor[i].floorz - Actor[i].ceilingz < 128) break;
|
||||
if (s->z > Actor[i].floorz+2048) break;
|
||||
*/
|
||||
|
||||
switch (pSprite->pal)
|
||||
{
|
||||
case 1: color = 128+(128<<8)+(255<<16); break;
|
||||
case 2: color = 255+(48<<8)+(48<<16); break;
|
||||
case 8: color = 48+(255<<8)+(48<<16); break;
|
||||
default: color = 240+(160<<8)+(80<<16); break;
|
||||
}
|
||||
|
||||
for (jj=savedFires-1; jj>=0; jj--)
|
||||
if (savedfires[jj][0]==pSprite->sectnum && savedfires[jj][1]==(pSprite->x>>3) &&
|
||||
savedfires[jj][2]==(pSprite->y>>3) && savedfires[jj][3]==(pSprite->z>>7))
|
||||
break;
|
||||
|
||||
if (jj==-1 && savedFires<32)
|
||||
{
|
||||
jj = savedFires;
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), LIGHTRAD2(spriteNum, pSprite), color, PR_LIGHT_PRIO_HIGH_GAME);
|
||||
savedfires[jj][0] = pSprite->sectnum;
|
||||
savedfires[jj][1] = pSprite->x>>3;
|
||||
savedfires[jj][2] = pSprite->y>>3;
|
||||
savedfires[jj][3] = pSprite->z>>7;
|
||||
savedFires++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OOZFILTER__STATIC:
|
||||
if (pSprite->xrepeat > 4)
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 4096, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case FLOORFLAME__STATIC:
|
||||
case FIREBARREL__STATIC:
|
||||
case FIREVASE__STATIC:
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<2), LIGHTRAD2(spriteNum, pSprite)>>1, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
|
||||
case EXPLOSION2__STATIC:
|
||||
if (!actor[spriteNum].lightcount)
|
||||
{
|
||||
// XXX: This block gets CODEDUP'd too much.
|
||||
int32_t x = ((sintable[(pSprite->ang+512)&2047])>>6);
|
||||
int32_t y = ((sintable[(pSprite->ang)&2047])>>6);
|
||||
|
||||
pSprite->x -= x;
|
||||
pSprite->y -= y;
|
||||
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), LIGHTRAD(spriteNum, pSprite), 240+(160<<8)+(80<<16),
|
||||
pSprite->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME);
|
||||
|
||||
pSprite->x += x;
|
||||
pSprite->y += y;
|
||||
}
|
||||
break;
|
||||
case FORCERIPPLE__STATIC:
|
||||
case TRANSPORTERBEAM__STATIC:
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), LIGHTRAD(spriteNum, pSprite), 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case GROWSPARK__STATIC:
|
||||
{
|
||||
int32_t x = ((sintable[(pSprite->ang+512)&2047])>>6);
|
||||
int32_t y = ((sintable[(pSprite->ang)&2047])>>6);
|
||||
|
||||
pSprite->x -= x;
|
||||
pSprite->y -= y;
|
||||
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 1024, 216+(52<<8)+(20<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
|
||||
pSprite->x += x;
|
||||
pSprite->y += y;
|
||||
}
|
||||
break;
|
||||
case SHRINKEREXPLOSION__STATIC:
|
||||
{
|
||||
int32_t x = ((sintable[(pSprite->ang+512)&2047])>>6);
|
||||
int32_t y = ((sintable[(pSprite->ang)&2047])>>6);
|
||||
|
||||
pSprite->x -= x;
|
||||
pSprite->y -= y;
|
||||
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 2048, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
|
||||
pSprite->x += x;
|
||||
pSprite->y += y;
|
||||
}
|
||||
break;
|
||||
case FREEZEBLAST__STATIC:
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), LIGHTRAD(spriteNum, pSprite)<<2, 72+(88<<8)+(140<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case COOLEXPLOSION1__STATIC:
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), LIGHTRAD(spriteNum, pSprite)<<2, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case SHRINKSPARK__STATIC:
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), LIGHTRAD(spriteNum, pSprite), 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
||||
break;
|
||||
case FIRELASER__STATIC:
|
||||
if (pSprite->statnum == STAT_PROJECTILE)
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 64 * pSprite->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case RPG__STATIC:
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 128 * pSprite->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
||||
break;
|
||||
case SHOTSPARK1__STATIC:
|
||||
if (actor[spriteNum].t_data[2] == 0) // check for first frame of action
|
||||
{
|
||||
int32_t x = ((sintable[(pSprite->ang+512)&2047])>>7);
|
||||
int32_t y = ((sintable[(pSprite->ang)&2047])>>7);
|
||||
|
||||
pSprite->x -= x;
|
||||
pSprite->y -= y;
|
||||
|
||||
G_AddGameLight(0, spriteNum, ((pSprite->yrepeat*tilesiz[pSprite->picnum].y)<<1), 8 * pSprite->yrepeat, 240+(160<<8)+(80<<16),PR_LIGHT_PRIO_LOW_GAME);
|
||||
actor[spriteNum].lightcount = 1;
|
||||
|
||||
pSprite->x += x;
|
||||
pSprite->y += y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // POLYMER
|
||||
END_BLD_NS
|
||||
|
|
Loading…
Reference in a new issue