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