- CoreActor setposition natives.

This commit is contained in:
Christoph Oelckers 2022-11-12 20:17:16 +01:00
parent de51b65ead
commit 53e43d6d1e
2 changed files with 41 additions and 0 deletions

View file

@ -549,6 +549,7 @@ DEFINE_FIELD_NAMED(DCoreActor, sprext.alpha, alpha)
DEFINE_FIELD_NAMED(DCoreActor, time, spawnindex)
DEFINE_FIELD_NAMED(DCoreActor, spritesetindex, spritesetpic)
DEFINE_FIELD_NAMED(DCoreActor, spr.angle, angle)
DEFINE_FIELD(DCoreActor, vel)
void coreactor_setpos(DCoreActor* self, double x, double y, double z, int relink)
{
@ -633,3 +634,34 @@ DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, backuppos, coreactor_backuppos)
return 0;
}
void coreactor_setposition(DCoreActor* self, double x, double y, double z)
{
SetActor(self, DVector3(x, y, z));
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setposition, coreactor_setposition)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
coreactor_setposition(self, x, y, z);
return 0;
}
void coreactor_setpositionz(DCoreActor* self, double x, double y, double z)
{
SetActorZ(self, DVector3(x, y, z));
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setpositionz, coreactor_setpositionz)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
coreactor_setpositionz(self, x, y, z);
return 0;
}

View file

@ -1,4 +1,10 @@
enum EClipMask
{
CLIPMASK0 = (1 << 16) + 1,
CLIPMASK1 = (256 << 16) + 64
};
class CoreActor native
{
native readonly sectortype sectp;
@ -32,6 +38,7 @@ class CoreActor native
native float alpha;
native double clipdist;
native double angle;
native Vector3 vel;
native readonly int16 spritesetpic;
native readonly int spawnindex;
@ -41,5 +48,7 @@ class CoreActor native
native void move(Vector3 newpos, bool relink = true);
native void setSpritePic(int index); // index into actor's spriteset.
native void backuppos();
native void setPosition(Vector3 pos);
native void setPositionZ(Vector3 pos);
}