mirror of
				https://github.com/thunderbrewhq/thunderbrew
				synced 2025-10-31 00:06:05 +03:00 
			
		
		
		
	feat(game): prepare EnterWorld classes and methods
This commit is contained in:
		
							parent
							
								
									5e25dc0171
								
							
						
					
					
						commit
						d46e056299
					
				| @ -39,6 +39,7 @@ target_link_libraries(client | ||||
|         console | ||||
|         db | ||||
|         event | ||||
|         gameui | ||||
|         gx | ||||
|         model | ||||
|         net | ||||
|  | ||||
| @ -9,6 +9,7 @@ | ||||
| #include "console/Command.hpp" | ||||
| #include "db/Db.hpp" | ||||
| #include "glue/CGlueMgr.hpp" | ||||
| #include "gameui/CGGameUI.hpp" | ||||
| #include "gx/Screen.hpp" | ||||
| #include "gx/Texture.hpp" | ||||
| #include "model/Model2.hpp" | ||||
| @ -662,3 +663,9 @@ void WowClientInit() { | ||||
| 
 | ||||
|     EventRegister(EVENT_ID_POLL, &PollNet); | ||||
| } | ||||
| 
 | ||||
| void ClientInitializeGame(int32_t continentID, const C3Vector& position) { | ||||
|     // TODO
 | ||||
|     CGGameUI::InitializeGame(); | ||||
|     // TODO
 | ||||
| } | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| #define CLIENT_CLIENT_HPP | ||||
| 
 | ||||
| #include "event/Event.hpp" | ||||
| #include "tempest/Vector.hpp" | ||||
| #include <cstdint> | ||||
| 
 | ||||
| class CVar; | ||||
| @ -27,4 +28,6 @@ void StormInitialize(); | ||||
| 
 | ||||
| void WowClientInit(); | ||||
| 
 | ||||
| void ClientInitializeGame(int32_t continentID, const C3Vector& position); | ||||
| 
 | ||||
| #endif | ||||
|  | ||||
| @ -74,6 +74,10 @@ void ClientServices::GetCharacterList() { | ||||
|     ClientServices::s_currentConnection->GetCharacterList(); | ||||
| } | ||||
| 
 | ||||
| void ClientServices::CharacterLogin(uint64_t id, const C3Vector& position) { | ||||
|     // TODO
 | ||||
| } | ||||
| 
 | ||||
| REALM_INFO* ClientServices::GetRealmInfoByIndex(int32_t index) { | ||||
|     if (index >= ClientServices::GetInstance()->m_realmList.Count()) { | ||||
|         return nullptr; | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| #define CLIENT_CLIENT_SERVICES_HPP | ||||
| 
 | ||||
| #include "net/login/LoginResponse.hpp" | ||||
| #include "tempest/Vector.hpp" | ||||
| 
 | ||||
| class ClientConnection; | ||||
| class CVar; | ||||
| @ -35,6 +36,7 @@ class ClientServices : public LoginResponse { | ||||
|         static ClientServices* GetInstance(); | ||||
|         static void GetRealmList(); | ||||
|         static void GetCharacterList(); | ||||
|         static void CharacterLogin(uint64_t id, const C3Vector& position); | ||||
|         static REALM_INFO* GetRealmInfoByIndex(int32_t index); | ||||
|         static const char* GetSelectedRealmName(); | ||||
|         static const REALM_INFO* GetSelectedRealm(); | ||||
|  | ||||
| @ -77,6 +77,8 @@ int32_t CGlueMgr::m_surveyDownload; | ||||
| int32_t CGlueMgr::m_patchDownload; | ||||
| bool CGlueMgr::m_deleteLocalPatch; | ||||
| 
 | ||||
| CHARACTER_INFO* CGlueMgr::m_characterInfo = nullptr; | ||||
| 
 | ||||
| 
 | ||||
| float CalculateAspectRatio() { | ||||
|     auto widescreenVar = CVar::Lookup("widescreen"); | ||||
| @ -300,6 +302,11 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) { | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     case IDLE_ENTER_WORLD: { | ||||
|         CGlueMgr::PollEnterWorld(); | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     case IDLE_12: { | ||||
|         if (CGlueMgr::m_patchDownload) { | ||||
|             CGlueMgr::PatchDownloadIdle(); | ||||
| @ -411,6 +418,20 @@ void CGlueMgr::QuitGame() { | ||||
|     ClientPostClose(0); | ||||
| } | ||||
| 
 | ||||
| void CGlueMgr::EnterWorld() { | ||||
|     // TODO: Proper implementation
 | ||||
|     if (CCharacterSelection::GetNumCharacters() < 1) { | ||||
|         return; | ||||
|     } | ||||
|     CGlueMgr::m_characterInfo = &CCharacterSelection::s_characterList[0].m_characterInfo; | ||||
|     if (!m_characterInfo || !ClientServices::Connection()->IsConnected()) { | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     CGlueMgr::m_idleState = IDLE_ENTER_WORLD; | ||||
|     CGlueMgr::m_showedDisconnect = 0; | ||||
| } | ||||
| 
 | ||||
| void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op) { | ||||
|     auto login = ClientServices::LoginConnection(); | ||||
| 
 | ||||
| @ -820,9 +841,9 @@ void CGlueMgr::StatusDialogClick() { | ||||
|         } | ||||
| 
 | ||||
|         case IDLE_REALM_LIST: | ||||
|         case IDLE_5: | ||||
|         case IDLE_6: | ||||
|         case IDLE_10: { | ||||
|         case IDLE_CREATE_CHARACTER: | ||||
|         case IDLE_DELETE_CHARACTER: | ||||
|         case IDLE_ENTER_WORLD: { | ||||
|             ClientServices::Connection()->Cancel(2); | ||||
| 
 | ||||
|             CGlueMgr::m_showedDisconnect = 0; | ||||
| @ -899,6 +920,29 @@ bool CGlueMgr::HandleBattlenetDisconnect() { | ||||
|     return false; | ||||
| } | ||||
| 
 | ||||
| void CGlueMgr::PollEnterWorld() { | ||||
|     //if (!LoadingScreenDrawing())
 | ||||
|     //    return;
 | ||||
| 
 | ||||
|     if (CGlueMgr::m_suspended) { | ||||
|         CGlueMgr::m_idleState = IDLE_NONE; | ||||
|         CGlueMgr::m_showedDisconnect = 0; | ||||
|         //SI3::StopGlueMusic(3.0);
 | ||||
|         //SI3::StopGlueAmbience(-1.0);
 | ||||
|         ClientServices::CharacterLogin(CGlueMgr::m_characterInfo->guid, C3Vector()); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     auto info = CGlueMgr::m_characterInfo; | ||||
| 
 | ||||
|     //if (*(_BYTE*)(info + 385))
 | ||||
|     //    sub_4D9660(*(_BYTE*)(info + 377), (int)v51, *(_BYTE*)(info + 376), (int)&v68);
 | ||||
| 
 | ||||
| 
 | ||||
|     CGlueMgr::Suspend(); | ||||
|     ClientInitializeGame(info->mapID, info->position); | ||||
| } | ||||
| 
 | ||||
| void CGlueMgr::SurveyDownloadStart() { | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -21,12 +21,12 @@ class CGlueMgr { | ||||
|             IDLE_ACCOUNT_LOGIN = 2, | ||||
|             IDLE_CHARACTER_LIST = 3, | ||||
|             IDLE_REALM_LIST = 4, | ||||
|             IDLE_5 = 5, | ||||
|             IDLE_6 = 6, | ||||
|             IDLE_CREATE_CHARACTER = 5, | ||||
|             IDLE_DELETE_CHARACTER = 6, | ||||
|             IDLE_7 = 7, | ||||
|             IDLE_8 = 8, | ||||
|             IDLE_9 = 9, | ||||
|             IDLE_10 = 10, | ||||
|             IDLE_ENTER_WORLD = 10, | ||||
|             IDLE_WORLD_LOGIN = 11, | ||||
|             IDLE_12 = 12, | ||||
|             IDLE_13 = 13 | ||||
| @ -69,6 +69,8 @@ class CGlueMgr { | ||||
|         static int32_t m_patchDownload; | ||||
|         static bool m_deleteLocalPatch; | ||||
| 
 | ||||
|         static CHARACTER_INFO* m_characterInfo; | ||||
| 
 | ||||
|         // Static functions
 | ||||
|         static void ChangeRealm(const REALM_INFO* realmInfo); | ||||
|         static void DisplayLoginStatus(); | ||||
| @ -81,6 +83,7 @@ class CGlueMgr { | ||||
|         static void InitCursor(); | ||||
|         static void LoginServerLogin(const char* accountName, const char* password); | ||||
|         static void QuitGame(); | ||||
|         static void EnterWorld(); | ||||
|         static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op); | ||||
|         static void PollLoginServerLogin(); | ||||
|         static void PollCharacterList(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op); | ||||
| @ -95,6 +98,8 @@ class CGlueMgr { | ||||
|         static void UpdateCurrentScreen(const char* screen); | ||||
|         static bool HandleBattlenetDisconnect(); | ||||
| 
 | ||||
|         static void PollEnterWorld(); | ||||
| 
 | ||||
|         // Survey Download System
 | ||||
|         static void SurveyDownloadStart(); | ||||
|         static void SurveyDownloadCancel(); | ||||
|  | ||||
| @ -141,6 +141,15 @@ void ClientConnection::GetCharacterList() { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::CharacterLogin(uint64_t id) { | ||||
|     this->Initiate(COP_LOGIN_CHARACTER, 76, nullptr); | ||||
|     if (this->m_connected) { | ||||
|         this->RequestCharacterLogin(id); | ||||
|     } else { | ||||
|         this->Cancel(4); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void ClientConnection::Cancel(int32_t errorCode) { | ||||
|     this->Complete(0, errorCode); | ||||
| } | ||||
|  | ||||
| @ -28,6 +28,7 @@ class ClientConnection : public RealmConnection { | ||||
|         void AccountLogin_Finish(int32_t authResult); | ||||
|         void AccountLogin_Queued(); | ||||
|         void GetCharacterList(); | ||||
|         void CharacterLogin(uint64_t id); | ||||
|         void Cancel(int32_t errorCode); | ||||
|         void Cleanup(); | ||||
|         void Connect(); | ||||
|  | ||||
| @ -282,3 +282,11 @@ void RealmConnection::RequestCharacterEnum() { | ||||
|     msg.Finalize(); | ||||
|     this->Send(&msg); | ||||
| } | ||||
| 
 | ||||
| void RealmConnection::RequestCharacterLogin(uint64_t id) { | ||||
|     CDataStore msg; | ||||
|     msg.Put(static_cast<uint32_t>(CMSG_PLAYER_LOGIN)); | ||||
|     msg.Put(id); | ||||
|     msg.Finalize(); | ||||
|     this->Send(&msg); | ||||
| } | ||||
|  | ||||
| @ -43,6 +43,7 @@ class RealmConnection : public NetClient { | ||||
|         int32_t HandleCharEnum(uint32_t msgId, uint32_t time, CDataStore* msg); | ||||
|         void SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4); | ||||
|         void RequestCharacterEnum(); | ||||
|         void RequestCharacterLogin(uint64_t id); | ||||
| }; | ||||
| 
 | ||||
| #endif | ||||
|  | ||||
| @ -294,7 +294,8 @@ int32_t Script_IsConnectedToServer(lua_State* L) { | ||||
| } | ||||
| 
 | ||||
| int32_t Script_EnterWorld(lua_State* L) { | ||||
|     WHOA_UNIMPLEMENTED(0); | ||||
|     CGlueMgr::EnterWorld(); | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| int32_t Script_Screenshot(lua_State* L) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 VDm
						VDm