Mercurial > mm7
changeset 733:700b58aac975
MonsterPopup preview doll fixed
author | Nomad |
---|---|
date | Fri, 22 Mar 2013 13:24:12 +0200 |
parents | 93287fb98441 |
children | 2f4e33c1ed24 |
files | LOD.cpp LOD.h Render.cpp UIPopup.cpp mm7_2.cpp mm7_data.cpp mm7_data.h stru6.cpp |
diffstat | 8 files changed, 186 insertions(+), 188 deletions(-) [+] |
line wrap: on
line diff
--- a/LOD.cpp Fri Mar 22 11:19:09 2013 +0200 +++ b/LOD.cpp Fri Mar 22 13:24:12 2013 +0200 @@ -436,7 +436,7 @@ } //----- (004ACC38) -------------------------------------------------------- -int LODSprite::_4ACC38(RenderBillboardTransform_local0 *a2, char a3) +int LODSprite::DrawSprite_sw(RenderBillboardTransform_local0 *a2, char a3) { RenderBillboardTransform_local0 *v3; // edi@1 int result; // eax@1
--- a/LOD.h Fri Mar 22 11:19:09 2013 +0200 +++ b/LOD.h Fri Mar 22 13:24:12 2013 +0200 @@ -221,7 +221,7 @@ ~LODSprite(); void Release(); - int _4ACC38(struct RenderBillboardTransform_local0 *a2, char a3); + int DrawSprite_sw(struct RenderBillboardTransform_local0 *a2, char a3); int _4AD2D1(struct RenderBillboardTransform_local0 *a2, int a3); char pName[12]; //0
--- a/Render.cpp Fri Mar 22 11:19:09 2013 +0200 +++ b/Render.cpp Fri Mar 22 13:24:12 2013 +0200 @@ -218,7 +218,7 @@ soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, 0, 1); v5 = p->uHwSpriteID; if ( v5 >= 0 ) - pSprites_LOD->pSpriteHeaders[v5]._4ACC38(&soft_billboard, 1); + pSprites_LOD->pSpriteHeaders[v5].DrawSprite_sw(&soft_billboard, 1); } } } @@ -3050,7 +3050,7 @@ } v13 = *((short *)v1 - 8); if ( v13 >= 0 ) - pSprites_LOD->pSpriteHeaders[v13]._4ACC38(&billboard, 1); + pSprites_LOD->pSpriteHeaders[v13].DrawSprite_sw(&billboard, 1); } } }
--- a/UIPopup.cpp Fri Mar 22 11:19:09 2013 +0200 +++ b/UIPopup.cpp Fri Mar 22 13:24:12 2013 +0200 @@ -643,12 +643,12 @@ //----- (0041E360) -------------------------------------------------------- -char *__fastcall MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0) +void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0) { unsigned int v2; // esi@1 Actor *v3; // esi@3 int v4; // eax@3 - unsigned int v5; // ecx@3 + //unsigned int v5; // ecx@3 NPCData *v6; // eax@3 unsigned __int16 v7; // cx@3 int v8; // eax@4 @@ -657,10 +657,10 @@ LODSprite *v11; // esi@17 unsigned int v12; // ecx@17 Sprite *v13; // edi@18 - int v14; // ecx@18 - int v15; // edx@18 - int v16; // edx@18 - int v17; // eax@18 + //int v14; // ecx@18 + //int v15; // edx@18 + //int v16; // edx@18 + //int v17; // eax@18 unsigned int v18; // ecx@19 unsigned int v19; // eax@21 char *v20; // esi@28 @@ -672,15 +672,15 @@ char *v26; // edx@34 unsigned __int8 v27; // sf@36 unsigned __int8 v28; // of@36 - int v29; // esi@40 - char *v30; // ecx@40 - int v31; // eax@40 - int v32; // esi@43 - unsigned __int16 v33; // ax@45 - int v34; // edx@45 - int v35; // eax@45 + //int v29; // esi@40 + //unsigned __int16 *v30; // ecx@40 + //int v31; // eax@40 + //int v32; // esi@43 + //unsigned __int16 v33; // ax@45 + //int v34; // edx@45 + //int v35; // eax@45 int v36; // eax@49 - char *v37; // eax@52 + //char *v37; // eax@52 int v38; // eax@55 unsigned __int16 v39; // ax@59 SpellBuff *v40; // eax@60 @@ -691,7 +691,7 @@ signed int v45; // edi@65 unsigned __int16 v46; // ax@73 Player *v47; // ecx@77 - unsigned int v48; // eax@85 + //unsigned int v48; // eax@85 GUIFont *v49; // edi@90 int v50; // edi@90 SpellBuff *v51; // eax@91 @@ -706,7 +706,7 @@ unsigned __int8 v60; // dl@138 char *v62; // eax@147 int v63; // eax@152 - char *result; // eax@152 + //char *result; // eax@152 int v65; // eax@155 const char *v66; // [sp-10h] [bp-1FCh]@121 const char *v67; // [sp-10h] [bp-1FCh]@125 @@ -735,20 +735,20 @@ unsigned int v109; // [sp+1A8h] [bp-44h]@32 LPVOID v110; // [sp+1ACh] [bp-40h]@28 unsigned int v111; // [sp+1B0h] [bp-3Ch]@29 - char **v112; // [sp+1B4h] [bp-38h]@3 - IDirectDrawSurface *v222; // [sp+1B8h] [bp-34h]@18 + int v112; // [sp+1B4h] [bp-38h]@3 + int v222; // [sp+1B8h] [bp-34h]@18 unsigned __int8 v114; // [sp+1BFh] [bp-2Dh]@133 int v115; // [sp+1C0h] [bp-2Ch]@3 unsigned int v116; // [sp+1C4h] [bp-28h]@18 int i; // [sp+1C8h] [bp-24h]@18 - Player *a2; // [sp+1CCh] [bp-20h]@28 + int a2; // [sp+1CCh] [bp-20h]@28 int v119; // [sp+1D0h] [bp-1Ch]@18 SpellBuff *v120; // [sp+1D4h] [bp-18h]@18 Actor *v121; // [sp+1D8h] [bp-14h]@3 int a5; // [sp+1DCh] [bp-10h]@3 GUIWindow *a1; // [sp+1E0h] [bp-Ch]@1 int v124; // [sp+1E4h] [bp-8h]@18 - char *a4; // [sp+1E8h] [bp-4h]@18 + int a4; // [sp+1E8h] [bp-4h]@18 a1 = edx0; v2 = uActorID; @@ -763,13 +763,13 @@ v106.uParentBillboardID = -1; v3 = &pActors[v2]; v121 = v3; - v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xFFu, 0x9Bu); - v5 = v3->sNPC_ID; + v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 255, 0x9Bu); + //v5 = v3->sNPC_ID; a5 = v4; - v6 = GetNPCData(v5); + v6 = GetNPCData(v3->sNPC_ID); v7 = v3->pMonsterInfo.uID; - v112 = (char **)v6; - v115 = byte_4E2B70[((signed __int16)v7 - 1) / 3] - 40; + //v112 = (char **)v6; + v115 = monster_popup_y_offsets[((signed __int16)v7 - 1) / 3] - 40; if ( v7 == pMonsterInfoUI_Doll.pMonsterInfo.uID ) { v9 = pMonsterInfoUI_Doll.uCurrentActionLength; @@ -784,6 +784,7 @@ v9 = v8 % 256 + 128; pMonsterInfoUI_Doll.uCurrentActionLength = v8 % 256 + 128; } + if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) { pMonsterInfoUI_Doll.uCurrentActionTime = 0; @@ -794,16 +795,15 @@ } else { - rand(); + //rand(); pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored; - if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) - && (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) - && rand() % 30 < 100 ) + if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) && + (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 ) pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee; pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; } } - v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); + v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); v11 = &pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]];//40 * v10->pHwSpriteIDs[0] + 7218180; v106.pTarget = pRenderer->pTargetSurface; v106.pTargetZ = pRenderer->pActiveZBuffer; @@ -829,46 +829,48 @@ { v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]]; v106.uScreenSpaceY = v115 + v106.uViewportY + v13->uBufferHeight; - v222 = (IDirectDrawSurface *)v13->pTextureSurface; + //v222 = (IDirectDrawSurface *)v13->pTextureSurface; memset(&Dst, 0, 0x64u); Dst.dwSize = 100; Dst.dwFillColor = 0; memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - v222->GetSurfaceDesc((LPDDSURFACEDESC)&pDesc); - v14 = v13->uBufferHeight; - v120 = (SpellBuff *)v13->uBufferWidth; + v13->pTextureSurface->GetSurfaceDesc(&pDesc); + //v14 = v13->uBufferHeight; + //v120 = (SpellBuff *)v13->uBufferWidth; v107 = 0; - v15 = v13->uAreaX; - v119 = (signed int)v120 / 2; + //v15 = v13->uAreaX; + //v119 = v13->uBufferWidth / 2; i = 0; - a4 = (char *)(v106.uScreenSpaceX + v15 - (signed int)v120 / 2); - v115 = v13->uAreaY; - v16 = v13->uAreaWidth + (signed int)v120 / 2 + v15 - (int)v120; - v124 = v106.uScreenSpaceY + v115 - v14; - v17 = v13->uAreaHeight + v115 - v14; - v116 = v106.uScreenSpaceX + v16; - v119 = v106.uScreenSpaceY + v17; - if ( (signed int)a4 < (signed int)v106.uViewportX ) + //a4 = v106.uScreenSpaceX + v15 - v13->uBufferWidth / 2; + int dst_x = v106.uScreenSpaceX + v13->uAreaX - v13->uBufferWidth / 2; + //v115 = v13->uAreaY; + //v16 = v13->uAreaWidth + v13->uBufferWidth / 2 + v13->uAreaX - v13->uBufferWidth; + //v124 = v106.uScreenSpaceY + v115 - v14; + int dst_y = v106.uScreenSpaceY + v13->uAreaY - v13->uBufferHeight; + //v17 = v13->uAreaHeight + v13->uAreaY - v14; + //v116 = v106.uScreenSpaceX + v16; + uint dst_z = v106.uScreenSpaceX + v13->uAreaX + v13->uAreaWidth + v13->uBufferWidth / 2 - v13->uBufferWidth; + //v119 = v106.uScreenSpaceY + v17; + uint dst_w = v106.uScreenSpaceY + v13->uAreaY + v13->uAreaHeight - v13->uBufferHeight; + if (dst_x < v106.uViewportX) { - v18 = v106.uViewportX - (int)a4; - a4 = (char *)v106.uViewportX; + v18 = v106.uViewportX - dst_x; + dst_x = v106.uViewportX; v107 = v18; } - if ( v124 < (signed int)v106.uViewportY ) + if (dst_y < v106.uViewportY) { - v19 = v106.uViewportY - v124; - v124 = v106.uViewportY; + v19 = v106.uViewportY - dst_y; + dst_y = v106.uViewportY; i = v19; } - if ( (signed int)v116 > (signed int)v106.uViewportZ ) - v116 = v106.uViewportZ; - if ( v119 > (signed int)v106.uViewportW ) - v119 = v106.uViewportW; - pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, - pRenderer->uTargetBMask | pRenderer->uTargetGMask); - pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, - pRenderer->uTargetBMask | pRenderer->uTargetGMask); + if (dst_z > v106.uViewportZ) + dst_z = v106.uViewportZ; + if (dst_w > v106.uViewportW) + dst_w = v106.uViewportW; + pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask); + pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask); v84.left = v106.uViewportX; v84.top = v106.uViewportY; v84.right = v106.uViewportZ; @@ -876,25 +878,27 @@ ErrD3D(pRenderer->pBackBuffer4->Blt(&v84, 0, 0, 16778240u, &Dst)); if ( pRenderer->uTargetGBits == 5 ) { + __debugbreak(); // no monster popup for r5g5b5 yet memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, DDLOCK_WAIT)) + if ( pRenderer->LockSurface_DDraw4(v13->pTextureSurface, &pDesc, DDLOCK_WAIT)) { - v20 = (char *)v124; + v20 = (char *)dst_y; v110 = pDesc.lpSurface; - a2 = (Player *)v124; - if ( v124 < v119 ) + a2 = dst_y; + if (dst_y < dst_w) { - v111 = 2 * pRenderer->uTargetSurfacePitch; - v21 = (int)a4; - v22 = &pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; - v23 = i - v124; - v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; - v115 = i - v124; + //v111 = 2 * pRenderer->uTargetSurfacePitch; + v21 = dst_x; + v22 = &pRenderer->pTargetSurface[dst_y * pRenderer->uTargetSurfacePitch + dst_x]; + auto _v22_2 = v22; + v23 = i - dst_y; + //v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; + v115 = i - dst_y; while ( 1 ) { - v124 = v21; - if ( v21 < (signed int)v116 ) + dst_y = v21; + if ( v21 < dst_z ) { v24 = (int)&v20[v23]; v25 = v107 - v21; @@ -902,73 +906,54 @@ for ( i = v107 - v21; ; v25 = i ) { v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / v13->uAreaHeight); - v26 = (char *)v108 + pDesc.dwWidth * (v25 + v124++) / v13->uAreaWidth; + v26 = (char *)v108 + pDesc.dwWidth * (v25 + dst_y++) / v13->uAreaWidth; *v22 = *((short *)v110 + (int)v26); ++v22; - if ( v124 >= (signed int)v116 ) + if ( dst_y >= dst_z ) break; } v23 = v115; } - v22 = (unsigned __int16 *)((char *)v120 + v111); - v20 = (char *)&a2->pConditions[0] + 1; - v28 = __OFSUB__((int)&a2->pConditions[0] + 1, v119); - v27 = (signed int)((char *)&a2->pConditions[0] + -v119 + 1) < 0; - a2 = (Player *)((char *)a2 + 1); - v120 = (SpellBuff *)((char *)v120 + v111); + v22 = (unsigned __int16 *)((char *)_v22_2 + 2 * pRenderer->uTargetSurfacePitch); + _v22_2 = v22; + v20 = (char *)(a2 + 1); + v28 = __OFSUB__(a2 + 1, dst_w); + v27 = (signed int)(a2++ + 1 - dst_w) < 0; + //a2 = (Player *)((char *)a2 + 1); + //v120 = (SpellBuff *)((char *)v120 + v111); if ( !(v27 ^ v28) ) break; - v21 = (int)a4; + v21 = dst_x; } } - v222->Unlock(0); + v13->pTextureSurface->Unlock(0); } } else { memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; - if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, DDLOCK_WAIT) ) + if ( pRenderer->LockSurface_DDraw4(v13->pTextureSurface, &pDesc, DDLOCK_WAIT) ) { - v108 = (unsigned __int16 *)pDesc.lpSurface; - a2 = (Player *)v124; - if ( v124 < v119 ) + auto src = (unsigned __int16 *)pDesc.lpSurface; + + uint num_top_scanlines_above_frame_y = i - dst_y; + for (uint y = dst_y; y < dst_w; ++y) { - v109 = 2 * pRenderer->uTargetSurfacePitch; - v29 = (int)a4; - v30 = (char *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; - v31 = i - v124; - v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; - v115 = i - v124; - while ( 1 ) - { - v124 = v29; - if ( v29 < (signed int)v116 ) - { - v32 = v107 - (int)a4; - v111 = (unsigned int)((char *)a2 + v31); - for ( i = v107 - (int)a4; ; v32 = i ) - { - v110 = (LPVOID)((pDesc.lPitch >> 1) * pDesc.dwHeight * v111 / v13->uAreaHeight); - v33 = v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124) / v13->uAreaWidth)]; - v34 = v33 & 0x1F | 2 * (unsigned __int16)(v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124++) / v13->uAreaWidth)] & 0xFFE0); - v35 = v124; - *(short *)v30 = v34; - v30 += 2; - if ( v35 >= (signed int)v116 ) - break; - } - v31 = v115; - } - a2 = (Player *)((char *)a2 + 1); - v30 = (char *)v120 + v109; - v120 = (SpellBuff *)((char *)v120 + v109); - if ( (signed int)a2 >= v119 ) - break; - v29 = (int)a4; - } + auto dst = &pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + dst_x]; + + uint src_y = num_top_scanlines_above_frame_y + y; + for (uint x = dst_x; x < dst_z; ++x) + { + uint src_x = v107 - dst_x + x; // num scanlines left to frame_x + current x + + uint idx = pDesc.dwHeight * src_y / v13->uAreaHeight * (pDesc.lPitch / sizeof(short)) + + pDesc.dwWidth * src_x / v13->uAreaWidth; + uint b = src[idx] & 0x1F; + *dst++ = b | 2 * (src[idx] & 0xFFE0); + } } - v222->Unlock(0); + v13->pTextureSurface->Unlock(0); } } } @@ -977,19 +962,20 @@ pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0); v36 = v10->pHwSpriteIDs[0]; if ( v36 >= 0 ) - pSprites_LOD->pSpriteHeaders[v36]._4ACC38(&v106, 0); + pSprites_LOD->pSpriteHeaders[v36].DrawSprite_sw(&v106, 0); } + if ( v121->sNPC_ID ) { - v37 = v112[6]; - if ( v37 ) + //v37 = v6->uProfession; + if (v6->uProfession) { - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], *v112, aNPCProfessionNames[(signed int)v37]); + sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v6->pName, aNPCProfessionNames[v6->uProfession]); // "%s the %s" / ^Pi[%s] %s } else { v77 = 2000; - v72 = *v112; + v72 = v6->pName; } } else @@ -1001,7 +987,7 @@ else v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName; } - if(!v121->sNPC_ID || (v121->sNPC_ID && !v37)) + if(!v121->sNPC_ID || (v121->sNPC_ID && !v6->uProfession)) strncpy(pTmpBuf, v72, v77); v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf, 3u); @@ -1077,7 +1063,7 @@ v119 = 1; v116 = 1; i = 1; - v112 = (char **)1; + v112 = 1; } } } @@ -1102,11 +1088,14 @@ v47->PlaySound((PlayerSpeech)v73, 0); } } - a2 = pParty->pPlayers; - do + + for (uint _it = 0; _it < 4; ++_it) { - LOBYTE(v48) = a2->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); - v111 = v48; + auto player = pParty->pPlayers + _it; + + //LOBYTE(v48) = player->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); + //v111 = v48; + v111 = player->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); v120 = (SpellBuff *)138; do { @@ -1115,11 +1104,12 @@ v120 = (SpellBuff *)((char *)v120 - 1); } while ( v120 ); - ++a2; + //++a2; } - while ( (signed int)a2 < (signed int)pParty->pHirelings ); + //while ( (signed int)a2 < (signed int)pParty->pHirelings ); + v49 = pFontSmallnum; - a2 = (Player *)pFontSmallnum; + a2 = (int)pFontSmallnum; a1->DrawText(pFontSmallnum, 12, 196, a5, pGlobalTXT_LocalizationStrings[631], 0, 0, 0); v50 = LOBYTE(v49->uFontHeight) + 193; if ( !v115 ) @@ -1144,92 +1134,92 @@ { case 0u: v124 = 60; - a4 = pGlobalTXT_LocalizationStrings[591]; + a4 = (int)pGlobalTXT_LocalizationStrings[591]; break; case 1u: v124 = 82; - a4 = pGlobalTXT_LocalizationStrings[649]; + a4 = (int)pGlobalTXT_LocalizationStrings[649]; break; case 2u: v124 = 92; - a4 = pGlobalTXT_LocalizationStrings[592]; + a4 = (int)pGlobalTXT_LocalizationStrings[592]; break; case 3u: v124 = 63; - a4 = pGlobalTXT_LocalizationStrings[4]; + a4 = (int)pGlobalTXT_LocalizationStrings[4]; break; case 4u: v52 = pGlobalTXT_LocalizationStrings[220]; - a4 = v52; + a4 = (int)v52; v124 = 81; break; case 5u: v52 = pGlobalTXT_LocalizationStrings[162]; - a4 = v52; + a4 = (int)v52; v124 = 81; break; case 6u: v53 = pGlobalTXT_LocalizationStrings[593]; v124 = 35; - a4 = v53; + a4 = (int)v53; break; case 8u: v53 = pGlobalTXT_LocalizationStrings[608]; v124 = 62; - a4 = v53; + a4 = (int)v53; break; case 7u: case 9u: a4 = 0; v124 = 0; ++v51; - v222 = (IDirectDrawSurface *)((char *)v222 + 1); + v222 = v222 + 1; v120 = v51; __debugbreak(); // fix condition continue; case 0xAu: v124 = 47; - a4 = pGlobalTXT_LocalizationStrings[221]; + a4 = (int)pGlobalTXT_LocalizationStrings[221]; break; case 0xBu: v124 = 66; - a4 = pGlobalTXT_LocalizationStrings[607]; + a4 = (int)pGlobalTXT_LocalizationStrings[607]; break; case 0xCu: v124 = 85; - a4 = pGlobalTXT_LocalizationStrings[610]; + a4 = (int)pGlobalTXT_LocalizationStrings[610]; break; case 0xDu: v124 = 86; - a4 = pGlobalTXT_LocalizationStrings[609]; + a4 = (int)pGlobalTXT_LocalizationStrings[609]; break; case 0xEu: v124 = 17; - a4 = pGlobalTXT_LocalizationStrings[279]; + a4 = (int)pGlobalTXT_LocalizationStrings[279]; break; case 0xFu: v124 = 38; - a4 = pGlobalTXT_LocalizationStrings[442]; + a4 = (int)pGlobalTXT_LocalizationStrings[442]; break; case 0x10u: v124 = 46; - a4 = pGlobalTXT_LocalizationStrings[443]; + a4 = (int)pGlobalTXT_LocalizationStrings[443]; break; case 0x11u: v124 = 51; - a4 = pGlobalTXT_LocalizationStrings[440]; + a4 = (int)pGlobalTXT_LocalizationStrings[440]; break; case 0x12u: v124 = 5; - a4 = pGlobalTXT_LocalizationStrings[441]; + a4 = (int)pGlobalTXT_LocalizationStrings[441]; break; case 0x13u: v124 = 95; - a4 = pGlobalTXT_LocalizationStrings[229]; + a4 = (int)pGlobalTXT_LocalizationStrings[229]; break; case 0x14u: v124 = 73; - a4 = pGlobalTXT_LocalizationStrings[228]; + a4 = (int)pGlobalTXT_LocalizationStrings[228]; break; default: a4 = 0; @@ -1237,22 +1227,23 @@ } if ( a4 ) { - v54 = a4; + v54 = (char *)a4; v55 = GetSpellColor(v124); a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0); - v50 = v50 + BYTE5(a2->pConditions[0]) - 3; + v50 = v50 + *(char *)(a2 + 5) - 3; v51 = v120; } } ++v51; - v222 = (IDirectDrawSurface *)((char *)v222 + 1); + v222 = v222 + 1; v120 = v51; __debugbreak(); // fix condition } //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 ); while (true); + if ( !a4 ) { v78 = 0; @@ -1263,12 +1254,12 @@ } } v56 = pFontSmallnum; - a4 = (char *)v106.uViewportY; + a4 = v106.uViewportY; if ( v119 ) { sprintf(pTmpBuf, "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; v79 = v121->pMonsterInfo.uAC; v75 = 0; v70 = pGlobalTXT_LocalizationStrings[12]; @@ -1281,12 +1272,12 @@ v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630]; v75 = 0; v70 = pGlobalTXT_LocalizationStrings[12]; - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; v67 = "%s\f%05u\t100%s\n"; } sprintf(pTmpBuf, v67, v70, v75, v79); - a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 6] + LOBYTE(v56->uFontHeight); + a1->DrawText(v56, 150, a4, a5, pTmpBuf, 0, 0, 0); + a4 = a4 + LOBYTE(v56->uFontHeight) - 6 + LOBYTE(v56->uFontHeight); v95[0] = pGlobalTXT_LocalizationStrings[87]; v95[1] = pGlobalTXT_LocalizationStrings[6]; v95[2] = pGlobalTXT_LocalizationStrings[240]; @@ -1302,7 +1293,7 @@ { sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, v95[v121->pMonsterInfo.uAttack1Type]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; v57 = v121->pMonsterInfo.uAttack1DamageBonus; if ( v57 ) sprintf(pTmpBuf, "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53], @@ -1315,12 +1306,12 @@ { sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); } - a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); + a1->DrawText(v56, 150, a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 6] + v58; + a4 = a4 + v58 - 6 + v58; if ( !i ) { v80 = pGlobalTXT_LocalizationStrings[630]; @@ -1330,7 +1321,7 @@ sprintf(pTmpBuf, v68, v71, v76, v80); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; + a4 = a4 + v58 - 3; } else { @@ -1344,7 +1335,7 @@ sprintf(pTmpBuf, "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; + a4 = a4 + v58 - 3; v59 = v121; } v60 = v59->pMonsterInfo.uSpell2ID; @@ -1353,7 +1344,7 @@ sprintf(pTmpBuf, "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; + a4 = a4 + v58 - 3; v59 = v121; } if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID ) @@ -1365,12 +1356,12 @@ sprintf(pTmpBuf, v68, v71, v76, v80); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); - a4 = &a4[v58 - 3]; + a4 = a4 + v58 - 3; } } - a4 = &a4[v58 - 3]; - a1->DrawText(v56, 150, (int)a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0); - a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; + a4 = a4 + v58 - 3; + a1->DrawText(v56, 150, a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0); + a4 = a4 + LOBYTE(v56->uFontHeight) - 3; v85[0] = pGlobalTXT_LocalizationStrings[87]; v85[1] = pGlobalTXT_LocalizationStrings[6]; v85[2] = pGlobalTXT_LocalizationStrings[240]; @@ -1409,11 +1400,10 @@ v81 = pGlobalTXT_LocalizationStrings[153]; } sprintf(pTmpBuf, "%s\f%05u\t070%s\n", v85[v124], 0, v81); - a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); + a1->DrawText(v56, 170, a4, a5, pTmpBuf, 0, 0, 0); v63 = LOBYTE(v56->uFontHeight); v124 += 4; - result = &a4[v63 - 3]; - a4 = result; + a4 = a4 + v63 - 3; } while ( v124 < 40 ); } @@ -1423,11 +1413,10 @@ do { sprintf(pTmpBuf, "%s\f%05u\t070%s\n", v85[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" - a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); + a1->DrawText(v56, 170, a4, a5, pTmpBuf, 0, 0, 0); v65 = LOBYTE(v56->uFontHeight); ++i; - result = &a4[v65 - 3]; - a4 = result; + a4 = a4 + v65 - 3; } while ( i < 10 ); } @@ -1435,9 +1424,8 @@ { sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP); pFontSmallnum->GetLineWidth(pTmpBuf); - result = a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf, 3); + a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf, 3); } - return result; }
--- a/mm7_2.cpp Fri Mar 22 11:19:09 2013 +0200 +++ b/mm7_2.cpp Fri Mar 22 13:24:12 2013 +0200 @@ -9730,14 +9730,14 @@ byte_6BE388_graphicsmode = 0; uGammaPos = ReadWindowsRegistryInt("GammaPos", 4); - if (uGammaPos < 0 || uGammaPos > 9) + if (uGammaPos > 9) uGammaPos = 4; pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6); if ( ReadWindowsRegistryInt("Bloodsplats", 1) ) pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS; else - pGame->uFlags2 &= GAME_FLAGS_2_DRAW_BLOODSPLATS; + pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS; uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0); dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0);
--- a/mm7_data.cpp Fri Mar 22 11:19:09 2013 +0200 +++ b/mm7_data.cpp Fri Mar 22 13:24:12 2013 +0200 @@ -486,7 +486,17 @@ unsigned int pManaBarPos[4] = {102, 217, 331, 447}; char _4E2AD8_ui_colors[72]; char _4E2B21_buff_spell_tooltip_colors[80]; -char byte_4E2B70[777]; // weak +char monster_popup_y_offsets[88] = +{ + 236, 20, 0, 216, 0, 0, 0, 0, 0, 0, 206, + 20, 0, 246, 246, 236, 10, 246, 0, 0, 0, 236, + 10, 246, 0, 0, 0, 236, 246, 0, 0, 0, 216, + 236, 0, 0, 0, 206, 226, 226, 226, 226, 226, 226, + 0, 0, 0, 0, 0, 0, 236, 236, 236, 20, 20, + 20, 10, 10, 10, 10, 10, 10, 166, 196, 216, 236, + 236, 176, 246, 0, 0, 216, 0, 0, 0, 236, 10, + 0, 0, 0, 0, 0, 0, 196, 0, 0, 0, 0 +}; unsigned char hourglass_icon_idx = 12; // weak char aSS[777]; // idb
--- a/mm7_data.h Fri Mar 22 11:19:09 2013 +0200 +++ b/mm7_data.h Fri Mar 22 13:24:12 2013 +0200 @@ -472,7 +472,7 @@ extern unsigned int pManaBarPos[4]; extern char _4E2AD8_ui_colors[72]; extern char _4E2B21_buff_spell_tooltip_colors[80]; -extern char byte_4E2B70[]; // weak +extern char monster_popup_y_offsets[]; // weak extern unsigned char hourglass_icon_idx; // weak extern char aSS[]; // idb @@ -1892,7 +1892,7 @@ bool __thiscall sub_41CD4F(unsigned int _this); char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2); void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb -char *__fastcall MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0); +void MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0); void __cdecl nullsub_3(); // idb void __cdecl LoadActualSkyFrame(); void __cdecl Sleep6Hours();
--- a/stru6.cpp Fri Mar 22 11:19:09 2013 +0200 +++ b/stru6.cpp Fri Mar 22 13:24:12 2013 +0200 @@ -1537,7 +1537,7 @@ vsr.uViewportW = pViewport->uViewportBR_Y; vsr.uFlags = 0; if ( v11 >= 0 ) - pSprites_LOD->pSpriteHeaders[v11]._4ACC38(&vsr, 1); + pSprites_LOD->pSpriteHeaders[v11].DrawSprite_sw(&vsr, 1); } } }