- rename weaponhit to DDukeActor.

Just make do with one name instead of aliasing it.
This commit is contained in:
Christoph Oelckers 2021-08-30 08:12:39 +02:00
parent 2b6bc414f5
commit fefc9e91da
6 changed files with 18 additions and 21 deletions

View file

@ -51,7 +51,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int
int l, t1, t3, t4;
spritetype* s;
tspritetype* t;
weaponhit* h;
DDukeActor* h;
for (j = 0; j < spritesortcnt; j++)
{

View file

@ -44,7 +44,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int
int l, t1, t3, t4;
spritetype* s;
tspritetype* t;
weaponhit* h;
DDukeActor* h;
int bg = 0;

View file

@ -124,8 +124,7 @@ int GetDefID(const char *szGameLabel);
void ClearGameVars(void);
void AddSystemVars();
void ResetGameVars(void);
struct weaponhit;
using DDukeActor = weaponhit;
struct DDukeActor;
int GetGameVarID(int id, DDukeActor* sActor, int sPlayer);
void SetGameVarID(int id, int lValue, DDukeActor* sActor, int sPlayer);
int GetGameVar(const char* szGameLabel, int lDefault, DDukeActor* sActor, int sPlayer);

View file

@ -91,7 +91,7 @@ bool sound445done; // used in checksectors_r. This was local state inside
// serialized
uint8_t sectorextra[MAXSECTORS]; // something about keys, all access through the haskey function.
weaponhit hittype[MAXSPRITES + 1]; // +1 to have a blank entry for serialization, all access in game code through the iterators.
DDukeActor hittype[MAXSPRITES + 1]; // +1 to have a blank entry for serialization, all access in game code through the iterators.
int spriteqamount = 64; // internal sprite queue
int spriteqloc;
DDukeActor* spriteq[1024];

View file

@ -39,7 +39,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
//
//==========================================================================
template<> FSerializer& Serialize(FSerializer& arc, const char* key, Duke3d::weaponhit*& ht, Duke3d::weaponhit** def)
template<> FSerializer& Serialize(FSerializer& arc, const char* key, Duke3d::DDukeActor*& ht, Duke3d::DDukeActor** def)
{
int index = ht? int(ht - Duke3d::hittype) : -1;
assert(index >= -1 && index < MAXSPRITES);
@ -268,7 +268,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
}
FSerializer& Serialize(FSerializer& arc, const char* keyname, weaponhit& w, weaponhit* def)
FSerializer& Serialize(FSerializer& arc, const char* keyname, DDukeActor& w, DDukeActor* def)
{
if (!def) def = &hittype[MAXSPRITES];
if (arc.BeginObject(keyname))

View file

@ -20,7 +20,7 @@ struct STATUSBARTYPE
bool gotweapon[MAX_WEAPONS];
};
struct weaponhit
struct DDukeActor
{
uint8_t cgg;
uint8_t spriteextra; // moved here for easier maintenance. This was originally a hacked in field in the sprite structure called 'filler'.
@ -34,14 +34,14 @@ struct weaponhit
int palvals;
};
int temp_data[6];
weaponhit* temp_actor, *seek_actor;
DDukeActor* temp_actor, *seek_actor;
spritetype* s; // direct reference to the corresponding sprite.
static weaponhit* array(); // this is necessary to allow define inline functions referencing the global array inside the definition itself.
static DDukeActor* array(); // this is necessary to allow define inline functions referencing the global array inside the definition itself.
weaponhit() : s(&sprite[this - array()]) {} // little trick to initialize the reference automatically. ;)
weaponhit(const weaponhit& other) = delete; // we also do not want to allow copies.
weaponhit& operator=(const weaponhit& other) = delete;
DDukeActor() : s(&sprite[this - array()]) {} // little trick to initialize the reference automatically. ;)
DDukeActor(const DDukeActor& other) = delete; // we also do not want to allow copies.
DDukeActor& operator=(const DDukeActor& other) = delete;
void clear()
{
cgg = spriteextra = 0;
@ -52,23 +52,23 @@ struct weaponhit
int GetIndex() const { return int(this - array()); }
// Wrapper around some ugliness. The 'owner' field gets abused by some actors, so better wrap its real use in access functions to keep things in order.
inline weaponhit* GetOwner()
inline DDukeActor* GetOwner()
{
return s->owner < 0 ? nullptr : &array()[s->owner];
}
inline void SetOwner(weaponhit* a)
inline void SetOwner(DDukeActor* a)
{
s->owner = a? a->GetIndex() : -1;
}
// same for the 'hittype' owner - which is normally the shooter in an attack.
inline weaponhit* GetHitOwner()
inline DDukeActor* GetHitOwner()
{
return owner < 0 ? nullptr : &array()[owner];
}
inline void SetHitOwner(weaponhit* a)
inline void SetHitOwner(DDukeActor* a)
{
owner = a ? a->GetIndex() : -1;
}
@ -93,10 +93,8 @@ struct weaponhit
};
extern weaponhit hittype[MAXSPRITES + 1];
inline weaponhit* weaponhit::array() { return hittype; }
using DDukeActor = weaponhit; // we do not really want that stupid name in our interface (but also not rename the struct yet.) The preceding 'D' is for the DObject interface this should be transitioned to later.
extern DDukeActor hittype[MAXSPRITES + 1];
inline DDukeActor* DDukeActor::array() { return hittype; }
struct animwalltype
{