mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- some conceptual work on statusbar stuff. This looks like a viable approach to build something that can replace SBARINFO.
This commit is contained in:
parent
f0e4f54c80
commit
9bd75bcac5
4 changed files with 70 additions and 0 deletions
|
@ -1429,3 +1429,65 @@ DBaseStatusBar *CreateStrifeStatusBar()
|
|||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
||||
static DObject *InitObject(PClass *type, int paramnum, VM_ARGS)
|
||||
{
|
||||
auto obj = type->CreateNew();
|
||||
// Todo: init
|
||||
return obj;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DStatusbarWidget, AppendWidget)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
PARAM_CLASS(type, DObject);
|
||||
if (!type->IsDescendantOf(NAME_StatusbarWidget) || type->IsDescendantOf(NAME_StatusbarCondition))
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "Invalid class %s for AppendWidget", type->TypeName.GetChars());
|
||||
}
|
||||
auto obj = InitObject(type, paramnum, VM_ARGS_NAMES);
|
||||
auto owner = self->PointerVar<DObject>(NAME_Owner);
|
||||
self->PointerVar<DObject>(NAME_Next) = obj;
|
||||
obj->PointerVar<DObject>(NAME_Prev) = self;
|
||||
obj->PointerVar<DObject>(NAME_Owner) = owner;
|
||||
ACTION_RETURN_POINTER(obj);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DStatusbarWidget, BeginCondition)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
PARAM_CLASS(type, DObject);
|
||||
if (!type->IsDescendantOf(NAME_StatusbarCondition))
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "Invalid class %s for BeginCondition", type->TypeName.GetChars());
|
||||
}
|
||||
auto obj = InitObject(type, paramnum, VM_ARGS_NAMES);
|
||||
auto head = PClass::FindClass(NAME_StatusbarWidget)->CreateNew();
|
||||
|
||||
head->PointerVar<DObject>(NAME_Owner) = self;
|
||||
self->PointerVar<DObject>(NAME_Children) = head;
|
||||
ACTION_RETURN_POINTER(head);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DStatusbarWidget, EndCondition)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
auto owner = self->PointerVar<DObject>(NAME_Owner);
|
||||
if (owner == nullptr || !owner->IsKindOf(NAME_StatusbarCondition))
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "No matching BeginCondition found for EndCondition");
|
||||
}
|
||||
ACTION_RETURN_POINTER(owner);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DStatusbarWidget, Finish)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DObject);
|
||||
auto owner = self->PointerVar<DObject>(NAME_Owner);
|
||||
if (owner == nullptr || owner->PointerVar<DObject>(NAME_Owner) != owner || owner->GetClass()->TypeName != NAME_StatusbarWidget)
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "No matching Begin found for Finish");
|
||||
}
|
||||
ACTION_RETURN_POINTER(owner);
|
||||
}
|
||||
|
|
|
@ -648,6 +648,12 @@ xx(Staticconst)
|
|||
xx(DeathmatchStatusScreen)
|
||||
xx(CoopStatusScreen)
|
||||
xx(RavenStatusScreen)
|
||||
xx(StatusbarWidget)
|
||||
xx(StatusbarCondition)
|
||||
xx(Next)
|
||||
xx(Prev)
|
||||
xx(Children)
|
||||
xx(Owner)
|
||||
|
||||
// USDF keywords
|
||||
xx(Amount)
|
||||
|
|
|
@ -914,6 +914,7 @@ void NullParam(const char *varname);
|
|||
#define PARAM_POINTERTYPE(x,type) ++paramnum; PARAM_POINTERTYPE_AT(paramnum,x,type)
|
||||
#define PARAM_OBJECT(x,type) ++paramnum; PARAM_OBJECT_AT(paramnum,x,type)
|
||||
#define PARAM_CLASS(x,base) ++paramnum; PARAM_CLASS_AT(paramnum,x,base)
|
||||
#define PARAM_CLASS(x,base) ++paramnum; PARAM_CLASS_AT(paramnum,x,base)
|
||||
#define PARAM_POINTER_NOT_NULL(x,type) ++paramnum; PARAM_POINTER_NOT_NULL_AT(paramnum,x,type)
|
||||
#define PARAM_OBJECT_NOT_NULL(x,type) ++paramnum; PARAM_OBJECT_NOT_NULL_AT(paramnum,x,type)
|
||||
#define PARAM_CLASS_NOT_NULL(x,base) ++paramnum; PARAM_CLASS_NOT_NULL_AT(paramnum,x,base)
|
||||
|
|
|
@ -35,6 +35,7 @@ version "2.5"
|
|||
#include "zscript/statusbar/statusbar.txt"
|
||||
#include "zscript/statusbar/strife_sbar.txt"
|
||||
#include "zscript/statusbar/sbarinfowrapper.txt"
|
||||
#include "zscript/statusbar/statusbarwidget.txt"
|
||||
|
||||
#include "zscript/inventory/inventory.txt"
|
||||
#include "zscript/inventory/inv_misc.txt"
|
||||
|
|
Loading…
Reference in a new issue