- Backend update fron Raze, mainly new script exports and extensions.
This commit is contained in:
parent
b193e582ce
commit
52554dc32c
21 changed files with 288 additions and 17 deletions
|
|
@ -8706,7 +8706,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
|
|||
bool writable;
|
||||
ArgList[i] = ArgList[i]->Resolve(ctx); // must be resolved before the address is requested.
|
||||
|
||||
if (ArgList[i]->ValueType->isRealPointer())
|
||||
if (ArgList[i] && ArgList[i]->ValueType->isRealPointer())
|
||||
{
|
||||
auto pointedType = ArgList[i]->ValueType->toPointer()->PointedType;
|
||||
if (pointedType && pointedType->isDynArray())
|
||||
|
|
|
|||
|
|
@ -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,28 @@ 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_VA_POINTER(va_reginfo); // Get the hidden type information array
|
||||
VMVa_List args = { param + 1, 0, numparam - 2, va_reginfo + 1 };
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -550,7 +550,21 @@ DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, ToDouble, StringToDbl)
|
|||
ACTION_RETURN_FLOAT(self->ToDouble());
|
||||
}
|
||||
|
||||
static void StringSplit(FString *self, TArray<FString> *tokens, const FString &delimiter, int keepEmpty)
|
||||
static void StringSubst(FString *self, const FString &substr, const FString& replc)
|
||||
{
|
||||
self->Substitute(substr, replc);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, Substitute, StringSubst)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FString);
|
||||
PARAM_STRING(substr);
|
||||
PARAM_STRING(replc);
|
||||
StringSubst(self, substr, replc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void StringSplit(FString* self, TArray<FString>* tokens, const FString& delimiter, int keepEmpty)
|
||||
{
|
||||
self->Split(*tokens, delimiter, static_cast<FString::EmptyTokenType>(keepEmpty));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#include "s_music.h"
|
||||
#include "i_interface.h"
|
||||
#include "base_sbar.h"
|
||||
#include "image.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -339,8 +340,7 @@ DEFINE_ACTION_FUNCTION(_TexMan, GetName)
|
|||
|
||||
static int CheckForTexture(const FString& name, int type, int flags)
|
||||
{
|
||||
// ForceLookup is intentionally blocked here, this flag is for internal use only.
|
||||
return TexMan.CheckForTexture(name, static_cast<ETextureType>(type), (flags & ~FTextureManager::TEXMAN_ForceLookup)).GetIndex();
|
||||
return TexMan.CheckForTexture(name, static_cast<ETextureType>(type), flags).GetIndex();
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture)
|
||||
|
|
@ -480,6 +480,20 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, OkForLocalization, OkForLocalization_)
|
|||
ACTION_RETURN_INT(OkForLocalization_(name, subst));
|
||||
}
|
||||
|
||||
static int UseGamePalette(int index)
|
||||
{
|
||||
auto tex = TexMan.GameByIndex(index, false);
|
||||
if (!tex) return false;
|
||||
auto image = tex->GetTexture()->GetImage();
|
||||
return image ? image->UseGamePalette() : false;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, UseGamePalette, UseGamePalette)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(texid);
|
||||
ACTION_RETURN_INT(UseGamePalette(texid));
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
//
|
||||
|
|
@ -870,6 +884,13 @@ DEFINE_ACTION_FUNCTION(FKeyBindings, GetAllKeysForCommand)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FKeyBindings, GetBinding)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings);
|
||||
PARAM_INT(key);
|
||||
ACTION_RETURN_STRING(self->GetBinding(key));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FKeyBindings, UnbindACommand)
|
||||
{
|
||||
PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings);
|
||||
|
|
@ -917,6 +938,7 @@ DEFINE_GLOBAL_NAMED(mus_playing, musplaying);
|
|||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, name);
|
||||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, baseorder);
|
||||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, loop);
|
||||
DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, handle);
|
||||
|
||||
DEFINE_GLOBAL_NAMED(PClass::AllClasses, AllClasses)
|
||||
DEFINE_GLOBAL(Bindings)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue