- prototyping some refactoring helpers.

This commit is contained in:
Christoph Oelckers 2020-10-14 00:58:21 +02:00
parent fcfeafdbe9
commit d368d734d3
2 changed files with 28 additions and 0 deletions

View file

@ -246,6 +246,25 @@ extern usermaphack_t g_loadedMapHack;
EXTERN spriteext_t *spriteext;
EXTERN spritesmooth_t *spritesmooth;
// Wrapper that makes an array of pointers look like an array of references. (Refactoring helper.)
template<class T, int size>
class ReferenceArray
{
T* data[size];
public:
T& operator[](size_t index)
{
assert(index < size);
return *data[index];
}
void set(int pos, T* spr)
{
data[pos] = spr;
}
};
EXTERN sectortype *sector;
EXTERN walltype *wall;
EXTERN spritetype *sprite;

View file

@ -30,6 +30,15 @@ struct weaponhit
int temp_data[6];
};
// This is how a Duke actor should later be exposed to scripting. The object definition parts are disabled for now so that this can be used already to transition the code.
class DDukeActor //: public DBuildActor
{
public:
//DECLARE_CLASS(DDukeActor, DBuildActor)
spritetype s;
weaponhit h;
};
struct animwalltype
{
short wallnum, tag;