- PrevWall

This commit is contained in:
Christoph Oelckers 2021-11-24 18:58:14 +01:00
parent 5cf776daaa
commit cab2181ddc
4 changed files with 11 additions and 19 deletions

View file

@ -1634,7 +1634,7 @@ void SpriteSetupPost(void)
SWStatIterator it(STAT_FLOOR_PAN);
while (auto iActor = it.Next())
{
SWSectIterator it2(iActor->s().sectnum);
SWSectIterator it2(iActor->s().sector());
while (auto jActor = it.Next())
{
ds = &jActor->s();
@ -4938,7 +4938,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange)
int DoStayOnFloor(DSWActor* actor)
{
actor->s().z = sector[actor->s().sectnum].floorz;
actor->s().z = actor->s().sector()->floorz;
return 0;
}

View file

@ -85,7 +85,6 @@ int DoWallMove(DSWActor* actor)
int dist,nx,ny;
short shade1,shade2,ang,picnum1,picnum2;
WALLp wallp;
short prev_wall;
bool found = false;
short dang;
bool SOsprite = false;
@ -134,11 +133,11 @@ int DoWallMove(DSWActor* actor)
wallp->picnum = picnum1;
// find the previous wall
prev_wall = PrevWall(wallnum(wallp));
auto prev_wall = PrevWall(wallp);
if (shade2)
wall[prev_wall].shade = int8_t(shade2);
prev_wall->shade = int8_t(shade2);
if (picnum2)
wall[prev_wall].picnum = picnum2;
prev_wall->picnum = picnum2;
}
}

View file

@ -5293,7 +5293,7 @@ int ActorStdMissile(DSWActor* actor, DSWActor* weapActor)
if (goal != nullptr)
{
// attempt to see if it was killed
ASSERT(goal->s().sectnum >= 0);
ASSERT(goal->s().insector());
if (goal->hasU())
RESET(goal->u()->Flags, SPR_TARGETED);
}
@ -7279,20 +7279,13 @@ int DoFlamesDamageTest(DSWActor* actor)
return 0;
}
short PrevWall(short wall_num)
walltype* PrevWall(walltype* wall_num)
{
short start_wall,prev_wall;
start_wall = wall_num;
do
for(auto&wal : wallsofsector(wall_num->sectorp()))
{
prev_wall = wall_num;
wall_num = wall[wall_num].point2;
if (wal.point2Wall() == wall_num) return &wal;
}
while (wall_num != start_wall);
return prev_wall;
return wall_num; // should never happen unless the sector is malformed.
}

View file

@ -248,7 +248,7 @@ void SpawnGoroFireballExp(DSWActor* Weapon);
bool MissileHitMatch(DSWActor* weapActor, int WeaponNum, DSWActor* hitActor);
int DoItemFly(DSWActor*);
int SpawnVehicleSmoke(DSWActor* actor);
short PrevWall(short wall_num);
walltype* PrevWall(walltype* wall_num);
int DoDamage(DSWActor*, DSWActor*);
END_SW_NS