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