Mercurial > mm7
annotate UI/UITransition.cpp @ 1937:bd5c3f33bff4
m
author | Ritor1 |
---|---|
date | Thu, 24 Oct 2013 15:24:55 +0600 |
parents | 11f5c0ac170a |
children | 28cb79ae2f6f |
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 const char *v15; // eax@14 | |
30 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 | |
31 | |
32 dword_59117C_teleportx = x; | |
33 dword_591178_teleporty = y; | |
34 dword_591174_teleportz = z; | |
35 dword_591170_teleport_directiony = directiony; | |
36 dword_59116C_teleport_directionx = directionx; | |
37 dword_591168_teleport_speedz = a8; | |
38 dword_591164_teleport_map_name = (char *)pLocationName; | |
39 uCurrentHouse_Animation = anim_id; | |
40 pEventTimer->Pause(); | |
41 pAudioPlayer->StopChannels(-1, -1); | |
42 | |
43 switch (pParty->alignment) | |
44 { | |
45 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; | |
46 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; | |
47 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; | |
1545 | 48 default: Error("Invalid alignment: %u", pParty->alignment); |
1298 | 49 } |
50 | |
1754 | 51 pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)]; |
52 pTexture_outside = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[exit_pic_id], TEXTURE_16BIT_PALETTE); | |
1298 | 53 if (anim_id) |
54 { | |
1754 | 55 if ( !IndoorLocation::GetLocationIndex(pLocationName) ) |
1298 | 56 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1); |
57 } | |
1754 | 58 else if ( !IndoorLocation::GetLocationIndex(pLocationName) ) |
1298 | 59 { |
1754 | 60 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
61 { | |
62 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); // "Leave %s" | |
63 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); | |
64 //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) | |
65 //PlayHouseSound(anim_id, HouseSound_Greeting); | |
66 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) | |
67 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); | |
68 if ( IndoorLocation::GetLocationIndex(pLocationName) ) | |
69 uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); | |
70 return; | |
71 } | |
72 strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]); | |
73 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); | |
74 //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) | |
75 //PlayHouseSound(anim_id, HouseSound_Greeting); | |
76 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) | |
77 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); | |
78 if ( IndoorLocation::GetLocationIndex(pLocationName) ) | |
79 uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); | |
80 return; | |
1298 | 81 } |
82 v15 = pLocationName; | |
83 if ( *pLocationName == 48 ) | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1299
diff
changeset
|
84 v15 = pCurrentMapName; |
1754 | 85 if ( pMapStats->GetMapInfo(v15) ) |
1298 | 86 { |
1754 | 87 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[pMapStats->GetMapInfo(v15)].pName);//Войти в ^Pv[%s] |
88 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); | |
89 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) | |
90 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); | |
91 if ( IndoorLocation::GetLocationIndex(pLocationName) ) | |
92 uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); | |
93 return; | |
1298 | 94 } |
1754 | 95 strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[73]);//Войти |
1298 | 96 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); |
1754 | 97 //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) |
98 //PlayHouseSound(anim_id, HouseSound_Greeting); | |
1298 | 99 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) |
100 pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); | |
1754 | 101 if ( IndoorLocation::GetLocationIndex(pLocationName) ) |
102 uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); | |
1298 | 103 } |
104 | |
105 //----- (00444C8F) -------------------------------------------------------- | |
106 void TravelUI_Load() | |
107 { | |
108 char pContainer[32]; // [sp+0h] [bp-28h]@1 | |
109 | |
110 pEventTimer->Pause(); | |
111 | |
112 switch (pParty->alignment) | |
113 { | |
114 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; | |
115 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; | |
116 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; | |
1545 | 117 default: Error("Invalid alignment: %u", pParty->alignment); |
1298 | 118 } |
119 | |
120 pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); | |
121 pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE); | |
1757 | 122 if ( pMapStats->GetMapInfo(pCurrentMapName) ) |
123 sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName);// "Leave %s" | |
1298 | 124 else |
125 strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit" | |
126 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, sHouseName.data()); | |
127 } | |
128 | |
129 //----- (00444DCA) -------------------------------------------------------- | |
130 void TravelUI_Draw() | |
131 { | |
1757 | 132 GUIWindow travel_window; // [sp+Ch] [bp-78h]@1 |
1298 | 133 char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1 |
134 | |
1757 | 135 memcpy(&travel_window, pPrimaryWindow, sizeof(travel_window)); |
1298 | 136 pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); |
1757 | 137 pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); |
138 pRenderer->DrawTextureTransparent(468, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); | |
1298 | 139 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); |
1757 | 140 pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); |
141 pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); | |
142 if ( pMapStats->GetMapInfo(pDestinationMapName) ) | |
1298 | 143 { |
1757 | 144 travel_window.uFrameX = 493; |
145 travel_window.uFrameWidth = 126; | |
146 travel_window.uFrameZ = 366; | |
147 travel_window.DrawTitleText(pFontCreate, 0, 4, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName, 3); | |
148 travel_window.uFrameX = 483; | |
149 travel_window.uFrameWidth = 148; | |
150 travel_window.uFrameZ = 334; | |
151 if ( GetTravelTime() == 1 ) | |
152 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[663], 1, pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d day to cross to %s." | |
1298 | 153 else |
1757 | 154 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[128], GetTravelTime(), pMapStats->pInfos[pMapStats->GetMapInfo(pDestinationMapName)].pName);// "It will take %d days to travel to %s." |
155 | |
1298 | 156 strcat(pTmpBuf.data(), "\n \n"); |
1757 | 157 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); |
1298 | 158 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
1757 | 159 travel_window.DrawTitleText(pFontCreate, 0, (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &travel_window, 0, 0)) / 2 + 101, 0, pTmpBuf.data(), 3); |
1298 | 160 _unused_5B5924_is_travel_ui_drawn = 1; |
161 } | |
162 } | |
163 | |
164 //----- (00444A51) -------------------------------------------------------- | |
165 void TransitionUI_Draw() | |
166 { | |
167 unsigned int v4; // [sp-10h] [bp-7Ch]@12 | |
1755 | 168 GUIWindow transition_window; // [sp+Ch] [bp-60h]@1 |
1298 | 169 unsigned int v9; // [sp+60h] [bp-Ch]@1 |
1755 | 170 unsigned int map_id; // [sp+64h] [bp-8h]@1 |
1298 | 171 |
1755 | 172 memcpy(&transition_window, pPrimaryWindow, sizeof(transition_window)); |
1298 | 173 v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); |
174 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); | |
175 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C)); | |
176 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); | |
177 uTextureID_right_panel_loop = uTextureID_right_panel; | |
178 pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); | |
179 pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); | |
180 pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); | |
1755 | 181 map_id = pMapStats->GetMapInfo(pCurrentMapName); |
1298 | 182 if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != ' ' ) |
1755 | 183 map_id = pMapStats->GetMapInfo(dword_591164_teleport_map_name); |
184 transition_window.uFrameX = 493; | |
185 transition_window.uFrameWidth = 126; | |
186 transition_window.uFrameZ = 366; | |
187 transition_window.DrawTitleText(pFontCreate, 0, 5, 0, pMapStats->pInfos[map_id].pName, 3); | |
188 transition_window.uFrameX = 483; | |
189 transition_window.uFrameWidth = 148; | |
190 transition_window.uFrameZ = 334; | |
1298 | 191 |
192 if ( uCurrentHouse_Animation ) | |
193 { | |
1755 | 194 v4 = (212 - pFontCreate->CalcTextHeight(pTransitionStrings[uCurrentHouse_Animation], &transition_window, 0, 0)) / 2 + 101; |
195 transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTransitionStrings[uCurrentHouse_Animation], 3); | |
1298 | 196 } |
1755 | 197 else if ( map_id ) |
1298 | 198 { |
1755 | 199 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapStats->pInfos[map_id].pName);// "Do you wish to leave %s?" |
200 v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &transition_window, 0, 0)) / 2 + 101; | |
201 transition_window.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3); | |
1298 | 202 } |
1545 | 203 else Error("Troubles in da house"); |
1298 | 204 |
205 _unused_5B5924_is_travel_ui_drawn = true; | |
206 } |