annotate GUI/UI/UITransition.cpp @ 2553:48708da03b7f

Party Creation UI logic separated from MainMenu
author a.parshin
date Wed, 13 May 2015 02:20:05 +0200
parents 3121fb54a110
children d87bfbd3bb3b
rev   line source
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
4
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
6 #include <io.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
7
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
8 #include "Engine/Engine.h"
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
9 #include "Engine/Party.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
10 #include "Engine/Graphics/Outdoor.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
11 #include "Engine/LOD.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
12 #include "Engine/Timer.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
13 #include "Engine/stru159.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
14 #include "Engine/Events2D.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
15 #include "Engine/texts.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
16 #include "Engine/MapInfo.h"
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
17
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
18 #include "GUI/UI/UITransition.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
19 #include "GUI/GUIFont.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
20 #include "GUI/GUIProgressBar.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
21 #include "GUI/UI/UIHouses.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
22
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
23 #include "Media/Audio/AudioPlayer.h"
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
24 #include "Media/MediaPlayer.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
25
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
26
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
27
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
28
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
29 void GUIWindow_Travel::Release()
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
30 {
2549
3121fb54a110 Rest & Spelbook refactored into class
a.parshin
parents: 2546
diff changeset
31 // -----------------------------------------
3121fb54a110 Rest & Spelbook refactored into class
a.parshin
parents: 2546
diff changeset
32 // 0041C26A void GUIWindow::Release --- part
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
33 pTexture_outside->Release();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
34 pTexture_Dialogue_Background->Release();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
35 pIcons_LOD->SyncLoadedFilesCount();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
36 current_screen_type = prev_screen_type;
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
37
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
38 GUIWindow::Release();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
39 }
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
40
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
41 void GUIWindow_Transition::Release()
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
42 {
2549
3121fb54a110 Rest & Spelbook refactored into class
a.parshin
parents: 2546
diff changeset
43 // -----------------------------------------
3121fb54a110 Rest & Spelbook refactored into class
a.parshin
parents: 2546
diff changeset
44 // 0041C26A void GUIWindow::Release --- part
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
45 //pVideoPlayer->Unload();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
46 pTexture_outside->Release();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
47 pTexture_Dialogue_Background->Release();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
48 pIcons_LOD->SyncLoadedFilesCount();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
49 current_screen_type = prev_screen_type;
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
50
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
51 GUIWindow::Release();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
52 }
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
53
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
54
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
55 //----- (00444839) --------------------------------------------------------
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
56 GUIWindow_Transition::GUIWindow_Transition(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) :
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
57 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
58 {
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
59 // ----------------------------------
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
60 // 00444839 TransitionUI_Load -- part
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
61 const char *v15; // eax@14
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
62 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
63
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
64 dword_59117C_teleportx = x;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
65 dword_591178_teleporty = y;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
66 dword_591174_teleportz = z;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
67 dword_591170_teleport_directiony = directiony;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
68 dword_59116C_teleport_directionx = directionx;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
69 dword_591168_teleport_speedz = a8;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
70 dword_591164_teleport_map_name = (char *)pLocationName;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
71 uCurrentHouse_Animation = anim_id;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
72 pEventTimer->Pause();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
73 pAudioPlayer->StopChannels(-1, -1);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
74
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
75 switch (pParty->alignment)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
76 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
77 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
78 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
79 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
80 default: Error("Invalid alignment: %u", pParty->alignment);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
81 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
82
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
83 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
84 pTexture_outside = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[exit_pic_id], TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
85 if (anim_id)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
86 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
87 if ( !IndoorLocation::GetLocationIndex(pLocationName) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
88 pMediaPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1);
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
89
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
90 v15 = pLocationName;
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
91 if (*pLocationName == 48)
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
92 v15 = pCurrentMapName;
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
93 if (pMapStats->GetMapInfo(v15))
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
94 {
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
95 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[pMapStats->GetMapInfo(v15)].pName);//Войти в ^Pv[%s]
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
96 if (uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30)
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
97 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
98 if (IndoorLocation::GetLocationIndex(pLocationName))
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
99 uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
100 }
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
101 else
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
102 {
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
103 strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[73]);//Войти
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
104 //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
105 //PlayHouseSound(anim_id, HouseSound_Greeting);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
106 if (uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30)
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
107 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
108 if (IndoorLocation::GetLocationIndex(pLocationName))
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
109 uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
110 }
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
111 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
112 else if ( !IndoorLocation::GetLocationIndex(pLocationName) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
113 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
114 if ( pMapStats->GetMapInfo(pCurrentMapName) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
115 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
116 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); // "Leave %s"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
117 //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
118 //PlayHouseSound(anim_id, HouseSound_Greeting);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
119 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
120 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
121 if ( IndoorLocation::GetLocationIndex(pLocationName) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
122 uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
123 }
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
124 else
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
125 {
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
126 strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
127 //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId )
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
128 //PlayHouseSound(anim_id, HouseSound_Greeting);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
129 if (uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30)
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
130 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
131 if (IndoorLocation::GetLocationIndex(pLocationName))
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
132 uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
133 }
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
134 }
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
135
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
136 auto hint = this->Hint = sHouseName.data();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
137
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
138 //
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
139 // --------------------------------
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
140 // 0041C432 GUIWindow c-tor -- part
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
141 prev_screen_type = current_screen_type;
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
142 current_screen_type = SCREEN_INPUT_BLV;
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
143 pBtn_ExitCancel = CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); // Cancel / Отмена
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
144 pBtn_YES = CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
145 CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, hint, 0);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
146 CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, hint, 0);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
147 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
148
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
149
2546
4087cbc62706 GameMenu logic moved to GUIWindow_GameMenu
a.parshin
parents: 2545
diff changeset
150
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
151 //----- (00444C8F) --------------------------------------------------------
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
152 GUIWindow_Travel::GUIWindow_Travel() :
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
153 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
154 {
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
155 // ------------------------------
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
156 // 00444C8F TravelUI_Load -- part
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
157 char pContainer[32]; // [sp+0h] [bp-28h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
158
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
159 pEventTimer->Pause();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
160
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
161 switch (pParty->alignment)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
162 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
163 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
164 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
165 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
166 default: Error("Invalid alignment: %u", pParty->alignment);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
167 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
168
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
169 pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
170 pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
171 if ( pMapStats->GetMapInfo(pCurrentMapName) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
172 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName);// "Leave %s"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
173 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
174 strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit"
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
175
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
176
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
177
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
178 auto hint = this->Hint = sHouseName.data();
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
179
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
180 // --------------------------------
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
181 // 0041C432 GUIWindow c-tor -- part
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
182 prev_screen_type = current_screen_type;
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
183 current_screen_type = SCREEN_CHANGE_LOCATION;
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
184 pBtn_ExitCancel = CreateButton(
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
185 566, 445, 75, 33, 1, 0,
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
186 UIMSG_CHANGE_LOCATION_ClickCencelBtn,
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
187 0,
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
188 'N',
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
189 pGlobalTXT_LocalizationStrings[156],
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
190 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2),
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
191 0
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
192 );// Stay in this area / Остаться в этой области
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
193 pBtn_YES = CreateButton(
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
194 486, 445, 75, 33, 1, 0,
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
195 UIMSG_OnTravelByFoot,
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
196 0,
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
197 'Y',
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
198 hint,
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
199 pIcons_LOD->GetTexture(uTextureID_BUTTYES2),
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
200 0
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
201 );
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
202 CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', hint, 0, 0, 0);
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
203 CreateButton(8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, hint, 0);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
204 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
205
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
206
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
207
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
208 //----- (00444DCA) --------------------------------------------------------
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
209 void GUIWindow_Travel::Update()
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
210 {
2546
4087cbc62706 GameMenu logic moved to GUIWindow_GameMenu
a.parshin
parents: 2545
diff changeset
211 // -----------------------------------
4087cbc62706 GameMenu logic moved to GUIWindow_GameMenu
a.parshin
parents: 2545
diff changeset
212 // 004156F0 GUI_UpdateWindows --- part
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
213 GUIWindow travel_window; // [sp+Ch] [bp-78h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
214 char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
215
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
216 memcpy(&travel_window, pPrimaryWindow, sizeof(travel_window));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
217 pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
218 pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background);
2524
c7264ab7132f Main menu rendered using d3d11
a.parshin
parents: 2502
diff changeset
219 pRenderer->DrawTextureIndexedAlpha(468, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
220 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
221 pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
222 pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
223 if ( pMapStats->GetMapInfo(pDestinationMapName) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
224 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
225 travel_window.uFrameX = 493;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
226 travel_window.uFrameWidth = 126;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
227 travel_window.uFrameZ = 366;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
228 travel_window.DrawTitleText(pFontCreate, 0, 4, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName, 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
229 travel_window.uFrameX = 483;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
230 travel_window.uFrameWidth = 148;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
231 travel_window.uFrameZ = 334;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
232 if ( GetTravelTime() == 1 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
233 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[663], 1, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d day to cross to %s."
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
234 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
235 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[128], GetTravelTime(), pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d days to travel to %s."
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
236
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
237 strcat(pTmpBuf.data(), "\n \n");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
238 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
239 strcat(pTmpBuf.data(), pTmpBuf2.data());
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
240 travel_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
241 _unused_5B5924_is_travel_ui_drawn = 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
242 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
243 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
244
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
245
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
246
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
247 //----- (00444A51) --------------------------------------------------------
2545
e06a3fe9ad6e TravelUI init logic moved to GUIWindow_Travel
a.parshin
parents: 2544
diff changeset
248 void GUIWindow_Transition::Update()
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
249 {
2546
4087cbc62706 GameMenu logic moved to GUIWindow_GameMenu
a.parshin
parents: 2545
diff changeset
250 // -----------------------------------
4087cbc62706 GameMenu logic moved to GUIWindow_GameMenu
a.parshin
parents: 2545
diff changeset
251 // 004156F0 GUI_UpdateWindows --- part
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
252 unsigned int v4; // [sp-10h] [bp-7Ch]@12
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
253 GUIWindow transition_window; // [sp+Ch] [bp-60h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
254 unsigned int v9; // [sp+60h] [bp-Ch]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
255 unsigned int map_id; // [sp+64h] [bp-8h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
256
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
257 memcpy(&transition_window, pPrimaryWindow, sizeof(transition_window));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
258 v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
259 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
260 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
261 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
262 uTextureID_right_panel_loop = uTextureID_right_panel;
2524
c7264ab7132f Main menu rendered using d3d11
a.parshin
parents: 2502
diff changeset
263 pRenderer->DrawTextureIndexedAlpha(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel));
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
264 pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
265 pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
266 map_id = pMapStats->GetMapInfo(pCurrentMapName);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
267 if ( (pMovie_Track || v9) && *dword_591164_teleport_map_name != ' ' )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
268 map_id = pMapStats->GetMapInfo(dword_591164_teleport_map_name);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
269 transition_window.uFrameX = 493;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
270 transition_window.uFrameWidth = 126;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
271 transition_window.uFrameZ = 366;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
272 transition_window.DrawTitleText(pFontCreate, 0, 5, 0, pMapStats->pInfos[map_id].pName, 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
273 transition_window.uFrameX = 483;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
274 transition_window.uFrameWidth = 148;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
275 transition_window.uFrameZ = 334;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
276
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
277 if ( uCurrentHouse_Animation )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
278 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
279 v4 = (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uCurrentHouse_Animation], &transition_window, 0, 0)) / 2 + 101;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
280 transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTransitionStrings[uCurrentHouse_Animation], 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
281 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
282 else if ( map_id )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
283 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
284 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapStats->pInfos[map_id].pName);// "Do you wish to leave %s?"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
285 v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &transition_window, 0, 0)) / 2 + 101;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
286 transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
287 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
288 else Error("Troubles in da house");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
289
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
290 _unused_5B5924_is_travel_ui_drawn = true;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
291 }