- added some VM exports for DukePlayer

This commit is contained in:
Christoph Oelckers 2022-11-12 21:55:14 +01:00
parent 53e43d6d1e
commit 48d1367a7e
2 changed files with 44 additions and 18 deletions

View file

@ -212,9 +212,7 @@ DEFINE_FIELD_X(DukePlayer, player_struct, loogcnt)
DEFINE_FIELD_X(DukePlayer, player_struct, invdisptime)
//DEFINE_FIELD_X(DukePlayer, player_struct, bobposx)
//DEFINE_FIELD_X(DukePlayer, player_struct, bobposy)
//DEFINE_FIELD_X(DukePlayer, player_struct, oposx)
//DEFINE_FIELD_X(DukePlayer, player_struct, oposy)
//DEFINE_FIELD_X(DukePlayer, player_struct, oposz)
DEFINE_FIELD_X(DukePlayer, player_struct, pos)
DEFINE_FIELD_X(DukePlayer, player_struct, pyoff)
DEFINE_FIELD_X(DukePlayer, player_struct, opyoff)
//DEFINE_FIELD_X(DukePlayer, player_struct, posxv)
@ -362,6 +360,7 @@ DEFINE_FIELD_X(DukePlayer, player_struct, somethingonplayer)
DEFINE_FIELD_X(DukePlayer, player_struct, access_spritenum)
DEFINE_FIELD_X(DukePlayer, player_struct, dummyplayersprite)
DEFINE_FIELD_X(DukePlayer, player_struct, newOwner)
DEFINE_FIELD_X(DukePlayer, player_struct, fric)
DEFINE_ACTION_FUNCTION(_DukePlayer, IsFrozen)
{
@ -377,12 +376,6 @@ DEFINE_ACTION_FUNCTION(_DukePlayer, GetGameVar)
ACTION_RETURN_INT(GetGameVar(name, def, self->GetActor(), self->GetPlayerNum()).safeValue());
}
DEFINE_ACTION_FUNCTION(_DukePlayer, angleAsBuild)
{
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
ACTION_RETURN_INT(self->angle.ang.Buildang());
}
void dukeplayer_backuppos(player_struct* self)
{
self->backuppos();
@ -395,6 +388,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, backuppos, dukeplayer_backuppos)
return 0;
}
void dukeplayer_backupxyz(player_struct* self)
{
self->backupxyz();
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, backupxyz, dukeplayer_backupxyz)
{
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
dukeplayer_backupxyz(self);
return 0;
}
void dukeplayer_setpos(player_struct* self, double x, double y, double z)
{
self->pos = { x, y, z };
@ -410,6 +415,30 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, setpos, dukeplayer_setpos)
return 0;
}
void dukeplayer_settargetangle(player_struct* self, double a, int backup)
{
self->angle.settarget(DAngle::fromDeg(a), backup);
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, settargetangle, dukeplayer_settargetangle)
{
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
PARAM_FLOAT(a);
PARAM_BOOL(bak);
dukeplayer_settargetangle(self, a, bak);
return 0;
}
double dukeplayer_angle(player_struct* self)
{
return self->angle.ang.Degrees();
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, angle, dukeplayer_angle)
{
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
ACTION_RETURN_FLOAT(dukeplayer_angle(self));
}
static DDukeActor* duke_firstStat(DukeStatIterator* it, int statnum)
{

View file

@ -122,14 +122,9 @@ struct Duke native
struct DukePlayer
{
// The sound code wants to read a vector out of this so we need to define one for the main coordinate.
/*
union
{
vec3_t pos;
struct { int32_t posx, posy, posz; };
};
native Vector3 pos;
/*
// player's horizon and angle structs.
PlayerHorizon horizon;
PlayerAngle angle;
@ -143,7 +138,7 @@ struct DukePlayer
native color pals;
// this was a global variable originally.
//vec2_t fric;
native Vector2 fric;
// weapon drawer variables and their interpolation counterparts.
native int weapon_sway;
@ -268,9 +263,11 @@ struct DukePlayer
native bool IsFrozen();
native int GetGameVar(String varname, int defval);
native int angleAsBuild();
native void backuppos();
native void backupxyz();
native void setpos(Vector3 pos);
native void settargetangle(double angle, bool backup = false);
native double angle();
}