Mercurial > mm7
changeset 342:bf7596b71b24
PrepareHouse
author | Nomad |
---|---|
date | Thu, 21 Feb 2013 00:33:58 +0200 |
parents | a8ee15a20bea |
children | 6e152b7ec581 |
files | mm7_4.cpp mm7_data.h |
diffstat | 2 files changed, 96 insertions(+), 85 deletions(-) [+] |
line wrap: on
line diff
--- a/mm7_4.cpp Thu Feb 21 00:12:19 2013 +0200 +++ b/mm7_4.cpp Thu Feb 21 00:33:58 2013 +0200 @@ -9651,7 +9651,7 @@ strcpy(v22, v24); pParty->field_709 = 0; sub_44A56A(); - PrepareHouse((unsigned int)window_SpeakInHouse->ptr_1C); + PrepareHouse((HOUSE_TYPE)(int)window_SpeakInHouse->ptr_1C); dword_F8B19C = 1; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { @@ -14870,113 +14870,124 @@ //----- (0044606A) -------------------------------------------------------- -int __fastcall PrepareHouse(unsigned int uHouseID) -{ - unsigned int v1; // ebx@1 - signed int v2; // esi@1 - int uExitPic; // edi@1 +void PrepareHouse(HOUSE_TYPE house) +{ + //unsigned int v1; // ebx@1 + //signed int v2; // esi@1 + //int uExitPic; // edi@1 __int16 uExitMapID; // ax@2 - int result; // eax@5 - unsigned int *v6; // ecx@8 + //int result; // eax@5 + //unsigned int *v6; // ecx@8 int v7; // ebx@11 - int v8; // esi@16 - unsigned int v9; // eax@16 - unsigned int v10; // eax@19 - int v11; // ecx@19 - char pContainer[36]; // [sp+Ch] [bp-54h]@16 + //int v8; // esi@16 + //unsigned int v9; // eax@16 + //unsigned int v10; // eax@19 + //int v11; // ecx@19 + //char pContainer[36]; // [sp+Ch] [bp-54h]@16 int v13; // [sp+30h] [bp-30h]@11 int Dst[6]; // [sp+34h] [bp-2Ch]@1 - unsigned int v15; // [sp+4Ch] [bp-14h]@1 + //unsigned int v15; // [sp+4Ch] [bp-14h]@1 int uAnimationID; // [sp+50h] [bp-10h]@1 - unsigned int *v17; // [sp+54h] [bp-Ch]@3 - unsigned int v18; // [sp+58h] [bp-8h]@1 - int v19; // [sp+5Ch] [bp-4h]@7 - - v15 = uHouseID; - v1 = 52 * uHouseID; + //unsigned int *v17; // [sp+54h] [bp-Ch]@3 + //unsigned int v18; // [sp+58h] [bp-8h]@1 + //int v19; // [sp+5Ch] [bp-4h]@7 + + //v15 = uHouseID; + //v1 = 52 * uHouseID; //uAnimationID = p2DEvents_minus1___02[26 * uHouseID]; - uAnimationID = p2DEvents[uHouseID - 1].uAnimationID; - v2 = 0; - v18 = 52 * uHouseID; + uAnimationID = p2DEvents[house - 1].uAnimationID; + //v18 = 52 * uHouseID; memset(Dst, 0, 0x18u); //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1); - uExitPic = p2DEvents[uHouseID - 1].uExitPicID; + //uExitPic = p2DEvents[uHouseID - 1].uExitPicID; uNumDialogueNPCPortraits = 0; - uHouse_ExitPic = uExitPic; - if ( uExitPic ) + uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; + if ( uHouse_ExitPic ) { //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1); - uExitMapID = p2DEvents[uHouseID - 1]._quest_related; + uExitMapID = p2DEvents[house - 1]._quest_related; if ( uExitMapID > 0 ) { - v17 = (unsigned int *)(uExitMapID - 1); - if ( !((unsigned __int8)(0x80u >> (signed int)v17 % 8) & pParty->_award_bits[(uExitMapID - 1) >> 3]) ) - { - uExitPic = 0; + //v17 = (unsigned int *)(uExitMapID - 1); + if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_award_bits[(uExitMapID - 1) >> 3]) ) + { + //uExitPic = 0; uHouse_ExitPic = 0; } } } + dword_591080 = pAnimatedRooms[uAnimationID].field_8; - result = dword_591080; + //result = dword_591080; + + //v2 = 0; + uNumDialogueNPCPortraits = 0; if ( dword_591080 ) { - v2 = 1; + //v2 = 1; Dst[0] = dword_591080; uNumDialogueNPCPortraits = 1; } - v19 = 1; - if ( (signed int)pNPCStats->uNumNewNPCs > 1 ) - { - v6 = &pNPCStats->pNewNPCData[1].uFlags; - v17 = &pNPCStats->pNewNPCData[1].uFlags; - do - { - if ( v6[3] == v15 ) - { - if ( !(*(char *)v6 & 0x80) ) - { - v7 = v2++ - (result != 0); - array_5913D8[v7] = (NPCData *)(v6 - 2); - v6 = v17; - *(&v13 + v2) = *(v17 - 1); - v1 = v18; - if ( (*v6 & 3) != 2 ) - ++*v6; - } - } - ++v19; - v6 += 19; - v17 = v6; - } - while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); - uNumDialogueNPCPortraits = v2; - } - v19 = 0; - if ( v2 > 0 ) - { - do - { - v8 = v19; - sprintf(pContainer, "npc%03u", Dst[v19]); - v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - ++v19; - pDialogueNPCPortraits[v8] = &pIcons_LOD->pTextures[v9]; - result = v19; - } - while ( v19 < uNumDialogueNPCPortraits ); - uExitPic = uHouse_ExitPic; - } - if ( uExitPic ) - { - v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uExitPic], TEXTURE_16BIT_PALETTE); - v11 = uNumDialogueNPCPortraits++; - pDialogueNPCPortraits[v11] = &pIcons_LOD->pTextures[v10]; + + //v19 = 1; + for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) + { + auto npc = pNPCStats->pNewNPCData + i; + //v6 = &pNPCStats->pNewNPCData[1].uFlags; + //v17 = &pNPCStats->pNewNPCData[1].uFlags; + //do + //{ + if (npc->Location2D == house ) + { + if (~npc->uFlags & 0x80) + //if ( !(*(char *)v6 & 0x80) ) + { + v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0; + array_5913D8[v7] = npc; + //v6 = v17; + //*(&v13 + v2) = *(v17 - 1); + Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID; + //v1 = v18; + if ((npc->uFlags & 3) != 2) + ++npc->uFlags; + } + } + //++v19; + //v6 += 19; + //v17 = v6; + //} + //while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); + } + //uNumDialogueNPCPortraits = v2; + + //v19 = 0; + for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) + //if ( v2 > 0 ) + { + //do + //{ + //v8 = v19; + char icon_name[128]; + sprintfex(icon_name, "npc%03u", Dst[i]); + //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + //++v19; + pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); + //result = v19; + //} + //while ( v19 < uNumDialogueNPCPortraits ); + //uExitPic = uHouse_ExitPic; + } + + if (uHouse_ExitPic) + { + //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); + //v11 = uNumDialogueNPCPortraits++; + pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1); - result = p2DEvents[uHouseID - 1].uExitMapID; - uHouse_ExitPic = result; - } - return result; + //result = p2DEvents[house - 1].uExitMapID; + uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; + } + //return result; }
--- a/mm7_data.h Thu Feb 21 00:12:19 2013 +0200 +++ b/mm7_data.h Thu Feb 21 00:33:58 2013 +0200 @@ -2023,7 +2023,7 @@ struct NPCData *__fastcall GetNewNPCData(signed int npcid, int a2); int __fastcall sub_445C8B(signed int a1); void __cdecl sub_44603D(); -int __fastcall PrepareHouse(unsigned int uHouseID); // idb +void PrepareHouse(enum HOUSE_TYPE house); // idb bool __fastcall EnterHouse(enum HOUSE_TYPE uHouseID); int sub_4465DF_check_season(int a1); int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb