Mercurial > mm7
diff mm7_6.cpp @ 437:0a1ea44b4a0a
ui mesages & spellcasting
author | Nomad |
---|---|
date | Sun, 24 Feb 2013 09:51:42 +0200 |
parents | 58b71c1af7d8 |
children | acd8fa960c32 |
line wrap: on
line diff
--- a/mm7_6.cpp Sun Feb 24 03:07:03 2013 +0200 +++ b/mm7_6.cpp Sun Feb 24 09:51:42 2013 +0200 @@ -2175,7 +2175,7 @@ { //bool result; // eax@2 __int16 v6; // bx@4 - Player *v7; // eax@4 + //Player *v7; // eax@4 char v8; // zf@12 unsigned __int16 v9; // cx@16 unsigned int v10; // eax@18 @@ -2214,7 +2214,9 @@ v6 = a5; - v7 = &pParty->pPlayers[uPlayerID]; + //v7 = &pParty->pPlayers[uPlayerID]; + assert(uPlayerID < 4); + auto player = &pParty->pPlayers[uPlayerID]; if ( !(a5 & 0x10) ) { switch ( a1 ) @@ -2275,19 +2277,19 @@ if ( a4 ) v8 = (a4 & 0x1C0) == 0; else - v8 = (v7->pActiveSkills[16] & 0x1C0) == 0; + v8 = (player->pActiveSkills[PLAYER_SKILL_SPIRIT] & 0x1C0) == 0; if ( v8 ) goto LABEL_25; break; case 50: v9 = a4; if ( !a4 ) - v9 = v7->pActiveSkills[16]; + v9 = player->pActiveSkills[PLAYER_SKILL_SPIRIT]; goto LABEL_18; case 95: v9 = a4; if ( !a4 ) - v9 = v7->pActiveSkills[20]; + v9 = player->pActiveSkills[PLAYER_SKILL_DARK]; LABEL_18: v10 = SkillToMastery(v9); v12 = __OFSUB__(v10, 3); @@ -2296,7 +2298,7 @@ case 73: v13 = a4; if ( !a4 ) - v13 = v7->pActiveSkills[18]; + v13 = player->pActiveSkills[PLAYER_SKILL_BODY]; v14 = SkillToMastery(v13); v12 = __OFSUB__(v14, 4); v11 = ((v14 - 4) & 0x80000000u) != 0; @@ -5613,7 +5615,7 @@ if ( pParty->uFlags & 0x30 && v12 != 4 || rand() % 100 >= amount && v731 != 4 ) goto LABEL_200; byte_50C0C0 = LOBYTE(v3->uPlayerID); - pMessageQueue_50CBD0->SendMessage((UIMessageType)195, v1, v1); + pMessageQueue_50CBD0->AddMessage(UIMSG_C3, v1, v1); goto LABEL_1056; case 33: LODWORD(v733) = 604800 * v2; @@ -5623,7 +5625,7 @@ if ( pPlayer->sMana >= (signed int)uRequiredMana ) { pEventTimer->Pause(); - pMessageQueue_50CBD0->SendMessage((UIMessageType)177, v1, v1); + pMessageQueue_50CBD0->AddMessage(UIMSG_B1, v1, v1); qword_506350 = (signed int)v733; _506348_current_lloyd_playerid = v3->uPlayerID; ::uRequiredMana = v319; @@ -7795,11 +7797,115 @@ return 8 * this->pIcons[uIconID].uAnimLength; } + +const wchar_t *UIMessage2String(UIMessageType msg) +{ + #define CASE(xxx) case xxx: _swprintf(b, L"%03X/%s", msg, L#xxx); return b; + static wchar_t b[256]; // bad for threads + switch (msg) + { + CASE(UIMSG_SelectSpell) + CASE(UIMSG_ChangeGameState) + CASE(UIMSG_Attack) + CASE(UIMSG_PlayArcomage) + CASE(UIMSG_MainMenu_ShowPartyCreationWnd) + CASE(UIMSG_MainMenu_ShowLoadWindow) + CASE(UIMSG_ShowCredits) + CASE(UIMSG_ExitToWindows) + CASE(UIMSG_PlayerCreationChangeName) + CASE(UIMSG_PlayerCreationClickPlus) + CASE(UIMSG_PlayerCreationClickMinus) + CASE(UIMSG_PlayerCreationSelectActiveSkill) + CASE(UIMSG_PlayerCreationSelectClass) + CASE(UIMSG_PlayerCreationClickOK) + CASE(UIMSG_PlayerCreationClickReset) + CASE(UIMSG_AutonotesBook) + CASE(UIMSG_PlayerCreationRemoveUpSkill) + CASE(UIMSG_PlayerCreationRemoveDownSkill) + CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) + CASE(UIMSG_LoadGame) + CASE(UIMSG_SaveGame) + CASE(UIMSG_ShowStatus_DateTime) + CASE(UIMSG_ShowStatus_ManaHP) + CASE(UIMSG_ShowStatus_Player) + CASE(UIMSG_Wait5Minutes) + CASE(UIMSG_Wait1Hour) + CASE(UIMSG_ShowStatus_Food) + CASE(UIMSG_ShowStatus_Funds) + CASE(UIMSG_QuickReference) + CASE(UIMSG_GameMenuButton) + CASE(UIMSG_AlreadyResting) + CASE(UIMSG_SelectCharacter) + CASE(UIMSG_ChangeSoundVolume) + CASE(UIMSG_ChangeMusicVolume) + CASE(UIMSG_Escape) + CASE(UIMSG_PlayerCreation_SelectAttribute) + CASE(UIMSG_InventoryLeftClick) + CASE(UIMSG_SkillUp) + CASE(UIMSG_GameMenu_ReturnToGame) + CASE(UIMSG_StartNewGame) + CASE(UIMSG_Game_OpenLoadGameDialog) + CASE(UIMSG_Game_OpenSaveGameDialog) + CASE(UIMSG_Game_OpenOptionsDialog) + CASE(UIMSG_SetGraphicsMode) + CASE(UIMSG_Quit) + CASE(UIMSG_StartHireling1Dialogue) + CASE(UIMSG_StartHireling2Dialogue) + CASE(UIMSG_SelectDialogueOption) + CASE(UIMSG_CastSpellFromBook) + CASE(UIMSG_PlayerCreation_VoicePrev) + CASE(UIMSG_PlayerCreation_VoiceNext) + CASE(UIMSG_StartNPCDialogue) + CASE(UIMSG_ArrowUp) + CASE(UIMSG_DownArrow) + CASE(UIMSG_LoadSlot) + CASE(UIMSG_SelectLoadSlot) + CASE(UIMSG_Cancel) + CASE(UIMSG_ExitRest) + CASE(UIMSG_PlayerCreation_FacePrev) + CASE(UIMSG_PlayerCreation_FaceNext) + CASE(UIMSG_CycleCharacters) + CASE(UIMSG_SetTurnSpeed) + CASE(UIMSG_ToggleWalkSound) + CASE(UIMSG_ChangeVoiceVolume) + CASE(UIMSG_ToggleShowDamage) + CASE(UIMSG_ScrollNPCPanel) + CASE(UIMSG_ShowFinalWindow) + CASE(UIMSG_OpenQuestBook) + CASE(UIMSG_OpenAutonotes) + CASE(UIMSG_OpenMapBook) + CASE(UIMSG_OpenCalendar) + CASE(UIMSG_OpenHistoryBook) + CASE(UIMSG_ToggleAlwaysRun) + CASE(UIMSG_ToggleFlipOnExit) + CASE(UIMSG_Game_Action) + CASE(UIMSG_OpenRestUI) + CASE(UIMSG_TransitionUI_Confirm) + CASE(UIMSG_OpenKeyMappingOptions) + CASE(UIMSG_SelectKeyPage1) + CASE(UIMSG_SelectKeyPage2) + CASE(UIMSG_ResetKeyMapping) + CASE(UIMSG_ChangeKeyButton) + CASE(UIMSG_OpenVideoOptions) + CASE(UIMSG_ToggleBloodsplats) + CASE(UIMSG_ToggleColoredLights) + CASE(UIMSG_ToggleTint) + default: + _swprintf(b, L"UIMSG_%03X", msg); return b; + }; + #undef CASE +} + + //----- (0042EB8D) -------------------------------------------------------- -void GUIMessageQueue::SendMessage(UIMessageType msg, int param, unsigned int a4) +void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) { + Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line); if (uNumMessages < 40) { + files[uNumMessages] = file; + lines[uNumMessages] = line; + pMessages[uNumMessages].eType = msg; pMessages[uNumMessages].param = param; pMessages[uNumMessages++].field_8 = a4; @@ -9084,8 +9190,9 @@ { pActionQueue = pPartyActionQueue; LABEL_120: - - if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); + break; + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; //goto _send_message; @@ -9093,7 +9200,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; break; - } + }*/ } else { @@ -9101,8 +9208,8 @@ if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = 25; - dword_50C9F0[3 * dword_50C9E8] = 0; - *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; + dword_50C9EC[3 * dword_50C9E8 + 1] = 0; + dword_50C9EC[3 * dword_50C9E8 + 2] = 0; ++dword_50C9E8; } } @@ -9119,13 +9226,15 @@ case INPUT_EventTrigger: if (pCurrentScreen == SCREEN_GAME) { - if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) break; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action; //goto _send_message; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; + break;*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); break; } if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) @@ -9133,6 +9242,8 @@ v11 = pMessageQueue_50CBD0->uNumMessages; if ( pMessageQueue_50CBD0->uNumMessages ) { + v11 = 0; + pMessageQueue_50CBD0->uNumMessages = 0; if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) { v11 = 1; @@ -9145,10 +9256,9 @@ ++pMessageQueue_50CBD0->uNumMessages; break; } - v11 = 0; - pMessageQueue_50CBD0->uNumMessages = 0; + break; } - if ( (signed int)v11 < 40 ) + /*if ( (signed int)v11 < 40 ) //goto LABEL_132; { pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; @@ -9156,7 +9266,8 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; break; - } + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); } break; case INPUT_CharCycle: @@ -9166,8 +9277,8 @@ break; dword_50C9EC[3 * dword_50C9E8] = 176; //goto LABEL_155; - dword_50C9F0[3 * dword_50C9E8] = 0; - *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; + dword_50C9EC[3 * dword_50C9E8 + 1] = 0; + dword_50C9EC[3 * dword_50C9E8 + 2] = 0; ++dword_50C9E8; break; case INPUT_LookUp: @@ -9235,8 +9346,8 @@ break; dword_50C9EC[3 * dword_50C9E8] = 367; //goto LABEL_155; - dword_50C9F0[3 * dword_50C9E8] = 0; - *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; + dword_50C9EC[3 * dword_50C9E8 + 1] = 0; + dword_50C9EC[3 * dword_50C9E8 + 2] = 0; ++dword_50C9E8; break; case INPUT_ZoomOut: @@ -9245,8 +9356,8 @@ { dword_50C9EC[3 * dword_50C9E8] = 368; //LABEL_155: - dword_50C9F0[3 * dword_50C9E8] = 0; - *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; + dword_50C9EC[3 * dword_50C9E8 + 1] = 0; + dword_50C9EC[3 * dword_50C9E8 + 2] = 0; ++dword_50C9E8; } break; @@ -9276,13 +9387,14 @@ { if ( !pCurrentScreen ) { - if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) goto LABEL_175; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; //goto LABEL_174; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; + ++pMessageQueue_50CBD0->uNumMessages;*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); goto LABEL_175; } if ( pCurrentScreen == SCREEN_NPC_DIALOGUE @@ -9295,9 +9407,9 @@ if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) { v15 = 1; - pMessageQueue_50CBD0->uNumMessages = 1; + pMessageQueue_50CBD0->uNumMessages = 0; //goto LABEL_173; - pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -9305,14 +9417,15 @@ } pMessageQueue_50CBD0->uNumMessages = 0; } - if ( (signed int)v15 >= 40 ) + /*if ( (signed int)v15 >= 40 ) goto LABEL_175; //LABEL_173: pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; //LABEL_174: pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; + ++pMessageQueue_50CBD0->uNumMessages;*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); goto LABEL_175; } }