# HG changeset patch # User Ritor1 # Date 1378365150 -21600 # Node ID 53265d238d94384536452c4c95542095bce08d29 # Parent 948191fca433217df408c78c7792fc54ce5f9b71 interaction_distance_limit for 3DModel in DrawStatusText diff -r 948191fca433 -r 53265d238d94 Player.h --- a/Player.h Mon Sep 02 17:39:31 2013 +0600 +++ b/Player.h Thu Sep 05 13:12:30 2013 +0600 @@ -10,9 +10,12 @@ #define PLAYER_BUFF_FATE 4 #define PLAYER_BUFF_HAMMERHANDS 6 #define PLAYER_BUFF_7 7 +#define PLAYER_BUFF_8 8 #define PLAYER_BUFF_PAIN_REFLECTION 10 #define PLAYER_BUFF_PRESERVATION 11 #define PLAYER_BUFF_REGENERATION 12 +#define PLAYER_BUFF_13 13 +#define PLAYER_BUFF_14 14 #define PLAYER_GUILD_BITS__SPIRIT_MEMBERSHIP 58 diff -r 948191fca433 -r 53265d238d94 UI/Books/UIMapBook.cpp --- a/UI/Books/UIMapBook.cpp Mon Sep 02 17:39:31 2013 +0600 +++ b/UI/Books/UIMapBook.cpp Thu Sep 05 13:12:30 2013 +0600 @@ -528,21 +528,21 @@ { v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; if ( (signed int)v51 <= 1920 ) - v50 = 7; + v50 = 6; if ( (signed int)v51 < 1664 ) - v50 = 6; + v50 = 5; if ( (signed int)v51 <= 1408 ) - v50 = 5; + v50 = 4; if ( (signed int)v51 < 1152 ) - v50 = 4; + v50 = 3; if ( (signed int)v51 <= 896 ) - v50 = 3; + v50 = 2; if ( (signed int)v51 < 640 ) - v50 = 2; + v50 = 1; if ( (signed int)v51 <= 384 ) - v50 = 1; - if ( (signed int)v51 < 128 ) v50 = 0; + if ( (signed int)v51 < 128 || (signed int)v51 > 1920 ) + v50 = 7; pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50])); } result = TargetColor(0xFFu, 0xFFu, 0xFFu); diff -r 948191fca433 -r 53265d238d94 UI/UIMainMenu.cpp --- a/UI/UIMainMenu.cpp Mon Sep 02 17:39:31 2013 +0600 +++ b/UI/UIMainMenu.cpp Thu Sep 05 13:12:30 2013 +0600 @@ -117,14 +117,14 @@ pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB")); pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA")); - pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); - pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); + pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE); uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE); diff -r 948191fca433 -r 53265d238d94 UI/UiGame.cpp --- a/UI/UiGame.cpp Mon Sep 02 17:39:31 2013 +0600 +++ b/UI/UiGame.cpp Thu Sep 05 13:12:30 2013 +0600 @@ -33,6 +33,7 @@ #include "..\texts.h" #include "UIHouses.h" #include "..\BSPModel.h" +#include "..\Math.h" int uTextureID_GameUI_CharSelectionFrame; // 50C98C @@ -176,7 +177,7 @@ ++v4; } while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/ - for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i) + for ( uint i = 0; i < pNPCStats->uNumNewNPCs; ++i ) { if (pNPCStats->pNewNPCData[i].Hired()) { @@ -349,7 +350,7 @@ int pTextHeight; // esi@39 GUIButton *pButton; // eax@43 int v32; // ebx@93 - int v35; // esi@93 + uint v35; // esi@93 int v38; // eax@95 signed int v39; // esi@99 signed int v40; // eax@102 @@ -600,7 +601,7 @@ // Install Buttons(Установка кнопок)-------- v32 = 0; - v35 = pDialogueWindow->pStartingPosActiveItem; + v35 = (uint)pDialogueWindow->pStartingPosActiveItem; for ( uint i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ) { pButton = pDialogueWindow->GetControl(v35); @@ -731,7 +732,7 @@ } else { - for ( uint j = 0; j < (signed int)pOutdoor->uNumBModels; ++j ) + for ( uint j = 0; j < (uint)pOutdoor->uNumBModels; ++j ) { v7 = int_get_vector_length(abs((signed)pOutdoor->pBModels[j].vBoundingCenter.x - v19), abs((signed)pOutdoor->pBModels[j].vBoundingCenter.y - v20), 0); @@ -739,7 +740,7 @@ { if ( pOutdoor->pBModels[j].uNumFaces ) { - for ( uint i = 0; i < (signed int)pOutdoor->pBModels[j].uNumFaces; ++i ) + for ( uint i = 0; i < (uint)pOutdoor->pBModels[j].uNumFaces; ++i ) { pFace = &pOutdoor->pBModels[j].pFaces[i]; if ( pFace->sCogTriggeredID ) @@ -975,10 +976,10 @@ //----- (0041AD6E) -------------------------------------------------------- void GameUI_DrawRightPanelItems() { - if (GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed) + if ( (unsigned long long)GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed ) GameUI_RightPanel_BookFlashTimer = 0; - if (pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128) + if ( pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128 ) { GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed; @@ -1167,61 +1168,39 @@ int v1; // ebx@6 GUIWindow *pWindow; // edi@7 GUIButton *pButton; // ecx@11 - Player *pPlayer; // eax@19 - char v5; // cl@19 - unsigned int v6; // eax@19 int v7; // ecx@19 - __int16 v8; // fps@23 - unsigned __int8 v9; // c0@23 - unsigned __int8 v10; // c3@23 enum UIMessageType pMessageType1; // esi@24 - char *v13; // ecx@28 int v14; // eax@41 ItemGen *pItemGen; // ecx@44 int v16; // ecx@46 - const char *v17; // eax@49 signed int v18; // eax@55 signed int v18b; signed int v19; // ecx@63 BLVFace *pFace; // eax@69 - __int16 v21; // ax@70 - const char *v22; // eax@72 - LevelDecoration *v23; // ecx@75 - LevelDecoration *v24; // esi@75 - __int16 v25; // ax@75 - const char *v26; // ecx@79 - Actor *pActor; // ecx@82 + const char *pText; // ecx@79 char *v28; // esi@82 - int v29; // eax@82 - signed int v30; // ecx@88 - const char *v31; // eax@91 - __int16 v32; // fps@109 enum UIMessageType pMessageType2; // esi@110 enum UIMessageType pMessageType3; // edx@117 - const char *v39; // [sp-8h] [bp-E8h]@20 - char *v40; // [sp-8h] [bp-E8h]@83 - int v41; // [sp-4h] [bp-E4h]@20 char Str1[200]; // [sp+Ch] [bp-D4h]@129 unsigned int pX; // [sp+D4h] [bp-Ch]@1 unsigned int pY; // [sp+D8h] [bp-8h]@1 unsigned int v45; // [sp+DCh] [bp-4h]@21 - v13 = nullptr; + int interaction_distance_limit = 512; + 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 ) + if ( pX < 0 || pX > 639 || pY < 0 || pY > 479 ) return; if (pCurrentScreen == SCREEN_GAME) { - if ( (signed int)pX > 467 || (signed int)pY > 351 ) + if ( pX > 467 || pY > 351 ) goto _click_on_game_ui; if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 { v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); - if ( (signed int)pX < (signed int)pViewport->uScreen_TL_X - || (signed int)pX > (signed int)pViewport->uScreen_BR_X - || (signed int)pY < (signed int)pViewport->uScreen_TL_Y - || (signed int)pY > (signed int)pViewport->uScreen_BR_Y ) + if ( pX < (unsigned int)pViewport->uScreen_TL_X || pX > (unsigned int)pViewport->uScreen_BR_X + || pY < (unsigned int)pViewport->uScreen_TL_Y || pY > (unsigned int)pViewport->uScreen_BR_Y ) v18 = -1; if ( v18 == -1 ) { @@ -1242,13 +1221,20 @@ v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; pMouse->uPointingObjectID = (unsigned __int16)v18; v19 = (signed)PID_ID(v18); + //For Items------------------------------------ if (PID_TYPE(v18) == OBJECT_Item) { - v30 = v19; - if ( pObjectList->pObjects[pSpriteObjects[v30].uObjectDescID].uFlags & 0x10 ) + if ( pObjectList->pObjects[pSpriteObjects[v19].uObjectDescID].uFlags & 0x10 ) { pMouse->uPointingObjectID = 0; - uLastPointedObjectID = 1; + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; + } + if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) + { + GameUI_SetFooterString(pSpriteObjects[v19].stru_24.GetDisplayName()); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1260,10 +1246,32 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) + v28 = pTmpBuf.data(); + sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[v19].stru_24.GetDisplayName());// "Get %s" + } +//For Decorations---------------------------------- + if (PID_TYPE(v18) == OBJECT_Decoration) + { + if ( !pLevelDecorations[v19].field_16_event_id ) { - v22 = pSpriteObjects[v30].stru_24.GetDisplayName(); - GameUI_SetFooterString(v22); + if ( pLevelDecorations[v19].IsInteractive() ) + pText = pNPCTopics[stru_5E4C90._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic; + else + pText = pDecorationList->pDecorations[pLevelDecorations[v19].uDecorationDescID].field_20; + GameUI_SetFooterString(pText); + if ( pMouse->uPointingObjectID == 0 ) + { + if ( uLastPointedObjectID != 0 ) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + } + uLastPointedObjectID = pMouse->uPointingObjectID; + return; + } + if ( !GetEventHintString(pLevelDecorations[v19].field_16_event_id) ) + { if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1275,52 +1283,36 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - v31 = pSpriteObjects[v30].stru_24.GetDisplayName(); - v28 = pTmpBuf.data(); - sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], v31);// "Get %s" + GameUI_SetFooterString(GetEventHintString(pLevelDecorations[v19].field_16_event_id)); + if ( pMouse->uPointingObjectID == 0 ) + { + if ( uLastPointedObjectID != 0 ) + { + pFooterString[0] = 0; + bForceDrawFooter = 1; + } + } + uLastPointedObjectID = pMouse->uPointingObjectID; + return; } - else + //For 3D Model------------------------------------- + if (PID_TYPE(v18) == OBJECT_BModel) { - if (PID_TYPE(v18) != OBJECT_Actor) + if ( HIWORD(v18) < interaction_distance_limit ) { - if (PID_TYPE(v18) == OBJECT_Decoration) + if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { - v23 = &pLevelDecorations[v19]; - v24 = v23; - v25 = v23->field_16_event_id; - if ( !v25 ) + v18b = (signed int)(unsigned __int16)v18 >> 9; + if ( !pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID + || !GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID) ) { - if ( v23->IsInteractive() ) - v26 = pNPCTopics[stru_5E4C90._decor_events[v24->_idx_in_stru123 - 75] + 379].pTopic; - else - v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; - GameUI_SetFooterString(v26); - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; + pMouse->uPointingObjectID = 0; + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; return; } - v22 = GetEventHintString(v25); - if ( !v22 ) - { - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - GameUI_SetFooterString(v22); + GameUI_SetFooterString(GetEventHintString(pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID)); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1332,75 +1324,19 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - if (PID_TYPE(v18) == OBJECT_BModel) + pFace = &pIndoor->pFaces[v19]; + if ( BYTE3(pFace->uAttributes) & 6 ) { - if ( HIWORD(v18) < 512) + if ( !pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID + || !GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID) ) { - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) - { - v18b = (signed int)(unsigned __int16)v18 >> 9; - v21 = pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID; - if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) - { - pMouse->uPointingObjectID = 0; - uLastPointedObjectID = 1; - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - GameUI_SetFooterString(v22); - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - pFace = &pIndoor->pFaces[v19]; - if ( BYTE3(pFace->uAttributes) & 6 ) - { - v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; - if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) - { - pMouse->uPointingObjectID = 0; - uLastPointedObjectID = 1; - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } - GameUI_SetFooterString(v22); - if ( pMouse->uPointingObjectID == 0 ) - { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } - } - uLastPointedObjectID = pMouse->uPointingObjectID; - return; - } + pMouse->uPointingObjectID = 0; + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; } - pMouse->uPointingObjectID = 0; - uLastPointedObjectID = 1; + GameUI_SetFooterString(GetEventHintString(pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID)); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1412,14 +1348,22 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } + } + pMouse->uPointingObjectID = 0; + pFooterString[0] = 0; + bForceDrawFooter = 1; + uLastPointedObjectID = 0; + return; + } + else + { + if (PID_TYPE(v18) != OBJECT_Actor) + { pMouse->uPointingObjectID = 0; - if ( pMouse->uPointingObjectID == 0 ) + if ( uLastPointedObjectID != 0 ) { - if ( uLastPointedObjectID != 0 ) - { - pFooterString[0] = 0; - bForceDrawFooter = 1; - } + pFooterString[0] = 0; + bForceDrawFooter = 1; } uLastPointedObjectID = pMouse->uPointingObjectID; return; @@ -1438,17 +1382,14 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - pActor = &pActors[v19]; v28 = pTmpBuf.data(); - v29 = pActor->dword_000334_unique_name; - if ( v29 ) - v40 = pMonsterStats->pPlaceStrings[v29]; + if ( pActors[v19].dword_000334_unique_name ) + pText = pMonsterStats->pPlaceStrings[pActors[v19].dword_000334_unique_name]; else - v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName; - strncpy(pTmpBuf.data(), v40, 0x7D0u); + pText = pMonsterStats->pInfos[pActors[v19].pMonsterInfo.uID].pName; + strncpy(pTmpBuf.data(), pText, 0x7D0u); } - v26 = v28; - GameUI_SetFooterString(v26); + GameUI_SetFooterString(v28); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -1487,8 +1428,7 @@ { pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); } - v13 = pButton->pButtonName; - GameUI_SetFooterString(v13); + GameUI_SetFooterString(pButton->pButtonName); uLastPointedObjectID = 1; return; } @@ -1508,8 +1448,7 @@ { pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); } - v13 = pButton->pButtonName; - GameUI_SetFooterString(v13); + GameUI_SetFooterString(pButton->pButtonName); uLastPointedObjectID = 1; return; //} @@ -1518,31 +1457,16 @@ } else // click on skill { - if ( pButton->uButtonType == 3 - && (signed int)pX >= (signed int)pButton->uX - && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY - && (signed int)pY <= (signed int)pButton->uW ) - { - pPlayer = pPlayers[uActiveCharacter]; - v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]); - v6 = pPlayer->uSkillPoints; - v7 = (v5 & 0x3F) + 1; - if ( v6 < v7 ) - { - v41 = v7 - v6; - v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" - } - else - { - v41 = v7; - v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" - } - sprintf(Str1, v39, v41); - v13 = Str1; - GameUI_SetFooterString(v13); - uLastPointedObjectID = 1; - return; + if ( pButton->uButtonType == 3 && pX >= pButton->uX && pX <= pButton->uZ && pY >= pButton->uY && pY <= pButton->uW ) + { + v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; + if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) + sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" + else + sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" + GameUI_SetFooterString(Str1); + uLastPointedObjectID = 1; + return; } } } @@ -1591,8 +1515,7 @@ return; } pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); - v17 = pItemGen->GetDisplayName(); - GameUI_SetFooterString(v17); + GameUI_SetFooterString(pItemGen->GetDisplayName()); uLastPointedObjectID = 1; if ( pMouse->uPointingObjectID == 0 ) { @@ -1622,8 +1545,7 @@ return; } pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; - v17 = pItemGen->GetDisplayName(); - GameUI_SetFooterString(v17); + GameUI_SetFooterString(pItemGen->GetDisplayName()); uLastPointedObjectID = 1; if ( pMouse->uPointingObjectID == 0 ) { @@ -1654,8 +1576,7 @@ pMessageType3 = (UIMessageType)pButton->field_1C; if ( pMessageType3 == 0 ) // For books { - v13 = pButton->pButtonName; - GameUI_SetFooterString(v13); + GameUI_SetFooterString(pButton->pButtonName); uLastPointedObjectID = 1; return; } @@ -1685,8 +1606,7 @@ if ( pMessageType2 != 0 ) pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0); - v13 = pButton->pButtonName; - GameUI_SetFooterString(v13); + GameUI_SetFooterString(pButton->pButtonName); uLastPointedObjectID = 1; return; //} @@ -1696,28 +1616,15 @@ else { if ( pButton->uButtonType == 3 - && (signed int)pX >= (signed int)pButton->uX - && (signed int)pX <= (signed int)pButton->uZ - && (signed int)pY >= (signed int)pButton->uY - && (signed int)pY <= (signed int)pButton->uW ) + && pX >= pButton->uX && pX <= pButton->uZ + && pY >= pButton->uY && pY <= pButton->uW ) { - pPlayer = pPlayers[uActiveCharacter]; - v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]); - v6 = pPlayer->uSkillPoints; - v7 = (v5 & 0x3F) + 1; - if ( v6 < v7 ) - { - v41 = v7 - v6; - v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" - } + v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1; + if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 ) + sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here" else - { - v41 = v7; - v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" - } - sprintf(Str1, v39, v41); - v13 = Str1; - GameUI_SetFooterString(v13); + sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points" + GameUI_SetFooterString(Str1); uLastPointedObjectID = 1; return; } @@ -1750,259 +1657,209 @@ //----- (0044162D) -------------------------------------------------------- void GameUI_DrawPartySpells() { - unsigned int v0; // ebp@1 - Texture *v7; // [sp-4h] [bp-1Ch]@12 - Texture *v9; // [sp-4h] [bp-1Ch]@21 - - v0 = (signed __int64)((double)GetTickCount() * 0.050000001); - //v1 = 0; - for (uint i = 0; i < 14; ++i) - { - //v2 = byte_4E5DD8[v1]; - if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) - { - auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); - //v3 = pTextureIDs_PartyBuffIcons[i]; - pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], - pPartySpellbuffsUI_XYs[i][1], tex, tex, - v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); - } - //++v1; - } - //while ( v1 < 14 ); + unsigned int v0; // ebp@1 + Texture *v7; // [sp-4h] [bp-1Ch]@12 + Texture *v9; // [sp-4h] [bp-1Ch]@21 - if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE) - { - if (pParty->FlyActive()) - { - if ( pParty->bFlying ) - v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); - else - v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); - if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureIndexed(8, 8, v7); - else - pRenderer->DrawTextureTransparent(8, 8, v7); - } - if (pParty->WaterWalkActive()) - { - if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER) - v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); - else - v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); - if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureIndexed(396u, 8u, v9); - else - pRenderer->DrawTextureTransparent(396u, 8u, v9); - } - } - - for (uint i = 0; i < 4; ++i) - { - auto player = pParty->pPlayers + i; - - if (player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime) - pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); - if (player->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime) - pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); - if (player->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime) - pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); - if (player->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime) - pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); - } + v0 = (signed __int64)((double)GetTickCount() * 0.050000001); + //v1 = 0; + for (uint i = 0; i < 14; ++i) + { + //v2 = byte_4E5DD8[v1]; + if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) + { + auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); + //v3 = pTextureIDs_PartyBuffIcons[i]; + pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], + pPartySpellbuffsUI_XYs[i][1], tex, tex, + v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); } + //++v1; + } + //while ( v1 < 14 ); + if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE) + { + if (pParty->FlyActive()) + { + if ( pParty->bFlying ) + v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); + else + v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); + if ( pRenderer->pRenderD3D ) + pRenderer->DrawTextureIndexed(8, 8, v7); + else + pRenderer->DrawTextureTransparent(8, 8, v7); + } + if ( pParty->WaterWalkActive() ) + { + if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) + v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); + else + v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); + if ( pRenderer->pRenderD3D ) + pRenderer->DrawTextureIndexed(396, 8, v9); + else + pRenderer->DrawTextureTransparent(396, 8, v9); + } + } + for (uint i = 0; i < 4; ++i) + { + if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime ) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); + if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime ) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); + if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime ) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); + if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime ) + pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); + } +} //----- (004921C1) -------------------------------------------------------- void GameUI_DrawPortraits(unsigned int _this) { - Texture *pFace; // eax@10 - unsigned int v7; // eax@17 + unsigned int face_expression_ID; // eax@17 PlayerFrame *pFrame; // eax@21 - unsigned int v9; // eax@27 - bool v10; // eax@33 - bool v11; // edi@40 - bool v12; // edx@43 - bool v13; // ecx@46 - int v16; // eax@57 - int v19; // eax@62 + int pTextureID; // eax@57 Texture *pPortrait; // [sp-4h] [bp-1Ch]@27 - //unsigned int v22; // [sp+14h] [bp-4h]@1 + + if ( qword_A750D8 ) + { + qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed; + if ( qword_A750D8 <= 0 ) + { + if ( pPlayers[uSpeakingCharacter]->CanAct() ) + pPlayers[uSpeakingCharacter]->PlaySound(PlayerSpeechID, 0); + qword_A750D8 = 0i64; + } + } - //v22 = _this; - if ( qword_A750D8 ) + for (uint i = 0; i < 4; ++i) + { + Player* pPlayer = &pParty->pPlayers[i]; + if ( pPlayer->IsEradicated() ) + { + pPortrait = pTexture_PlayerFaceEradicated; + if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) + pRenderer->_4A6E7E(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + else + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_7].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_8].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_14].uExpireTime ) + sub_441A4E(i); + continue; + } + if (pPlayer->IsDead()) + { + pPortrait = pTexture_PlayerFaceDead; + if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) + pRenderer->_4A6E7E(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + else + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_7].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_8].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_14].uExpireTime ) + sub_441A4E(i); + continue; + } + face_expression_ID = 0; + for ( uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j ) + if ( pPlayerFrameTable->pFrames[j].expression == pPlayer->expression ) + { + face_expression_ID = j; + break; + } + if ( face_expression_ID == 0 ) + face_expression_ID = 1; + if (pPlayer->expression == CHARACTER_EXPRESSION_21) + pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); + else + pFrame = pPlayerFrameTable->GetFrameBy_x(face_expression_ID, pPlayer->uExpressionTimePassed); + if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || _this ) + { + pPlayer->field_1AA2 = pFrame->uTextureID - 1; + pPortrait = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID]; + if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) + pRenderer->_4A6E7E(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + else + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_7].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_8].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_13].uExpireTime + | pPlayer->pPlayerBuffs[PLAYER_BUFF_14].uExpireTime ) + sub_441A4E(i); + continue; + } + } + if ( pParty->bTurnBasedModeOn == 1 ) + { + if ( pTurnEngine->turn_stage != 1 ) + { + if (PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) + { + if ( pTurnEngine->uActorQueueSize > 0 ) { - qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed; - if ( qword_A750D8 <= 0 ) - { - if ( pPlayers[uSpeakingCharacter]->CanAct() ) - pPlayers[uSpeakingCharacter]->PlaySound(PlayerSpeechID, 0); - qword_A750D8 = 0i64; - } - } - - for (uint i = 0; i < 4; ++i) - { - Player* pPlayer = &pParty->pPlayers[i]; - - if (pPlayer->IsEradicated()) + for (uint i = 0; i < (uint)pTurnEngine->uActorQueueSize; ++i) + { + if (PID_TYPE(pTurnEngine->pQueue[i].uPackedID) != OBJECT_Player) + break; + pTextureID = dword_5079D0; + if ( pParty->uFlags & 0x10 ) + pTextureID = dword_5079CC; + else { - pFace = pTexture_PlayerFaceEradicated; - pPortrait = pFace; - v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; - if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->_4A6E7E(v9, 0x183u, pPortrait); - else - pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); - auto _v1 = 0; - v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; - if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) - _v1 = 1; - v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; - v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; - v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; - if ( v13 | v12 | v11 | _v1 | v10 ) - sub_441A4E(i); - continue; - } - if (pPlayer->IsDead()) - { - pFace = pTexture_PlayerFaceDead; - pPortrait = pFace; - v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; - if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->_4A6E7E(v9, 0x183u, pPortrait); - else - pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); - auto _v1 = 0; - v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; - if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) - _v1 = 1; - v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; - v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; - v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; - if ( v13 | v12 | v11 | _v1 | v10 ) - sub_441A4E(i); - continue; + if ( pParty->uFlags & 0x20 ) + pTextureID = dword_5079C8; } - v7 = 0; - for (uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j) - if (pPlayerFrameTable->pFrames[j].expression == pPlayer->expression) - { - v7 = j; - break; - } - if ( v7 == 0 ) - v7 = 1; - if (pPlayer->expression == CHARACTER_EXPRESSION_21) - pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); - else - pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed); - if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || _this ) - { - pPlayer->field_1AA2 = pFrame->uTextureID - 1; - pFace = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID]; - pPortrait = pFace; - v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; - if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->_4A6E7E(v9, 0x183u, pPortrait); - else - pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); - auto _v1 = 0; - v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; - if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) - _v1 = 1; - v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; - v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; - v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; - if ( v13 | v12 | v11 | _v1 | v10 ) - sub_441A4E(i); - continue; - } + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pTurnEngine->pQueue[i].uPackedID)] - 4, 385, pIcons_LOD->GetTexture(pTextureID)); + } } - if ( pParty->bTurnBasedModeOn == 1 ) + } + } + } + else + { + for (uint i = 0; i < 4; ++i) + { + if (pParty->pPlayers[i].CanAct() && !pParty->pPlayers[i].uTimeToRecovery) + { + pTextureID = dword_5079D0; + if ( pParty->uFlags & 0x10 ) + pTextureID = dword_5079CC; + else { - if ( pTurnEngine->turn_stage != 1 ) - { - if (PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) - { - //v14 = 0; - if ( pTurnEngine->uActorQueueSize > 0 ) - { - //v15 = (char *)pTurnEngine->pQueue; - for (uint i = 0; i < pTurnEngine->uActorQueueSize; ++i) - { - auto pElem = pTurnEngine->pQueue + i; - - if (PID_TYPE(pElem->uPackedID) != OBJECT_Player) - break; - v16 = dword_5079D0; - if ( pParty->uFlags & 0x10 ) - { - v16 = dword_5079CC; - } - else - { - if ( pParty->uFlags & 0x20 ) - v16 = dword_5079C8; - } - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pElem->uPackedID)] - 4, 0x181u, pIcons_LOD->GetTexture(v16)); - } - } - } - } + if ( pParty->uFlags & 0x20 ) + pTextureID = dword_5079C8; } - else - { - for (uint i = 0; i < 4; ++i) - { - auto pPlayer = pParty->pPlayers + i; - if (pPlayer->CanAct() && !pPlayer->uTimeToRecovery) - { - v19 = dword_5079D0; - if ( pParty->uFlags & 0x10 ) - { - v19 = dword_5079CC; - } - else - { - if ( pParty->uFlags & 0x20 ) - v19 = dword_5079C8; - } - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, 0x181u, pIcons_LOD->GetTexture(v19)); - } - } - } + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, 385, pIcons_LOD->GetTexture(pTextureID)); + } } + } +} //----- (00441D38) -------------------------------------------------------- void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap) { int uHeight; // ebx@6 - unsigned int v14; // ebx@23 + unsigned int pW; // ebx@23 int v15; // eax@23 - __int16 v17; // di@30 double v20; // st7@30 signed int v27; // eax@37 unsigned __int16 *v28; // ecx@37 signed int v29; // edi@40 - int pObject_X; // edi@72 - int pObject_Y; // ebx@72 - int pActor_X; // edi@91 - int pActor_Y; // ebx@91 - int pDecoration_X; // edi@108 - int pDecoration_Y; // eax@108 + int pPoint_X; // edi@72 + int pPoint_Y; // ebx@72 unsigned int lPitch; // [sp+20h] [bp-34h]@1 - unsigned int lPitcha; // [sp+20h] [bp-34h]@23 - unsigned int v69; // [sp+24h] [bp-30h]@23 + unsigned int pY; // [sp+20h] [bp-34h]@23 + unsigned int pX; // [sp+24h] [bp-30h]@23 signed int v70; // [sp+24h] [bp-30h]@37 signed int uBluea; // [sp+28h] [bp-2Ch]@37 int v73; // [sp+2Ch] [bp-28h]@30 signed int uCenterY; // [sp+48h] [bp-Ch]@1 signed int uCenterX; // [sp+4Ch] [bp-8h]@1 signed int uWidth; // [sp+5Ch] [bp+8h]@30 - unsigned int uWa; // [sp+60h] [bp+Ch]@23 + unsigned int pZ; // [sp+60h] [bp+Ch]@23 float uWb; // [sp+60h] [bp+Ch]@30 - unsigned int uWd; // [sp+60h] [bp+Ch]@95 unsigned int pColor; uCenterX = (uX + uZ) / 2; @@ -2027,12 +1884,11 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { - v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; auto pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; auto pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; - v73 = (1 << (v17 + 16)) / (signed int)uZoom; - v20 = (double)(pParty->vPosition.x + 32768) / (double)(1 << (16 - v17)); - uWb = (double)(32768 - pParty->vPosition.y) / (double)(1 << (16 - v17)); + v73 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / (signed int)uZoom; + v20 = (double)(pParty->vPosition.x + 32768) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); + uWb = (double)(32768 - pParty->vPosition.y) / (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); switch (uZoom) { case 512: @@ -2100,7 +1956,7 @@ pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); uNumBlueFacesInBLVMinimap = 0; - for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i) + for (uint i = 0; i < (uint)pIndoor->pMapOutlines->uNumOutlines; ++i) { auto pOutline = &pIndoor->pMapOutlines->pOutlines[i]; auto pFace1 = pIndoor->pFaces + pOutline->uFace1ID; @@ -2109,7 +1965,6 @@ //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes; if (pFace1->Visible() && pFace2->Visible()) { - //v11 = pOutline->uFlags; if ( pOutline->uFlags & 1 ) goto LABEL_15; if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80) @@ -2135,36 +1990,50 @@ auto _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x); auto _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16); auto _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16); - //v69 = uCenterX + _c; - v69 = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); - lPitcha = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); - uWa = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); - v14 = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); + pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); + pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); + pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); + pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; if ( v15 > 100 ) v15 = 100; - pRenderer->RasterLine2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); + pRenderer->RasterLine2D(pX, pY, pZ, pW, viewparams->pPalette[-v15 + 200]); } } for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) { auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; - pRenderer->RasterLine2D(uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16), - uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16), - uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16), - uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16), - ui_game_minimap_outline_color); + pX = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); + pY = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); + pZ = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); + pW = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); + pRenderer->RasterLine2D(pX, pY, pZ, pW, ui_game_minimap_outline_color); } } - assert(pParty->sRotationY >= 0); - float angle = (pParty->sRotationY % 2048) / 2048.0f; - const float two_pi = 2.0f * 3.14159f; + //draw arrow on the minimap(include. Ritor1) + uint arrow_idx; + unsigned int rotate = pParty->sRotationY & stru_5C6E00->uDoublePiMask; + if ( (signed int)rotate <= 1920 ) + arrow_idx = 6; + if ( (signed int)rotate < 1664 ) + arrow_idx = 5; + if ( (signed int)rotate <= 1408 ) + arrow_idx = 4; + if ( (signed int)rotate < 1152 ) + arrow_idx = 3; + if ( (signed int)rotate <= 896 ) + arrow_idx = 2; + if ( (signed int)rotate < 640 ) + arrow_idx = 1; + if ( (signed int)rotate <= 384 ) + arrow_idx = 0; + if ( (signed int)rotate < 128 || (signed int)rotate > 1920 ) + arrow_idx = 7; + pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx]));//стрелка - uint arrow_idx = floorf(0.5f + 7 * angle); - pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx])); - + //draw objects on the minimap if ( bWizardEyeActive ) { if ( uWizardEyeSkillLevel >= 2 ) @@ -2174,27 +2043,27 @@ if ( !pSpriteObjects[i].uType || !pSpriteObjects[i].uObjectDescID ) continue; //if (uWizardEyeSkillLevel == 1 - pObject_X = uCenterX + ((unsigned __int64)((pSpriteObjects[i].vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16); - pObject_Y = uCenterY - ((signed __int64)((pSpriteObjects[i].vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16); - if ( pObject_X >= pRenderer->raster_clip_x && pObject_X <= pRenderer->raster_clip_z && - pObject_Y >= pRenderer->raster_clip_y && pObject_Y <= pRenderer->raster_clip_w) + pPoint_X = uCenterX + ((unsigned __int64)((pSpriteObjects[i].vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16); + pPoint_Y = uCenterY - ((signed __int64)((pSpriteObjects[i].vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16); + if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z && + pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w) { if (pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) { - pRenderer->RasterLine2D(pObject_X, pObject_Y, pObject_X, pObject_Y, ui_game_minimap_projectile_color); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y, pPoint_X, pPoint_Y, ui_game_minimap_projectile_color); } else if ( uZoom > 512 ) { - pRenderer->RasterLine2D(pObject_X - 2, pObject_Y, pObject_X - 2, pObject_Y + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pObject_X - 1, pObject_Y - 1, pObject_X - 1, pObject_Y + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pObject_X, pObject_Y - 2, pObject_X, pObject_Y + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pObject_X + 1, pObject_Y - 1, pObject_X + 1, pObject_Y + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pObject_X + 2, pObject_Y, pObject_X + 2, pObject_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X - 2, pPoint_Y, pPoint_X - 2, pPoint_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 2, pPoint_X, pPoint_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 1, pPoint_X + 1, pPoint_Y + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X + 2, pPoint_Y, pPoint_X + 2, pPoint_Y + 1, ui_game_minimap_treasure_color); } else { - pRenderer->RasterLine2D(pObject_X - 1, pObject_Y - 1, pObject_X - 1, pObject_Y, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(pObject_X, pObject_Y - 1, pObject_X, pObject_Y, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y, ui_game_minimap_treasure_color); } } } @@ -2204,10 +2073,10 @@ if ( pActors[i].uAIState != Removed && pActors[i].uAIState != Disabled && (pActors[i].uAIState == Dead || BYTE1(pActors[i].uAttributes) & 0x80) ) { - pActor_X = uCenterX + ((unsigned __int64)(( pActors[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16); - pActor_Y = uCenterY - ((unsigned __int64)(( pActors[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16); - if ( pActor_X >= pRenderer->raster_clip_x && pActor_X <= pRenderer->raster_clip_z - && pActor_Y >= pRenderer->raster_clip_y && pActor_Y <= pRenderer->raster_clip_w ) + pPoint_X = uCenterX + ((unsigned __int64)(( pActors[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16); + pPoint_Y = uCenterY - ((unsigned __int64)(( pActors[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16); + if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z + && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) { pColor = ui_game_minimap_actor_friendly_color; if ( BYTE3(pActors[i].uAttributes) & 1 ) @@ -2216,16 +2085,16 @@ pColor = ui_game_minimap_actor_corpse_color; if ( uZoom > 1024 ) { - pRenderer->RasterLine2D(pActor_X - 2, pActor_Y - 1, pActor_X - 2, pActor_Y + 1, pColor); - pRenderer->RasterLine2D(pActor_X - 1, pActor_Y - 2, pActor_X - 1, pActor_Y + 2, pColor); - pRenderer->RasterLine2D(pActor_X, pActor_Y - 2, pActor_X, pActor_Y + 2, pColor); - pRenderer->RasterLine2D(pActor_X + 1, pActor_Y - 2, pActor_X + 1, pActor_Y + 2, pColor); - pRenderer->RasterLine2D(pActor_X + 2, pActor_Y - 1, pActor_X + 2, pActor_Y + 1, pColor); + pRenderer->RasterLine2D(pPoint_X - 2, pPoint_Y - 1, pPoint_X - 2, pPoint_Y + 1, pColor); + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 2, pPoint_X - 1, pPoint_Y + 2, pColor); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 2, pPoint_X, pPoint_Y + 2, pColor); + pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 2, pPoint_X + 1, pPoint_Y + 2, pColor); + pRenderer->RasterLine2D(pPoint_X + 2, pPoint_Y - 1, pPoint_X + 2, pPoint_Y + 1, pColor); } else { - pRenderer->RasterLine2D(pActor_X - 1, pActor_Y - 1, pActor_X - 1, pActor_Y, pColor); - pRenderer->RasterLine2D(pActor_X, pActor_Y - 1, pActor_X, pActor_Y, pColor); + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y, pColor); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y, pColor); } } } @@ -2234,19 +2103,19 @@ { if ( pLevelDecorations[i].uFlags & 8 ) { - pDecoration_X = uCenterX + ((unsigned __int64)((pLevelDecorations[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16); - pDecoration_Y = uCenterY - ((unsigned __int64)((pLevelDecorations[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16); - if ( pDecoration_X >= pRenderer->raster_clip_x && pDecoration_X <= pRenderer->raster_clip_z - && pDecoration_Y >= pRenderer->raster_clip_y && pDecoration_Y <= pRenderer->raster_clip_w ) + pPoint_X = uCenterX + ((unsigned __int64)((pLevelDecorations[i].vPosition.x - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16); + pPoint_Y = uCenterY - ((unsigned __int64)((pLevelDecorations[i].vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16); + if ( pPoint_X >= pRenderer->raster_clip_x && pPoint_X <= pRenderer->raster_clip_z + && pPoint_Y >= pRenderer->raster_clip_y && pPoint_Y <= pRenderer->raster_clip_w ) { if ( (signed int)uZoom > 512 ) { - pRenderer->RasterLine2D(pDecoration_X - 1, pDecoration_Y - 1, pDecoration_X - 1, pDecoration_Y + 1, ui_game_minimap_decoration_color_1); - pRenderer->RasterLine2D(pDecoration_X, pDecoration_Y - 1, pDecoration_X, pDecoration_Y + 1, ui_game_minimap_decoration_color_1); - pRenderer->RasterLine2D(pDecoration_X + 1, pDecoration_Y - 1, pDecoration_X + 1, pDecoration_Y + 1, ui_game_minimap_decoration_color_1); + pRenderer->RasterLine2D(pPoint_X - 1, pPoint_Y - 1, pPoint_X - 1, pPoint_Y + 1, ui_game_minimap_decoration_color_1); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y - 1, pPoint_X, pPoint_Y + 1, ui_game_minimap_decoration_color_1); + pRenderer->RasterLine2D(pPoint_X + 1, pPoint_Y - 1, pPoint_X + 1, pPoint_Y + 1, ui_game_minimap_decoration_color_1); } else - pRenderer->RasterLine2D(pDecoration_X, pDecoration_Y, pDecoration_X, pDecoration_Y, ui_game_minimap_decoration_color_1); + pRenderer->RasterLine2D(pPoint_X, pPoint_Y, pPoint_X, pPoint_Y, ui_game_minimap_decoration_color_1); } } } diff -r 948191fca433 -r 53265d238d94 mm7_3.cpp --- a/mm7_3.cpp Mon Sep 02 17:39:31 2013 +0600 +++ b/mm7_3.cpp Thu Sep 05 13:12:30 2013 +0600 @@ -6318,8 +6318,8 @@ char *v3; // esi@1 int v4; // edi@4 bool v5; // ecx@4 - SpriteFrame *v6; // eax@6 - SpriteFrame *v7; // edi@6 + SpriteFrame *pFrame; // eax@6 + //SpriteFrame *v7; // edi@6 int v8; // eax@6 unsigned __int16 v9; // ax@6 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 @@ -6357,24 +6357,24 @@ { if ( !pOtherOverlayList->pOverlays[i].field_0 ) { - v6 = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, + pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, pOtherOverlayList->pOverlays[i].field_4); - v7 = v6; + //v7 = v6; v11 = pOtherOverlayList->pOverlays[i].field_E; - v13 = v6->scale; - v13 = (unsigned __int64)(v11 * (signed __int64)v13) >> 16; + //v13 = pFrame->scale; + v13 = (unsigned __int64)(v11 * (signed __int64)pFrame->scale) >> 16; v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; v10._screenspace_x_scaler_packedfloat = v13; v10._screenspace_y_scaler_packedfloat = v13; - v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v6->uPaletteIndex, 0, 1); + v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1); v8 = pOtherOverlayList->pOverlays[i].field_2; v10.sZValue = 0; v10.uFlags = 0; v9 = pOverlayList->pOverlays[v8].uOverlayType; if ( !v9 || v9 == 2 ) - v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]].uHeight >> 1; - result = pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); + v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight >> 1; + result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); ++v12; if ( v12 == 5 ) break;