Mercurial > mm7
changeset 1506:c76c0f6974bc
Слияние
author | Ritor1 |
---|---|
date | Mon, 02 Sep 2013 12:03:40 +0600 |
parents | 6306a33af531 (current diff) ee5c98a437d9 (diff) |
children | a109bb203e28 |
files | UI/UiGame.cpp mm7_2.cpp |
diffstat | 21 files changed, 2286 insertions(+), 2710 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/Actor.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -3468,7 +3468,7 @@ if ( v23 <= v11 && v27 <= v11 && v12 <= v11 - && sub_4070EF_prolly_collide_objects(PID(OBJECT_Actor, i), PID(OBJECT_Actor, uActorID)) + && sub_4070EF_prolly_detect_player(PID(OBJECT_Actor, i), PID(OBJECT_Actor, uActorID)) && v23 * v23 + v27 * v27 + v19 * v19 < (unsigned int)v25 ) { v25 = v23 * v23 + v27 * v27 + v19 * v19;
--- a/Events.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/Events.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -65,62 +65,62 @@ //----- (00443CE1) -------------------------------------------------------- unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) { - FILE *pLodFile; // eax@1 - unsigned int uTextureSize; // esi@3 - char Args[60]; // [sp+8h] [bp-B4h]@6 - void *ptr; // [sp+B8h] [bp-4h]@1 - Texture DstBuf; // [sp+6Ch] [bp-50h]@1 + FILE *pLodFile; // eax@1 + unsigned int uTextureSize; // esi@3 + char Args[60]; // [sp+8h] [bp-B4h]@6 + void *ptr; // [sp+B8h] [bp-4h]@1 + Texture DstBuf; // [sp+6Ch] [bp-50h]@1 - ptr = pEvents_LOD->LoadRaw(pContainerName, 0); - pLodFile = pEvents_LOD->FindContainer(pContainerName, 0); - if ( !pLodFile ) - Abortf("Unable to load %s", pContainerName); - fread(&DstBuf, 1, 48, pLodFile); - uTextureSize = DstBuf.uDecompressedSize; - if ( !DstBuf.uDecompressedSize ) - uTextureSize = DstBuf.uTextureSize; - memset(&DstBuf, 0, 72); - if ( uTextureSize >= (signed int)uBufferSize ) - { - sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize); - Abortf(Args); - } - memcpy(pBuffer, ptr, uTextureSize); - pAllocator->FreeChunk(ptr); - return uTextureSize; - } + ptr = pEvents_LOD->LoadRaw(pContainerName, 0); + pLodFile = pEvents_LOD->FindContainer(pContainerName, 0); + if ( !pLodFile ) + Abortf("Unable to load %s", pContainerName); + fread(&DstBuf, 1, 48, pLodFile); + uTextureSize = DstBuf.uDecompressedSize; + if ( !DstBuf.uDecompressedSize ) + uTextureSize = DstBuf.uTextureSize; + memset(&DstBuf, 0, 72); + if ( uTextureSize >= (signed int)uBufferSize ) + { + sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize); + Abortf(Args); + } + memcpy(pBuffer, ptr, uTextureSize); + pAllocator->FreeChunk(ptr); + return uTextureSize; + } //----- (00443DA1) -------------------------------------------------------- void Initialize_GlobalEVT() { - struct raw_event_header - { - unsigned char evt_size; - unsigned char evt_id_l; - unsigned char evt_id_h; - unsigned char evt_sequence_num; - } ; - uint events_count; - unsigned int offset_in; - raw_event_header *current_hdr; - uGlobalEVT_NumEvents = 0; - uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT.data(), 46080); - if ( !uGlobalEVT_Size ) - return; - memset(pGlobalEVT_Index.data(), 0x80, sizeof(pGlobalEVT_Index));//52800 - events_count = uGlobalEVT_NumEvents; - current_hdr=(raw_event_header *)pGlobalEVT.data(); - offset_in=0; - for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count) - { - pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); - pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; - pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in; - offset_in+=current_hdr->evt_size+1; + struct raw_event_header + { + unsigned char evt_size; + unsigned char evt_id_l; + unsigned char evt_id_h; + unsigned char evt_sequence_num; + } ; + uint events_count; + unsigned int offset_in; + raw_event_header *current_hdr; + uGlobalEVT_NumEvents = 0; + uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT.data(), 46080); + if ( !uGlobalEVT_Size ) + return; + memset(pGlobalEVT_Index.data(), 0x80, sizeof(pGlobalEVT_Index));//52800 + events_count = uGlobalEVT_NumEvents; + current_hdr=(raw_event_header *)pGlobalEVT.data(); + offset_in=0; + for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count) + { + pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); + pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; + pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in; + offset_in+=current_hdr->evt_size+1; - current_hdr=(raw_event_header *)&pGlobalEVT[offset_in]; - } - uGlobalEVT_NumEvents = events_count; + current_hdr=(raw_event_header *)&pGlobalEVT[offset_in]; + } + uGlobalEVT_NumEvents = events_count; assert(uGlobalEVT_NumEvents < 4400); } @@ -129,26 +129,26 @@ //----- (00443EF8) -------------------------------------------------------- void LoadLevel_InitializeLevelEvt() - { + { struct raw_event_header - { + { unsigned char evt_size; unsigned char evt_id_l; unsigned char evt_id_h; unsigned char evt_sequence_num; } ; uint events_count; - unsigned int offset_in; - raw_event_header *current_hdr; + unsigned int offset_in; + raw_event_header *current_hdr; - if (!uLevelEVT_Size) - return; + if (!uLevelEVT_Size) + return; - memset(array_5B5928_timers, 0, 3200); - memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400); + memset(array_5B5928_timers, 0, 3200); + memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400); - uLevelEVT_NumEvents = 0; - dword_5B65C8_timers_count = 0; + uLevelEVT_NumEvents = 0; + dword_5B65C8_timers_count = 0; current_hdr=(raw_event_header *)pLevelEVT.data(); offset_in=0; @@ -156,7 +156,7 @@ { pLevelEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; - pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in; + pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in; offset_in+=current_hdr->evt_size+1; current_hdr=(raw_event_header *)&pLevelEVT[offset_in]; @@ -173,512 +173,512 @@ Emerald Isle #110 // Fire Resistance fountain -0 LocationName -0 if (Player.FireResistance < 50) - { -1 Set(Player.FireResistance, 50) -2 SetFooterString(22) // +50 Fire Resistance (temporarily) -3 Add(Party.Autonotes, 2) -4 goto return - } -5 SetFooterString(11) // Refreshing! -6 return +0 LocationName +0 if (Player.FireResistance < 50) + { +1 Set(Player.FireResistance, 50) +2 SetFooterString(22) // +50 Fire Resistance (temporarily) +3 Add(Party.Autonotes, 2) +4 goto return + } +5 SetFooterString(11) // Refreshing! +6 return Emerald Isle #111 // ??? - Initialize - Set(Map.Variables[0], 30) - Set(Map.Variables[1], 30) + Initialize + Set(Map.Variables[0], 30) + Set(Map.Variables[1], 30) Emerald Isle #114 // month timer - manage luck fountain -0 LocationName -0 if (Player.BaseLuck >= 15) - { -2 SetFooterString(11) // Refreshing! -3 return - } - else - { -1 if (Map.Variables[2] >= 1) - { -4 Sub(Map.Variables[2], 1) -5 Add(Player.BaseLuck, 2) -6 SetFooterString(25) // +2 Luck (Permament) -7 return - } - else - { -2 SetFooterString(11) // Refreshing! -3 return - } - } +0 LocationName +0 if (Player.BaseLuck >= 15) + { +2 SetFooterString(11) // Refreshing! +3 return + } + else + { +1 if (Map.Variables[2] >= 1) + { +4 Sub(Map.Variables[2], 1) +5 Add(Player.BaseLuck, 2) +6 SetFooterString(25) // +2 Luck (Permament) +7 return + } + else + { +2 SetFooterString(11) // Refreshing! +3 return + } + } -8 Initialize -9 Set Map.Variables[2], 8 +8 Initialize +9 Set Map.Variables[2], 8 Emerald Isle #115 // week timer - gold fountain in the center of town -0 LocationName -0 if (Map.Variables[4] < 3) - { -1 if (Map.Variables[3] == 0) - { -2 if (Party.Gold < 201) - { -3 if (Player.BaseLuck >= 15) - { -5 Add(Map.Variables[3], 1) -6 Add(Party.Gold, 1000) -7 Add(Map.Variables[4], 1) -8 goto return - } - else - { -4 goto 9 - } - } - } - } -9 SetFooterString(11) // Refreshing! -10 return +0 LocationName +0 if (Map.Variables[4] < 3) + { +1 if (Map.Variables[3] == 0) + { +2 if (Party.Gold < 201) + { +3 if (Player.BaseLuck >= 15) + { +5 Add(Map.Variables[3], 1) +6 Add(Party.Gold, 1000) +7 Add(Map.Variables[4], 1) +8 goto return + } + else + { +4 goto 9 + } + } + } + } +9 SetFooterString(11) // Refreshing! +10 return -11 Initialize -12 Set(Map.Variables[3], 0) +11 Initialize +12 Set(Map.Variables[3], 0) -Emerald Isle #220 // day timer - monster spawner -0 LocationName -0 Initialize -1 if (NumAliveActors(group=20) != 0) -2 return -3 SpawnMonsters(1, level=1, count=10, x=-336, y=14512, z=0, group=20) -4 SpawnMonsters(1, level=2, count=5, x=16, y=16352, z=90, group=20) -5 SpawnMonsters(1, level=1, count=10, x=480, y=18288, z=6, group=20) +Emerald Isle #220 // day timer - monster spawner +0 LocationName +0 Initialize +1 if (NumAliveActors(group=20) != 0) +2 return +3 SpawnMonsters(1, level=1, count=10, x=-336, y=14512, z=0, group=20) +4 SpawnMonsters(1, level=2, count=5, x=16, y=16352, z=90, group=20) +5 SpawnMonsters(1, level=1, count=10, x=480, y=18288, z=6, group=20) -Emerald Isle #200 // margareth dock tip -0 if (!QBits.QuestDone[17]) - { -1 InitiateNPCDialogue(npc=19) - } -2 return +Emerald Isle #200 // margareth dock tip +0 if (!QBits.QuestDone[17]) + { +1 InitiateNPCDialogue(npc=19) + } +2 return -Emerald Isle #201 // margareth armoury tip -0 if (!QBits.QuestDone[17]) - { -1 InitiateNPCDialogue(npc=20) - } -2 return +Emerald Isle #201 // margareth armoury tip +0 if (!QBits.QuestDone[17]) + { +1 InitiateNPCDialogue(npc=20) + } +2 return */ - } + } //----- (0044684A) -------------------------------------------------------- void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line) { - unsigned int v3; // eax@5 - signed int v4; // esi@7 - //char *v5; // eax@8 - Player *v6; // ecx@8 - //char *v7; // ebp@8 - //signed int v8; // edx@10 - //int v9; // edi@12 - //ByteArray *v10; // esi@12 - int v11; // eax@14 - char *v12; // eax@15 - //char *v13; // edi@21 - int v14; // ebp@21 - int v15; // edi@21 - const char *v16; // esi@21 - bool v17; // edx@21 - int v18; // ecx@22 - int v19; // ebp@36 - signed int v20; // ecx@40 - int v21; // eax@40 - int v22; // edx@40 - int v23; // eax@40 - unsigned __int16 v24; // ax@45 - int v25; // eax@54 - LevelDecoration *v26; // eax@55 - int v27; // eax@57 - int v28; // ecx@57 - //int v29; // edx@58 - int pEventID; // eax@58 - int pNPC_ID; // ecx@58 - int pIndex; // esi@58 - NPCData *pNPC; // ecx@58 - int v34; // esi@59 - int v35; // esi@60 - int v36; // esi@61 - int v37; // esi@62 - int v38; // eax@78 - int v39; // ecx@78 - size_t v40; // edx@78 - Actor *v41; // esi@79 - int v42; // eax@84 - int v43; // ecx@84 - size_t v44; // edx@84 - Actor *v45; // esi@85 - void *v46; // eax@91 - GUIWindow *v47; // eax@93 - GUIButton *v48; // ecx@93 - GUIButton *v49; // esi@94 - char v50; // al@100 - Player *v51; // esi@103 - Player *v52; // ecx@106 - int v53; // ecx@107 - char v54; // al@111 - Player *v55; // esi@114 - Player *v56; // ecx@117 - int v57; // ecx@118 - signed int pValue; // ebp@124 - Player *pPlayer; // esi@125 - int v60; // eax@126 - int v61; // edx@133 - int v62; // eax@139 - int v63; // ebp@145 - signed int v64; // edi@146 - unsigned int v65; // edx@148 - Player *v66; // ecx@148 - int v67; // esi@148 - signed int v68; // eax@151 - int v69; // esi@151 - Player *v70; // ecx@158 - unsigned int v71; // eax@159 - int v72; // esi@159 - signed int v73; // eax@162 - int v74; // esi@162 - int v75; // edx@172 - Player *v76; // esi@173 - signed int v77; // ebp@186 - int v78; // edx@186 - Player *v79; // esi@187 - //signed int v80; // ebp@200 - //int v81; // edx@200 - Player *v82; // esi@201 - int v83; // eax@212 - int v84; // ebp@220 - signed int v85; // ebp@224 - char v86; // al@224 - Player *v87; // esi@227 - Player *v88; // ecx@231 - int v89; // ecx@232 - int v90; // eax@243 - const char *v91; // ecx@247 - int v92; // eax@251 - char *v93; // eax@252 - int v94; // ecx@262 - int v95; // ebp@262 - int v96; // edx@262 - int v97; // eax@262 - unsigned int v98; // edx@265 - const char *v99; // esi@267 - int v100; // edx@267 - //char *v101; // edi@281 - unsigned int v102; // esi@281 - int v103; // edi@284 - int v104; // eax@288 - int v105; // edx@294 - int v106; // [sp-20h] [bp-4C8h]@278 - signed int v107; // [sp-1Ch] [bp-4C4h]@278 - unsigned int v108; // [sp-18h] [bp-4C0h]@278 - signed int v109; // [sp-14h] [bp-4BCh]@278 - signed int v110; // [sp-10h] [bp-4B8h]@278 - int v111; // [sp-Ch] [bp-4B4h]@278 - // Event *v112; // [sp-8h] [bp-4B0h]@5 - int v113; // [sp-8h] [bp-4B0h]@106 - int v114; // [sp-8h] [bp-4B0h]@117 - signed int v115; // [sp-8h] [bp-4B0h]@231 - unsigned int v116; // [sp-8h] [bp-4B0h]@278 - int v117; // [sp-4h] [bp-4ACh]@106 - int v118; // [sp-4h] [bp-4ACh]@117 - int v119; // [sp-4h] [bp-4ACh]@231 - int v120; // [sp-4h] [bp-4ACh]@278 - int v121; // [sp-4h] [bp-4ACh]@294 - int curr_seq_num; // [sp+10h] [bp-498h]@4 - //char *v123; // [sp+14h] [bp-494h]@0 - signed int v124; // [sp+18h] [bp-490h]@7 - //signed int v125; // [sp+1Ch] [bp-48Ch]@155 - int v126; // [sp+1Ch] [bp-48Ch]@262 - int player_choose; // [sp+20h] [bp-488h]@4 - int v128; // [sp+24h] [bp-484h]@21 - int v129; // [sp+24h] [bp-484h]@262 - signed int v130; // [sp+28h] [bp-480h]@0 - //int v131; // [sp+2Ch] [bp-47Ch]@1 - int v132; // [sp+30h] [bp-478h]@262 - signed int v133; // [sp+34h] [bp-474h]@1 - int v134; // [sp+38h] [bp-470h]@262 - int v135; // [sp+3Ch] [bp-46Ch]@262 - int v136; // [sp+40h] [bp-468h]@40 - int v137; // [sp+44h] [bp-464h]@40 - int v138; // [sp+48h] [bp-460h]@40 - int v139; // [sp+4Ch] [bp-45Ch]@40 - ItemGen item; // [sp+50h] [bp-458h]@15 - char Source[120]; // [sp+74h] [bp-434h]@15 - char Str[120]; // [sp+ECh] [bp-3BCh]@21 - Actor Dst; // [sp+164h] [bp-344h]@53 + unsigned int v3; // eax@5 + signed int v4; // esi@7 + //char *v5; // eax@8 + Player *v6; // ecx@8 + //char *v7; // ebp@8 + //signed int v8; // edx@10 + //int v9; // edi@12 + //ByteArray *v10; // esi@12 + int v11; // eax@14 + char *v12; // eax@15 + //char *v13; // edi@21 + int v14; // ebp@21 + int v15; // edi@21 + const char *v16; // esi@21 + bool v17; // edx@21 + int v18; // ecx@22 + int v19; // ebp@36 + signed int v20; // ecx@40 + int v21; // eax@40 + int v22; // edx@40 + int v23; // eax@40 + unsigned __int16 v24; // ax@45 + int v25; // eax@54 + LevelDecoration *v26; // eax@55 + int v27; // eax@57 + int v28; // ecx@57 + //int v29; // edx@58 + int pEventID; // eax@58 + int pNPC_ID; // ecx@58 + int pIndex; // esi@58 + NPCData *pNPC; // ecx@58 + int v34; // esi@59 + int v35; // esi@60 + int v36; // esi@61 + int v37; // esi@62 + int v38; // eax@78 + int v39; // ecx@78 + size_t v40; // edx@78 + Actor *v41; // esi@79 + int v42; // eax@84 + int v43; // ecx@84 + size_t v44; // edx@84 + Actor *v45; // esi@85 + void *v46; // eax@91 + GUIWindow *v47; // eax@93 + GUIButton *v48; // ecx@93 + GUIButton *v49; // esi@94 + char v50; // al@100 + Player *v51; // esi@103 + Player *v52; // ecx@106 + int v53; // ecx@107 + char v54; // al@111 + Player *v55; // esi@114 + Player *v56; // ecx@117 + int v57; // ecx@118 + signed int pValue; // ebp@124 + Player *pPlayer; // esi@125 + int v60; // eax@126 + int v61; // edx@133 + int v62; // eax@139 + int v63; // ebp@145 + signed int v64; // edi@146 + unsigned int v65; // edx@148 + Player *v66; // ecx@148 + int v67; // esi@148 + signed int v68; // eax@151 + int v69; // esi@151 + Player *v70; // ecx@158 + unsigned int v71; // eax@159 + int v72; // esi@159 + signed int v73; // eax@162 + int v74; // esi@162 + int v75; // edx@172 + Player *v76; // esi@173 + signed int v77; // ebp@186 + int v78; // edx@186 + Player *v79; // esi@187 + //signed int v80; // ebp@200 + //int v81; // edx@200 + Player *v82; // esi@201 + int v83; // eax@212 + int v84; // ebp@220 + signed int v85; // ebp@224 + char v86; // al@224 + Player *v87; // esi@227 + Player *v88; // ecx@231 + int v89; // ecx@232 + int v90; // eax@243 + const char *v91; // ecx@247 + int v92; // eax@251 + char *v93; // eax@252 + int v94; // ecx@262 + int v95; // ebp@262 + int v96; // edx@262 + int v97; // eax@262 + unsigned int v98; // edx@265 + const char *v99; // esi@267 + int v100; // edx@267 + //char *v101; // edi@281 + unsigned int v102; // esi@281 + int v103; // edi@284 + int v104; // eax@288 + int v105; // edx@294 + int v106; // [sp-20h] [bp-4C8h]@278 + signed int v107; // [sp-1Ch] [bp-4C4h]@278 + unsigned int v108; // [sp-18h] [bp-4C0h]@278 + signed int v109; // [sp-14h] [bp-4BCh]@278 + signed int v110; // [sp-10h] [bp-4B8h]@278 + int v111; // [sp-Ch] [bp-4B4h]@278 + // Event *v112; // [sp-8h] [bp-4B0h]@5 + int v113; // [sp-8h] [bp-4B0h]@106 + int v114; // [sp-8h] [bp-4B0h]@117 + signed int v115; // [sp-8h] [bp-4B0h]@231 + unsigned int v116; // [sp-8h] [bp-4B0h]@278 + int v117; // [sp-4h] [bp-4ACh]@106 + int v118; // [sp-4h] [bp-4ACh]@117 + int v119; // [sp-4h] [bp-4ACh]@231 + int v120; // [sp-4h] [bp-4ACh]@278 + int v121; // [sp-4h] [bp-4ACh]@294 + int curr_seq_num; // [sp+10h] [bp-498h]@4 + //char *v123; // [sp+14h] [bp-494h]@0 + signed int v124; // [sp+18h] [bp-490h]@7 + //signed int v125; // [sp+1Ch] [bp-48Ch]@155 + int v126; // [sp+1Ch] [bp-48Ch]@262 + int player_choose; // [sp+20h] [bp-488h]@4 + int v128; // [sp+24h] [bp-484h]@21 + int v129; // [sp+24h] [bp-484h]@262 + signed int v130; // [sp+28h] [bp-480h]@0 + //int v131; // [sp+2Ch] [bp-47Ch]@1 + int v132; // [sp+30h] [bp-478h]@262 + signed int v133; // [sp+34h] [bp-474h]@1 + int v134; // [sp+38h] [bp-470h]@262 + int v135; // [sp+3Ch] [bp-46Ch]@262 + int v136; // [sp+40h] [bp-468h]@40 + int v137; // [sp+44h] [bp-464h]@40 + int v138; // [sp+48h] [bp-460h]@40 + int v139; // [sp+4Ch] [bp-45Ch]@40 + ItemGen item; // [sp+50h] [bp-458h]@15 + char Source[120]; // [sp+74h] [bp-434h]@15 + char Str[120]; // [sp+ECh] [bp-3BCh]@21 + Actor Dst; // [sp+164h] [bp-344h]@53 - //v131 = uEventID; - v133 = 0; - EvtTargetObj = targetObj; - dword_5B65C4 = 0; - if ( !uEventID ) - { - if ( !GameUI_Footer_TimeLeft ) - ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here - return; - } - player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 - curr_seq_num = entry_line; + //v131 = uEventID; + v133 = 0; + EvtTargetObj = targetObj; + dword_5B65C4 = 0; + if ( !uEventID ) + { + if ( !GameUI_Footer_TimeLeft ) + ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here + return; + } + player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 + curr_seq_num = entry_line; - if ( activeLevelDecoration ) - { - uSomeEVT_NumEvents = uGlobalEVT_NumEvents; - pSomeEVT = pGlobalEVT.data(); - memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts - } - else - { - uSomeEVT_NumEvents = uLevelEVT_NumEvents; - pSomeEVT = pLevelEVT.data(); - memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400); - } + if ( activeLevelDecoration ) + { + uSomeEVT_NumEvents = uGlobalEVT_NumEvents; + pSomeEVT = pGlobalEVT.data(); + memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts + } + else + { + uSomeEVT_NumEvents = uLevelEVT_NumEvents; + pSomeEVT = pLevelEVT.data(); + memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400); + } - v4 = 0; - v124 = 0; - //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) - // { - //v6 = v123; - //v7 = ""; - while ( 1 ) - { - if ( dword_5B65C4 ) - goto LABEL_301; - //v8 = v4; - if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) - { - //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; - //v10 = (ByteArray *)&v5[v9]; - auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT); + v4 = 0; + v124 = 0; + //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) + // { + //v6 = v123; + //v7 = ""; + while ( 1 ) + { + if ( dword_5B65C4 ) + goto LABEL_301; + //v8 = v4; + if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) + { + //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; + //v10 = (ByteArray *)&v5[v9]; + auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT); - switch (_evt->_e_type) - { - case EVENT_CheckSeason: - // - if ( !sub_4465DF_check_season(_evt->v5) ) + switch (_evt->_e_type) + { + case EVENT_CheckSeason: + // + if ( !sub_4465DF_check_season(_evt->v5) ) { - ++curr_seq_num; - v4 = v124; - break; + ++curr_seq_num; + v4 = v124; + break; } - v124 = -1; - curr_seq_num = _evt->v6 - 1; - ++curr_seq_num; - break; - case EVENT_ShowMovie: - { - strcpy(Source, (char *)&_evt->v7); - v12 = (char *)&item.uExpireTime + strlen(Source) + 7; - if ( *v12 == 32 ) - *v12 = 0; - if ( pVideoPlayer->field_54 ) - pVideoPlayer->Unload(); - pVideoPlayer->bStopBeforeSchedule = 0; - pVideoPlayer->pResetflag = 0; + v124 = -1; + curr_seq_num = _evt->v6 - 1; + ++curr_seq_num; + break; + case EVENT_ShowMovie: + { + strcpy(Source, (char *)&_evt->v7); + v12 = (char *)&item.uExpireTime + strlen(Source) + 7; + if ( *v12 == 32 ) + *v12 = 0; + if ( pVideoPlayer->field_54 ) + pVideoPlayer->Unload(); + pVideoPlayer->bStopBeforeSchedule = 0; + pVideoPlayer->pResetflag = 0; - v128 = pCurrentScreen; - //v13 = &pSomeEVT[v9]; - //v14 = (unsigned __int8)v13[5]; - //v15 = (unsigned __int8)v13[6]; - v14 = _evt->v5; - v15 = _evt->v6; - strcpy(Str, Source); - v16 = RemoveQuotes(Str); - VideoPlayer::MovieLoop(v16, 0, v14, 1); - if ( !_stricmp(v16, "arbiter good") ) + v128 = pCurrentScreen; + //v13 = &pSomeEVT[v9]; + //v14 = (unsigned __int8)v13[5]; + //v15 = (unsigned __int8)v13[6]; + v14 = _evt->v5; + v15 = _evt->v6; + strcpy(Str, Source); + v16 = RemoveQuotes(Str); + VideoPlayer::MovieLoop(v16, 0, v14, 1); + if ( !_stricmp(v16, "arbiter good") ) { pParty->alignment = PartyAlignment_Good; - v18 = 0; - LOBYTE(v17) = 1; - SetUserInterface(PartyAlignment_Good, v17); - if ( !v15 || v128 == 3 ) - { - pCurrentScreen = v128; - if ( v128 == 3 ) - pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; - if ( v128 == 13 ) - pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); - } + v18 = 0; + LOBYTE(v17) = 1; + SetUserInterface(PartyAlignment_Good, v17); + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + } + + ++curr_seq_num; + v4 = v124; - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - } - if ( !_stricmp(v16, "arbiter evil") ) - { - v18 = 2; - pParty->alignment = PartyAlignment_Evil; - LOBYTE(v17) = 1; - SetUserInterface(PartyAlignment_Evil, v17); - if ( !v15 || v128 == 3 ) - { - pCurrentScreen = v128; - if ( v128 == 3 ) - pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; - if ( v128 == 13 ) - pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; + //v6 = v123; + //v7 = ""; + break; + } + if ( !_stricmp(v16, "arbiter evil") ) + { + v18 = 2; + pParty->alignment = PartyAlignment_Evil; + LOBYTE(v17) = 1; + SetUserInterface(PartyAlignment_Evil, v17); + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + } + ++curr_seq_num; + v4 = v124; - break; - } - if ( !_stricmp(v16, "pcout01") ) // moving to harmondale from emerald isle + //v6 = v123; + //v7 = ""; + + break; + } + if ( !_stricmp(v16, "pcout01") ) // moving to harmondale from emerald isle { - Rest(0x2760u); - pParty->RestAndHeal(); - pParty->days_played_without_rest = 0; + Rest(0x2760u); + pParty->RestAndHeal(); + pParty->days_played_without_rest = 0; } - if ( !v15 || v128 == 3 ) - { - pCurrentScreen = v128; - if ( v128 == 3 ) - pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; - if ( v128 == 13 ) - pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - } - break; - case EVENT_CheckSkill: - { - v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); - if ( player_choose < 0 ) - goto LABEL_47; - if ( player_choose <= 3 ) - { - v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; - } - else - { - if ( player_choose == 4 ) - { - v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; - } - else - { - if ( player_choose == 5 ) - { - v20 = 0; - v21 = 3486 * v130 + _evt->v5; - v136 = 1; - LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; - v137 = v21 & 0x40; - v138 = v21 & 0x80; - v22 = v21 & 0x100; - v23 = v21 & 0x3F; - v139 = v22; - while ( v23 < v19 || !*(&v136 + _evt->v6) ) - { - ++v20; - if ( v20 >= 4 ) - { - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - } - } - v11 = _evt->v11; - goto LABEL_130; - } + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + } + break; + case EVENT_CheckSkill: + { + v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); + if ( player_choose < 0 ) + goto LABEL_47; + if ( player_choose <= 3 ) + { + v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; + } + else + { + if ( player_choose == 4 ) + { + v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; + } + else + { + if ( player_choose == 5 ) + { + v20 = 0; + v21 = 3486 * v130 + _evt->v5; + v136 = 1; + LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; + v137 = v21 & 0x40; + v138 = v21 & 0x80; + v22 = v21 & 0x100; + v23 = v21 & 0x3F; + v139 = v22; + while ( v23 < v19 || !*(&v136 + _evt->v6) ) + { + ++v20; + if ( v20 >= 4 ) + { + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + } + } + v11 = _evt->v11; + goto LABEL_130; + } LABEL_47: - //v10 = (ByteArray *)&v5[v9]; - v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; - } - } - v136 = 1; - v137 = v24 & 0x40; - v138 = v24 & 0x80; - v139 = v24 & 0x100; - if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) - { - v11 = _evt->v11; - goto LABEL_130; - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - } - break; + //v10 = (ByteArray *)&v5[v9]; + v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; + } + } + v136 = 1; + v137 = v24 & 0x40; + v138 = v24 & 0x80; + v139 = v24 & 0x100; + if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) + { + v11 = _evt->v11; + goto LABEL_130; + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + } + break; - case EVENT_SpeakNPC: - if ( canShowMessages ) - { - //Actor::Actor(&Dst); - memset(&Dst, 0, 0x344u); - dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); - Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id; - GameUI_InitializeDialogue(&Dst, false); - } - else - { - bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_ChangeEvent: - v25 = EVT_DWORD(_evt->v5); - if ( v25 ) - { - stru_5E4C90._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; - } - else - { - v26 = (LevelDecoration *)activeLevelDecoration; - stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; - v26->field_2 |= 0x0020; - } - ++curr_seq_num; - v4 = v124; + case EVENT_SpeakNPC: + if ( canShowMessages ) + { + //Actor::Actor(&Dst); + memset(&Dst, 0, 0x344u); + dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id; + GameUI_InitializeDialogue(&Dst, false); + } + else + { + bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + } + ++curr_seq_num; + v4 = v124; - break; - case EVENT_SetNPCGreeting: - v27 = EVT_DWORD(_evt->v5); - pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; - pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; + //v6 = v123; + //v7 = ""; + break; + case EVENT_ChangeEvent: + v25 = EVT_DWORD(_evt->v5); + if ( v25 ) + { + stru_5E4C90._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; + } + else + { + v26 = (LevelDecoration *)activeLevelDecoration; + stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; + v26->uFlags |= LEVEL_DECORATION_INVISIBLE; + } + ++curr_seq_num; + v4 = v124; + + break; + case EVENT_SetNPCGreeting: + v27 = EVT_DWORD(_evt->v5); + pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; + pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; case EVENT_SetNPCTopic: { //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); @@ -722,381 +722,381 @@ } v4 = v124; break; - case EVENT_NPCSetItem: - sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); - ++curr_seq_num; - v4 = v124; + case EVENT_NPCSetItem: + sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); + ++curr_seq_num; + v4 = v124; - break; - case EVENT_SetActorItem: - Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); - ++curr_seq_num; - v4 = v124; - break; - case EVENT_SetNPCGroupNews: - pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); - ++curr_seq_num; - v4 = v124; - break; - case EVENT_SetActorGroup: - __debugbreak(); - *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - ++curr_seq_num; - v4 = v124; - break; - case EVENT_ChangeGroup: - v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v40 = uNumActors; - __debugbreak(); - if ( (signed int)uNumActors > 0 ) - { - v41 = pActors.data();//[0].uGroup; - do - { - if ( v41->uGroup == v38 ) - v41->uGroup = v39; - ++v41; - --v40; - } - while ( v40 ); - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_ChangeGroupAlly: - v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v44 = uNumActors; - __debugbreak(); - if ( (signed int)uNumActors > 0 ) - { - v45 = pActors.data();//[0].uAlly; - do - { - if ( v45->uGroup == v42 ) - v45->uAlly = v43; - ++v45; - --v44; - } - while ( v44 ); - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_MoveNPC: - { + break; + case EVENT_SetActorItem: + Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); + ++curr_seq_num; + v4 = v124; + break; + case EVENT_SetNPCGroupNews: + pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); + ++curr_seq_num; + v4 = v124; + break; + case EVENT_SetActorGroup: + __debugbreak(); + *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + ++curr_seq_num; + v4 = v124; + break; + case EVENT_ChangeGroup: + v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v40 = uNumActors; + __debugbreak(); + if ( (signed int)uNumActors > 0 ) + { + v41 = pActors.data();//[0].uGroup; + do + { + if ( v41->uGroup == v38 ) + v41->uGroup = v39; + ++v41; + --v40; + } + while ( v40 ); + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_ChangeGroupAlly: + v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v44 = uNumActors; + __debugbreak(); + if ( (signed int)uNumActors > 0 ) + { + v45 = pActors.data();//[0].uAlly; + do + { + if ( v45->uGroup == v42 ) + v45->uAlly = v43; + ++v45; + --v44; + } + while ( v44 ); + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_MoveNPC: + { + + pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9); + if ( window_SpeakInHouse ) + { - pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9); - if ( window_SpeakInHouse ) - { - - if ( window_SpeakInHouse->par1C == 165 ) - { - sub_4BD8B5(); - pVideoPlayer->Unload(); - window_SpeakInHouse->Release(); - pParty->uFlags &= ~2; - activeLevelDecoration = (LevelDecoration*)1; - if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) - { - pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); - window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); - v48 = window_SpeakInHouse->pControlsHead; - if ( v48 ) - { - do - { - v49 = v48->pNext; - pAllocator->FreeChunk(v48); - v48 = v49; - } - while ( v49 ); - } - window_SpeakInHouse->pControlsHead = 0; - window_SpeakInHouse->pControlsTail = 0; - window_SpeakInHouse->uNumControls = 0; - } - } - else - { - if ( window_SpeakInHouse->par1C == 553 ) - pVideoPlayer->bLoopPlaying = 0; - } - } - - } + if ( window_SpeakInHouse->par1C == 165 ) + { + sub_4BD8B5(); + pVideoPlayer->Unload(); + window_SpeakInHouse->Release(); + pParty->uFlags &= ~2; + activeLevelDecoration = (LevelDecoration*)1; + if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) + { + pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); + window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); + v48 = window_SpeakInHouse->pControlsHead; + if ( v48 ) + { + do + { + v49 = v48->pNext; + pAllocator->FreeChunk(v48); + v48 = v49; + } + while ( v49 ); + } + window_SpeakInHouse->pControlsHead = 0; + window_SpeakInHouse->pControlsTail = 0; + window_SpeakInHouse->uNumControls = 0; + } + } + else + { + if ( window_SpeakInHouse->par1C == 553 ) + pVideoPlayer->bLoopPlaying = 0; + } + } + + } ++curr_seq_num; - v4 = v124; + v4 = v124; + + break; + case EVENT_Jmp: + curr_seq_num = _evt->v5 - 1; + ++curr_seq_num; + v4 = -1; - break; - case EVENT_Jmp: - curr_seq_num = _evt->v5 - 1; - ++curr_seq_num; - v4 = -1; + break; + case EVENT_ShowFace: + if ( _evt->v5 <= 3u ) //someone + pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); + else if ( _evt->v5 == 4 ) //active + pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); + else if ( _evt->v5 == 5 ) //all players + { + for(int i=0; i<4; ++i) + pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); + } + else //random player + pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); + ++curr_seq_num; + v4 = v124; - break; - case EVENT_ShowFace: - if ( _evt->v5 <= 3u ) //someone - pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); - else if ( _evt->v5 == 4 ) //active - pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); - else if ( _evt->v5 == 5 ) //all players - { - for(int i=0; i<4; ++i) - pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); - } - else //random player - pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); - ++curr_seq_num; - v4 = v124; + break; + case EVENT_CharacterAnimation: + if ( _evt->v5 <= 3u ) //someone + pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); + else if ( _evt->v5 == 4 ) //active + pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); + else if ( _evt->v5 == 5 ) //all + for(int i=0; i<4; ++i) + pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); + else //random + pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); + ++curr_seq_num; + v4 = v124; - break; - case EVENT_CharacterAnimation: - if ( _evt->v5 <= 3u ) //someone - pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); - else if ( _evt->v5 == 4 ) //active - pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); - else if ( _evt->v5 == 5 ) //all - for(int i=0; i<4; ++i) - pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); - else //random - pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); - ++curr_seq_num; - v4 = v124; + break; + case EVENT_ForPartyMember: + player_choose = _evt->v5; + ++curr_seq_num; + v4 = v124; + break; + case EVENT_SummonItem: + sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), + _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), + _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), + _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), + _evt->v25, _evt->v26, 0, 0); + ++curr_seq_num; + v4 = v124; - break; - case EVENT_ForPartyMember: - player_choose = _evt->v5; - ++curr_seq_num; - v4 = v124; - break; - case EVENT_SummonItem: - sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), - _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), - _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), - _evt->v25, _evt->v26, 0, 0); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_Compare: - pValue = EVT_DWORD(_evt->v7); - if ( player_choose <= 3 ) - { - if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) - { - v124 = -1; - curr_seq_num = _evt->v11 - 1; - } - } - else if ( player_choose == 4 ) //active - { - if ( uActiveCharacter ) - { - if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) - { - v124 = -1; - curr_seq_num = _evt->v11 - 1; - } - } - } - else if ( player_choose == 5 )//all - { - v130=0; - for(int i = 1; i < 5; ++i) - { - if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) - { - v124 = -1; - curr_seq_num = _evt->v11 - 1; - break; - } - ++v130; - } - } - else if ( player_choose == 6 ) //random - { - if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) - { - v124 = -1; - curr_seq_num = _evt->v11 - 1; - } - } - ++curr_seq_num; - v4 = v124; - break; - case EVENT_IsActorAlive: - if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) - { - v124 = -1; - curr_seq_num = _evt->v11 - 1; - } - ++curr_seq_num; - v4 = v124; - break; - case EVENT_Substract: - pValue = EVT_DWORD(_evt->v7); - if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) - { - if ( pParty->pPickedItem.uItemID == pValue )//In hand - { - pMouse->RemoveHoldingItem(); - ++curr_seq_num; - v4 = v124; - break; - } - v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; - for ( v65 = 0; v65 < 126; ++v65 ) - { - if ( (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v67] == pValue ) - { - pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); - ++curr_seq_num; - v4 = v124; - break; - } - v67 += 4; - } - while ( (signed int)v65 < 126 ); - v69 = (int)&pPlayers[uActiveCharacter]->pEquipment; - for ( v68 = 0; v68 < 16; ++v68 ) - { - if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v69] == pValue ) - { - *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v68) = 0; - ++curr_seq_num; - v4 = v124; - break; - } - v69 += 4; - } - for (int i = 1; i < 5; i++) - { - v72 = (int)pPlayers[i]->pInventoryMatrix; - for ( int v71 = 0; v71 < 126; ++v71 ) - { - if ( (int)&pPlayers[i]->pInventoryItemList[v72] == pValue ) - { - pPlayers[i]->RemoveItemAtInventoryIndex(v71); - break; - } - v72 += 4; - } - v73 = 0; - v74 = (int)&pPlayers[i]->pEquipment; - while ( !*(int *)v74 || (int)&pPlayer->pInventoryItemList[v74] != pValue ) - { - ++v73; - v74 += 4; - if ( v73 >= 16 ) - break; - } - *(&pPlayers[i]->pEquipment.uShield + v73) = 0; - } - } - if ( player_choose <= 3 ) - { - pPlayer = &pParty->pPlayers[player_choose]; - pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - else if ( player_choose == 4 ) //active - { - if ( uActiveCharacter ) - { - pPlayer = pPlayers[uActiveCharacter]; - pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - } - else if ( player_choose == 5 )//all - { - v130 = 0; - for(int i = 1; i < 5; ++i) - { - if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) - break; - } - ++v130; - } - else if ( player_choose == 6 ) //random - { - player_choose = rand() % 4; - pPlayer = &pParty->pPlayers[player_choose]; - pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - ++curr_seq_num; - v4 = v124; - break; - case EVENT_Set: - pValue = EVT_DWORD(_evt->v7); - if ( player_choose <= 3 ) - { - pPlayer = &pParty->pPlayers[player_choose]; - pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - else if ( player_choose == 4 ) //active - { - if ( uActiveCharacter ) - { - pPlayer = pPlayers[uActiveCharacter]; - pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - } - else if ( player_choose == 5 )//all - { + //v6 = v123; + //v7 = ""; + break; + case EVENT_Compare: + pValue = EVT_DWORD(_evt->v7); + if ( player_choose <= 3 ) + { + if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) + { + v124 = -1; + curr_seq_num = _evt->v11 - 1; + } + } + else if ( player_choose == 4 ) //active + { + if ( uActiveCharacter ) + { + if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) + { + v124 = -1; + curr_seq_num = _evt->v11 - 1; + } + } + } + else if ( player_choose == 5 )//all + { + v130=0; + for(int i = 1; i < 5; ++i) + { + if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) + { + v124 = -1; + curr_seq_num = _evt->v11 - 1; + break; + } + ++v130; + } + } + else if ( player_choose == 6 ) //random + { + if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) + { + v124 = -1; + curr_seq_num = _evt->v11 - 1; + } + } + ++curr_seq_num; + v4 = v124; + break; + case EVENT_IsActorAlive: + if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) + { + v124 = -1; + curr_seq_num = _evt->v11 - 1; + } + ++curr_seq_num; + v4 = v124; + break; + case EVENT_Substract: + pValue = EVT_DWORD(_evt->v7); + if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) + { + if ( pParty->pPickedItem.uItemID == pValue )//In hand + { + pMouse->RemoveHoldingItem(); + ++curr_seq_num; + v4 = v124; + break; + } + v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; + for ( v65 = 0; v65 < 126; ++v65 ) + { + if ( (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v67] == pValue ) + { + pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); + ++curr_seq_num; + v4 = v124; + break; + } + v67 += 4; + } + while ( (signed int)v65 < 126 ); + v69 = (int)&pPlayers[uActiveCharacter]->pEquipment; + for ( v68 = 0; v68 < 16; ++v68 ) + { + if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v69] == pValue ) + { + *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v68) = 0; + ++curr_seq_num; + v4 = v124; + break; + } + v69 += 4; + } + for (int i = 1; i < 5; i++) + { + v72 = (int)pPlayers[i]->pInventoryMatrix; + for ( int v71 = 0; v71 < 126; ++v71 ) + { + if ( (int)&pPlayers[i]->pInventoryItemList[v72] == pValue ) + { + pPlayers[i]->RemoveItemAtInventoryIndex(v71); + break; + } + v72 += 4; + } + v73 = 0; + v74 = (int)&pPlayers[i]->pEquipment; + while ( !*(int *)v74 || (int)&pPlayer->pInventoryItemList[v74] != pValue ) + { + ++v73; + v74 += 4; + if ( v73 >= 16 ) + break; + } + *(&pPlayers[i]->pEquipment.uShield + v73) = 0; + } + } + if ( player_choose <= 3 ) + { + pPlayer = &pParty->pPlayers[player_choose]; + pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } + else if ( player_choose == 4 ) //active + { + if ( uActiveCharacter ) + { + pPlayer = pPlayers[uActiveCharacter]; + pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } + } + else if ( player_choose == 5 )//all + { + v130 = 0; + for(int i = 1; i < 5; ++i) + { + if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) + break; + } + ++v130; + } + else if ( player_choose == 6 ) //random + { + player_choose = rand() % 4; + pPlayer = &pParty->pPlayers[player_choose]; + pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } + ++curr_seq_num; + v4 = v124; + break; + case EVENT_Set: + pValue = EVT_DWORD(_evt->v7); + if ( player_choose <= 3 ) + { + pPlayer = &pParty->pPlayers[player_choose]; + pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } + else if ( player_choose == 4 ) //active + { + if ( uActiveCharacter ) + { + pPlayer = pPlayers[uActiveCharacter]; + pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } + } + else if ( player_choose == 5 )//all + { //recheck v130 - for(int i = 1; i < 5; ++i) - pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + for(int i = 1; i < 5; ++i) + pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - else if ( player_choose == 6 ) //random - { - player_choose = rand() % 4; - pPlayer = &pParty->pPlayers[player_choose]; - pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } + else if ( player_choose == 6 ) //random + { + player_choose = rand() % 4; + pPlayer = &pParty->pPlayers[player_choose]; + pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } + } ++curr_seq_num; v4 = v124; break; - case EVENT_Add: - pValue = EVT_DWORD(_evt->v7); - if ( player_choose <= 3 ) - { - pPlayer = &pParty->pPlayers[player_choose]; - pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - else if ( player_choose == 4 ) //active - { - if ( uActiveCharacter ) - { - pPlayer = pPlayers[uActiveCharacter]; - pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - } - else if ( player_choose == 5 )//all - { - //v130 = 0; - for(int i = 1; i < 5; ++i) - pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + case EVENT_Add: + pValue = EVT_DWORD(_evt->v7); + if ( player_choose <= 3 ) + { + pPlayer = &pParty->pPlayers[player_choose]; + pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } + else if ( player_choose == 4 ) //active + { + if ( uActiveCharacter ) + { + pPlayer = pPlayers[uActiveCharacter]; + pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } + } + else if ( player_choose == 5 )//all + { + //v130 = 0; + for(int i = 1; i < 5; ++i) + pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } - else if ( player_choose == 6 ) //random - { - player_choose = rand() % 4; - pPlayer = &pParty->pPlayers[player_choose]; - pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); - } + } + else if ( player_choose == 6 ) //random + { + player_choose = rand() % 4; + pPlayer = &pParty->pPlayers[player_choose]; + pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); + } v83 = EVT_WORD(_evt->v5); if (v83 == 21 || // gold well on emerald isle v83 == 22 || v83 == 23 || v83 == 24 ) @@ -1107,432 +1107,432 @@ ++curr_seq_num; v4 = v124; break; - case EVENT_InputString: - if ( !entry_line ) - { - strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); - v105 = curr_seq_num; - v121 = 26; + case EVENT_InputString: + if ( !entry_line ) + { + strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); + v105 = curr_seq_num; + v121 = 26; LABEL_295: - sub_4451A8_press_any_key(uEventID, v105, v121); + sub_4451A8_press_any_key(uEventID, v105, v121); LABEL_301: - if ( v133 == 1 ) - OnMapLeave(); - return; - } - v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); - if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) - || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) ) - { - v11 = _evt->v17; + if ( v133 == 1 ) + OnMapLeave(); + return; + } + v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); + if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) + || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) ) + { + v11 = _evt->v17; LABEL_130: - //v124 = -1; + //v124 = -1; LABEL_131: - curr_seq_num = v11 - 1; - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_RandomGoTo: - //v124 = -1; - v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) - + (_evt->v10 != 0))); + curr_seq_num = v11 - 1; + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_RandomGoTo: + //v124 = -1; + v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) + + (_evt->v10 != 0))); curr_seq_num = v11 - 1; ++curr_seq_num; v4 = v124; break; - case EVENT_ReceiveDamage: - v85 = EVT_DWORD(_evt->v7 ); - v86 = _evt->v5; - if ( (unsigned __int8)v86 <= 3 ) - { - v119 = _evt->v6; - v115 = EVT_DWORD(_evt->v7 ); - v89 = (unsigned __int8)v86; - v88 = &pParty->pPlayers[v89]; - v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); - ++curr_seq_num; - v4 = v124; - break; - } - if ( v86 == 4 ) - { - if ( !uActiveCharacter ) - { - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - } - v119 = _evt->v6; - v88 = pPlayers[uActiveCharacter]; - v115 = EVT_DWORD(_evt->v7 ); - v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); - ++curr_seq_num; - v4 = v124; - break; - } - if ( v86 != 5 ) - { - v119 = _evt->v6; - v115 = EVT_DWORD(_evt->v7 ); - v89 = rand() % 4; - v88 = &pParty->pPlayers[v89]; - v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - } - v87 = pParty->pPlayers; - do - { - v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6); - ++v87; - } - while ( (signed int)v87 < (signed int)pParty->pHirelings ); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_ToggleIndoorLight: - pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetFacesBit: - sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_ToggleChestFlag: - Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_ToggleActorFlag: - Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_ToggleActorGroupFlag: - ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetSnow: - if ( !_evt->v5 ) - pWeather->bRenderSnow = _evt->v6 != 0; - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_StatusText: - v90 = EVT_DWORD(_evt->v5 ); - if ( activeLevelDecoration ) - { - if ( activeLevelDecoration == (LevelDecoration*)1 ) - { - current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; - } - if ( canShowMessages == 1 ) - { - v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; - //LABEL_248: - ShowStatusBarString(v91, 2u); - } - } - else - { - if ( canShowMessages == 1 ) - { - v91 = &pLevelStr[pLevelStrOffsets[v90]]; - ShowStatusBarString(v91, 2u); - } - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_ShowMessage: - v92 = EVT_DWORD(_evt->v5 ); - if ( activeLevelDecoration ) - { - v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; - byte_5B0938[0] = 0; - current_npc_text = v93; - } - else - { - strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]); - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_CastSpell: + case EVENT_ReceiveDamage: + v85 = EVT_DWORD(_evt->v7 ); + v86 = _evt->v5; + if ( (unsigned __int8)v86 <= 3 ) + { + v119 = _evt->v6; + v115 = EVT_DWORD(_evt->v7 ); + v89 = (unsigned __int8)v86; + v88 = &pParty->pPlayers[v89]; + v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); + ++curr_seq_num; + v4 = v124; + break; + } + if ( v86 == 4 ) + { + if ( !uActiveCharacter ) + { + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + } + v119 = _evt->v6; + v88 = pPlayers[uActiveCharacter]; + v115 = EVT_DWORD(_evt->v7 ); + v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); + ++curr_seq_num; + v4 = v124; + break; + } + if ( v86 != 5 ) + { + v119 = _evt->v6; + v115 = EVT_DWORD(_evt->v7 ); + v89 = rand() % 4; + v88 = &pParty->pPlayers[v89]; + v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + } + v87 = pParty->pPlayers; + do + { + v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6); + ++v87; + } + while ( (signed int)v87 < (signed int)pParty->pHirelings ); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_ToggleIndoorLight: + pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetFacesBit: + sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_ToggleChestFlag: + Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_ToggleActorFlag: + Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_ToggleActorGroupFlag: + ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetSnow: + if ( !_evt->v5 ) + pWeather->bRenderSnow = _evt->v6 != 0; + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_StatusText: + v90 = EVT_DWORD(_evt->v5 ); + if ( activeLevelDecoration ) + { + if ( activeLevelDecoration == (LevelDecoration*)1 ) + { + current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; + } + if ( canShowMessages == 1 ) + { + v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; + //LABEL_248: + ShowStatusBarString(v91, 2u); + } + } + else + { + if ( canShowMessages == 1 ) + { + v91 = &pLevelStr[pLevelStrOffsets[v90]]; + ShowStatusBarString(v91, 2u); + } + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_ShowMessage: + v92 = EVT_DWORD(_evt->v5 ); + if ( activeLevelDecoration ) + { + v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; + byte_5B0938[0] = 0; + current_npc_text = v93; + } + else + { + strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]); + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_CastSpell: EventCastSpell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 )); ++curr_seq_num; v4 = v124; break; - case EVENT_SetTexture: - sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_SetSprite: - SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_SummonMonsters: - sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ), + case EVENT_SetTexture: + sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_SetSprite: + SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_SummonMonsters: + sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ), EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), EVT_DWORD(_evt->v24 )); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_MouseOver: - case EVENT_LocationName: - --curr_seq_num; - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_ChangeDoorState: - sub_449A49_door_switch_animation(_evt->v5, _evt->v6); - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_OpenChest: - if ( !Chest::Open(_evt->v5) ) - goto LABEL_301; - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_MoveToMap: - v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); - v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); - v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); - v96 = _evt->v25; - v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); - v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); - if ( _evt->v29 || _evt->v30 ) - { - if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) - pRenderer->_49FD3A(); - TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); - dword_5C3418 = uEventID; - dword_5C341C = curr_seq_num + 1; - goto LABEL_301; - } - _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - _5B65A8_npcdata_uflags_or_other = v94; - _5B65B0_npcdata_rep_or_other = v126; - if ( v129 == -1 ) - { - v98 = _5B65B4_npcdata_loword_house_or_other; - } - else - { - v98 = v129 & stru_5C6E00->uDoublePiMask; - _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; - } - v99 = (char *)&_evt->v31; - _5B65B8_npcdata_hiword_house_or_other = v95; - dword_5B65BC = v97; - v100 = v94 | v132 | v126 | v95 | v97 | v98; - dword_5B65C0 = v100; - if ( *v99 == 48 ) - { - if ( v100 ) - { - pParty->vPosition.x = v135; - pParty->vPosition.y = v132; - pParty->vPosition.z = v126; - pParty->uFallStartY = v126; - if ( _5B65B4_npcdata_loword_house_or_other != -1 ) - pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; - _5B65B4_npcdata_loword_house_or_other = -1; - v120 = 0; - v116 = 0; - v111 = 0; - v110 = 0; - v109 = -1; - v108 = 0; - v107 = 0; - pParty->sRotationX = v95; - pParty->uFallSpeed = v134; - dword_5B65C0 = 0; - dword_5B65BC = 0; - _5B65B8_npcdata_hiword_house_or_other = 0; - _5B65B0_npcdata_rep_or_other = 0; - _5B65AC_npcdata_fame_or_other = 0; - _5B65A8_npcdata_uflags_or_other = 0; - v106 = 232; + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_MouseOver: + case EVENT_LocationName: + --curr_seq_num; + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_ChangeDoorState: + sub_449A49_door_switch_animation(_evt->v5, _evt->v6); + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_OpenChest: + if ( !Chest::Open(_evt->v5) ) + goto LABEL_301; + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_MoveToMap: + v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); + v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); + v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); + v96 = _evt->v25; + v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); + v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); + if ( _evt->v29 || _evt->v30 ) + { + if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) + pRenderer->_49FD3A(); + TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); + dword_5C3418 = uEventID; + dword_5C341C = curr_seq_num + 1; + goto LABEL_301; + } + _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + _5B65A8_npcdata_uflags_or_other = v94; + _5B65B0_npcdata_rep_or_other = v126; + if ( v129 == -1 ) + { + v98 = _5B65B4_npcdata_loword_house_or_other; + } + else + { + v98 = v129 & stru_5C6E00->uDoublePiMask; + _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; + } + v99 = (char *)&_evt->v31; + _5B65B8_npcdata_hiword_house_or_other = v95; + dword_5B65BC = v97; + v100 = v94 | v132 | v126 | v95 | v97 | v98; + dword_5B65C0 = v100; + if ( *v99 == 48 ) + { + if ( v100 ) + { + pParty->vPosition.x = v135; + pParty->vPosition.y = v132; + pParty->vPosition.z = v126; + pParty->uFallStartY = v126; + if ( _5B65B4_npcdata_loword_house_or_other != -1 ) + pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; + _5B65B4_npcdata_loword_house_or_other = -1; + v120 = 0; + v116 = 0; + v111 = 0; + v110 = 0; + v109 = -1; + v108 = 0; + v107 = 0; + pParty->sRotationX = v95; + pParty->uFallSpeed = v134; + dword_5B65C0 = 0; + dword_5B65BC = 0; + _5B65B8_npcdata_hiword_house_or_other = 0; + _5B65B0_npcdata_rep_or_other = 0; + _5B65AC_npcdata_fame_or_other = 0; + _5B65A8_npcdata_uflags_or_other = 0; + v106 = 232; LABEL_280: - pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); - } - } - else - { - pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); - sub_44987B(v99, MapStartPoint_Party); - v133 = 1; - if ( pCurrentScreen == SCREEN_HOUSE ) - { - if ( uGameState == GAME_STATE_2 ) - { - pAudioPlayer->StopChannels(-1, -1); - dialog_menu_id = HOUSE_DIALOGUE_NULL; - while ( sub_4BD8B5() ) - ; - pVideoPlayer->Unload(); - window_SpeakInHouse->Release(); - window_SpeakInHouse = 0; - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = 1; - pDialogueNPCCount = 0; - pDialogueWindow->Release(); - dialog_menu_id = HOUSE_DIALOGUE_NULL; - pDialogueWindow = 0; - pIcons_LOD->SyncLoadedFilesCount(); - } - OnMapLeave(); - return; - } - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_PlaySound: - v120 = 0; - v116 = 0; - v111 = 0; - v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); - v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - v108 = 0; - v107 = 0; - v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - goto LABEL_280; - case EVENT_GiveItem: - item.Reset(); - //v101 = &pSomeEVT[v9]; - v102 = _evt->v7 - + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); - pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); - if ( v102 ) - item.uItemID = v102; - pParty->SetHoldingItem(&item); - ++curr_seq_num; - v4 = v124; - //v6 = v123; - //v7 = ""; - break; - case EVENT_SpeakInHouse: - if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) - { - if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) - pRenderer->_49FD3A(); - pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); - pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); - v104 = 187; - if ( uCurrentHouse_Animation != 167 ) - v104 = EVT_DWORD(_evt->v5); - window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); - window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); - } - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - case EVENT_PressAnyKey: - v121 = 33; - v105 = curr_seq_num + 1; - goto LABEL_295; - case EVENT_Exit: - if ( v133 == 1 ) - OnMapLeave(); - return; - default: - ++curr_seq_num; - v4 = v124; - - //v6 = v123; - //v7 = ""; - break; - } - } - ++v4; - v124 = v4; - if ( v4 >= uSomeEVT_NumEvents ) - goto LABEL_301; - //} - } - } + pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); + } + } + else + { + pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); + sub_44987B(v99, MapStartPoint_Party); + v133 = 1; + if ( pCurrentScreen == SCREEN_HOUSE ) + { + if ( uGameState == GAME_STATE_2 ) + { + pAudioPlayer->StopChannels(-1, -1); + dialog_menu_id = HOUSE_DIALOGUE_NULL; + while ( sub_4BD8B5() ) + ; + pVideoPlayer->Unload(); + window_SpeakInHouse->Release(); + window_SpeakInHouse = 0; + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + pDialogueNPCCount = 0; + pDialogueWindow->Release(); + dialog_menu_id = HOUSE_DIALOGUE_NULL; + pDialogueWindow = 0; + pIcons_LOD->SyncLoadedFilesCount(); + } + OnMapLeave(); + return; + } + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_PlaySound: + v120 = 0; + v116 = 0; + v111 = 0; + v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); + v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); + v108 = 0; + v107 = 0; + v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); + goto LABEL_280; + case EVENT_GiveItem: + item.Reset(); + //v101 = &pSomeEVT[v9]; + v102 = _evt->v7 + + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); + if ( v102 ) + item.uItemID = v102; + pParty->SetHoldingItem(&item); + ++curr_seq_num; + v4 = v124; + //v6 = v123; + //v7 = ""; + break; + case EVENT_SpeakInHouse: + if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) + { + if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) + pRenderer->_49FD3A(); + pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); + v104 = 187; + if ( uCurrentHouse_Animation != 167 ) + v104 = EVT_DWORD(_evt->v5); + window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); + window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); + } + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + case EVENT_PressAnyKey: + v121 = 33; + v105 = curr_seq_num + 1; + goto LABEL_295; + case EVENT_Exit: + if ( v133 == 1 ) + OnMapLeave(); + return; + default: + ++curr_seq_num; + v4 = v124; + + //v6 = v123; + //v7 = ""; + break; + } + } + ++v4; + v124 = v4; + if ( v4 >= uSomeEVT_NumEvents ) + goto LABEL_301; + //} + } + } //----- (00444732) -------------------------------------------------------- char *GetEventHintString(unsigned int uEventID) @@ -1548,14 +1548,14 @@ event_index = 0; if ( uLevelEVT_NumEvents <= 0 ) return NULL; - + //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; while ( 1 ) { if ( pLevelEVT_Index[event_index].uEventID == uEventID ) { - test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; - last_evt=test_evt; + test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; + last_evt=test_evt; event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; if ( test_evt->_e_type == EVENT_MouseOver ) break; @@ -1564,7 +1564,7 @@ if ( event_index >= uLevelEVT_NumEvents ) return NULL; } - test_evt=(_evt_raw*)&pLevelEVT[event_pos]; + test_evt=(_evt_raw*)&pLevelEVT[event_pos]; if ( test_evt->_e_type== EVENT_SpeakInHouse ) { str_index = EVT_DWORD(test_evt->v5); @@ -1575,7 +1575,7 @@ for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) { event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; - test_evt=(_evt_raw*)&pLevelEVT[event_pos]; + test_evt=(_evt_raw*)&pLevelEVT[event_pos]; if ( test_evt->_e_type == EVENT_SpeakInHouse ) { str_index = EVT_DWORD(test_evt->v5); @@ -1585,6 +1585,6 @@ } result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; } - + return result; }
--- a/GUIWindow.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/GUIWindow.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -911,7 +911,7 @@ pDialogWindow.uFrameZ = 457; pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &pDialogWindow, 13, 0); v6 = pTextHeight + 7; - pRenderer->_4A6A68(8, 352 - (pTextHeight + 7), &pIcons_LOD->pTextures[uTextureID_Leather], + pRenderer->GetLeather(8, 352 - (pTextHeight + 7), &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (pTextHeight + 7)); pRenderer->DrawTextureIndexed(8, 347 - v6, pTexture_591428); v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0);
--- a/Indoor.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/Indoor.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -2245,7 +2245,7 @@ for (uint i = 0; i < uNumLevelDecorations; ++i) { - memcpy(&pLevelDecorations[i].field_2, pData, 2); + memcpy(&pLevelDecorations[i].uFlags, pData, 2); pData += 2; } @@ -3868,7 +3868,7 @@ _6807B8_level_decorations_ids[v16] = i; } - if ( !(pDecortaion->field_2 & 0x20) ) + if (!(pDecortaion->uFlags & LEVEL_DECORATION_INVISIBLE)) { v17 = &pDecorationList->pDecorations[pDecortaion->uDecorationDescID]; if (!v17->DontDraw()) @@ -3908,7 +3908,7 @@ v22 = stru_5E4C90._decor_events[v21 + 74 - 75]; v35 = v21; if ( !v22 ) - pDecortaion->field_2 |= 0x20; + pDecortaion->uFlags |= LEVEL_DECORATION_INVISIBLE; } } } @@ -4397,7 +4397,7 @@ { v20 = &pActors[ai_near_actors_ids[v18]]; if ( v20->uAttributes & 0x8000 - || (v21 = sub_4070EF_prolly_collide_objects(PID(OBJECT_Actor,ai_near_actors_ids[v18]), 4u), v18 = i, v21) ) + || (v21 = sub_4070EF_prolly_detect_player(PID(OBJECT_Actor,ai_near_actors_ids[v18]), 4u), v18 = i, v21) ) { v22 = ai_near_actors_ids[v18]; v20->uAttributes |= 0x8000u; @@ -4984,7 +4984,7 @@ //v26 = uDecorationID; //LODWORD(v31) = uSectorID; v2 = &pLevelDecorations[uDecorationID]; - if (v2->field_2 & 0x20) + if (v2->uFlags & LEVEL_DECORATION_INVISIBLE) return; v3 = &pDecorationList->pDecorations[v2->uDecorationDescID]; @@ -6159,7 +6159,7 @@ if ( v9 ) { EventProcessor(v9, a1, 1); - LOBYTE(v8->field_2) |= 8u; + v8->uFlags |= LEVEL_DECORATION_VISIBLE_ON_MAP; } else {
--- a/Level/Decoration.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/Level/Decoration.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -1,39 +1,28 @@ -#include <assert.h> - #include "Decoration.h" #include "../Party.h" -#include "../mm7_data.h" // for _449B57_test_bit //----- (004583B0) -------------------------------------------------------- LevelDecoration::LevelDecoration() { - this->field_1A = 0; - this->field_18 = 0; - this->vPosition.z = 0; - this->vPosition.y = 0; - this->vPosition.x = 0; - this->uDecorationDescID = 0; - this->field_2 = 0; - this->field_16_event_id = 0; - this->uCog = 0; + memset(this, 0, sizeof(this)); } //----- (00450929) -------------------------------------------------------- int LevelDecoration::GetGlobalEvent() { - LevelDecoration *v1; // esi@1 - signed int v2; // eax@1 - int v3; // eax@5 - int v4; // eax@6 - int v5; // eax@7 - int v6; // eax@8 - int v7; // eax@9 - int result; // eax@14 - int v9; // eax@18 - int v10; // eax@19 - int v11; // eax@20 - int v12; // eax@21 - int v13; // eax@22 + //LevelDecoration *v1; // esi@1 + //signed int v2; // eax@1 + //int v3; // eax@5 + //int v4; // eax@6 + //int v5; // eax@7 + //int v6; // eax@8 + //int v7; // eax@9 + //int result; // eax@14 + //int v9; // eax@18 + //int v10; // eax@19 + //int v11; // eax@20 + //int v12; // eax@21 + //int v13; // eax@22 switch (uDecorationDescID) { @@ -100,18 +89,18 @@ case 207: return 169 + rand() % 7; // dec61 case 208: return 176 + rand() % 7; // dec62 case 209: return 183 + rand() % 7; // dec63 - case 210: return 150; // dec64 "Magic Pedistal" - case 211: return 151; // dec65 "Magic Pedistal" - case 212: return 152; // dec66 "Magic Pedistal" - case 213: return 153; // dec67 "Magic Pedistal" - case 214: return 154; // dec68 "Magic Pedistal" - case 215: return 155; // dec69 "Magic Pedistal" - case 216: return 156; // dec70 "Magic Pedistal" - case 217: return 157; // dec71 "Magic Pedistal" - case 218: return 158; // dec72 "Magic Pedistal" - case 219: return 159; // dec73 "Magic Pedistal" - case 220: return 160; // dec74 "Magic Pedistal" - case 221: return 161; // dec75 "Magic Pedistal" + case 210: return 150; // dec64 "Magic pedestal" + case 211: return 151; // dec65 "Magic pedestal" + case 212: return 152; // dec66 "Magic pedestal" + case 213: return 153; // dec67 "Magic pedestal" + case 214: return 154; // dec68 "Magic pedestal" + case 215: return 155; // dec69 "Magic pedestal" + case 216: return 156; // dec70 "Magic pedestal" + case 217: return 157; // dec71 "Magic pedestal" + case 218: return 158; // dec72 "Magic pedestal" + case 219: return 159; // dec73 "Magic pedestal" + case 220: return 160; // dec74 "Magic pedestal" + case 221: return 161; // dec75 "Magic pedestal" case 222: case 223: case 224: case 225: case 226: case 227: @@ -122,33 +111,37 @@ } //----- (0047A825) -------------------------------------------------------- -bool LevelDecoration::_47A825() +bool LevelDecoration::IsObeliskChestActive() { //bool v1; // ebx@1 //LevelDecoration *v2; // edi@1 + static const std::array<const PARTY_QUEST_BITS, 14> aObeliskQuests = { + PARTY_QUEST_OBELISK_HARMONDALE, + PARTY_QUEST_OBELISK_ERATHIA, + PARTY_QUEST_OBELISK_TULAREAN_FOREST, + PARTY_QUEST_OBELISK_DEYJA, + PARTY_QUEST_OBELISK_BRACADA_DESERT, + PARTY_QUEST_OBELISK_CELESTE, + PARTY_QUEST_OBELISK_THE_PIT, + PARTY_QUEST_OBELISK_EVENMORN_ISLAND, + PARTY_QUEST_OBELISK_MOUNT_NIGHON, + PARTY_QUEST_OBELISK_BARROW_DOWNS, + PARTY_QUEST_OBELISK_LAND_OF_THE_GIANTS, + PARTY_QUEST_OBELISK_TATALIA, + PARTY_QUEST_OBELISK_AVLEE, + PARTY_QUEST_OBELISK_STONE_CITY + }; + if (pParty->uCurrentHour == 0 - && !_449B57_test_bit(pParty->_quest_bits, 178) - && _449B57_test_bit(pParty->_quest_bits, 164) - && _449B57_test_bit(pParty->_quest_bits, 165) - && _449B57_test_bit(pParty->_quest_bits, 166) - && _449B57_test_bit(pParty->_quest_bits, 167) - && _449B57_test_bit(pParty->_quest_bits, 168) - && _449B57_test_bit(pParty->_quest_bits, 169) - && _449B57_test_bit(pParty->_quest_bits, 170) - && _449B57_test_bit(pParty->_quest_bits, 171) - && _449B57_test_bit(pParty->_quest_bits, 172) - && _449B57_test_bit(pParty->_quest_bits, 173) - && _449B57_test_bit(pParty->_quest_bits, 174) - && _449B57_test_bit(pParty->_quest_bits, 175) - && _449B57_test_bit(pParty->_quest_bits, 176) - && _449B57_test_bit(pParty->_quest_bits, 177)) + && !TestPartyQuestBit(PARTY_QUEST_OBELISK_TREASURE_FOUND) + && std::all_of(aObeliskQuests.begin(), aObeliskQuests.end(), TestPartyQuestBit)) { - this->field_2 &= ~LEVEL_DECORATION_INVISIBLE; + this->uFlags &= ~LEVEL_DECORATION_INVISIBLE; return true; } - this->field_2 |= LEVEL_DECORATION_INVISIBLE; + this->uFlags |= LEVEL_DECORATION_INVISIBLE; return false; } @@ -172,7 +165,7 @@ if (uDecorationDescID >= 206 && uDecorationDescID <= 209) // lighthouse fire return true; - if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedistal + if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedestal return true; return false;
--- a/Level/Decoration.h Mon Sep 02 12:03:25 2013 +0600 +++ b/Level/Decoration.h Mon Sep 02 12:03:40 2013 +0600 @@ -1,8 +1,8 @@ #pragma once -#include "../VectorTypes.h" +#include "../mm7_data.h" -enum LEVEL_DECORATION_FLAGS +enum LEVEL_DECORATION_FLAGS: uint16 { LEVEL_DECORATION_TRIGGERED_BY_TOUCH = 0x01, LEVEL_DECORATION_TRIGGERED_BY_MONSTER = 0x02, @@ -20,18 +20,17 @@ LevelDecoration(); int GetGlobalEvent(); bool IsInteractive(); - bool _47A825(); - + bool IsObeliskChestActive(); - unsigned __int16 uDecorationDescID; - __int16 field_2; - struct Vec3_int_ vPosition; - int field_10_y_rot; - __int16 uCog; - __int16 field_16_event_id; - __int16 field_18; - __int16 field_1A; - __int16 _idx_in_stru123; - __int16 field_1E; + uint16 uDecorationDescID; + uint16 uFlags; + Vec3_int_ vPosition; + int32 field_10_y_rot; + uint16 uCog; + int16 field_16_event_id; + int16 field_18; + int16 field_1A; + int16 _idx_in_stru123; + int16 field_1E; }; #pragma pack(pop)
--- a/Outdoor.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/Outdoor.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -2271,7 +2271,7 @@ //thisa = (int)&pLevelDecorations[0].field_2; //do //{ - memcpy(&pLevelDecorations[i].field_2, pSrc, 2); + memcpy(&pLevelDecorations[i].uFlags, pSrc, 2); pSrc += 2; //thisa += 32; //v85 = (char *)v85 + 2; @@ -2717,7 +2717,7 @@ _6807B8_level_decorations_ids[v5] = i; } if ( v8 && decor->uCog == 20 ) - decor->field_2 |= 0x0040u; + decor->uFlags |= LEVEL_DECORATION_OBELISK_CHEST; if ( !decor->field_16_event_id ) { if ( decor->IsInteractive() ) @@ -2727,7 +2727,7 @@ v6 = v1 + 75; decor->_idx_in_stru123 = v6; if ( !stru_5E4C90._decor_events[v1++] ) - decor->field_2 |= 0x0020u; + decor->uFlags |= LEVEL_DECORATION_INVISIBLE; } } }
--- a/Party.h Mon Sep 02 12:03:25 2013 +0600 +++ b/Party.h Mon Sep 02 12:03:40 2013 +0600 @@ -1,13 +1,13 @@ #pragma once #include "Player.h" #include "NPC.h" -#include "VectorTypes.h" +#include "mm7_data.h" #define PARTY_AUTONOTES_BIT__EMERALD_FIRE_FOUNTAIN 2 -enum PARTY_QUEST_BITS: unsigned __int32 +enum PARTY_QUEST_BITS: uint16 { PARTY_QUEST_EMERALD_RED_POTION_ACTIVE = 1, PARTY_QUEST_EMERALD_SEASHELL_ACTIVE = 2, @@ -20,6 +20,24 @@ PARTY_QUEST_EVENMORN_MAP_FOUND = 64, PARTY_QUEST_FINISHED_EMERALD_ISLE = 136, + + PARTY_QUEST_OBELISK_HARMONDALE = 164, + PARTY_QUEST_OBELISK_ERATHIA = 165, + PARTY_QUEST_OBELISK_TULAREAN_FOREST = 166, + PARTY_QUEST_OBELISK_DEYJA = 167, + PARTY_QUEST_OBELISK_BRACADA_DESERT = 168, + PARTY_QUEST_OBELISK_CELESTE = 169, + PARTY_QUEST_OBELISK_THE_PIT = 170, + PARTY_QUEST_OBELISK_EVENMORN_ISLAND = 171, + PARTY_QUEST_OBELISK_MOUNT_NIGHON = 172, + PARTY_QUEST_OBELISK_BARROW_DOWNS = 173, + PARTY_QUEST_OBELISK_LAND_OF_THE_GIANTS = 174, + PARTY_QUEST_OBELISK_TATALIA = 175, + PARTY_QUEST_OBELISK_AVLEE = 176, + PARTY_QUEST_OBELISK_STONE_CITY = 177, + + PARTY_QUEST_OBELISK_TREASURE_FOUND = 178, + PARTY_QUEST_FOUNTAIN_HARMONDALE = 206, PARTY_QUEST_FOUNTAIN_NIGHON = 207, PARTY_QUEST_FOUNTAIN_PIERPONT = 208, @@ -28,9 +46,6 @@ PARTY_QUEST_FOUNTAIN_EVENMORN_ISLE = 211 }; - - - /* 355 */ enum PARTY_FLAGS_1: __int32 { @@ -300,3 +315,7 @@ extern struct ActionQueue *pPartyActionQueue; +inline bool TestPartyQuestBit(PARTY_QUEST_BITS bit) +{ + return _449B57_test_bit(pParty->_quest_bits, bit); +}
--- a/Render.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/Render.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -915,259 +915,259 @@ auto decor = &pLevelDecorations[i]; auto v0 = (char *)&pLevelDecorations[i].vPosition.y; - if ( (!(decor->field_2 & 0x40) || decor->_47A825()) && !(decor->field_2 & 0x20) ) - { - //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; - auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; - v2 = decor_desc->uFlags; - if ( (char)v2 >= 0 ) + if ((!(decor->uFlags & LEVEL_DECORATION_OBELISK_CHEST) || decor->IsObeliskChestActive()) && !(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) + { + //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; + auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; + v2 = decor_desc->uFlags; + if ( (char)v2 >= 0 ) + { + if ( !(v2 & 0x22) ) { - if ( !(v2 & 0x22) ) + //v4 = decor->vPosition.x; + //v5 = decor->vPosition.z; + v6 = pMiscTimer->uTotalGameTimeElapsed; + //y = decor->vPosition.y; + //x = decor->vPosition.x; + //v36 = decor->vPosition.z; + v7 = abs(decor->vPosition.x + decor->vPosition.y); + + + #pragma region "New: seasons change" + extern bool change_seasons; + if (change_seasons) + switch (pParty->uCurrentMonth) + { + // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites + case 11: case 0: case 1: // winter + switch (decor_desc->uSpriteID) + { + //case 468: //bush02 grows on swamps, which are evergreeen actually + case 548: // flower10 + case 547: // flower09 + case 541: // flower03 + case 539: continue; // flower01 + + case 483: // tree01 + case 486: // tree04 + case 492: // tree10 + pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2); + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); + break; + + default: + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + } + break; + + case 2: case 3: case 4: // spring + switch (decor_desc->uSpriteID) + { + } + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + break; + + case 8: case 9: case 10: // autumn + switch (decor_desc->uSpriteID) + { + //case 468: //bush02 grows on swamps, which are evergreeen actually + case 548: // flower10 + case 547: // flower09 + case 541: // flower03 + case 539: continue; // flower01 + + case 483: // tree01 + case 486: // tree04 + case 492: // tree10 + pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1); + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); + break; + + default: + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + } + break; + + case 5: case 6: case 7: // summer + //all green by default + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + break; + + default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); + } + else + v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + #pragma endregion + //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); + + //v9 = v8; + v42 = v8->uFlags; + a5 = v8->uGlowRadius; + v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x, + decor->vPosition.y - pIndoorCamera->pos.y); + v11 = *((int *)v0 + 2); + v37 = v10; + v12 = v42; + v38 = 0; + v13 = ((signed int)(stru_5C6E00->uIntegerPi + + ((signed int)stru_5C6E00->uIntegerPi >> 3) + + v11 + - (signed int)v37) >> 8) & 7; + v37 = (unsigned __int16 *)v13; + if ( v42 & 2 ) + v38 = 2; + if ( (256 << v13) & v42 ) + v38 |= 4u; + if ( v12 & 0x40000 ) + v38 |= 0x40u; + if ( v12 & 0x20000 ) + LOBYTE(v38) = v38 | 0x80; + if ( a5 ) { - //v4 = decor->vPosition.x; - //v5 = decor->vPosition.z; - v6 = pMiscTimer->uTotalGameTimeElapsed; - //y = decor->vPosition.y; - //x = decor->vPosition.x; - //v36 = decor->vPosition.z; - v7 = abs(decor->vPosition.x + decor->vPosition.y); - - - #pragma region "New: seasons change" - extern bool change_seasons; - if (change_seasons) - switch (pParty->uCurrentMonth) - { - // case 531 (tree60), 536 (tree65), 537 (tree66) have no autumn/winter sprites - case 11: case 0: case 1: // winter - switch (decor_desc->uSpriteID) - { - //case 468: //bush02 grows on swamps, which are evergreeen actually - case 548: // flower10 - case 547: // flower09 - case 541: // flower03 - case 539: continue; // flower01 - - case 483: // tree01 - case 486: // tree04 - case 492: // tree10 - pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 2); - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 2, v6 + v7); - break; - - default: - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - } - break; - - case 2: case 3: case 4: // spring - switch (decor_desc->uSpriteID) - { - } - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - break; - - case 8: case 9: case 10: // autumn - switch (decor_desc->uSpriteID) - { - //case 468: //bush02 grows on swamps, which are evergreeen actually - case 548: // flower10 - case 547: // flower09 - case 541: // flower03 - case 539: continue; // flower01 - - case 483: // tree01 - case 486: // tree04 - case 492: // tree10 - pSpriteFrameTable->InitializeSprite(decor_desc->uSpriteID + 1); - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID + 1, v6 + v7); - break; - - default: - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - } - break; - - case 5: case 6: case 7: // summer - //all green by default - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - break; - - default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); - } - else - v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - #pragma endregion - //v8 = pSpriteFrameTable->GetFrame(decor_desc->uSpriteID, v6 + v7); - - //v9 = v8; - v42 = v8->uFlags; - a5 = v8->uGlowRadius; - v10 = (unsigned __int16 *)stru_5C6E00->Atan2(decor->vPosition.x - pIndoorCamera->pos.x, - decor->vPosition.y - pIndoorCamera->pos.y); - v11 = *((int *)v0 + 2); - v37 = v10; - v12 = v42; - v38 = 0; - v13 = ((signed int)(stru_5C6E00->uIntegerPi - + ((signed int)stru_5C6E00->uIntegerPi >> 3) - + v11 - - (signed int)v37) >> 8) & 7; - v37 = (unsigned __int16 *)v13; - if ( v42 & 2 ) - v38 = 2; - if ( (256 << v13) & v42 ) - v38 |= 4u; - if ( v12 & 0x40000 ) - v38 |= 0x40u; - if ( v12 & 0x20000 ) - LOBYTE(v38) = v38 | 0x80; - if ( a5 ) + if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights ) { - if ( pRenderer->pRenderD3D && pRenderer->bUseColoredLights ) - { - v14 = decor_desc->uColoredLightRed; - v15 = decor_desc->uColoredLightGreen; - v16 = decor_desc->uColoredLightBlue; - } - else - { - v16 = 255; - v14 = 255; - v15 = 255; - } - b = v16; - pStationaryLightsStack->AddLight( - decor->vPosition.x, - decor->vPosition.y, - decor->vPosition.z + decor_desc->uDecorationHeight / 2, - a5, - v14, - v15, - v16, - byte_4E94D0); - } - v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; - if ( pIndoorCamera->sRotationX ) - { - v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; - v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - v42 = v18; - b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; - v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; - v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; - v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); - v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); - if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) - { - v21 = a5 - b; - v41 = a5 - b; - a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; - b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; - v22 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - a5; -LABEL_30: - v42 = v22; - v40 = 2 * abs(v20); - v23 = abs(v21); - if ( v40 >= v23 ) - { - LODWORD(v24) = 0; - HIDWORD(v24) = SLOWORD(pOutdoorCamera->int_fov_rad); - a5 = v24 / v39; - v25 = pViewport->uScreenCenterX - - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); - b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16; - v41 = v24 / v39; - v40 = pViewport->uScreenCenterY - - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16); - v42 = v8->scale; - v41 = (unsigned __int64)(v42 * v24 / v39) >> 16; - v37 = (unsigned __int16 *)&v8->pHwSpriteIDs[(int)v37]; - if ( pRenderer->pRenderD3D ) - { - v26 = v41; - v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1; - b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; - } - else - { - v26 = v41; - v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; - b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; - } - if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) - { - if (::uNumBillboardsToDraw >= 500) - return; - v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; - ++uNumDecorationsDrawnThisFrame; - v27->uHwSpriteID = *v37; - v28 = v8->uPaletteIndex; - v27->_screenspace_x_scaler_packedfloat = v26; - v27->_screenspace_y_scaler_packedfloat = v26; - v29 = v38; - v27->uScreenSpaceX = v25; - HIBYTE(v29) |= 2u; - v27->uPalette = v28; - v27->field_1E = v29; - v27->world_x = decor->vPosition.x; - v27->world_y = decor->vPosition.y; - v27->world_z = decor->vPosition.z; - v27->uScreenSpaceY = v40; - HIWORD(v30) = HIWORD(v39); - v31 = PID(OBJECT_Decoration,i); - LOWORD(v30) = 0; - v27->uIndoorSectorID = 0; - v27->sZValue = v30 + v31; - v27->dimming_level = 0; - v27->pSpriteFrame = v8; - v27->uTintColor = 0; - } - } - goto LABEL_38; - } + v14 = decor_desc->uColoredLightRed; + v15 = decor_desc->uColoredLightGreen; + v16 = decor_desc->uColoredLightBlue; } else { - v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; - v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; - b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); - if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) + v16 = 255; + v14 = 255; + v15 = 255; + } + b = v16; + pStationaryLightsStack->AddLight( + decor->vPosition.x, + decor->vPosition.y, + decor->vPosition.z + decor_desc->uDecorationHeight / 2, + a5, + v14, + v15, + v16, + byte_4E94D0); + } + v17 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; + if ( pIndoorCamera->sRotationX ) + { + v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; + v18 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) + + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); + v42 = v18; + b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + v40 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; + v41 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; + v19 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; + v20 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); + v39 = v19 + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); + if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) + { + v21 = a5 - b; + v41 = a5 - b; + a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16; + b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16; + v22 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) - a5; +LABEL_30: + v42 = v22; + v40 = 2 * abs(v20); + v23 = abs(v21); + if ( v40 >= v23 ) { - a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; - b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; - v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; - v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; - v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; - goto LABEL_30; + LODWORD(v24) = 0; + HIDWORD(v24) = SLOWORD(pOutdoorCamera->int_fov_rad); + a5 = v24 / v39; + v25 = pViewport->uScreenCenterX + - ((signed int)(((unsigned __int64)(v24 / v39 * v41) >> 16) + 32768) >> 16); + b = (unsigned __int64)(a5 * (signed __int64)v42) >> 16; + v41 = v24 / v39; + v40 = pViewport->uScreenCenterY + - ((signed int)(((unsigned __int64)(a5 * (signed __int64)v42) >> 16) + 32768) >> 16); + v42 = v8->scale; + v41 = (unsigned __int64)(v42 * v24 / v39) >> 16; + v37 = (unsigned __int16 *)&v8->pHwSpriteIDs[(int)v37]; + if ( pRenderer->pRenderD3D ) + { + v26 = v41; + v42 = pSprites_LOD->pHardwareSprites[(signed __int16)*v37].uBufferWidth >> 1; + b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; + } + else + { + v26 = v41; + v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; + b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; + } + if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) + { + if (::uNumBillboardsToDraw >= 500) + return; + v27 = &pBillboardRenderList[::uNumBillboardsToDraw++]; + ++uNumDecorationsDrawnThisFrame; + v27->uHwSpriteID = *v37; + v28 = v8->uPaletteIndex; + v27->_screenspace_x_scaler_packedfloat = v26; + v27->_screenspace_y_scaler_packedfloat = v26; + v29 = v38; + v27->uScreenSpaceX = v25; + HIBYTE(v29) |= 2u; + v27->uPalette = v28; + v27->field_1E = v29; + v27->world_x = decor->vPosition.x; + v27->world_y = decor->vPosition.y; + v27->world_z = decor->vPosition.z; + v27->uScreenSpaceY = v40; + HIWORD(v30) = HIWORD(v39); + v31 = PID(OBJECT_Decoration,i); + LOWORD(v30) = 0; + v27->uIndoorSectorID = 0; + v27->sZValue = v30 + v31; + v27->dimming_level = 0; + v27->pSpriteFrame = v8; + v27->uTintColor = 0; + } } + goto LABEL_38; + } + } + else + { + v42 = (decor->vPosition.x - pIndoorCamera->pos.x) << 16; + v40 = (decor->vPosition.y - pIndoorCamera->pos.y) << 16; + b = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + a5 = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + v20 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); + v39 = b + ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); + if ( v20 >= 262144 && v20 <= pOutdoorCamera->shading_dist_mist << 16 ) + { + a5 = (unsigned __int64)(v42 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; + b = (unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; + v21 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; + v41 = ((unsigned __int64)(v40 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - a5; + v22 = (decor->vPosition.z - pIndoorCamera->pos.z) << 16; + goto LABEL_30; } } } - else - { - memset(&local_0, 0, 0x68u); - v3 = (double)*((signed int *)v0 - 1); - local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; - local_0.uDiffuse = 0xFF3C1E; - local_0.x = v3; - local_0.y = (double)*(signed int *)v0; - local_0.z = (double)*((signed int *)v0 + 1); - local_0.r = 0.0; - local_0.g = 0.0; - local_0.b = 0.0; - local_0.flt_28 = 1.0; - local_0.timeToLive = (rand() & 0x80) + 128; - local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); - pGame->pParticleEngine->AddParticle(&local_0); - } - } + } + else + { + memset(&local_0, 0, 0x68u); + v3 = (double)*((signed int *)v0 - 1); + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + local_0.uDiffuse = 0xFF3C1E; + local_0.x = v3; + local_0.y = (double)*(signed int *)v0; + local_0.z = (double)*((signed int *)v0 + 1); + local_0.r = 0.0; + local_0.g = 0.0; + local_0.b = 0.0; + local_0.flt_28 = 1.0; + local_0.timeToLive = (rand() & 0x80) + 128; + local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01"); + pGame->pParticleEngine->AddParticle(&local_0); + } + } LABEL_38: ; //++v35; @@ -7359,20 +7359,13 @@ } //----- (004A6A68) -------------------------------------------------------- -void Render::_4A6A68(unsigned int a2, unsigned int a3, Texture *a4, __int16 height) -{ - Render *v5; // ebx@1 - unsigned __int16 v6; // ax@1 - - v5 = this; - +void Render::GetLeather(unsigned int a2, unsigned int a3, Texture *a4, __int16 height) +{ Texture tex; // [sp+Ch] [bp-48h]@1 - //Texture::Texture(&tex); - - v6 = a4->uTextureHeight - height; + memcpy(&tex, a4, sizeof(tex)); - tex.uTextureHeight = v6; - if ( (signed __int16)v6 > 0 ) + tex.uTextureHeight = a4->uTextureHeight - height; + if ( (signed __int16)tex.uTextureHeight > 0 ) DrawTextureIndexed(a2, a3, &tex); }
--- a/Render.h Mon Sep 02 12:03:25 2013 +0600 +++ b/Render.h Mon Sep 02 12:03:40 2013 +0600 @@ -348,7 +348,7 @@ void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8); void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4); void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture); - void _4A6A68(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height); + void GetLeather(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height); void DrawTextPalette(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8); void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor); void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16);
--- a/SaveLoad.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/SaveLoad.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -415,7 +415,7 @@ for (int i = 0; i <(signed int)uNumLevelDecorations; ++i) { - memcpy(data_write_pos, &pLevelDecorations[i].field_2, 2); + memcpy(data_write_pos, &pLevelDecorations[i].uFlags, 2); data_write_pos+= 2; } @@ -465,7 +465,7 @@ for (int i = 0; i < (signed int)uNumLevelDecorations; ++i) { - memcpy(data_write_pos, &pLevelDecorations[i].field_2, 2); + memcpy(data_write_pos, &pLevelDecorations[i].uFlags, 2); data_write_pos += 2; } memcpy(data_write_pos, &uNumActors, 4);
--- a/Sprites.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/Sprites.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -753,7 +753,7 @@ if ( PID_TYPE(v4) == OBJECT_Decoration) { v5 = &pLevelDecorations[(signed __int16)v4 >> 3]; - if ( !(v5->field_2 & 0x20) ) + if (!(v5->uFlags & LEVEL_DECORATION_INVISIBLE)) { v6 = &pDecorationList->pDecorations[v5->uDecorationDescID]; if (!v6->CanMoveThrough())
--- a/UI/Books/UIMapBook.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/UI/Books/UIMapBook.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -551,7 +551,7 @@ { for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i ) { - if ( pLevelDecorations[i].field_2 & 8 ) + if (pLevelDecorations[i].uFlags & LEVEL_DECORATION_VISIBLE_ON_MAP) { screenHeight = pLevelDecorations[i].vPosition.y - pCenterY; v93 = (unsigned __int16 *)(pLevelDecorations[i].vPosition.x - viewparams->sViewCenterX);
--- a/UI/UICharacter.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/UI/UICharacter.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -2325,35 +2325,17 @@ unsigned __int16 v5; // ax@7 int v7; // esi@27 int v8; // eax@29 - int v10; // esi@34 - int v12; // esi@38 - char v14; // zf@38 - int v15; // esi@42 int v17; // eax@44 unsigned int v18; // ecx@55 unsigned int v19; // eax@55 - int v20; // esi@60 unsigned int v22; // eax@61 int v23; // eax@62 - int v24; // esi@65 - int v25; // eax@65 int v26; // eax@69 - int v27; // esi@81 - int v28; // eax@81 - int v29; // esi@84 - int v30; // eax@84 - int v31; // eax@85 - unsigned int v32; // ecx@88 - unsigned int v33; // eax@88 int v34; // esi@90 - unsigned int v35; // eax@91 int v36; // esi@93 - int v37; // edi@93 ItemGen *v38; // edi@93 - __int16 v39; // dx@99 ItemGen _this; // [sp+Ch] [bp-40h]@1 unsigned int v48; // [sp+30h] [bp-1Ch]@88 - unsigned int v49; // [sp+34h] [bp-18h]@57 unsigned int v50; // [sp+38h] [bp-14h]@50 int v51; // [sp+3Ch] [bp-10h]@1 int v52; // [sp+40h] [bp-Ch]@5 @@ -2363,9 +2345,7 @@ _this.Reset(); v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand; v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; - //v54 = pPlayers[uActiveCharacter]->pEquipment.uShield; - //v53 = v1; - if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uEquipType == 1 ) + if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uEquipType == EQUIP_MAIN_HAND ) v51 = v1; v3 = pParty->pPickedItem.uItemID; if ( pParty->pPickedItem.uItemID ) @@ -2389,7 +2369,7 @@ { if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2) && v1 - && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1-1]].uSkillType == 4 ) + && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uSkillType == 4 ) { LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); if ( (signed int)SkillToMastery(v5) < 3 ) @@ -2411,7 +2391,6 @@ WetsuitOn(uActiveCharacter); return; } - //v6 = v52; switch ( pEquipType ) { case EQUIP_BOW: @@ -2422,7 +2401,7 @@ case EQUIP_GAUNTLETS: case EQUIP_BOOTS: case EQUIP_AMULET: - if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) + if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )// { pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); return; @@ -2436,8 +2415,8 @@ if ( pParty->pPickedItem.uItemID == ITEM_WETSUIT ) WetsuitOff(uActiveCharacter); return; - - case EQUIP_RING:// +//------------------------dress rings( )---------------------------------- + case EQUIP_RING: if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); @@ -2465,40 +2444,37 @@ { v52 = pPlayers[uActiveCharacter]->pEquipment.uRings[5] - 1; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - v10 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v52); - *(char *)(v10 + 556) = 0; + pPlayers[uActiveCharacter]->pInventoryItemList[v52].uBodyAnchor = 0; pParty->pPickedItem.Reset(); - pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v52]);//(ItemGen *)(v10 + 532) + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v52]); _this.uBodyAnchor = 16; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uRings[6] = v52 + 1; + pPlayers[uActiveCharacter]->pEquipment.uRings[5] = v52 + 1; } return; - +//------------------dress shield( )------------------------------------------------------ case EQUIP_SHIELD:// - if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) + if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )// { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); return; } - if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) + if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) )// { pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); return; } - if ( v2 ) + if ( v2 )// { --v2; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - v12 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v2); - *(char *)(v12 + 556) = 0; + pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; pParty->pPickedItem.Reset(); - pParty->SetHoldingItem((ItemGen *)(v12 + 532)); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); _this.uBodyAnchor = 1; - v14 = v51 == 0; - memcpy((void *)(v12 + 532), &_this, 0x24u); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2], &_this, 0x24u); pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; - if ( v14 ) + if ( v51 == EQUIP_OFF_HAND ) return; } else @@ -2506,26 +2482,27 @@ v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v52 < 0 ) return; - if ( !v51 ) + if ( !v51 )// { pParty->pPickedItem.uBodyAnchor = 1; v17 = v52 + 1; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = v17; pMouse->RemoveHoldingItem(); - return; + return; } + v1--;// memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - v15 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v1 - 1)); - *(char *)(v15 + 556) = 0; + pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; pParty->pPickedItem.Reset(); - pParty->SetHoldingItem((ItemGen *)(v15 + 532)); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); _this.uBodyAnchor = 1; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = v52 + 1; } pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0; return; +//-------------------------taken in hand( )------------------------------------------- case EQUIP_OFF_HAND: case EQUIP_WAND: if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) @@ -2546,7 +2523,6 @@ { v18 = pMouse->uMouseClickX; v19 = pMouse->uMouseClickY; - v49 = v19; if ( (signed int)v18 >= 560 ) { if ( !v51 ) @@ -2555,19 +2531,16 @@ { --v2; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - v20 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v2); - *(char *)(v20 + 556) = 0; + pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; pParty->pPickedItem.Reset(); - pParty->SetHoldingItem((ItemGen *)(v20 + 532)); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); _this.uBodyAnchor = 1; - v14 = pEquipType == EQUIP_WAND; - memcpy((void *)(v20 + 532), &_this, 0x24u); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2], &_this, 0x24u); pPlayers[uActiveCharacter]->pEquipment.uShield = v2 + 1; - if ( !v14 ) + if ( pEquipType != EQUIP_WAND ) return; - v22 = _this.uItemID; - v50 = v22; - if ( v50 ) + v50 = _this.uItemID; + if ( _this.uItemID ) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 stru_A750F8[uActiveCharacter - 1]._494836(*((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); @@ -2582,7 +2555,7 @@ memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v23])); pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1; pMouse->RemoveHoldingItem(); - if ( pEquipType != 12 ) + if ( pEquipType != EQUIP_WAND ) return; v22 = *(int *)v50; v50 = v22; @@ -2605,7 +2578,7 @@ memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v26])); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1; pMouse->RemoveHoldingItem(); - if ( pEquipType != 12 ) + if ( pEquipType != EQUIP_WAND ) return; v22 = *(int *)v50; v50 = v22; @@ -2618,103 +2591,92 @@ } --v1; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - v24 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v1); - *(char *)(v24 + 556) = 0; + pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; pParty->pPickedItem.Reset(); - pParty->SetHoldingItem((ItemGen *)(v24 + 532)); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); _this.uBodyAnchor = 2; - v25 = v1 + 1; - v14 = pEquipType == 12; - memcpy((void *)(v24 + 532), &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v25; - if ( v14 ) + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v1], &_this, 0x24u); + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v1 + 1; + if ( pEquipType == EQUIP_WAND ) v50 = _this.uItemID; if ( v51 ) pPlayers[uActiveCharacter]->pEquipment.uShield = 0; - if ( v50 ) + if ( v50 )// { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 stru_A750F8[uActiveCharacter - 1]._494836( *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), uActiveCharacter - 1 + 9); } break; +//---------------------------take two hands( )--------------------------------- case EQUIP_MAIN_HAND: if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) - { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; - } + { + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; + } if ( !pPlayers[uActiveCharacter]->HasSkill(pSkillType) ) { pPlayers[uActiveCharacter]->PlaySound(SPEECH_39, 0); return; } - if ( v1 ) + if ( v1 )// ( ) { if ( v2 ) { - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - return; + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + return; } --v1; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - v27 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v1); - *(char *)(v27 + 556) = 0; + pPlayers[uActiveCharacter]->pInventoryItemList[v1].uBodyAnchor = 0; pParty->pPickedItem.Reset(); - pParty->SetHoldingItem((ItemGen *)(v27 + 532)); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v1]); _this.uBodyAnchor = 2; - v28 = v1 + 1; - memcpy((void *)(v27 + 532), &_this, 0x24u); - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v28; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v1], &_this, 0x24u); + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v1 + 1; } else { v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v52 >= 0 ) { - if ( v2 ) + if ( v2 )// ( ) { + v2--; memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); - v29 = (int)((char *)pPlayers[uActiveCharacter] + 36 * (v2 - 1)); - *(char *)(v29 + 556) = 0; + pPlayers[uActiveCharacter]->pInventoryItemList[v2].uBodyAnchor = 0; pParty->pPickedItem.Reset(); - pParty->SetHoldingItem((ItemGen *)(v29 + 532)); + pParty->SetHoldingItem(&pPlayers[uActiveCharacter]->pInventoryItemList[v2]); _this.uBodyAnchor = 2; - v30 = v52 + 1; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = 0; - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v30; + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v52 + 1; } else { pParty->pPickedItem.uBodyAnchor = 2; - v31 = v52 + 1; memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); - pPlayers[uActiveCharacter]->pEquipment.uMainHand = v31; + pPlayers[uActiveCharacter]->pEquipment.uMainHand = v52 + 1; pMouse->RemoveHoldingItem(); } } } return; +//------------------------------------------------------------------------------- default: - pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(uActiveCharacter, 0); + pPlayers[uActiveCharacter]->UseItem_DrinkPotion_etc(uActiveCharacter, 0);// . return; } return; } - v32 = pMouse->uMouseClickX; - v33 = pMouse->uMouseClickY; - - v34 = pRenderer->pActiveZBuffer[v32 + pSRZBufferLineOffsets[v33]] & 0xFFFF; + v34 = pRenderer->pActiveZBuffer[pMouse->uMouseClickX + pSRZBufferLineOffsets[pMouse->uMouseClickY]] & 0xFFFF; if ( v34 ) { v36 = v34 - 1; - v37 = (int)((char *)pPlayers[uActiveCharacter] + 36 * v36); - v50 = v37; - v38 = (ItemGen *)(v37 + 532); - v14 = v38->uItemID == ITEM_WETSUIT; + v38 = &pPlayers[uActiveCharacter]->pInventoryItemList[v36]; pEquipType = pItemsTable->pItems[v38->uItemID].uEquipType; - if ( v14 ) + if ( v38->uItemID == ITEM_WETSUIT ) { if ( bUnderwater ) { @@ -2723,13 +2685,12 @@ } WetsuitOff(uActiveCharacter); } - if ( unk_50C9A0 ) + if ( unk_50C9A0 )// { - *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; + *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;//CastSpellInfo *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; - v39 = pEquipType; *((int *)pGUIWindow_Settings->ptr_1C + 3) = v36; - *((short *)pGUIWindow_Settings->ptr_1C + 3) = v39; + *((short *)pGUIWindow_Settings->ptr_1C + 3) = pEquipType; ptr_50C9A4 = v38; unk_50C9A0 = 0; if ( pMessageQueue_50CBD0->uNumMessages ) @@ -2741,22 +2702,21 @@ } else { - if ( !ptr_50C9A4 ) + if ( !ptr_50C9A4 )// { pParty->SetHoldingItem(v38); - *(&pPlayers[uActiveCharacter]->uBirthYear + *(char *)(v50 + 556)) = 0; + *(&pPlayers[uActiveCharacter]->uBirthYear + pPlayers[uActiveCharacter]->pInventoryItemList[v36].uBodyAnchor) = 0;// pPlayers[uActiveCharacter]->pEquipment[pPlayers[uActiveCharacter]->pInventoryItemList[v36].uBodyAnchor] v38->Reset(); } } } - else + else// { - v35 = pPlayers[uActiveCharacter]->pEquipment.uBow; - if ( v35 ) + if ( pPlayers[uActiveCharacter]->pEquipment.uBow ) { - auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v35 - 1]; - pParty->SetHoldingItem(_a); - _a->Reset(); + _this = pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->pEquipment.uBow - 1]; + pParty->SetHoldingItem(&_this); + _this.Reset(); pPlayers[uActiveCharacter]->pEquipment.uBow = 0; } }
--- a/UI/UIHouses.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/UI/UIHouses.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -2510,9 +2510,9 @@ } auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->_4A6A68(8u, 352 - v9, pTex, pTex->uTextureHeight - v9); - pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428); - v10 = FitTextInAWindow(current_npc_text, pOutString, &w, 0xDu, 0); + pRenderer->GetLeather(8, 352 - v9, pTex, pTex->uTextureHeight - v9); + pRenderer->DrawTextureIndexed(8, 347 - v9, pTexture_591428); + v10 = FitTextInAWindow(current_npc_text, pOutString, &w, 13, 0); a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); break; } @@ -2932,7 +2932,7 @@ pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; } auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->_4A6A68(8, 352 - pTextHeight, pTex, pTex->uTextureHeight - pTextHeight); + pRenderer->GetLeather(8, 352 - pTextHeight, pTex, pTex->uTextureHeight - pTextHeight); pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); v63 = FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0); window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, v63, 0, 0, 0); @@ -2946,7 +2946,7 @@ v61 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0); pTextHeight = v61 + 7; auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->_4A6A68(8, 352 - (v61 + 7), pTex, pTex->uTextureHeight - (v61 + 7)); + pRenderer->GetLeather(8, 352 - (v61 + 7), pTex, pTex->uTextureHeight - (v61 + 7)); pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); v63 = FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0); window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, v63, 0, 0, 0); @@ -4224,7 +4224,7 @@ pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); v12 = v11 + 7; - pRenderer->_4A6A68(8, 352 - (v11 + 7), + pRenderer->GetLeather(8, 352 - (v11 + 7), pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); @@ -4427,11 +4427,9 @@ v47 = pFontCreate; v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; } - pRenderer->_4A6A68(8, 352 - v48, - pIcons_LOD->GetTexture(uTextureID_Leather), - pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); + pRenderer->GetLeather(8, 352 - v48, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); - v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); + v49 = FitTextInAWindow(current_npc_text, v47, &w, 13, 0); a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); } }
--- a/UI/UiGame.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/UI/UiGame.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -35,29 +35,14 @@ #include "..\BSPModel.h" - - - int uTextureID_GameUI_CharSelectionFrame; // 50C98C - - - - //----- (00421D00) -------------------------------------------------------- void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) { - //unsigned int v1; // esi@1 - //int v2; // eax@2 - //Player *v3; // ecx@2 - //Player *v4; // ecx@5 - unsigned int v5; // [sp-4h] [bp-10h]@21 - - //v1 = uPlayerID; auto player = &pParty->pPlayers[uPlayerID - 1]; if (pParty->pPickedItem.uItemID) { - //v3 = player; if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) { memcpy(&player->pInventoryItemList[slot-1], &pParty->pPickedItem, 0x24u); @@ -70,16 +55,14 @@ { player = pPlayers[uActiveCharacter]; } - if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct()) - player->PlaySound(SPEECH_NoRoom, 0); + if( player->CanAct() || !pPlayers[uActiveCharacter]->CanAct() ) + player->PlaySound(SPEECH_NoRoom, 0); } -//LABEL_9: if (pCurrentScreen == SCREEN_GAME) { viewparams->bRedrawGameUI = true; if ( uActiveCharacter != uPlayerID ) - //goto LABEL_27; { if ( pPlayers[uPlayerID]->uTimeToRecovery ) return; @@ -87,29 +70,23 @@ uActiveCharacter = uPlayerID; return; } - v5 = 7; -//LABEL_22: - pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); + pGUIWindow_CurrentMenu = CharacterUI_Initialize(7); return; } if ( pCurrentScreen == SCREEN_SPELL_BOOK ) return; if ( pCurrentScreen == SCREEN_CHEST ) { -//LABEL_23: viewparams->bRedrawGameUI = true; if ( uActiveCharacter == uPlayerID ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; pCurrentScreen = SCREEN_CHEST_INVENTORY; - //goto LABEL_28; uActiveCharacter = uPlayerID; return; } -//LABEL_27: if ( pPlayers[uPlayerID]->uTimeToRecovery ) return; - //goto LABEL_28; uActiveCharacter = uPlayerID; return; } @@ -117,7 +94,6 @@ { if ( pCurrentScreen == SCREEN_E ) { -//LABEL_28: uActiveCharacter = uPlayerID; return; } @@ -129,20 +105,16 @@ FillAwardsData(); return; } - //goto LABEL_23; viewparams->bRedrawGameUI = true; if ( uActiveCharacter == uPlayerID ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; pCurrentScreen = SCREEN_CHEST_INVENTORY; - //goto LABEL_28; uActiveCharacter = uPlayerID; return; } -//LABEL_27: if ( pPlayers[uPlayerID]->uTimeToRecovery ) return; - //goto LABEL_28; uActiveCharacter = uPlayerID; return; } @@ -150,16 +122,13 @@ return; viewparams->bRedrawGameUI = true; if ( uActiveCharacter != uPlayerID ) - //goto LABEL_28; uActiveCharacter = uPlayerID; return; if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) { __debugbreak(); // fix indexing pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - v5 = 14; - //goto LABEL_22; - pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); + pGUIWindow_CurrentMenu = CharacterUI_Initialize(14); return; } } @@ -170,30 +139,16 @@ void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText { int v1; // edi@2 - int v2; // ecx@2 - NPCData *v3; // eax@2 - NPCData *v4; // esi@7 - NPCData *v5; // eax@16 - NPCData *v6; // esi@16 - const CHAR *v7; // eax@18 - unsigned int v8; // eax@25 - unsigned int v9; // eax@25 - const char *v10; // ST14_4@26 + NPCData *pNPC; // eax@16 + const CHAR *pText; // eax@18 char *v11; // esi@26 - const char *v12; // ST18_4@27 - unsigned __int16 v13; // ax@28 - char *v14; // eax@28 - GUIWindow a1; // [sp+Ch] [bp-60h]@23 + GUIWindow popup_window; // [sp+Ch] [bp-60h]@23 int a2; // [sp+60h] [bp-Ch]@16 - void *v17; // [sp+64h] [bp-8h]@1 LPCSTR lpsz; // [sp+68h] [bp-4h]@6 - v17 = _this; if ( bNoNPCHiring != 1 ) { v1 = 0; - v2 = 0; - v3 = pParty->pHirelings; /*do { if ( v3->pName ) @@ -233,69 +188,57 @@ } } } - if ( (signed int)((char *)v17 + (unsigned __int8)pParty->field_709) < v1 ) + if ( (signed int)((char *)_this + (unsigned __int8)pParty->field_709) < v1 ) { - sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)v17; - v5 = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &a2); - v6 = v5; - if ( v5 ) + sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)_this; + pNPC = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &a2); + if ( pNPC ) { if ( a2 == 57 ) - v7 = pNPCTopics[512].pText; // Baby dragon + pText = pNPCTopics[512].pText; // Baby dragon else - v7 = (const CHAR *)pNPCStats->pProfessions[v5->uProfession].pBenefits; - lpsz = v7; - if ( !v7 ) + pText = (const CHAR *)pNPCStats->pProfessions[pNPC->uProfession].pBenefits; + lpsz = pText; + if ( !pText ) { - lpsz = (LPCSTR)pNPCStats->pProfessions[v5->uProfession].pJoinText; + lpsz = (LPCSTR)pNPCStats->pProfessions[pNPC->uProfession].pJoinText; if ( !lpsz ) lpsz = ""; } - a1.Hint = 0; - a1.uFrameX = 38; - a1.uFrameY = 60; - a1.uFrameWidth = 276; - a1.uFrameZ = 313; - a1.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &a1, 0, 0) - + 2 * LOBYTE(pFontArrus->uFontHeight) - + 24; - if ( (signed int)a1.uFrameHeight < 130 ) - a1.uFrameHeight = 130; - a1.uFrameWidth = 400; - a1.uFrameZ = a1.uFrameX + 399; - a1.DrawMessageBox(0); - sprintfex(pTmpBuf2.data(), "NPC%03d", v6->uPortraitID); - v8 = pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed( - a1.uFrameX + 22, - a1.uFrameY + 36, - (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0)); - v9 = v6->uProfession; - if ( v9 ) + popup_window.Hint = 0; + popup_window.uFrameX = 38; + popup_window.uFrameY = 60; + popup_window.uFrameWidth = 276; + popup_window.uFrameZ = 313; + popup_window.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &popup_window, 0, 0) + 2 * LOBYTE(pFontArrus->uFontHeight) + 24; + if ( (signed int)popup_window.uFrameHeight < 130 ) + popup_window.uFrameHeight = 130; + popup_window.uFrameWidth = 400; + popup_window.uFrameZ = popup_window.uFrameX + 399; + popup_window.DrawMessageBox(0); + sprintfex(pTmpBuf2.data(), "NPC%03d", pNPC->uPortraitID); + pRenderer->DrawTextureIndexed(popup_window.uFrameX + 22, popup_window.uFrameY + 36, + (Texture *)(pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE) != -1 + ? &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE)] : 0)); + if ( pNPC->uProfession ) { - v10 = v6->pName; v11 = pTmpBuf.data(); - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]); + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]); } else { - v12 = v6->pName; v11 = pTmpBuf.data(); - strcpy(pTmpBuf.data(), v12); + strcpy(pTmpBuf.data(), pNPC->pName); } - v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u); - a1.uFrameWidth -= 24; - a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; - v14 = BuildDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0); - a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0); + popup_window.DrawTitleText(pFontArrus, 0, 12, TargetColor(0xFFu, 0xFFu, 0x9Bu), v11, 3); + popup_window.uFrameWidth -= 24; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.DrawText(pFontArrus, 100, 36, 0, BuildDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0), 0, 0, 0); } } } } - - //----- (00445D4A) -------------------------------------------------------- void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello) { @@ -403,64 +346,31 @@ { NPCData *pNPC; // ebx@2 int pGreetType; // eax@2 - //unsigned __int16 v2; // di@2 - //unsigned int v3; // eax@2 - char *v4; // esi@3 - //int v5; // eax@11 - //char *v6; // ecx@13 - //char *v7; // eax@16 - //unsigned int v8; // edi@19 - //char *v9; // ecx@27 - char *v10; // eax@29 - //int v11; // eax@30 - int v12; // esi@39 - char *v13; // eax@41 - GUIButton *v14; // eax@43 - //GUIButton *v15; // edi@43 - signed int v16; // eax@44 - //unsigned int v23; // eax@53 - //const char *v24; // eax@59 - //unsigned __int16 v30; // cx@83 - int v31; // ecx@86 + int pTextHeight; // esi@39 + GUIButton *pButton; // eax@43 int v32; // ebx@93 - //unsigned int v33; // eax@93 - GUIWindow *v34; // ecx@93 int v35; // esi@93 - int i; // eax@93 - GUIButton *v37; // eax@94 int v38; // eax@95 signed int v39; // esi@99 signed int v40; // eax@102 unsigned int v41; // ebx@102 int v42; // edi@102 - GUIButton *v43; // esi@103 - int v44; // eax@104 unsigned int v45; // ecx@104 - unsigned __int16 *v46; // edx@104 - unsigned __int16 v47; // ax@104 - GUIWindow pWindow; // [sp+4h] [bp-110h]@39 - int v49; // [sp+Ch] [bp-108h]@39 - int v50; // [sp+14h] [bp-100h]@39 - GUIWindow v51; // [sp+58h] [bp-BCh]@2 - GUIWindow v52; // [sp+ACh] [bp-68h]@42 + unsigned __int16 pTextColor; // ax@104 + GUIWindow window; // [sp+ACh] [bp-68h]@42 char *Str; // [sp+100h] [bp-14h]@104 - //int v54; // [sp+104h] [bp-10h]@2 - //unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82 GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39 char *pInString=NULL; // [sp+110h] [bp-4h]@32 if ( !pDialogueWindow ) return; - memcpy(&v51, pDialogueWindow, sizeof(v51)); + // Window title( )---- + memcpy(&window, pDialogueWindow, sizeof(window)); pNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); pGreetType = GetGreetType(sDialogue_SpeakingActorNPC_ID); - v51.uFrameWidth -= 10; - v51.uFrameZ -= 10; - //v54 = v1; - //TargetColor(0xFFu, 0xFFu, 0xFFu); - //TargetColor(0xE1u, 0xCDu, 0x23u); - //v2 = TargetColor(0x15u, 0x99u, 0xE9u); + window.uFrameWidth -= 10; + window.uFrameZ -= 10; pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? &pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0)); pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0)); @@ -474,7 +384,7 @@ else strcpy(pTmpBuf.data(), pNPC->pName); - v51.DrawTitleText(pFontArrus, 483, 112, ui_game_dialogue_npc_name_color, pTmpBuf.data(), 3); + window.DrawTitleText(pFontArrus, 483, 112, ui_game_dialogue_npc_name_color, pTmpBuf.data(), 3); pParty->GetPartyFame(); pInString = nullptr; @@ -532,7 +442,7 @@ } else if (pGreetType == 2)//HiredNPC_greet { - auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1; + auto prof = pNPCStats->pProfessions + pNPC->uProfession; if (pNPC->Hired()) pInString = BuildDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0); @@ -542,145 +452,139 @@ break; } + // Message window( )---- if (pInString) { - pWindow.uFrameWidth = game_viewport_width; - pWindow.uFrameZ = 452; + window.uFrameWidth = game_viewport_width; + window.uFrameZ = 452; auto font = pFontArrus; - v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; - if ( 352 - v12 < 8 ) + pTextHeight = pFontArrus->CalcTextHeight(pInString, &window, 13, 0) + 7; + if ( 352 - pTextHeight < 8 ) { font = pFontCreate; - v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7; + pTextHeight = pFontCreate->CalcTextHeight(pInString, &window, 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, font, &pWindow, 0xDu, 0); - pDialogueWindow->DrawText(font, 13, 354 - v12, 0, v13, 0, 0, 0); + pRenderer->GetLeather(8, 352 - pTextHeight, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + pDialogueWindow->DrawText(font, 13, 354 - pTextHeight, 0, FitTextInAWindow(pInString, font, &window, 13, 0), 0, 0, 0); } - - - memcpy(&v52, pDialogueWindow, sizeof(v52)); - v52.uFrameX = 483; - v52.uFrameWidth = 148; - v52.uFrameZ = 334; - for (int i = v52.pStartingPosActiveItem; - i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i) + // Right panel( )------- + memcpy(&window, pDialogueWindow, sizeof(window)); + window.uFrameX = 483; + window.uFrameWidth = 148; + window.uFrameZ = 334; + for (int i = window.pStartingPosActiveItem; i < window.pStartingPosActiveItem + window.pNumPresenceButton; ++i) { - v14 = v52.GetControl(i); - //v15 = v14; - if ( !v14 ) + pButton = window.GetControl(i); + if ( !pButton ) break; - v16 = v14->msg_param; - if ( v16 > 88 ) - v14->pButtonName[0] = 0; - else if (v16 == 88) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord - else if (v16 == 87) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight - else if (v16 == 86) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire - else if (v16 == 85) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page - else if (v16 == 77) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details - else if (v16 == 76) + if ( pButton->msg_param > 88 ) + pButton->pButtonName[0] = 0; + else if (pButton->msg_param == 88) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord + else if (pButton->msg_param == 87) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight + else if (pButton->msg_param == 86) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire + else if (pButton->msg_param == 85) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page + else if (pButton->msg_param == 77) + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details + else if (pButton->msg_param == 76) { if (pNPC->Hired()) - sprintf(v14->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s + sprintf(pButton->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s else - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire } - else if (v16 == 24) + else if (pButton->msg_param == 24) { __debugbreak(); // learn conditions of this event auto topic = pNPCTopics[pNPC->evt_F - 1].pTopic;//(&dword_721660)[8 * v23]; if (!topic) { - v14->pButtonName[0] = 0; - v14->msg_param = 0; + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; } else - strcpy(v14->pButtonName, topic); + strcpy(pButton->pButtonName, topic); } - else if (v16 == 9) - strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession)); - else if (v16 == 19) - { + else if (pButton->msg_param == 9) + strcpy(pButton->pButtonName, GetProfessionActionText(pNPC->uProfession)); + else if (pButton->msg_param == 19) + { // __debugbreak(); // learn conditions of this event Scavenger Hunt auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23]; if (!topic) { - v14->pButtonName[0] = 0; - v14->msg_param = 0; + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 20) - { + else strcpy(pButton->pButtonName, topic); + } + else if (pButton->msg_param == 20) + { //__debugbreak(); // learn conditions of this event instruments auto topic = pNPCTopics[pNPC->evt_B - 1].pTopic;//(&dword_721660)[8 * v23]; if (!topic) { - v14->pButtonName[0] = 0; - v14->msg_param = 0; + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 21) - { + else strcpy(pButton->pButtonName, topic); + } + else if (pButton->msg_param == 21) + { //__debugbreak(); // learn conditions of this event auto topic = pNPCTopics[pNPC->evt_C - 1].pTopic;//(&dword_721660)[8 * v23]; if (!topic) { - v14->pButtonName[0] = 0; - v14->msg_param = 0; + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 22) - { + else strcpy(pButton->pButtonName, topic); + } + else if (pButton->msg_param == 22) + { //__debugbreak(); // learn conditions of this event auto topic = pNPCTopics[pNPC->evt_D - 1].pTopic;//(&dword_721660)[8 * v23]; if (!topic) { - v14->pButtonName[0] = 0; - v14->msg_param = 0; + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 23) - { + else strcpy(pButton->pButtonName, topic); + } + else if (pButton->msg_param == 23) + { //__debugbreak(); // learn conditions of this event auto topic = pNPCTopics[pNPC->evt_E - 1].pTopic;//(&dword_721660)[8 * v23]; if (!topic) { - v14->pButtonName[0] = 0; - v14->msg_param = 0; + pButton->pButtonName[0] = 0; + pButton->msg_param = 0; } - else strcpy(v14->pButtonName, topic); - } - else if (v16 == 13) - { + else strcpy(pButton->pButtonName, topic); + } + else if (pButton->msg_param == 13) + { if (pNPC->Hired()) - sprintf(v14->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s + sprintf(pButton->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s else - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join - } - else - v14->pButtonName[0] = 0; - + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join + } + else + pButton->pButtonName[0] = 0; if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1) { int num_dead_actors = 0; pInString = 0; - for (uint i = 0; i < uNumActors; ++i) + for ( uint i = 0; i < uNumActors; ++i ) { - if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || - pActors[i].uAIState == Disabled) + if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled) ++num_dead_actors; else { @@ -690,29 +594,23 @@ } } if (num_dead_actors == uNumActors) - strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize + strcpy(pButton->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize } } - + // Install Buttons( )-------- v32 = 0; - v34 = pDialogueWindow; - //v54 = v33; v35 = pDialogueWindow->pStartingPosActiveItem; - for ( i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ) + for ( uint i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ) { - v37 = v34->GetControl(v35); - if ( !v37 ) - { - v34 = pDialogueWindow; + pButton = pDialogueWindow->GetControl(v35); + if ( !pButton ) break; - } - v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0); - v34 = pDialogueWindow; + v38 = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0); v32 += v38; ++v35; } - v39 = v34->pNumPresenceButton; + v39 = pDialogueWindow->pNumPresenceButton; if ( v39 ) { pOutString = (GUIFont *)((174 - v32) / v39); @@ -720,28 +618,26 @@ pOutString = (GUIFont *)32; int v55 = 1; v40 = 174 - (int)pOutString * v39 - v32; - v41 = v34->pStartingPosActiveItem; + v41 = pDialogueWindow->pStartingPosActiveItem; v42 = v40 / 2 - (signed int)pOutString / 2 + 138; if ( (signed int)v41 < (signed int)(v41 + v39) ) { do { - v43 = v34->GetControl(v41); - if ( !v43 ) + pButton = pDialogueWindow->GetControl(v41); + if ( !pButton ) break; - v43->uY = (unsigned int)((char *)pOutString + v42); - Str = v43->pButtonName; - v44 = pFontArrus->CalcTextHeight(v43->pButtonName, &v52, 0, 0); - v45 = v43->uY; - v46 = (unsigned short *)v55; - v43->uHeight = v44; - v42 = v45 + v44 - 1; - v43->uW = v42; - v47 = ui_game_dialogue_option_highlight_color; - if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 ) - v47 = ui_game_dialogue_option_normal_color; - v52.DrawTitleText(pFontArrus, 0, v45, v47, Str, 3u); - v34 = pDialogueWindow; + pButton->uY = (unsigned int)((char *)pOutString + v42); + Str = pButton->pButtonName; + pTextHeight = pFontArrus->CalcTextHeight(pButton->pButtonName, &window, 0, 0); + v45 = pButton->uY; + pButton->uHeight = pTextHeight; + v42 = v45 + pTextHeight - 1; + pButton->uW = v42; + pTextColor = ui_game_dialogue_option_highlight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != v55 ) + pTextColor = ui_game_dialogue_option_normal_color; + window.DrawTitleText(pFontArrus, 0, v45, pTextColor, Str, 3); ++v55; ++v41; } @@ -751,36 +647,28 @@ pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); } - - //----- (00444FBE) -------------------------------------------------------- void GameUI_DrawBranchlessDialogue() { - //GUIFont *v0; // esi@1 - int v1; // esi@4 - char *v2; // eax@6 - int v3; // edi@12 + int pTextHeight; // esi@4 char Str[200]; // [sp+Ch] [bp-120h]@12 - GUIWindow v5; // [sp+D4h] [bp-58h]@4 + GUIWindow BranchlessDlg_window; // [sp+D4h] [bp-58h]@4 GUIFont *pFont; // [sp+128h] [bp-4h]@1 pFont = pFontArrus; if ( current_npc_text && !byte_5B0938[0] ) strcpy(byte_5B0938.data(), current_npc_text); - v5.uFrameWidth = game_viewport_width; - v5.uFrameZ = 452; - v1 = pFontArrus->CalcTextHeight(byte_5B0938.data(), &v5, 12, 0) + 7; - if ( 352 - v1 < 8 ) + BranchlessDlg_window.uFrameWidth = game_viewport_width; + BranchlessDlg_window.uFrameZ = 452; + pTextHeight = pFontArrus->CalcTextHeight(byte_5B0938.data(), &BranchlessDlg_window, 12, 0) + 7; + if ( 352 - pTextHeight < 8 ) { pFont = pFontCreate; - v1 = pFontCreate->CalcTextHeight(byte_5B0938.data(), &v5, 12, 0) + 7; + pTextHeight = pFontCreate->CalcTextHeight(byte_5B0938.data(), &BranchlessDlg_window, 12, 0) + 7; } - pRenderer->_4A6A68(8, 352 - v1, - pIcons_LOD->GetTexture(uTextureID_Leather), - pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v1); - pRenderer->DrawTextureIndexed(8, 347 - v1, pTexture_591428); - v2 = FitTextInAWindow(byte_5B0938.data(), pFont, &v5, 0xCu, 0); - pGUIWindow2->DrawText(pFont, 12, 354 - v1, 0, v2, 0, 0, 0); + pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); + pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); + pGUIWindow2->DrawText(pFont, 12, 354 - pTextHeight, 0, FitTextInAWindow(byte_5B0938.data(), pFont, &BranchlessDlg_window, 12, 0), 0, 0, 0); pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS) { @@ -788,167 +676,108 @@ { pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; strcpy(GameUI_Footer_TimedString.data(), (const char *)pKeyActionMap->pPressedKeysBuffer); -LABEL_16: sub_4452BB(); return; } if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED) return; pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE; -LABEL_15: memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); - goto LABEL_16; + sub_4452BB(); + return; } if ( pGUIWindow2->ptr_1C == (void *)26 ) { sprintf(Str, "%s %s", GameUI_Footer_TimedString, pKeyActionMap->pPressedKeysBuffer); - v3 = pFontLucida->GetLineWidth(Str); pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0); - pGUIWindow2->DrawFlashingInputCursor(v3 + 13, 357, pFontLucida); + pGUIWindow2->DrawFlashingInputCursor(pFontLucida->GetLineWidth(Str) + 13, 357, pFontLucida); return; } if ( pKeyActionMap->pPressedKeysBuffer[0] ) { pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); - goto LABEL_15; + memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); + sub_4452BB(); + return; } } - //----- (004443D5) -------------------------------------------------------- const char *GameUI_GetMinimapHintText() { - int v0; // ST20_4@1 - unsigned int v1; // esi@1 - signed int v2; // ebx@1 double v3; // st7@1 - int v4; // esi@3 - int v5; // edi@4 - int v6; // eax@4 int v7; // eax@4 - BSPModel *v8; // ecx@4 - unsigned __int8 v9; // zf@5 - char v10; // sf@5 - unsigned __int8 v11; // of@5 - ODMFace *v12; // eax@6 - __int16 v13; // cx@6 + ODMFace *pFace; // eax@6 const char *v14; // eax@8 - const char *v15; // edi@8 char *result; // eax@12 - unsigned int v17; // eax@14 - unsigned int v18; // [sp+Ch] [bp-20h]@1 + unsigned int pMapID; // eax@14 int v19; // [sp+10h] [bp-1Ch]@1 int v20; // [sp+14h] [bp-18h]@1 - char *v21; // [sp+18h] [bp-14h]@1 unsigned int pY; // [sp+1Ch] [bp-10h]@1 - int v23; // [sp+20h] [bp-Ch]@1 - int v24; // [sp+24h] [bp-8h]@1 - int pX; // [sp+28h] [bp-4h]@1 + unsigned int pX; // [sp+28h] [bp-4h]@1 - v24 = pParty->vPosition.x; - v0 = pParty->vPosition.y; - v1 = pOutdoor->uNumBModels; - *(float *)&v23 = (double)(signed int)viewparams->uMinimapZoom * 0.000015258789; - v2 = 0; - v18 = pOutdoor->uNumBModels; - v21 = 0; - pMouse->GetClickPos((unsigned int *)&pX, &pY); - v3 = 1.0 / *(float *)&v23; - v23 = pX - 557; - v19 = (signed __int64)((double)(pX - 557) * v3 + (double)v24); - v20 = (signed __int64)((double)v0 - (double)(signed int)(pY - 74) * v3); - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || (*(float *)&v23 = 0.0, (signed int)v1 <= 0) ) + result = 0; + pMouse->GetClickPos(&pX, &pY); + v3 = 1.0 / (float)((signed int)viewparams->uMinimapZoom * 0.000015258789); + v19 = (signed __int64)((double)(pX - 557) * v3 + (double)pParty->vPosition.x); + v20 = (signed __int64)((double)pParty->vPosition.y - (double)(pY - 74) * v3); + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || pOutdoor->uNumBModels <= 0 ) { -LABEL_14: - v17 = pMapStats->GetMapInfo(pCurrentMapName); - if ( v17 == v2 ) + pMapID = pMapStats->GetMapInfo(pCurrentMapName); + if ( pMapID == 0 ) result = "No Maze Info for this maze on file!"; else - result = pMapStats->pInfos[v17].pName; + result = pMapStats->pInfos[pMapID].pName; } else { - v4 = 0; - while ( 1 ) + for ( uint j = 0; j < (signed int)pOutdoor->uNumBModels; ++j ) { - pX = pOutdoor->pBModels[v4].vBoundingCenter.x - v19; - pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20; - v5 = abs((signed)pY); - v6 = abs((signed)pX); - v7 = int_get_vector_length(v6, v5, v2); - v8 = &pOutdoor->pBModels[0]; - if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius ) + v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - v19), + abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - v20), 0); + if ( v7 < 2 * pOutdoor->pBModels[j].sBoundingRadius ) { - v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2); - v9 = pOutdoor->pBModels[v4].uNumFaces == v2; - v10 = ((pOutdoor->pBModels[v4].uNumFaces - v2) & 0x80000000u) != 0; - v24 = v2; - if ( !((unsigned __int8)(v10 ^ v11) | v9) ) + if ( pOutdoor->pBModels[j].uNumFaces ) { - do + for ( uint i = 0; i < (signed int)pOutdoor->pBModels[j].uNumFaces; ++i ) { - v12 = &v8[v4].pFaces[v2 / 0x134u]; - v13 = v12->sCogTriggeredID; - if ( v13 ) + pFace = &pOutdoor->pBModels[j].pFaces[i]; + if ( pFace->sCogTriggeredID ) { - if ( !(BYTE2(v12->uAttributes) & 0x10) ) + if ( !(BYTE2(pFace->uAttributes) & 0x10) ) { - v14 = GetEventHintString(v13); - v15 = v14; + v14 = GetEventHintString(pFace->sCogTriggeredID); if ( v14 ) { if ( _stricmp(v14, "") ) - v21 = (char *)v15; + result = (char *)v14; } } } - ++v24; - v8 = pOutdoor->pBModels; - v2 += 308; } - while ( v24 < (signed int)pOutdoor->pBModels[v4].uNumFaces ); } - result = v21; - v2 = 0; - if ( v21 ) - break; + if ( result ) + return result; } - ++v23; - ++v4; - if ( v23 >= (signed int)v18 ) - goto LABEL_14; } + pMapID = pMapStats->GetMapInfo(pCurrentMapName); + if ( pMapID == 0 ) + result = "No Maze Info for this maze on file!"; + else + result = pMapStats->pInfos[pMapID].pName; + return result; } return result; } - - - - //----- (0041D3B7) -------------------------------------------------------- void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player) { - //Player *pPlayer; // esi@1 - int v6; // eax@5 - int v7; // ebx@5 - //unsigned int v8; // ecx@5 - int v9; // ebx@5 - //unsigned int v10; // eax@5 - //int v11; // eax@5 - //unsigned int v12; // ecx@5 Texture *v13; // eax@6 - unsigned int v14; // eax@12 PlayerFrame *v15; // eax@12 - //unsigned int v16; // eax@15 - unsigned int v20; // eax@15 - unsigned int v24; // eax@15 - unsigned int v25; // eax@15 - unsigned __int8 v28; // al@15 + unsigned int pTextColor; // eax@15 char *v29; // eax@16 - __int64 v35; // ST38_8@22 int v36; // esi@22 - unsigned int v38; // eax@22 char *v39; // eax@24 signed int uFramesetID; // [sp+20h] [bp-8h]@9 int uFramesetIDa; // [sp+20h] [bp-8h]@18 @@ -958,12 +787,9 @@ if (player->pPlayerBuffs[i].uExpireTime > 0) ++numActivePlayerBuffs; - v6 = pFontArrus->uFontHeight + 162; - v7 = (numActivePlayerBuffs - 1) * pFontArrus->uFontHeight; - v9 = v6 + v7; - window->uFrameHeight = v9; + window->uFrameHeight = ((pFontArrus->uFontHeight + 162) + ((numActivePlayerBuffs - 1) * pFontArrus->uFontHeight)); window->uFrameZ = window->uFrameWidth + window->uFrameX - 1; - window->uFrameW = v9 + window->uFrameY - 1; + window->uFrameW = ((pFontArrus->uFontHeight + 162) + ((numActivePlayerBuffs - 1) * pFontArrus->uFontHeight)) + window->uFrameY - 1; window->DrawMessageBox(0); if (player->IsEradicated()) @@ -976,14 +802,9 @@ if ( !uFramesetID ) uFramesetID = 1; if ( player->expression == CHARACTER_EXPRESSION_21) - { v15 = pPlayerFrameTable->GetFrameBy_y(&player->_expression21_frameset, &player->_expression21_animtime, pMiscTimer->uTimeElapsed); - } else - { - v14 = pMiscTimer->Time(); - v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, v14); - } + v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, pMiscTimer->Time()); player->field_1AA2 = v15->uTextureID - 1; v13 = pTextures_PlayerFaces[(unsigned int)window->ptr_1C][v15->uTextureID - 1]; } @@ -995,27 +816,23 @@ strcat(pTmpBuf.data(), pTmpBuf2.data()); strcat(pTmpBuf.data(), "\f00000\n"); - v20 = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth()); - sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", - pGlobalTXT_LocalizationStrings[108], // "Hit Points" - v20, player->sHealth, player->GetMaxHealth()); + pTextColor = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth()); + sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[108], // "Hit Points" + pTextColor, player->sHealth, player->GetMaxHealth()); strcat(pTmpBuf.data(), pTmpBuf2.data()); - v24 = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana()); - sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", - pGlobalTXT_LocalizationStrings[212], // "Spell Points" - v24, player->sMana, player->GetMaxMana()); + pTextColor = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana()); + sprintfex(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[212], // "Spell Points" + pTextColor, player->sMana, player->GetMaxMana()); strcat(pTmpBuf.data(), pTmpBuf2.data()); - v25 = player->GetMajorConditionIdx(); - sprintfex(pTmpBuf2.data(), "%s: \f%05d%s\f00000\n", - pGlobalTXT_LocalizationStrings[47], // "Condition - GetConditionDrawColor(v25), aCharacterConditionNames[v25]); + pTextColor = player->GetMajorConditionIdx(); + sprintfex(pTmpBuf2.data(), "%s: \f%05d%s\f00000\n", pGlobalTXT_LocalizationStrings[47], // "Condition + GetConditionDrawColor(pTextColor), aCharacterConditionNames[pTextColor]); strcat(pTmpBuf.data(), pTmpBuf2.data()); - v28 = player->uQuickSpell; - if ( v28 ) - v29 = pSpellStats->pInfos[v28].pShortName; + if ( player->uQuickSpell ) + v29 = pSpellStats->pInfos[player->uQuickSpell].pShortName; else v29 = pGlobalTXT_LocalizationStrings[153]; sprintfex(pTmpBuf2.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v29); // "Quick Spell" @@ -1029,11 +846,9 @@ auto buff = player->pPlayerBuffs + i; if (buff->uExpireTime > 0) { - v35 = buff->uExpireTime - pParty->uTimePlayed; v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134; - v38 = ui_game_character_record_playerbuff_colors[i]; - window->DrawText(pFontComic, 52, v36, v38, aSpellNames[20 + i], 0, 0, 0); - sub_41D20D_buff_remaining_time_string(v36, window, v35, pFontComic); + window->DrawText(pFontComic, 52, v36, ui_game_character_record_playerbuff_colors[i], aSpellNames[20 + i], 0, 0, 0); + sub_41D20D_buff_remaining_time_string(v36, window, buff->uExpireTime - pParty->uTimePlayed, pFontComic); } } @@ -1044,186 +859,119 @@ window->DrawText(pFontArrus, 14, 114, 0, pTmpBuf.data(), 0, 0, 0); } - - //----- (0041A57E) -------------------------------------------------------- void GameUI_QuickRef_Draw() { - //unsigned int v0; // ebx@1 - //unsigned int v1; // eax@1 - //Player *pPlayer; // ebp@2 - //int v3; // eax@6 - //int v4; // edi@6 - unsigned int v5; // eax@7 - unsigned int v6; // edi@9 - unsigned int v7; // edi@11 - //signed int v8; // eax@13 - unsigned int v9; // eax@13 - unsigned int v10; // edi@13 - //int v11; // eax@15 - unsigned int v12; // eax@15 - unsigned int v13; // edi@15 - //int v14; // eax@17 - //int v15; // ST18_4@17 - //int v16; // ebx@17 - //int v17; // eax@17 - unsigned int v18; // eax@17 - unsigned int v19; // edi@17 - //int v20; // eax@19 - unsigned int v21; // edi@19 - char *v22; // eax@21 - unsigned int v23; // edi@21 - //int v24; // eax@23 - unsigned int v25; // edi@23 - char *v26; // eax@25 - unsigned int v27; // edi@25 - int v28; // ecx@27 - char *v29; // eax@27 - signed int v30; // edx@27 - unsigned int v31; // edi@31 - unsigned int v32; // edi@33 - const char *v33; // ST10_4@35 - unsigned int v34; // eax@35 - unsigned int v35; // edi@35 - //unsigned __int8 v36; // al@37 - char *v37; // eax@38 - int v38; // eax@41 - signed int v39; // edi@42 - //char *v40; // eax@45 - //unsigned int v41; // eax@45 - signed int v43; // [sp+10h] [bp-1Ch]@1 - unsigned int v44; // [sp+14h] [bp-18h]@2 - int v45; // [sp+18h] [bp-14h]@1 - //unsigned int v46; // [sp+1Ch] [bp-10h]@1 - //unsigned int v47; // [sp+20h] [bp-Ch]@1 - unsigned int v48; // [sp+24h] [bp-8h]@33 - //unsigned int v49; // [sp+28h] [bp-4h]@1 + unsigned int pTextColor; // eax@7 + unsigned int pX; // [sp+14h] [bp-18h]@2 + unsigned int pY; // edi@9 + int pSkillsCount; // ecx@27 + char *pText; // eax@38 + int pFontHeight; // [sp+18h] [bp-14h]@1 - //v0 = 0; - //v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - //v49 = TargetColor(0xFFu, 0, 0); - //v46 = TargetColor(0, 0xFFu, 0); - //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE); pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); - v43 = 0; - v45 = LOBYTE(pFontArrus->uFontHeight) + 1; - do - { - auto player = &pParty->pPlayers[v43]; - v44 = 94 * v43 + 89; - if ( v43 == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, ui_character_header_text_color, player->pName, 84, 0); - if ( v43 == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //. - sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel()); - if ( player->GetActualLevel() <= player->GetBaseLevel()) - v5 = player->GetExperienceDisplayColor(); - else - v5 = ui_character_bonus_text_color; - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf.data(), 84, 0); - v6 = v45 + 47; - if ( v43 == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);// - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, 0, pClassNames[player->classType], 84, 0); - v7 = v45 + v6; - if ( v43 == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//. - sprintf(pTmpBuf.data(), "%d", player->sHealth); - v9 = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf.data(), 84, 0); - v10 = v45 + v7; - if ( v43 == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);// - sprintf(pTmpBuf.data(), "%d", player->sMana); - v12 = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf.data(), 84, 0); - v13 = v45 + v10; - if ( v43 == 0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);// - sprintf(pTmpBuf.data(), "%d", player->GetActualAC()); - v18 = UI_GetHealthManaStringColor(player->GetActualAC(), player->GetBaseAC()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf.data(), 84, 0); - v19 = v45 + v13; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);// - sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(0)); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf.data(), 84, 0); - v21 = v45 + v19; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//. - v22 = player->GetMeleeDamageString(); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0); - v23 = v45 + v21; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// - sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack()); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf.data(), 84, 0); - v25 = v45 + v23; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//. - v26 = player->GetRangedDamageString(); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0); - v27 = v45 + v25; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);// - v28 = 0; - v29 = (char *)player->pActiveSkills; - v30 = 36; - do - { - if ( *(short *)v29 ) - ++v28; - v29 += 2; - --v30; - } - while ( v30 ); - sprintf(pTmpBuf.data(), "%lu", v28); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf.data(), 84, 0); - v31 = v45 + v27; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);// - sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0); - v32 = v45 + v31; - v48 = player->GetMajorConditionIdx(); - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//. - v33 = aCharacterConditionNames[v48]; - v34 = GetConditionDrawColor(v48); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0); - v35 = v45 + v32; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//.. - if (player->uQuickSpell) - v37 = pSpellStats->pInfos[player->uQuickSpell].pShortName; - else - v37 = pGlobalTXT_LocalizationStrings[153];// - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0); - ++v43; - } - while ( v43 < 4 ); + pFontHeight = LOBYTE(pFontArrus->uFontHeight) + 1; + for ( uint i = 0; i < 4; ++i ) + { + auto player = &pParty->pPlayers[i]; + pX = 94 * i + 89; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 18, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * i + 89, 18, ui_character_header_text_color, player->pName, 84, 0); + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, 47, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //. + sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel()); + if ( player->GetActualLevel() <= player->GetBaseLevel()) + pTextColor = player->GetExperienceDisplayColor(); + else + pTextColor = ui_character_bonus_text_color; + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, 47, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + 47; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pFontHeight + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);// + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pClassNames[player->classType], 84, 0); + pY = pFontHeight + pY; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//. + sprintf(pTmpBuf.data(), "%d", player->sHealth); + pTextColor = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);// + sprintf(pTmpBuf.data(), "%d", player->sMana); + pTextColor = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( i == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);// + sprintf(pTmpBuf.data(), "%d", player->GetActualAC()); + pTextColor = UI_GetHealthManaStringColor(player->GetActualAC(), player->GetBaseAC()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);// + sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(0)); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetMeleeDamageString(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// + sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, player->GetRangedDamageString(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);// + pSkillsCount = 0; + for ( uint j = 0; j <= 36; ++j ) + { + if ( player->pActiveSkills[j] ) + ++pSkillsCount; + } + sprintf(pTmpBuf.data(), "%lu", pSkillsCount); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);// + sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//. + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, aCharacterConditionNames[player->GetMajorConditionIdx()], 84, 0); + pY = pFontHeight + pY; + if ( !i ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 22, pY, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//.. + if (player->uQuickSpell) + pText = pSpellStats->pInfos[player->uQuickSpell].pShortName; + else + pText = pGlobalTXT_LocalizationStrings[153];// + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, 0, pText, 84, 0); + } - v38 = GetPartyReputation(); - if ( v38 >= 0 ) - { - if ( v38 <= 5 ) - v39 = ui_character_default_text_color; - else - v39 = ui_character_bonus_text_color_neg; - } - else - v39 = ui_character_bonus_text_color; + if ( GetPartyReputation() >= 0 ) + { + if ( GetPartyReputation() <= 5 ) + pTextColor = ui_character_default_text_color; + else + pTextColor = ui_character_bonus_text_color_neg; + } + else + pTextColor = ui_character_bonus_text_color; - sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, GetReputationString(v38));//Reputation - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0); - - sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0); + sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], pTextColor, GetReputationString(GetPartyReputation()));//Reputation + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0); + sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0); } - - //----- (0041AD6E) -------------------------------------------------------- void GameUI_DrawRightPanelItems() { @@ -1265,69 +1013,52 @@ } } - //----- (0041B0C9) -------------------------------------------------------- void GameUI_DrawLifeManaBars() { double v3; // st7@3 double v7; // st7@25 - Texture *v9; // [sp-4h] [bp-30h]@10 - Texture *v10; // [sp+Ch] [bp-20h]@1 + Texture *pTextureHealth; // [sp-4h] [bp-30h]@10 + Texture *pTextureMana; // [sp+Ch] [bp-20h]@1 - - v10 = pIcons_LOD->GetTexture(uTextureID_BarBlue); - + pTextureMana = pIcons_LOD->GetTexture(uTextureID_BarBlue); for (uint i = 0; i < 4; ++i) { - auto player = pParty->pPlayers + i; - - if (player->sHealth > 0) - { + if (pParty->pPlayers[i].sHealth > 0) + { int v17 = 0; if (i == 2 || i == 3) v17 = 2; - - v3 = (double)player->sHealth / (double)player->GetMaxHealth(); + v3 = (double)pParty->pPlayers[i].sHealth / (double)pParty->pPlayers[i].GetMaxHealth(); if( v3 > 0.5 ) { if ( v3 > 1.0 ) v3 = 1.0; - v9 = pIcons_LOD->GetTexture(uTextureID_BarGreen); + pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarGreen); } else if ( v3 > 0.25 ) - v9 = pIcons_LOD->GetTexture(uTextureID_BarYellow); + pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarYellow); else if ( v3 > 0.0 ) - v9 = pIcons_LOD->GetTexture(uTextureID_BarRed); - - - if( v3 > 0.0 ) - { - pRenderer->SetTextureClipRect(v17 + pHealthBarPos[i], - (signed __int64)((1.0 - v3) * v9->uTextureHeight) + 402, - v17 + pHealthBarPos[i] + v9->uTextureWidth, - v9->uTextureHeight + 402); - - pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[i], 402, v9); - pRenderer->ResetTextureClipRect(); - } - } - - - if (player->sMana > 0) + pTextureHealth = pIcons_LOD->GetTexture(uTextureID_BarRed); + if( v3 > 0.0 ) + { + pRenderer->SetTextureClipRect(v17 + pHealthBarPos[i], (signed __int64)((1.0 - v3) * pTextureHealth->uTextureHeight) + 402, + v17 + pHealthBarPos[i] + pTextureHealth->uTextureWidth, pTextureHealth->uTextureHeight + 402); + pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[i], 402, pTextureHealth); + pRenderer->ResetTextureClipRect(); + } + } + if (pParty->pPlayers[i].sMana > 0) { - v7 = player->sMana / (double)player->GetMaxMana(); + v7 = pParty->pPlayers[i].sMana / (double)pParty->pPlayers[i].GetMaxMana(); if ( v7 > 1.0 ) v7 = 1.0; - int v17 = 0; if (i == 2) v17 = 1; - - pRenderer->SetTextureClipRect(v17 + pManaBarPos[i], - (signed __int64)((1.0 - v7) * v10->uTextureHeight) + 402, - v17 + pManaBarPos[i] + v10->uTextureWidth, - v10->uTextureHeight + 402); - pRenderer->DrawTextureIndexed(v17 + pManaBarPos[i], 402, v10); + pRenderer->SetTextureClipRect(v17 + pManaBarPos[i], (signed __int64)((1.0 - v7) * pTextureMana->uTextureHeight) + 402, + v17 + pManaBarPos[i] + pTextureMana->uTextureWidth, pTextureMana->uTextureHeight + 402); + pRenderer->DrawTextureIndexed(v17 + pManaBarPos[i], 402, pTextureMana); pRenderer->ResetTextureClipRect(); } } @@ -1336,8 +1067,7 @@ //----- (0041B3B6) -------------------------------------------------------- void GameUI_DrawRightPanel() { - pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, - pIcons_LOD->GetTexture(uTextureID_right_panel)); + pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); } //----- (0041B3E2) -------------------------------------------------------- @@ -1351,12 +1081,11 @@ GameUI_DrawRightPanelItems(); } - //----- (0041C047) -------------------------------------------------------- void GameUI_Footer_2() { - char *v1; // edx@2 - int v5; // eax@5 + char *v1; // edx@2 + int v5; // eax@5 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); if (GameUI_Footer_TimeLeft) @@ -1375,88 +1104,63 @@ //----- (0041C0B8) -------------------------------------------------------- void GameUI_SetFooterString(const char *pStr) { - const char *v1; // esi@1 - int i; // eax@7 - int j; // eax@11 + const char *v1; // esi@1 - v1 = pStr; - if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1) && (*v1 || GameUI_Footer_TimeLeft) ) - { - if ( GameUI_Footer_TimeLeft ) - { - for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); - i > 450; - i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) - GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; - } - else - { - strcpy(pFooterString.data(), v1); - for ( j = pFontLucida->GetLineWidth(pFooterString.data()); - j > 450; - j = pFontLucida->GetLineWidth(pFooterString.data()) ) - pFooterString[strlen(pFooterString.data()) - 1] = 0; - } - } + v1 = pStr; + if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(pStr, 1) && (*v1 || GameUI_Footer_TimeLeft) ) + { + if ( GameUI_Footer_TimeLeft ) + { + for ( int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450; i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) + GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; } + else + { + strcpy(pFooterString.data(), v1); + for ( int j = pFontLucida->GetLineWidth(pFooterString.data()); j > 450; j = pFontLucida->GetLineWidth(pFooterString.data()) ) + pFooterString[strlen(pFooterString.data()) - 1] = 0; + } + } +} //----- (0041C179) -------------------------------------------------------- void GameUI_Footer() { - //unsigned int v0; // ebp@1 - char *v1; // edi@5 - int v2; // eax@5 - unsigned int v3; // esi@5 - size_t v4; // eax@6 - GUIFont *v5; // ecx@6 - int v6; // eax@9 - size_t v7; // eax@10 - GUIFont *v8; // ecx@10 - char v9; // zf@12 - //unsigned int v10; // ST08_4@13 - int v11; // eax@13 + char *v1; // edi@5 + int v2; // eax@5 + int v6; // eax@9 + char v9; // zf@12 - if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter ) - { - pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); - if ( GameUI_Footer_TimeLeft ) - { - v1 = GameUI_Footer_TimedString.data(); - v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); - v3 = 450; - while ( v2 > 450 ) - { - v4 = strlen(GameUI_Footer_TimedString.data()); - v5 = pFontLucida; - GameUI_Footer_TimedString[v4 - 1] = 0; - v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); - } - } - else - { - v1 = pFooterString.data(); - v6 = pFontLucida->GetLineWidth(pFooterString.data()); - v3 = 450; - while ( v6 > 450 ) - { - v7 = strlen(pFooterString.data()); - v8 = pFontLucida; - pFooterString[v7 - 1] = 0; - v6 = pFontLucida->GetLineWidth(pFooterString.data()); - } - } - v9 = *v1 == 0; - bForceDrawFooter = 0; - if ( !v9 ) - { - v11 = pFontLucida->AlignText_Center(v3, v1); - pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); - } - } + if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter ) + { + pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); + if ( GameUI_Footer_TimeLeft ) + { + v1 = GameUI_Footer_TimedString.data(); + v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); + while ( v2 > 450 ) + { + GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; + v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); + } } + else + { + v1 = pFooterString.data(); + v6 = pFontLucida->GetLineWidth(pFooterString.data()); + while ( v6 > 450 ) + { + pFooterString[strlen(pFooterString.data()) - 1] = 0; + v6 = pFontLucida->GetLineWidth(pFooterString.data()); + } + } + v9 = *v1 == 0; + bForceDrawFooter = 0; + if ( !v9 ) + pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, v1) + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); + } +} // 5C35BC: using guessed type int bForceDrawFooter; - - //----- (00420EFF) -------------------------------------------------------- void GameUI_WritePointedObjectStatusString() { @@ -1471,7 +1175,6 @@ unsigned __int8 v9; // c0@23 unsigned __int8 v10; // c3@23 enum UIMessageType pMessageType1; // esi@24 - //int v12; // edx@25 char *v13; // ecx@28 int v14; // eax@41 ItemGen *pItemGen; // ecx@44 @@ -1493,12 +1196,8 @@ signed int v30; // ecx@88 const char *v31; // eax@91 __int16 v32; // fps@109 - //unsigned __int8 v33; // c0@109 - //unsigned __int8 v34; // c3@109 enum UIMessageType pMessageType2; // esi@110 - //int v36; // edx@111 enum UIMessageType pMessageType3; // edx@117 - //int v38; // ecx@118 const char *v39; // [sp-8h] [bp-E8h]@20 char *v40; // [sp-8h] [bp-E8h]@83 int v41; // [sp-4h] [bp-E4h]@20 @@ -1508,7 +1207,6 @@ unsigned int v45; // [sp+DCh] [bp-4h]@21 v13 = nullptr; - pMouse->uPointingObjectID = 0; pMouse->GetClickPos(&pX, &pY); if ( pX < 0 || (signed int)pX > 639 || pY < 0 || (signed int)pY > 479 )//( (pX & 0x80000000u) != 0 || (signed int)pX > 639 || (pY & 0x80000000u) != 0 || (signed int)pY > 479 ) @@ -1526,7 +1224,6 @@ || (signed int)pY > (signed int)pViewport->uScreen_BR_Y ) v18 = -1; if ( v18 == -1 ) - //goto LABEL_61; { pMouse->uPointingObjectID = 0; if ( pMouse->uPointingObjectID == 0 ) @@ -1542,19 +1239,15 @@ } } else - { v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; - } pMouse->uPointingObjectID = (unsigned __int16)v18; v19 = (signed)PID_ID(v18); if (PID_TYPE(v18) == OBJECT_Item) { v30 = v19; if ( pObjectList->pObjects[pSpriteObjects[v30].uObjectDescID].uFlags & 0x10 ) - //goto LABEL_73; { pMouse->uPointingObjectID = 0; - //goto LABEL_50; uLastPointedObjectID = 1; if ( pMouse->uPointingObjectID == 0 ) { @@ -1570,10 +1263,7 @@ if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) { v22 = pSpriteObjects[v30].stru_24.GetDisplayName(); -//LABEL_93: - v26 = v22; - //goto LABEL_87; - GameUI_SetFooterString(v26); + GameUI_SetFooterString(v22); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1604,7 +1294,6 @@ v26 = pNPCTopics[stru_5E4C90._decor_events[v24->_idx_in_stru123 - 75] + 379].pTopic; else v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; - //goto LABEL_87; GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { @@ -1619,7 +1308,6 @@ } v22 = GetEventHintString(v25); if ( !v22 ) - //goto _return; { if ( pMouse->uPointingObjectID == 0 ) { @@ -1632,10 +1320,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - //goto LABEL_93; - v26 = v22; - //goto LABEL_87; - GameUI_SetFooterString(v26); + GameUI_SetFooterString(v22); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1653,14 +1338,11 @@ { if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { - v18b = (signed int)(unsigned __int16)v18 >> 9; + v18b = (signed int)(unsigned __int16)v18 >> 9; v21 = pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID; - //goto LABEL_71; if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) - //goto LABEL_73; { pMouse->uPointingObjectID = 0; - //goto LABEL_50; uLastPointedObjectID = 1; if ( pMouse->uPointingObjectID == 0 ) { @@ -1673,10 +1355,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - //goto LABEL_93; - v26 = v22; - //goto LABEL_87; - GameUI_SetFooterString(v26); + GameUI_SetFooterString(v22); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1692,12 +1371,9 @@ if ( BYTE3(pFace->uAttributes) & 6 ) { v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; -//LABEL_71: if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) - //goto LABEL_73; { pMouse->uPointingObjectID = 0; - //goto LABEL_50; uLastPointedObjectID = 1; if ( pMouse->uPointingObjectID == 0 ) { @@ -1710,10 +1386,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - //goto LABEL_93; - v26 = v22; - //goto LABEL_87; - GameUI_SetFooterString(v26); + GameUI_SetFooterString(v22); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1726,9 +1399,7 @@ return; } } -//LABEL_73: pMouse->uPointingObjectID = 0; - //goto LABEL_50; uLastPointedObjectID = 1; if ( pMouse->uPointingObjectID == 0 ) { @@ -1741,9 +1412,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } -//LABEL_61: pMouse->uPointingObjectID = 0; - //goto _return; if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1756,7 +1425,6 @@ return; } if ( v18 >= 335544320 ) - //goto LABEL_61; { pMouse->uPointingObjectID = 0; if ( pMouse->uPointingObjectID == 0 ) @@ -1780,9 +1448,7 @@ strncpy(pTmpBuf.data(), v40, 0x7D0u); } v26 = v28; -//LABEL_87: GameUI_SetFooterString(v26); - //goto _return; if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1816,17 +1482,13 @@ && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) { - //LABEL_24: pMessageType1 = (UIMessageType)pButton->field_1C; if ( pMessageType1 ) { pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); } - //LABEL_28: v13 = pButton->pButtonName; - //_set_status_and_ret: GameUI_SetFooterString(v13); - //LABEL_131: uLastPointedObjectID = 1; return; } @@ -1862,7 +1524,6 @@ && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) { - //LABEL_19: pPlayer = pPlayers[uActiveCharacter]; v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]); v6 = pPlayer->uSkillPoints; @@ -1879,7 +1540,6 @@ } sprintf(Str1, v39, v41); v13 = Str1; - //goto _set_status_and_ret; GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; @@ -1902,7 +1562,6 @@ if ( pCurrentScreen == SCREEN_CHEST ) { ChestUI_WritePointedObjectStatusString(); - //goto _return; if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1919,7 +1578,6 @@ if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) || v16 == -65536 ) - //goto _return; { if ( pMouse->uPointingObjectID == 0 ) { @@ -1933,12 +1591,9 @@ return; } pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); -//LABEL_49: v17 = pItemGen->GetDisplayName(); GameUI_SetFooterString(v17); -//LABEL_50: uLastPointedObjectID = 1; -//_return: if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1954,7 +1609,6 @@ { v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; if ( v14 == 0 || v14 == -65536 || (unsigned int)v14 >= 0x1388 ) - //goto _return; { if ( pMouse->uPointingObjectID == 0 ) { @@ -1968,7 +1622,6 @@ return; } pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; - //goto LABEL_49; v17 = pItemGen->GetDisplayName(); GameUI_SetFooterString(v17); uLastPointedObjectID = 1; @@ -2000,7 +1653,6 @@ { pMessageType3 = (UIMessageType)pButton->field_1C; if ( pMessageType3 == 0 ) // For books - //goto LABEL_28; { v13 = pButton->pButtonName; GameUI_SetFooterString(v13); @@ -2009,7 +1661,6 @@ } pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0); - //goto LABEL_131; uLastPointedObjectID = 1; return; } @@ -2034,7 +1685,6 @@ if ( pMessageType2 != 0 ) pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0); - //goto LABEL_28; v13 = pButton->pButtonName; GameUI_SetFooterString(v13); uLastPointedObjectID = 1; @@ -2050,7 +1700,6 @@ && (signed int)pX <= (signed int)pButton->uZ && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW ) - //goto LABEL_19; { pPlayer = pPlayers[uActiveCharacter]; v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]); @@ -2068,7 +1717,6 @@ } sprintf(Str1, v39, v41); v13 = Str1; - //goto _set_status_and_ret; GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; @@ -2078,7 +1726,6 @@ } } pMouse->uPointingObjectID = sub_46A99B(); - //goto _return; if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -2092,7 +1739,6 @@ } } - //----- (0044158F) -------------------------------------------------------- void GameUI_DrawCharacterSelectionFrame() { @@ -2101,22 +1747,12 @@ pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame)); } - - //----- (0044162D) -------------------------------------------------------- void GameUI_DrawPartySpells() { unsigned int v0; // ebp@1 - //signed int v1; // edi@1 - //int v2; // eax@2 - //int v3; // ecx@5 - //__int16 *v4; // ebx@25 - //Player *v5; // edi@26 - //unsigned int v6; // [sp-4h] [bp-1Ch]@11 Texture *v7; // [sp-4h] [bp-1Ch]@12 - //unsigned int v8; // [sp-4h] [bp-1Ch]@20 Texture *v9; // [sp-4h] [bp-1Ch]@21 - //Player **v10; // [sp+10h] [bp-8h]@25 v0 = (signed __int64)((double)GetTickCount() * 0.050000001); //v1 = 0; @@ -2176,8 +1812,6 @@ } } - - //----- (004921C1) -------------------------------------------------------- void GameUI_DrawPortraits(unsigned int _this) {
--- a/mm7_2.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/mm7_2.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -443,7 +443,7 @@ pRenderer->uTargetGMask | pRenderer->uTargetBMask); auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); - pRenderer->_4A6A68(8, 352 - v0, pTex, pTex->uTextureHeight - v0); + pRenderer->GetLeather(8, 352 - v0, pTex, pTex->uTextureHeight - v0); pRenderer->DrawTextureIndexed(8u, 347 - v0, pTexture_591428); v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);
--- a/mm7_3.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/mm7_3.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -7203,7 +7203,7 @@ v6 = uCog; if ( (signed int)uNumLevelDecorations > 0 ) { - v4 = (char *)&pLevelDecorations[0].field_2; + v4 = (char *)&pLevelDecorations[0].uFlags; do { if ( *((_WORD *)v4 + 9) == v6 )
--- a/mm7_4.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/mm7_4.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -99,7 +99,7 @@ v32 = v1->vPosition.y; v35 = v1->vPosition.z; v31 = v1->field_18; - if ( v1->field_2 & 1 ) + if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_TOUCH) { v36 = abs(v1->vPosition.x - pParty->vPosition.x); v25 = abs(v3 - pParty->vPosition.y); @@ -127,7 +127,7 @@ if ( (signed int)(((unsigned int)(11 * v5) >> 5) + (v6 >> 2) + v4) < v2 ) EventProcessor(v1->field_16_event_id, PID(OBJECT_Decoration,i), 1); } - if ( v1->field_2 & 2 ) + if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_MONSTER) { v37 = 0; if ( (signed int)uNumActors > 0 ) @@ -167,7 +167,7 @@ while ( v37 < (signed int)uNumActors ); } } - if ( v1->field_2 & 4 ) + if (v1->uFlags & LEVEL_DECORATION_TRIGGERED_BY_OBJECT) { v38 = 0; if ( (signed int)uNumSpriteObjects > 0 ) @@ -466,7 +466,7 @@ for ( i = 0; i < v0->uNumDecorations; ++i ) { v1 = &pLevelDecorations[v0->pDecorationIDs[i]]; - if ( !(v1->field_2 & 0x20) ) + if (!(v1->uFlags & LEVEL_DECORATION_INVISIBLE)) { v2 = &pDecorationList->pDecorations[v1->uDecorationDescID]; if (!v2->CanMoveThrough())
--- a/mm7_5.cpp Mon Sep 02 12:03:25 2013 +0600 +++ b/mm7_5.cpp Mon Sep 02 12:03:40 2013 +0600 @@ -4316,14 +4316,14 @@ //----- (004070EF) -------------------------------------------------------- -bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID) +bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID) { signed int v2; // eax@1 - unsigned int v3; // ecx@1 - signed int v4; // esi@1 + //unsigned int v3; // ecx@1 + //signed int v4; // esi@1 int v5; // ecx@2 signed int v6; // eax@4 - int v7; // eax@4 + int object1_sector; // eax@4 float v8; // ST24_4@5 double v9; // ST18_8@5 signed int v10; // eax@6 @@ -4333,18 +4333,18 @@ int v14; // esi@8 int v15; // esi@9 signed int v16; // eax@11 - int v17; // edi@11 - int v18; // esi@11 - int v19; // eax@13 + int obj2_z; // edi@11 + int obj2_x; // esi@11 + int obj2_sector; // eax@13 float v20; // ST24_4@14 double v21; // ST18_8@14 signed int v22; // eax@15 - int v23; // ebx@16 + int dist2_x; // ebx@16 signed int v24; // ecx@16 int v25; // eax@18 - int v26; // eax@28 - BLVSector *v27; // edx@31 - int v28; // ecx@31 + //int v26; // eax@28 + //BLVSector *v27; // edx@31 + //int v28; // ecx@31 BLVFace *v29; // ebx@32 Vec3_short_ *v30; // esi@32 int v31; // eax@32 @@ -4360,12 +4360,12 @@ __int16 v42; // bx@58 int v43; // [sp-8h] [bp-70h]@11 int v44; // [sp-4h] [bp-6Ch]@11 - int v45; // [sp+Ch] [bp-5Ch]@32 - __int16 v46; // [sp+10h] [bp-58h]@32 + //int v45; // [sp+Ch] [bp-5Ch]@32 + //__int16 v46; // [sp+10h] [bp-58h]@32 int v47; // [sp+18h] [bp-50h]@20 int v48; // [sp+1Ch] [bp-4Ch]@20 int v49; // [sp+20h] [bp-48h]@20 - int v50; // [sp+24h] [bp-44h]@16 + int dist2_z; // [sp+24h] [bp-44h]@16 signed int v51; // [sp+24h] [bp-44h]@27 signed int v52; // [sp+28h] [bp-40h]@26 signed int v53; // [sp+2Ch] [bp-3Ch]@23 @@ -4375,101 +4375,85 @@ signed int v57; // [sp+3Ch] [bp-2Ch]@28 int v58; // [sp+44h] [bp-24h]@50 int v59; // [sp+48h] [bp-20h]@44 - int v60; // [sp+50h] [bp-18h]@11 + int obj2_y; // [sp+50h] [bp-18h]@11 signed int v61; // [sp+50h] [bp-18h]@31 - int v62; // [sp+54h] [bp-14h]@16 - int v63; // [sp+58h] [bp-10h]@4 - int v64; // [sp+5Ch] [bp-Ch]@4 - int v65; // [sp+60h] [bp-8h]@4 + //int v62; // [sp+54h] [bp-14h]@16 + int obj_x; // [sp+58h] [bp-10h]@4 + int obj_y; // [sp+5Ch] [bp-Ch]@4 + int obj_z; // [sp+60h] [bp-8h]@4 int v66; // [sp+64h] [bp-4h]@7 v2 = PID_ID(uObjID); - v3 = PID_TYPE(uObjID) - 2; - v4 = uObj2ID; - if ( v3 ) + if ( PID_TYPE(uObjID) == 5 ) { - v5 = v3 - 1; - if ( v5 ) - { - if ( v5 != 2 ) - return 0; v6 = v2; - v63 = pLevelDecorations[v6].vPosition.x; - v64 = pLevelDecorations[v6].vPosition.y; - v65 = pLevelDecorations[v6].vPosition.z; - v7 = pIndoor->GetSector(v63, v64, v65); - } - else - { - v63 = pActors[v2].vPosition.x; - v64 = pActors[v2].vPosition.y; + obj_x = pLevelDecorations[v6].vPosition.x; + obj_y = pLevelDecorations[v6].vPosition.y; + obj_z = pLevelDecorations[v6].vPosition.z; + object1_sector = pIndoor->GetSector(obj_x, obj_y, obj_z); + } + else if ( PID_TYPE(uObjID) == 3 ) + { + obj_x = pActors[v2].vPosition.x; + obj_y = pActors[v2].vPosition.y; v8 = (double)pActors[v2].uActorHeight * 0.69999999; - v9 = v8 + 6.7553994e15; - v65 = LODWORD(v9) + pActors[v2].vPosition.z; - v7 = pActors[v2].uSectorID; - } + //v9 = v8 + 6.7553994e15; + //obj_z = LODWORD(v9) + pActors[v2].vPosition.z; + obj_z = (int)v8 + pActors[v2].vPosition.z; + object1_sector = pActors[v2].uSectorID; } - else + else if ( PID_TYPE(uObjID) == 2 ) { v10 = v2; - v63 = pSpriteObjects[v10].vPosition.x; - v64 = pSpriteObjects[v10].vPosition.y; - v11 = pSpriteObjects[v10].vPosition.z; - v7 = pSpriteObjects[v10].uSectorID; - v65 = v11; - } - v66 = v7; - v12 = PID_ID(v4); - v13 = PID_TYPE(v4) - 2; - if ( v13 ) - { - v14 = v13 - 1; - if ( v14 ) - { - v15 = v14 - 1; - if ( v15 ) - { - if ( v15 != 1 ) - return 0; - v16 = v12; - v17 = pLevelDecorations[v16].vPosition.z; - v18 = pLevelDecorations[v16].vPosition.x; - v44 = pLevelDecorations[v16].vPosition.z; - v60 = pLevelDecorations[v16].vPosition.y; - v43 = pLevelDecorations[v16].vPosition.y; - } - else - { - v18 = pParty->vPosition.x; - v17 = pParty->sEyelevel + pParty->vPosition.z; - v60 = pParty->vPosition.y; - v44 = pParty->sEyelevel + pParty->vPosition.z; - v43 = pParty->vPosition.y; - } - v19 = pIndoor->GetSector(v18, v43, v44); - } - else - { - v60 = pActors[v12].vPosition.y; - v18 = pActors[v12].vPosition.x; - v20 = (double)pActors[v12].uActorHeight * 0.69999999; - v21 = v20 + 6.7553994e15; - v17 = LODWORD(v21) + pActors[v12].vPosition.z; - v19 = pActors[v12].uSectorID; - } + obj_x = pSpriteObjects[v10].vPosition.x; + obj_y = pSpriteObjects[v10].vPosition.y; + obj_z = pSpriteObjects[v10].vPosition.z; + object1_sector = pSpriteObjects[v10].uSectorID; } else + return 0; + v66 = object1_sector; + v12 = PID_ID(uObj2ID); + if ( PID_TYPE(uObj2ID) == 5) + { + v16 = v12; + obj2_z = pLevelDecorations[v16].vPosition.z; + obj2_x = pLevelDecorations[v16].vPosition.x; + obj2_y = pLevelDecorations[v16].vPosition.y; + obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z); + } + else if ( PID_TYPE(uObj2ID) == 4) + { + obj2_x = pParty->vPosition.x; + obj2_z = pParty->sEyelevel + pParty->vPosition.z; + obj2_y = pParty->vPosition.y; + obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z); + } + + else if( PID_TYPE(uObj2ID) == 3) + { + obj2_y = pActors[v12].vPosition.y; + obj2_x = pActors[v12].vPosition.x; + v20 = (double)pActors[v12].uActorHeight * 0.69999999; + //v21 = v20 + 6.7553994e15; + //obj2_z = LODWORD(v21) + pActors[v12].vPosition.z; + obj2_z = (int)v20 + pActors[v12].vPosition.z; + obj2_sector = pActors[v12].uSectorID; + } + + else if ( PID_TYPE(uObj2ID) == 2) { v22 = v12; - v18 = pSpriteObjects[v22].vPosition.x; - v17 = pSpriteObjects[v22].vPosition.z; - v60 = pSpriteObjects[v22].vPosition.y; - v19 = pSpriteObjects[v22].uSectorID; + obj2_x = pSpriteObjects[v22].vPosition.x; + obj2_z = pSpriteObjects[v22].vPosition.z; + obj2_y = pSpriteObjects[v22].vPosition.y; + obj2_sector = pSpriteObjects[v22].uSectorID; } - v62 = v19; - v23 = v18 - v63; - v50 = v17 - v65; - v24 = integer_sqrt(v23 * v23 + (v60 - v64) * (v60 - v64) + v50 * v50); + else + return 0; + dist2_x = obj2_x - obj_x; + dist2_z = obj2_z - obj_z; + v24 = integer_sqrt(dist2_x * dist2_x + (obj2_y - obj_y) * (obj2_y - obj_y) + dist2_z * dist2_z); if ( v24 > 5120 ) return 0; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) @@ -4477,120 +4461,116 @@ v25 = 65536; if ( v24 ) v25 = 65536 / v24; - v49 = v23 * v25; - v47 = v50 * v25; - v48 = (v60 - v64) * v25; - v56 = v63; - if ( v63 < v18 ) + v49 = dist2_x * v25; + v47 = dist2_z * v25; + v48 = (obj2_y - obj_y) * v25; + if ( obj_x < obj2_x ) { - v55 = v18; + v56 = obj_x; + v55 = obj2_x; } else { - v56 = v18; - v55 = v63; + v56 = obj2_x; + v55 = obj_x; } - v54 = v64; - if ( v64 < v60 ) + if ( obj_y < obj2_y ) { - v53 = v60; + v54 = obj_y; + v53 = obj2_y; } else { - v54 = v60; - v53 = v64; + v54 = obj2_y; + v53 = obj_y; } - v52 = v65; - if ( v65 < v17 ) + if ( obj_z < obj2_z ) { - v51 = v17; + v52 = obj_z; + v51 = obj2_z; } else { - v52 = v17; - v51 = v65; + v52 = obj2_z; + v51 = obj_z; } v57 = 0; - v26 = v66; - while ( 2 ) - { - if ( v26 == v62 ) + if ( v66 == obj2_sector ) return 1; - if ( v57 >= 30 || (v27 = pIndoor->pSectors, v28 = v66, v61 = 0, pIndoor->pSectors[v66].uNumPortals <= 0) ) - break; - while ( 1 ) - { - v29 = &pIndoor->pFaces[v27[v28].pPortals[v61]]; + //for ( v57 = 0; v57 < 30; v57++ ) + if ( v57 < 30 && !(v61 = 0, pIndoor->pSectors[v66].uNumPortals <= 0) ) + for( int v61 = 0; v61 < pIndoor->pSectors[v66].uNumPortals; v61++ ) + { + v29 = &pIndoor->pFaces[pIndoor->pSectors[v66].pPortals[v61]]; v30 = &pIndoor->pVertices[*v29->pVertexIDs]; - v45 = *(int *)&v30->x; - v46 = v30->z; - v31 = v29->pFacePlane_old.vNormal.z * (v46 - v65) - + v29->pFacePlane_old.vNormal.y * (SHIWORD(v45) - v64) - + v29->pFacePlane_old.vNormal.x * ((signed __int16)v45 - v63); + //v45 = *(int *)&v30->x; + //v46 = v30->z; + //v31 = v29->pFacePlane_old.vNormal.z * (v46 - obj_z) + v31 = v29->pFacePlane_old.vNormal.z * (v30->z - obj_z) + //+ v29->pFacePlane_old.vNormal.y * (SHIWORD(v45) - obj_y) + + v29->pFacePlane_old.vNormal.y * (v30->y - obj_y) + //+ v29->pFacePlane_old.vNormal.x * ((signed __int16)v45 - obj_x); + + v29->pFacePlane_old.vNormal.x * (v30->x - obj_x); if ( v66 != v29->uSectorID ) v31 = -v31; - if ( v31 >= 0 && (signed __int16)v45 != v63 && SHIWORD(v45) != v64 && v46 != v65 + //if (!( v31 >= 0 && (signed __int16)v45 != obj_x && SHIWORD(v45) != obj_y && v46 != obj_z + if (!( v31 >= 0 && v30->x != obj_x && v30->y != obj_y && v30->z != obj_z || v56 > v29->pBounding.x2 || v55 < v29->pBounding.x1 || v54 > v29->pBounding.y2 || v53 < v29->pBounding.y1 || v52 > v29->pBounding.z2 - || v51 < v29->pBounding.z1 ) - goto LABEL_54; - v32 = (unsigned __int64)(v49 * (signed __int64)v29->pFacePlane_old.vNormal.x) >> 16; - v33 = (unsigned __int64)(v47 * (signed __int64)v29->pFacePlane_old.vNormal.z) >> 16; - v34 = (unsigned __int64)(v48 * (signed __int64)v29->pFacePlane_old.vNormal.y) >> 16; - v35 = v32 + v33 + v34 == 0; - v36 = v32 + v33 + v34; - v59 = v32 + v33 + v34; - if ( v35 ) - goto LABEL_53; - v37 = v65 * v29->pFacePlane_old.vNormal.z; - v38 = -(v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y); - if ( v36 <= 0 ) - break; - if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y <= 0 ) - goto LABEL_49; -LABEL_53: - v27 = pIndoor->pSectors; -LABEL_54: - ++v61; - if ( v61 >= v27[v28].uNumPortals ) - goto LABEL_55; + || v51 < v29->pBounding.z1 ) ) + { + v32 = (unsigned __int64)(v49 * (signed __int64)v29->pFacePlane_old.vNormal.x) >> 16; + v33 = (unsigned __int64)(v47 * (signed __int64)v29->pFacePlane_old.vNormal.z) >> 16; + v34 = (unsigned __int64)(v48 * (signed __int64)v29->pFacePlane_old.vNormal.y) >> 16; + v35 = v32 + v33 + v34 == 0; + v36 = v32 + v33 + v34; + v59 = v32 + v33 + v34; + if ( !v35 ) + { + v37 = obj_z * v29->pFacePlane_old.vNormal.z; + v38 = -(v29->pFacePlane_old.dist + v37 + obj_x * v29->pFacePlane_old.vNormal.x + obj_y * v29->pFacePlane_old.vNormal.y); + if ( v36 <= 0 ^ v29->pFacePlane_old.dist + v37 + obj_x * v29->pFacePlane_old.vNormal.x + obj_y * v29->pFacePlane_old.vNormal.y <= 0) + { + v39 = abs(-(v29->pFacePlane_old.dist + + v37 + + obj_x * v29->pFacePlane_old.vNormal.x + + obj_y * v29->pFacePlane_old.vNormal.y)) >> 14; + if ( v39 > abs(v36) + || (LODWORD(v40) = v38 << 16, HIDWORD(v40) = v38 >> 16, v58 = v40 / v59, (signed int)(v40 / v59) < 0) + || !sub_4075DB( + obj_x + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v49) >> 16) + 32768) >> 16), + obj_y + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v48) >> 16) + 32768) >> 16), + obj_z + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v47) >> 16) + 32768) >> 16), + v29) ) + { + continue; + } + if ( v29->uSectorID == v66 ) + v42 = v29->uBackSectorID; + else + v42 = v29->uSectorID; + if ( v42 != v66 ) + { + ++v57; + v66 = v42; + if ( v42 == obj2_sector ) + return 1; + if ( v57 < 30 && pIndoor->pSectors[v66].uNumPortals > 0) + { + v61=-1; + continue; + } + + } + break; + } + } + } } - if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y < 0 ) - goto LABEL_53; -LABEL_49: - v39 = abs(-(v29->pFacePlane_old.dist - + v37 - + v63 * v29->pFacePlane_old.vNormal.x - + v64 * v29->pFacePlane_old.vNormal.y)) >> 14; - if ( v39 > abs(v36) - || (LODWORD(v40) = v38 << 16, HIDWORD(v40) = v38 >> 16, v58 = v40 / v59, (signed int)(v40 / v59) < 0) - || !sub_4075DB( - v63 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v49) >> 16) + 32768) >> 16), - v64 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v48) >> 16) + 32768) >> 16), - v65 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v47) >> 16) + 32768) >> 16), - v29) ) - { - v28 = v66; - goto LABEL_53; - } - if ( v29->uSectorID == v66 ) - v42 = v29->uBackSectorID; - else - v42 = v29->uSectorID; - v26 = v42; - if ( v42 != v66 ) - { - ++v57; - v66 = v42; - continue; - } - break; - } -LABEL_55: - if ( v66 != v62 ) + if ( v66 != obj2_sector ) return 0; return 1; } @@ -4621,7 +4601,7 @@ signed int a3a; // [sp+24h] [bp+8h]@14 int a4a; // [sp+28h] [bp+Ch]@2 - __debugbreak(); + //__debugbreak(); v5 = a4->uAttributes; v9 = pIndoor->pVertices;
--- a/mm7_data.h Mon Sep 02 12:03:25 2013 +0600 +++ b/mm7_data.h Mon Sep 02 12:03:40 2013 +0600 @@ -1073,7 +1073,7 @@ void MakeActorAIList_ODM(); int MakeActorAIList_BLV(); void UpdateActorAI(); -bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID); +bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID); bool __fastcall sub_4075DB(int a1, int a2, int a3, struct BLVFace *a4); bool __fastcall sub_4077F1(int a1, int a2, int a3, struct ODMFace *a4, struct BSPVertexBuffer *a5); bool __fastcall sub_407A1C(int x, int z, int y, struct Vec3_int_ v); // idb