- moved all CoreActor exports to vmexports.cpp.

This commit is contained in:
Christoph Oelckers 2022-11-16 22:25:40 +01:00
parent c69e86d119
commit 133cb3a02e
2 changed files with 171 additions and 166 deletions

View file

@ -517,169 +517,3 @@ double DCoreActor::GetOffsetAndHeight(double& height)
return zofs - tileTopOffset(spr.picnum) * yscale;
}
DEFINE_FIELD_NAMED(DCoreActor, spr.sectp, sector)
DEFINE_FIELD_NAMED(DCoreActor, spr.cstat, cstat)
DEFINE_FIELD_NAMED(DCoreActor, spr.cstat2, cstat2)
DEFINE_FIELD_NAMED(DCoreActor, spr.picnum, picnum)
DEFINE_FIELD_NAMED(DCoreActor, spr.statnum, statnum)
DEFINE_FIELD_NAMED(DCoreActor, spr.intangle, intangle)
DEFINE_FIELD_NAMED(DCoreActor, spr.pos, pos)
DEFINE_FIELD_NAMED(DCoreActor, spr.xint, xint)
DEFINE_FIELD_NAMED(DCoreActor, spr.yint, yint)
DEFINE_FIELD_NAMED(DCoreActor, spr.inittype, inittype)
DEFINE_FIELD_NAMED(DCoreActor, spr.hitag, hitag)
DEFINE_FIELD_NAMED(DCoreActor, spr.lotag, lotag)
DEFINE_FIELD_NAMED(DCoreActor, spr.type, type)
DEFINE_FIELD_NAMED(DCoreActor, spr.flags, flags) // need to be careful with this!
DEFINE_FIELD_NAMED(DCoreActor, spr.extra, extra)
DEFINE_FIELD_NAMED(DCoreActor, spr.detail, detail)
DEFINE_FIELD_NAMED(DCoreActor, spr.shade, shade)
DEFINE_FIELD_NAMED(DCoreActor, spr.pal, pal)
DEFINE_FIELD_NAMED(DCoreActor, spr.clipdist, intclipdist)
DEFINE_FIELD_NAMED(DCoreActor, clipdist, clipdist)
DEFINE_FIELD_NAMED(DCoreActor, spr.blend, blend)
DEFINE_FIELD_NAMED(DCoreActor, spr.scale, scale)
DEFINE_FIELD_NAMED(DCoreActor, spr.xoffset, xoffset)
DEFINE_FIELD_NAMED(DCoreActor, spr.yoffset, yoffset)
DEFINE_FIELD_NAMED(DCoreActor, spr.intowner, intowner)
DEFINE_FIELD_NAMED(DCoreActor, sprext.mdanimtims, mdanimtims)
DEFINE_FIELD_NAMED(DCoreActor, sprext.mdanimcur, mdanimcur)
DEFINE_FIELD_NAMED(DCoreActor, sprext.renderflags, renderflags)
DEFINE_FIELD_NAMED(DCoreActor, sprext.alpha, alpha)
DEFINE_FIELD_NAMED(DCoreActor, time, spawnindex)
DEFINE_FIELD(DCoreActor, spritesetindex)
DEFINE_FIELD_NAMED(DCoreActor, spr.angle, angle)
DEFINE_FIELD(DCoreActor, vel)
void coreactor_setpos(DCoreActor* self, double x, double y, double z, int relink)
{
self->spr.pos = { x, y, z };
// todo: SW needs to call updatesectorz here or have a separate function.
if (relink) SetActor(self, self->spr.pos);
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setpos, coreactor_setpos)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
PARAM_BOOL(relink);
coreactor_setpos(self, x, y, z, relink);
return 0;
}
void coreactor_copypos(DCoreActor* self, DCoreActor* other, int relink)
{
if (!other) return;
self->spr.pos = other->spr.pos;
// todo: SW needs to call updatesectorz here or have a separate function.
if (relink) SetActor(self, self->spr.pos);
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, copypos, coreactor_setpos)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_POINTER(other, DCoreActor);
PARAM_BOOL(relink);
coreactor_copypos(self, other, relink);
return 0;
}
void coreactor_move(DCoreActor* self, double x, double y, double z, int relink)
{
self->spr.pos += { x, y, z };
// todo: SW needs to call updatesectorz here or have a separate function.
if (relink) SetActor(self, self->spr.pos);
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, move, coreactor_move)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
PARAM_BOOL(relink);
coreactor_move(self, x, y, z, relink);
return 0;
}
void coreactor_setSpritePic(DCoreActor* self, unsigned z)
{
auto &spriteset = static_cast<PClassActor*>(self->GetClass())->ActorInfo()->SpriteSet;
if (z < spriteset.Size())
{
self->spritesetindex = z;
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;
}
void coreactor_backuppos(DCoreActor* self)
{
self->backuppos();
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, backuppos, coreactor_backuppos)
{
PARAM_SELF_PROLOGUE(DCoreActor);
coreactor_backuppos(self);
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;
}
void tspritetype_setSpritePic(tspritetype* targ, DCoreActor* self, unsigned z)
{
auto& spriteset = static_cast<PClassActor*>(self->GetClass())->ActorInfo()->SpriteSet;
if (z < spriteset.Size())
{
targ->picnum = spriteset[z];
}
}
DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, setSpritePic, tspritetype_setSpritePic)
{
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
PARAM_OBJECT(owner, DCoreActor);
PARAM_INT(z);
tspritetype_setSpritePic(self, owner, z);
return 0;
}

View file

@ -522,3 +522,174 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, twosided, wall_twosided)
PARAM_SELF_STRUCT_PROLOGUE(walltype);
ACTION_RETURN_BOOL(self->twoSided());
}
//=============================================================================
void tspritetype_setSpritePic(tspritetype* targ, DCoreActor* self, unsigned z)
{
auto& spriteset = static_cast<PClassActor*>(self->GetClass())->ActorInfo()->SpriteSet;
if (z < spriteset.Size())
{
targ->picnum = spriteset[z];
}
}
DEFINE_ACTION_FUNCTION_NATIVE(_tspritetype, setSpritePic, tspritetype_setSpritePic)
{
PARAM_SELF_STRUCT_PROLOGUE(tspritetype);
PARAM_OBJECT(owner, DCoreActor);
PARAM_INT(z);
tspritetype_setSpritePic(self, owner, z);
return 0;
}
//=============================================================================
DEFINE_FIELD_NAMED(DCoreActor, spr.sectp, sector)
DEFINE_FIELD_NAMED(DCoreActor, spr.cstat, cstat)
DEFINE_FIELD_NAMED(DCoreActor, spr.cstat2, cstat2)
DEFINE_FIELD_NAMED(DCoreActor, spr.picnum, picnum)
DEFINE_FIELD_NAMED(DCoreActor, spr.statnum, statnum)
DEFINE_FIELD_NAMED(DCoreActor, spr.intangle, intangle)
DEFINE_FIELD_NAMED(DCoreActor, spr.pos, pos)
DEFINE_FIELD_NAMED(DCoreActor, spr.xint, xint)
DEFINE_FIELD_NAMED(DCoreActor, spr.yint, yint)
DEFINE_FIELD_NAMED(DCoreActor, spr.inittype, inittype)
DEFINE_FIELD_NAMED(DCoreActor, spr.hitag, hitag)
DEFINE_FIELD_NAMED(DCoreActor, spr.lotag, lotag)
DEFINE_FIELD_NAMED(DCoreActor, spr.type, type)
DEFINE_FIELD_NAMED(DCoreActor, spr.flags, flags) // need to be careful with this!
DEFINE_FIELD_NAMED(DCoreActor, spr.extra, extra)
DEFINE_FIELD_NAMED(DCoreActor, spr.detail, detail)
DEFINE_FIELD_NAMED(DCoreActor, spr.shade, shade)
DEFINE_FIELD_NAMED(DCoreActor, spr.pal, pal)
DEFINE_FIELD_NAMED(DCoreActor, spr.clipdist, intclipdist)
DEFINE_FIELD_NAMED(DCoreActor, clipdist, clipdist)
DEFINE_FIELD_NAMED(DCoreActor, spr.blend, blend)
DEFINE_FIELD_NAMED(DCoreActor, spr.scale, scale)
DEFINE_FIELD_NAMED(DCoreActor, spr.xoffset, xoffset)
DEFINE_FIELD_NAMED(DCoreActor, spr.yoffset, yoffset)
DEFINE_FIELD_NAMED(DCoreActor, spr.intowner, intowner)
DEFINE_FIELD_NAMED(DCoreActor, sprext.mdanimtims, mdanimtims)
DEFINE_FIELD_NAMED(DCoreActor, sprext.mdanimcur, mdanimcur)
DEFINE_FIELD_NAMED(DCoreActor, sprext.renderflags, renderflags)
DEFINE_FIELD_NAMED(DCoreActor, sprext.alpha, alpha)
DEFINE_FIELD_NAMED(DCoreActor, time, spawnindex)
DEFINE_FIELD(DCoreActor, spritesetindex)
DEFINE_FIELD_NAMED(DCoreActor, spr.angle, angle)
DEFINE_FIELD(DCoreActor, vel)
void coreactor_setpos(DCoreActor* self, double x, double y, double z, int relink)
{
self->spr.pos = { x, y, z };
// todo: SW needs to call updatesectorz here or have a separate function.
if (relink) SetActor(self, self->spr.pos);
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, setpos, coreactor_setpos)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
PARAM_BOOL(relink);
coreactor_setpos(self, x, y, z, relink);
return 0;
}
void coreactor_copypos(DCoreActor* self, DCoreActor* other, int relink)
{
if (!other) return;
self->spr.pos = other->spr.pos;
// todo: SW needs to call updatesectorz here or have a separate function.
if (relink) SetActor(self, self->spr.pos);
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, copypos, coreactor_setpos)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_POINTER(other, DCoreActor);
PARAM_BOOL(relink);
coreactor_copypos(self, other, relink);
return 0;
}
void coreactor_move(DCoreActor* self, double x, double y, double z, int relink)
{
self->spr.pos += { x, y, z };
// todo: SW needs to call updatesectorz here or have a separate function.
if (relink) SetActor(self, self->spr.pos);
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, move, coreactor_move)
{
PARAM_SELF_PROLOGUE(DCoreActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
PARAM_BOOL(relink);
coreactor_move(self, x, y, z, relink);
return 0;
}
void coreactor_setSpritePic(DCoreActor* self, unsigned z)
{
auto& spriteset = static_cast<PClassActor*>(self->GetClass())->ActorInfo()->SpriteSet;
if (z < spriteset.Size())
{
self->spritesetindex = z;
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;
}
void coreactor_backuppos(DCoreActor* self)
{
self->backuppos();
}
DEFINE_ACTION_FUNCTION_NATIVE(DCoreActor, backuppos, coreactor_backuppos)
{
PARAM_SELF_PROLOGUE(DCoreActor);
coreactor_backuppos(self);
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;
}