mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- added varargs pushv function to Array<int>.
We'll need this for the ANM sound arrays. Support for other array<> types to be done later.
This commit is contained in:
parent
66799d9a6d
commit
b515543016
2 changed files with 26 additions and 0 deletions
|
@ -37,6 +37,7 @@
|
|||
#include "dobject.h"
|
||||
#include "vm.h"
|
||||
#include "types.h"
|
||||
#include "v_draw.h"
|
||||
|
||||
// We need one specific type for each of the 8 integral VM types and instantiate the needed functions for each of them.
|
||||
// Dynamic arrays cannot hold structs because for every type there'd need to be an internal implementation which is impossible.
|
||||
|
@ -412,6 +413,30 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_I32, Push, ArrayPush<FDynArray_I32 COMMA
|
|||
ACTION_RETURN_INT(self->Push(val));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FDynArray_I32, PushV)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_I32);
|
||||
PARAM_INT(val);
|
||||
PARAM_VA_POINTER(va_reginfo); // Get the hidden type information array
|
||||
self->Push(val);
|
||||
VMVa_List args = { param + 3, 0, numparam - 4, va_reginfo + 3 };
|
||||
while (args.curindex < args.numargs)
|
||||
{
|
||||
if (args.reginfo[args.curindex] == REGT_INT)
|
||||
{
|
||||
self->Push(args.args[args.curindex++].i);
|
||||
}
|
||||
else if (args.reginfo[args.curindex] == REGT_FLOAT)
|
||||
{
|
||||
self->Push(int(args.args[args.curindex++].f));
|
||||
}
|
||||
else ThrowAbortException(X_OTHER, "Invalid parameter in pushv, int expected");
|
||||
}
|
||||
|
||||
|
||||
ACTION_RETURN_INT(self->Size()-1);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_I32, Pop, ArrayPop<FDynArray_I32>)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_I32);
|
||||
|
|
|
@ -50,6 +50,7 @@ struct DynArray_I32 native
|
|||
native void Append (DynArray_I32 other);
|
||||
native uint Find(int item) const;
|
||||
native uint Push (int item);
|
||||
native vararg uint PushV (int item, ...);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, int item);
|
||||
|
|
Loading…
Reference in a new issue