diff --git a/saco/cmdwindow.h b/saco/cmdwindow.h index 04ca822..3bf34a4 100644 --- a/saco/cmdwindow.h +++ b/saco/cmdwindow.h @@ -35,6 +35,9 @@ public: void GetDialogSize(RECT *pRect); + // 0x14E0 falls inside m_szCmdNames, so the accessor reaches it by a cast + int GetField14E0() { return *(int *)((char *)this + 0x14E0); }; // .text:10002E50, out of line copy + bool IsImeActive(); // .text:10069810 void Enable(); diff --git a/saco/net/localplayer.cpp b/saco/net/localplayer.cpp index acd1ea0..a213908 100644 --- a/saco/net/localplayer.cpp +++ b/saco/net/localplayer.cpp @@ -5,6 +5,9 @@ extern CGame *pGame; extern CNetGame *pNetGame; +extern CCmdWindow *pCmdWindow; +extern CUnkClass3 *pUnkClass3; +extern CDXUTDialog *pClassSelectDialog; DWORD dword_100FE0A4 = -1; DWORD dword_100FE0A8 = 30; @@ -674,3 +677,65 @@ void CLocalPlayer::SetInteriorId(BYTE byteInteriorId) bsSend.Write(byteInteriorId); pNetGame->GetRakClient()->RPC(RPC_SetInteriorId, &bsSend, HIGH_PRIORITY, RELIABLE, 0, FALSE); } + +//---------------------------------------------------- + +// drives class selection: centres the dialog on entry, then steps on the arrows +void CLocalPlayer::FUNC_10006100() +{ + if(!pGame->sub_100A0920()) + { + pGame->sub_100A1DB0(0); + pGame->ToggleKeyInputsDisabled(2, 0); + } + + if(pUnkClass3 && pUnkClass3->GetField28()) + return; + + if(!field_306) + { + RECT rect; + + pClassSelectDialog->SetVisible(true); + GetClientRect(pGame->GetMainWindowHwnd(), &rect); + pClassSelectDialog->SetLocation(rect.right / 2 - pClassSelectDialog->GetWidth() / 2, + rect.bottom - pClassSelectDialog->GetHeight() - 50); + + field_306 = 1; + RequestClass(field_2FE); + return; + } + + if(GetTickCount() - field_14B < 2000) + return; + + if(!field_302) + { + if(!field_143) + return; + + if((GetAsyncKeyState(VK_SHIFT) & 0x8000) && !pCmdWindow->GetField14E0()) + { + sub_10004060(); + return; + } + } + + if(!field_143) + return; + + DWORD dwElapsed = GetTickCount() - field_147; + + if((GetAsyncKeyState(VK_LEFT) & 0x8000) && dwElapsed > 250) + { + field_147 = GetTickCount(); + SelectPreviousClass(); + return; + } + + if((GetAsyncKeyState(VK_RIGHT) & 0x8000) && dwElapsed > 250) + { + field_147 = GetTickCount(); + SelectNextClass(); + } +} diff --git a/saco/net/localplayer.h b/saco/net/localplayer.h index 9ba447f..2f20231 100644 --- a/saco/net/localplayer.h +++ b/saco/net/localplayer.h @@ -151,6 +151,7 @@ public: void FUNC_10004080(); // .text:10004080 void FUNC_10004230(WORD a1); // .text:10004230 void FUNC_10004280(PLAYERID playerId); // .text:10004280 + void FUNC_10006100(); // .text:10006100 void SendDeath(); // .text:10005810 void SetInteriorId(BYTE byteInteriorId); // .text:10005970 void FUNC_10003F50(); // .text:10003F50 diff --git a/saco/unkclass3.h b/saco/unkclass3.h index 1a644ec..1050d2b 100644 --- a/saco/unkclass3.h +++ b/saco/unkclass3.h @@ -25,4 +25,6 @@ public: CUnkClass3(IDirect3DDevice9 *pD3DDevice); void ResetDialogControls(CDXUTDialog *pDialog); + + int GetField28() { return field_28; }; // .text:10002E60, out of line copy };