# HG changeset patch # User Ritor1 # Date 1360901196 -21600 # Node ID e6db0995ac4b9ec51d072b69aa1925c89b4fe9b7 # Parent 90521fb9766c181584877b3a1138bf07c41b3f6b Dialogue_Type diff -r 90521fb9766c -r e6db0995ac4b GUIWindow.h --- a/GUIWindow.h Thu Feb 14 16:17:23 2013 +0600 +++ b/GUIWindow.h Fri Feb 15 10:06:36 2013 +0600 @@ -25,10 +25,14 @@ enum DIALOGUE_TYPE { - DIALOGUE_ARENA_WELCOME = 0x89, - DIALOGUE_ARENA_FIGHT_NOT_OVER_YET = 0x90, - DIALOGUE_ARENA_REWARD = 0x91, - DIALOGUE_ARENA_ALREADY_WON = 0x92, + DIALOGUE_13 = 0xD, + DIALOGUE_18 = 0x12, + DIALOGUE_24 = 0x18, + DIALOGUE_77 = 0x4D, + DIALOGUE_ARENA_WELCOME = 0x59, + DIALOGUE_ARENA_FIGHT_NOT_OVER_YET = 0x5A, + DIALOGUE_ARENA_REWARD = 0x5B, + DIALOGUE_ARENA_ALREADY_WON = 0x5C, }; diff -r 90521fb9766c -r e6db0995ac4b mm7_3.cpp --- a/mm7_3.cpp Thu Feb 14 16:17:23 2013 +0600 +++ b/mm7_3.cpp Fri Feb 15 10:06:36 2013 +0600 @@ -16004,9 +16004,9 @@ } v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3); pParty->GetPartyFame(); - if ( (signed int)uDialogueType > 89 ) - { - if ( uDialogueType == 90 ) + if ( (signed int)uDialogueType > DIALOGUE_ARENA_WELCOME ) + { + if ( uDialogueType == DIALOGUE_ARENA_FIGHT_NOT_OVER_YET ) { pWindow.uFrameWidth = 460; pWindow.uFrameZ = 452; @@ -16024,7 +16024,7 @@ pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); goto LABEL_42; } - if ( uDialogueType == 91 ) + if ( uDialogueType == DIALOGUE_ARENA_REWARD ) { sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold." pInString = v4; @@ -16045,7 +16045,7 @@ pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); goto LABEL_42; } - if ( uDialogueType == 92 ) + if ( uDialogueType == DIALOGUE_ARENA_ALREADY_WON ) { v7 = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" v8 = 0; @@ -16069,7 +16069,7 @@ } else { - if ( uDialogueType == 89 ) + if ( uDialogueType == DIALOGUE_ARENA_WELCOME ) { v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:" v8 = 0; @@ -16090,7 +16090,7 @@ pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); goto LABEL_42; } - if ( uDialogueType == 13 ) + if ( uDialogueType == DIALOGUE_13 ) { v5 = 5 * pNPC->uProfession; v6 = (char *)*(&pNPCStats->field_13A64 + v5); @@ -16113,11 +16113,11 @@ pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); goto LABEL_42; } - if ( (signed int)uDialogueType > 18 ) - { - if ( (signed int)uDialogueType > 24 ) - { - if ( uDialogueType == 77 ) + if ( (signed int)uDialogueType > DIALOGUE_18 ) + { + if ( (signed int)uDialogueType > DIALOGUE_24 ) + { + if ( uDialogueType == DIALOGUE_77 ) { v5 = 5 * pNPC->uProfession; if ( byte_F8B1EC ) @@ -16225,9 +16225,9 @@ { v8 = 0; if ( pNPC->uFlags & 0x80 ) - v9 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); - else - v9 = (char *)*(&pNPCStats->field_13A64 + 5 * pNPC->uProfession); //"Invalid String Passed" + v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pDismissText; + else + v9 = (char *)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; v10 = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0); LABEL_32: pInString = v10; @@ -16470,18 +16470,23 @@ NPCData *result; // eax@5 int v3; // esi@9 int v4; // ecx@9 - int v5; // edx@9 - NPCData *v6; // eax@9 + //int v5; // edx@9 + //NPCData *v6; // eax@9 char *v7; // ebx@14 NPCData *v8; // edi@14 char v9; // al@22 - std::string v10; // [sp-18h] [bp-2Ch]@4 - const char *v11; // [sp-8h] [bp-1Ch]@4 + char v10; + //std::string v10; // [sp-18h] [bp-2Ch]@4 + int v11; + //const char *v11; // [sp-8h] [bp-1Ch]@4 int v12; // [sp-4h] [bp-18h]@4 - std::string *v13; // [sp+Ch] [bp-8h]@4 + int v13; + char *v14; + //std::string *v13; // [sp+Ch] [bp-8h]@4 int a3; // [sp+13h] [bp-1h]@4 - - v1 = npcid; + int i; + + /*v1 = npcid; if ( (npcid & 0x80000000u) == 0 ) { if ( (signed int)npcid < 5000 ) @@ -16536,6 +16541,60 @@ else result = &pParty->pHirelings[(unsigned __int8)v9]; } + return result;*/ + v1 = npcid; + if ( npcid >= 0 ) + { + if ( npcid < 5000 ) + { + if ( npcid >= 501 ) + { + MessageBoxW(nullptr, L"NPC id exceeds MAX_DATA!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1984", 0); + } + return &pNPCStats->pNewNPCData[v1 - 1]; + } + return &pNPCStats->array_13EF4[npcid - 5000]; + } + + + if ( npcid >= 5000 ) + return &pNPCStats->array_13EF4[npcid - 5000]; + if (uDialogue_SpeakingActorNPC_ID >= 0) + { + result = 0; + } + else + { + v3 = uDialogue_SpeakingActorNPC_ID - 1; + v4 = 0; + + for (i = 0; i < 4; ++i) + { + if (pParty->pHirelings[i].pName) + pTmpBuf[v4++] = i; + } + + if (pNPCStats->uNumNewNPCs > 0) + { + for (i = 0; i < pNPCStats->uNumNewNPCs; ++i) + { + if (pNPCStats->pNewNPCData[i].uFlags & 0x80) + { + if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName)) + { + if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName)) + pTmpBuf[v4++] = i + 2; + } + } + } + } + + v9 = pTmpBuf[v3]; + if ( v9 >= 2 ) + result = &pNPCStats->pNPCData[499 + v9]; + else + result = &pParty->pHirelings[v9]; + } return result; }