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