Skip to content

Commit

Permalink
Workable
Browse files Browse the repository at this point in the history
  • Loading branch information
ForserX committed Sep 22, 2024
1 parent 6ece3a4 commit b876181
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/xrEngine/IGame_Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ class IMainMenu

virtual void RegisterPPDraw(CUIWindow*) = 0;
virtual void UnregisterPPDraw(CUIWindow*) = 0;

virtual class CDialogHolder* GetDialogHolder() = 0;
};
1 change: 1 addition & 0 deletions src/xrEngine/IGame_UICustom.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class IGame_CustomUI
public:
virtual void ShowGameIndicators(bool) = 0;
virtual bool GameIndicatorsShown() const = 0;
virtual class CDialogHolder* GetDialogHolder() = 0;
};

extern ENGINE_API IGame_CustomUI* g_pGameCustom;
2 changes: 1 addition & 1 deletion src/xrEngine/xr_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ virtual const IObjectPhysicsCollision *physics_collision () { return 0; }

virtual void On_SetEntity () {};
virtual void On_LostEntity () {};

virtual class IInputReceiver* GetIIR () {return nullptr;}
public:
virtual bool register_schedule () const {return true;}

Expand Down
1 change: 1 addition & 0 deletions src/xrGame/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ virtual void _BCL HideAllWeapons ( bool v ){ SetWeaponHideState(INV_STATE_B

void set_inventory_disabled (bool is_disabled) { m_inventory_disabled = is_disabled; }
bool inventory_disabled () const { return m_inventory_disabled; }
virtual IInputReceiver* GetIIR() override { return this; }
private:
void set_state_box(u32 mstate);
private:
Expand Down
5 changes: 3 additions & 2 deletions src/xrGame/MainMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ class CMainMenu :

virtual bool UseIndicators () {return false;}

virtual CDialogHolder* GetDialogHolder() override { return this; }
void OnDeviceCreate ();

void Screenshot (IRender_interface::ScreenshotMode mode=IRender_interface::SM_NORMAL, LPCSTR name = 0);
virtual void RegisterPPDraw (CUIWindow* w);
virtual void UnregisterPPDraw (CUIWindow* w);
virtual void RegisterPPDraw (CUIWindow* w) override;
virtual void UnregisterPPDraw (CUIWindow* w) override;

void SetErrorDialog (EErrorDlg ErrDlg);
EErrorDlg GetErrorDialogType () const { return m_NeedErrDialog; } ;
Expand Down
1 change: 1 addition & 0 deletions src/xrGame/UIGameCustom.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class CUIGameCustom :

virtual void ShowGameIndicators (bool b) override {m_bShowGameIndicators = b;};
virtual bool GameIndicatorsShown () const override {return m_bShowGameIndicators;};
virtual CDialogHolder* GetDialogHolder () { return this; };
void ShowCrosshair (bool b) {psHUD_Flags.set (HUD_CROSSHAIR_RT, b);}
bool CrosshairShown () {return !!psHUD_Flags.test (HUD_CROSSHAIR_RT);}

Expand Down
13 changes: 5 additions & 8 deletions src/xrUI/Widgets/UIDialogHolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "../../xrEngine/IGame_UICustom.h"
#include "../xrEngine/xr_level_controller.h"
#include "../xrEngine/CustomHud.h"
#include "../xrEngine/xr_object.h"

dlgItem::dlgItem(CUIWindow* pWnd)
{
Expand Down Expand Up @@ -278,8 +279,7 @@ bool CDialogHolder::IR_UIOnKeyboardPress(int dik)
CObject* O = g_pGameLevel->CurrentEntity();
if (O)
{
// FX: Ïðîâåðèòü íà MP â ðåæèìå íàáëþäàòåëÿ, âîçìîæíà ïîð÷à ïàìÿòè
IInputReceiver* IR = (IInputReceiver*)(O);
IInputReceiver* IR = O->GetIIR();
if (IR)
{
EGameActions action = get_binded_action(dik);
Expand Down Expand Up @@ -315,8 +315,7 @@ bool CDialogHolder::IR_UIOnKeyboardRelease(int dik)
CObject* O = g_pGameLevel->CurrentEntity();
if( O )
{
// FX: Ïðîâåðèòü íà MP â ðåæèìå íàáëþäàòåëÿ, âîçìîæíà ïîð÷à ïàìÿòè
IInputReceiver* IR = (IInputReceiver*)(O);
IInputReceiver* IR = O->GetIIR();
if (IR)
IR->IR_OnKeyboardRelease(get_binded_action(dik));
return (false);
Expand All @@ -339,8 +338,7 @@ bool CDialogHolder::IR_UIOnKeyboardHold(int dik)
CObject* O = g_pGameLevel->CurrentEntity();
if(O)
{
// FX: Ïðîâåðèòü íà MP â ðåæèìå íàáëþäàòåëÿ, âîçìîæíà ïîð÷à ïàìÿòè
IInputReceiver* IR = (IInputReceiver*)(O);
IInputReceiver* IR = O->GetIIR();
if(IR)
IR->IR_OnKeyboardHold(get_binded_action(dik));
return false;
Expand Down Expand Up @@ -377,8 +375,7 @@ bool CDialogHolder::IR_UIOnMouseMove(int dx, int dy)
CObject* O = g_pGameLevel->CurrentEntity();
if(O)
{
// FX: Ïðîâåðèòü íà MP â ðåæèìå íàáëþäàòåëÿ, âîçìîæíà ïîð÷à ïàìÿòè
IInputReceiver* IR = (IInputReceiver*)(O);
IInputReceiver* IR = O->GetIIR();
if (IR)
IR->IR_OnMouseMove (dx,dy);
return false;
Expand Down
6 changes: 3 additions & 3 deletions src/xrUI/Widgets/UIDialogWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ bool CUIDialogWnd::IR_process()
UI_API CDialogHolder* CurrentDialogHolder()
{
if (g_pGamePersistent->m_pMainMenu->IsActive())
return (CDialogHolder*)g_pGamePersistent->m_pMainMenu;
else
return (CDialogHolder*)g_pGameCustom;
return g_pGamePersistent->m_pMainMenu->GetDialogHolder();

return g_pGameCustom->GetDialogHolder();
}


Expand Down
2 changes: 1 addition & 1 deletion src/xrUI/xrUIXmlParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

shared_str CUIXml::correct_file_name (LPCSTR path, LPCSTR fn)
{
#ifdef XRGAME_EXPORTS
#ifdef XR_UI_EXPORTS
if(0==xr_strcmp(path,UI_PATH) || 0==xr_strcmp(path,"UI"))
{
return UI().get_xml_name(fn);
Expand Down

0 comments on commit b876181

Please sign in to comment.