Mercurial > mm7
diff UI/UiGame.cpp @ 1507:a109bb203e28
UIGame.cpp cleaning(continue) GameUI_DrawMinimap
author | Ritor1 |
---|---|
date | Mon, 02 Sep 2013 17:30:50 +0600 |
parents | c76c0f6974bc |
children | 9c1838b78ffc |
line wrap: on
line diff
--- a/UI/UiGame.cpp Mon Sep 02 12:03:40 2013 +0600 +++ b/UI/UiGame.cpp Mon Sep 02 17:30:50 2013 +0600 @@ -816,12 +816,12 @@ strcat(pTmpBuf.data(), pTmpBuf2.data()); strcat(pTmpBuf.data(), "\f00000\n"); - pTextColor = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth()); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(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()); - pTextColor = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana()); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(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()); @@ -894,19 +894,19 @@ 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()); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(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()); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(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()); + pTextColor = UI_GetHealthManaAndOtherQualitiesStringColor(player->GetActualAC(), player->GetBaseAC()); pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, pX, pY, pTextColor, pTmpBuf.data(), 84, 0); pY = pFontHeight + pY; if ( !i ) @@ -1978,60 +1978,36 @@ 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 - __int16 v11; // cx@11 unsigned int v14; // ebx@23 int v15; // eax@23 __int16 v17; // di@30 - double v18; // st7@30 - float v19; // ST38_4@30 double v20; // st7@30 - double v21; // st6@30 - double v22; // st5@33 signed int v27; // eax@37 unsigned __int16 *v28; // ecx@37 signed int v29; // edi@40 - int v37; // edi@72 - int v38; // ebx@72 - __int16 v39; // ax@87 - int v40; // edi@91 - int v41; // ebx@91 - unsigned int v42; // eax@101 - unsigned int v43; // ebx@101 - unsigned int v44; // ST30_4@101 - char *v45; // ebx@106 - int v46; // edi@108 - int v47; // eax@108 - unsigned int v48; // ebx@114 - unsigned int v49; // ST64_4@114 - unsigned int v52; // [sp-10h] [bp-64h]@100 - unsigned int v54; // [sp-Ch] [bp-60h]@100 - unsigned int v56; // [sp-8h] [bp-5Ch]@100 - unsigned __int16 v59; // [sp-4h] [bp-58h]@100 + 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 unsigned int lPitch; // [sp+20h] [bp-34h]@1 unsigned int lPitcha; // [sp+20h] [bp-34h]@23 - char *lPitchb; // [sp+20h] [bp-34h]@106 unsigned int v69; // [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 - int v76; // [sp+34h] [bp-20h]@91 - int v77; // [sp+34h] [bp-20h]@108 signed int uCenterY; // [sp+48h] [bp-Ch]@1 signed int uCenterX; // [sp+4Ch] [bp-8h]@1 signed int uWidth; // [sp+5Ch] [bp+8h]@30 - signed int uZf; // [sp+5Ch] [bp+8h]@85 - signed int uZg; // [sp+5Ch] [bp+8h]@105 unsigned int uWa; // [sp+60h] [bp+Ch]@23 float uWb; // [sp+60h] [bp+Ch]@30 unsigned int uWd; // [sp+60h] [bp+Ch]@95 - float uZooma; // [sp+64h] [bp+10h]@117 - Actor *flagsc; // [sp+68h] [bp+14h]@86 + unsigned int pColor; uCenterX = (uX + uZ) / 2; uCenterY = (uY + uW) / 2; lPitch = pRenderer->uTargetSurfacePitch; - //TargetColor(0, 0, 0); - //uBlue = TargetColor(0, 0, 0xFFu); auto bWizardEyeActive = pParty->WizardEyeActive(); auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); if ( CheckHiredNPCSpeciality(Cartographer) ) @@ -2049,43 +2025,34 @@ uHeight = uW - uY; uWidth = uZ - uX; - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) + 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; - v18 = (double)(1 << (16 - v17)); - v19 = v18; - v20 = (double)(pParty->vPosition.x + 32768) / v18; - v21 = (double)(32768 - pParty->vPosition.y) / v19; - uWb = v21; + v20 = (double)(pParty->vPosition.x + 32768) / (double)(1 << (16 - v17)); + uWb = (double)(32768 - pParty->vPosition.y) / (double)(1 << (16 - v17)); switch (uZoom) { case 512: { v20 = v20 - (double)(uWidth / 2); - v22 = (double)(uHeight / 2); - uWb = v21 - v22; + uWb = uWb - (double)(uHeight / 2); } break; - case 1024: { v20 = v20 - (double)(uWidth / 4); - v22 = (double)(uHeight / 4); - uWb = v21 - v22; + uWb = uWb - (double)(uHeight / 4); } break; - case 2048: { v20 = v20 - (double)(uWidth / 8); - v22 = (double)(uHeight / 8); - uWb = v21 - v22; + uWb = uWb - (double)(uHeight / 8); } break; - default: assert(false); } assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short)); @@ -2099,25 +2066,23 @@ assert(uWidth == 137 && uHeight == 117); //auto pMinimap = (unsigned __int16 *)pOdmMinimap; - auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - - v29 = v70 >> 16; + auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - for (int y = 0; y < uHeight; ++y) - { - auto pMapLod0Line = &pMapLod0[v27 * mapWidth]; - for (int x = 0; x < uWidth; ++x) - { - //*pMinimap++ = pPal[pMapLod0Line[v29]]; - pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]]; - v29 = (v70 + x * v73) >> 16; - } - - v29 = v70 >> 16; - v28 += 137 - uWidth; - uBluea += v73; - v27 = uBluea >> 16; - } + v29 = v70 >> 16; + for (int y = 0; y < uHeight; ++y) + { + auto pMapLod0Line = &pMapLod0[v27 * mapWidth]; + for (int x = 0; x < uWidth; ++x) + { + //*pMinimap++ = pPal[pMapLod0Line[v29]]; + pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]]; + v29 = (v70 + x * v73) >> 16; + } + v29 = v70 >> 16; + v28 += 137 - uWidth; + uBluea += v73; + v27 = uBluea >> 16; + } } for (int y = 0; y < 117; ++y) @@ -2130,7 +2095,7 @@ } uNumBlueFacesInBLVMinimap = 0; } - else + else// uCurrentlyLoadedLevelType == LEVEL_Indoor { pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); uNumBlueFacesInBLVMinimap = 0; @@ -2138,77 +2103,62 @@ for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i) { auto pOutline = &pIndoor->pMapOutlines->pOutlines[i]; - auto pFace1 = pIndoor->pFaces + pOutline->uFace1ID; auto pFace2 = pIndoor->pFaces + pOutline->uFace2ID; //v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes; //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes; if (pFace1->Visible() && pFace2->Visible()) { - v11 = pOutline->uFlags; - if ( v11 & 1 ) + //v11 = pOutline->uFlags; + if ( pOutline->uFlags & 1 ) goto LABEL_15; if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80) goto LABEL_ABC; - } continue; LABEL_ABC: - pOutline->uFlags = v11 | 1; - pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); + pOutline->uFlags = pOutline->uFlags | 1; + pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); LABEL_15: - //v12 = &pIndoor->pFaces[pOutline->uFace1ID]; - if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && - (pFace1->uAttributes & 0x2000 || pFace2->uAttributes & 0x2000) && - (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID)) - { - if (uNumBlueFacesInBLVMinimap < 49) - pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; + //v12 = &pIndoor->pFaces[pOutline->uFace1ID]; + if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && + (pFace1->uAttributes & 0x2000 || pFace2->uAttributes & 0x2000) && + (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID)) + { + if (uNumBlueFacesInBLVMinimap < 49) + pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; + } + else + { + 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); + v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; + if ( v15 > 100 ) + v15 = 100; + pRenderer->RasterLine2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); + } } - else + + for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) { - 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); - v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; - if ( v15 > 100 ) - v15 = 100; - pRenderer->RasterLine2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); + //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]]; + 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); } } - - for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) - { - //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]]; - 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); - } - } - - assert(pParty->sRotationY >= 0); float angle = (pParty->sRotationY % 2048) / 2048.0f; const float two_pi = 2.0f * 3.14159f; @@ -2216,172 +2166,95 @@ uint arrow_idx = floorf(0.5f + 7 * angle); pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx])); - //flagsb = TargetColor(0, 0, 255); - //v60 = TargetColor(255, 0, 0); - if (bWizardEyeActive) + if ( bWizardEyeActive ) { - //uZe = 0; - if (uWizardEyeSkillLevel >= 2) - for (uint i = 0; i < uNumSpriteObjects; ++i) - //if (uNumSpriteObjects > 0) - { - auto object = &pSpriteObjects[i]; - - //a2c = (char *)&pSpriteObjects[0].uObjectDescID; - //while ( 1 ) - //{ - if (!object->uType || !object->uObjectDescID) - continue; - //if (uWizardEyeSkillLevel == 1 - v37 = uCenterX + ((unsigned __int64)((object->vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16); - //v79 = (unsigned __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; - //v38 = uCenterY - v79; - v38 = uCenterY - ((signed __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16); - if (v37 < pRenderer->raster_clip_x || v37 > pRenderer->raster_clip_z || - v38 < pRenderer->raster_clip_y || v38 > pRenderer->raster_clip_w) - continue; - - assert(uZoom >= 512); - if (pObjectList->pObjects[object->uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) - { - pRenderer->RasterLine2D(v37, v38, v37, v38, ui_game_minimap_projectile_color); - } - else if (uZoom > 512) + if ( uWizardEyeSkillLevel >= 2 ) + { + for ( uint i = 0; i < uNumSpriteObjects; ++i ) { - pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(v37 + 2, v38, - v37 + 2, v38 + 1, ui_game_minimap_treasure_color); - } - else - { - pRenderer->RasterLine2D(v37 - 1, v38 - 1, - v37 - 1, v38, ui_game_minimap_treasure_color); - pRenderer->RasterLine2D(v37, v38 - 1, - v37, v38, ui_game_minimap_treasure_color); - } -//LABEL_82: -//LABEL_83: - //++uZe; - //a2c += 112; - //if ( uZe >= (signed int)uNumSpriteObjects ) - //{ - //goto LABEL_85; - //} - //} - } - - -LABEL_85: - //v63 = TargetColor(255, 0, 0); - //v61 = TargetColor(0, 255, 0); - //v65 = TargetColor(255, 255, 0); - uZf = 0; - if ( (signed int)uNumActors > 0 ) - { - flagsc = pActors.data();//[0].uAIState; - do - { - v39 = flagsc->uAIState; - if ( flagsc->uAIState != 11 && v39 != 19 && (v39 == 5 || BYTE1(flagsc->uAttributes) & 0x80) ) + 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) { - v40 = ((unsigned __int64)(( flagsc->vPosition.x - pParty->vPosition.x) - * (signed __int64)(signed int)uZoom) >> 16) - + uCenterX; - v76 = (unsigned __int64)(( flagsc->vPosition.y - pParty->vPosition.y) - * (signed __int64)(signed int)uZoom) >> 16; - v41 = uCenterY - v76; - if ( v40 >= pRenderer->raster_clip_x ) + if (pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) { - if ( v40 <= pRenderer->raster_clip_z && v41 >= pRenderer->raster_clip_y && v41 <= pRenderer->raster_clip_w ) - { - uWd = ui_game_minimap_actor_friendly_color; - if ( BYTE3(flagsc->uAttributes) & 1 ) - uWd = ui_game_minimap_actor_hostile_color; - if ( flagsc->uAIState == Dead) - uWd = ui_game_minimap_actor_corpse_color; - if ( (signed int)uZoom > 1024 ) - { - pRenderer->RasterLine2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); - pRenderer->RasterLine2D(v40, v41 - 2, v40, v41 + 2, uWd); - pRenderer->RasterLine2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd); - v42 = v41 + 1; - v43 = v41 - 1; - v44 = v42; - pRenderer->RasterLine2D(v40 - 2, v43, v40 - 2, v42, uWd); - v40 += 2; - v59 = uWd; - v56 = v44; - v54 = v40; - v52 = v43; - } - else - { - pRenderer->RasterLine2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd); - v59 = uWd; - v56 = uCenterY - v76; - v54 = v40; - v52 = v41 - 1; - } - pRenderer->RasterLine2D(v40, v52, v54, v56, v59); - } + pRenderer->RasterLine2D(pObject_X, pObject_Y, pObject_X, pObject_Y, ui_game_minimap_projectile_color); } - } - ++uZf; - ++flagsc; - } - while ( uZf < (signed int)uNumActors ); - } - } - - - //flagsd = TargetColor(255, 255, 255); - uZg = 0; - if ( (signed int)uNumLevelDecorations > 0 ) - { - v45 = (char *)&pLevelDecorations[0].vPosition; - lPitchb = (char *)&pLevelDecorations[0].vPosition; - do - { - if ( *(v45 - 2) & 8 ) - { - v46 = ((unsigned __int64)((*(int *)v45 - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) - + uCenterX; - v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; - v47 = uCenterY - v77; - if ( v46 >= pRenderer->raster_clip_x ) - { - if ( v46 <= pRenderer->raster_clip_z && v47 >= pRenderer->raster_clip_y && v47 <= pRenderer->raster_clip_w ) + else if ( uZoom > 512 ) { - if ( (signed int)uZoom > 512 ) - { - v48 = v47 + 1; - v49 = v47 - 1; - pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, ui_game_minimap_decoration_color_1); - pRenderer->RasterLine2D(v46, v49, v46, v48, ui_game_minimap_decoration_color_1); - pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, ui_game_minimap_decoration_color_1); - v45 = lPitchb; - } - else - { - pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, ui_game_minimap_decoration_color_1); - } + 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); + } + 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); } } } - ++uZg; - v45 += 32; - lPitchb = v45; } - while ( uZg < (signed int)uNumLevelDecorations ); + for ( uint i = 0; i < uNumActors; ++i )//draw actors(отрисовка монстров и нпс) + { + 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 ) + { + pColor = ui_game_minimap_actor_friendly_color; + if ( BYTE3(pActors[i].uAttributes) & 1 ) + pColor = ui_game_minimap_actor_hostile_color; + if ( pActors[i].uAIState == Dead) + 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); + } + 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); + } + } + } + } + for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i )//draw items(отрисовка предметов) + { + 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 ) + { + 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); + } + else + pRenderer->RasterLine2D(pDecoration_X, pDecoration_Y, pDecoration_X, pDecoration_Y, ui_game_minimap_decoration_color_1); + } + } + } } - pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(dword_5079D8)); - uZooma = (double)pParty->sRotationY * 0.1171875; - //v50 = uZooma + 6.7553994e15; + pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_Minimap_Loop));//draw minimap_loop pRenderer->SetTextureClipRect(541, 0, 567, 480); - pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 136, pIcons_LOD->GetTexture(dword_5079B4)); + pRenderer->DrawTextureIndexed(floorf(((double)pParty->sRotationY * 0.1171875) + 0.5f) + 285, 136, pIcons_LOD->GetTexture(uTextureID_Compas));//draw compas pRenderer->ResetTextureClipRect(); } @@ -2445,7 +2318,6 @@ } } - //v6 = (unsigned __int8)pParty->field_709; for ( int i = (unsigned __int8)pParty->field_709; i < v22 && pNPC_limit_ID < 2; i++ ) { if ( (unsigned __int8)pTmpBuf[i] >= 2 ) @@ -2482,37 +2354,22 @@ // 6BE3C5: using guessed type char bNoNPCHiring; //----- (004178FE) -------------------------------------------------------- -unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) +unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(signed int current_pos, signed int base_pos) { - unsigned __int16 v2; // dx@2 - unsigned __int16 v3; // cx@2 - int v5; // eax@5 - unsigned __int16 v6; // [sp-4h] [bp-8h]@2 + unsigned __int16 R, G, B; - if ( a1 <= a2 ) + if ( current_pos <= base_pos ) { - if ( a1 == a2 ) + if ( current_pos == base_pos )//White return 0; - v5 = 100 * a1 / a2; - v3 = 255; - if ( v5 >= 25 ) - { - v6 = 100; - v2 = 255; - } - else - { - v6 = 0; - v2 = 0; - } + if ( 100 * current_pos / base_pos >= 25 )//Yellow( current_pos > 1/4 ) + R = 255, G = 255, B = 100; + else//Red( current_pos < 1/4 ) + R = 255, G = 0, B = 0; } - else - { - v6 = 0; - v2 = 255; - v3 = 0; - } - return TargetColor(v3, v2, v6); + else//Green + R = 0, G = 255, B = 0; + return TargetColor(R, G, B); } //----- (00417939) --------------------------------------------------------