- SW: Clean up local functions variables to prevent redefinition conflicts.

This commit is contained in:
Mitchell Richters 2021-12-24 20:24:30 +11:00 committed by Christoph Oelckers
parent a611fdb152
commit c26b5d2303
13 changed files with 30 additions and 79 deletions

View file

@ -65,7 +65,7 @@ void DrawOverlapRoom(int tx, int ty, int tz, fixed_t tq16ang, fixed_t tq16horiz,
}
else
{
int match = ViewSectorInScene(tsect, VIEW_LEVEL2);
match = ViewSectorInScene(tsect, VIEW_LEVEL2);
if (match != -1)
{
FindFloorView(match, &tx, &ty, tz, &tsect);

View file

@ -614,7 +614,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie
int smr4, smr2;
USERp tu;
static int ang = 0;
PLAYERp pp = Player + screenpeek;
PLAYERp pp = nullptr;
int newshade=0;
const int DART_PIC = 2526;
@ -790,7 +790,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie
// sw if its your playersprite
if (Player[screenpeek].Actor() == tActor)
{
PLAYERp pp = Player + screenpeek;
pp = Player + screenpeek;
if (display_mirror || TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE|PF_VIEW_FROM_CAMERA))
{
if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE))
@ -822,7 +822,7 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie
}
else // Otherwise just interpolate the player sprite
{
PLAYERp pp = tu->PlayerP;
pp = tu->PlayerP;
int sr = 65536 - int(smoothratio);
tsp->pos.X -= MulScale(pp->pos.X - pp->opos.X, sr, 16);
tsp->pos.Y -= MulScale(pp->pos.Y - pp->opos.Y, sr, 16);
@ -1663,7 +1663,7 @@ bool GameInterface::GenerateSavePic()
bool GameInterface::DrawAutomapPlayer(int mx, int my, int cposx, int cposy, int czoom, int cang, double const smoothratio)
{
int i, k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff;
int k, l, x1, y1, x2, y2, x3, y3, x4, y4, ox, oy, xoff, yoff;
int dax, day, cosang, sinang, xspan, yspan, sprx, spry;
int xrepeat, yrepeat, z1, z2, startwall, endwall, tilenum, daang;
int xvect, yvect;

View file

@ -352,7 +352,7 @@ void JS_InitMirrors(void)
Found_Cam = false;
if (TEST_BOOL1(&mirror[mirrorcnt].cameraActor->s()))
{
SWStatIterator it(STAT_DEFAULT);
it.Reset(STAT_DEFAULT);
while (auto itActor = it.Next())
{
sp = &itActor->s();

View file

@ -2235,17 +2235,14 @@ int DoCarryFlagNoDet(DSWActor* actor)
fu->WaitTics = 30 * 120; // Keep setting respawn tics so it won't respawn
// if no Owner then die
if (u->attachActor != nullptr)
if (ap != nullptr)
{
SPRITEp ap = &u->attachActor->s();
vec3_t pos = { ap->pos.X, ap->pos.Y, GetSpriteZOfMiddle(ap) };
SetActorZ(actor, &pos);
sp->ang = NORM_ANGLE(ap->ang + 1536);
sp->pos.Z = ap->pos.Z - DIV2(GetSpriteSizeZ(ap));
}
if (!au || au->Health <= 0)
{
if (u->flagOwnerActor != nullptr)

View file

@ -57,7 +57,6 @@ void SectorLightShade(DSWActor* actor, short intensity)
auto sp = &actor->s();
int8_t* wall_shade;
short base_shade;
short wallcount;
if (TEST_BOOL8(sp))
intensity = -intensity;

View file

@ -922,7 +922,7 @@ void RetractCurWpn(PLAYERp pp)
{
// check for any outstanding siblings that need to go away also
auto list = pp->GetPanelSpriteList();
for (auto cur = list->Next; nxt = cur->Next, cur != list; cur = nxt)
for (cur = list->Next; nxt = cur->Next, cur != list; cur = nxt)
{
if (cur->sibling && cur->sibling == pp->CurWpn)
{
@ -6231,7 +6231,7 @@ void InsertPanelSprite(PLAYERp pp, PANEL_SPRITEp psp)
// search for first pri in list thats less than the new pri
auto list = pp->GetPanelSpriteList();
for (auto cur = list->Next; nxt = cur->Next, cur != list; cur = nxt)
for (cur = list->Next; nxt = cur->Next, cur != list; cur = nxt)
{
// if the next pointer is the end of the list, insert it
if ((LIST) cur->Next == (LIST) &pp->PanelSpriteList)

View file

@ -2526,7 +2526,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y)
// if it ends up actually in the drivable sector kill it
for (sectp = sop->sectp; *sectp; sectp++)
{
SWSectIterator it(*sectp);
it.Reset(*sectp);
while (auto actor = it.Next())
{
sp = &actor->s();
@ -3381,7 +3381,6 @@ void DoPlayerClimb(PLAYERp pp)
if (LadderUpdate)
{
SPRITEp lsp;
int nx,ny;
HitInfo near;
@ -3698,16 +3697,16 @@ DSWActor* FindNearSprite(DSWActor* actor, short stat)
SWStatIterator it(stat);
while (auto actor = it.Next())
while (auto itActor = it.Next())
{
auto fp = &actor->s();
auto fp = &itActor->s();
dist = Distance(sp->pos.X, sp->pos.Y, fp->pos.X, fp->pos.Y);
if (dist < near_dist)
{
near_dist = dist;
near_fp = actor;
near_fp = itActor;
}
}
@ -7040,7 +7039,7 @@ void InitMultiPlayerInfo(void)
if (gNet.MultiGameType != MULTI_GAME_NONE)
{
// if start position is physically set then don't spawn a new one
SWStatIterator it(MultiStatList[stat]);
it.Reset(MultiStatList[stat]);
if (it.Next())
continue;
}

View file

@ -183,7 +183,7 @@ void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *a
SWStatIterator it(STAT_QUAKE_ON);
while (auto actor = it.Next())
{
auto sp = &actor->s();
sp = &actor->s();
dist = FindDistance3D(pp->pos.X - sp->pos.X, pp->pos.Y - sp->pos.Y, pp->pos.Z - sp->pos.Z);

View file

@ -1273,7 +1273,7 @@ void DoDeleteSpriteMatch(short match)
for (stat = 0; stat < SIZ(StatList); stat++)
{
SWStatIterator it(StatList[stat]);
it.Reset(StatList[stat]);
while (auto actor = it.Next())
{
auto sp = &actor->s();
@ -1302,14 +1302,11 @@ void DoDeleteSpriteMatch(short match)
void DoChangorMatch(short match)
{
SPRITEp sp;
SECTORp sectp;
SWStatIterator it(STAT_CHANGOR);
while (auto actor = it.Next())
{
auto sp = &actor->s();
sectp = sp->sector();
auto sectp = sp->sector();
if (SP_TAG2(sp) != match)
continue;
@ -1682,8 +1679,6 @@ int OperateSprite(DSWActor* actor, short player_is_operating)
case TAG_SPRITE_GRATING:
{
USERp u;
change_actor_stat(actor, STAT_NO_STATE);
u = SpawnUser(actor, 0, nullptr);
@ -2296,16 +2291,13 @@ void PlayerOperateEnv(PLAYERp pp)
if (!found)
{
int z[3];
unsigned i;
NEAR_TAG_INFO nti[16];
short nt_ndx;
auto psp = &pp->Actor()->s();
z[0] = psp->pos.Z - GetSpriteSizeZ(psp) - Z(10);
z[1] = psp->pos.Z;
z[2] = DIV2(z[0] + z[1]);
for (i = 0; i < SIZ(z); i++)
for (unsigned i = 0; i < SIZ(z); i++)
{
BuildNearTagList(nti, sizeof(nti), pp, z[i], 1024 + 768L, NTAG_SEARCH_LO_HI, 8);

View file

@ -554,7 +554,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
else if (type == SOURCE_Ambient)
{
auto sp = ((AmbientSound*)source)->sp;
vec3_t* vpos = &sp->pos;
vpos = &sp->pos;
FVector3 npos = GetSoundPos(vpos);
// Can the ambient sound see the player? If not, tone it down some.

View file

@ -709,11 +709,11 @@ void KillActor(DSWActor* actor)
for (stat = 0; stat < SIZ(MissileStats); stat++)
{
SWStatIterator it(MissileStats[stat]);
while (auto actor = it.Next())
while (auto itActor = it.Next())
{
if (!actor->hasU()) continue;
mu = actor->u();
if (mu->WpnGoalActor == actor)
if (!itActor->hasU()) continue;
mu = itActor->u();
if (mu->WpnGoalActor == itActor)
{
mu->WpnGoalActor = nullptr;
}
@ -768,19 +768,6 @@ void KillActor(DSWActor* actor)
// shred your garbage
sp->clear();
actor->Destroy();
// Kill references in all users - slow but unavoidable if we don't want the game to crash on stale pointers.
SWSpriteIterator it;
while (auto actor = it.Next())
{
if (actor->hasU())
{
auto u = actor->u();
if (u->highActor == actor) u->highActor = nullptr;
if (u->lowActor == actor) u->lowActor = nullptr;
if (u->targetActor == actor) u->targetActor = nullptr;
}
}
}
void ChangeState(DSWActor* actor, STATEp statep)
@ -1454,7 +1441,6 @@ void IconDefault(DSWActor* actor)
void PreMapCombineFloors(void)
{
const int MAX_FLOORS = 32;
SPRITEp sp;
int i, j, k;
int base_offset;
int dx, dy;
@ -1504,8 +1490,8 @@ void PreMapCombineFloors(void)
BFSSectorSearch search(BoundList[i].offset->sector());
while (auto dasect = search.GetNext())
{
SWSectIterator it(dasect);
while (auto jActor = it.Next())
SWSectIterator it2(dasect);
while (auto jActor = it2.Next())
{
jActor->spr.pos.X += dx;
jActor->spr.pos.Y += dy;
@ -2056,7 +2042,6 @@ void SpriteSetup(void)
case SECT_VATOR:
{
SECTORp sectp = sp->sector();
short speed,vel,time,type,start_on,floor_vator;
u = SpawnUser(actor, 0, nullptr);
@ -2165,7 +2150,6 @@ void SpriteSetup(void)
case SECT_ROTATOR:
{
SECTORp sectp = sp->sector();
short time,type;
short wallcount,startwall,endwall,w;
u = SpawnUser(actor, 0, nullptr);
@ -2220,7 +2204,6 @@ void SpriteSetup(void)
case SECT_SLIDOR:
{
SECTORp sectp = sp->sector();
short time,type;
u = SpawnUser(actor, 0, nullptr);
@ -2362,7 +2345,6 @@ void SpriteSetup(void)
{
int wallcount = 0;
int8_t* wall_shade;
USERp u;
LIGHT_Tics(sp) = 0;
@ -2415,7 +2397,6 @@ void SpriteSetup(void)
{
int wallcount = 0;
int8_t* wall_shade;
USERp u;
LIGHT_Tics(sp) = 0;
@ -2509,8 +2490,6 @@ void SpriteSetup(void)
case SECT_EXPLODING_CEIL_FLOOR:
{
SECTORp sectp = sp->sector();
SetSectorWallBits(sp->sector(), WALLFX_DONT_STICK, false, true);
if (TEST(sectp->floorstat, CSTAT_SECTOR_SLOPE))
@ -2653,8 +2632,8 @@ void SpriteSetup(void)
case VIEW_THRU_FLOOR:
{
// make sure there is only one set per level of these
SWStatIterator it(STAT_FAF);
while (auto itActor = it.Next())
SWStatIterator it2(STAT_FAF);
while (auto itActor = it2.Next())
{
auto ispr = &itActor->s();
if (ispr->hitag == sp->hitag && ispr->lotag == sp->lotag)
@ -6303,7 +6282,7 @@ void SpriteControl(void)
it.Reset(STAT_NO_STATE);
while (auto actor = it.Next())
{
auto u = actor->u();
u = actor->u();
if (u && u->ActorActionFunc)
u->ActorActionFunc(actor);
}

View file

@ -751,7 +751,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
BoundActor = FindBoundSprite(SECT_SO_CENTER);
if (BoundActor)
{
auto BoundSprite = &BoundActor->s();
BoundSprite = &BoundActor->s();
sop->xmid = BoundSprite->pos.X;
sop->ymid = BoundSprite->pos.Y;
sop->zmid = BoundSprite->pos.Z;
@ -863,7 +863,6 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
while (auto itActor = it.Next())
{
SPRITEp sp = &itActor->s();
USERp u;
if (sp->pos.X > xlow && sp->pos.X < xhigh && sp->pos.Y > ylow && sp->pos.Y < yhigh)
{
@ -974,7 +973,6 @@ cont:
if (TEST(sop->flags, SOBJ_SPRITE_OBJ))
{
SPRITEp sp;
USERp u;
int zmid = -9999999;
// choose the lowest sprite for the zmid
@ -1005,7 +1003,6 @@ cont:
void SetupSectorObject(sectortype* sectp, short tag)
{
SPRITEp sp;
SECTOR_OBJECTp sop;
int object_num;
short j;
@ -1163,7 +1160,6 @@ void SetupSectorObject(sectortype* sectp, short tag)
case SPAWN_SPOT:
if (sp->clipdist == 3)
{
USERp u;
change_actor_stat(actor, STAT_NO_STATE);
u = SpawnUser(actor, 0, nullptr);
u->ActorActionFunc = nullptr;
@ -1386,9 +1382,6 @@ void SetupSectorObject(sectortype* sectp, short tag)
if (sop->max_damage <= 0)
VehicleSetSmoke(sop, SpawnVehicleSmoke);
// find radius
//u->Radius = sop->
break;
}
@ -2593,7 +2586,6 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
if (TEST(sop->flags, SOBJ_ZDIFF_MODE))
{
int dist;
short i;
// set dx,dy,dz up for finding the z magnitude
@ -2713,8 +2705,6 @@ void PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy)
void VehicleSetSmoke(SECTOR_OBJECTp sop, ANIMATORp animator)
{
SECTORp *sectp;
SPRITEp sp;
USERp u;
for (sectp = sop->sectp; *sectp; sectp++)
{
@ -3593,8 +3583,6 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
if (TEST(u->Flags, SPR_ZDIFF_MODE))
{
int dist;
// set dx,dy,dz up for finding the z magnitude
dx = tpoint->x;
dy = tpoint->y;

View file

@ -8008,8 +8008,6 @@ int VectorMissileSeek(DSWActor* actor, int16_t delay_tics, int16_t turn_speed, i
}
else
{
DSWActor* hitActor;
if ((hitActor = DoPickTarget(actor, aware_range1, false)) != nullptr)
{
USERp hu = hitActor->u();
@ -8172,7 +8170,6 @@ int DoPlasmaFountain(DSWActor* actor)
USER* u = actor->u();
SPRITEp sp = &actor->s();
SPRITEp ap;
short bak_cstat;
// if no Owner then die
if (u->attachActor == nullptr)
@ -16123,7 +16120,7 @@ bool HitscanSpriteAdjust(DSWActor* actor, walltype* hit_wall)
int InitUzi(PLAYERp pp)
{
USERp u = pp->Actor()->u();
SPRITEp wp, hsp;
SPRITEp wp;
USERp wu;
short daang;
HitInfo hit{};