1033
|
1 #include <assert.h>
|
|
2 #include <io.h>
|
|
3
|
|
4 #include "Mouse.h"
|
|
5 #include "Keyboard.h"
|
|
6 #include "VideoPlayer.h"
|
|
7 #include "MapInfo.h"
|
|
8 #include "Game.h"
|
|
9 #include "GUIWindow.h"
|
|
10 #include "GUIFont.h"
|
|
11 #include "GUIProgressBar.h"
|
|
12 #include "Party.h"
|
|
13 #include "AudioPlayer.h"
|
|
14 #include "Outdoor.h"
|
|
15 #include "IndoorCamera.h"
|
|
16 #include "Overlays.h"
|
|
17 #include "Monsters.h"
|
|
18 #include "Arcomage.h"
|
|
19 #include "LOD.h"
|
|
20 #include "Actor.h"
|
|
21 #include "Allocator.h"
|
|
22 #include "Events.h"
|
|
23 #include "Viewport.h"
|
|
24 #include "FrameTableInc.h"
|
|
25 #include "Math.h"
|
|
26 #include "SpriteObject.h"
|
|
27 #include "ObjectList.h"
|
|
28 #include "Chest.h"
|
|
29 #include "PaletteManager.h"
|
|
30 #include "DecorationList.h"
|
|
31 #include "SaveLoad.h"
|
|
32 #include "stru123.h"
|
|
33 #include "Time.h"
|
|
34 #include "IconFrameTable.h"
|
|
35 #include "Awards.h"
|
|
36 #include "Autonotes.h"
|
|
37 #include "stru159.h"
|
|
38 #include "stru160.h"
|
|
39 #include "TurnEngine.h"
|
|
40 #include "CastSpellInfo.h"
|
|
41 #include "Weather.h"
|
|
42 #include "stru298.h"
|
|
43 #include "StorylineTextTable.h"
|
|
44 #include "Events2D.h"
|
|
45 #include "texts.h"
|
|
46 #include "UIHouses.h"
|
|
47
|
|
48 #include "mm7_data.h"
|
|
49
|
|
50
|
|
51
|
|
52
|
|
53
|
|
54 //----- (00444839) --------------------------------------------------------
|
|
55 void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName)
|
|
56 {
|
|
57 //unsigned int v9; // ebx@1
|
|
58 //int v10; // edi@1
|
|
59 //signed int v11; // eax@1
|
|
60 unsigned int v12; // eax@6
|
|
61 const char *v13; // ST0C_4@6
|
|
62 unsigned int v14; // eax@8
|
|
63 const char *v15; // eax@14
|
|
64 unsigned int v16; // eax@16
|
|
65 //unsigned int result; // eax@26
|
|
66 const char *v18; // [sp-8h] [bp-40h]@9
|
|
67 //const char *v19; // [sp-4h] [bp-3Ch]@2
|
|
68 char *v20; // [sp-4h] [bp-3Ch]@9
|
|
69 const char *v21; // [sp-4h] [bp-3Ch]@11
|
|
70 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1
|
|
71 unsigned int v23; // [sp+34h] [bp-4h]@1
|
|
72
|
|
73 //v9 = a1;
|
|
74 //v10 = a2;
|
|
75 v23 = IndoorLocation::GetLocationIndex(pLocationName);
|
|
76 dword_59117C_teleportx = x;
|
|
77 dword_591178_teleporty = y;
|
|
78 dword_591174_teleportz = z;
|
|
79 dword_591170_teleport_directiony = directiony;
|
|
80 dword_59116C_teleport_directionx = directionx;
|
|
81 dword_591168_teleport_speedz = a8;
|
|
82 dword_591164_teleport_map_name = (char *)pLocationName;
|
|
83 uCurrentHouse_Animation = anim_id;
|
|
84 pEventTimer->Pause();
|
|
85 pAudioPlayer->StopChannels(-1, -1);
|
|
86
|
|
87 switch (pParty->alignment)
|
|
88 {
|
|
89 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break;
|
|
90 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break;
|
|
91 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break;
|
|
92 default: assert(false);
|
|
93 }
|
|
94
|
|
95 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
|
|
96 v13 = pHouse_ExitPictures[exit_pic_id];
|
|
97 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12];
|
|
98 pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE);
|
|
99 if (anim_id)
|
|
100 {
|
|
101 if ( !v23 )
|
|
102 //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u);
|
|
103 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1);
|
|
104 }
|
|
105 else if ( !v23 )
|
|
106 {
|
|
107 v14 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
108 if ( v14 )
|
|
109 {
|
|
110 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); // "Leave %s"
|
|
111 goto LABEL_20;
|
|
112 }
|
|
113 v21 = pGlobalTXT_LocalizationStrings[79];
|
|
114 goto LABEL_19;
|
|
115 }
|
|
116 v15 = pLocationName;
|
|
117 if ( *pLocationName == 48 )
|
|
118 v15 = pCurrentMapName;
|
|
119 v16 = pMapStats->GetMapInfo(v15);
|
|
120 if ( v16 )
|
|
121 {
|
|
122 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName);
|
|
123 goto LABEL_20;
|
|
124 }
|
|
125 v21 = pGlobalTXT_LocalizationStrings[73];
|
|
126 LABEL_19:
|
|
127 strcpy(sHouseName, v21);
|
|
128 LABEL_20:
|
|
129 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, (int)sHouseName);
|
|
130 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) )
|
|
131 if ( pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].uRoomSoundId )
|
|
132 PlayHouseSound(anim_id, HouseSound_Greeting);
|
|
133 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 )
|
|
134 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0);
|
|
135 if ( v23 )
|
|
136 uCurrentHouse_Animation = v23;
|
|
137 }
|
|
138
|
|
139
|
|
140
|
|
141
|
|
142 //----- (00444C8F) --------------------------------------------------------
|
|
143 void TravelUI_Load()
|
|
144 {
|
|
145 //signed int v0; // eax@1
|
|
146 unsigned int v1; // eax@6
|
|
147 GUIWindow *result; // eax@9
|
|
148 //const char *v3; // [sp-4h] [bp-2Ch]@2
|
|
149 char pContainer[32]; // [sp+0h] [bp-28h]@1
|
|
150
|
|
151 pEventTimer->Pause();
|
|
152
|
|
153 switch (pParty->alignment)
|
|
154 {
|
|
155 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break;
|
|
156 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break;
|
|
157 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break;
|
|
158 default: assert(false);
|
|
159 }
|
|
160
|
|
161 pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
|
|
162 pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE);
|
|
163 v1 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
164 if ( v1 )
|
|
165 sprintfex(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
|
|
166 else
|
|
167 strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit"
|
|
168 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName);
|
|
169 }
|
|
170
|
|
171
|
|
172
|
|
173 //----- (00444DCA) --------------------------------------------------------
|
|
174 void TravelUI_Draw()
|
|
175 {
|
|
176 unsigned int v0; // edi@1
|
|
177 MapInfo *v1; // edi@2
|
|
178 signed int v3; // eax@2
|
|
179 int v4; // eax@5
|
|
180 const char *v5; // [sp-Ch] [bp-90h]@3
|
|
181 signed int v6; // [sp-8h] [bp-8Ch]@3
|
|
182 GUIWindow v7; // [sp+Ch] [bp-78h]@1
|
|
183 char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1
|
|
184 unsigned int v9; // [sp+80h] [bp-4h]@1
|
|
185
|
|
186 memcpy(&v7, pPrimaryWindow, sizeof(v7));
|
|
187 v9 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
188 pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20);
|
|
189 v0 = pMapStats->GetMapInfo(pDestinationMapName);
|
|
190 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
|
|
191 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]);
|
|
192 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside);
|
|
193 pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_x_u));
|
|
194 pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
|
|
195 if ( v0 )
|
|
196 {
|
|
197 v1 = &pMapStats->pInfos[v0];
|
|
198 v7.uFrameX = 493;
|
|
199 v7.uFrameWidth = 126;
|
|
200 v7.uFrameZ = 366;
|
|
201 v7.DrawTitleText(pFontCreate, 0, 4u, 0, v1->pName, 3);
|
|
202 v7.uFrameX = 483;
|
|
203 v7.uFrameWidth = 148;
|
|
204 v7.uFrameZ = 334;
|
|
205 v3 = GetTravelTime();
|
|
206 if ( v3 == 1 )
|
|
207 {
|
|
208 v6 = 1;
|
|
209 v5 = pGlobalTXT_LocalizationStrings[663]; // "It will take %d day to cross to %s."
|
|
210 }
|
|
211 else
|
|
212 {
|
|
213 v6 = v3;
|
|
214 v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s."
|
|
215 }
|
|
216 sprintfex(pTmpBuf, v5, v6, v1->pName);
|
|
217 strcat(pTmpBuf, "\n \n");
|
|
218 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName);
|
|
219 strcat(pTmpBuf, pTmpBuf2);
|
|
220 v4 = pFontCreate->CalcTextHeight(pTmpBuf, &v7, 0, 0);
|
|
221 v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf, 3);
|
|
222 _unused_5B5924_is_travel_ui_drawn = 1;
|
|
223 }
|
|
224 }
|
|
225
|
|
226
|
|
227
|
|
228 //----- (00444A51) --------------------------------------------------------
|
|
229 void TransitionUI_Draw()
|
|
230 {
|
|
231 MapInfo *pMapInfo; // esi@5
|
|
232 char *v1; // eax@6
|
|
233 std::string v3; // [sp-18h] [bp-84h]@11
|
|
234 unsigned int v4; // [sp-10h] [bp-7Ch]@12
|
|
235 int v5; // [sp-Ch] [bp-78h]@12
|
|
236 const char *v6; // [sp-8h] [bp-74h]@11
|
|
237 signed int v7; // [sp-4h] [bp-70h]@11
|
|
238 GUIWindow v8; // [sp+Ch] [bp-60h]@1
|
|
239 unsigned int v9; // [sp+60h] [bp-Ch]@1
|
|
240 unsigned int v10; // [sp+64h] [bp-8h]@1
|
|
241 int a3; // [sp+6Bh] [bp-1h]@11
|
|
242
|
|
243 memcpy(&v8, pPrimaryWindow, sizeof(v8));
|
|
244 v10 = pMapStats->GetMapInfo(pCurrentMapName);
|
|
245 v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name);
|
|
246 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
|
|
247 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C));
|
|
248 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside);
|
|
249 uTextureID_right_panel_loop = uTextureID_right_panel;
|
|
250 pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel));
|
|
251 pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u));
|
|
252 pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
|
|
253 if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != ' ' )
|
|
254 v10 = pMapStats->GetMapInfo(dword_591164_teleport_map_name);
|
|
255 pMapInfo = &pMapStats->pInfos[v10];
|
|
256 v8.uFrameX = 493;
|
|
257 v8.uFrameWidth = 126;
|
|
258 v8.uFrameZ = 366;
|
|
259 v8.DrawTitleText(pFontCreate, 0, 5u, 0, pMapInfo->pName, 3);
|
|
260 v8.uFrameX = 483;
|
|
261 v8.uFrameWidth = 148;
|
|
262 v8.uFrameZ = 334;
|
|
263
|
|
264 v1 = "";
|
|
265 if ( uCurrentHouse_Animation )
|
|
266 {
|
|
267 v1 = pTransitionStrings[uCurrentHouse_Animation];
|
|
268 v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101;
|
|
269 v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3);
|
|
270 }
|
|
271 else if ( v10 )
|
|
272 {
|
|
273 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?"
|
|
274 v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf, &v8, 0, 0)) / 2 + 101;
|
|
275 v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf, 3);
|
|
276 }
|
|
277 else assert(false);
|
|
278
|
|
279 _unused_5B5924_is_travel_ui_drawn = true;
|
|
280 }
|