# HG changeset patch # User Ritor1 # Date 1360926864 -21600 # Node ID f102bbff6fd83011fdcdd89e8b8231941f2301f9 # Parent 1dfa65be220eb896a5d931ffe0df9ca016f08477 15.02.13 Water diff -r 1dfa65be220e -r f102bbff6fd8 GUIWindow.h --- a/GUIWindow.h Fri Feb 15 10:41:54 2013 +0600 +++ b/GUIWindow.h Fri Feb 15 17:14:24 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 1dfa65be220e -r f102bbff6fd8 Outdoor.cpp --- a/Outdoor.cpp Fri Feb 15 10:41:54 2013 +0600 +++ b/Outdoor.cpp Fri Feb 15 17:14:24 2013 +0600 @@ -2432,7 +2432,7 @@ if (v3 < 198) { if (v3 >= 90) - v3 = v3 + this->pTileTypes[(v3 - 90) / 18].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,13 +2470,13 @@ result = pTileTable->pTiles[v3].uAttributes; } return result;*/ - if (uX > 127 || uY > 127) - return 0; - else - { - v3 = this->pTerrain.pTilemap[128 * uY + uX]; - if ( v3 >= 90 ) - v3 = v3 + this->pTileTypes[(v3 - 90) / 18].uTileID - 36 * (v3 - 90) / 36 - 90; + if (uX > 127 || 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; return pTileTable->pTiles[v3].uAttributes; } } @@ -2489,7 +2489,7 @@ if ( (signed int)uX < 0 || (signed int)uX > 127 || (signed int)uZ < 0 || (signed int)uZ > 127 ) result = 0; else - result = 32 * *(&this->pTerrain.pHeightmap[128 * uZ] + uX); + result = 32 * *(&this->pTerrain.pHeightmap[uZ * 128 + uX]); return result; } diff -r 1dfa65be220e -r f102bbff6fd8 Player.cpp --- a/Player.cpp Fri Feb 15 10:41:54 2013 +0600 +++ b/Player.cpp Fri Feb 15 17:14:24 2013 +0600 @@ -1983,9 +1983,9 @@ char *v7; // esi@7 signed int uSkillMultiplier; // [sp-4h] [bp-14h]@2 - LOBYTE(v2) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); + v2 = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_ITEM_ID); v3 = v2; - if ( HIBYTE(v2) & 1 ) + if ( v2 & 1 ) { uSkillMultiplier = 5; } @@ -1994,21 +1994,34 @@ if ( (v2 & 0x80u) == 0 ) { uSkillMult = ((v2 & 0x40) != 0) + 1; - goto LABEL_7; + v5 = uSkillMult * (v3 & 0x3F); + v6 = 0; + v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; + if ( CheckHiredNPCSpeciality(4) ) + { + v6 = 1; + return v6; + } + if ( (signed int)SkillToMastery(v3) >= 4 ) + v6 = 1; + if ( v5 >= (unsigned __int8)v7[46] ) + v6 = 1; + return v6; } uSkillMultiplier = 3; } uSkillMult = uSkillMultiplier; -LABEL_7: v5 = uSkillMult * (v3 & 0x3F); v6 = 0; v7 = (char *)&pItemsTable->pItems[pItem->uItemID].pIconName; - if ( CheckHiredNPCSpeciality(4u) ) - goto LABEL_15; + if ( CheckHiredNPCSpeciality(4) ) + { + v6 = 1; + return v6; + } if ( (signed int)SkillToMastery(v3) >= 4 ) v6 = 1; if ( v5 >= (unsigned __int8)v7[46] ) -LABEL_15: v6 = 1; return v6; } diff -r 1dfa65be220e -r f102bbff6fd8 Render.cpp --- a/Render.cpp Fri Feb 15 10:41:54 2013 +0600 +++ b/Render.cpp Fri Feb 15 17:14:24 2013 +0600 @@ -20,6 +20,7 @@ #include "OSInfo.h" #include "Actor.h" #include "Log.h" +#include "TileFrameTable.h" #include "mm7_data.h" @@ -1711,6 +1712,7 @@ int v6; // ecx@8 //int v7; // ecx@8 struct stru148 *v8; // ebx@8 +// RenderVertexSoft *v8a; // edi@3 //char v11; // zf@8 struct stru148 *v16; unsigned int v18; // edi@22 @@ -1739,6 +1741,7 @@ int v64; // [sp+57h] [bp-1h]@2 int v62; //struct IndoorCameraD3D *pIndoorCameraD3D; + //RenderVertexSoft *pVertices; // [sp+C4h] [bp-Ch]@6 v63 = 0; // basic optimizations @@ -1787,12 +1790,17 @@ v8->flags = 0; v8->field_32 = 0; //unsigned int uTileID = pOutdoor->pTerrain.pTilemap[z * 128 + x]; - //struct TileDesc *pTile = pOutdoor->pTerrain->pTileTable->GetTileById(uTileID); + //struct TileDesc *pTile = pTileTable->GetTileById(uTileID); v8->uTileBitmapID = pOutdoor->DoGetTileTexture(x, z); - v6 = v8->uTileBitmapID; - v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v6]; + //v6 = v8->uTileBitmapID; + v8->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v8->uTileBitmapID]; if (v8->uTileBitmapID == 0xFFFF) continue; + v8->flags = 0x8010 |pOutdoor->GetSomeOtherTileInfo(x, z); + v8->field_32 = 0; + v8->field_59 = 1; + //v8->field_5D = (char)WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8a->vWorldPosition.z) / 2 + 0.5f)); + //v8->field_5C = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f));; v8->sTextureDeltaU = 0; v8->sTextureDeltaV = 0; memcpy(array_73D150 + 0, &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft)); @@ -1828,6 +1836,17 @@ array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); } + if ( v8->flags & 2 && v8->uTileBitmapID == pRenderer->field_1036AC_bitmapid ) + { + //v80 = false; + v6 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; + } + else + { + v6 = v8->uTileBitmapID; + //v80 = true; + } + assert(v6 < 1000); // many random crashes here pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]); --pOutdoorCamera->numStru148s; diff -r 1dfa65be220e -r f102bbff6fd8 mm7_3.cpp --- a/mm7_3.cpp Fri Feb 15 10:41:54 2013 +0600 +++ b/mm7_3.cpp Fri Feb 15 17:14:24 2013 +0600 @@ -8366,8 +8366,8 @@ array_50AC10[3].u = 1; array_50AC10[3].v = 1 + t; pRenderer->DrawStrip(_this.uNumVertices, &_this, - pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); - return; + pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); + return; } @@ -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) --------------------------------------------------------