- setSpritesetImage export added.

This commit is contained in:
Christoph Oelckers 2022-01-26 22:51:36 +01:00
parent ef22a78618
commit d9fee902de
4 changed files with 26 additions and 1 deletions

View file

@ -306,6 +306,7 @@ void DDukeActor::Serialize(FSerializer& arc)
("actorstayput", actorstayput)
("dispicnum", dispicnum)
("basepicnum", basepicnum)
("spritesetindex", spritesetindex)
("timetosleep", timetosleep)
("floorz", floorz)
("ceilingz", ceilingz)

View file

@ -36,7 +36,7 @@ public:
uint8_t cgg;
uint8_t spriteextra; // moved here for easier maintenance. This was originally a hacked in field in the sprite structure called 'filler'.
short attackertype, hitang, hitextra, movflag;
short tempang, dispicnum, basepicnum;
short tempang, dispicnum, basepicnum, spritesetindex;
short timetosleep;
vec2_t ovel;
int floorz, ceilingz;

View file

@ -95,6 +95,27 @@ DEFINE_FIELD(DDukeActor, temp_actor)
DEFINE_FIELD(DDukeActor, seek_actor)
DEFINE_FIELD(DDukeActor, flags1)
DEFINE_FIELD(DDukeActor, flags2)
DEFINE_FIELD(DDukeActor, spritesetindex)
static void setSpritesetImage(DDukeActor* self, unsigned int index)
{
auto& spriteset = static_cast<PClassActor*>(self->GetClass())->ActorInfo()->SpriteSet;
if (index >= spriteset.Size())
{
ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "Bad sprite set index %d (max. allowed is %d", index, spriteset.Size() - 1);
}
self->spritesetindex = index;
self->spr.picnum = spriteset[index];
}
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, SetSpritesetImage, setSpritesetImage)
{
PARAM_SELF_PROLOGUE(DDukeActor);
PARAM_UINT(index);
setSpritesetImage(self, index);
return 0;
}
//---------------------------------------------------------------------------
//

View file

@ -22,6 +22,8 @@ class DukeActor : CoreActor native
STAT_DESTRUCT = 100,
STAT_BOWLING = 105,
};
native void SetSpritesetImage(int index);
native DukeActor ownerActor, hitOwnerActor;
native uint8 cgg;
@ -34,6 +36,7 @@ class DukeActor : CoreActor native
native int palvals;
native int temp_data[6];
native private int flags1, flags2;
native readonly int16 spritesetindex;
//walltype* temp_walls[2]; // SE20 + SE128
//sectortype* temp_sect, *actorstayput;