Mercurial > mm7
changeset 829:d5b1870df3ab
Merge
author | Nomad |
---|---|
date | Wed, 27 Mar 2013 00:28:45 +0200 |
parents | 0f56abdcce94 (current diff) 085eb19b7ffd (diff) |
children | 08d90b633131 |
files | mm7_3.cpp |
diffstat | 9 files changed, 100 insertions(+), 133 deletions(-) [+] |
line wrap: on
line diff
--- a/Events.cpp Wed Mar 27 00:27:38 2013 +0200 +++ b/Events.cpp Wed Mar 27 00:28:45 2013 +0200 @@ -197,11 +197,11 @@ LevelDecoration *v26; // eax@55 int v27; // eax@57 int v28; // ecx@57 - int v29; // edx@58 - int v30; // eax@58 - int v31; // ecx@58 - int v32; // esi@58 - NPCData *v33; // ecx@58 + //int v29; // edx@58 + int pEventID; // eax@58 + int pNPC_ID; // ecx@58 + int pIndex; // esi@58 + NPCData *pNPC; // ecx@58 int v34; // esi@59 int v35; // esi@60 int v36; // esi@61 @@ -571,82 +571,49 @@ //v6 = v123; //v7 = ""; break; - case EVENT_SetNPCTopic: - { - - v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); - v31 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v32 = _evt->v9; - v33 = &pNPCStats->pNewNPCData[v31]; - if ( v32 ) - { - v34 = v32 - 1; - if ( v34 ) - { - v35 = v34 - 1; - if ( v35 ) - { - v36 = v35 - 1; - if ( v36 ) - { - v37 = v36 - 1; - if ( v37 ) - { - if ( v37 == 1 ) - v33->evt_F = v30; - } - else - { - v33->evt_E = v30; - } - } - else - { - v33->evt_D = v30; - } - } - else - { - v33->evt_C = v30; - } - } - else - { - v33->evt_B = v30; - } - } - else - { - v33->evt_A = v30; - } - if ( v29 == 8 ) - { - if ( v30 == 78 ) - { - sub_4BD8B5(); - window_SpeakInHouse->Release(); - pParty->uFlags &= ~2; - if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) - { - pAudioPlayer->StopChannels(-1, -1); - window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); - window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); - window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); - window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); - window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); - window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); - ptr_F8B1E8 = pNPCTopics[90].pText; - } - } - } - ++curr_seq_num; - } - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; + case EVENT_SetNPCTopic: + { + //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + pEventID = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); + pNPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + pIndex = _evt->v9; + pNPC = &pNPCStats->pNewNPCData[pNPC_ID]; + if ( pIndex == 0 ) + pNPC->evt_A = pEventID; + if ( pIndex == 1 ) + pNPC->evt_B = pEventID; + if ( pIndex == 2 ) + pNPC->evt_C = pEventID; + if ( pIndex == 3 ) + pNPC->evt_D = pEventID; + if ( pIndex == 4 ) + pNPC->evt_E = pEventID; + if ( pIndex == 5 ) + pNPC->evt_F = pEventID; + if ( pNPC_ID == 8 ) + { + if ( pEventID == 78 ) + { + sub_4BD8B5(); + window_SpeakInHouse->Release(); + pParty->uFlags &= ~2; + if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) + { + pAudioPlayer->StopChannels(-1, -1); + window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); + window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); + window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); + window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); + window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); + window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); + current_npc_text = pNPCTopics[90].pText; + } + } + } + ++curr_seq_num; + } + v4 = v124; + break; case EVENT_NPCSetItem: sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); ++curr_seq_num; @@ -1180,7 +1147,7 @@ { if ( activeLevelDecoration == (LevelDecoration*)1 ) { - ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; + current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; } if ( canShowMessages == 1 ) { @@ -1209,7 +1176,7 @@ { v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; byte_5B0938[0] = 0; - ptr_F8B1E8 = v93; + current_npc_text = v93; } else {
--- a/GUIWindow.cpp Wed Mar 27 00:27:38 2013 +0200 +++ b/GUIWindow.cpp Wed Mar 27 00:28:45 2013 +0200 @@ -1075,15 +1075,15 @@ JailDialog(); goto LABEL_58; } - if ( ptr_F8B1E8 ) + if ( current_npc_text ) { w.uFrameWidth = 458; w.uFrameZ = 457; - v5 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0); + v5 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0); v6 = v5 + 7; pRenderer->_4A6A68(8, 352 - (v5 + 7), &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (v5 + 7)); pRenderer->DrawTextureIndexed(8u, 347 - v6, pTexture_591428); - v7 = FitTextInAWindow(ptr_F8B1E8, pFontArrus, &w, 0xDu, 0); + v7 = FitTextInAWindow(current_npc_text, pFontArrus, &w, 0xDu, 0); window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); } v8 = 0; @@ -1797,7 +1797,7 @@ num_menu_buttons = 0; v11 = LOBYTE(pFontArrus->uFontHeight) - 3; speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); - if ( sub_445C8B(sDialogue_SpeakingActorNPC_ID) == 1 ) + if ( GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1 )//QuestsNPC_greet { if ( speakingNPC->joins ) {
--- a/NPC.cpp Wed Mar 27 00:27:38 2013 +0200 +++ b/NPC.cpp Wed Mar 27 00:28:45 2013 +0200 @@ -385,10 +385,10 @@ } while ((decode_step<78)&&!break_loop); } - for (i=0; i<78; ++i) + for ( i = 0; i < 77; ++i ) { pProfessionChance[i].uTotalprofChance=0; - for (int ii=1; ii<59; ++ii) + for ( int ii = 1; ii < 59; ++ii ) { pProfessionChance[i].uTotalprofChance+=pProfessionChance[i].professionChancePerArea[ii]; }
--- a/UIHouses.cpp Wed Mar 27 00:27:38 2013 +0200 +++ b/UIHouses.cpp Wed Mar 27 00:28:45 2013 +0200 @@ -484,7 +484,7 @@ } uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; - ptr_F8B1E8 = 0; + current_npc_text = 0; dword_F8B1E4 = 0; dword_F8B1F4 = 0; memset(byte_F8B1F0, 0, 4); @@ -2147,7 +2147,7 @@ v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); - ptr_F8B1E8 = pTmpBuf2; + current_npc_text = pTmpBuf2; memcpy(&a1, pDialogueWindow, sizeof(a1)); w.uFrameWidth = 458; w.uFrameZ = 457; @@ -2156,13 +2156,13 @@ if ( 352 - v9 < 8 ) { pOutString = pFontCreate; - v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; + v9 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; } auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9); pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428); - v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0); + v10 = FitTextInAWindow(current_npc_text, pOutString, &w, 0xDu, 0); a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); break; }
--- a/mm7_2.cpp Wed Mar 27 00:27:38 2013 +0200 +++ b/mm7_2.cpp Wed Mar 27 00:28:45 2013 +0200 @@ -827,7 +827,7 @@ pKeyActionMap->_459ED1(3); pKeyActionMap->ResetKeys(); activeLevelDecoration = NULL; - ptr_F8B1E8 = 0; + current_npc_text = 0; if ( pDialogueNPCCount ) { v0 = dialog_menu_id;
--- a/mm7_3.cpp Wed Mar 27 00:27:38 2013 +0200 +++ b/mm7_3.cpp Wed Mar 27 00:28:45 2013 +0200 @@ -12428,8 +12428,8 @@ v0 = pFontArrus; pFont = pFontArrus; - if ( ptr_F8B1E8 && !byte_5B0938[0] ) - strcpy(byte_5B0938, ptr_F8B1E8); + if ( current_npc_text && !byte_5B0938[0] ) + strcpy(byte_5B0938, current_npc_text); v5.uFrameWidth = game_viewport_width; v5.uFrameZ = 452; v1 = pFontArrus->CalcTextHeight(byte_5B0938, &v5, 12, 0) + 7; @@ -12542,7 +12542,7 @@ void __cdecl DrawDialogueUI() { NPCData *pNPC; // ebx@2 - int v1; // eax@2 + int pGreetType; // eax@2 unsigned __int16 v2; // di@2 //unsigned int v3; // eax@2 char *v4; // esi@3 @@ -12593,7 +12593,7 @@ return; memcpy(&v51, pDialogueWindow, sizeof(v51)); pNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); - v1 = sub_445C8B(sDialogue_SpeakingActorNPC_ID); + pGreetType = GetGreetType(sDialogue_SpeakingActorNPC_ID); v51.uFrameWidth -= 10; v51.uFrameZ -= 10; //v54 = v1; @@ -12657,9 +12657,9 @@ default: if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_23 && !byte_5B0938[0]) { - pInString = (char *)ptr_F8B1E8; - } - else if (v1 == 1) + pInString = (char *)current_npc_text; + } + else if (pGreetType == 1)//QuestNPC_greet { if (pNPC->greet) { @@ -12669,7 +12669,7 @@ pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting1; } } - else if (v1 == 2) + else if (pGreetType == 2)//HiredNPC_greet { auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1; @@ -12893,7 +12893,7 @@ } //----- (00445C8B) -------------------------------------------------------- -int __fastcall sub_445C8B(signed int a1) +int __fastcall GetGreetType(signed int SpeakingNPC_ID) { signed int v1; // ebx@1 int v3; // edi@6 @@ -12904,13 +12904,13 @@ NPCData *v8; // esi@11 v1 = 0; - if ( a1 >= 0 ) - { - if ( a1 < 5000 ) - return 1; - return 2; - } - if ( a1 >= 5000 ) + if ( SpeakingNPC_ID >= 0 ) + { + if ( SpeakingNPC_ID < 5000 ) + return 1;//QuestNPC_greet + return 2;//HiredNPC_greet + } + if ( SpeakingNPC_ID >= 5000 ) return 2; v3 = abs((int)sDialogue_SpeakingActorNPC_ID) - 1; v4 = 0; @@ -12940,7 +12940,7 @@ } while ( v1 < (signed int)pNPCStats->uNumNewNPCs ); } - return ((unsigned __int8)pTmpBuf[v3] < 2u) + 1; + return ((unsigned __int8)pTmpBuf[v3] < 2) + 1; } //----- (0044603D) --------------------------------------------------------
--- a/mm7_4.cpp Wed Mar 27 00:27:38 2013 +0200 +++ b/mm7_4.cpp Wed Mar 27 00:28:45 2013 +0200 @@ -6472,7 +6472,7 @@ contract_approved = 0; v11 = 0; uDialogueType = 84; - ptr_F8B1E8 = (char *)pNPCTopics[667].pText; + current_npc_text = (char *)pNPCTopics[667].pText; v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; while ( 1 ) { @@ -6499,7 +6499,7 @@ } if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] ) { - ptr_F8B1E8 = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful + current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); @@ -6587,8 +6587,8 @@ switch ( uMessageParam ) { case 13: - ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); - ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); + current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); + current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); NPCHireableDialogPrepare(); dialogue_show_profession_details = false; goto _return; @@ -6638,7 +6638,7 @@ } else { - ptr_F8B1E8 = 0; + current_npc_text = 0; activeLevelDecoration = (LevelDecoration*)1; EventProcessor(pEventNumber, 0, 1); activeLevelDecoration = NULL; @@ -6666,10 +6666,10 @@ v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; else v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pBenefits; - ptr_F8B1E8 = v17; + current_npc_text = v17; v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0); dialogue_show_profession_details = ~dialogue_show_profession_details; - ptr_F8B1E8 = v18; + current_npc_text = v18; } else { @@ -6786,8 +6786,8 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); dialogue_show_profession_details = false; uDialogueType = 13; - ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; - ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); + current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession - 1].pJoinText; + current_npc_text = BuilDialogueString((char *)current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0); if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); @@ -7365,7 +7365,7 @@ v32 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); sprintf(pTmpBuf, &byte_4F0F98, v32, v31, v30); sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]); - ptr_F8B1E8 = pTmpBuf2; + current_npc_text = pTmpBuf2; v15 = ""; goto LABEL_45; } @@ -7407,8 +7407,8 @@ if ( uDialogueType != 84 ) goto LABEL_49; sprintf(pTmpBuf, format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName); - sprintf(pTmpBuf2, ptr_F8B1E8, pTmpBuf); - ptr_F8B1E8 = pTmpBuf2; + sprintf(pTmpBuf2, current_npc_text, pTmpBuf); + current_npc_text = pTmpBuf2; goto LABEL_45; } v21 = v20 - 1; @@ -7495,16 +7495,16 @@ } } } - if ( ptr_F8B1E8 ) + if ( current_npc_text ) { w.uFrameWidth = 458; w.uFrameZ = 457; v47 = pFontArrus; - v48 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; + v48 = pFontArrus->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; if ( 352 - v48 < 8 ) { v47 = pFontCreate; - v48 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; + v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; } pRenderer->_4A6A68( 8u, @@ -7512,7 +7512,7 @@ (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); - v49 = FitTextInAWindow(ptr_F8B1E8, v47, &w, 0xDu, 0); + v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); } } @@ -7792,7 +7792,7 @@ void DrawJoinGuildWindow( int pEventCode ) { uDialogueType = 81;//enum JoinGuildDialog - ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; + current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; ContractSelectText(pEventCode); pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); @@ -7813,7 +7813,7 @@ v1 = a4; uDialogueType = 78; - ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText; + current_npc_text = (char *)pNPCTopics[a4 + 168].pText; _4B254D_SkillMasteryTeacher(a4); pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); @@ -8214,7 +8214,7 @@ break; default: activeLevelDecoration = (LevelDecoration*)1; - ptr_F8B1E8 = 0; + current_npc_text = 0; EventProcessor(npc_event_id, 0, 1); activeLevelDecoration = NULL; break;
--- a/mm7_data.cpp Wed Mar 27 00:27:38 2013 +0200 +++ b/mm7_data.cpp Wed Mar 27 00:28:45 2013 +0200 @@ -1990,7 +1990,7 @@ int dword_F8B1DC; // weak int dword_F8B1E0; // weak int dword_F8B1E4; // weak -const char *ptr_F8B1E8; // idb +const char *current_npc_text; // idb char dialogue_show_profession_details = false; // F8B1EC char byte_F8B1EF[777]; // weak char byte_F8B1F0[4];
--- a/mm7_data.h Wed Mar 27 00:27:38 2013 +0200 +++ b/mm7_data.h Wed Mar 27 00:28:45 2013 +0200 @@ -1503,7 +1503,7 @@ extern int dword_F8B1DC; // weak extern int dword_F8B1E0; // weak extern int dword_F8B1E4; // weak -extern const char *ptr_F8B1E8; // idb +extern const char *current_npc_text; // 0xF8B1E8 extern char dialogue_show_profession_details; // weak extern char byte_F8B1EF[]; // weak extern char byte_F8B1F0[4]; @@ -1818,7 +1818,7 @@ void __cdecl DrawDialogueUI(); struct NPCData *__fastcall GetNPCData(signed int npcid); struct NPCData *__fastcall GetNewNPCData(signed int npcid, int a2); -int __fastcall sub_445C8B(signed int a1); +int __fastcall GetGreetType(signed int SpeakingNPC_ID); void __cdecl sub_44603D(); void PrepareHouse(enum HOUSE_ID house); // idb bool EnterHouse(enum HOUSE_ID uHouseID);