Skip to content

Commit

Permalink
- got rid of all TILE_* globals, except TILE_CROSSHAIR.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Mar 27, 2023
1 parent 044fa98 commit 6d9a225
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 26 deletions.
1 change: 1 addition & 0 deletions source/core/thingdef_data.cpp
Expand Up @@ -187,6 +187,7 @@ static FFlagDef DukeActorFlagDefs[] =
DEFINE_FLAG(SFLAG3, DONTENTERWATERONGROUND, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, RANDOMANGLEONWATER, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, NORANDOMANGLEWHENBLOCKED, DDukeActor, flags3),
DEFINE_FLAG(SFLAG3, QUICKALTERANG, DDukeActor, flags3),

};

Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/actors.cpp
Expand Up @@ -3558,7 +3558,7 @@ void alterang(int ang, DDukeActor* actor, int playernum)
else
goalang = (Owner->spr.pos.XY() - actor->spr.pos.XY()).Angle();

if (actor->vel.X != 0 && actor->spr.picnum != TILE_DRONE)
if (actor->vel.X != 0 && !(actor->flags3 & SFLAG3_QUICKALTERANG))
{
angdif = deltaangle(aang, goalang);

Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/animatesprites_d.cpp
Expand Up @@ -116,7 +116,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
continue;
}

if (h->spr.picnum == DTILE_APLAYER)
if (h->isPlayer())
{
p = h->PlayerIndex();

Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/animatesprites_r.cpp
Expand Up @@ -114,7 +114,7 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
continue;
}

if (h->spr.picnum == RTILE_APLAYER)
if (h->isPlayer())
{
p = h->PlayerIndex();

Expand Down
2 changes: 2 additions & 0 deletions source/games/duke/src/classnames.h
Expand Up @@ -112,3 +112,5 @@ xx(RedneckMoonshine)
xx(RedneckTitgun)
xx(RedneckTitAmmo)
xx(DukeRadiusExplosion)
xx(DukePlayerBase)
xx(DukePlayerPawn)
1 change: 1 addition & 0 deletions source/games/duke/src/constants.h
Expand Up @@ -420,6 +420,7 @@ enum sflags3_t
SFLAG3_DONTENTERWATERONGROUND = 0x00040000,
SFLAG3_RANDOMANGLEONWATER = 0x00080000,
SFLAG3_NORANDOMANGLEWHENBLOCKED = 0x00100000,
SFLAG3_QUICKALTERANG = 0x00200000,


};
Expand Down
4 changes: 0 additions & 4 deletions source/games/duke/src/dispatch.cpp
Expand Up @@ -136,10 +136,6 @@ void SetDispatcher()
}


int TILE_APLAYER;
int TILE_DRONE;
int TILE_WATERBUBBLE;
int TILE_BLOODPOOL;
int TILE_CROSSHAIR;

END_DUKE_NS
4 changes: 0 additions & 4 deletions source/games/duke/src/flags_d.cpp
Expand Up @@ -57,10 +57,6 @@ void initactorflags_d()
gs.weaponsandammosprites[14] = DukeFreezeAmmoClass;
gs.firstdebris = DTILE_SCRAP6;

TILE_APLAYER = DTILE_APLAYER;
TILE_DRONE = DTILE_DRONE;
TILE_WATERBUBBLE = DTILE_WATERBUBBLE;
TILE_BLOODPOOL = DTILE_BLOODPOOL;
TILE_CROSSHAIR = DTILE_CROSSHAIR;

}
Expand Down
4 changes: 0 additions & 4 deletions source/games/duke/src/flags_r.cpp
Expand Up @@ -50,10 +50,6 @@ void initactorflags_r()
gs.weaponsandammosprites[13] = RedneckTitgunClass;
gs.weaponsandammosprites[14] = RedneckTitAmmoClass;

TILE_APLAYER = RTILE_APLAYER;
TILE_DRONE = RTILE_DRONE;
TILE_WATERBUBBLE = RTILE_WATERBUBBLE;
TILE_BLOODPOOL = RTILE_BLOODPOOL;
TILE_CROSSHAIR = RTILE_CROSSHAIR;

gs.firstdebris = RTILE_SCRAP6;
Expand Down
6 changes: 6 additions & 0 deletions source/games/duke/src/inlines.h
Expand Up @@ -315,6 +315,12 @@ inline const ActorInfo* DDukeActor::conInfo() const
return tn < 0 ? nullptr : &gs.actorinfo[tn];
}

inline bool DDukeActor::isPlayer() const
{
return IsKindOf(DukePlayerBaseClass);
}


inline void setPlayerActorViewZOffset(DDukeActor* const pact)
{
if (!PlayClock)
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/input.cpp
Expand Up @@ -298,7 +298,7 @@ void hud_input(int plnum)
p->inven_icon = 3;

auto pactor =
CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ().plusZ(30), TILE_APLAYER, -64, DVector2(0, 0), p->GetActor()->spr.Angles.Yaw, 0., 0., nullptr, 10);
CreateActor(p->cursector, p->GetActor()->getPosWithOffsetZ().plusZ(30), DukePlayerPawnClass, -64, DVector2(0, 0), p->GetActor()->spr.Angles.Yaw, 0., 0., nullptr, 10);
pactor->temp_data[3] = pactor->temp_data[4] = 0;
p->holoduke_on = pactor;
pactor->spr.yint = plnum;
Expand Down
4 changes: 0 additions & 4 deletions source/games/duke/src/names.h
Expand Up @@ -3,10 +3,6 @@
BEGIN_DUKE_NS

// These are all globally accessed tiles.
extern int TILE_APLAYER;
extern int TILE_DRONE;
extern int TILE_WATERBUBBLE;
extern int TILE_BLOODPOOL;
extern int TILE_CROSSHAIR;


Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/premap.cpp
Expand Up @@ -494,7 +494,7 @@ void resetpspritevars(int g, const DVector3& startpos, const DAngle startang)
STATUSBARTYPE tsbar[MAXPLAYERS];

auto newActor = CreateActor(ps[0].cursector, startpos,
TILE_APLAYER, 0, DVector2(0, 0), startang, 0., 0., nullptr, 10);
DukePlayerPawnClass /*fixme for RR later!*/, 0, DVector2(0, 0), startang, 0., 0., nullptr, 10);

newActor->spr.Angles.Pitch = DAngle::fromDeg(-17.354);
newActor->backuploc();
Expand Down
5 changes: 1 addition & 4 deletions source/games/duke/src/types.h
Expand Up @@ -144,10 +144,7 @@ class DDukeActor : public DCoreActor
return spr.yint;
}

bool isPlayer() const
{
return spr.picnum == TILE_APLAYER;
}
bool isPlayer() const;

void Serialize(FSerializer& arc) override;

Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/games/duke/actors/mech.zs
Expand Up @@ -7,6 +7,7 @@ class DukeDrone : DukeActor
+KILLCOUNT;
+NOWATERDIP;
+FLOATING;
+QUICKALTERANG;
falladjustz 0;
}

Expand Down
6 changes: 5 additions & 1 deletion wadsrc/static/zscript/games/duke/actors/player.zs
@@ -1,4 +1,8 @@
class DukePlayerPawn : DukeActor
class DukePlayerBase : DukeActor
{
}

class DukePlayerPawn : DukePlayerBase
{
default
{
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/games/duke/actors/redneckenemies.zs
Expand Up @@ -440,6 +440,7 @@ class RedneckMosquito : DukeActor
+KILLCOUNT;
+NOWATERDIP;
+FLOATING;
+QUICKALTERANG;
falladjustz 0;
}
override void Initialize()
Expand Down

0 comments on commit 6d9a225

Please sign in to comment.