Peds, Hud, CFO 1/2, fixes - including zone names

This commit is contained in:
eray orçunus
2020-07-21 05:59:31 +03:00
parent 5bedca7692
commit f40f44b14e
30 changed files with 1467 additions and 818 deletions

View File

@ -64,10 +64,6 @@ static psGlobalType PsGlobal;
#undef MAKEPOINTS
#define MAKEPOINTS(l) (*((POINTS /*FAR*/ *)&(l)))
#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
#define JIF(x) if (FAILED(hr=(x))) \
{debug(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("\n"), hr); return;}
unsigned long _dwMemAvailPhys;
RwUInt32 gGameState;
@ -830,9 +826,10 @@ void _InputInitialiseJoys()
}
}
void _InputInitialiseMouse()
long _InputInitialiseMouse(bool exclusive)
{
glfwSetInputMode(PSGLOBAL(window), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
return 0;
}
void psPostRWinit(void)
@ -847,7 +844,7 @@ void psPostRWinit(void)
glfwSetJoystickCallback(joysChangeCB);
_InputInitialiseJoys();
_InputInitialiseMouse();
_InputInitialiseMouse(false);
if(!(vm.flags & rwVIDEOMODEEXCLUSIVE))
glfwSetWindowSize(PSGLOBAL(window), RsGlobal.maximumWidth, RsGlobal.maximumHeight);

View File

@ -35,6 +35,7 @@ extern RwBool psInstallFileSystem(void);
extern RwBool psNativeTextureSupport(void);
extern void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
extern long _InputInitialiseMouse(bool exclusive); // returns HRESULT on Windows actually
extern void HandleExit();

View File

@ -1602,7 +1602,6 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode)
return TRUE;
}
/*
*****************************************************************************
*/
@ -2003,7 +2002,7 @@ WinMain(HINSTANCE instance,
if ( _InputInitialise() == S_OK )
{
_InputInitialiseMouse();
_InputInitialiseMouse(false);
_InputInitialiseJoys();
}
@ -2542,7 +2541,7 @@ HRESULT _InputInitialise()
return S_OK;
}
HRESULT _InputInitialiseMouse()
HRESULT _InputInitialiseMouse(bool exclusive)
{
HRESULT hr;
@ -2560,7 +2559,7 @@ HRESULT _InputInitialiseMouse()
if( FAILED( hr = PSGLOBAL(mouse)->SetDataFormat( &c_dfDIMouse2 ) ) )
return hr;
if( FAILED( hr = PSGLOBAL(mouse)->SetCooperativeLevel( PSGLOBAL(window), DISCL_NONEXCLUSIVE | DISCL_FOREGROUND ) ) )
if( FAILED( hr = PSGLOBAL(mouse)->SetCooperativeLevel( PSGLOBAL(window), (exclusive ? DISCL_EXCLUSIVE : DISCL_NONEXCLUSIVE) | DISCL_FOREGROUND ) ) )
return hr;
// Acquire the newly created device
@ -2848,6 +2847,23 @@ void _InputShutdown()
SAFE_RELEASE(PSGLOBAL(dinterface));
}
void _InputShutdownMouse()
{
if (PSGLOBAL(mouse) == nil)
return;
PSGLOBAL(mouse)->Unacquire();
SAFE_RELEASE(PSGLOBAL(mouse));
}
BOOL _InputMouseNeedsExclusive(void)
{
RwVideoMode vm;
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
return vm.flags & rwVIDEOMODEEXCLUSIVE;
}
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext )
{
HRESULT hr;

View File

@ -88,13 +88,14 @@ extern LRESULT CALLBACK
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
HRESULT _InputInitialise();
HRESULT _InputInitialiseMouse();
HRESULT CapturePad(RwInt32 padID);
void _InputInitialiseJoys();
void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
HRESULT _InputAddJoys();
HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
void _InputShutdown();
void _InputShutdownMouse();
BOOL _InputMouseNeedsExclusive();
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);