mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- exported some stuff for fonts and screen size that will be needed for the menus.
This commit is contained in:
parent
d5b908186c
commit
abac756289
4 changed files with 57 additions and 14 deletions
|
@ -53,6 +53,7 @@
|
|||
#include "vm.h"
|
||||
#include "p_checkposition.h"
|
||||
#include "r_sky.h"
|
||||
#include "v_font.h"
|
||||
|
||||
static TArray<FPropertyInfo*> properties;
|
||||
static TArray<AFuncDesc> AFTable;
|
||||
|
@ -801,34 +802,51 @@ void InitThingdef()
|
|||
pstruct->Size = sizeof(player_t);
|
||||
pstruct->Align = alignof(player_t);
|
||||
PArray *parray = NewArray(pstruct, MAXPLAYERS);
|
||||
PField *playerf = new PField("players", parray, VARF_Native | VARF_Static, (intptr_t)&players);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
|
||||
PField *fieldptr = new PField("players", parray, VARF_Native | VARF_Static, (intptr_t)&players);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
pstruct->AddNativeField("weapons", NewNativeStruct("WeaponSlots", nullptr), myoffsetof(player_t, weapons), VARF_Native);
|
||||
|
||||
|
||||
parray = NewArray(TypeBool, MAXPLAYERS);
|
||||
playerf = new PField("playeringame", parray, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&playeringame);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
|
||||
fieldptr = new PField("playeringame", parray, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&playeringame);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
playerf = new PField("gameaction", TypeUInt8, VARF_Native | VARF_Static, (intptr_t)&gameaction);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
|
||||
fieldptr = new PField("gameaction", TypeUInt8, VARF_Native | VARF_Static, (intptr_t)&gameaction);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
playerf = new PField("skyflatnum", TypeTextureID, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&skyflatnum);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
|
||||
fieldptr = new PField("skyflatnum", TypeTextureID, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&skyflatnum);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
playerf = new PField("globalfreeze", TypeUInt8, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&bglobal.freeze);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
|
||||
fieldptr = new PField("globalfreeze", TypeUInt8, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&bglobal.freeze);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
playerf = new PField("consoleplayer", TypeSInt32, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&consoleplayer);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
|
||||
fieldptr = new PField("consoleplayer", TypeSInt32, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&consoleplayer);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
auto fontptr = NewPointer(NewNativeStruct("Font", nullptr));
|
||||
|
||||
fieldptr = new PField("smallfont", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&SmallFont);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
fieldptr = new PField("smallfont2", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&SmallFont2);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
fieldptr = new PField("bigfont", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&BigFont);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
fieldptr = new PField("confont", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&ConFont);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
fieldptr = new PField("intermissionfont", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&IntermissionFont);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
// Argh. It sucks when bad hacks need to be supported. WP_NOCHANGE is just a bogus pointer but it used everywhere as a special flag.
|
||||
// It cannot be defined as constant because constants can either be numbers or strings but nothing else, so the only 'solution'
|
||||
// is to create a static variable from it and reference that in the script. Yuck!!!
|
||||
static AWeapon *wpnochg = WP_NOCHANGE;
|
||||
playerf = new PField("WP_NOCHANGE", NewPointer(RUNTIME_CLASS(AWeapon), false), VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&wpnochg);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
|
||||
fieldptr = new PField("WP_NOCHANGE", NewPointer(RUNTIME_CLASS(AWeapon), false), VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&wpnochg);
|
||||
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
|
||||
|
||||
// synthesize a symbol for each flag from the flag name tables to avoid redundant declaration of them.
|
||||
for (auto &fl : FlagLists)
|
||||
|
|
|
@ -91,6 +91,17 @@ CVAR (Bool, hud_scale, true, CVAR_ARCHIVE);
|
|||
static int LastPal = -1;
|
||||
static uint32 LastRGB;
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Screen, GetWidth)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
ACTION_RETURN_INT(screen->GetWidth());
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Screen, GetHeight)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
ACTION_RETURN_INT(screen->GetHeight());
|
||||
}
|
||||
|
||||
static int PalFromRGB(uint32 rgb)
|
||||
{
|
||||
|
|
|
@ -525,6 +525,13 @@ FFont *FFont::FindFont (const char *name)
|
|||
return font;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(FFont, FindFont)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_STRING(name);
|
||||
ACTION_RETURN_POINTER(FFont::FindFont(name));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// RecordTextureColors
|
||||
|
|
|
@ -63,9 +63,16 @@ struct Screen native
|
|||
NUM_TEXT_COLORS
|
||||
};
|
||||
|
||||
native static int GetWidth();
|
||||
native static int GetHeight();
|
||||
native static void DrawHUDTexture(TextureID tex, double x, double y);
|
||||
}
|
||||
|
||||
struct Font native
|
||||
{
|
||||
native static Font FindFont(String name);
|
||||
}
|
||||
|
||||
struct Console native
|
||||
{
|
||||
native static void HideConsole();
|
||||
|
|
Loading…
Reference in a new issue