Mercurial > mm7
comparison GUI/UI/UIHouses.cpp @ 2573:0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
Changing more class Texture to class Image.
author | a.parshin |
---|---|
date | Sat, 05 Mar 2016 16:25:53 +0200 |
parents | d87bfbd3bb3b |
children | dd36326a9994 |
comparison
equal
deleted
inserted
replaced
2572:d87bfbd3bb3b | 2573:0c67be4ec900 |
---|---|
3 #include <crtdbg.h> | 3 #include <crtdbg.h> |
4 | 4 |
5 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
6 | 6 |
7 #include "Engine/Engine.h" | 7 #include "Engine/Engine.h" |
8 #include "Engine/AssetsManager.h" | |
8 | 9 |
9 #include "UIGuilds.h" | 10 #include "UIGuilds.h" |
10 #include "UIPartyCreation.h" | 11 #include "UIPartyCreation.h" |
11 #include "UIShops.h" | 12 #include "UIShops.h" |
12 #include "..\../GUI/GUIButton.h" | 13 #include "..\../GUI/GUIButton.h" |
41 | 42 |
42 int dword_591080; // weak | 43 int dword_591080; // weak |
43 | 44 |
44 BuildingType in_current_building_type; // 00F8B198 | 45 BuildingType in_current_building_type; // 00F8B198 |
45 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C | 46 HOUSE_DIALOGUE_MENU dialog_menu_id; // 00F8B19C |
47 | |
48 | |
49 class Image *_591428_endcap = nullptr; | |
50 | |
46 | 51 |
47 #pragma pack(push, 1) | 52 #pragma pack(push, 1) |
48 struct stru365_travel_info | 53 struct stru365_travel_info |
49 { | 54 { |
50 unsigned char uMapInfoID; | 55 unsigned char uMapInfoID; |
319 {"Player Castle Good", 0x24, 0, 25, 0, 0 }, | 324 {"Player Castle Good", 0x24, 0, 25, 0, 0 }, |
320 {"Player Castle Bad", 0x24, 0, 25, 0, 0} | 325 {"Player Castle Bad", 0x24, 0, 25, 0, 0} |
321 }}; | 326 }}; |
322 | 327 |
323 | 328 |
329 static std::array<const char *, 19> _4F03B8_shop_background_names = | |
330 { | |
331 { | |
332 "", "WEPNTABL", "ARMORY", "MAGSHELF", | |
333 "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", | |
334 "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", | |
335 "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", | |
336 "MAGSHELF", "MAGSHELF", "MAGSHELF" | |
337 } | |
338 }; | |
339 | |
340 | |
324 | 341 |
325 //----- (004B3A72) -------------------------------------------------------- | 342 //----- (004B3A72) -------------------------------------------------------- |
326 void InitializaDialogueOptions_Tavern(BuildingType type) | 343 void InitializaDialogueOptions_Tavern(BuildingType type) |
327 { | 344 { |
328 int num_buttons; // esi@1 | 345 int num_buttons; // esi@1 |
885 } | 902 } |
886 | 903 |
887 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | 904 v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
888 pDialogueNPCCount = 0; | 905 pDialogueNPCCount = 0; |
889 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; | 906 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; |
890 right_panel_loop = right_panel; | 907 |
891 PrepareHouse(uHouseID); | 908 PrepareHouse(uHouseID); |
892 v18 = 1; | 909 v18 = 1; |
893 right_panel_loop = right_panel; | 910 |
894 if ( uNumDialogueNPCPortraits == 1 ) | 911 if ( uNumDialogueNPCPortraits == 1 ) |
895 pDialogueNPCCount = 1; | 912 pDialogueNPCCount = 1; |
896 pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | 913 pMediaPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); |
897 dword_5C35D4 = 1; | 914 dword_5C35D4 = 1; |
898 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) | 915 if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) |
1045 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) | 1062 if ( !pPlayers[uActiveCharacter]->IsPlayerHealableByTemple() ) |
1046 return; | 1063 return; |
1047 } | 1064 } |
1048 } | 1065 } |
1049 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; | 1066 dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; |
1050 if ( in_current_building_type < BuildingType_19 ) | 1067 if (in_current_building_type < BuildingType_19) |
1051 ShopTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(off_4F03B8[(int)in_current_building_type], TEXTURE_16BIT_PALETTE)]; | 1068 { |
1069 wchar_t name[1024]; | |
1070 swprintf(name, L"%S", _4F03B8_shop_background_names[(int)in_current_building_type]); | |
1071 | |
1072 shop_ui_background = assets->GetImage_16BitColorKey(name, 0x7FF); | |
1073 } | |
1052 } | 1074 } |
1053 | 1075 |
1054 //NEW | 1076 //NEW |
1055 switch (in_current_building_type) | 1077 switch (in_current_building_type) |
1056 { | 1078 { |
1713 { | 1735 { |
1714 pOutString = pFontCreate; | 1736 pOutString = pFontCreate; |
1715 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7; | 1737 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &window, 13, 0) + 7; |
1716 } | 1738 } |
1717 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | 1739 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
1718 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | 1740 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap); |
1719 window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0); | 1741 window.DrawText(pOutString, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pOutString, &window, 13, 0), 0, 0, 0); |
1720 break; | 1742 break; |
1721 } | 1743 } |
1722 case HOUSE_DIALOGUE_TOWNHALL_PAY_FINE: | 1744 case HOUSE_DIALOGUE_TOWNHALL_PAY_FINE: |
1723 { | 1745 { |
2012 { | 2034 { |
2013 pOutString = pFontCreate; | 2035 pOutString = pFontCreate; |
2014 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | 2036 pTextHeight = pFontCreate->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; |
2015 } | 2037 } |
2016 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | 2038 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
2017 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | 2039 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap); |
2018 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); | 2040 window_SpeakInHouse->DrawText(pOutString, 12, 354 - pTextHeight, 0, FitTextInAWindow(pTmpBuf.data(), pOutString, &dialog_window, 0xCu, 0), 0, 0, 0); |
2019 break; | 2041 break; |
2020 } | 2042 } |
2021 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | 2043 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: |
2022 { | 2044 { |
2023 strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); | 2045 strcpy(pTmpBuf.data(), pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); |
2024 dialog_window.uFrameWidth = game_viewport_width; | 2046 dialog_window.uFrameWidth = game_viewport_width; |
2025 dialog_window.uFrameZ = 452; | 2047 dialog_window.uFrameZ = 452; |
2026 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; | 2048 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &dialog_window, 12, 0) + 7; |
2027 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | 2049 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
2028 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | 2050 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap); |
2029 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, | 2051 window_SpeakInHouse->DrawText(pFontArrus, 12, 354 - pTextHeight, 0, |
2030 FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); | 2052 FitTextInAWindow(pTmpBuf.data(), pFontArrus, &dialog_window, 0xCu, 0), 0, 0, 0); |
2031 break; | 2053 break; |
2032 } | 2054 } |
2033 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | 2055 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: |
2903 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)]; | 2925 pInString = pNPCStats->pNPCGreetings[pNPC->greet].pGreetings[((pNPC->uFlags & 3) == 2)]; |
2904 //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); | 2926 //pInString = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * pNPC->greet); |
2905 pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), | 2927 pRenderer->GetLeather(8, 352 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), |
2906 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight | 2928 pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight |
2907 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); | 2929 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7)); |
2908 pRenderer->DrawTextureIndexed(8, 347 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), pTexture_591428); | 2930 |
2909 pDialogueWindow->DrawText(pFontArrus, 13, 354 - (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7), | 2931 int h = (pFontArrus->CalcTextHeight(pInString, &house_window, 13, 0) + 7); |
2910 0, FitTextInAWindow(pInString, pFontArrus, &house_window, 0xDu, 0), 0, 0, 0); | 2932 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - h)/480.0f, _591428_endcap); |
2933 pDialogueWindow->DrawText(pFontArrus, 13, 354 - h, 0, FitTextInAWindow(pInString, pFontArrus, &house_window, 0xDu, 0), 0, 0, 0); | |
2911 } | 2934 } |
2912 } | 2935 } |
2913 } | 2936 } |
2914 //for right panel | 2937 //for right panel |
2915 memcpy(&right_panel_window, pDialogueWindow, sizeof(right_panel_window)); | 2938 memcpy(&right_panel_window, pDialogueWindow, sizeof(right_panel_window)); |
3060 { | 3083 { |
3061 pTextFont = pFontCreate; | 3084 pTextFont = pFontCreate; |
3062 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; | 3085 pTextHeight = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; |
3063 } | 3086 } |
3064 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); | 3087 pRenderer->GetLeather(8, 352 - pTextHeight, pIcons_LOD->GetTexture(uTextureID_Leather), pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - pTextHeight); |
3065 pRenderer->DrawTextureIndexed(8, 347 - pTextHeight, pTexture_591428); | 3088 pRenderer->DrawTextureAlphaNew(8/640.0f, (347 - pTextHeight)/480.0f, _591428_endcap); |
3066 house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0); | 3089 house_window.DrawText(pTextFont, 13, 354 - pTextHeight, 0, FitTextInAWindow(current_npc_text, pTextFont, &w, 13, 0), 0, 0, 0); |
3067 } | 3090 } |
3068 } | 3091 } |
3069 | 3092 |
3070 //----- (004B4F4F) -------------------------------------------------------- | 3093 //----- (004B4F4F) -------------------------------------------------------- |
3317 activeLevelDecoration = nullptr; | 3340 activeLevelDecoration = nullptr; |
3318 current_npc_text = 0; | 3341 current_npc_text = 0; |
3319 if ( pDialogueNPCCount == 0) | 3342 if ( pDialogueNPCCount == 0) |
3320 return 0; | 3343 return 0; |
3321 | 3344 |
3322 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL && ShopTexture ) | 3345 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL && shop_ui_background) |
3323 { | 3346 { |
3324 ShopTexture->Release(); | 3347 shop_ui_background->Release(); |
3325 ShopTexture = 0; | 3348 shop_ui_background = nullptr; |
3326 } | 3349 } |
3327 | 3350 |
3328 switch(dialog_menu_id) | 3351 switch(dialog_menu_id) |
3329 { | 3352 { |
3330 case -1: | 3353 case -1: |