Mercurial > mm7
diff GUI/UI/UiGame.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | dd36326a9994 |
children |
line wrap: on
line diff
--- a/GUI/UI/UiGame.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/GUI/UI/UiGame.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -44,8 +44,6 @@ #include "Media/Audio/AudioPlayer.h" -int uTextureID_GameUI_CharSelectionFrame; // 50C98C - Image *game_ui_statusbar = nullptr; Image *game_ui_rightframe = nullptr; @@ -60,15 +58,6 @@ Image *game_ui_monster_hp_border_left = nullptr; Image *game_ui_monster_hp_border_right = nullptr; -Image *game_ui_bar_red = nullptr; -Image *game_ui_bar_yellow = nullptr; -Image *game_ui_bar_green = nullptr; -Image *game_ui_bar_blue = nullptr; - -Image *game_ui_player_alert_yellow = nullptr; // 5079C8 -Image *game_ui_player_alert_red = nullptr; // 5079CC -Image *game_ui_player_alert_green = nullptr; // 5079D0 - Image *game_ui_minimap_frame = nullptr; // 5079D8 Image *game_ui_minimap_compass = nullptr; // 5079B4 std::array<Image *, 8> game_ui_minimap_dirs; @@ -105,6 +94,24 @@ Image *game_ui_evtnpc = nullptr; // 50795C +std::array< std::array<Image *, 56>, 4> game_ui_player_faces; +Image *game_ui_player_face_eradicated = nullptr; +Image *game_ui_player_face_dead = nullptr; + +Image *game_ui_player_selection_frame = nullptr; // 50C98C +Image *game_ui_player_alert_yellow = nullptr; // 5079C8 +Image *game_ui_player_alert_red = nullptr; // 5079CC +Image *game_ui_player_alert_green = nullptr; // 5079D0 + +Image *game_ui_bar_red = nullptr; +Image *game_ui_bar_yellow = nullptr; +Image *game_ui_bar_green = nullptr; +Image *game_ui_bar_blue = nullptr; + +Image *game_ui_playerbuff_pain_reflection = nullptr; +Image *game_ui_playerbuff_hammerhands = nullptr; +Image *game_ui_playerbuff_preservation = nullptr; +Image *game_ui_playerbuff_bless = nullptr; GUIWindow_GameMenu::GUIWindow_GameMenu() : GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) @@ -759,9 +766,11 @@ popup_window.uFrameZ = popup_window.uFrameX + 399; popup_window.DrawMessageBox(0); sprintfex(pTmpBuf2.data(), "NPC%03d", pNPC->uPortraitID); - pRenderer->DrawTextureTransparentColorKey(popup_window.uFrameX + 22, popup_window.uFrameY + 36, - (Texture_MM7 *)(pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE) != -1 - ? &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE)] : 0)); + pRenderer->DrawTextureAlphaNew( + (popup_window.uFrameX + 22)/640.0f, + (popup_window.uFrameY + 36)/480.0f, + assets->GetImage_16BitColorKey(pTmpBuf2.data(), 0x7FF) + ); if ( pNPC->uProfession ) { v11 = pTmpBuf.data(); @@ -814,7 +823,7 @@ game_ui_dialogue_background = assets->GetImage_16Bit(pContainer); sprintfex(pContainer, "npc%03u", pNPCInfo->uPortraitID); v9 = 0; - pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); + pDialogueNPCPortraits[0] = assets->GetImage_16BitColorKey(pContainer, 0x7FF); dword_591084 = areWeLoadingTexture; if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 ) @@ -916,7 +925,7 @@ pRenderer->DrawTextureNew(477/640.0f, 0, game_ui_dialogue_background); pRenderer->DrawTextureAlphaNew(468/640.0f, 0, game_ui_right_panel_frame); pRenderer->DrawTextureAlphaNew((pNPCPortraits_x[0][0] - 4)/640.0f, (pNPCPortraits_y[0][0] - 4)/480.0f, game_ui_evtnpc); - pRenderer->DrawTextureTransparentColorKey(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[0]); + pRenderer->DrawTextureAlphaNew(pNPCPortraits_x[0][0]/640.0f, pNPCPortraits_y[0][0]/480.0f, pDialogueNPCPortraits[0]); if (pNPC->uProfession) { @@ -1306,7 +1315,7 @@ //----- (0041D3B7) -------------------------------------------------------- void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player) { - Texture_MM7 *v13; // eax@6 + Image *v13; // eax@6 PlayerFrame *v15; // eax@12 unsigned int pTextColor; // eax@15 const char *v29; // eax@16 @@ -1326,9 +1335,9 @@ window->DrawMessageBox(0); if (player->IsEradicated()) - v13 = pTexture_PlayerFaceEradicated; + v13 = game_ui_player_face_eradicated; else if (player->IsDead()) - v13 = pTexture_PlayerFaceDead; + v13 = game_ui_player_face_dead; else { uFramesetID = pPlayerFrameTable->GetFrameIdByExpression(player->expression); @@ -1339,10 +1348,10 @@ else v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, pMiscTimer->Time()); player->field_1AA2 = v15->uTextureID - 1; - v13 = pTextures_PlayerFaces[(unsigned int)window->ptr_1C][v15->uTextureID - 1]; + v13 = game_ui_player_faces[(unsigned int)window->ptr_1C][v15->uTextureID - 1]; } - pRenderer->DrawTextureIndexedAlpha(window->uFrameX + 24, window->uFrameY + 24, v13); + pRenderer->DrawTextureAlphaNew((window->uFrameX + 24)/640.0f, (window->uFrameY + 24)/480.0f, v13); sprintfex(pTmpBuf.data(), "\f%05d", ui_character_header_text_color); sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]); // "%s the %s" @@ -1951,15 +1960,17 @@ void GameUI_DrawCharacterSelectionFrame() { if ( uActiveCharacter ) - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, 380, - pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame)); + pRenderer->DrawTextureAlphaNew( + (pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9)/640.0f, + 380/480.0f, + game_ui_player_selection_frame); } //----- (0044162D) -------------------------------------------------------- void GameUI_DrawPartySpells() { unsigned int v0; // ebp@1 - Texture_MM7 *spell_texture; // [sp-4h] [bp-1Ch]@12 + Image *spell_texture; // [sp-4h] [bp-1Ch]@12 //Texture_MM7 *v9; // [sp-4h] [bp-1Ch]@21 v0 = (signed __int64)((double)GetTickCount() * 0.050000001); @@ -1971,9 +1982,11 @@ { Texture_MM7* 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); + pRenderer->_4A65CC( + pPartySpellbuffsUI_XYs[i][0], + pPartySpellbuffsUI_XYs[i][1], tex, tex, + v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63 + ); } //++v1; } @@ -1983,22 +1996,22 @@ if (pParty->FlyActive()) { if ( pParty->bFlying ) - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); + spell_texture = pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->texture; else - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); + spell_texture = pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->texture; //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureTransparentColorKey(8, 8, spell_texture); + pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, spell_texture); /*else pRenderer->DrawTextureIndexedAlpha(8, 8, v7);*/ } if ( pParty->WaterWalkActive() ) { if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER ) - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); + spell_texture = pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->texture; else - spell_texture = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); + spell_texture = pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->texture; //if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureTransparentColorKey(396, 8, spell_texture); + pRenderer->DrawTextureAlphaNew(396/640.0f, 8/480.0f, spell_texture); /*else pRenderer->DrawTextureIndexedAlpha(396, 8, v9);*/ } @@ -2006,13 +2019,13 @@ for (uint i = 0; i < 4; ++i) { if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime ) - pRenderer->DrawTextureTransparentColorKey(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 427/480.0f, game_ui_playerbuff_hammerhands); if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime ) - pRenderer->DrawTextureTransparentColorKey(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 393/480.0f, game_ui_playerbuff_bless); if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime ) - pRenderer->DrawTextureTransparentColorKey(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 410/480.0f, game_ui_playerbuff_preservation); if ( pParty->pPlayers[i].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime ) - pRenderer->DrawTextureTransparentColorKey(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72)/640.0f, 444/480.0f, game_ui_playerbuff_pain_reflection); } } @@ -2021,7 +2034,7 @@ { unsigned int face_expression_ID; // eax@17 PlayerFrame *pFrame; // eax@21 - Texture_MM7 *pPortrait; // [sp-4h] [bp-1Ch]@27 + Image *pPortrait; // [sp-4h] [bp-1Ch]@27 if ( _A750D8_player_speech_timer ) { @@ -2039,11 +2052,11 @@ Player* pPlayer = &pParty->pPlayers[i]; if ( pPlayer->IsEradicated() ) { - pPortrait = pTexture_PlayerFaceEradicated; + pPortrait = game_ui_player_face_eradicated; if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); else - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, pPortrait); if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) @@ -2052,11 +2065,11 @@ } if (pPlayer->IsDead()) { - pPortrait = pTexture_PlayerFaceDead; + pPortrait = game_ui_player_face_dead; if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); else - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, pPortrait); if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) @@ -2079,11 +2092,11 @@ if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || _this ) { pPlayer->field_1AA2 = pFrame->uTextureID - 1; - pPortrait = (Texture_MM7 *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture_MM7 *)pTextures_PlayerFaces[i][pFrame->uTextureID]; + pPortrait = game_ui_player_faces[i][pPlayer->field_1AA2];//pFace = (Texture_MM7 *)game_ui_player_faces[i][pFrame->uTextureID]; if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) - pRenderer->DrawTranslucent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 388, pPortrait); + pRenderer->DrawTextureGrayShade(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]/640.0f, 388/480.0f, pPortrait); else - pRenderer->DrawTextureIndexedAlpha(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1, 388, pPortrait); + pRenderer->DrawTextureAlphaNew((pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 1)/640.0f, 388/480.0f, pPortrait); if ( pPlayer->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_HEROISM].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_SHIELD].uExpireTime | pPlayer->pPlayerBuffs[PLAYER_BUFF_STONESKIN].uExpireTime ) @@ -2483,13 +2496,19 @@ { if (pParty->TorchlightActive()) { - IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); - pRenderer->DrawTextureIndexedAlpha(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); + pRenderer->DrawTextureAlphaNew( + pUIAnum_Torchlight->x/640.0f, + pUIAnum_Torchlight->y/480.0f, + pIconsFrameTable->GetFrame(pUIAnum_Torchlight->icon->id, pEventTimer->Time())->texture + ); } if (pParty->WizardEyeActive()) { - IconFrame* icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); - pRenderer->DrawTextureIndexedAlpha(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); + pRenderer->DrawTextureAlphaNew( + pUIAnim_WizardEye->x/640.0f, + pUIAnim_WizardEye->y/480.0f, + pIconsFrameTable->GetFrame(pUIAnim_WizardEye->icon->id, pEventTimer->Time())->texture + ); } } } @@ -2530,14 +2549,22 @@ if ( (unsigned __int8)pTmpBuf[i] >= 2 ) { sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)pTmpBuf[i] + 499].uPortraitID); - pRenderer->DrawTextureTransparentColorKey(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE))); + pRenderer->DrawTextureAlphaNew( + pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, + pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, + //pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)) + assets->GetImage_16BitColorKey(pContainer, 0x7FF) + ); } else { sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].uPortraitID); - pRenderer->DrawTextureTransparentColorKey(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE))); + pRenderer->DrawTextureAlphaNew( + pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, + pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, + //pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)) + assets->GetImage_16BitColorKey(pContainer, 0x7FF) + ); if ( pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_A == 1 ) { uFrameID = pParty->pHirelings[(unsigned __int8)pTmpBuf[i]].evt_B; @@ -2546,12 +2573,16 @@ { for ( v13 = 0; v13 < pIconsFrameTable->uNumIcons; ++v13 ) { - if ( !_stricmp("spell96", pIconsFrameTable->pIcons[v13].pAnimationName) ) + if ( !_stricmp("spell96", pIconsFrameTable->pIcons[v13].GetAnimationName()) ) break; } } - pRenderer->DrawTextureIndexedAlpha(pHiredNPCsIconsOffsetsX[pNPC_limit_ID], pHiredNPCsIconsOffsetsY[pNPC_limit_ID], - &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(v13, uFrameID)->uTextureID]); + pRenderer->DrawTextureAlphaNew( + pHiredNPCsIconsOffsetsX[pNPC_limit_ID]/640.0f, + pHiredNPCsIconsOffsetsY[pNPC_limit_ID]/480.0f, + //&pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(v13, uFrameID)->uTextureID] + pIconsFrameTable->GetFrame(v13, uFrameID)->texture + ); } } ++pNPC_limit_ID;