Mercurial > mm7
changeset 248:37dcbe8f3cca
Dialogue stuff
author | Nomad |
---|---|
date | Mon, 18 Feb 2013 07:11:43 +0200 |
parents | fb8a876f41e1 |
children | 9a8d37c07e50 |
files | Actor.cpp GUIWindow.cpp GUIWindow.h NPC.h Player.cpp Player.h mm7_1.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_data.cpp mm7_data.h mm7text_ru.cpp |
diffstat | 13 files changed, 198 insertions(+), 178 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Feb 18 03:59:31 2013 +0200 +++ b/Actor.cpp Mon Feb 18 07:11:43 2013 +0200 @@ -200,7 +200,7 @@ pDialogueNPCPortraits[0] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)]; dword_591084 = areWeLoadingTexture; uTextureID_507B04 = uTextureID_right_panel; - if ( !(v5->uFlags & 0x80) && v5->house >= 0 ) + if ( !v5->Hired() && v5->house >= 0 ) { if ( (signed int)pParty->GetPartyFame() <= v5->fame || (v10 = v5->uFlags & 0xFFFFFF7F, (v5->uFlags & 0xFFFFFF7F & 0x80000000u) != 0) ) @@ -241,7 +241,7 @@ v9 = 4; v11 = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)10, v9, 0); pDialogueWindow = v11; - if ( v5->uFlags & 0x80 ) + if (v5->Hired()) { if ( !v5->bHasUsedTheAbility ) { @@ -271,7 +271,7 @@ pDialogueWindow->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); pDialogueWindow->CreateButton(292u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); pDialogueWindow->CreateButton(407u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); - if ( v17 && uActiveCharacter && !(v5->uFlags & 0x80) ) + if (v17 && uActiveCharacter && !v5->Hired()) { if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21) pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0);
--- a/GUIWindow.cpp Mon Feb 18 03:59:31 2013 +0200 +++ b/GUIWindow.cpp Mon Feb 18 07:11:43 2013 +0200 @@ -1909,7 +1909,7 @@ if ( v12->joins ) { pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее - if ( v12->uFlags & 0x80 ) + if (v12->Hired()) { sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], v12->pName); //Отпустить pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pTmpBuf, 0);
--- a/GUIWindow.h Mon Feb 18 03:59:31 2013 +0200 +++ b/GUIWindow.h Mon Feb 18 07:11:43 2013 +0200 @@ -25,10 +25,17 @@ enum DIALOGUE_TYPE { + DIALOGUE_9 = 9, DIALOGUE_13 = 0xD, DIALOGUE_18 = 0x12, + DIALOGUE_19 = 19, + DIALOGUE_20 = 20, + DIALOGUE_21 = 21, + DIALOGUE_22 = 22, + DIALOGUE_23 = 23, DIALOGUE_24 = 0x18, - DIALOGUE_77 = 0x4D, + DIALOGUE_76 = 76, + DIALOGUE_PROFESSION_DETAILS = 77, DIALOGUE_ARENA_WELCOME = 0x59, DIALOGUE_ARENA_FIGHT_NOT_OVER_YET = 0x5A, DIALOGUE_ARENA_REWARD = 0x5B, @@ -230,7 +237,7 @@ UIMSG_85 = 0x85, UIMSG_StartHireling1Dialogue = 0x86, UIMSG_StartHireling2Dialogue = 0x87, - UIMSG_88 = 0x88, + UIMSG_SelectDialogueOption = 0x88, UIMSG_8C = 0x8C, UIMSG_8D = 0x8D, UIMSG_8E = 0x8E, @@ -388,6 +395,11 @@ + +void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType); + + + extern int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[]; // idb extern struct GUIWindow *pWindow_MainMenu; extern struct GUIWindow pWindowList[20]; \ No newline at end of file
--- a/NPC.h Mon Feb 18 03:59:31 2013 +0200 +++ b/NPC.h Mon Feb 18 07:11:43 2013 +0200 @@ -17,9 +17,11 @@ #pragma pack(push, 1) struct NPCData { + inline bool Hired() {return uFlags & 0x80;} + char *pName; unsigned int uPortraitID; - unsigned int uFlags; // & 0x80 no greeting on dialogue start + unsigned int uFlags; // & 0x80 no greeting on dialogue start; looks like hired int fame; int rep; int house;
--- a/Player.cpp Mon Feb 18 03:59:31 2013 +0200 +++ b/Player.cpp Mon Feb 18 07:11:43 2013 +0200 @@ -586,7 +586,7 @@ signed int v13; // esi@12 int v14; // eax@12 //int v15; // eax@17 - int pExpression; // ebx@17 + CHARACTER_EXPRESSION_ID expression; // ebx@17 signed int v17; // ecx@19 char *pSoundID; // edi@20 int v20[5]; // [sp+Ch] [bp-1Ch]@7 @@ -647,8 +647,8 @@ if ( v13 ) { pPlayerNum = 0; - pExpression = v20[rand() % v13]; - if ( pExpression == 21 && pSoundId ) + expression = (CHARACTER_EXPRESSION_ID)v20[rand() % v13]; + if (expression == CHARACTER_EXPRESSION_21 && pSoundId ) { v17 = 0; if ( (signed int)pSoundList->uNumSounds <= 0 ) @@ -670,7 +670,7 @@ if ( pSoundList->pSounds[v17].pSoundData[0] ) pPlayerNum = (sLastTrackLengthMS << 7) / 1000; } - /*LOWORD(v14) = */PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); + /*LOWORD(v14) = */PlayEmotion(expression, pPlayerNum); } //return v14; } @@ -5758,7 +5758,7 @@ } if ( CheckHiredNPCSpeciality(v5) ) v2 += 4; - if ( v9->classType == PLAYER_CLASS_31 && sub_476387() ) + if ( v9->classType == PLAYER_CLASS_31 && PartyHasDragon() ) v2 += 3; LABEL_86: if ( uSkillType <= PLAYER_SKILL_DARK ) @@ -7892,7 +7892,7 @@ LOBYTE(v6) = CheckHiredNPCSpeciality(a1); return v6; case VAR_NPCs2: - return pNPCStats->pNewNPCData[a1].uFlags & 0x80; + return pNPCStats->pNewNPCData[a1].Hired(); case VAR_MonthEquals|VAR_CurrentSP: v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; v14 = this->field_1A50[((signed __int16)a1 - 1) >> 3];
--- a/Player.h Mon Feb 18 03:59:31 2013 +0200 +++ b/Player.h Mon Feb 18 07:11:43 2013 +0200 @@ -47,7 +47,7 @@ SPEECH_35 = 35, SPEECH_36 = 36, SPEECH_37 = 37, - SPEECH_38 = 38, + SPEECH_NotEnoughGold = 38, SPEECH_39 = 39, SPEECH_40 = 40, SPEECH_41 = 41,
--- a/mm7_1.cpp Mon Feb 18 03:59:31 2013 +0200 +++ b/mm7_1.cpp Mon Feb 18 07:11:43 2013 +0200 @@ -3701,7 +3701,7 @@ pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); - if ( sub_476387() ) + if ( PartyHasDragon() ) { v0 = pParty->pPlayers;//[0].uClass; while ( v0 <= &pParty->pPlayers[3] )
--- a/mm7_3.cpp Mon Feb 18 03:59:31 2013 +0200 +++ b/mm7_3.cpp Mon Feb 18 07:11:43 2013 +0200 @@ -4704,9 +4704,9 @@ } //----- (00476387) -------------------------------------------------------- -bool __cdecl sub_476387() -{ - return (pNPCStats->pNewNPCData[57].uFlags & 0x80) != 0; +bool PartyHasDragon() +{ + return pNPCStats->pNewNPCData[57].Hired(); } //----- (00476395) -------------------------------------------------------- @@ -16221,7 +16221,7 @@ unsigned __int16 v2; // di@2 //unsigned int v3; // eax@2 char *v4; // esi@3 - int v5; // eax@11 + //int v5; // eax@11 char *v6; // ecx@13 char *v7; // eax@16 unsigned int v8; // edi@19 @@ -16279,16 +16279,86 @@ pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[0]); - if ( pNPC->uProfession ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s - } - else - { + + if (pNPC->uProfession) + { + assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames)); // sometimes buffer overflows; errors emerge both here and in dialogue text + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s + } + else strcpy(pTmpBuf, pNPC->pName); - } + v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3); pParty->GetPartyFame(); + + switch (uDialogueType) + { + case DIALOGUE_PROFESSION_DETAILS: + { + if (dialogue_show_profession_details) + { + v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pBenefits; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + } + if (uTextureID_Leather != -1) + pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); + } + else if (pNPC->Hired()) + { + v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pDismissText; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + } + if (uTextureID_Leather != -1) + pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); + } + else + { + v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + } + if (uTextureID_Leather != -1) + pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); + } + } + break; + } + if ( (signed int)uDialogueType > DIALOGUE_ARENA_WELCOME ) { if ( uDialogueType == DIALOGUE_ARENA_FIGHT_NOT_OVER_YET ) @@ -16369,8 +16439,7 @@ } else if ( uDialogueType == DIALOGUE_13 ) { - v5 = 5 * pNPC->uProfession; - v6 = (char *)*(&pNPCStats->field_13A64 + v5); + v6 = pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText; v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); pInString = v7; pWindow.uFrameWidth = 460; @@ -16382,79 +16451,15 @@ pOutString = pFontCreate; v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; } - pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); } - else if ( (signed int)uDialogueType > DIALOGUE_18 && !((signed int)uDialogueType > DIALOGUE_24 && uDialogueType != DIALOGUE_77 || byte_5B0938[0]) ) - { - if ( (signed int)uDialogueType > DIALOGUE_24 && uDialogueType == DIALOGUE_77 ) - { - v5 = 5 * pNPC->uProfession; - if ( byte_F8B1EC ) - { - v6 = (char *)*(&pNPCStats->field_13A5C + 5 * pNPC->uProfession); - v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); - pInString = v7; - pWindow.uFrameWidth = 460; - pWindow.uFrameZ = 452; - pOutString = pFontArrus; - v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - if ( 352 - v12 < 8 ) - { - pOutString = pFontCreate; - v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - } - pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), - (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); - pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); - v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); - pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); - } - else if ( pNPC->uFlags & 0x80 ) - { - v6 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); - v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); - pInString = v7; - pWindow.uFrameWidth = 460; - pWindow.uFrameZ = 452; - pOutString = pFontArrus; - v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - if ( 352 - v12 < 8 ) - { - pOutString = pFontCreate; - v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - } - pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), - (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); - pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); - v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); - pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); - } - else - { - v6 = (char *)*(&pNPCStats->field_13A64 + v5); - v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); - pInString = v7; - pWindow.uFrameWidth = 460; - pWindow.uFrameZ = 452; - pOutString = pFontArrus; - v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - if ( 352 - v12 < 8 ) - { - pOutString = pFontCreate; - v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - } - pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), - (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); - pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); - v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); - pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); - } - } - else + else if ( (signed int)uDialogueType > DIALOGUE_18 && !((signed int)uDialogueType > DIALOGUE_24 && uDialogueType != DIALOGUE_PROFESSION_DETAILS || byte_5B0938[0]) ) + { + if ((signed int)uDialogueType <= DIALOGUE_23) { v7 = (char *)ptr_F8B1E8; pInString = v7; @@ -16467,7 +16472,7 @@ pOutString = pFontCreate; v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; } - pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); @@ -16506,10 +16511,10 @@ { if ( *(int *)v54 == 2 ) { - if ( pNPC->uFlags & 0x80 ) - v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pDismissText; + if (pNPC->Hired()) + v9 = pNPCStats->pProfessions[pNPC->uProfession].pDismissText; else - v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; //"Invalid String Passed" + v9 = pNPCStats->pProfessions[pNPC->uProfession].pJoinText; //"Invalid String Passed" pInString = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0); if ( pInString != NULL ) { @@ -16522,8 +16527,8 @@ pOutString = pFontCreate; v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; } - pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), - (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + if (uTextureID_Leather != -1) + pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12); pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, 0); pDialogueWindow->DrawText(pOutString, 13, 354 - v12, 0, v13, 0, 0, 0); @@ -16551,24 +16556,24 @@ v24 = ""; } else if ( v16 == 88 ) - v24 = pGlobalTXT_LocalizationStrings[581]; + v24 = pGlobalTXT_LocalizationStrings[581]; // Lord else if ( v16 == 87 ) - v24 = pGlobalTXT_LocalizationStrings[580]; + v24 = pGlobalTXT_LocalizationStrings[580]; // Knight else if ( v16 == 86 ) - v24 = pGlobalTXT_LocalizationStrings[579]; + v24 = pGlobalTXT_LocalizationStrings[579]; // Squire else if ( v16 == 85 ) - v24 = pGlobalTXT_LocalizationStrings[578]; + v24 = pGlobalTXT_LocalizationStrings[578]; // Page else if ( v16 == 77 ) - v24 = pGlobalTXT_LocalizationStrings[407]; + v24 = pGlobalTXT_LocalizationStrings[407]; // Details else if ( v16 == 76 ) { - if ( pNPC->uFlags & 0x80 ) + if (pNPC->Hired()) { - sprintf(pTmpBuf, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); + sprintf(pTmpBuf, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s v24 = pTmpBuf; } else - v24 = pGlobalTXT_LocalizationStrings[406]; + v24 = pGlobalTXT_LocalizationStrings[406]; // Hire } else if ( v16 == 24 ) { @@ -16634,13 +16639,13 @@ } else if ( v16 == 13 ) { - if ( pNPC->uFlags & 0x80 ) + if (pNPC->Hired()) { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s v24 = pTmpBuf; } else - v24 = pGlobalTXT_LocalizationStrings[122]; + v24 = pGlobalTXT_LocalizationStrings[122]; // Join } else v24 = ""; @@ -16841,7 +16846,7 @@ { for (i = 0; i < pNPCStats->uNumNewNPCs; ++i) { - if (pNPCStats->pNewNPCData[i].uFlags & 0x80) + if (pNPCStats->pNewNPCData[i].Hired()) { if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) { @@ -16927,7 +16932,7 @@ v16 = &pTmpBuf[v6]; do { - if ( v9->uFlags & 0x80 + if ( v9->Hired() && (!pParty->pHirelings[0].pName || strcmp(v9->pName, pParty->pHirelings[0].pName)) && (!pParty->pHirelings[1].pName || strcmp(v9->pName, pParty->pHirelings[1].pName)) ) { @@ -16993,7 +16998,7 @@ v8 = pNPCStats->pNewNPCData; do { - if ( v8->uFlags & 0x80 && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName)) ) + if (v8->Hired() && (!pParty->pHirelings[0].pName || strcmp(v8->pName, pParty->pHirelings[0].pName)) ) { if ( !pParty->pHirelings[1].pName || strcmp(v8->pName, pParty->pHirelings[1].pName) ) *v7++ = v1 + 2; @@ -20111,7 +20116,7 @@ for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) { auto npc = pNPCStats->pNewNPCData + i; - if (npc->uFlags & 0x80 && + if (npc->Hired() && (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName))) { if (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName))
--- a/mm7_4.cpp Mon Feb 18 03:59:31 2013 +0200 +++ b/mm7_4.cpp Mon Feb 18 07:11:43 2013 +0200 @@ -3519,7 +3519,7 @@ } } v44 = 0; - if ( sub_476387() == 1 ) + if (PartyHasDragon()) v44 = 1; v49 = 0; LABEL_25: @@ -4905,11 +4905,14 @@ v60 = strlen(Str); a1[0] = 0; pPlayer = &pParty->pPlayers[v6]; - v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); v61 = pPlayer; memset(pTmpBuf2, 0, 0x7D0u); if ( dword_5C35D4 ) + { + __debugbreak(); // fix v9 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; + } else v9 = GetNPCData(uDialogue_SpeakingActorNPC_ID); v65 = v9; @@ -9404,7 +9407,7 @@ char *v17; // ecx@63 char *v18; // eax@65 const char *v19; // ecx@68 - unsigned int v20; // eax@69 + //unsigned int v20; // eax@69 unsigned int v21; // ecx@70 char *v22; // [sp-Ch] [bp-18h]@73 int v23; // [sp-8h] [bp-14h]@49 @@ -9427,7 +9430,7 @@ ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); sub_4B40E6(); - byte_F8B1EC = 0; + dialogue_show_profession_details = false; goto _return; } switch ( a1 ) @@ -9494,13 +9497,13 @@ if ( a1 == 77 ) { v16 = v2->uProfession; - if ( byte_F8B1EC ) - v17 = (char *)*(&pNPCStats->field_13A64 + 5 * v16); + if (dialogue_show_profession_details) + v17 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText; else - v17 = (char *)*(&pNPCStats->field_13A5C + 5 * v16); + v17 = pNPCStats->pProfessions[v2->uProfession - 1].pBenefits; ptr_F8B1E8 = v17; v18 = sub_495461(v17, uActiveCharacter - 1, 0, 0, 0, 0); - byte_F8B1EC ^= 1u; + dialogue_show_profession_details = ~dialogue_show_profession_details; ptr_F8B1E8 = v18; } else @@ -9616,19 +9619,19 @@ ShowStatusBarString(v19, 2u); goto _return; } - v20 = v2->uProfession; - if ( v20 != 51 ) - { - v21 = *(&pNPCStats->field_13A58 + 5 * v20); + //v20 = v2->uProfession; + if ( v2->uProfession != 51 ) + { + v21 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice; if ( pParty->uNumGold < v21 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - byte_F8B1EC = 0; + dialogue_show_profession_details = false; uDialogueType = 13; - ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); + ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText; ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); v19 = pGlobalTXT_LocalizationStrings[155]; goto LABEL_77; } @@ -12538,17 +12541,17 @@ } //----- (004BC49B) -------------------------------------------------------- -void __thiscall sub_4BC49B(unsigned int _this) -{ - unsigned int v1; // esi@1 +void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType) +{ + //unsigned int v1; // esi@1 NPCData *v2; // ebp@1 - unsigned int v3; // eax@1 + //unsigned int v3; // eax@1 int v4; // ecx@10 signed int v5; // edi@14 char *v6; // esi@15 const char *v7; // ecx@22 signed int v8; // edi@37 - unsigned int v9; // eax@56 + //unsigned int v9; // eax@56 unsigned int v10; // ecx@57 void *v11; // [sp-Ch] [bp-1Ch]@46 int v12; // [sp-8h] [bp-18h]@46 @@ -12556,36 +12559,36 @@ size_t v14; // [sp-4h] [bp-14h]@46 const char *v15; // [sp-4h] [bp-14h]@60 - v1 = _this; + //v1 = _this; v2 = GetNPCData(uDialogue_SpeakingActorNPC_ID); - v3 = v1; - uDialogueType = v1; + //v3 = v1; + uDialogueType = newDialogueType; if ( !v2->uFlags ) { v2->uFlags = 1; - v3 = uDialogueType; - } - if ( (signed int)v3 > 22 ) - { - if ( v3 == 23 ) + //v3 = uDialogueType; + } + if ( (signed int)newDialogueType > 22 ) + { + if ( newDialogueType == DIALOGUE_23 ) { v4 = v2->evte; goto LABEL_74; } - if ( v3 == 24 ) + if (newDialogueType == DIALOGUE_24) { v4 = v2->evtf; goto LABEL_74; } - if ( v3 != 76 ) - { - if ( v3 == 77 ) - { - byte_F8B1EC ^= 1u; + if (newDialogueType != DIALOGUE_76) + { + if (newDialogueType == DIALOGUE_PROFESSION_DETAILS) + { + dialogue_show_profession_details = ~dialogue_show_profession_details; } else { - if ( (signed int)v3 > 84 && (signed int)v3 <= 88 ) + if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 ) { ArenaFight(); return; @@ -12593,7 +12596,7 @@ } goto LABEL_87; } - if ( v2->uFlags & 0x80 ) + if (v2->Hired()) { v8 = 0; if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) @@ -12646,17 +12649,17 @@ ShowStatusBarString(v7, 2u); goto LABEL_87; } - v9 = v2->uProfession; - if ( v9 != 51 ) - { - v10 = *(&pNPCStats->field_13A58 + 5 * v9); + //v9 = v2->uProfession; + if ( v2->uProfession != 51 ) + { + v10 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice; if ( pParty->uNumGold < v10 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" - byte_F8B1EC = 0; + dialogue_show_profession_details = false; uDialogueType = 13; if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0); + pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); v7 = pGlobalTXT_LocalizationStrings[155]; goto LABEL_64; } @@ -12691,12 +12694,12 @@ pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0); goto LABEL_87; } - if ( v3 == 22 ) + if (newDialogueType == DIALOGUE_22) { v4 = v2->evtd; goto LABEL_74; } - if ( v3 == 9 ) + if (newDialogueType == DIALOGUE_9) { if ( !sub_4BB756(v2->uProfession) ) { @@ -12714,12 +12717,12 @@ v7 = pGlobalTXT_LocalizationStrings[140]; goto LABEL_64; } - if ( v3 == 13 ) - { - if ( !(v2->uFlags & 0x80) ) + if (newDialogueType == DIALOGUE_13) + { + if (!v2->Hired()) { sub_4B3E1E(); - byte_F8B1EC = 0; + dialogue_show_profession_details = false; goto LABEL_87; } v5 = 0; @@ -12739,17 +12742,17 @@ } goto LABEL_44; } - if ( v3 == 19 ) + if (newDialogueType == DIALOGUE_19) { v4 = v2->bDrawSomeAnim; goto LABEL_74; } - if ( v3 == 20 ) + if (newDialogueType == DIALOGUE_20) { v4 = v2->_anim_current_time; goto LABEL_74; } - if ( v3 == 21 ) + if (newDialogueType == DIALOGUE_21) { v4 = v2->_anim_end_time; LABEL_74: @@ -12778,7 +12781,7 @@ } else { - dword_F8B1D8 = v3; + dword_F8B1D8 = newDialogueType; sub_4B3EF0(v4 - 400); } }
--- a/mm7_5.cpp Mon Feb 18 03:59:31 2013 +0200 +++ b/mm7_5.cpp Mon Feb 18 07:11:43 2013 +0200 @@ -365,7 +365,7 @@ auto npc = pNPCStats->pNewNPCData + i; //do //{ - if (npc->uFlags & 0x80 && + if (npc->Hired() && (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) && (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) ) { @@ -398,8 +398,8 @@ case UIMSG_195: sub_4BCACC_bounties(uMessageParam); continue; - case UIMSG_88: - sub_4BC49B(uMessageParam); + case UIMSG_SelectDialogueOption: + OnSelectDialogueOption((DIALOGUE_TYPE)uMessageParam); continue; case UIMSG_19A: _4B4224_UpdateNPCTopics(uMessageParam); @@ -16044,7 +16044,7 @@ while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/ for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) { - if (pNPCStats->pNewNPCData[i].uFlags & 0x80) + if (pNPCStats->pNewNPCData[i].Hired()) { if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) {
--- a/mm7_data.cpp Mon Feb 18 03:59:31 2013 +0200 +++ b/mm7_data.cpp Mon Feb 18 07:11:43 2013 +0200 @@ -2007,7 +2007,7 @@ int dword_F8B1E0; // weak int dword_F8B1E4; // weak const char *ptr_F8B1E8; // idb -char byte_F8B1EC; // weak +char dialogue_show_profession_details = false; // F8B1EC char byte_F8B1EF[777]; // weak char byte_F8B1F0[4]; int dword_F8B1F4; // weak
--- a/mm7_data.h Mon Feb 18 03:59:31 2013 +0200 +++ b/mm7_data.h Mon Feb 18 07:11:43 2013 +0200 @@ -1702,7 +1702,7 @@ extern int dword_F8B1E0; // weak extern int dword_F8B1E4; // weak extern const char *ptr_F8B1E8; // idb -extern char byte_F8B1EC; // weak +extern char dialogue_show_profession_details; // weak extern char byte_F8B1EF[]; // weak extern char byte_F8B1F0[4]; extern int dword_F8B1F4; // weak @@ -2183,7 +2183,7 @@ bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4); bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4); bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9); -bool __cdecl sub_476387(); +bool PartyHasDragon(); bool __thiscall CheckHiredNPCSpeciality(unsigned int uProfession); void __cdecl InitializeAwards(); void __cdecl InitializeScrolls(); @@ -2350,7 +2350,6 @@ void __cdecl sub_4BBCDD(); void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb void __cdecl ArenaFight(); -void __thiscall sub_4BC49B(unsigned int _this); struct Texture *__cdecl sub_4BC8D5(); struct GUIButton *__cdecl sub_4BCA33(); void __fastcall sub_4BCACC_bounties(signed int a1);