mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +00:00
- exported ADecal to ZScript as a non-native class.
Its one function is still native but this was by far the easiest of the remaining actor classes to export.
This commit is contained in:
parent
e90ed0a01c
commit
a5ee673c91
2 changed files with 20 additions and 21 deletions
|
@ -43,6 +43,7 @@
|
|||
#include "serializer.h"
|
||||
#include "doomdata.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "vm.h"
|
||||
|
||||
static double DecalWidth, DecalLeft, DecalRight;
|
||||
static double SpreadZ;
|
||||
|
@ -753,29 +754,20 @@ DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
class ADecal : public AActor
|
||||
DEFINE_ACTION_FUNCTION(ADecal, SpawnDecal)
|
||||
{
|
||||
DECLARE_CLASS (ADecal, AActor);
|
||||
public:
|
||||
void BeginPlay ();
|
||||
};
|
||||
PARAM_SELF_PROLOGUE(AActor);
|
||||
|
||||
IMPLEMENT_CLASS(ADecal, false, false)
|
||||
|
||||
void ADecal::BeginPlay ()
|
||||
{
|
||||
const FDecalTemplate *tpl = nullptr;
|
||||
|
||||
Super::BeginPlay ();
|
||||
|
||||
if (args[0] < 0)
|
||||
if (self->args[0] < 0)
|
||||
{
|
||||
FName name = ENamedName(-args[0]);
|
||||
FName name = ENamedName(-self->args[0]);
|
||||
tpl = DecalLibrary.GetDecalByName(name.GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
int decalid = args[0] + (args[1] << 8); // [KS] High byte for decals.
|
||||
int decalid = self->args[0] + (self->args[1] << 8); // [KS] High byte for decals.
|
||||
tpl = DecalLibrary.GetDecalByNum(decalid);
|
||||
}
|
||||
|
||||
|
@ -784,23 +776,22 @@ void ADecal::BeginPlay ()
|
|||
{
|
||||
if (!tpl->PicNum.Exists())
|
||||
{
|
||||
Printf("Decal actor at (%f,%f) does not have a valid texture\n", X(), Y());
|
||||
Printf("Decal actor at (%f,%f) does not have a valid texture\n", self->X(), self->Y());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Look for a wall within 64 units behind the actor. If none can be
|
||||
// found, then no decal is created, and this actor is destroyed
|
||||
// without effectively doing anything.
|
||||
if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), Z(), Angles.Yaw + 180, 64., true))
|
||||
if (NULL == ShootDecal(tpl, self, self->Sector, self->X(), self->Y(), self->Z(), self->Angles.Yaw + 180, 64., true))
|
||||
{
|
||||
DPrintf (DMSG_WARNING, "Could not find a wall to stick decal to at (%f,%f)\n", X(), Y());
|
||||
DPrintf (DMSG_WARNING, "Could not find a wall to stick decal to at (%f,%f)\n", self->X(), self->Y());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPrintf (DMSG_ERROR, "Decal actor at (%f,%f) does not have a good template\n", X(), Y());
|
||||
DPrintf (DMSG_ERROR, "Decal actor at (%f,%f) does not have a good template\n", self->X(), self->Y());
|
||||
}
|
||||
// This actor doesn't need to stick around anymore.
|
||||
Destroy();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
class Decal : Actor native
|
||||
class Decal : Actor
|
||||
{
|
||||
native void SpawnDecal();
|
||||
|
||||
override void BeginPlay()
|
||||
{
|
||||
Super.BeginPlay();
|
||||
SpawnDecal();
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue