- made DCoreActor's properties functional.

They cannot be parsed directly into the actor's sprite because that gets used in ways that require a different setup.
This alsp adds a property parser and a setter function for the SpriteSet array. The idea here is to write code that does not need to use actual tile indices so it can later be refactored to real textures.
This commit is contained in:
Christoph Oelckers 2022-02-13 10:44:39 +01:00
parent e3f1893e02
commit e396798198
5 changed files with 60 additions and 24 deletions

View file

@ -581,3 +581,17 @@ DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, addz, coreactor_addz)
self->spr.pos.Z = int(z * 256);
return 0;
}
void coreactor_setSpritePic(DCoreActor* self, unsigned z)
{
auto &spriteset = static_cast<PClassActor*>(self->GetClass())->ActorInfo()->SpriteSet;
if (z < spriteset.Size()) self->spr.picnum = spriteset[z];
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setSpritePic, coreactor_setSpritePic)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_INT(z);
coreactor_setSpritePic(self, z);
return 0;
}