- wall[] in light.cpp and player.cpp

This commit is contained in:
Christoph Oelckers 2021-11-24 20:11:50 +01:00
parent 732aa2023b
commit 9c21483279
6 changed files with 24 additions and 47 deletions

View file

@ -75,19 +75,6 @@ extern ParentalStruct aVoxelArray[MAXTILES];
// F U N C T I O N S //////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
// SpawnWallSound
/////////////////////////////////////////////////////
void SpawnWallSound(short sndnum, short i)
{
vec3_t mid;
// Get wall midpoint for offset in mirror view
mid.vec2 = wall[i].center();
mid.z = (sector[wall[i].nextsector].ceilingz + sector[wall[i].nextsector].floorz) / 2;
PlaySound(sndnum, &mid, v3df_dontpan | v3df_doppler);
}
short
CheckTileSound(short picnum)
@ -162,7 +149,6 @@ JS_SpriteSetup(void)
{
SPRITEp sp;
USERp u;
short i;
SWStatIterator it(STAT_DEFAULT);
while (auto actor = it.Next())
@ -240,12 +226,9 @@ JS_SpriteSetup(void)
}
}
// Check for certain walls to make sounds
for (i = 0; i < numwalls; i++)
for(auto& wal : walls())
{
short picnum;
picnum = wall[i].picnum;
int picnum = wal.picnum;
// Set the don't stick bit for liquid tiles
switch (picnum)
@ -261,7 +244,7 @@ JS_SpriteSetup(void)
case 2608:
case 2616:
//case 3834:
SET(wall[i].extra, WALLFX_DONT_STICK);
SET(wal.extra, WALLFX_DONT_STICK);
break;
}
}
@ -307,7 +290,7 @@ void JS_InitMirrors(void)
{
if (mirrorcnt >= MAXMIRRORS)
{
Printf("MAXMIRRORS reached! Skipping mirror wall[%d]\n", i);
Printf("MAXMIRRORS reached! Skipping mirror wall\n");
wal.overpicnum = sec->ceilingpicnum;
continue;
}
@ -391,7 +374,7 @@ void JS_InitMirrors(void)
if (!Found_Cam)
{
Printf("Did not find drawtotile for camera number %d\n", mirrorcnt);
Printf("wall[%d].hitag == %d\n", i, wal.hitag);
Printf("wall(%d).hitag == %d\n", wallnum(&wal), wal.hitag);
Printf("Map Coordinates: x = %d, y = %d\n", wal.x, wal.y);
RESET_BOOL1(&mirror[mirrorcnt].cameraActor->s());
}

View file

@ -475,13 +475,11 @@ int DoBloodSpray(DSWActor* actor)
// !FRANK! bit of a hack
// yvel is the hit_wall
if (bsp->yvel >= 0)
if (bldActor->tempwall)
{
short wallnum = bsp->yvel;
// sy & sz are the ceiling and floor of the sector you are sliding down
if (wall[wallnum].nextsector >= 0)
getzsofslope(wall[wallnum].nextsector, sp->x, sp->y, &u->sy, &u->sz);
if (bldActor->tempwall->twoSided())
getzsofslopeptr(bldActor->tempwall->nextSector(), sp->x, sp->y, &u->sy, &u->sz);
else
u->sy = u->sz; // ceiling and floor are equal - white wall
}

View file

@ -55,7 +55,6 @@ void SectorLightShade(DSWActor* actor, short intensity)
{
auto u = actor->hasU()? actor->u() : nullptr;
auto sp = &actor->s();
short w, startwall, endwall;
int8_t* wall_shade;
short base_shade;
short wallcount;
@ -82,27 +81,25 @@ void SectorLightShade(DSWActor* actor, short intensity)
{
ASSERT(u && u->WallShade.Data());
wall_shade = u->WallShade.Data();
int wallcount = 0;
startwall = sp->sector()->wallptr;
endwall = startwall + sp->sector()->wallnum - 1;
for (w = startwall, wallcount = 0; w <= endwall; w++)
for(auto &wal : wallsofsector(sp->sector()))
{
base_shade = wall_shade[wallcount];
wall[w].shade = base_shade + intensity;
wal.shade = base_shade + intensity;
if (!TEST_BOOL6(sp))
wall[w].pal = sp->pal;
wal.pal = sp->pal;
wallcount++;
if (TEST(sp->extra, SPRX_BOOL5))
{
uint16_t const nextwall = wall[w].nextwall;
if (validWallIndex(nextwall))
if (wal.twoSided())
{
auto nextWall = wal.nextWall();
base_shade = wall_shade[wallcount];
wall[nextwall].shade = base_shade + intensity;
nextWall->shade = base_shade + intensity;
if (!TEST_BOOL6(sp))
wall[nextwall].pal = sp->pal;
nextWall->pal = sp->pal;
wallcount++;
}
}

View file

@ -2629,15 +2629,12 @@ void DoPlayerMoveVehicle(PLAYERp pp)
{
for (sectp = sop->sectp, wallcount = 0, j = 0; *sectp; sectp++, j++)
{
startwall = (*sectp)->wallptr;
endwall = startwall + (*sectp)->wallnum - 1;
for (wp = &wall[startwall], k = startwall; k <= endwall; wp++, k++)
for(auto& wal : wallsofsector(*sectp))
{
if (wp->extra && TEST(wp->extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY) == WALLFX_LOOP_OUTER)
if (wal.extra && TEST(wal.extra, WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY) == WALLFX_LOOP_OUTER)
{
x[count] = wp->x;
y[count] = wp->y;
x[count] = wal.x;
y[count] = wal.y;
ox[count] = sop->xmid - sop->xorig[wallcount];
oy[count] = sop->ymid - sop->yorig[wallcount];
@ -3402,6 +3399,7 @@ void DoPlayerClimb(PLAYERp pp)
if (wal >= 0)
{
auto wp = &wall[wal];
auto lActor = FindNearSprite(pp->Actor(), STAT_CLIMB_MARKER);
if (!lActor) return;
auto lsp = &lActor->s();
@ -3412,7 +3410,7 @@ void DoPlayerClimb(PLAYERp pp)
ny = MOVEy(100, lsp->ang);
// set ladder sector
pp->LadderSector = wall[wal].nextsector >= 0? wall[wal].nextsector : wall[wal].sector;
pp->LadderSector = wp->nextsector >= 0? wp->nextsector : wp->sector;
// set players "view" distance from the ladder - needs to be farther than
// the sprite

View file

@ -14,6 +14,7 @@ public:
bool hasUser;
USER user;
walltype* tempwall; // transient, to replace a hack using a 16 bit sprite field.
DSWActor() :index(int(this - base())) { /*assert(index >= 0 && index < kMaxSprites);*/ }
DSWActor& operator=(const DSWActor& other) = default;

View file

@ -18985,7 +18985,7 @@ DSWActor* QueueWallBlood(DSWActor* actor, short ang)
sp->y = hitinfo.pos.y;
sp->z = hitinfo.pos.z;
sp->shade -= 5; // Brighten it up just a bit
sp->yvel = hitinfo.hitwall; // pass hitinfo.wall in yvel
spawnedActor->tempwall = hitinfo.wall(); // pass hitinfo.wall
SET(sp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL);
SET(sp->cstat, CSTAT_SPRITE_ONE_SIDED);