# HG changeset patch # User Ritor1 # Date 1360935985 -21600 # Node ID 16d257ffc80247840bdaa136651dce2b5311bbda # Parent 428cbb33872cc4e6293e857c49cd754c7f446ca4 wtrdrE diff -r 428cbb33872c -r 16d257ffc802 Outdoor.cpp --- a/Outdoor.cpp Fri Feb 15 18:34:53 2013 +0600 +++ b/Outdoor.cpp Fri Feb 15 19:46:25 2013 +0600 @@ -2425,14 +2425,14 @@ result = pTileTable->pTiles[v3].uBitmapID; } return result;*/ - if (uX > 127 || uY > 127) + if ( uX < 0 || uX > 127 || uY < 0 || uY > 127) return 0; v3 = this->pTerrain.pTilemap[uY * 128 + uX]; if (v3 < 198) { if (v3 >= 90) - v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * (v3 - 90) / 36 - 90; + v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; } else v3 = v3 + this->pTileTypes[3].uTileID - 198; @@ -2470,15 +2470,15 @@ result = pTileTable->pTiles[v3].uAttributes; } return result;*/ - if (uX > 127 || uY > 127) + if (uX < 0 || uX > 127 || uY < 0 || uY > 127) return 0; else { v3 = this->pTerrain.pTilemap[uY * 128 + uX]; if ( v3 >= 90 ) - v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * (v3 - 90) / 36 - 90; + v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; return pTileTable->pTiles[v3].uAttributes; - } + } } //----- (0047EE16) -------------------------------------------------------- diff -r 428cbb33872c -r 16d257ffc802 mm7_3.cpp --- a/mm7_3.cpp Fri Feb 15 18:34:53 2013 +0600 +++ b/mm7_3.cpp Fri Feb 15 19:46:25 2013 +0600 @@ -16484,9 +16484,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; @@ -16504,7 +16504,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; @@ -16525,7 +16525,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; @@ -16549,7 +16549,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; @@ -16570,7 +16570,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); @@ -16593,11 +16593,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 ) @@ -16705,9 +16705,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; //"Invalid String Passed" v10 = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0); LABEL_32: pInString = v10; @@ -16950,18 +16950,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 ) @@ -17016,7 +17021,60 @@ else result = &pParty->pHirelings[(unsigned __int8)v9]; } - return result; + 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]; + } } //----- (00445B2C) --------------------------------------------------------