Mercurial > mm7
diff mm7_3.cpp @ 706:d6236f6a9882
Rough function rearranging to new files
author | Gloval |
---|---|
date | Tue, 19 Mar 2013 21:53:21 +0400 |
parents | af0332a32034 |
children | 436ae1842e92 70c5a87a1307 |
line wrap: on
line diff
--- a/mm7_3.cpp Mon Mar 18 21:50:20 2013 +0000 +++ b/mm7_3.cpp Tue Mar 19 21:53:21 2013 +0400 @@ -11662,132 +11662,7 @@ } // 4E28F8: using guessed type int pCurrentScreen; -//----- (00441498) -------------------------------------------------------- -void __cdecl GameUI_DrawTorchlightAndWizardEye() -{ - if (pCurrentScreen == SCREEN_GAME - || pCurrentScreen == SCREEN_MENU - || pCurrentScreen == SCREEN_OPTIONS - || pCurrentScreen == SCREEN_REST - || pCurrentScreen == SCREEN_SPELL_BOOK - || pCurrentScreen == SCREEN_CHEST - || pCurrentScreen == SCREEN_SAVEGAME - || pCurrentScreen == SCREEN_LOADGAME - || pCurrentScreen == SCREEN_F - || pCurrentScreen == SCREEN_BOOKS - || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) - { - if (pParty->TorchlightActive()) - { - auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); - pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); - } - if (pParty->WizardEyeActive()) - { - auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); - pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); - } - } -} -// 4E28F8: using guessed type int pCurrentScreen; - -//----- (0044158F) -------------------------------------------------------- -void __cdecl GameUI_DrawCharacterSelectionFrame() -{ - if ( uActiveCharacter ) - pRenderer->DrawTextureTransparent( - pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, - 0x17Cu, - &pIcons_LOD->pTextures[dword_50C98C]); -} - -//----- (004415C5) -------------------------------------------------------- -void LoadPartyBuffIcons() -{ - for (uint i = 0; i < 14; ++i) - { - char filename[200]; - sprintf(filename, "isn-%02d", i + 1); - pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE); - } - - uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21"); - uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27"); -} - -//----- (0044162D) -------------------------------------------------------- -void __cdecl GameUI_DrawPartySpells() -{ - unsigned int v0; // ebp@1 - //signed int v1; // edi@1 - //int v2; // eax@2 - //int v3; // ecx@5 - //__int16 *v4; // ebx@25 - //Player *v5; // edi@26 - //unsigned int v6; // [sp-4h] [bp-1Ch]@11 - Texture *v7; // [sp-4h] [bp-1Ch]@12 - //unsigned int v8; // [sp-4h] [bp-1Ch]@20 - Texture *v9; // [sp-4h] [bp-1Ch]@21 - //Player **v10; // [sp+10h] [bp-8h]@25 - - v0 = (signed __int64)((double)GetTickCount() * 0.050000001); - //v1 = 0; - 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]; - if (tex) - 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->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID]; - else - v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID]; - if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureIndexed(8u, 8u, v7); - else - pRenderer->DrawTextureTransparent(8u, 8u, v7); - } - if (pParty->WaterWalkActive()) - { - if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER) - v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID]; - else - v9 = &pIcons_LOD->pTextures[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)); - } -} + //----- (00441A4E) -------------------------------------------------------- __int16 __fastcall sub_441A4E(int a1) @@ -11866,931 +11741,6 @@ -//----- (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 - __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 - //signed int v33; // ebx@50 - //unsigned int v34; // eax@50 - //signed int v35; // ecx@50 - //unsigned __int16 v36; // di@66 - 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 v51; // [sp-10h] [bp-64h]@79 - unsigned int v52; // [sp-10h] [bp-64h]@100 - unsigned int v53; // [sp-Ch] [bp-60h]@79 - unsigned int v54; // [sp-Ch] [bp-60h]@100 - unsigned int v55; // [sp-8h] [bp-5Ch]@77 - unsigned int v56; // [sp-8h] [bp-5Ch]@100 - //signed int v57; // [sp-4h] [bp-58h]@54 - unsigned __int16 v58; // [sp-4h] [bp-58h]@77 - unsigned __int16 v59; // [sp-4h] [bp-58h]@100 - unsigned __int16 v60; // [sp+10h] [bp-44h]@66 - unsigned int v61; // [sp+10h] [bp-44h]@85 - unsigned int v63; // [sp+14h] [bp-40h]@85 - unsigned int v65; // [sp+18h] [bp-3Ch]@85 - 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 - unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1 - 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 - int v79; // [sp+38h] [bp-1Ch]@72 - char *a2c; // [sp+40h] [bp-14h]@68 - 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 uZe; // [sp+5Ch] [bp+8h]@67 - 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 - unsigned int flagsb; // [sp+68h] [bp+14h]@66 - Actor *flagsc; // [sp+68h] [bp+14h]@86 - unsigned int flagsd; // [sp+68h] [bp+14h]@105 - - uCenterX = (uX + uZ) / 2; - uCenterY = (uY + uW) / 2; - lPitch = pRenderer->uTargetSurfacePitch; - GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); - uBlue = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); - auto bWizardEyeActive = pParty->WizardEyeActive(); - auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); - if (CheckHiredNPCSpeciality(Cartographer)) - { - bWizardEyeActive = true; - uWizardEyeSkillLevel = 2; - } - pRenderer->Clip_v2(uX, uY, uZ - 1, uW - 1); - uHeight = uW - uY; - uWidth = uZ - uX; - - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) - { - v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; - auto pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; - 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; - switch (uZoom) - { - case 512: - { - v20 = v20 - (double)(uWidth / 2); - v22 = (double)(uHeight / 2); - uWb = v21 - v22; - } - break; - - case 1024: - { - v20 = v20 - (double)(uWidth / 4); - v22 = (double)(uHeight / 4); - uWb = v21 - v22; - } - break; - - case 2048: - { - v20 = v20 - (double)(uWidth / 8); - v22 = (double)(uHeight / 8); - uWb = v21 - v22; - } - break; - - default: assert(false); - } - assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short)); - - v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); - uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); - v27 = uBluea >> 16; - v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; - if (pMapLod0 && bRedrawOdmMinimap) - { - assert(uWidth == 137 && uHeight == 117); - //auto pMinimap = (unsigned __int16 *)pOdmMinimap; - - auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - - 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) - { - for (int x = 0; x < 137; ++x) - { - *v28++ = pOdmMinimap[y][x]; - } - v28 += lPitch - 137; - } - uNumBlueFacesInBLVMinimap = 0; - } - else - { - pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); - uNumBlueFacesInBLVMinimap = 0; - - 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 ) - goto LABEL_15; - if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80u != 0 ) - goto LABEL_ABC; - - } - continue; - -LABEL_ABC: - pOutline->uFlags = v11 | 1; - pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); - -LABEL_15: - //v12 = &pIndoor->pFaces[pOutline->uFace1ID]; - if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && - (pFace1->uAttributes & 0x2000000 || pFace2->uAttributes & 0x2000000) && - (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->Line2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); - } - } - - - for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) - { - //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]]; - auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; - pRenderer->Line2D(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), - uBlue); - } - } - - - assert(pParty->sRotationY >= 0); - float angle = (pParty->sRotationY % 2048) / 2048.0f; - const float two_pi = 2.0f * 3.14159f; - - uint arrow_idx = floorf(0.5f + 7 * angle); - pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx])); - - flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); - v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); - if (bWizardEyeActive) - { - uZe = 0; - //for (uint i = 0; i < uNumSpriteObjects; ++i) - if (uNumSpriteObjects > 0) - { - a2c = (char *)&pSpriteObjects[0].uObjectDescID; - while ( 1 ) - { - if ( !*((short *)a2c - 1) - || !*(short *)a2c - || uWizardEyeSkillLevel == 1 - || (v37 = ((unsigned __int64)((*(int *)(a2c + 2) - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) - + uCenterX, - v79 = (unsigned __int64)((*(int *)(a2c + 6) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16, - v38 = uCenterY - v79, - v37 < pRenderer->field_1C_clipx) - || v37 > pRenderer->field_24_width - || v38 < pRenderer->field_20_clipy - || v38 > pRenderer->field_28_height ) - goto LABEL_83; - if ( pObjectList->pObjects[*(short *)a2c].uFlags & 0x10 ) - break; - if ( (signed int)uZoom > 512 ) - { - pRenderer->Line2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb); - pRenderer->Line2D(v37, v38 - 2, v37, v38 + 1, flagsb); - pRenderer->Line2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb); - pRenderer->Line2D(v37 - 2, v38, v37 - 2, v38 + 1, flagsb); - v37 += 2; - v58 = flagsb; - v55 = v38 + 1; - goto LABEL_81; - } - pRenderer->Line2D(v37 - 1, v38 - 1, v37 - 1, uCenterY - v79, flagsb); - v58 = flagsb; - v55 = uCenterY - v79; - v53 = v37; - v51 = v38 - 1; -LABEL_82: - pRenderer->Line2D(v37, v51, v53, v55, v58); -LABEL_83: - ++uZe; - a2c += 112; - if ( uZe >= (signed int)uNumSpriteObjects ) - { - goto LABEL_85; - } - } - v58 = v60; - v55 = uCenterY - v79; -LABEL_81: - v53 = v37; - v51 = uCenterY - v79; - goto LABEL_82; - } -LABEL_85: - v63 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 0, 0); - v61 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 255, 0); - v65 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0); - uZf = 0; - if ( (signed int)uNumActors > 0 ) - { - flagsc = pActors;//[0].uAIState; - do - { - v39 = flagsc->uAIState; - if ( flagsc->uAIState != 11 && v39 != 19 && (v39 == 5 || BYTE1(flagsc->uAttributes) & 0x80) ) - { - 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->field_1C_clipx ) - { - if ( v40 <= pRenderer->field_24_width && v41 >= pRenderer->field_20_clipy && v41 <= pRenderer->field_28_height ) - { - uWd = v61; - if ( BYTE3(flagsc->uAttributes) & 1 ) - uWd = v63; - if ( flagsc->uAIState == 5 ) - uWd = v65; - if ( (signed int)uZoom > 1024 ) - { - pRenderer->Line2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); - pRenderer->Line2D(v40, v41 - 2, v40, v41 + 2, uWd); - pRenderer->Line2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd); - v42 = v41 + 1; - v43 = v41 - 1; - v44 = v42; - pRenderer->Line2D(v40 - 2, v43, v40 - 2, v42, uWd); - v40 += 2; - v59 = uWd; - v56 = v44; - v54 = v40; - v52 = v43; - } - else - { - pRenderer->Line2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd); - v59 = uWd; - v56 = uCenterY - v76; - v54 = v40; - v52 = v41 - 1; - } - pRenderer->Line2D(v40, v52, v54, v56, v59); - } - } - } - ++uZf; - ++flagsc; - } - while ( uZf < (signed int)uNumActors ); - } - } - flagsd = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(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->field_1C_clipx ) - { - if ( v46 <= pRenderer->field_24_width && v47 >= pRenderer->field_20_clipy && v47 <= pRenderer->field_28_height ) - { - if ( (signed int)uZoom > 512 ) - { - v48 = v47 + 1; - v49 = v47 - 1; - pRenderer->Line2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd); - pRenderer->Line2D(v46, v49, v46, v48, flagsd); - pRenderer->Line2D(v46 + 1, v49, v46 + 1, v48, flagsd); - v45 = lPitchb; - } - else - { - pRenderer->Line2D(v46, uCenterY - v77, v46, uCenterY - v77, flagsd); - } - } - } - } - ++uZg; - v45 += 32; - lPitchb = v45; - } - while ( uZg < (signed int)uNumLevelDecorations ); - } - pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(dword_5079D8 != -1 ? &pIcons_LOD->pTextures[dword_5079D8] : 0)); - uZooma = (double)pParty->sRotationY * 0.1171875; - //v50 = uZooma + 6.7553994e15; - pRenderer->Clip(541, 0, 567, 480); - pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 136, (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0)); - pRenderer->ResetClip(); -} - - -//----- (00442955) -------------------------------------------------------- -void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 ) - { - int v5; // ebx@1 - int v6; // edi@1 - BLVMapOutlines *v7; // eax@8 - unsigned __int8 v8; // zf@8 - unsigned __int8 v9; // sf@8 - int v10; // esi@10 - unsigned int v11; // edx@11 - __int16 v12; // cx@12 - signed int v13; // eax@15 - int v14; // eax@16 - Vec3_short_ *v15; // ecx@16 - int v16; // edx@16 - int v17; // ecx@16 - Vec3_short_ *v18; // eax@16 - int v19; // ecx@16 - int v20; // eax@16 - signed int v21; // esi@18 - int v22; // ecx@21 - BLVMapOutline *v23; // ecx@21 - Vec3_short_ *v24; // edx@21 - Vec3_short_ *v25; // eax@21 - int v26; // ecx@21 - unsigned __int16 *v27; // edi@21 - int v28; // edx@21 - int v29; // eax@21 - double v30; // st7@23 - signed __int64 v31; // qax@23 - unsigned short *v32; // edx@23 - int textr_width; // esi@23 - signed int v34; // eax@23 - signed int v35; // ecx@23 - int v36; // esi@27 - int v37; // ecx@27 - int v38; // edx@31 - unsigned int v39; // eax@33 - short *v40; // esi@33 - short *v41; // edi@33 - unsigned __int8 v42; // cf@33 - unsigned int v43; // ecx@33 - short *v44; // edi@33 - short *v45; // esi@33 - int v46; // ecx@33 - signed int v47; // esi@38 - signed int v48; // ecx@38 - int v49; // eax@38 - signed int v50; // edx@55 - unsigned int v51; // ecx@55 - int result; // eax@72 - int v53; // eax@75 - int v54; // esi@75 - int v55; // eax@75 - __int16 v56; // si@85 - double v57; // st7@85 - int v58; // ebx@85 - signed __int64 v59; // qax@85 - signed int v60; // edi@85 - signed __int64 v61; // qax@85 - signed int v62; // ebx@85 - signed int v63; // esi@85 - int v64; // eax@87 - unsigned int v65; // ebx@95 - unsigned short *v66; // edx@95 - unsigned __int16 *v67; // esi@96 - int v68; // edi@98 - unsigned __int16 v69; // cx@99 - unsigned int v70; // [sp-10h] [bp-48074h]@80 - unsigned int v71; // [sp-Ch] [bp-48070h]@80 - unsigned int v72; // [sp-8h] [bp-4806Ch]@80 - signed int v73; // [sp-4h] [bp-48068h]@59 - unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 - unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23 - int v76; // [sp+4800Ch] [bp-58h]@23 - unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 - unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 - unsigned int surfPitch; // [sp+48018h] [bp-4Ch]@1 - - int v81; // [sp+48020h] [bp-44h]@23 - unsigned __int16* render16_data; - unsigned char* texture8_data; - unsigned char* curr_line; - int scale_increment; - int scaled_posX; - int scaled_posY; - int stepX_r; - int stepY_r; - - - unsigned int teal; // [sp+48028h] [bp-3Ch]@8 - int v84; // [sp+4802Ch] [bp-38h]@1 - int screenCenter_X; // [sp+48030h] [bp-34h]@1 - int v86; // [sp+48034h] [bp-30h]@1 - int v87; // [sp+48038h] [bp-2Ch]@16 - unsigned int v88; // [sp+4803Ch] [bp-28h]@16 - int black; // [sp+48040h] [bp-24h]@8 - int screenCenterY; // [sp+48044h] [bp-20h]@1 - unsigned int i; // [sp+48048h] [bp-1Ch]@9 - unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16 - unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 - signed int screenWidth; // [sp+48054h] [bp-10h]@8 - unsigned int v95; // [sp+48058h] [bp-Ch]@16 - int v96; // [sp+4805Ch] [bp-8h]@10 - const void *v97; // [sp+48060h] [bp-4h]@16 - unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 - int a5a; // [sp+48070h] [bp+Ch]@86 - - tl_x = tl_x; - tl_y = tl_y; - screenCenter_X = (signed int)(tl_x + br_x) >> 1; - screenCenterY = (signed int)(tl_y + br_y) >> 1; - surfPitch = pRenderer->uTargetSurfacePitch; - pRenderer->Clip_v2(tl_x, tl_y, br_x, br_y); - v5 = viewparams->field_2C; - v6 = viewparams->sViewCenterX; - v86 = viewparams->sViewCenterX; - v84 = viewparams->sViewCenterY; - if ( viewparams->field_2C != 384 ) - { - if ( viewparams->field_2C == 768 ) - { - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - v5 = 680; - } - } - else - { - v6 = viewparams->field_38; - v86 = viewparams->field_38; - v84 = viewparams->field_3A; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - v5 = viewparams->field_2C - 34; - } - if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) - { - screenWidth = br_x - tl_x + 1; - screenHeight = br_y - tl_y + 1; - render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch]; - texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; - pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; - scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5; - - v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); - - - teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; - v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); - - v32 = map_texture_16; - textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16; - v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); - black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); - - v76 = textr_width; - scaled_posY = stepY_r >> 16; - //nearest neiborhood scaling - if ( texture8_data) - { - for(uint i=0; i<screenHeight;++i) - { - curr_line=&texture8_data[scaled_posY*textr_width]; - stepX_r=teal; - for(uint j=0; j<screenWidth;++j) - { - scaled_posX=stepX_r>>16; - map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)]; - stepX_r+=scale_increment; - } - stepY_r+=scale_increment; - scaled_posY=stepY_r>>16; - } - } - //move visible square to render - for(uint i=0; i<screenHeight;++i) - { - if ( screenWidth > 0 ) - { - memcpy((void*)&render16_data[surfPitch*i],(void*)&map_texture_16[i*screenWidth], screenWidth*2); - } - } - } - else - { - black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); - teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); - v7 = pIndoor->pMapOutlines; - uNumBlueFacesInBLVMinimap = 0; - v8 = pIndoor->pMapOutlines->uNumOutlines == 0; - v9 = pIndoor->pMapOutlines->uNumOutlines < 0; - screenWidth = 0; - if ( !(v9 | v8) ) - { - i = 0; - do - { - v10 = (int)((char *)v7 + i + 4); - v96 = pIndoor->pFaces[*(short *)((char *)v7 + i + 8)].uAttributes; - if ( !(BYTE1(v96) & 0x20 || (v11 = pIndoor->pFaces[*(short *)((char *)v7 + i + 10)].uAttributes, BYTE1(v11) & 0x20) )) - { - v12 = *(short *)((char *)v7 + i + 14); - if ( !(v12 & 1) ) - { - if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) - { - v96 = (signed int)screenWidth >> 3; - v13 = screenWidth; - *(short *)(v10 + 10) = v12 | 1; - pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8); - } - } - if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1) - { - v14 = *(short *)v10; - v88 = v5; - v15 = &pIndoor->pVertices[v14]; - v16 = v15->x; - v17 = v15->y - v84; - v93 = (unsigned __int16 *)(v16 - v6); - screenHeight = v17; - v18 = &pIndoor->pVertices[*(short *)(v10 + 2)]; - v19 = v18->x; - v20 = v18->y - v84; - v95 = v19 - v6; - v97 = (const void *)v20; - v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16; - v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)v5) >> 16; - v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); - screenHeight = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; - pRenderer->Line2D( - screenCenter_X + v88, - screenCenterY - v87, - screenCenter_X + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), - screenCenterY - screenHeight, - black); - v7 = pIndoor->pMapOutlines; - } - } - ++screenWidth; - i += 12; - } - while ( screenWidth < (signed int)v7->uNumOutlines ); - } - v21 = 0; - if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) - { - while ( 1 ) - { - v22 = pBlueFacesInBLVMinimapIDs[v21]; - v87 = v5; - v23 = &v7->pOutlines[v22]; - v24 = &pIndoor->pVertices[v23->uVertex1ID]; - v25 = &pIndoor->pVertices[v23->uVertex2ID]; - v26 = v25->x; - v27 = (unsigned __int16 *)(v24->x - v86); - v28 = v24->y - v84; - v29 = v25->y - v84; - v93 = v27; - screenHeight = v28; - v97 = (const void *)v29; - v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16; - v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; - i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; - v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; - pRenderer->Line2D( - screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), - screenCenterY - v88, - screenCenter_X + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), - screenCenterY - v95, - teal); - ++v21; - if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) - break; - v7 = pIndoor->pMapOutlines; - } - v6 = v86; - } - } - v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 3; - v81 = pParty->vPosition.y - v84; - v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16); - v48 = 1; - v49 = screenCenterY - (int)v97 - 3; - if ( v47 >= (signed int)tl_x ) - { - if ( v47 > (signed int)br_x ) - { - if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 6) > (signed int)br_x ) - v48 = 0; - v47 = br_x; - } - } - else - { - if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X) < (signed int)tl_x ) - v48 = 0; - v47 = tl_x; - } - if ( v49 >= (signed int)tl_y ) - { - if ( v49 > br_y ) - { - if ( screenCenterY - (signed int)v97 - 6 > br_y ) - v48 = 0; - v49 = br_y; - } - } - else - { - if ( screenCenterY - (signed int)v97 < (signed int)tl_y ) - v48 = 0; - v49 = tl_y; - } - if ( v48 == 1 ) - { - v50 = 0; - v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; - if ( (signed int)(pParty->sRotationY & stru_5C6E00->uDoublePiMask) >= 128 ) - { - if ( (signed int)v51 > 384 ) - { - if ( (signed int)v51 >= 640 ) - { - if ( (signed int)v51 > 896 ) - { - if ( (signed int)v51 >= 1152 ) - { - if ( (signed int)v51 > 1408 ) - { - if ( (signed int)v51 >= 1664 ) - { - if ( (signed int)v51 <= 1920 ) - v73 = 7; - } - else - { - v73 = 6; - } - } - else - { - v73 = 5; - } - } - else - { - v73 = 4; - } - } - else - { - v73 = 3; - } - } - else - { - v73 = 2; - } - if( (signed int)v51 <=1920) - v50 = v73; - } - else - v50 = 1; - } - pRenderer->DrawTransparentRedShade(v47, v49, (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0)); - } - result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v95 = 0; - v86 = result; - if ( (signed int)uNumLevelDecorations > 0 ) - { - screenWidth = (unsigned int)&pLevelDecorations[0].vPosition; - do - { - if ( *(char *)(screenWidth - 2) & 8 ) - { - v53 = *(int *)(screenWidth + 4) - v84; - v93 = (unsigned __int16 *)(*(int *)screenWidth - v6); - screenHeight = v53; - v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; - v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16); - v55 = screenCenterY - (int)v97; - if ( v54 >= pRenderer->field_1C_clipx ) - { - if ( v54 <= pRenderer->field_24_width && v55 >= pRenderer->field_20_clipy && v55 <= pRenderer->field_28_height ) - { - v74 = v86; - if ( v5 > 512 ) - { - v96 = v55 + 1; - black = v55 - 1; - pRenderer->Line2D(v54 - 1, v55 - 1, v54 - 1, v55 + 1, v86); - pRenderer->Line2D(v54, black, v54, v96, v86); - ++v54; - v74 = v86; - v72 = v96; - v71 = v54; - v70 = black; - } - else - { - v72 = screenCenterY - (int)v97; - v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; - v70 = screenCenterY - (int)v97; - } - pRenderer->Line2D(v54, v70, v71, v72, v74); - } - } - } - ++v95; - result = v95; - screenWidth += 32; - } - while ( (signed int)v95 < (signed int)uNumLevelDecorations ); - } - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - { - screenCenterY = br_x - tl_x + 1; - v95 = br_y - tl_y + 1; - v77 = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch]; - v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; - black = (1 << (v56 + 16)) / v5; - v57 = (double)(1 << (16 - v56)); - v58 = 22528 / (v5 / 384); - v59 = (signed __int64)((double)(v6 - v58 + 32768) / v57); - v60 = (int)v59 << 16; - v97 = (const void *)((int)v59 << 16); - v61 = (signed __int64)((double)(32768 - v58 - v84) / v57); - pPalette_16 = (unsigned __int16 *)(v60 >> 16); - v62 = (int)v61 << 16; - teal = v60 >> 16; - v63 = (signed __int16)v61; - a4a = map_texture_16; - result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu); - screenCenter_X = 0; - for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X ) - { - a5a = 0; - if ( screenCenterY > 0 ) - { - v96 = (v63 - 80) / 4; - v64 = teal; - do - { - v81 = (v64 - 80) / 4; - if ( !pOutdoor->_47F04C(v81, v96) ) - { - if ( pOutdoor->_47F097(v81, v96) ) - { - if ( !((a5a + screenCenter_X) % 2) ) - *a4a = i; - } - else - { - *a4a = 0; - } - } - ++a4a; - v97 = (char *)v97 + black; - v64 = (signed int)v97 >> 16; - ++a5a; - } - while ( a5a < screenCenterY ); - } - v62 += black; - v97 = (const void *)v60; - a4a += screenCenterY - a5a; - v63 = v62 >> 16; - ++screenCenter_X; - teal = (unsigned int)pPalette_16; - } - v65 = v95; - v66 = map_texture_16; - if ( (signed int)v95 > 0 ) - { - v67 = v77; - result = 2 * (surfPitch - screenCenterY); - do - { - if ( screenCenterY > 0 ) - { - v68 = screenCenterY; - do - { - v69 = *(short *)v66; - if ( !*(short *)v66 || v69 == (short)i ) - *v67 = v69; - ++v66; - ++v67; - --v68; - } - while ( v68 ); - } - v67 = (unsigned __int16 *)((char *)v67 + result); - --v65; - } - while ( v65 ); - } - } -} - @@ -14883,20 +13833,7 @@ } -//----- (00448A17) -------------------------------------------------------- -void Chest::ToggleFlag(unsigned int uChestID, unsigned __int16 uFlag, unsigned int bToggle) -{ - unsigned __int16 *pFlags; // eax@3 - - if ( (uChestID & 0x80000000u) == 0 && (signed int)uChestID <= 19 ) - { - pFlags = &pChests[uChestID].uFlags; - if ( bToggle ) - *pFlags |= uFlag; - else - *pFlags &= ~uFlag; - } -} + //----- (00448A40) -------------------------------------------------------- void Actor::ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle)