mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-13 07:57:58 +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";
|
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 ***************************************************************/
|
/* PPointer ***************************************************************/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PPointer, false, true, false, false)
|
IMPLEMENT_CLASS(PPointer, false, true, false, false)
|
||||||
|
@ -1736,6 +1692,48 @@ PPointer *NewPointer(PType *type, bool isconst)
|
||||||
return static_cast<PPointer *>(ptype);
|
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 **********************************************************/
|
/* PClassPointer **********************************************************/
|
||||||
|
|
||||||
|
|
|
@ -551,16 +551,6 @@ public:
|
||||||
|
|
||||||
// Pointers -----------------------------------------------------------------
|
// 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
|
class PPointer : public PBasicType
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PPointer, PBasicType);
|
DECLARE_CLASS(PPointer, PBasicType);
|
||||||
|
@ -583,6 +573,17 @@ protected:
|
||||||
void SetOps();
|
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
|
class PClassPointer : public PPointer
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassPointer, PPointer);
|
DECLARE_CLASS(PClassPointer, PPointer);
|
||||||
|
|
Loading…
Reference in a new issue