Mercurial > mm7
annotate UI/UITransition.cpp @ 1746:f305a00a6d98
AlchemistDialog() cleared
author | Ritor1 |
---|---|
date | Sun, 29 Sep 2013 21:32:47 +0600 |
parents | 2b5c8fe78e79 |
children | b6212ecbc140 77abbabd2a04 |
rev | line source |
---|---|
1298 | 1 #ifdef _MSC_VER |
2 #define _CRT_SECURE_NO_WARNINGS | |
3 #endif | |
4 | |
5 #include <io.h> | |
6 | |
1299 | 7 #include "..\mm7_data.h" |
8 #include "..\VideoPlayer.h" | |
9 #include "..\MapInfo.h" | |
10 #include "..\GUIWindow.h" | |
11 #include "..\GUIFont.h" | |
12 #include "..\GUIProgressBar.h" | |
13 #include "..\Party.h" | |
14 #include "..\AudioPlayer.h" | |
15 #include "..\Outdoor.h" | |
16 #include "..\LOD.h" | |
17 #include "..\Time.h" | |
18 #include "..\stru159.h" | |
19 #include "..\Events2D.h" | |
20 #include "..\texts.h" | |
1298 | 21 #include "UIHouses.h" |
22 | |
23 | |
24 | |
25 | |
26 //----- (00444839) -------------------------------------------------------- | |
27 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) | |
28 { | |
29 unsigned int v12; // eax@6 | |
30 const char *v13; // ST0C_4@6 | |
31 unsigned int v14; // eax@8 | |
32 const char *v15; // eax@14 | |
33 unsigned int v16; // eax@16 | |
34 const char *v18; // [sp-8h] [bp-40h]@9 | |
35 char *v20; // [sp-4h] [bp-3Ch]@9 | |
36 const char *v21; // [sp-4h] [bp-3Ch]@11 | |
37 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
38 unsigned int v23; // [sp+34h] [bp-4h]@1 | |
39 | |
40 v23 = IndoorLocation::GetLocationIndex(pLocationName); | |
41 dword_59117C_teleportx = x; | |
42 dword_591178_teleporty = y; | |
43 dword_591174_teleportz = z; | |
44 dword_591170_teleport_directiony = directiony; | |
45 dword_59116C_teleport_directionx = directionx; | |
46 dword_591168_teleport_speedz = a8; | |
47 dword_591164_teleport_map_name = (char *)pLocationName; | |
48 uCurrentHouse_Animation = anim_id; | |
49 pEventTimer->Pause(); | |
50 pAudioPlayer->StopChannels(-1, -1); | |
51 | |
52 switch (pParty->alignment) | |
53 { | |
54 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; | |
55 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; | |
56 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; | |
1545 | 57 default: Error("Invalid alignment: %u", pParty->alignment); |
1298 | 58 } |
59 | |
60 v12 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
61 v13 = pHouse_ExitPictures[exit_pic_id]; | |
62 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v12]; | |
63 pTexture_outside = pIcons_LOD->LoadTexturePtr(v13, TEXTURE_16BIT_PALETTE); | |
64 if (anim_id) | |
65 { | |
66 if ( !v23 ) | |
67 //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); | |
68 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1); | |
69 } | |
70 else if ( !v23 ) | |
71 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1299
diff
changeset
|
72 v14 = pMapStats->GetMapInfo(pCurrentMapName); |
1298 | 73 if ( v14 ) |
74 { | |
75 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v14].pName); // "Leave %s" | |
76 goto LABEL_20; | |
77 } | |
78 v21 = pGlobalTXT_LocalizationStrings[79]; | |
79 goto LABEL_19; | |
80 } | |
81 v15 = pLocationName; | |
82 if ( *pLocationName == 48 ) | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1299
diff
changeset
|
83 v15 = pCurrentMapName; |
1298 | 84 v16 = pMapStats->GetMapInfo(v15); |
85 if ( v16 ) | |
86 { | |
87 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[v16].pName); | |
88 goto LABEL_20; | |
89 } | |
90 v21 = pGlobalTXT_LocalizationStrings[73]; | |
91 LABEL_19: | |
92 strcpy(sHouseName.data(), v21); | |
93 LABEL_20: | |
94 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); | |
95 //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) | |
96 if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) | |
97 PlayHouseSound(anim_id, HouseSound_Greeting); | |
98 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) | |
99 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); | |
100 if ( v23 ) | |
101 uCurrentHouse_Animation = v23; | |
102 } | |
103 | |
104 | |
105 | |
106 | |
107 //----- (00444C8F) -------------------------------------------------------- | |
108 void TravelUI_Load() | |
109 { | |
110 //signed int v0; // eax@1 | |
111 unsigned int v1; // eax@6 | |
112 GUIWindow *result; // eax@9 | |
113 //const char *v3; // [sp-4h] [bp-2Ch]@2 | |
114 char pContainer[32]; // [sp+0h] [bp-28h]@1 | |
115 | |
116 pEventTimer->Pause(); | |
117 | |
118 switch (pParty->alignment) | |
119 { | |
120 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; | |
121 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; | |
122 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; | |
1545 | 123 default: Error("Invalid alignment: %u", pParty->alignment); |
1298 | 124 } |
125 | |
126 pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); | |
127 pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1299
diff
changeset
|
128 v1 = pMapStats->GetMapInfo(pCurrentMapName); |
1298 | 129 if ( v1 ) |
130 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" | |
131 else | |
132 strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit" | |
133 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, sHouseName.data()); | |
134 } | |
135 | |
136 | |
137 | |
138 //----- (00444DCA) -------------------------------------------------------- | |
139 void TravelUI_Draw() | |
140 { | |
141 unsigned int v0; // edi@1 | |
142 MapInfo *v1; // edi@2 | |
143 signed int v3; // eax@2 | |
144 int v4; // eax@5 | |
145 const char *v5; // [sp-Ch] [bp-90h]@3 | |
146 signed int v6; // [sp-8h] [bp-8Ch]@3 | |
147 GUIWindow v7; // [sp+Ch] [bp-78h]@1 | |
148 char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1 | |
149 unsigned int v9; // [sp+80h] [bp-4h]@1 | |
150 | |
151 memcpy(&v7, pPrimaryWindow, sizeof(v7)); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1299
diff
changeset
|
152 v9 = pMapStats->GetMapInfo(pCurrentMapName); |
1298 | 153 pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); |
154 v0 = pMapStats->GetMapInfo(pDestinationMapName); | |
155 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); | |
156 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); | |
157 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); | |
158 pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_x_u)); | |
159 pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); | |
160 if ( v0 ) | |
161 { | |
162 v1 = &pMapStats->pInfos[v0]; | |
163 v7.uFrameX = 493; | |
164 v7.uFrameWidth = 126; | |
165 v7.uFrameZ = 366; | |
166 v7.DrawTitleText(pFontCreate, 0, 4u, 0, v1->pName, 3); | |
167 v7.uFrameX = 483; | |
168 v7.uFrameWidth = 148; | |
169 v7.uFrameZ = 334; | |
170 v3 = GetTravelTime(); | |
171 if ( v3 == 1 ) | |
172 { | |
173 v6 = 1; | |
174 v5 = pGlobalTXT_LocalizationStrings[663]; // "It will take %d day to cross to %s." | |
175 } | |
176 else | |
177 { | |
178 v6 = v3; | |
179 v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s." | |
180 } | |
181 sprintfex(pTmpBuf.data(), v5, v6, v1->pName); | |
182 strcat(pTmpBuf.data(), "\n \n"); | |
183 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName); | |
184 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
185 v4 = pFontCreate->CalcTextHeight(pTmpBuf.data(), &v7, 0, 0); | |
186 v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf.data(), 3); | |
187 _unused_5B5924_is_travel_ui_drawn = 1; | |
188 } | |
189 } | |
190 | |
191 | |
192 | |
193 //----- (00444A51) -------------------------------------------------------- | |
194 void TransitionUI_Draw() | |
195 { | |
196 MapInfo *pMapInfo; // esi@5 | |
197 char *v1; // eax@6 | |
198 std::string v3; // [sp-18h] [bp-84h]@11 | |
199 unsigned int v4; // [sp-10h] [bp-7Ch]@12 | |
200 int v5; // [sp-Ch] [bp-78h]@12 | |
201 const char *v6; // [sp-8h] [bp-74h]@11 | |
202 signed int v7; // [sp-4h] [bp-70h]@11 | |
203 GUIWindow v8; // [sp+Ch] [bp-60h]@1 | |
204 unsigned int v9; // [sp+60h] [bp-Ch]@1 | |
205 unsigned int v10; // [sp+64h] [bp-8h]@1 | |
206 int a3; // [sp+6Bh] [bp-1h]@11 | |
207 | |
208 memcpy(&v8, pPrimaryWindow, sizeof(v8)); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1299
diff
changeset
|
209 v10 = pMapStats->GetMapInfo(pCurrentMapName); |
1298 | 210 v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); |
211 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); | |
212 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C)); | |
213 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); | |
214 uTextureID_right_panel_loop = uTextureID_right_panel; | |
215 pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); | |
216 pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); | |
217 pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); | |
218 if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != ' ' ) | |
219 v10 = pMapStats->GetMapInfo(dword_591164_teleport_map_name); | |
220 pMapInfo = &pMapStats->pInfos[v10]; | |
221 v8.uFrameX = 493; | |
222 v8.uFrameWidth = 126; | |
223 v8.uFrameZ = 366; | |
224 v8.DrawTitleText(pFontCreate, 0, 5u, 0, pMapInfo->pName, 3); | |
225 v8.uFrameX = 483; | |
226 v8.uFrameWidth = 148; | |
227 v8.uFrameZ = 334; | |
228 | |
229 v1 = ""; | |
230 if ( uCurrentHouse_Animation ) | |
231 { | |
232 v1 = pTransitionStrings[uCurrentHouse_Animation]; | |
233 v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101; | |
234 v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3); | |
235 } | |
236 else if ( v10 ) | |
237 { | |
238 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?" | |
239 v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &v8, 0, 0)) / 2 + 101; | |
240 v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3); | |
241 } | |
1545 | 242 else Error("Troubles in da house"); |
1298 | 243 |
244 _unused_5B5924_is_travel_ui_drawn = true; | |
245 } |