- move two more backend->frontend calls to the interface

This commit is contained in:
Christoph Oelckers 2022-10-02 18:29:57 +02:00
parent b19b0db150
commit e6615629b3
5 changed files with 9 additions and 6 deletions

View file

@ -94,7 +94,7 @@ void D_ProcessEvents (void)
continue; // menu ate the event continue; // menu ate the event
} }
if (G_Responder(ev) && ev->type == EV_KeyDown) keywasdown.Set(ev->data1); if (sysCallbacks.G_Responder(ev) && ev->type == EV_KeyDown) keywasdown.Set(ev->data1);
} }
for (auto& ev: delayedevents) for (auto& ev: delayedevents)

View file

@ -7,10 +7,12 @@
struct event_t; struct event_t;
class FRenderState; class FRenderState;
class FGameTexture; class FGameTexture;
class FTextureID;
enum EUpscaleFlags : int; enum EUpscaleFlags : int;
struct SystemCallbacks struct SystemCallbacks
{ {
bool (*G_Responder)(event_t* ev); // this MUST be set, otherwise nothing will work
bool (*WantGuiCapture)(); bool (*WantGuiCapture)();
bool (*WantLeftButton)(); bool (*WantLeftButton)();
bool (*NetGame)(); bool (*NetGame)();
@ -41,6 +43,7 @@ struct SystemCallbacks
bool (*SetSpecialMenu)(FName& menu, int param); bool (*SetSpecialMenu)(FName& menu, int param);
void (*OnMenuOpen)(bool makesound); void (*OnMenuOpen)(bool makesound);
void (*LanguageChanged)(const char*); void (*LanguageChanged)(const char*);
bool (*OkForLocalization)(FTextureID, const char*);
}; };
extern SystemCallbacks sysCallbacks; extern SystemCallbacks sysCallbacks;

View file

@ -111,8 +111,6 @@ extern PClass *DefaultOptionMenuClass;
#define KEY_REPEAT_DELAY (GameTicRate*5/12) #define KEY_REPEAT_DELAY (GameTicRate*5/12)
#define KEY_REPEAT_RATE (3) #define KEY_REPEAT_RATE (3)
bool OkForLocalization(FTextureID texnum, const char* substitute);
//============================================================================ //============================================================================
// //
// //

View file

@ -522,11 +522,9 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckRealHeight, CheckRealHeight)
ACTION_RETURN_INT(CheckRealHeight(texid)); ACTION_RETURN_INT(CheckRealHeight(texid));
} }
bool OkForLocalization(FTextureID texnum, const char* substitute);
static int OkForLocalization_(int index, const FString& substitute) static int OkForLocalization_(int index, const FString& substitute)
{ {
return OkForLocalization(FSetTextureID(index), substitute); return sysCallbacks.OkForLocalization? sysCallbacks.OkForLocalization(FSetTextureID(index), substitute) : false;
} }
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, OkForLocalization, OkForLocalization_) DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, OkForLocalization, OkForLocalization_)

View file

@ -178,6 +178,7 @@ void S_ParseMusInfo();
void D_GrabCVarDefaults(); void D_GrabCVarDefaults();
void LoadHexFont(const char* filename); void LoadHexFont(const char* filename);
void InitBuildTiles(); void InitBuildTiles();
bool OkForLocalization(FTextureID texnum, const char* substitute);
// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
@ -3524,6 +3525,7 @@ static int D_DoomMain_Internal (void)
buttonMap.GetButton(Button_Klook)->bReleaseLock = true; buttonMap.GetButton(Button_Klook)->bReleaseLock = true;
sysCallbacks = { sysCallbacks = {
G_Responder,
System_WantGuiCapture, System_WantGuiCapture,
System_WantLeftButton, System_WantLeftButton,
System_NetGame, System_NetGame,
@ -3554,6 +3556,8 @@ static int D_DoomMain_Internal (void)
M_SetSpecialMenu, M_SetSpecialMenu,
OnMenuOpen, OnMenuOpen,
System_LanguageChanged, System_LanguageChanged,
OkForLocalization,
}; };