Fetch hWnd from Window::GetWindow()

This commit is contained in:
GEEKiDoS 2022-05-03 10:32:15 +08:00
parent 1b6a852d07
commit 64103044df
4 changed files with 7 additions and 24 deletions

View File

@ -12,7 +12,7 @@ namespace Components
tagPOINT curPos;
GetCursorPos(&curPos);
GetWindowRect(Game::g_wv->hWnd, &rc);
GetWindowRect(Window::GetWindow(), &rc);
auto isClamped = false;
if (curPos.x >= rc.left)
{
@ -77,7 +77,7 @@ namespace Components
{
static auto r_fullscreen = Dvar::Var("r_fullscreen");
if (GetForegroundWindow() == Game::g_wv->hWnd)
if (GetForegroundWindow() == Window::GetWindow())
{
if (r_fullscreen.get<bool>())
IN_ClampMouseMove();
@ -95,11 +95,11 @@ namespace Components
tagPOINT curPos;
GetCursorPos(&curPos);
Game::s_wmv->oldPos = curPos;
ScreenToClient(Game::g_wv->hWnd, &curPos);
ScreenToClient(Window::GetWindow(), &curPos);
Game::g_wv->recenterMouse = Game::CL_MouseEvent(curPos.x, curPos.y, dx, dy);
auto recenterMouse = Game::CL_MouseEvent(curPos.x, curPos.y, dx, dy);
if (Game::g_wv->recenterMouse)
if (recenterMouse)
{
Game::IN_RecenterMouse();
}
@ -108,7 +108,7 @@ namespace Components
void RawMouse::IN_RawMouse_Init()
{
if (Game::g_wv->hWnd && RawMouse::M_RawInput.get<bool>())
if (Window::GetWindow() && RawMouse::M_RawInput.get<bool>())
{
#ifdef DEBUG
Logger::Print("Raw Mouse Init.\n");
@ -118,7 +118,7 @@ namespace Components
Rid[0].usUsagePage = 0x01; // HID_USAGE_PAGE_GENERIC
Rid[0].usUsage = 0x02; // HID_USAGE_GENERIC_MOUSE
Rid[0].dwFlags = RIDEV_INPUTSINK;
Rid[0].hwndTarget = Game::g_wv->hWnd;
Rid[0].hwndTarget = Window::GetWindow();
RegisterRawInputDevices(Rid, ARRAYSIZE(Rid), sizeof(Rid[0]));
}

View File

@ -550,7 +550,6 @@ namespace Game
level_locals_t* level = reinterpret_cast<level_locals_t*>(0x1A831A8);
WinVars_t* g_wv = reinterpret_cast<WinVars_t*>(0x64A3AC8);
WinMouseVars_t* s_wmv = reinterpret_cast<WinMouseVars_t*>(0x649D640);
int* window_center_x = reinterpret_cast<int*>(0x649D638);

View File

@ -1148,7 +1148,6 @@ namespace Game
extern level_locals_t* level;
extern WinVars_t* g_wv;
extern WinMouseVars_t* s_wmv;
extern int* window_center_x;

View File

@ -7473,21 +7473,6 @@ namespace Game
static_assert(sizeof(level_locals_t) == 0x2F78);
struct WinVars_t
{
HINSTANCE reflib_library;
int reflib_active;
HWND hWnd;
HINSTANCE hInstance;
int hasFocus;
int activationStateChanged;
int recenterMouse;
HHOOK lowLevelKeyboardHook;
unsigned int sysMsgTime;
};
static_assert(sizeof(WinVars_t) == 0x24);
struct WinMouseVars_t
{
int oldButtonState;