mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- made PStatePointer a real pointer pointing to a native struct named 'state', because that's what it really is and what it needs to be if we want to use a state as more than an opaque identifier in the VM
This commit is contained in:
parent
6cc00e79a6
commit
ff3baac8a7
2 changed files with 53 additions and 54 deletions
|
@ -1547,50 +1547,6 @@ PStateLabel::PStateLabel()
|
|||
mDescriptiveName = "StateLabel";
|
||||
}
|
||||
|
||||
/* PStatePointer **********************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PStatePointer, false, false, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStatePointer Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PStatePointer::PStatePointer()
|
||||
: PBasicType(sizeof(FState *), alignof(FState *))
|
||||
{
|
||||
mDescriptiveName = "State";
|
||||
storeOp = OP_SP;
|
||||
loadOp = OP_LP;
|
||||
moveOp = OP_MOVEA;
|
||||
RegType = REGT_POINTER;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStatePointer :: WriteValue
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void PStatePointer::WriteValue(FSerializer &ar, const char *key,const void *addr) const
|
||||
{
|
||||
ar(key, *(FState **)addr);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStatePointer :: ReadValue
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool PStatePointer::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
||||
{
|
||||
bool res = false;
|
||||
::Serialize(ar, key, *(FState **)addr, nullptr, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* PPointer ***************************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PPointer, false, true, false, false)
|
||||
|
@ -1736,6 +1692,48 @@ PPointer *NewPointer(PType *type, bool isconst)
|
|||
return static_cast<PPointer *>(ptype);
|
||||
}
|
||||
|
||||
/* PStatePointer **********************************************************/
|
||||
|
||||
IMPLEMENT_CLASS(PStatePointer, false, false, false, false)
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStatePointer Default Constructor
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
PStatePointer::PStatePointer()
|
||||
{
|
||||
mDescriptiveName = "Pointer<State>";
|
||||
PointedType = NewNativeStruct(NAME_State, nullptr);
|
||||
IsConst = true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStatePointer :: WriteValue
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void PStatePointer::WriteValue(FSerializer &ar, const char *key, const void *addr) const
|
||||
{
|
||||
ar(key, *(FState **)addr);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PStatePointer :: ReadValue
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool PStatePointer::ReadValue(FSerializer &ar, const char *key, void *addr) const
|
||||
{
|
||||
bool res = false;
|
||||
::Serialize(ar, key, *(FState **)addr, nullptr, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* PClassPointer **********************************************************/
|
||||
|
||||
|
|
|
@ -551,16 +551,6 @@ public:
|
|||
|
||||
// Pointers -----------------------------------------------------------------
|
||||
|
||||
class PStatePointer : public PBasicType
|
||||
{
|
||||
DECLARE_CLASS(PStatePointer, PBasicType);
|
||||
public:
|
||||
PStatePointer();
|
||||
|
||||
void WriteValue(FSerializer &ar, const char *key,const void *addr) const override;
|
||||
bool ReadValue(FSerializer &ar, const char *key,void *addr) const override;
|
||||
};
|
||||
|
||||
class PPointer : public PBasicType
|
||||
{
|
||||
DECLARE_CLASS(PPointer, PBasicType);
|
||||
|
@ -583,6 +573,17 @@ protected:
|
|||
void SetOps();
|
||||
};
|
||||
|
||||
class PStatePointer : public PPointer
|
||||
{
|
||||
DECLARE_CLASS(PStatePointer, PPointer);
|
||||
public:
|
||||
PStatePointer();
|
||||
|
||||
void WriteValue(FSerializer &ar, const char *key, const void *addr) const override;
|
||||
bool ReadValue(FSerializer &ar, const char *key, void *addr) const override;
|
||||
};
|
||||
|
||||
|
||||
class PClassPointer : public PPointer
|
||||
{
|
||||
DECLARE_CLASS(PClassPointer, PPointer);
|
||||
|
|
Loading…
Reference in a new issue