annotate Engine/Game.cpp @ 2516:56b6d74ce716

.
author Ritor1
date Thu, 02 Oct 2014 22:01:06 +0600
parents fb1c61a82a55
children 3a1b56ab8749
rev   line source
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6 #include "Arcomage\Arcomage.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
8 #include "Engine/Graphics/Vis.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
9 #include "Engine/Graphics/Weather.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
10 #include "Engine/Graphics/LightmapBuilder.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
11 #include "Engine/Graphics/DecalBuilder.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
12 #include "Engine/Graphics/ParticleEngine.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
13 #include "IO/Mouse.h"
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
14 #include "IO/Keyboard.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
15 #include "Engine/Graphics/GammaControl.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
16 #include "stru6.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
17 #include "Engine/Graphics/stru9.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
18 #include "Engine/Graphics/stru10.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
19 #include "Engine/ErrorHandling.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
21 #include "Game.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
22 #include "Party.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
23 #include "Engine/Graphics/Viewport.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
24 #include "Timer.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
25 #include "Engine/Graphics/Outdoor.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
26 #include "Engine/Graphics/Overlays.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
27 #include "Media/Audio/AudioPlayer.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
28 #include "LOD.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
29 #include "GUI/GUIWindow.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
30 #include "TurnEngine/TurnEngine.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
31 #include "Media/Video/Bink_Smacker.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
32 #include "Events.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
33 #include "texts.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
34 #include "GUI/GUIFont.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
35 #include "Log.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
36 #include "Graphics/Lights.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
37 #include "Spells/CastSpellInfo.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
38 #include "Tables/FrameTableInc.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
39 #include "Objects/Actor.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
40 #include "GUI/GUIProgressBar.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
41 #include "Objects/ObjectList.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
42 #include "Graphics/Level/Decoration.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
43 #include "Graphics/PaletteManager.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
44 #include "..\GUI\UI\UIHouses.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
45 #include "..\GUI\UI\UIShops.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
46 #include "..\GUI\UI\UIPartyCreation.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
47 #include "SaveLoad.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
48 #include "Engine/Objects/SpriteObject.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
49 #include "mm7.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
50 #include "Graphics/Sprites.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
51 #include "Registry.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
52 #include "Objects/Chest.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
53
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
54 #include "..\GUI\UI\UIGame.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
55
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
56 #include "Graphics/DecorationList.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
57 #include "Tables/IconFrameTable.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
58 #include "Tables/PlayerFrameTable.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
59 #include "MapsLongTimer.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
60 #include "Tables/StorylineTextTable.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
61 #include "Tables/FactionTable.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
62 #include "stru123.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
63 #include "LuaVM.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
64 #include "Graphics/RenderD3D11.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
65 #include "MMT.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents: 2499
diff changeset
66 #include "../GUI/NewUI\MainMenu.h"
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
67 #include <direct.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
68
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
69
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
70
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
71
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
72
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
73 Game *pGame;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
74
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
75
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
76
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
77
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
78
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
79 //----- (00435694) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
80 void Game::ToggleFlags2(unsigned int uFlag)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
81 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
82 unsigned int v2; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
83
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
84 v2 = this->uFlags2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
85 if ( v2 & uFlag )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
86 this->uFlags2 = v2 & ~uFlag;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
87 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
88 this->uFlags2 = uFlag | v2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
89 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
90
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
91 //----- (0044103C) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
92 void Game::Draw()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
93 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
94 int v4; // edi@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
95
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
96 uFlags2 &= ~0x02;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
97 if ( pParty->_497FC5_check_party_perception_against_level() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
98 uFlags2 |= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
99
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
100 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
101 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
102 pGame->pIndoorCameraD3D->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * 3.141592653589 * pParty->sRotationY / 2048.0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
103 pGame->pIndoorCameraD3D->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * 3.141592653589 * pParty->sRotationY / 2048.0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
104 pGame->pIndoorCameraD3D->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
105
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
106 //pIndoorCamera->Initialize2();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
107 pIndoorCameraD3D->CalculateRotations(pParty->sRotationX, pParty->sRotationY);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
108 pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
109 pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
110
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
111 if ( pMovie_Track )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
112 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
113 /*if ( !pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
114 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
115 pRenderer->BeginSceneD3D();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
116 pMouse->DrawCursorToTarget();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
117 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
118 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
119 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
120 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
121 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
122 if ( pParty->vPosition.x != pParty->vPrevPosition.x || pParty->sRotationY != pParty->sPrevRotationY || pParty->vPosition.y != pParty->vPrevPosition.y
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
123 || pParty->sRotationX != pParty->sPrevRotationX || pParty->vPosition.z != pParty->vPrevPosition.z || pParty->sEyelevel != pParty->sPrevEyelevel )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
124 pParty->uFlags |= 2u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
125 pParty->vPrevPosition.x = pParty->vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
126 pParty->vPrevPosition.y = pParty->vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
127 pParty->vPrevPosition.z = pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
128 //v0 = &pRenderer;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
129 pParty->sPrevRotationY = pParty->sRotationY;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
130 pParty->sPrevRotationX = pParty->sRotationX;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
131
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
132 pParty->sPrevEyelevel = pParty->sEyelevel;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
133 pRenderer->BeginSceneD3D();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
134
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
135 //if ( !pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
136 //pMouse->DrawCursorToTarget();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
137 if ( !PauseGameDrawing() || viewparams->field_48 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
138 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
139 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
140 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
141 float v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
142 //v3 = v2 + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
143 //pRenderer->field_1036A8_bitmapid = LODWORD(v3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
144 pRenderer->hd_water_current_frame = floorf(v2 + 0.5f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
145 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
146
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
147 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
148 pIndoor->Draw();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
149 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
150 pOutdoor->Draw();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
151 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
152 Error("Invalid level type: %u", uCurrentlyLoadedLevelType);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
153
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
154 //if (pRenderer->pRenderD3D)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
155 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
156 pDecalBuilder->DrawBloodsplats();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
157 pGame->pLightmapBuilder->DrawLightmapsType(2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
158 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
159 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
160 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
161 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
162
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
163 //DEBUG: force redraw gui
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
164 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
165
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
166
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
167 pRenderer->BeginScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
168 //if (pRenderer->pRenderD3D)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
169 pMouse->DrawCursorToTarget();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
170 if (pOtherOverlayList->bRedraw)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
171 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
172 v4 = viewparams->bRedrawGameUI;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
173 GameUI_Footer();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
174 if (!viewparams->bRedrawGameUI)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
175 GameUI_DrawRightPanelItems();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
176 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
177 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
178 GameUI_DrawRightPanelFrames();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
179 GameUI_Footer_2();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
180 viewparams->bRedrawGameUI = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
181 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
182 if (!pMovie_Track)//!pVideoPlayer->pSmackerMovie)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
183 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
184 GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, true);//redraw = pParty->uFlags & 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
185 if (v4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
186 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
187 if ( !PauseGameDrawing() /*&& pRenderer->pRenderD3D*/) // clear game viewport with transparent color
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
188 pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pViewport->uViewportBR_X - pViewport->uViewportTL_X,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
189 pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
190 0x7FF);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
191 viewparams->field_48 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
192 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
193 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
194
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
195 viewparams->bRedrawGameUI = pOtherOverlayList->bRedraw;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
196 pOtherOverlayList->bRedraw = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
197
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
198 GameUI_DrawPartySpells();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
199 if (v4 || pParty->pHirelings[0].evt_C || pParty->pHirelings[1].evt_C )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
200 GameUI_DrawHiredNPCs();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
201 GameUI_DrawPortraits(v4);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
202 GameUI_DrawLifeManaBars();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
203 GameUI_DrawCharacterSelectionFrame();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
204 if ( _44100D_should_alter_right_panel() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
205 GameUI_DrawRightPanel();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
206 if ( !pMovie_Track )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
207 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
208 pStru6Instance->DrawPlayerBuffAnims();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
209 pOtherOverlayList->DrawTurnBasedIcon(v4);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
210 GameUI_DrawTorchlightAndWizardEye();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
211 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
212
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
213
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
214 static bool render_framerate = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
215 static float framerate = 0.0f;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
216 static uint frames_this_second = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
217 static uint last_frame_time = GetTickCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
218 static uint framerate_time_elapsed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
219
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
220 if ( pCurrentScreen == SCREEN_GAME && uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
221 pWeather->Draw();//Ritor1: my include
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
222
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
223 //while(GetTickCount() - last_frame_time < 33 );//FPS control
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
224 uint frame_dt = GetTickCount() - last_frame_time;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
225 last_frame_time = GetTickCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
226
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
227 framerate_time_elapsed += frame_dt;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
228 if (framerate_time_elapsed >= 1000)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
229 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
230 framerate = frames_this_second * (1000.0f / framerate_time_elapsed);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
231
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
232 framerate_time_elapsed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
233 frames_this_second = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
234 render_framerate = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
235 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
236
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
237 ++frames_this_second;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
238
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
239 if ( debug_information )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
240 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
241 if (render_framerate)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
242 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
243 sprintf(pTmpBuf.data(), "FPS: % .4f", framerate);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
244 pPrimaryWindow->DrawText(pFontArrus, 494, 0, Color16(0, 0, 0), pTmpBuf.data(), 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
245 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
246
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
247 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
248 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
249 int sector_id = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
250 sprintf(pTmpBuf.data(), "Party Sector ID: %u/%u\n", sector_id, pIndoor->uNumSectors);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
251 pPrimaryWindow->DrawText(pFontArrus, 16, 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
252 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
253 sprintf(pTmpBuf.data(), "Party Position: % d % d % d", pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
254 pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
255
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
256 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
257 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
258 uint uFaceID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
259 int sector_id = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
260 int floor_level = BLV_GetFloorLevel(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + 40, sector_id, &uFaceID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
261 sprintf(pTmpBuf.data(), "BLV_GetFloorLevel: %d face_id %d\n", floor_level, uFaceID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
262 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
263 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
264 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
265 int on_water, _a6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
266 int floor_level = ODM_GetFloorLevel(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z, 0, &on_water, &_a6, false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
267 sprintf(pTmpBuf.data(), "ODM_GetFloorLevel: %d on_water: %s a6 = %d\n", floor_level, on_water ? "true" : "false", _a6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
268 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
269 pPrimaryWindow->DrawText(pFontArrus, 16, 16 + 16 + 16, Color16(255, 255, 255), pTmpBuf.data(), 0, 0, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
270 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
271
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
272 GUI_UpdateWindows();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
273 pParty->UpdatePlayersAndHirelingsEmotions();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
274
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
275 _unused_5B5924_is_travel_ui_drawn = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
276 if (v4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
277 pMouse->bRedraw = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
278 pMouse->ReadCursorWithItem();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
279 pMouse->DrawCursor();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
280 pMouse->Activate();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
281 pRenderer->EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
282 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
283 pParty->uFlags &= ~2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
284 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
285
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
286 //----- (0047A815) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
287 void Game::DrawParticles()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
288 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
289 pParticleEngine->Draw();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
290 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
291
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
292 //----- (00463149) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
293 void Game::Loop()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
294 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
295 const char *pLocationName; // [sp-4h] [bp-68h]@74
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
296 bool bLoading; // [sp+10h] [bp-54h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
297 signed int v16; // [sp+14h] [bp-50h]@8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
298 MSG Msg; // [sp+28h] [bp-3Ch]@20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
299 char Source[64]; // [sp+44h] [bp-20h]@76
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
300
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
301 bLoading = sCurrentMenuID == MENU_LoadingProcInMainMenu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
302 SetCurrentMenuID((MENU_STATE)-1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
303 if (bLoading)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
304 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
305 pParty->Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
306 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
307 LoadGame(uLoadGameUI_SelectedSlot);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
308 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
309
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
310 for (uint i = 1; i < 5; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
311 for (uint j = 1; j < 6; ++j)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
312 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
313 sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
314 remove(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
315 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
316
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
317 LoadPlayerPortraintsAndVoices();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
318 pIcons_LOD->_inlined_sub1();
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
319 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
320 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
321 else
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
322 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
323
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
324 while ( 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
325 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
326 v16 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
327 pMessageQueue_50CBD0->Flush();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
328
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
329 pPartyActionQueue->uNumActions = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
330 if (pParty->bTurnBasedModeOn)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
331 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
332 pTurnEngine->End(false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
333 pParty->bTurnBasedModeOn = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
334 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
335 DoPrepareWorld(bLoading, 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
336 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
337 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
338 // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
339 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
340
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
341 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
342 pGame->pVisInstance->_4C1A02();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
343
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
344 bool game_finished = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
345 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
346 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
347 while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
348 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
349 if ( Msg.message == WM_QUIT )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
350 Game_DeinitializeAndTerminate(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
351 TranslateMessage(&Msg);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
352 DispatchMessageA(&Msg);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
353 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
354 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
355 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
356 WaitMessage();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
357 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
358 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
359 pGame->_44EEA7();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
360 GameUI_WritePointedObjectStatusString();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
361 Keyboard::ProcessInputActions();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
362 GameUI_MsgProc();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
363 if ( pArcomageGame->bGameInProgress )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
364 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
365 ArcomageGame::Loop();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
366 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
367 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
368 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
369
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
370 pMediaPlayer->HouseMovieLoop();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
371
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
372 pEventTimer->Update();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
373 pMiscTimer->Update();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
374
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
375 OnTimer(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
376 GameUI_StatusBar_UpdateTimedString(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
377 if ( pMiscTimer->bPaused && !pEventTimer->bPaused )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
378 pMiscTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
379 if ( pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
380 pEventTimer->bTackGameTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
381 if ( !pEventTimer->bPaused && uGameState == GAME_STATE_PLAYING)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
382 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
383 if ( !pEventTimer->bTackGameTime )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
384 _494035_timed_effects__water_walking_damage__etc();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
385
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
386 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0001)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
387 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0001;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
388 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
389 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
390 Actor::UpdateActorAI();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
391 UpdateUserInput_and_MapSpecificStuff();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
392 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
393 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
394 if ( v16 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
395 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
396 v16 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
397 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
398 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
399 pAudioPlayer->UpdateSounds();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
400 if ( (signed int)uGameState == GAME_STATE_PLAYING )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
401 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
402 pGame->Draw();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
403 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
404 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
405 if (uGameState == GAME_FINISHED)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
406 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
407 game_finished = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
408 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
409 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
410 if (uGameState == GAME_STATE_CHANGE_LOCATION)// ñìåíà ëîêàöèè
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
411 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
412 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
413 PrepareWorld(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
414 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
415 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
416 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
417 if ( (signed int)uGameState <= GAME_STATE_5 || uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU )//GAME_STATE_NEWGAME_OUT_GAMEMENU, GAME_STATE_LOADING_GAME
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
418 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
419 game_finished = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
420 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
421 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
422 if ( uGameState == GAME_STATE_FINAL_WINDOW )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
423 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
424 pRenderer->BeginScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
425 GUI_UpdateWindows();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
426 pRenderer->EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
427 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
428 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
429 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
430 if ( uGameState != GAME_STATE_PARTY_DIED )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
431 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
432 pGame->Draw();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
433 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
434 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
435 if ( uGameState == GAME_STATE_PARTY_DIED )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
436 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
437 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
438 memset(&pParty->pHirelings[0], 0, 0x4Cu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
439 memset(&pParty->pHirelings[1], 0, 0x4Cu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
440 for ( int i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
441 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
442 if ( pNPCStats->pNewNPCData[i].field_24 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
443 pNPCStats->pNewNPCData[i].uFlags &= 0xFFFFFF7Fu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
444 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
445 pMediaPlayer->bStopBeforeSchedule = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
446 pMediaPlayer->PlayFullscreenMovie(MOVIE_Death, true);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
447 if ( pMovie_Track )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
448 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
449 SaveGame(0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
450 ++pParty->uNumDeaths;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
451 for ( uint i = 0; i < 4; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
452 pParty->pPlayers[i].SetVariable(VAR_Award, 85);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
453 pParty->days_played_without_rest = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
454 pParty->uTimePlayed += 0x276000ui64;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
455 LOWORD(pParty->uFlags) &= ~0x204;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
456 pParty->SetGold(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
457 pOtherOverlayList->Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
458 memset(pParty->pPartyBuffs.data(), 0, 0x140u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
459
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
460 if ( pParty->bTurnBasedModeOn == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
461 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
462 pTurnEngine->End(true);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
463 pParty->bTurnBasedModeOn = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
464 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
465 for( int i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
466 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
467 memset(pParty->pPlayers[i].pConditions.data(), 0, 0xA0u);//(pConditions, 0, 160)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
468 memset(pParty->pPlayers[i].pPlayerBuffs.data(), 0, 0x180u);//(pPlayerBuffs[0], 0, 384)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
469 pParty->pPlayers[i].sHealth = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
470 uActiveCharacter = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
471 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
472 if (_449B57_test_bit(pParty->_quest_bits, PARTY_QUEST_FINISHED_EMERALD_ISLE))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
473 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
474 pParty->vPosition.x = -17331; // respawn in harmondale
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
475 pParty->vPosition.y = 12547;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
476 pParty->vPosition.z = 465;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
477 pParty->sRotationY = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
478 pLocationName = "out02.odm";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
479 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
480 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
481 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
482 pParty->vPosition.x = 12552; // respawn on emerald isle
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
483 pParty->vPosition.y = 1816;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
484 pParty->vPosition.z = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
485 pParty->sRotationY = 512;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
486 pLocationName = "out01.odm";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
487 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
488 strcpy(Source, pLocationName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
489 pParty->uFallStartY = pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
490 pParty->sRotationX = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
491 pParty->uFallSpeed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
492 pParty->field_6E4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
493 pParty->field_6E0 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
494 if ( _stricmp(Source, pCurrentMapName) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
495 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
496 strcpy(pCurrentMapName, Source);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
497 _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
498 _5B65AC_npcdata_fame_or_other = pParty->vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
499 _5B65B0_npcdata_rep_or_other = pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
500 _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
501 _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
502 dword_5B65C0 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
503 PrepareWorld(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
504 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
505 Actor::InitializeActors();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
506
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
507 int num_conscious_players = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
508 int conscious_players_ids[4] = {-1, -1, -1, -1};
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
509 for (int i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
510 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
511 if (pParty->pPlayers[i].CanAct())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
512 conscious_players_ids[num_conscious_players++] = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
513 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
514 if (num_conscious_players)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
515 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
516 int idx = conscious_players_ids[rand() % num_conscious_players];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
517 Assert(idx >= 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
518 pParty->pPlayers[idx].PlaySound(SPEECH_99, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
519 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
520
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
521 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2);// "Once again you've cheated death!.." "Âû ñíîâà îáõèòðèëè ñìåðòü! …"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
522 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
523 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
524 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
525 while (!game_finished);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
526
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
527 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
528 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
529 if ( uGameState == GAME_STATE_LOADING_GAME )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
530 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
531 sub_491E3A();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
532 LoadPlayerPortraintsAndVoices();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
533 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
534 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
535 bLoading = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
536 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
537 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
538 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
539 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
540 pCurrentScreen = SCREEN_VIDEO;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
541 sub_491E3A();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
542 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
543
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
544
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
545 //----- (0044F192) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
546 void Game::PrepareBloodsplats()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
547 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
548 for (uint i = 0; i < uNumBloodsplats; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
549 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
550 pBloodsplatContainer->AddBloodsplat(pBloodsplats[i].x, pBloodsplats[i].y, pBloodsplats[i].z,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
551 pBloodsplats[i].radius, pBloodsplats[i].r, pBloodsplats[i].g, pBloodsplats[i].b);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
552 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
553 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
554
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
555
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
556 //----- (0044F120) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
557 void Game::PushStationaryLights(int a2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
558 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
559 Game__StationaryLight* pLight;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
560
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
561 for( int i=0; i<uNumStationaryLights; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
562 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
563 pLight=&pStationaryLights[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
564 pStationaryLightsStack->AddLight(pLight->vPosition.x, pLight->vPosition.y, pLight->vPosition.z,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
565 pLight->flt_18, pLight->vRGBColor.x, pLight->vRGBColor.y, pLight->vRGBColor.z, _4E94D0_light_type);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
566 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
567 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
568 // 4E94D0: using guessed type char _4E94D0_light_type;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
569
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
570 //----- (0044F0FD) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
571 void Game::_44F0FD()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
572 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
573 ToggleFlags(0x40u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
574
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
575 if ( !(uFlags & 0x40) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
576 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
577 uNumBloodsplats = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
578 field_E0C = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
579 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
580 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
581
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
582 //----- (0044F0D8) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
583 void Game::ToggleFlags(uint uMask)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
584 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
585 if (uFlags & uMask)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
586 uFlags &= ~uMask;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
587 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
588 uFlags |= uMask;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
589 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
590
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
591
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
592 //----- (0044F07B) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
593 bool Game::_44F07B()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
594 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
595 if (!pKeyboardInstance->IsKeyBeingHeld(VK_SHIFT) && !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
596 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) || (pKeyboardInstance->WasKeyPressed(VK_F11) == 0 &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
597 pKeyboardInstance->WasKeyPressed(VK_F11)))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
598 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
599 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
600 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
601
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
602 //----- (0044EEA7) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
603 bool Game::_44EEA7()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
604 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
605 //Game *v1; // esi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
606 //double v2; // st7@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
607 float depth; // ST00_4@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
608 //bool result; // eax@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
609 //unsigned int v5; // eax@14
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
610 __int64 v6; // kr00_8@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
611 //unsigned int y; // [sp+4h] [bp-24h]@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
612 //unsigned int x; // [sp+8h] [bp-20h]@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
613 Vis_SelectionFilter *v10; // [sp+10h] [bp-18h]@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
614 Vis_SelectionFilter *v11; // [sp+14h] [bp-14h]@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
615 POINT cursor; // [sp+20h] [bp-8h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
616
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
617 //v1 = this;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
618 ++qword_5C6DF0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
619 pParticleEngine->UpdateParticles();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
620 pMouseInstance->GetCursorPos(&cursor);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
621
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
622 //x = cursor.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
623 //y = cursor.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
624 if ( sub_4637E0_is_there_popup_onscreen() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
625 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
626 v11 = &vis_face_filter;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
627 v10 = &vis_sprite_filter_2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
628 depth = pGame->pIndoorCameraD3D->GetPickDepth();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
629 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
630 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
631 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
632 if ( uFlags2 & GAME_FLAGS_2_TARGETING_MODE )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
633 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
634 v11 = &vis_face_filter;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
635 v10 = &vis_sprite_filter_1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
636 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
637 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
638 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
639 v11 = &vis_face_filter;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
640 v10 = &vis_sprite_filter_4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
641 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
642 depth = 5120.0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
643 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
644 //depth = v2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
645
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
646 PickMouse(depth, cursor.x, cursor.y, false, v10, v11);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
647 pLightmapBuilder->std__vector_000004_size = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
648 pLightmapBuilder->std__vector_183808_size = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
649 pDecalBuilder->std__vector_pDecals_size = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
650 pDecalBuilder->field_308008 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
651 if (!_44F07B())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
652 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
653
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
654 if ( uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
655 pStru10Instance->bDoNotDrawPortalFrustum = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
656 if ( /*pRenderer->pRenderD3D &&*/ uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
657 pRenderer->uFogColor = GetLevelFogColor() & 0xFFFFFF;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
658 if (uFlags & 0x0400)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
659 uFlags2 |= 0x01;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
660 /*if ( !pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor && pMobileLightsStack->uNumLightsActive )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
661 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
662 uFlags2 |= 0x01;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
663 field_E10 = qword_5C6DF0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
664 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
665 v6 = qword_5C6DF0 - field_E10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
666 if ( qword_5C6DF0 - field_E10 == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
667 uFlags2 |= v6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
668 if (uNumStationaryLights_in_pStationaryLightsStack != pStationaryLightsStack->uNumLightsActive )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
669 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
670 uFlags2 |= 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
671 uNumStationaryLights_in_pStationaryLightsStack = pStationaryLightsStack->uNumLightsActive;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
672 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
673 _44E904();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
674 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
675 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
676
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
677
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
678 //----- (0044EDE4) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
679 bool Game::AlterGamma_BLV(BLVFace *pFace, signed int *pColor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
680 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
681 if (uFlags2 & GAME_FLAGS_2_SATURATE_LIGHTMAPS &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
682 pFace->uAttributes & FACE_CAN_SATURATE_COLOR)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
683 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
684 *pColor = ReplaceHSV(*pColor, 1.0, fSaturation, -1.0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
685 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
686 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
687 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
688 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
689 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
690
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
691 //----- (0044EE30) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
692 bool Game::AlterGamma_ODM(ODMFace *pFace, signed int *pColor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
693 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
694 if (uFlags2 & GAME_FLAGS_2_SATURATE_LIGHTMAPS &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
695 pFace->uAttributes & FACE_CAN_SATURATE_COLOR)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
696 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
697 *pColor = ReplaceHSV(*pColor, 1.0, fSaturation, -1.0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
698 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
699 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
700 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
701 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
702 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
703
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
704
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
705 //----- (004645FA) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
706 void Game::Deinitialize()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
707 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
708 WriteWindowsRegistryInt("startinwindow", 1);//pRenderer->bWindowMode);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
709 //if (pRenderer->bWindowMode)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
710 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
711 WriteWindowsRegistryInt("window X", window->GetX());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
712 WriteWindowsRegistryInt("window Y", window->GetY());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
713 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
714 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
715 pItemsTable->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
716 pNPCStats->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
717
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
718 if (pMouse)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
719 pMouse->Deactivate();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
720
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
721 delete pRenderer;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
722 pAudioPlayer->Release();//error
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
723 pNew_LOD->FreeSubIndexAndIO();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
724 pGames_LOD->FreeSubIndexAndIO();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
725 ClipCursor(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
726 Game::Destroy();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
727 delete pEventTimer;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
728 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
729
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
730 //----- (0044EE7C) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
731 bool Game::draw_debug_outlines()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
732 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
733 if (uFlags & 0x04)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
734 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
735 pLightmapBuilder->DrawDebugOutlines(-1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
736 pDecalBuilder->DrawDecalDebugOutlines();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
737 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
738 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
739 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
740
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
741 //----- (0044EC23) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
742 int Game::_44EC23(struct Polygon *a2, int *a3, signed int a4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
743 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
744 double v4; // st7@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
745 //double v5; // ST00_8@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
746 signed int v6; // eax@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
747 //double v7; // ST00_8@6
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
748 signed int result; // eax@8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
749 //double v9; // ST00_8@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
750 //double v10; // ST00_8@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
751 float a2a; // [sp+14h] [bp+8h]@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
752 float a3a; // [sp+18h] [bp+Ch]@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
753 float a3b; // [sp+18h] [bp+Ch]@6
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
754 float a4a; // [sp+1Ch] [bp+10h]@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
755 float a4b; // [sp+1Ch] [bp+10h]@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
756
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
757 if ( this->uFlags2 & 2 && a2->field_59 == 5 && a2->pODMFace->uAttributes & 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
758 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
759 v4 = (double)a4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
760 a2a = v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
761 *a3 |= 2u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
762 a3a = (1.0 - this->fSaturation) * v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
763 //v5 = a3a + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
764 //if ( SLODWORD(v5) >= 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
765 if (floorf(a3a + 0.5f) >= 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
766 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
767 a3b = (1.0 - this->fSaturation) * a2a;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
768 //v7 = a3b + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
769 //v6 = LODWORD(v7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
770 v6 = floorf(a3b + 0.5f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
771 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
772 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
773 v6 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
774 if ( a4 >= v6 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
775 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
776 a4a = (1.0 - fSaturation) * a2a;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
777 //v9 = a4a + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
778 //if ( SLODWORD(v9) >= 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
779 if (floorf(a4a + 0.5f) >= 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
780 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
781 a4b = (1.0 - fSaturation) * a2a;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
782 //v10 = a4b + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
783 //result = LODWORD(v10);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
784 result = floorf(a4b + 0.5f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
785 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
786 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
787 result = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
788 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
789 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
790 result = a4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
791 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
792 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
793 result = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
794 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
795 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
796
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
797
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
798
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
799 //----- (00465C8B) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
800 Game *Game::Create()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
801 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
802 return new Game;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
803 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
804
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
805 //----- (00465CF3) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
806 void Game::Destroy()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
807 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
808 delete pGame;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
809 pGame = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
810 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
811
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
812 //----- (0044ED0A) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
813 signed int Game::_44ED0A(BLVFace *a2, int *a3, signed int a4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
814 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
815 double v4; // st7@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
816 //double v5; // ST00_8@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
817 signed int v6; // eax@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
818 //double v7; // ST00_8@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
819 signed int result; // eax@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
820 //double v9; // ST00_8@8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
821 //double v10; // ST00_8@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
822 float v11; // [sp+14h] [bp+8h]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
823 float v12; // [sp+18h] [bp+Ch]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
824 float v13; // [sp+18h] [bp+Ch]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
825 float v14; // [sp+1Ch] [bp+10h]@8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
826 float v15; // [sp+1Ch] [bp+10h]@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
827
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
828 if ( this->uFlags2 & 2 && a2->uAttributes & 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
829 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
830 v4 = (double)a4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
831 v11 = v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
832 *a3 |= 2u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
833 v12 = (1.0 - this->fSaturation) * v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
834 //v5 = v12 + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
835 if (floorf(v12 + 0.5f)/* SLODWORD(v5)*/ >= 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
836 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
837 v13 = (1.0 - this->fSaturation) * v11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
838 //v7 = v13 + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
839 //v6 = LODWORD(v7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
840 v6 = floorf(v13 + 0.5f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
841 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
842 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
843 v6 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
844 if ( a4 >= v6 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
845 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
846 v14 = (1.0 - fSaturation) * v11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
847 //v9 = v14 + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
848 if (floorf(v14 + 0.5f)/* SLODWORD(v9)*/ >= 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
849 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
850 v15 = (1.0 - fSaturation) * v11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
851 //v10 = v15 + 6.7553994e15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
852 //result = LODWORD(v10);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
853 result = floorf(v15 + 0.5f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
854 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
855 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
856 result = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
857 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
858 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
859 result = a4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
860 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
861 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
862 result = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
863 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
864 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
865
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
866
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
867 //----- (0044E4B7) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
868 Game::Game()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
869 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
870 uNumStationaryLights = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
871 uNumBloodsplats = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
872 field_E0C = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
873 field_E10 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
874 uNumStationaryLights_in_pStationaryLightsStack = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
875 bGammaControlInitialized = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
876 uFlags = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
877 uFlags2 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
878 uSomeGammaStartTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
879 uSomeGammaDeltaTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
880
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
881 //pThreadWardInstance = new ThreadWard;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
882 pThreadWardInstance = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
883 pParticleEngine = new ParticleEngine;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
884 pMouse = pMouseInstance = new Mouse;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
885 pLightmapBuilder = new LightmapBuilder;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
886 pVisInstance = new Vis;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
887 pStru6Instance = new stru6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
888 pIndoorCameraD3D = new IndoorCameraD3D;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
889 pStru9Instance = new stru9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
890 pStru10Instance = new stru10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
891 //pStru11Instance = new stru11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
892 pStru11Instance = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
893 //pStru12Instance = new stru12(pStru11Instance);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
894 pStru12Instance = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
895 //pCShow = new CShow;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
896 pCShow = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
897 pKeyboardInstance = new Keyboard;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
898 pGammaController = new GammaController;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
899
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
900 uFlags |= 0x0800;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
901 uFlags2 |= 0x24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
902
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
903 _44F0FD();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
904 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
905
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
906 //----- (0044E7F3) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
907 Game::~Game()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
908 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
909 delete pGammaController;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
910 delete pKeyboardInstance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
911 /*delete pCShow;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
912 delete pStru12Instance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
913 delete pStru11Instance;*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
914 delete pStru10Instance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
915 delete pStru9Instance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
916 delete pIndoorCameraD3D;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
917 delete pStru6Instance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
918 delete pVisInstance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
919 delete pLightmapBuilder;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
920 delete pMouseInstance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
921 delete pParticleEngine;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
922 //delete pThreadWardInstance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
923 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
924
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
925 //----- (0044E904) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
926 void Game::_44E904()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
927 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
928 //Game *v1; // esi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
929 unsigned __int64 v2; // qax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
930 unsigned int v3; // ecx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
931 int v4; // edi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
932 unsigned __int8 v5; // cf@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
933 double v6; // st7@13
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
934 double v7; // st7@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
935 signed __int64 v8; // [sp+Ch] [bp-8h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
936
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
937 //v1 = this;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
938 v2 = pEventTimer->Time();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
939 v4 = (v2 - uSomeGammaStartTime) >> 32;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
940 v3 = v2 - LODWORD(uSomeGammaStartTime);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
941 v8 = v2 - uSomeGammaStartTime;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
942 if ( v4 < 0
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
943 || SHIDWORD(v2) < ((unsigned int)v2 < LODWORD(uSomeGammaStartTime)) + HIDWORD(uSomeGammaStartTime) | v4 == 0
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
944 && v3 <= 0x80 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
945 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
946 if ( v4 < 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
947 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
948 v3 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
949 v4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
950 uSomeGammaStartTime = v2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
951 v8 = __PAIR__(v4, v3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
952 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
953 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
954 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
955 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
956 if ( uSomeGammaDeltaTime )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
957 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
958 LODWORD(uSomeGammaDeltaTime) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
959 HIDWORD(uSomeGammaDeltaTime) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
960 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
961 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
962 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
963 LODWORD(uSomeGammaDeltaTime) = v3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
964 HIDWORD(uSomeGammaDeltaTime) = v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
965 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
966 v5 = __CFADD__(v3, -128);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
967 v3 -= 128;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
968 v4 = v5 + v4 - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
969 uSomeGammaStartTime = v2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
970 v8 = __PAIR__(v4, v3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
971 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
972 if ( uSomeGammaDeltaTime )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
973 v6 = (double)(signed __int64)(uSomeGammaDeltaTime - __PAIR__(v4, v3));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
974 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
975 v6 = (double)v8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
976 v7 = v6 * 0.0078125;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
977 if ( v7 < 0.0 || v7 <= 1.0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
978 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
979 if ( v7 < 0.0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
980 v7 = 0.0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
981 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
982 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
983 v7 = 1.0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
984 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
985 fSaturation = v7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
986 //else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
987 // fSaturation = (1.0 - 0.5) * v7 + 0.5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
988 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
989
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
990 //----- (0044EA17) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
991 bool Game::InitializeGammaController()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
992 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
993 //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
994 //pVersion->pVersionInfo.dwMajorVersion != 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
995 pGammaController->InitializeFromSurface(pRenderer->pFrontBuffer4);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
996
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
997 bGammaControlInitialized = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
998 uSomeGammaStartTime = pEventTimer->Time();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
999 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1000 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1001
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1002 //----- (0044EA5E) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1003 bool Game::PickMouse(float fPickDepth, unsigned int uMouseX, unsigned int uMouseY, bool bOutline, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1004 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1005 /*if (pCurrentScreen != SCREEN_GAME|| !pRenderer->pRenderD3D)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1006 return false;*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1007
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1008 if (!pVisInstance)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1009 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1010 MessageBoxW(nullptr, L"The 'Vis' object pointer has not been instatiated, but CGame::Pick() is trying to call through it.", nullptr, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1011 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1012 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1013
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1014 if (uMouseX >= (signed int)pViewport->uScreen_TL_X &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1015 uMouseX <= (signed int)pViewport->uScreen_BR_X &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1016 uMouseY >= (signed int)pViewport->uScreen_TL_Y &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1017 uMouseY <= (signed int)pViewport->uScreen_BR_Y)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1018 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1019 pVisInstance->PickMouse(fPickDepth, uMouseX, uMouseY, sprite_filter, face_filter);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1020
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1021 if (bOutline)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1022 OutlineSelection();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1023 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1024
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1025 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1026 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1027 // 4E28F8: using guessed type int pCurrentScreen;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1028
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1029 //----- (0044EB12) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1030 bool Game::PickKeyboard(bool bOutline, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1031 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1032 if (pCurrentScreen == SCREEN_GAME && pVisInstance /*&& pRenderer->pRenderD3D*/)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1033 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1034 bool r = pVisInstance->PickKeyboard(&pVisInstance->default_list, sprite_filter, face_filter);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1035
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1036 if (bOutline)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1037 OutlineSelection();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1038 return r;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1039 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1040 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1041 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1042 /*
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1043 Result::Code Game::PickKeyboard(bool bOutline, struct unnamed_F93E6C *a3, struct unnamed_F93E6C *a4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1044 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1045 if (dword_4E28F8_PartyCantJumpIfTrue)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1046 return Result::Generic;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1047
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1048 pVis->PickKeyboard(a3, a4);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1049 if (bOutline)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1050 Game_outline_selection((int)this);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1051 return Result::Success;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1052 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1053 */
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1054 // 4E28F8: using guessed type int pCurrentScreen;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1055
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1056 //----- (0044EB5A) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1057 void Game::OutlineSelection()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1058 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1059 if (!pVisInstance)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1060 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1061
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1062 if (!pVisInstance->default_list.uNumPointers)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1063 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1064
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1065 Vis_ObjectInfo* object_info = pVisInstance->default_list.object_pointers[0];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1066 if (object_info)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1067 switch (object_info->object_type)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1068 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1069 case VisObjectType_Sprite:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1070 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1071 Log::Warning(L"Sprite outline currently unsupported");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1072 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1073 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1074
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1075 case VisObjectType_Face:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1076 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1077 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1078 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1079 ODMFace* face = (ODMFace *)object_info->object;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1080 if (face->uAttributes & FACE_OUTLINED)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1081 face->uAttributes &= ~FACE_OUTLINED;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1082 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1083 face->uAttributes |= FACE_OUTLINED;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1084 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1085 else if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1086 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1087 BLVFace* face = (BLVFace *)object_info->object;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1088 if (face->uAttributes & FACE_OUTLINED)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1089 face->uAttributes &= ~FACE_OUTLINED;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1090 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1091 face->uAttributes |= FACE_OUTLINED;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1092 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1093 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1094 Error("Invalid level type", uCurrentlyLoadedLevelType);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1095 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1096 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1097
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1098 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1099 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1100 MessageBoxW(nullptr, L"Undefined CObjectInfo type requested in CGame::outline_selection()", nullptr, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1101 ExitProcess(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1102 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1103 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1104 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1105 //----- (004304E7) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1106 void GameUI_MsgProc()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1107 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1108 unsigned int v2; // edx@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1109 Actor *pActor; // ecx@13
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1110 int v4; // ecx@18
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1111 unsigned int v10; // ecx@73
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1112 int v14; // eax@98
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1113 int v18; // eax@106
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1114 float v19; // ST64_4@121
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1115 float v21; // ST64_4@126
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1116 float v22; // ST64_4@127
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1117 unsigned int v24; // ecx@149
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1118 GUIWindow *pWindow2; // ecx@248
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1119 bool pKeyBindingFlag; // eax@269
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1120 unsigned int v33; // eax@277
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1121 int v37; // eax@341
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1122 int v38; // eax@358
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1123 SHORT v39; // ax@365
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1124 char *v41; // eax@380
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1125 int v42; // eax@396
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1126 signed int v44; // eax@398
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1127 int v45; // edx@398
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1128 signed int v46; // ecx@398
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1129 char v47; // zf@399
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1130 char v48; // zf@405
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1131 BLVFace *pBLVFace; // ecx@410
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1132 ODMFace *pODMFace; // ecx@412
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1133 CastSpellInfo *pSpellInfo; // ecx@415
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1134 __int16 v53; // ax@431
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1135 int v54; // eax@432
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1136 int v55; // ecx@432
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1137 int v56; // edx@432
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1138 int v57; // eax@432
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1139 Player *pPlayer; // edx@442
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1140 unsigned int pMapNum; // eax@445
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1141 signed int v60; // ST64_4@459
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1142 __int16 v63; // dx@479
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1143 unsigned int v64; // eax@486
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1144 int v65; // ecx@486
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1145 int v66; // eax@488
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1146 char *v67; // eax@489
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1147 __int16 v68; // dx@498
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1148 char *v69; // eax@512
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1149 int v70; // eax@525
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1150 int v71; // edi@527
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1151 NPCData *pNPCData3; // esi@527
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1152 char *v73; // ecx@533
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1153 signed int v74; // edi@535
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1154 int v75; // eax@535
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1155 int v76; // esi@535
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1156 int v77; // eax@537
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1157 Player *pPlayer2; // ecx@549
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1158 signed int v81; // eax@552
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1159 signed int v83; // ecx@554
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1160 signed int v84; // ecx@554
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1161 GUIButton *pButton; // eax@578
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1162 unsigned int v86; // eax@583
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1163 const char *v87; // ecx@595
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1164 const char *v88; // ecx@596
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1165 unsigned int v90; // eax@602
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1166 int v91; // edx@605
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1167 int v92; // eax@605
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1168 int v93; // edx@605
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1169 int pPlayerNum; // edx@611
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1170 int v95; // eax@611
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1171 unsigned int v97; // eax@624
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1172 int v98; // eax@636
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1173 int v103; // eax@671
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1174 Player *pPlayer4; // ecx@718
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1175 int v105; // eax@718
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1176 Player *pPlayer5; // ST78_4@758
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1177 unsigned int v107; // eax@758
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1178 unsigned int v108; // eax@758
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1179 unsigned int v115; // eax@764
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1180 int v116; // eax@776
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1181 unsigned int v118; // eax@785
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1182 unsigned int v119; // ecx@786
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1183 unsigned int v121; // [sp-28h] [bp-624h]@711
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1184 unsigned int v123; // [sp-24h] [bp-620h]@711
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1185 unsigned int v125; // [sp-20h] [bp-61Ch]@711
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1186 int v127; // [sp-1Ch] [bp-618h]@107
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1187 unsigned int v128; // [sp-1Ch] [bp-618h]@711
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1188 GUIButton *pButton2; // [sp-4h] [bp-600h]@59
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1189 const char *v161; // [sp-4h] [bp-600h]@637
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1190 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1191 char *v173; // [sp+0h] [bp-5FCh]@444
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1192 char *v174; // [sp+0h] [bp-5FCh]@449
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1193 const char *v177; // [sp+0h] [bp-5FCh]@629
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1194 char *v178; // [sp+0h] [bp-5FCh]@637
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1195 signed int thisb; // [sp+14h] [bp-5E8h]@272
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1196 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1197 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1198 char *pMapName; // [sp+14h] [bp-5E8h]@445
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1199 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1200 int thisg; // [sp+14h] [bp-5E8h]@467
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1201 int thish; // [sp+14h] [bp-5E8h]@528
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1202 signed int thisi; // [sp+14h] [bp-5E8h]@535
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1203 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1204 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1205 int uMessageParam; // [sp+18h] [bp-5E4h]@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1206 int uAction; // [sp+1Ch] [bp-5E0h]@18
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1207 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1208 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1209 char v197; // [sp+2Bh] [bp-5D1h]@101
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1210 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1211 unsigned int v199; // [sp+30h] [bp-5CCh]@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1212 char *v200; // [sp+34h] [bp-5C8h]@518
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1213 POINT v202; // [sp+40h] [bp-5BCh]@141
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1214 POINT a2; // [sp+48h] [bp-5B4h]@127
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1215 POINT v205; // [sp+58h] [bp-5A4h]@171
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1216 POINT v207; // [sp+68h] [bp-594h]@155
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1217 POINT v211; // [sp+88h] [bp-574h]@704
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1218 int v213; // [sp+98h] [bp-564h]@385
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1219 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1220 char pOut[32]; // [sp+BCh] [bp-540h]@370
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1221 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1222 int v217[9]; // [sp+158h] [bp-4A4h]@652
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1223 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1224 char a1[64]; // [sp+1F8h] [bp-404h]@467
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1225 char Str2[128]; // [sp+238h] [bp-3C4h]@527
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1226 Actor actor; // [sp+2B8h] [bp-344h]@4
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1227 int currHour;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1228
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1229 dword_50CDC8 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1230 if ( !pEventTimer->bPaused )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1231 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1232 pParty->sEyelevel = pParty->uDefaultEyelevel;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1233 pParty->uPartyHeight = pParty->uDefaultPartyHeight;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1234 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1235 if ( bDialogueUI_InitializeActor_NPC_ID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1236 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1237 //Actor::Actor(&actor);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1238 memset(&actor, 0, 0x344u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1239 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1240 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1241 GameUI_InitializeDialogue(&actor, false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1242 bDialogueUI_InitializeActor_NPC_ID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1243 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1244 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1245 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1246 //v1 = "";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1247 while ( 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1248 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1249 if ( !pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1250 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1251
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1252 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1253 switch ( uMessage )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1254 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1255 case UIMSG_ChangeGameState:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1256 uGameState = GAME_FINISHED;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1257 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1258 case UIMSG_PlayArcomage:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1259 BackToHouseMenu();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1260 pArcomageGame->bGameInProgress = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1261 ArcomageGame::PrepareArcomage();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1262 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1263 case UIMSG_StartNPCDialogue:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1264 if ( !uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1265 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1266 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1267 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1268 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1269 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1270 pActor = &pActors[uMessageParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1271 //goto _actor_init_dlg;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1272 GameUI_InitializeDialogue(pActor, true);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1273 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1274 case UIMSG_StartHireling1Dialogue:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1275 case UIMSG_StartHireling2Dialogue:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1276 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1277 if (bNoNPCHiring || pCurrentScreen)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1278 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1279
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1280 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1281 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1282 uAction = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1283 int hireling_idx = uMessage - UIMSG_StartHireling1Dialogue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1284 v4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1285
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1286 for (uint i = 0; i < 2; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1287 //pNPCData0 = pParty->pHirelings;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1288 //do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1289 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1290 if (pParty->pHirelings[i].pName)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1291 //{
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1292 //v6 = uAction++;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1293 pTmpBuf[uAction++] = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1294 //}
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1295 //++pNPCData0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1296 //++v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1297 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1298 //while ( (signed int)pNPCData0 < (signed int)&pParty->pPickedItem );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1299
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1300 //_this = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1301 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1302 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1303 NPCData* npc = &pNPCStats->pNewNPCData[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1304 //do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1305 //{
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1306 if (npc->Hired() &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1307 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1308 (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1309 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1310 //v7 =;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1311 pTmpBuf[uAction++] = i + 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1312 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1313 //++_this;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1314 //++pNPCData4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1315 //}
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1316 //while ( _this < (signed int)pNPCStats->uNumNewNPCs );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1317 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1318
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1319 if ( (signed int)(hireling_idx + pParty->hirelingScrollPosition) < uAction )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1320 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1321 //Actor::Actor(&actor);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1322 memset(&actor, 0, 0x344u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1323 actor.sNPC_ID += -1 - pParty->hirelingScrollPosition - hireling_idx;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1324 pActor = &actor;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1325 GameUI_InitializeDialogue(&actor, true);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1326 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1327 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1328 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1329
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1330 case UIMSG_BuyInShop_Identify_Repair:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1331 UIShop_Buy_Identify_Repair();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1332 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1333 case UIMSG_ClickNPCTopic:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1334 ClickNPCTopic(uMessageParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1335 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1336 case UIMSG_SelectShopDialogueOption:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1337 OnSelectShopDialogueOption(uMessageParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1338 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1339 case UIMSG_SelectNPCDialogueOption:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1340 OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1341 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1342 case UIMSG_ClickHouseNPCPortrait:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1343 _4B4224_UpdateNPCTopics(uMessageParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1344 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1345 case UIMSG_StartNewGame:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1346 if ( dword_6BE138 == 124 || uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1347 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1348 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1349 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1350 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1351 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1352 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1353 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1354 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1355 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1356 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1357 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1358 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1359 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2);// "Are you sure? Click again to start a New Game"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1360 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1361 dword_6BE138 = 124;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1362 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1363 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1364 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1365 case UIMSG_Game_OpenLoadGameDialog:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1366 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1367 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1368 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1369 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1370 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1371 pCurrentScreen = SCREEN_LOADGAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1372 LoadUI_Load(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1373 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1374 case UIMSG_Quit:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1375 if ( dword_6BE138 == 132 || uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1376 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1377 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1378 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1379 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1380 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1381 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1382 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1383 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1384 if ( !uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1385 pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1386 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1387 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1388 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1389 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1390 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1391 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1392 dword_6BE138 = 132;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1393 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1394 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1395 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1396 case UIMSG_80:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1397 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1398 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1399 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1400 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1401 pCurrentScreen = SCREEN_OPTIONS;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1402 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_8, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1403 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1404 case UIMSG_ArrowUp:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1405 --pSaveListPosition;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1406 if ( pSaveListPosition < 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1407 pSaveListPosition = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1408 GUIWindow::Create(215, 199, 17, 17, WINDOW_PressedButton2, (int)pBtnArrowUp, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1409 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1410 case UIMSG_DownArrow:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1411 ++pSaveListPosition;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1412 if ( pSaveListPosition >= uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1413 pSaveListPosition = uMessageParam - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1414 GUIWindow::Create(215, 323, 17, 17, WINDOW_PressedButton2, (int)pBtnDownArrow, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1415 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1416 case UIMSG_Cancel:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1417 GUIWindow::Create(350, 302, 106, 42, WINDOW_CloseRestWindowBtn, (int)pBtnCancel, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1418 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1419 case UIMSG_SaveLoadBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1420 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1421 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1422 case UIMSG_SelectLoadSlot:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1423 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1424 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1425 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1426 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1427 v10 = pSaveListPosition + uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1428 if ( dword_6BE138 == pSaveListPosition + uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1429 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1430 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1431 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1432 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1433 uLoadGameUI_SelectedSlot = v10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1434 dword_6BE138 = v10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1435 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1436 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1437 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1438 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1439 if ( strcmp(pSavegameHeader[uLoadGameUI_SelectedSlot].pName, pGlobalTXT_LocalizationStrings[72]) )// "Empty"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1440 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1441 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1442 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1443 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1444 case UIMSG_LoadGame:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1445 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1446 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1447 LoadGame(uLoadGameUI_SelectedSlot);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1448 uGameState = GAME_STATE_LOADING_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1449 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1450 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1451 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1452 case UIMSG_SaveGame:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1453 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1454 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1455 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1456 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pKeyActionMap->pPressedKeysBuffer);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1457 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1458 DoSavegame(uLoadGameUI_SelectedSlot);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1459 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1460 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1461 case UIMSG_Game_OpenSaveGameDialog:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1462 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1463 pCurrentScreen = SCREEN_SAVEGAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1464 SaveUI_Load();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1465 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1466 case UIMSG_Game_OpenOptionsDialog://Open
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1467 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1468 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1469 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1470 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1471 pCurrentScreen = SCREEN_OPTIONS;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1472
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1473 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1474 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1475 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1476 options_menu_skin.uTextureID_TurnSpeed[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1477 options_menu_skin.uTextureID_ArrowLeft = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1478 options_menu_skin.uTextureID_ArrowRight = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1479 options_menu_skin.uTextureID_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1480 options_menu_skin.uTextureID_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1481 options_menu_skin.uTextureID_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1482 options_menu_skin.uTextureID_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1483 options_menu_skin.uTextureID_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1484 options_menu_skin.uTextureID_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1485 options_menu_skin.uTextureID_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1486 options_menu_skin.uTextureID_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1487 options_menu_skin.uTextureID_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1488 options_menu_skin.uTextureID_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1489 options_menu_skin.uTextureID_FlipOnExit = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1490 options_menu_skin.uTextureID_AlwaysRun = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1491 options_menu_skin.uTextureID_ShowDamage = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1492 options_menu_skin.uTextureID_WalkSound = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1493
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1494 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Options, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1495 pGUIWindow_CurrentMenu->CreateButton(22, 270,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1496 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1497 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1498 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1499 pGUIWindow_CurrentMenu->CreateButton(93, 270,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1500 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1501 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1502 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1503 pGUIWindow_CurrentMenu->CreateButton(164, 270,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1504 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1505 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1506 1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1507
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1508 pGUIWindow_CurrentMenu->CreateButton(20, 303,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1509 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1510 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1511 1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1512 pGUIWindow_CurrentMenu->CreateButton(128, 303,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1513 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1514 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1515 1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1516 pGUIWindow_CurrentMenu->CreateButton(20, 325,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1517 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1518 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1519 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1520 pGUIWindow_CurrentMenu->CreateButton(128, 325,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1521 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1522 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1523 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1524
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1525 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1526 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1527 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1528
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1529 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1530 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1531 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1532
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1533 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1534 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1535 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1536
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1537 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1538 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1539 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1540 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1541
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1542 case UIMSG_OpenKeyMappingOptions://Open
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1543 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1544 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1545 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1546 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1547 pCurrentScreen = SCREEN_KEYBOARD_OPTIONS;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1548 uTextureID_Optkb[0] = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1549 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1550 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1551 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1552 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1553 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_KeyMappingOptions, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1554
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1555 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1556
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1557 pGUIWindow_CurrentMenu->CreateButton(19, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1558 pGUIWindow_CurrentMenu->CreateButton(127, 302, 108, 20, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1559 pGUIWindow_CurrentMenu->CreateButton(127, 324, 108, 20, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1560 pGUIWindow_CurrentMenu->CreateButton(19, 324, 108, 20, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1561
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1562 pGUIWindow_CurrentMenu->CreateButton(129, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1563 pGUIWindow_CurrentMenu->CreateButton(129, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 1, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1564 pGUIWindow_CurrentMenu->CreateButton(129, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 2, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1565 pGUIWindow_CurrentMenu->CreateButton(129, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 3, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1566 pGUIWindow_CurrentMenu->CreateButton(129, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 4, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1567 pGUIWindow_CurrentMenu->CreateButton(129, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 5, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1568 pGUIWindow_CurrentMenu->CreateButton(129, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 6, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1569 pGUIWindow_CurrentMenu->CreateButton(350, 148, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 7, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1570 pGUIWindow_CurrentMenu->CreateButton(350, 167, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 8, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1571 pGUIWindow_CurrentMenu->CreateButton(350, 186, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 9, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1572 pGUIWindow_CurrentMenu->CreateButton(350, 205, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 10, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1573 pGUIWindow_CurrentMenu->CreateButton(350, 224, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 11, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1574 pGUIWindow_CurrentMenu->CreateButton(350, 243, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 12, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1575 pGUIWindow_CurrentMenu->CreateButton(350, 262, 70, 19, 1, 0, UIMSG_ChangeKeyButton, 13, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1576
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1577 uGameMenuUI_CurentlySelectedKeyIdx = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1578 KeyboardPageNum = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1579 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1580 //*(_WORD *)KeyButtonArray[28] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1581 memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1582 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1583 case UIMSG_ChangeKeyButton:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1584 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1585 {
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1586 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1587 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1588 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1589 v14 = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1590 if ( KeyboardPageNum != 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1591 v14 = uMessageParam + 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1592 uGameMenuUI_CurentlySelectedKeyIdx = v14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1593 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1594 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1595 case UIMSG_ResetKeyMapping:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1596 v197 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1597 pKeyActionMap->SetDefaultMapping();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1598 for ( uint i = 0; i < 28; i++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1599 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1600 if ( pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1601 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1602 if ( v197 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1603 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1604 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1605 v197 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1606 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1607 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1608 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[i]), pKeyActionMap->GetActionVKey((enum InputAction)i), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1609 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1610 pPrevVirtualCidesMapping[i] = pKeyActionMap->GetActionVKey((enum InputAction)i);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1611 GameMenuUI_InvaligKeyBindingsFlags[i] = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1612 }
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1613 pAudioPlayer->PlaySound(SOUND_219, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1614 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1615 case UIMSG_SelectKeyPage1:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1616 KeyboardPageNum = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1617 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1618 case UIMSG_SelectKeyPage2:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1619 KeyboardPageNum = 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1620 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1621 case UIMSG_OpenVideoOptions:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1622 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1623 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1624 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1625 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1626 pCurrentScreen = SCREEN_VIDEO_OPTIONS;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1627 optvid_base_texture_id = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1628 bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1629 us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1630 tinting_texture_id = pIcons_LOD->LoadTexture("opvdH-tn", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1631 uTextureID_507C20 = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1632 uTextureID_507C24 = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1633 pTextureIDs_GammaPositions[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1634 pTextureIDs_GammaPositions[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1635 pTextureIDs_GammaPositions[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1636 pTextureIDs_GammaPositions[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1637 pTextureIDs_GammaPositions[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1638 pTextureIDs_GammaPositions[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1639 pTextureIDs_GammaPositions[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1640 pTextureIDs_GammaPositions[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1641 pTextureIDs_GammaPositions[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1642 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1643 not_available_bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1644 not_available_us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1645 not_available_tinting_texture_id = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1646 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_VideoOptions, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1647 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1648 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1649 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1650 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1651 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1652 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1653 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1654 /*if ( !pRenderer->bWindowMode )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1655 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1656 //v0 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1657 if ( pRenderer->IsGammaSupported() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1658 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1659 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1660 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1661 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1662 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1663 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1664 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1665 case UIMSG_1A9:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1666 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1667 if ( uMessageParam == 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1668 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1669 //--uGammaPos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1670 if ( (uGammaPos -- -1) < 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1671 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1672 uGammaPos = 0;
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1673 pAudioPlayer->PlaySound(SOUND_21, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1674 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1675 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1676 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1677 pGame->pGammaController->Initialize(v19);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1678 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1679 pAudioPlayer->PlaySound(SOUND_21, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1680 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1681 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1682 if ( uMessageParam == 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1683 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1684 ++uGammaPos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1685 if ( (signed int)uGammaPos <= 9 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1686 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1687 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1688 pGame->pGammaController->Initialize(v21);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1689 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1690 pAudioPlayer->PlaySound(SOUND_21, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1691 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1692 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1693 uGammaPos = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1694 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1695 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1696 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1697 uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1698 v22 = (double)(signed int)uGammaPos * 0.1 + 0.6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1699 pGame->pGammaController->Initialize(v22);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1700 }
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1701 pAudioPlayer->PlaySound(SOUND_21, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1702 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1703 case UIMSG_ToggleBloodsplats:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1704 pGame->ToggleFlags2(0x20u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1705 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1706 case UIMSG_ToggleColoredLights:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1707 pRenderer->ToggleColoredLights();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1708 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1709 case UIMSG_ToggleTint:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1710 pRenderer->ToggleTint();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1711 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1712 case UIMSG_ChangeMusicVolume:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1713 if ( uMessageParam == 4 )//-
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1714 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1715 --uMusicVolimeMultiplier;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1716 if ( (char)uMusicVolimeMultiplier < 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1717 uMusicVolimeMultiplier = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1718 GUIWindow::Create(243, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1719 if ( uMusicVolimeMultiplier )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1720 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1721 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1722 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1723 else
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1724 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1725 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1726 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1727 if ( uMessageParam == 5 )//+
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1728 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1729 ++uMusicVolimeMultiplier;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1730 if ( (char)uMusicVolimeMultiplier > 9 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1731 uMusicVolimeMultiplier = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1732 GUIWindow::Create(435, 216, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1733 if ( uMusicVolimeMultiplier )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1734 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1735 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1736 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1737 else
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1738 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1739 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1740 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1741 uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17;//for mouse
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1742 if ( (char)uMusicVolimeMultiplier > 9 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1743 uMusicVolimeMultiplier = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1744 if ( uMusicVolimeMultiplier )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1745 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0);
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1746 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1747 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1748 else
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
1749 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1750 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1751 case UIMSG_ChangeSoundVolume:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1752 if ( uMessageParam == 4 )//reduce sound level button left
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1753 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1754 --uSoundVolumeMultiplier;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1755 if ( (char)uSoundVolumeMultiplier < 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1756 uSoundVolumeMultiplier = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1757 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1758 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1759 pAudioPlayer->PlaySound(SOUND_shurch, -1, 0, -1, 0, 0, 0, 0);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1760 int v = AIL_redbook_volume(pAudioPlayer->hAILRedbook);
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1761 //v = v+1;
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1762 if (v)
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1763 __debugbreak();
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1764 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1765 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1766 if ( uMessageParam == 5 )//Increase sound level button right
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1767 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1768 ++uSoundVolumeMultiplier;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1769 if ( (char)uSoundVolumeMultiplier > 8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1770 uSoundVolumeMultiplier = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1771 //v168 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1772 v24 = 435;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1773 //v154 = (int)pBtn_SliderRight;
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1774 GUIWindow::Create(v24, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1775 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1776 pAudioPlayer->PlaySound(SOUND_shurch, -1, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1777 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1778 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1779 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1780 if ( (char)uSoundVolumeMultiplier > 8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1781 uSoundVolumeMultiplier = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1782 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1783 pAudioPlayer->PlaySound(SOUND_shurch, -1, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1784 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1785 case UIMSG_ToggleFlipOnExit:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1786 bFlipOnExit = bFlipOnExit == 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1787 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1788 case UIMSG_ToggleAlwaysRun:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1789 bAlwaysRun = bAlwaysRun == 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1790 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1791 case UIMSG_ToggleWalkSound:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1792 bWalkSound = bWalkSound == 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1793 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1794 case UIMSG_ToggleShowDamage:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1795 bShowDamage = bShowDamage == 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1796 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1797 case UIMSG_ChangeVoiceVolume:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1798 if ( uMessageParam == 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1799 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1800 --uVoicesVolumeMultiplier;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1801 if ( (char)uVoicesVolumeMultiplier < 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1802 uVoicesVolumeMultiplier = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1803 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1804 if ( !uVoicesVolumeMultiplier )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1805 continue;
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1806 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1807 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1808 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1809 if ( uMessageParam == 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1810 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1811 ++uVoicesVolumeMultiplier;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1812 if ( (char)uVoicesVolumeMultiplier > 8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1813 uVoicesVolumeMultiplier = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1814 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1815 if ( !uVoicesVolumeMultiplier )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1816 continue;
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1817 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1818 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1819 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1820 uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1821 if ( (char)uVoicesVolumeMultiplier > 8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1822 uVoicesVolumeMultiplier = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1823 if ( !uVoicesVolumeMultiplier )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1824 continue;
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
1825 pAudioPlayer->PlaySound(SOUND_hf445a, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1826 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1827 case UIMSG_SetTurnSpeed:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1828 if ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1829 pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1830 uTurnSpeed = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1831 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1832
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1833 case UIMSG_SetGraphicsMode:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1834 /*if ( !bUseLoResSprites )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1835 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1836 byte_6BE388_graphicsmode = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1837 MM7Initialization();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1838 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1839 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1840 if ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1841 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1842 if ( uMessageParam == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1843 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1844 byte_6BE388_graphicsmode = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1845 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1846 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1847 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1848 if ( uMessageParam != 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1849 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1850 byte_6BE388_graphicsmode = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1851 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1852 MM7Initialization();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1853 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1854 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1855 ModalWindow(pNPCTopics[453].pText, UIMSG_0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1856 __debugbreak(); // Nomad: graphicsmode as it was now removed
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1857 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1858
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1859 case UIMSG_GameMenu_ReturnToGame:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1860 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1861 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1862 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1863 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1864 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1865 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1866 case UIMSG_OpenQuestBook:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1867 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1868 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1869 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1870 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1871 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1872 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1873 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1874 pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Quests, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1875 bFlashQuestBook = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1876 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1877 case UIMSG_OpenAutonotes:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1878 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1879 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1880 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1881 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1882 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1883 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1884 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1885 pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Autonotes, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1886 bFlashAutonotesBook = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1887 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1888 case UIMSG_OpenMapBook:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1889 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1890 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1891 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1892 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1893 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1894 viewparams->sViewCenterX = pParty->vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1895 viewparams->sViewCenterY = pParty->vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1896 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1897 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1898 pBooksWindow = GUIWindow::Create(546, 353, 0, 0, WINDOW_BooksWindow, (int)pBtn_Maps, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1899 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1900 case UIMSG_OpenCalendar:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1901 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1902 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1903 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1904 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1905 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1906 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1907 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1908 pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_BooksWindow, (int)pBtn_Calendar, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1909 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1910 case UIMSG_OpenHistoryBook:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1911 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1912 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1913 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1914 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1915 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1916 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1917 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, uMessage, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1918 pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_BooksWindow, (int)pBtn_History, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1919 bFlashHistoryBook = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1920 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1921 case UIMSG_Escape:// íàæàòèå Escape and return to game
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1922 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1923 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1924 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1925 switch ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1926 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1927 case SCREEN_E:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1928 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1929 case SCREEN_NPC_DIALOGUE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1930 case SCREEN_CHEST:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1931 case SCREEN_CHEST_INVENTORY:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1932 case SCREEN_CHANGE_LOCATION:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1933 case SCREEN_INPUT_BLV:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1934 case SCREEN_QUICK_REFERENCE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1935 if ( dword_50CDC8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1936 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1937 CloseWindowBackground();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1938 uMessageParam = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1939 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1940 case SCREEN_HOUSE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1941 if ( !dword_50CDC8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1942 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1943 CloseWindowBackground();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1944 uMessageParam = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1945 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1946 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1947 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1948 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1949 if ( !pModalWindow )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1950 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1951 pRenderer->ClearZBuffer(0, 479);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1952 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1953 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1954 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1955 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1956 if ( pCurrentScreen > SCREEN_67 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1957 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1958 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1959 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1960 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1961 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1962 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1963 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1964 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1965 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1966 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1967 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1968 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1969 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1970 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1971 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1972 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1973 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1974 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1975 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1976 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1977 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1978 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1979 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1980 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1981 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1982 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1983 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1984 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1985 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1986 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1987 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1988 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1989 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1990 if ( pCurrentScreen < SCREEN_64 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1991 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1992 switch ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1993 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1994 case SCREEN_CASTING:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1995 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1996 if ( some_active_character )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1997 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1998 uActiveCharacter = some_active_character;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1999 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2000 some_active_character = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2001 if ( pParty->bTurnBasedModeOn )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2002 pTurnEngine->ApplyPlayerAction();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2003 _50C9D0_AfterEnchClickEventId = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2004 _50C9D4_AfterEnchClickEventSecondParam = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2005 _50C9D8_AfterEnchClickEventTimeout = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2006 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2007 if ( ptr_50C9A4_ItemToEnchant && ptr_50C9A4_ItemToEnchant->uItemID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2008 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2009 LOBYTE(ptr_50C9A4_ItemToEnchant->uAttributes) &= 0xFu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2010 _50C9A8_item_enchantment_timer = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2011 ptr_50C9A4_ItemToEnchant = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2012 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2013 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2014 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2015 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2016 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2017 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2018 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2019 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2020 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2021 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2022 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2023 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2024 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2025 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2026 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2027 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2028 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2029 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2030 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2031 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2032 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2033 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2034 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2035 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2036 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2037 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2038 case SCREEN_BOOKS:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2039 pBooksWindow->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2040 //crt_deconstruct_ptr_6A0118();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2041 pBooksWindow = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2042 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2043 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2044 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2045 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2046 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2047 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2048 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2049 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2050 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2051 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2052 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2053 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2054 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2055 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2056 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2057 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2058 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2059 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2060 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2061 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2062 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2063 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2064 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2065 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2066 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2067 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2068 case SCREEN_SAVEGAME:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2069 case SCREEN_LOADGAME:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2070 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2071 //crt_deconstruct_ptr_6A0118();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2072 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2073 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2074 case SCREEN_CHEST_INVENTORY:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2075 pCurrentScreen = SCREEN_CHEST;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2076 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2077 case SCREEN_CHEST:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2078 pWindow2 = pChestWindow;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2079 pWindow2->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2080 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2081 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2082 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2083 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2084 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2085 case SCREEN_19:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2086 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2087 pWindow2 = ptr_507BC8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2088 pWindow2->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2089 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2090 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2091 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2092 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2093 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2094 case SCREEN_OPTIONS://Close
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2095 options_menu_skin.Relaease();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2096 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2097 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2098 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2099 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2100 WriteWindowsRegistryInt("WalkSound", bWalkSound);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2101 WriteWindowsRegistryInt("ShowDamage", bShowDamage);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2102 //WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2103 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2104 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2105 if ( !uTurnSpeed )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2106 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2107 WriteWindowsRegistryInt("TurnDelta", 3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2108 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2109 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2110 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2111 if ( uTurnSpeed == 64 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2112 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2113 WriteWindowsRegistryInt("TurnDelta", 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2114 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2115 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2116 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2117 if ( uTurnSpeed != 128 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2118 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2119 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2120 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2121 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2122 WriteWindowsRegistryInt("TurnDelta", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2123 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2124 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2125 case SCREEN_MENU:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2126 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2127 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2128 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2129 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2130 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2131 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2132 case SCREEN_VIDEO_OPTIONS:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2133 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2134 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2135 WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2136 WriteWindowsRegistryInt("Tinting", pRenderer->bTinting);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2137 WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2138 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2139 /*if ( !pRenderer->bWindowMode )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2140 WriteWindowsRegistryInt("GammaPos", uGammaPos);*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2141
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2142 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2143 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2144
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2145 case SCREEN_KEYBOARD_OPTIONS://Return to game
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2146 v197 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2147 pKeyBindingFlag = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2148 for ( uint i = 0; i < 28; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2149 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2150 if ( GameMenuUI_InvaligKeyBindingsFlags[i] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2151 pKeyBindingFlag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2152 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2153 if ( !pKeyBindingFlag )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2154 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2155 for ( uint i = 0; i < 5; i++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2156 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2157 if ( uTextureID_Optkb[i] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2158 pIcons_LOD->pTextures[uTextureID_Optkb[i]].Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2159 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2160 memset(&uTextureID_Optkb, 0, 20);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2161 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2162 for ( uint i = 0; i < 28; ++i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2163 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2164 if ( pKeyActionMap->GetActionVKey((enum InputAction)i) != pPrevVirtualCidesMapping[i] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2165 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2166 if ( v197 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2167 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2168 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2169 v197 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2170 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2171 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2172 GUI_ReplaceHotkey(pKeyActionMap->GetActionVKey((enum InputAction)i), LOBYTE(pPrevVirtualCidesMapping[i]), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2173 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2174 if ( i > 3 && i != 25 && i != 26 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2175 pKeyToggleType = TOGGLE_OneTimePress;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2176 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2177 pKeyToggleType = TOGGLE_Continuously;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2178 pKeyActionMap->SetKeyMapping(i, pPrevVirtualCidesMapping[i], pKeyToggleType);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2179 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2180 pKeyActionMap->StoreMappings();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2181 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2182 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2183 }
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
2184 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2185 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2186 case SCREEN_REST://close rest screen
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2187 if ( dword_506F14 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2188 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2189 Rest(_506F18_num_minutes_to_sleep);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2190 pParty->pPlayers[3].SetAsleep(false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2191 pParty->pPlayers[2].SetAsleep(false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2192 pParty->pPlayers[1].SetAsleep(false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2193 pParty->pPlayers[0].SetAsleep(false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2194 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2195 pTexture_RestUI_CurrentSkyFrame->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2196 pTexture_RestUI_CurrentHourglassFrame->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2197 pTexture_RestUI_CurrentHourglassFrame = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2198 pTexture_RestUI_CurrentSkyFrame = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2199 pIcons_LOD->SyncLoadedFilesCount();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2200 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2201 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2202 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2203 pOutdoor->UpdateSunlightVectors();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2204 pOutdoor->UpdateFog();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2205 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2206 _506F18_num_minutes_to_sleep = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2207 dword_506F14 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2208 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2209 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2210 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2211 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2212 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2213 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2214 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2215 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2216 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2217 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2218 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2219 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2220 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2221 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2222 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2223 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2224 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2225 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2226 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2227 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2228 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2229 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2230 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2231 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2232 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2233 case SCREEN_E:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2234 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2235 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2236 pCurrentScreen = SCREEN_HOUSE;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2237 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2238 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2239 case SCREEN_HOUSE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2240 if ( uDialogueType )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2241 uDialogueType = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2242 if ( uGameState == GAME_STATE_CHANGE_LOCATION )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2243 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2244 while ( HouseDialogPressCloseBtn() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2245 ;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2246 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2247 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2248 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2249 if ( HouseDialogPressCloseBtn() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2250 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2251 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2252 GetHouseGoodbyeSpeech();
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
2253 pAudioPlayer->PlaySound(SOUND_WoodDRClose, 814, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2254 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2255 pGUIWindow_CurrentMenu = window_SpeakInHouse;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2256 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2257 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2258 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2259 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2260 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2261 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2262 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2263 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2264 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2265 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2266 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2267 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2268 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2269 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2270 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2271 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2272 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2273 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2274 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2275 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2276 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2277 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2278 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2279 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2280 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2281 case SCREEN_INPUT_BLV://click escape
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2282 if ( uCurrentHouse_Animation == 153 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2283 PlayHouseSound(0x99u, HouseSound_Greeting_2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2284 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2285 if ( npcIdToDismissAfterDialogue )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2286 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2287 pParty->hirelingScrollPosition = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2288 LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2289 pParty->CountHirelings();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2290 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2291 npcIdToDismissAfterDialogue = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2292 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2293 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2294 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2295 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2296 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2297 case SCREEN_NPC_DIALOGUE://click escape
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2298 if ( npcIdToDismissAfterDialogue )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2299 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2300 pParty->hirelingScrollPosition = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2301 LOBYTE(pNPCStats->pNewNPCData[npcIdToDismissAfterDialogue].uFlags) &= 0x7Fu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2302 pParty->CountHirelings();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2303 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2304 npcIdToDismissAfterDialogue = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2305 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2306 //goto LABEL_317;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2307 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2308 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2309 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2310 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2311 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2312 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2313 sub_4452BB();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2314 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2315 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2316 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2317 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2318 case SCREEN_CHANGE_LOCATION://click escape
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2319 if ( pParty->vPosition.x < -22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2320 pParty->vPosition.x = -22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2321 if ( pParty->vPosition.x > 22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2322 pParty->vPosition.x = 22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2323 if ( pParty->vPosition.y < -22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2324 pParty->vPosition.y = -22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2325 if ( pParty->vPosition.y > 22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2326 pParty->vPosition.y = 22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2327 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2328 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2329 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2330 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2331 case SCREEN_VIDEO:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2332 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2333 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2334 case SCREEN_CHARACTERS:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2335 CharacterUI_ReleaseButtons();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2336 ReleaseAwardsScrollBar();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2337 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2338 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2339 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2340 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2341 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2342 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2343 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2344 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2345 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2346 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2347 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2348 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2349 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2350 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2351 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2352 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2353 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2354 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2355 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2356 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2357 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2358 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2359 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2360 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2361 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2362 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2363 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2364 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2365 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2366 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2367 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2368 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2369 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2370 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2371 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2372 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2373 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2374 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2375 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2376 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2377 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2378 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2379 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2380 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2381 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2382 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2383 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2384 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2385 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2386 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2387 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2388 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2389 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2390 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2391 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2392 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2393 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2394 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2395 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2396 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2397 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2398 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2399 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2400 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2401 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2402 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2403 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2404 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2405 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2406 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2407 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2408 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2409 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2410 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2411 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2412 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2413 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2414 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2415 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2416 CharacterUI_ReleaseButtons();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2417 ReleaseAwardsScrollBar();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2418 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2419 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2420 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2421 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2422 if ( pCurrentScreen == SCREEN_CHARACTERS )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2423 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2424 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2425 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2426 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2427 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2428 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2429 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2430 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2431 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2432 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2433 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2434 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2435 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2436 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2437 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2438 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2439 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2440 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2441 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2442 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2443 pIcons_LOD->RemoveTexturesFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2444 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2445 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2446 if ( !pGUIWindow_Settings )//Draw Menu
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2447 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2448 dword_6BE138 = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2449 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2450 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2451 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2452 pCurrentScreen = SCREEN_MENU;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2453
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2454 ++pIcons_LOD->uTexturePacksCount;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2455 if ( !pIcons_LOD->uNumPrevLoadedFiles )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2456 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2457
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2458 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_OptionsButtons, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2459 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2460 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2461 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2462 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2463 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2464 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2465 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2466 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2467 pGlobalTXT_LocalizationStrings[614],// "New Game"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2468 pIcons_LOD->GetTexture(uTextureID_New1), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2469 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2470 pGlobalTXT_LocalizationStrings[615],// "Save Game"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2471 pIcons_LOD->GetTexture(uTextureID_Save1), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2472 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2473 pGlobalTXT_LocalizationStrings[616],// "Load Game"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2474 pIcons_LOD->GetTexture(uTextureID_Load1), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2475 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2476 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:""
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2477 pIcons_LOD->GetTexture(uTextureID_Controls1), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2478 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2479 pGlobalTXT_LocalizationStrings[618],// "Quit"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2480 pIcons_LOD->GetTexture(uTextureID_Quit1), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2481 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2482 pGlobalTXT_LocalizationStrings[619],// "Return to Game"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2483 pIcons_LOD->GetTexture(uTextureID_Resume1), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2484 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2485 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2486
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2487 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2488 pRenderer->SaveScreenshot("gamma.pcx", 155, 117);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2489 stru_506E40.LoadPCXFile("gamma.pcx", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2490
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2491 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2492 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2493 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2494 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2495 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2496 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2497 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2498 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2499 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2500 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2501 ModalWindow_Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2502 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2503 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2504 if ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2505 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2506 GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2507 v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2508 if ( pParty->hirelingScrollPosition < v37 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2509 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2510 ++pParty->hirelingScrollPosition;//??? maybe number of the first cell???
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2511 if ( pParty->hirelingScrollPosition >= v37 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2512 pParty->hirelingScrollPosition = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2513 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2514 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2515 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2516 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2517 GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2518 /*if ( pParty->field_709 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2519 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2520 --pParty->field_709;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2521 if ( pParty->field_709 < 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2522 pParty->field_709 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2523 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2524 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2525 GameUI_DrawHiredNPCs();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2526 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2527 case UIMSG_TransitionUI_Confirm:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2528 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2529 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2530 dword_50CDC8 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2531 sub_42FBDD();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2532 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2533
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2534 if (pMovie_Track)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2535 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2536 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2537 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2538 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2539 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2540 if ( dword_59117C_teleportx )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2541 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2542 pParty->vPosition.x = dword_59117C_teleportx;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2543 _5B65A8_npcdata_uflags_or_other = dword_59117C_teleportx;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2544 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2545 if ( dword_591178_teleporty )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2546 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2547 pParty->vPosition.y = dword_591178_teleporty;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2548 _5B65AC_npcdata_fame_or_other = dword_591178_teleporty;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2549 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2550 if ( dword_591174_teleportz )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2551 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2552 pParty->vPosition.z = dword_591174_teleportz;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2553 _5B65B0_npcdata_rep_or_other = dword_591174_teleportz;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2554 pParty->uFallStartY = dword_591174_teleportz;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2555 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2556 if ( dword_591170_teleport_directiony )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2557 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2558 pParty->sRotationY = dword_591170_teleport_directiony;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2559 _5B65B4_npcdata_loword_house_or_other = dword_591170_teleport_directiony;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2560 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2561 if ( dword_59116C_teleport_directionx )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2562 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2563 pParty->sRotationX = dword_59116C_teleport_directionx;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2564 _5B65B8_npcdata_hiword_house_or_other = dword_59116C_teleport_directionx;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2565 v38 = dword_591168_teleport_speedz;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2566 pParty->uFallSpeed = dword_591168_teleport_speedz;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2567 dword_5B65BC = dword_591168_teleport_speedz;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2568 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2569 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2570 v38 = dword_5B65BC;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2571 if ( *dword_591164_teleport_map_name != 48 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2572 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2573 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2574 dword_5B65C0 = _5B65A8_npcdata_uflags_or_other | _5B65AC_npcdata_fame_or_other | _5B65B0_npcdata_rep_or_other | _5B65B4_npcdata_loword_house_or_other | _5B65B8_npcdata_hiword_house_or_other | v38;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2575 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2576 Transition_StopSound_Autosave(dword_591164_teleport_map_name, MapStartPoint_Party);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2577 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2578 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2579 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2580 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2581 if ( !_stricmp(byte_6BE3B0.data(), "d05.blv") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2582 pParty->uTimePlayed += 1474560i64;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2583 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2584 case UIMSG_TransitionWindowCloseBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2585 CloseWindowBackground();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2586 pMediaPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2587 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2588 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2589 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2590 case UIMSG_CycleCharacters:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2591 v39 = GetAsyncKeyState(VK_SHIFT);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2592 uActiveCharacter = CycleCharacter(v39);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2593 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2594 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2595 case UIMSG_OnTravelByFoot:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2596 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2597 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2598 dword_50CDC8 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2599 sub_42FBDD();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2600 //pNPCData4 = (NPCData *)GetTravelTime();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2601 strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2602 if ( bUnderwater != 1 && pParty->bFlying
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2603 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2604 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2605 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2606 CloseWindowBackground();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2607 if ( pParty->vPosition.x < -22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2608 pParty->vPosition.x = -22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2609 if ( pParty->vPosition.x > 22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2610 pParty->vPosition.x = 22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2611 if ( pParty->vPosition.y < -22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2612 pParty->vPosition.y = -22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2613 if ( pParty->vPosition.y > 22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2614 pParty->vPosition.y = 22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2615 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2616 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2617 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2618 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2619 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2620 pParty->field_6E4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2621 pParty->field_6E0 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2622 CastSpellInfoHelpers::_427D48();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2623 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2624 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2625 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2626 ++pGameLoadingUI_ProgressBar->uProgressMax;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2627 SaveGame(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2628 pGameLoadingUI_ProgressBar->Progress();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2629 RestAndHeal(1440 * (signed int)GetTravelTime());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2630 if ( pParty->uNumFoodRations )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2631 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2632 pParty->RestAndHeal();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2633 if ( ((pParty->uNumFoodRations - (signed int)GetTravelTime()) & 0x80000000u) != 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2634 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2635 pPlayer7 = pParty->pPlayers.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2636 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2637 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2638 pPlayer7->SetCondition(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2639 ++pPlayer7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2640 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2641 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings.data() );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2642 ++pParty->days_played_without_rest;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2643 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2644 Party::TakeFood((unsigned int)GetTravelTime());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2645 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2646 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2647 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2648 pPlayer8 = pParty->pPlayers.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2649 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2650 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2651 pPlayer8->SetCondition(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2652 ++pPlayer8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2653 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2654 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings.data() );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2655 ++pParty->days_played_without_rest;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2656 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2657 pPaletteManager->ResetNonLocked();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2658 pSpriteFrameTable->ResetSomeSpriteFlags();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2659 strcpy(pCurrentMapName, pOut);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2660 strcpy(pLevelName, pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2661 v41 = strtok(pLevelName, ".");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2662 strcpy(pLevelName, v41);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2663 Level_LoadEvtAndStr(pLevelName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2664 pDecalBuilder->Reset(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2665 LoadLevel_InitializeLevelEvt();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2666 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2667 bUnderwater = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2668 bNoNPCHiring = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2669 pGame->uFlags2 &= 0xFFFFFFF7u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2670 if ( Is_out15odm_underwater() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2671 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2672 bUnderwater = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2673 pGame->uFlags2 |= 8u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2674 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2675 if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2676 bNoNPCHiring = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2677 PrepareToLoadODM(1u, (ODMRenderParams *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2678 pAudioPlayer->SetMapEAX();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2679 bDialogueUI_InitializeActor_NPC_ID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2680 OnMapLoad();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2681 pOutdoor->SetFog();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2682 TeleportToStartingPoint(uLevel_StartingPointType);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2683 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2684 pParty->uFallStartY = pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2685 _461103_load_level_sub();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2686 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2687 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2688 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2689 pGameLoadingUI_ProgressBar->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2690 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2691 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2692 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2693 case UIMSG_CHANGE_LOCATION_ClickCencelBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2694 CloseWindowBackground();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2695 if ( pParty->vPosition.x < -22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2696 pParty->vPosition.x = -22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2697 if ( pParty->vPosition.x > 22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2698 pParty->vPosition.x = 22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2699 if ( pParty->vPosition.y < -22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2700 pParty->vPosition.y = -22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2701 if ( pParty->vPosition.y > 22528 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2702 pParty->vPosition.y = 22528;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2703 DialogueEnding();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2704 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2705 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2706 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2707 case UIMSG_CastSpell_Telekinesis:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2708 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2709 LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2710 /*else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2711 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2712 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2713 pPoint = pMouse->GetCursorPos(&v208);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2714 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2715 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2716 v44 = (unsigned __int16)v42;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2717 v45 = PID_TYPE(v44);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2718 uNumSeconds = v44;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2719 v46 = PID_ID(v44);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2720 if ( v45 == 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2721 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2722 v47 = pActors[v46].uAIState == Dead;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2723 if ( !v47 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2724 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2725 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2726 pSpellInfo->uFlags &= ~0x40u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2727 pSpellInfo->uPlayerID_2 = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2728 pSpellInfo->spell_target_pid = v44;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2729 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2730 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2731 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2732 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2733 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2734 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2735 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2736 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2737 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2738 if ( v45 == 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2739 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2740 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2741 if ( !v47 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2742 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2743 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2744 pSpellInfo->uFlags &= ~0x40u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2745 pSpellInfo->uPlayerID_2 = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2746 pSpellInfo->spell_target_pid = v44;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2747 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2748 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2749 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2750 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2751 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2752 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2753 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2754 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2755 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2756 if ( v45 == 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2757 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2758 v48 = pLevelDecorations[v46].uEventID == 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2759 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2760 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2761 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2762 if ( v45 != 6 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2763 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2764 if ( uCurrentlyLoadedLevelType != 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2765 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2766 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2767 if ( !pODMFace->Clickable() || !pODMFace->sCogTriggeredID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2768 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2769 v44 = uNumSeconds;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2770 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2771 pSpellInfo->uFlags &= ~0x40u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2772 pSpellInfo->uPlayerID_2 = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2773 pSpellInfo->spell_target_pid = v44;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2774 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2775 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2776 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2777 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2778 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2779 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2780 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2781 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2782 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2783 pBLVFace = &pIndoor->pFaces[v46];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2784 if ( !pBLVFace->Clickable() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2785 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2786 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2787 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2788 if ( v48 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2789 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2790 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2791 pSpellInfo->uFlags &= ~0x40u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2792 pSpellInfo->uPlayerID_2 = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2793 pSpellInfo->spell_target_pid = v44;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2794 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2795 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2796 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2797 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2798 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2799 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2800 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2801 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2802 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2803 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2804 case UIMSG_HiredNPC_CastSpell:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2805 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2806 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2807 if ( _50C9A0_IsEnchantingInProgress )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2808 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2809 uActiveCharacter = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2810 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2811 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2812 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2813 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2814 if ( pGUIWindow_Settings )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2815 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2816 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2817 switch ( uMessage )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2818 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2819 case UIMSG_CastSpell_Character_Big_Improvement:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2820 pSpellInfo->uFlags &= ~0x02u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2821 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2822 case UIMSG_CastSpell_Character_Small_Improvement:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2823 pSpellInfo->uFlags &= ~0x0100u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2824 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2825 case UIMSG_HiredNPC_CastSpell:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2826 pSpellInfo->uFlags &= ~0x0200u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2827 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2828 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2829 pSpellInfo->uPlayerID_2 = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2830 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2831 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2832 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2833 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2834 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2835 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2836 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2837 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2838 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2839 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2840 case UIMSG_BF:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2841 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2842 dword_50CDC8 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2843 sub_42FBDD();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2844 SaveGame(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2845 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2846 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2847 uGameState = GAME_STATE_CHANGE_LOCATION;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2848 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2849 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2850 if ( v53 < 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2851 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2852 v54 = abs(v53) - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2853 _5B65B8_npcdata_hiword_house_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2854 dword_5B65BC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2855 v55 = dword_4E4560[v54];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2856 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2857 v56 = dword_4E4590[v54];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2858 v57 = dword_4E45A8[v54];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2859 _5B65A8_npcdata_uflags_or_other = v55;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2860 _5B65B4_npcdata_loword_house_or_other = v57;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2861 _5B65B0_npcdata_rep_or_other = v56;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2862 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2863 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2864 HouseDialogPressCloseBtn();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2865 //goto LABEL_434;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2866 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2867 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2868 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2869 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2870 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2871 ++pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2872 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2873 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2874 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2875
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2876 case UIMSG_OnCastTownPortal:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2877 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2878 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, WINDOW_TownPortal, (char *)uMessageParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2879 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2880
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2881 case UIMSG_OnCastLloydsBeacon:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2882 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2883 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Book, WINDOW_LloydsBeacon, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2884 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2885
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2886 case UIMSG_LloydsBeacon_FlippingBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2887 bRecallingBeacon = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2888 v127 = uMessageParam + 204;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2889 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2890 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2891 case UIMSG_HintBeaconSlot:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2892 if ( !pGUIWindow_CurrentMenu )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2893 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2894 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2895 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2896 if ( bRecallingBeacon )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2897 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2898 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2899 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2900 v173 = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2901 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2902 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2903 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2904 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2905 pMapNum = pMapStats->GetMapInfo(pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2906 pMapName = "Not in Map Stats";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2907 if ( pMapNum )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2908 pMapName = pMapStats->pInfos[pMapNum].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2909 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) || !pMapNum )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2910 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2911 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], pMapName);// "Set to %s"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2912 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2913 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2914 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2915 v174 = pMapStats->pInfos[pMapStats->sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2916 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], (unsigned int)pMapName, v174);// "Set %s over %s"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2917 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2918 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2919 case UIMSG_CloseAfterInstallBeacon:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2920 dword_50CDC8 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2921 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2922 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2923 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2924 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2925 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2926 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2927 ++pMessageQueue_50CBD0->uNumMessages;*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2928 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2929 case UIMSG_InstallBeacon:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2930 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2931 if ( !pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime && bRecallingBeacon )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2932 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2933 byte_506360 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2934 pPlayer9->CanCastSpell(uRequiredMana);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2935 if ( pParty->bTurnBasedModeOn )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2936 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2937 v60 = sRecoveryTime;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2938 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2939 pPlayer9->SetRecoveryTime(v60);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2940 pTurnEngine->ApplyPlayerAction();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2941 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2942 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2943 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2944 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2945 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2946 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[lloyds_beacon_spell_id], 0, 0, -1, 0, lloyds_beacon_sound_id, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2947 if ( bRecallingBeacon )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2948 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2949 if ( _stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2950 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2951 SaveGame(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2952 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2953 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2954 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2955 uGameState = GAME_STATE_CHANGE_LOCATION;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2956 _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2957 _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2958 _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2959 _5B65B4_npcdata_loword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2960 _5B65B8_npcdata_hiword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2961 dword_5B65C0 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2962 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2963 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2964 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2965 pParty->vPosition.x = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2966 pParty->vPosition.y = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2967 pParty->vPosition.z = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2968 pParty->uFallStartY = pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2969 pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2970 pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2971 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2972 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2973 pBooksWindow->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2974 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2975 pBooksWindow = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2976 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2977 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2978 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2979 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2980 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2981 pRenderer->SaveScreenshot(a1, 92, 68);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2982 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2983 pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(lloyds_beacon_spell_level << 7) * 0.033333335);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2984 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2985 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y = pParty->vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2986 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z = pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2987 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X = LOWORD(pParty->sRotationY);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2988 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2989 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2990 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2991 for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2992 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2993 if ( !_stricmp(pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2994 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2995 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2996 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2997 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2998 case UIMSG_ClickTownInTP:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2999 if ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3000 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3001 switch ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3002 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3003 case 1:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3004 v63 = 208;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3005 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3006 case 2:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3007 v63 = 207;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3008 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3009 case 3:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3010 v63 = 211;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3011 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3012 case 4:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3013 v63 = 209;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3014 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3015 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3016 if ( uMessageParam != 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3017 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3018 LABEL_486:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3019 SaveGame(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3020 v64 = pMapStats->GetMapInfo(pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3021 v65 = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3022 if ( v64 == TownPortalList[uMessageParam].uMapInfoID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3023 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3024 pParty->vPosition.x = TownPortalList[v65].pos.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3025 pParty->vPosition.y = TownPortalList[v65].pos.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3026 pParty->vPosition.z = TownPortalList[v65].pos.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3027 pParty->uFallStartY = pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3028 pParty->sRotationY = TownPortalList[v65].rot_y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3029 pParty->sRotationX = TownPortalList[v65].rot_x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3030 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3031 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3032 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3033 SaveGame(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3034 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3035 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3036 uGameState = GAME_STATE_CHANGE_LOCATION;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3037 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3038 dword_5B65C0 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3039 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3040 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3041 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3042 v66 = TownPortalList[uMessageParam].rot_x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3043 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3044 _5B65B8_npcdata_hiword_house_or_other = v66;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3045 Actor::InitializeActors();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3046 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3047 v67 = (char*)pGUIWindow_CurrentMenu->Hint;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3048 if ( v67 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3049 *((int *)v67 + 17) = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3050 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3051 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3052 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3053 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3054 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3055 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3056 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3057 ++pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3058 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3059 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3060 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3061 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3062 v63 = 210;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3063 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3064 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3065 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3066 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3067 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3068 v63 = 206;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3069 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3070 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3071 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3072 goto LABEL_486;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3073 case UIMSG_HintTownPortal:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3074 if ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3075 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3076 switch ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3077 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3078 case 1:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3079 v68 = 208;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3080 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3081 case 2:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3082 v68 = 207;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3083 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3084 case 3:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3085 v68 = 211;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3086 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3087 case 4:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3088 v68 = 209;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3089 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3090 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3091 if ( uMessageParam != 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3092 //goto LABEL_506;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3093 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3094 if ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3095 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3096 switch ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3097 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3098 case 1:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3099 v69 = pMapStats->pInfos[4].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3100 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3101 case 2:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3102 v69 = pMapStats->pInfos[3].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3103 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3104 case 3:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3105 v69 = pMapStats->pInfos[10].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3106 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3107 case 4:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3108 v69 = pMapStats->pInfos[7].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3109 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3110 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3111 if ( uMessageParam != 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3112 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3113 __debugbreak(); // warning C4700: uninitialized local variable 'v200' used
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3114 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3115 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3116 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3117 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3118 v69 = pMapStats->pInfos[8].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3119 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3120 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3121 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3122 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3123 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3124 v69 = pMapStats->pInfos[21].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3125 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3126 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3127 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3128 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3129 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3130 v68 = 210;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3131 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3132 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3133 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3134 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3135 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3136 v68 = 206;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3137 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3138 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3139 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3140 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3141 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3142 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3143 //LABEL_506:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3144 if ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3145 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3146 switch ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3147 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3148 case 1:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3149 v69 = pMapStats->pInfos[4].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3150 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3151 case 2:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3152 v69 = pMapStats->pInfos[3].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3153 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3154 case 3:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3155 v69 = pMapStats->pInfos[10].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3156 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3157 case 4:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3158 v69 = pMapStats->pInfos[7].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3159 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3160 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3161 if ( uMessageParam != 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3162 //goto LABEL_519;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3163 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3164 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3165 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3166 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3167 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3168 v69 = pMapStats->pInfos[8].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3169 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3170 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3171 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3172 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3173 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3174 v69 = pMapStats->pInfos[21].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3175 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3176 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3177 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3178 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3179 case UIMSG_ShowFinalWindow:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3180 sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3181 pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment."
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3182 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team."
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3183 ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3184 uGameState = GAME_STATE_FINAL_WINDOW;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3185 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3186 case UIMSG_OnFinalWindowClose:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3187 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3188 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3189 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3190 __debugbreak(); // missed break/continue?
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3191 case UIMSG_DD:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3192 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3193 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3194 memcpy(&v216, txt_file_frametable_parser(pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3195 if ( v216.uPropCount == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3196 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3197 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3198 v70 = atoi(v216.pProperties[0]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3199 if ( v70 <= 0 || v70 >= 77 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3200 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3201 v71 = v70;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3202 strcpy(Str2, pMapStats->pInfos[v70].pFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3203 pNPCData3 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3204 if ( (signed int)pNPCData4 > 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3205 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3206 thish = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3207 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3208 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3209 if ( !_stricmp(pGames_LOD->pSubIndices[thish].pFilename, Str2) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3210 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3211 ++thish;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3212 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3213 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3214 while ( (signed int)pNPCData3 < (signed int)pNPCData4 );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3215 if ( (signed int)pNPCData3 < (signed int)pNPCData4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3216 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3217 strcpy(pCurrentMapName, pGames_LOD->pSubIndices[(int)pNPCData3].pFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3218 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3219 uGameState = GAME_STATE_CHANGE_LOCATION;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3220 OnMapLeave();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3221 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3222 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3223 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3224 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3225 v73 = Str2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3226 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3227 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3228 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3229 if ( v216.uPropCount != 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3230 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3231 v74 = atoi(v216.pProperties[0]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3232 thisi = atoi(v216.pProperties[1]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3233 v75 = atoi(v216.pProperties[2]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3234 v76 = v75;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3235 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3236 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3237 if ( pIndoor->GetSector(v74, thisi, v75) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3238 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3239 v77 = thisi;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3240 pParty->vPosition.x = v74;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3241 pParty->vPosition.y = v77;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3242 pParty->vPosition.z = v76;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3243 pParty->uFallStartY = v76;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3244 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3245 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3246 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3247 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3248 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3249 if ( v74 > -32768 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3250 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3251 if ( v74 < 32768 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3252 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3253 v77 = thisi;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3254 if ( thisi > -32768 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3255 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3256 if ( thisi < 32768 && v76 >= 0 && v76 < 10000 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3257 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3258 pParty->vPosition.x = v74;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3259 pParty->vPosition.y = v77;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3260 pParty->vPosition.z = v76;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3261 pParty->uFallStartY = v76;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3262 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3263 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3264 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3265 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3266 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3267 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3268 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3269 v73 = "Can't jump to that location!";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3270 }
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3271 ShowStatusBarString(v73, 6);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3272 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3273 case UIMSG_CastQuickSpell:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3274 if ( bUnderwater == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3275 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3276 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3277 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3278 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3279 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3280 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3281 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3282 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3283 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3284 case UIMSG_CastSpell_Monster_Improvement:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3285 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3286 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3287 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3288 v81 = pGame->pVisInstance->get_picked_object_zbuf_val();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3289 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3290 /*else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3291 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3292 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3293 pPoint2 = pMouse->GetCursorPos(&v201);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3294 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3295 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3296 v83 = v81;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3297 v44 = (unsigned __int16)v81;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3298 v84 = v83 >> 16;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3299 if ( PID_TYPE(v44) != 3 || v84 >= 5120 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3300 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3301 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3302 if ( uMessage == UIMSG_CastSpell_Shoot_Monster )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3303 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3304 pSpellInfo->uFlags &= ~0x08;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3305 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3306 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3307 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3308 if ( uMessage == UIMSG_CastSpell_Monster_Improvement )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3309 pSpellInfo->uFlags &= ~0x0100u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3310 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3311 pSpellInfo->uFlags &= ~0x0200u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3312 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3313 pSpellInfo->uPlayerID_2 = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3314 pSpellInfo->spell_target_pid = v44;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3315 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3316 pGUIWindow_Settings->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3317 pGUIWindow_Settings = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3318 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3319 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3320 _50C9A0_IsEnchantingInProgress = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3321 back_to_game();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3322 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3323 case UIMSG_1C:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3324 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3325 if ( !uActiveCharacter || pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3326 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3327 ptr_507BC8 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_68, uMessageParam, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3328 pCurrentScreen = SCREEN_19;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3329 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3330 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3331 case UIMSG_STEALFROMACTOR:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3332 if ( !uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3333 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3334 if ( pParty->bTurnBasedModeOn != 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3335 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3336 if ( pActors[uMessageParam].uAIState == 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3337 pActors[uMessageParam].LootActor();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3338 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3339 Actor::StealFrom(uMessageParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3340 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3341 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3342 if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3343 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3344 if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3345 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3346 if ( pActors[uMessageParam].uAIState == 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3347 pActors[uMessageParam].LootActor();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3348 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3349 Actor::StealFrom(uMessageParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3350 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3351 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3352
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3353 case UIMSG_Attack:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3354 if ( !uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3355 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3356 if ( pParty->bTurnBasedModeOn != 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3357 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3358 Player::_42ECB5_PlayerAttacksActor();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3359 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3360 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3361 if ( pTurnEngine->turn_stage == TE_WAIT || pTurnEngine->turn_stage == TE_MOVEMENT )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3362 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3363 if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3364 Player::_42ECB5_PlayerAttacksActor();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3365 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3366 case UIMSG_ExitRest:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3367 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3368 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3369 case UIMSG_Wait5Minutes:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3370 if ( dword_506F14 == 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3371 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3372 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3373 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3374 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3375 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3376 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3377 (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3378 dword_506F14 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3379 _506F18_num_minutes_to_sleep = 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3380 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3381 case UIMSG_Wait1Hour:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3382 if ( dword_506F14 == 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3383 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3384 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3385 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3386 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3387 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3388 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3389 (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3390 dword_506F14 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3391 _506F18_num_minutes_to_sleep = 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3392 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3393 case UIMSG_RentRoom:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3394 dword_506F14 = 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3395 RestUI_Load();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3396 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3397 _506F18_num_minutes_to_sleep = v86;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3398 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) // 107 = Emerald Isle tavern
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3399 _506F18_num_minutes_to_sleep = v86 + 12 * 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3400 dword_506F14 = 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3401 pParty->RestAndHeal();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3402 pParty->days_played_without_rest = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3403 pParty->pPlayers[3].SetAsleep(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3404 pParty->pPlayers[2].SetAsleep(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3405 pParty->pPlayers[1].SetAsleep(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3406 pParty->pPlayers[0].SetAsleep(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3407 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3408 case UIMSG_RestWindow:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3409 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3410 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3411 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3412 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3413 if ( CheckActors_proximity() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3414 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3415 if ( pParty->bTurnBasedModeOn == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3416 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3417 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3418 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3419 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3420 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3421 if ( pParty->uFlags & 0x88 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3422 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3423 ShowStatusBarString(v88, 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3424 if ( !uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3425 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3426 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3427 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3428 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3429 if ( pParty->bTurnBasedModeOn == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3430 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3431 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3432 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3433 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3434 if ( !(pParty->uFlags & 0x88) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3435 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3436 RestUI_Load();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3437 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3438 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3439 if ( pParty->bTurnBasedModeOn == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3440 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3441 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3442 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3443 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3444 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3445 if ( pParty->uFlags & 0x88 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3446 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3447 ShowStatusBarString(v88, 2u);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3448 if ( !uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3449 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3450 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3451 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3452 case UIMSG_Rest8Hour:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3453 if ( dword_506F14 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3454 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3455 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3456 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3457 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3458 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3459 if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3460 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3461 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3462 if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3463 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3464 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3465 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3466 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3467 pParty->pPlayers[3].pConditions[Condition_Sleep] = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3468 pParty->pPlayers[2].pConditions[Condition_Sleep] = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3469 pParty->pPlayers[1].pConditions[Condition_Sleep] = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3470 pParty->pPlayers[0].pConditions[Condition_Sleep] = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3471 v90 = pMapStats->GetMapInfo(pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3472 if ( !v90 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3473 v90 = rand() % (signed int)pMapStats->uNumMaps + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3474 pMapInfo = &pMapStats->pInfos[v90];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3475 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3476 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3477 v91 = rand() % 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3478 v92 = pMapInfo->EncM1percent;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3479 v93 = v91 + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3480 if ( v93 > v92 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3481 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3482 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3483 pNPCData4 = (NPCData *)1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3484 if ( !_45063B_spawn_some_monster(pMapInfo, (int)pNPCData4) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3485 pNPCData4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3486 if ( pNPCData4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3487 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3488 pPlayerNum = rand() % 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3489 pParty->pPlayers[pPlayerNum].pConditions[Condition_Sleep] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3490 v95 = rand();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3491 Rest(v95 % 6 + 60);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3492 _506F18_num_minutes_to_sleep = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3493 dword_506F14 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3494 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3495 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3496 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3497 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3498 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3499 ++pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3500 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3501 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3502 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3503 pAudioPlayer->PlaySound(SOUND_227, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3504 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3505 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3506 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3507 Party::TakeFood(uRestUI_FoodRequiredToRest);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3508 _506F18_num_minutes_to_sleep = 480;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3509 dword_506F14 = 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3510 pParty->RestAndHeal();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3511 pParty->days_played_without_rest = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3512 pParty->pPlayers[3].SetAsleep(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3513 pParty->pPlayers[2].SetAsleep(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3514 pParty->pPlayers[1].SetAsleep(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3515 pParty->pPlayers[0].SetAsleep(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3516 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3517 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3518 case UIMSG_AlreadyResting:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3519 if ( dword_506F14 == 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3520 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3521 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3522 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3523 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3524 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3525 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3526 (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3527 v97 = _494820_training_time(pParty->uCurrentHour);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3528 dword_506F14 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3529 _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3530 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3531 case UIMSG_HintSelectRemoveQuickSpellBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3532 if ( quick_spell_at_page && byte_506550 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3533 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3534 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3535 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3536 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3537 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3538 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3539 if ( pPlayers[uActiveCharacter]->uQuickSpell )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3540 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3541 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3542 v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3543 strcpy(pTmpBuf.data(), v177);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3544 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3545 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3546 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3547 case UIMSG_SPellbook_ShowHightlightedSpellInfo:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3548 if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter],
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3549 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3550 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3551 if ( sub_4637E0_is_there_popup_onscreen() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3552 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3553 v98 = *(char *)(uNumSeconds + 6734);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3554 if ( quick_spell_at_page - 1 == uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3555 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3556 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3557 v161 = pGlobalTXT_LocalizationStrings[485];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3558 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3559 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3560 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3561 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3562 v161 = pGlobalTXT_LocalizationStrings[486];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3563 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3564 sprintfex(pTmpBuf.data(), v161, v178);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3565 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3566 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3567 case UIMSG_ClickInstallRemoveQuickSpellBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3568 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3569 if ( !uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3570 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3571 pPlayer10 = pPlayers[uActiveCharacter];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3572 if ( !byte_506550 || !quick_spell_at_page )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3573 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3574 pPlayer10->uQuickSpell = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3575 quick_spell_at_page = 0;
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3576 pAudioPlayer->PlaySound(SOUND_203, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3577 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3578 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3579 pPlayers[uActiveCharacter]->uQuickSpell = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3580 AA1058_PartyQuickSpellSound[uActiveCharacter - 1].AddPartySpellSound(pPlayers[uActiveCharacter]->uQuickSpell, uActiveCharacter);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3581 if ( uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3582 pPlayer10->PlaySound(SPEECH_12, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3583 byte_506550 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3584 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3585 case UIMSG_SpellBook_PressTab://ïåðåëèñòûâàíèå ñòðàíèö êëàâèøåé Tab
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3586 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3587 if ( !uActiveCharacter )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3588 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3589 int skill_count = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3590 uAction = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3591 for ( uint i = 0; i < 9; i++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3592 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3593 if ( pPlayers[uActiveCharacter]->pActiveSkills[PLAYER_SKILL_FIRE + i] )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3594 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3595 if ( pPlayers[uActiveCharacter]->lastOpenedSpellbookPage == i )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3596 uAction = skill_count;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3597 v217[skill_count++] = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3598 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3599 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3600 if ( !skill_count )//íåò ñêèëëîâ
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3601 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_204), 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3602 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3603 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3604 if ( GetAsyncKeyState(VK_SHIFT) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3605 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3606 --uAction;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3607 if ( uAction < 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3608 uAction = skill_count - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3609 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3610 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3611 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3612 ++uAction;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3613 if ( uAction >= skill_count )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3614 uAction = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3615 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3616 OnCloseSpellBookPage();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3617 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3618 pGUIWindow_CurrentMenu->OpenSpellBook();
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3619 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_204), 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3620 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3621 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3622 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3623 case UIMSG_OpenSpellbookPage:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3624 if ( pTurnEngine->turn_stage == TE_MOVEMENT || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3625 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3626 OnCloseSpellBookPage();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3627 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3628 pGUIWindow_CurrentMenu->OpenSpellBook();
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3629 pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_204), 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3630 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3631 case UIMSG_SelectSpell:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3632 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3633 if (pTurnEngine->turn_stage == TE_MOVEMENT)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3634 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3635 if (!uActiveCharacter)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3636 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3637
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3638 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3639 Player* player = pPlayers[uActiveCharacter];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3640 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3641 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3642 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3643 if ( quick_spell_at_page - 1 == uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3644 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3645 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3646 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3647 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3648 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3649 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3650 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3651 /*if ( dword_50C9E8 < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3652 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3653 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3654 dword_50C9EC[3 * dword_50C9E8 + 1] = v103;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3655 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3656 ++dword_50C9E8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3657 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3658 pMessageQueue_50C9E8->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3659 // pMessageQueue_50CBD0->AddGUIMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3660 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3661 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3662 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3663 byte_506550 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3664 quick_spell_at_page = uMessageParam + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3665 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3666 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3667 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3668 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3669
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3670 case UIMSG_CastSpellFromBook:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3671 if ( pTurnEngine->turn_stage != TE_MOVEMENT )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3672 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3673 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3674
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3675 case UIMSG_SpellScrollUse:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3676 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3677 if ( pTurnEngine->turn_stage != TE_MOVEMENT )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3678 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3679 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3680 case UIMSG_SpellBookWindow:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3681 if ( pTurnEngine->turn_stage == TE_MOVEMENT )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3682 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3683 if ( bUnderwater == true )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3684 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3685 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3686 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3687 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3688 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3689 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3690 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3691 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3692 if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3693 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3694 if ( pCurrentScreen == SCREEN_GAME )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3695 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3696 GUIWindow::Create(476, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3697 pCurrentScreen = SCREEN_SPELL_BOOK;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3698 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3699 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_SpellBook, 0, 0);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3700 pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3701 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3702 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3703 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3704 if ( pCurrentScreen != SCREEN_REST && pCurrentScreen != SCREEN_CHARACTERS
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3705 && (pCurrentScreen <= SCREEN_63 || pCurrentScreen > SCREEN_67) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3706 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3707 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3708 GUIWindow::Create(476, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3709 pCurrentScreen = SCREEN_SPELL_BOOK;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3710 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3711 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_SpellBook, 0, 0);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
3712 pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3713 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3714 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3715 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3716 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3717 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3718 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3719 case UIMSG_QuickReference:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3720 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3721 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3722 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3723 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3724 ++pIcons_LOD->uTexturePacksCount;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3725 if ( !pIcons_LOD->uNumPrevLoadedFiles )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3726 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3727 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3728 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3729 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3730 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3731 pCurrentScreen = SCREEN_QUICK_REFERENCE;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3732 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_QuickReference, 5, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3733 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3734 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3735 pGlobalTXT_LocalizationStrings[79],// "Exit"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3736 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3737 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3738 case UIMSG_GameMenuButton:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3739 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3740 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3741 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3742 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3743 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3744 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3745 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3746
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3747 stru_506E40.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3748 pRenderer->SaveScreenshot("gamma.pcx", 155, 117);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3749 stru_506E40.LoadPCXFile("gamma.pcx", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3750
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3751 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3752 //LABEL_453:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3753 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3754 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3755 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3756 //goto LABEL_770;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3757 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3758 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3759 ++pMessageQueue_50CBD0->uNumMessages;*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3760 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3761 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3762 case UIMSG_ClickAwardScrollBar:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3763 books_page_number = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3764 if ( pMouse->GetCursorPos(&v211)->y > 178 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3765 books_page_number = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3766 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3767 case UIMSG_ClickAwardsUpBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3768 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3769 BtnUp_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3770 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3771 case UIMSG_ClickAwardsDownBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3772 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3773 BtnDown_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3774 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3775 case UIMSG_ChangeDetaliz:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3776 bRingsShownInCharScreen ^= 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3777 pCharacterScreen_DetalizBtn->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3778 pCharacterScreen_DollBtn->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3779 if ( bRingsShownInCharScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3780 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3781 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3782 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3783 v123 = 445;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3784 v121 = 470;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3785 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3786 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3787 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3788 v128 = 30;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3789 v125 = 30;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3790 v123 = 300;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3791 v121 = 600;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3792 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3793 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3794 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3795 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3796 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3797 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3798 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3799 case UIMSG_ClickPaperdoll:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3800 OnPaperdollLeftClick();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3801 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3802 case UIMSG_ClickStatsBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3803 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3804 CharacterUI_ReleaseButtons();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3805 ReleaseAwardsScrollBar();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3806 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3807 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3808 case UIMSG_ClickSkillsBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3809 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3810 CharacterUI_ReleaseButtons();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3811 ReleaseAwardsScrollBar();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3812 CharacterUI_SkillsTab_CreateButtons();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3813 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3814 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3815 case UIMSG_SkillUp:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3816 pPlayer4 = pPlayers[uActiveCharacter];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3817 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3818 LOWORD(v2) = *(short *)v105;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3819 uNumSeconds = v2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3820 if ( pPlayer4->uSkillPoints < (v2 & 0x3F) + 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3821 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3822 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3823 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3824 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3825 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3826 if ( (uNumSeconds & 0x3F) < 0x3C )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3827 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3828 *(short *)v105 = uNumSeconds + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3829 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3830 pPlayer4->PlaySound(SPEECH_14, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3831 pAudioPlayer->PlaySound((SoundID)20001, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3832 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3833 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3834 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3835 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3836 ShowStatusBarString(v87, 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3837 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3838 case UIMSG_ClickInventoryBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3839 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3840 ReleaseAwardsScrollBar();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3841 CharacterUI_ReleaseButtons();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3842 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3843 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3844 case UIMSG_ClickExitCharacterWindowBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3845 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3846 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3847 case UIMSG_ClickAwardsBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3848 ReleaseAwardsScrollBar();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3849 CharacterUI_ReleaseButtons();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3850 CreateAwardsScrollBar();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3851 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3852 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3853 FillAwardsData();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3854 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3855 case UIMSG_ClickBooksBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3856 switch ( uMessageParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3857 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3858 case 11://Page UP
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3859 BtnUp_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3860 pButton = pBtn_Book_2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3861 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3862 case 10://Page DOWN
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3863 BtnDown_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3864 pButton = pBtn_Book_1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3865 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3866 case 0://Zoom plus
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3867 pButton = pBtn_Book_1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3868 BtnDown_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3869 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3870 case 1://Zoom minus
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3871 pButton = pBtn_Book_2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3872 BtnUp_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3873 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3874 case 2://Potions
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3875 Book_PageBtn3_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3876 if ( dword_506364 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3877 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3878 pButton = pBtn_Book_3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3879 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3880 case 3://fountains
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3881 Book_PageBtn4_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3882 if ( dword_506364 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3883 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3884 pButton = pBtn_Book_4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3885 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3886 case 4://obelisks
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3887 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3888 if ( dword_506364 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3889 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3890 pButton = pBtn_Book_5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3891 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3892 case 5://seer
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3893 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3894 if ( dword_506364 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3895 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3896 pButton = pBtn_Book_6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3897 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3898 case 6://misc
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3899 pButton = pBtn_Autonotes_Misc;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3900 Autonotes_Misc_page_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3901 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3902 case 7://Instructors
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3903 pButton = pBtn_Autonotes_Instructors;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3904 Autonotes_Instructors_page_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3905 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3906 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3907 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3908 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3909 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3910 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3911 case UIMSG_SelectCharacter:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3912 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3913 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3914 GameUI_OnPlayerPortraitLeftClick(uMessageParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3915 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3916 case UIMSG_ShowStatus_Funds:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3917 v174 = (char *)pParty->uNumGoldInBank;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3918 //v158 = pParty->uNumGold + pParty->uNumGoldInBank;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3919 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], pParty->uNumGold + pParty->uNumGoldInBank, v174);// "You have %d total gold, %d in the Bank"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3920 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3921 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3922 case UIMSG_ShowStatus_DateTime:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3923 currHour = pParty->uCurrentHour;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3924 uNumSeconds = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3925 if (pParty->uCurrentHour > 12 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3926 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3927 if (pParty->uCurrentHour >= 24)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3928 uNumSeconds = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3929 currHour = (currHour - 12);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3930 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3931 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3932 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3933 if (pParty->uCurrentHour < 12) // 12:00 is PM
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3934 uNumSeconds = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3935 if (pParty->uCurrentHour == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3936 currHour = 12;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3937 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3938 sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", currHour, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7],
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3939 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3940 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3941 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3942 case UIMSG_ShowStatus_Food:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3943 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3944 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3945 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3946 case UIMSG_ShowStatus_Player:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3947 pPlayer5 = pPlayers[uMessageParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3948 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3949 strcat(pTmpBuf.data(), ": ");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3950 v107 = pPlayer5->GetMajorConditionIdx();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3951 strcat(pTmpBuf.data(), aCharacterConditionNames[v107]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3952 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3953 v108 = 8 * uMessageParam - 8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3954 LOBYTE(v108) = v108 | 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3955 pMouse->uPointingObjectID = PID(OBJECT_Player,v108);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3956 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3957 case UIMSG_ShowStatus_ManaHP:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3958 sprintf(pTmpBuf.data(), "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3959 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(),
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3960 pGlobalTXT_LocalizationStrings[212]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3961 GameUI_SetFooterString(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3962 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3963 case UIMSG_CHEST_ClickItem:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3964 if ( pCurrentScreen == SCREEN_CHEST_INVENTORY )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3965 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3966 pPlayers[uActiveCharacter]->OnInventoryLeftClick();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3967 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3968 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3969 Chest::OnChestLeftClick();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3970 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3971 case UIMSG_InventoryLeftClick:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3972 pPlayers[uActiveCharacter]->OnInventoryLeftClick();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3973 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3974 case UIMSG_MouseLeftClickInGame:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3975 /*if ( !pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3976 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3977 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3978 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3979 OnGameViewportClick();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3980 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3981 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3982 v115 = pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3983 if ( !pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3984 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3985 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3986 /*if ( (signed int)v115 < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3987 //goto LABEL_769;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3988 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3989 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3990 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3991 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3992 ++pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3993 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3994 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3995 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3996 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3997 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3998 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3999 pMessageQueue_50CBD0->uNumMessages = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4000 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4001 /*v115 = v0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4002 pMessageQueue_50CBD0->uNumMessages = v0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4003 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4004 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4005 //goto LABEL_771;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4006 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4007 ++pMessageQueue_50CBD0->uNumMessages;*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4008 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4009 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4010 v115 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4011 pMessageQueue_50CBD0->uNumMessages = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4012 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4013 /*if ( (signed int)v115 < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4014 //goto LABEL_769;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4015 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4016 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4017 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4018 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4019 ++pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4020 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4021 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4022 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4023 case UIMSG_MouseLeftClickInScreen://ñðàáàòûâàåò ïðè íàæàòèè íà ïðàâóþ êíîïêó ìûøè ïîñëå UIMSG_MouseLeftClickInGame
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4024 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4025 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4026 OnGameViewportClick();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4027 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4028 case UIMSG_F:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4029 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4030 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4031 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4032 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4033 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4034 /*else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4035 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4036 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4037 pPoint3 = pMouse->GetCursorPos(&v204);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4038 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4039 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4040 pButton2 = (GUIButton *)(unsigned __int16)v116;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4041 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4042 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4043 case UIMSG_54:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4044 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4045 pButton2 = (GUIButton *)uMessageParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4046 GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4047 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4048 case UIMSG_Game_Action:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4049 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4050 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4051 OnPressSpace();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4052 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4053 case UIMSG_ClickZoomOutBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4054 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4055 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4056 pParty->uFlags |= 2u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4057 GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4058 uNumSeconds = 131072;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4059 v118 = 2 * viewparams->uMinimapZoom;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4060 ++viewparams->field_28;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4061 viewparams->uMinimapZoom *= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4062 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4063 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4064 if ( (signed int)v118 > 4096 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4065 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4066 viewparams->uMinimapZoom = 4096;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4067 viewparams->field_28 = 12;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4068 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4069 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4070 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4071 v119 = 2048;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4072 if ( (signed int)v118 <= 2048 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4073 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4074 _576E2C_current_minimap_zoom = v118;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4075 dword_576E28 = viewparams->field_28;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4076 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4077 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4078 viewparams->field_28 = 11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4079 viewparams->uMinimapZoom = v119;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4080 _576E2C_current_minimap_zoom = v119;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4081 dword_576E28 = viewparams->field_28;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4082 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4083 case UIMSG_ClickZoomInBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4084 if ( pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4085 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4086 pParty->uFlags |= 2u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4087 GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4088 uNumSeconds = 32768;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4089 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4090 --viewparams->field_28;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4091 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4092 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4093 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4094 v119 = 512;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4095 if ( (signed int)v118 < 512 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4096 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4097 viewparams->field_28 = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4098 v118 = v119;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4099 viewparams->uMinimapZoom = v119;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4100 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4101 _576E2C_current_minimap_zoom = v118;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4102 dword_576E28 = viewparams->field_28;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4103 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4104 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4105 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4106 if ( (signed int)v118 < 256 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4107 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4108 viewparams->uMinimapZoom = 256;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4109 viewparams->field_28 = 8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4110 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4111 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4112 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4113 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4114 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4115 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4116 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4117 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4118 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4119 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4120 //dword_50C9E8 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4121
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4122
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4123 pMessageQueue_50C9E8->uNumMessages=0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4124 if ( dword_50C9DC )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4125 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4126 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4127 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4128 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4129 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4130 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4131 ++pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4132 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4133 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4134 dword_50C9DC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4135 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4136 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4137 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4138 if ( _50C9D0_AfterEnchClickEventId > 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4139 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4140 _50C9D8_AfterEnchClickEventTimeout -= pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4141 if ( _50C9D8_AfterEnchClickEventTimeout <= 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4142 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4143 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4144 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4145 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4146 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4147 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4148 ++pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4149 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4150 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)_50C9D0_AfterEnchClickEventId, _50C9D4_AfterEnchClickEventSecondParam, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4151 _50C9D0_AfterEnchClickEventId = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4152 _50C9D4_AfterEnchClickEventSecondParam = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4153 _50C9D8_AfterEnchClickEventTimeout = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4154 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4155 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4156 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4157 CastSpellInfoHelpers::_427E01_cast_spell();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4158 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4159 //----- (00435748) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4160 void GUI_MainMenuMessageProc()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4161 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4162 Player *pPlayer; // ebx@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4163 void *v3; // edi@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4164 signed int v4; // eax@29
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4165 // int v5; // ecx@29
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4166 // PLAYER_SKILL_TYPE v6; // edi@37
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4167 GUIWindow *pWindow; // eax@56
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4168 GUIButton *pButton; // eax@59
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4169 int v15; // edi@70
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4170 char v20; // dl@116
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4171 unsigned int v21; // eax@116
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4172 unsigned int v25; // eax@120
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4173 unsigned int v26; // ecx@127
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4174 // SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4175 // signed int v41; // [sp-10h] [bp-20h]@29
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4176 int pParam; // [sp+4h] [bp-Ch]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4177 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4178 int pSex; // [sp+Ch] [bp-4h]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4179
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4180 if ( pMessageQueue_50CBD0->uNumMessages )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4181 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4182 pPlayer = pParty->pPlayers.data();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4183 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4184 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4185 int param2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4186 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, &param2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4187 //auto player = &pParty->pPlayers[pParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4188
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4189 switch (pUIMessageType) // For buttons of window MainMenu
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4190 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4191 case UIMSG_MainMenu_ShowPartyCreationWnd:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4192 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4193 SetCurrentMenuID(MENU_NEWGAME);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4194 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4195 case UIMSG_MainMenu_ShowLoadWindow:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4196 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4197 SetCurrentMenuID(MENU_SAVELOAD);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4198 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4199 case UIMSG_ShowCredits:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4200 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4201 SetCurrentMenuID(MENU_CREDITS);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4202 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4203 case UIMSG_ExitToWindows:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4204 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4205 SetCurrentMenuID(MENU_EXIT_GAME);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4206 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4207 case UIMSG_PlayerCreation_SelectAttribute:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4208 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4209 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4210 uPlayerCreationUI_SelectedCharacter = pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4211 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4212 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4213 case UIMSG_PlayerCreation_VoicePrev:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4214 pSex = pParty->pPlayers[pParam].GetSexByVoice();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4215 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4216 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4217 if (pParty->pPlayers[pParam].uVoiceID == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4218 pParty->pPlayers[pParam].uVoiceID = 19;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4219 else --pParty->pPlayers[pParam].uVoiceID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4220 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4221 while (pParty->pPlayers[pParam].GetSexByVoice() != pSex);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4222 pButton = pCreationUI_BtnPressLeft2[pParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4223 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4224 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4225 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4226 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4227 case UIMSG_PlayerCreation_VoiceNext:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4228 pSex = pParty->pPlayers[pParam].GetSexByVoice();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4229 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4230 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4231 pParty->pPlayers[pParam].uVoiceID = (pParty->pPlayers[pParam].uVoiceID + 1) % 20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4232 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4233 while (pParty->pPlayers[pParam].GetSexByVoice() != pSex);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4234 pButton = pCreationUI_BtnPressRight2[pParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4235 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4236 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4237 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4238 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4239 case UIMSG_PlayerCreation_FacePrev:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4240 //pPlayer = &pParty->pPlayers[pParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4241 if (!pParty->pPlayers[pParam].uCurrentFace)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4242 pParty->pPlayers[pParam].uCurrentFace = 19;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4243 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4244 pParty->pPlayers[pParam].uCurrentFace -= 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4245 pParty->pPlayers[pParam].uVoiceID = pParty->pPlayers[pParam].uCurrentFace;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4246 pParty->pPlayers[pParam].SetInitialStats();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4247 pParty->pPlayers[pParam].SetSexByVoice();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4248 pParty->pPlayers[pParam].RandomizeName();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4249 v25 = pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4250 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4251 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4252 uPlayerCreationUI_SelectedCharacter = v25;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4253 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4254 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4255 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4256 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4257 case UIMSG_PlayerCreation_FaceNext:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4258 //pPlayer = &pParty->pPlayers[pParam];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4259 v20 = (char)((int)pParty->pPlayers[pParam].uCurrentFace + 1) % 20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4260 pParty->pPlayers[pParam].uCurrentFace = v20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4261 pParty->pPlayers[pParam].uVoiceID = v20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4262 pParty->pPlayers[pParam].SetInitialStats();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4263 pParty->pPlayers[pParam].SetSexByVoice();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4264 pParty->pPlayers[pParam].RandomizeName();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4265 v21 = pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4266 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4267 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4268 uPlayerCreationUI_SelectedCharacter = v21;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4269 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4270 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4271 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4272 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4273 case UIMSG_PlayerCreationClickPlus:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4274 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4275 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4276 pAudioPlayer->PlaySound(SOUND_20, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4277 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4278 case UIMSG_PlayerCreationClickMinus:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4279 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, (char *)1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4280 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7);
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4281 pAudioPlayer->PlaySound(SOUND_23, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4282 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4283 case UIMSG_PlayerCreationSelectActiveSkill:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4284 if ( pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4285 pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pParam + 4)] = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4286 pAudioPlayer->PlaySound(SOUND_24, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4287 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4288 case UIMSG_PlayerCreationSelectClass:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4289 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4290 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4291 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4292 case UIMSG_PlayerCreationClickOK:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4293 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4294 if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills() )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4295 GameUI_Footer_TimeLeft = GetTickCount() + 4000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4296 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4297 uGameState = GAME_STATE_STARTING_NEW_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4298 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4299 case UIMSG_PlayerCreationClickReset:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4300 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4301 pParty->Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4302 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4303 case UIMSG_PlayerCreationRemoveUpSkill:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4304 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4305 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4306 if ( pPlayer[pParam].GetSkillIdxByOrder(2) != 37 )//37 - None(Íåò)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4307 pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(2)] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4308 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4309 case UIMSG_PlayerCreationRemoveDownSkill:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4310 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4311 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4312 if ( pPlayer[pParam].GetSkillIdxByOrder(3) != 37 )//37 - None(Íåò)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4313 pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(3)] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4314 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4315 case UIMSG_PlayerCreationChangeName:
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4316 pAudioPlayer->PlaySound(SOUND_24, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4317 v3 = (void *)pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4318 uPlayerCreationUI_SelectedCharacter = pParam;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4319 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4320 pGUIWindow_CurrentMenu->ptr_1C = v3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4321 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4322 case UIMSG_ChangeGameState:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4323 uGameState = GAME_FINISHED;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4324 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4325 case UIMSG_ChangeCursor:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4326 pMouse->SetCursorBitmap("MICON2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4327 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4328 case UIMSG_3A:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4329 SetCurrentMenuID(MENU_DebugBLVLevel);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4330 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4331 case UIMSG_LoadGame:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4332 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4333 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4334 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4335 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4336 case UIMSG_SelectLoadSlot:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4337 //main menu save/load wnd clicking on savegame lines
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4338 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4339 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4340 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4341 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4342 //load clicked line
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4343 v26 = pParam + pSaveListPosition;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4344 if ( dword_6BE138 == pParam + pSaveListPosition )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4345 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4346 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4347 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4348 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4349 uLoadGameUI_SelectedSlot = v26;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4350 dword_6BE138 = v26;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4351 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4352 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4353 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4354 //typing in the line
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4355 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4356 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4357 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4358 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4359 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4360 case UIMSG_SaveLoadBtn:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4361 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4362 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4363 case UIMSG_DownArrow:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4364 ++pSaveListPosition;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4365 if ( pSaveListPosition >= pParam )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4366 pSaveListPosition = pParam - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4367 if ( pSaveListPosition < 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4368 pSaveListPosition = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4369 pWindow = pGUIWindow_CurrentMenu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4370 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4371 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4372 case UIMSG_Cancel:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4373 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4374 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4375 case UIMSG_ArrowUp:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4376 --pSaveListPosition;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4377 if ( pSaveListPosition < 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4378 pSaveListPosition = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4379 pWindow = pGUIWindow_CurrentMenu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4380 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4381 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4382 case UIMSG_AD:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4383 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4384 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4385 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4386 case UIMSG_AE:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4387 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4388 SetCurrentMenuID(MENU_DebugBLVLevel);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4389 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4390 case UIMSG_Escape:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4391 if ( pModalWindow )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4392 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4393 ModalWindow_Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4394 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4395 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4396 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_4000))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4397 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4398 v15 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4399 pMediaPlayer->bStopBeforeSchedule = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4400 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4401 viewparams->field_48 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4402 if ( GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_MMT_MAIN_MENU
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4403 || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4404 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4405 //if ( pCurrentScreen == SCREEN_VIDEO )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4406 //pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4407 if (GetCurrentMenuID() == MENU_NAMEPANELESC) //èç ïàíåëè èçìåíåíèÿ èìåíè
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4408 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4409 SetCurrentMenuID(MENU_CREATEPARTY);//â îêíî ñîçäàíèÿ ãðóïïû
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4410 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4411 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4412 if (GetCurrentMenuID() == MENU_CREDITSPROC) //èç îêíà Ñîçäàòåëè
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4413 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4414 SetCurrentMenuID(MENU_CREDITSCLOSE);//â çàêðûòèå Ñîçäàòåëè
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4415 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4416 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4417 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4418 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4419 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4420 if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4421 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4422 //if ( pCurrentScreen == SCREEN_VIDEO )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4423 //pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4424 if (GetCurrentMenuID() == MENU_NAMEPANELESC)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4425 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4426 SetCurrentMenuID(MENU_CREATEPARTY);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4427 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4428 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4429 if (GetCurrentMenuID() == MENU_CREDITSPROC)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4430 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4431 SetCurrentMenuID(MENU_CREDITSCLOSE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4432 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4433 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4434 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4435 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4436 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4437 if ( pCurrentScreen == SCREEN_LOADGAME )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4438 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4439 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4440 //crt_deconstruct_ptr_6A0118();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4441 pTexture_PCX.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4442 pTexture_PCX.Load("title.pcx", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4443 SetCurrentMenuID(MENU_MAIN);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4444 v15 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4445 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4446 pGUIWindow2->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4447 pGUIWindow2 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4448 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4449 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4450 viewparams->bRedrawGameUI = v15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4451 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4452 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4453 if ( pCurrentScreen == SCREEN_VIDEO )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4454 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4455 //pVideoPlayer->Unload();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4456 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4457 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4458 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4459 if ( pCurrentScreen != SCREEN_1B )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4460 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4461 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4462 pGUIWindow2->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4463 pGUIWindow2 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4464 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4465 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4466 viewparams->bRedrawGameUI = v15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4467 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4468 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4469 //VideoPlayer::dtor();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4470 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4471 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4472 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4473 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4474 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4475 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4476 while ( pMessageQueue_50CBD0->uNumMessages );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4477 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4478 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4479
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4480
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4481
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4482 //----- (0042FBDD) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4483 void sub_42FBDD()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4484 {
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4485 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4486 pRenderer->DrawTextureTransparent(pBtn_YES->uX, pBtn_YES->uY, pBtn_YES->pTextures[0]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4487 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4488 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4489
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4490 //----- (0042FC15) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4491 void CloseWindowBackground()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4492 {
2506
9b96a51011fb for sound
Ritor1
parents: 2502
diff changeset
4493 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, -2, 0, -1, 0, 0, 0, 0);
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4494 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pBtn_ExitCancel->pTextures[0]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4495 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4496 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4497
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4498
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4499 //----- (0046BDC0) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4500 void UpdateUserInput_and_MapSpecificStuff()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4501 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4502 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4503 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4504 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4505 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4506 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4507
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4508 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4509 BLV_UpdateUserInputAndOther();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4510 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4511 ODM_UpdateUserInputAndOther();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4512
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4513 area_of_effect__damage_evaluate();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4514 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4515
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4516 //----- (004646F0) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4517 void PrepareWorld(unsigned int _0_box_loading_1_fullscreen)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4518 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4519 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4520 pGame->pVisInstance->_4C1A02();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4521 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4522 pMiscTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4523 pParty->uFlags = 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4524 CastSpellInfoHelpers::_427D48();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4525 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4526 DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4527 pMiscTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4528 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4529 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4530
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4531 //----- (00464866) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4532 void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4533 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4534 char *v3; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4535 unsigned int v5; // eax@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4536 char Str1[20]; // [sp+Ch] [bp-18h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4537 unsigned int v9; // [sp+20h] [bp-4h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4538
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4539 v9 = bLoading;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4540 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4541 pDecalBuilder->Reset(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4542 pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen :
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4543 GUIProgressBar::TYPE_Box);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4544 strcpy(Str1, pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4545 v3 = strtok(Str1, ".");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4546 strcpy(Str1, v3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4547 Level_LoadEvtAndStr(Str1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4548 LoadLevel_InitializeLevelEvt();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4549 strcpy(Str1, pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4550 _strrev(Str1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4551 strtok(Str1, ".");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4552 _strrev(Str1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4553
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4554 for (uint i = 0; i < 1000; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4555 pSpriteObjects[i].uObjectDescID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4556
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4557 v5 = pMapStats->GetMapInfo(pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4558 bUnderwater = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4559 uLevelMapStatsID = v5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4560 pGame->uFlags2 &= 0xFFFFFFF7u;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4561 if (!_stricmp(pCurrentMapName, "out15.odm"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4562 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4563 bUnderwater = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4564 pGame->uFlags2 |= GAME_FLAGS_2_ALTER_GRAVITY;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4565 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4566 pParty->floor_face_pid = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4567 if (_stricmp(Str1, "blv"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4568 PrepareToLoadODM(v9, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4569 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4570 PrepareToLoadBLV(v9);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4571 pAudioPlayer->SetMapEAX();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4572 _461103_load_level_sub();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4573 if (!_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4574 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4575 //spawning grounds & walls of mist - no loot & exp from monsters
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4576
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4577 for (uint i = 0; i < uNumActors; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4578 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4579 pActors[i].pMonsterInfo.uTreasureType = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4580 pActors[i].pMonsterInfo.uTreasureDiceRolls = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4581 pActors[i].pMonsterInfo.uExp = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4582 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4583 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4584 bDialogueUI_InitializeActor_NPC_ID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4585 OnMapLoad();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4586 pGameLoadingUI_ProgressBar->Progress();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4587 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4588 pGameLoadingUI_ProgressBar->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4589 _flushall();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4590 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4591
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4592 void IntegrityTest()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4593 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4594 static_assert(sizeof(MovieHeader) == 44, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4595 static_assert(sizeof(SoundDesc_mm6) == 112, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4596 static_assert(sizeof(SoundDesc) == 120, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4597 static_assert(sizeof(OverlayDesc) == 8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4598 static_assert(sizeof(ChestDesc) == 36, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4599 static_assert(sizeof(ObjectDesc_mm6) == 52, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4600 static_assert(sizeof(ObjectDesc) == 56, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4601 static_assert(sizeof(DecorationDesc) == 84, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4602 static_assert(sizeof(IconFrame) == 32, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4603 static_assert(sizeof(PlayerFrame) == 10, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4604 static_assert(sizeof(TextureFrame) == 20, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4605 static_assert(sizeof(SpriteFrame) == 60, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4606 static_assert(sizeof(RenderVertexSoft) == 0x30, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4607 static_assert(sizeof(RenderBillboard) == 0x34, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4608 static_assert(sizeof(Texture) == 0x48, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4609 static_assert(sizeof(RGBTexture) == 0x28, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4610 //static_assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4, "Wrong type size"); // + virtual dtor ptr
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4611 static_assert(sizeof(AudioPlayer) == 0xC84, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4612 static_assert(sizeof(SoundDesc) == 0x78, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4613 static_assert(sizeof(stru339_spell_sound) == 0xAFD8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4614 //static_assert(sizeof(VideoPlayer) == 0x108 + 4, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4615 static_assert(sizeof(MovieHeader) == 0x2C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4616 static_assert(sizeof(DecorationDesc) == 0x54, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4617 static_assert(sizeof(ObjectDesc) == 0x38, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4618 static_assert(sizeof(OverlayDesc) == 0x8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4619 static_assert(sizeof(ChestDesc) == 0x24, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4620 static_assert(sizeof(TileDesc) == 0x1A, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4621 static_assert(sizeof(MonsterDesc_mm6) == 148, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4622 static_assert(sizeof(MonsterDesc) == 152, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4623 static_assert(sizeof(Timer) == 0x28, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4624 static_assert(sizeof(OtherOverlay) == 0x14, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4625 static_assert(sizeof(ItemGen) == 0x24, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4626 static_assert(sizeof(SpriteObject) == 0x70, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4627 static_assert(sizeof(ItemDesc) == 0x30, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4628 static_assert(sizeof(ItemsTable) == 0x117A0, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4629 static_assert(sizeof(Chest) == 0x14CC, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4630 static_assert(sizeof(MapInfo) == 0x44, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4631 static_assert(sizeof(SpellInfo) == 0x24, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4632 static_assert(sizeof(SpellData) == 0x14, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4633 static_assert(sizeof(SpellBuff) == 0x10, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4634 static_assert(sizeof(AIDirection) == 0x1C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4635 static_assert(sizeof(ActorJob) == 0xC, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4636 static_assert(sizeof(Actor) == 0x344, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4637 static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4638 static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4639 static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4640 static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4641 static_assert(sizeof(ODMFace) == 0x134, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4642 static_assert(sizeof(BSPNode) == 0x8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4643 static_assert(sizeof(BSPModel) == 0xBC, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4644 static_assert(sizeof(OutdoorLocation) == 0x1C28C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4645 static_assert(sizeof(BLVFace) == 0x60, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4646 static_assert(sizeof(BLVFaceExtra) == 0x24, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4647 static_assert(sizeof(BLVSector) == 0x74, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4648 static_assert(sizeof(BLVLightMM7) == 0x10, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4649 static_assert(sizeof(BLVDoor) == 0x50, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4650 static_assert(sizeof(IndoorLocation) == 0x690, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4651 //static_assert(sizeof(ODMRenderParams) == 0x74, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4652 static_assert(sizeof(Mouse) == 0x114, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4653 static_assert(sizeof(Particle_sw) == 0x68, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4654 static_assert(sizeof(Particle) == 0x68, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4655 static_assert(sizeof(ParticleEngine) == 0xE430, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4656 static_assert(sizeof(Lightmap) == 0xC1C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4657 static_assert(sizeof(LightmapBuilder) == 0x3CBC38, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4658 static_assert(sizeof(Vis_SelectionList) == 0x2008, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4659 static_assert(sizeof(Vis) == 0x20D0, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4660 static_assert(sizeof(PlayerBuffAnim) == 0x10, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4661 static_assert(sizeof(ProjectileAnim) == 0x1C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4662 static_assert(sizeof(stru6) == 0x5F8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4663 static_assert(sizeof(IndoorCameraD3D_Vec3) == 0x10, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4664 static_assert(sizeof(IndoorCameraD3D_Vec4) == 0x18, "Wrong type size"); //should be 14 (10 vec3 + 4 vdtor) but 18 coz of his +4 from own vdtor, but it is odd since vdtor already present from vec3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4665 //static_assert(sizeof(IndoorCameraD3D) == 0x1A1384, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4666 static_assert(sizeof(StationaryLight) == 0xC, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4667 static_assert(sizeof(LightsStack_StationaryLight_) == 0x12C8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4668 static_assert(sizeof(MobileLight) == 0x12, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4669 static_assert(sizeof(LightsStack_MobileLight_) == 0x1C28, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4670 static_assert(sizeof(Game) == 0xE78, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4671 static_assert(sizeof(stru141_actor_collision_object) == 0xA8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4672 static_assert(sizeof(ActionQueue) == 0x7C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4673 static_assert(sizeof(NPCData) == 0x4C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4674 static_assert(sizeof(NPCStats) == 0x17FFC, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4675 static_assert(sizeof(BspRenderer) == 0x53740, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4676 static_assert(sizeof(PaletteManager) == 0x267AF0, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4677 static_assert(sizeof(ViewingParams) == 0x26C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4678 //static_assert(sizeof(IndoorCamera) == 0x50, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4679 static_assert(sizeof(Bloodsplat) == 0x28, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4680 static_assert(sizeof(BloodsplatContainer) == 0xA0C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4681 static_assert(sizeof(TrailParticle) == 0x18, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4682 static_assert(sizeof(EventIndex) == 0xC, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4683 static_assert(sizeof(_2devent) == 0x34, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4684 static_assert(sizeof(MapsLongTimer) == 0x20, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4685 static_assert(sizeof(SavegameHeader) == 0x64, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4686 static_assert(sizeof(SavegameList) == 0x3138, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4687 static_assert(sizeof(StorylineText) == 0x160, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4688 static_assert(sizeof(FactionTable) == 0x1EF1, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4689 static_assert(sizeof(Decal) == 0xC20, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4690 static_assert(sizeof(DecalBuilder) == 0x30C038, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4691 static_assert(sizeof(MonsterInfo) == 0x58, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4692 static_assert(sizeof(MonsterStats) == 0x5BA0, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4693 static_assert(sizeof(RenderD3D) == 0x148, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4694 // static_assert(sizeof(Render) == 0x129844, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4695 static_assert(sizeof(Player) == 0x1B3C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4696 static_assert(sizeof(PartyTimeStruct) == 0x678, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4697 static_assert(sizeof(Party) == 0x16238, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4698 static_assert(sizeof(GUIButton) == 0xBC, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4699 static_assert(sizeof(GUIWindow) == 0x54, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4700 static_assert(sizeof(GUIProgressBar) == 0x1B8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4701 static_assert(sizeof(GUIFont) == 0x1020, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4702 // static_assert(sizeof(stru262_TurnBased) == 0x40, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4703 static_assert(sizeof(ArcomageGame) == 0xFB, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4704 static_assert(sizeof(CastSpellInfo) == 0x14, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4705 static_assert(sizeof(ArcomageCard) == 0x6C, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4706 static_assert(sizeof(stru320) == 0x3FC, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4707 static_assert(sizeof(TravelInfo) == 0x20, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4708 static_assert(sizeof(stru336) == 0x798, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4709 static_assert(sizeof(Vec3_short_) == 6, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4710 static_assert(sizeof(BLVFace) == 96, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4711 static_assert(sizeof(BLVFaceExtra) == 36, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4712 static_assert(sizeof(BLVSector) == 116, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4713 static_assert(sizeof(LevelDecoration) == 32, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4714 static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4715 static_assert(sizeof(BSPNode) == 8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4716 static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4717 static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4718 static_assert(sizeof(Actor) == 836, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4719 static_assert(sizeof(SpriteObject) == 112, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4720 static_assert(sizeof(Chest) == 5324, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4721 static_assert(sizeof(stru123) == 0xC8, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4722 static_assert(sizeof(BLVMapOutline) == 12, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4723 static_assert(sizeof(LODSprite) == 0x28, "Wrong type size");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4724 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4725
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4726
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4727 //----- (00464761) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4728 void Game_DeinitializeAndTerminate(int exitCode)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4729 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4730 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4731 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4732 pGame->Deinitialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4733 pRenderer->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4734 delete window;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4735 //if ( !DestroyWindow(hWnd) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4736 // GetLastError();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4737 exit(exitCode);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4738 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4739
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4740 //----- (004647AB) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4741 void FinalInitialization()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4742 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4743 pViewport->SetScreen(viewparams->uSomeX, viewparams->uSomeY, viewparams->uSomeZ, viewparams->uSomeW);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4744 pViewport->SetFOV(flt_6BE3A0 * 65536.0f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4745
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4746 //pIndoorCamera = new IndoorCamera;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4747 //pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4748 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4749
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4750 InitializeTurnBasedAnimations(&stru_50C198);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4751 pBitmaps_LOD->_inlined_sub1();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4752 pSprites_LOD->_inlined_sub1();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4753 pIcons_LOD->_inlined_sub1();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4754 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4755 // 6BE3A0: using guessed type float flt_6BE3A0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4756
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4757
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4758
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4759 //----- (00464E17) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4760 bool __fastcall CheckMM7CD(char c)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4761 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4762 char DstBuf[256] = { 0 };
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4763 char strCommand[256] = { 0 }; // [sp+10Ch] [bp-118h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4764 char Filename[20] = { 0 }; // [sp+20Ch] [bp-18h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4765
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4766 wchar_t pMagicPath[1024];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4767 swprintf(pMagicPath, wcslen(L"%C:\\anims\\magic7.vid"), L"%C:\\anims\\magic7.vid", c);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4768 if (GetFileAttributesW(pMagicPath) == -1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4769 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4770
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4771 //Open CD audio
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4772 wsprintfA(strCommand, "open %c: type cdaudio alias CD", c);
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4773 if (!mciSendStringA(strCommand, DstBuf, 255, 0))
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4774 {
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4775 wsprintfA(strCommand, "info CD UPC wait");
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4776 mciSendStringA(strCommand, DstBuf, 255, 0);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4777 wsprintfA(strCommand, "close CD");
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4778 mciSendStringA(strCommand, DstBuf, 255, 0);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4779 }
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4780
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4781 memcpy(Filename, "X:\\anims\\magic7.vid", sizeof(Filename));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4782 *Filename = c;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4783
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4784 FILE* f = fopen(Filename, "rb");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4785 if (!f)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4786 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4787
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4788 if (!fseek(f, 0, SEEK_END))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4789 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4790 if (!fseek(f, -100, SEEK_CUR))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4791 fread(DstBuf, 1, 0x64u, f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4792
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4793 fclose(f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4794 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4795 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4796 fclose(f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4797 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4798 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4799
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4800 //----- (00464F1B) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4801 signed int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4802 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4803 char v4; // zf@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4804 int v6; // eax@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4805 int v7; // eax@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4806 int v8; // eax@12
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4807 int v9; // eax@13
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4808 BOOL(__stdcall *v10)(HWND, int, LPCSTR); // edi@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4809 const CHAR *v11; // [sp-Ch] [bp-Ch]@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4810 INT_PTR v12; // [sp-4h] [bp-4h]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4811
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4812 if (a2 == 272)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4813 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4814 hInsertCDWindow = hDlg;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4815 v6 = (GetUserDefaultLangID() & 0x3FF) - 7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4816 if (v6)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4817 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4818 v7 = v6 - 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4819 if (v7)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4820 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4821 v8 = v7 - 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4822 if (v8)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4823 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4824 v9 = v8 - 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4825 if (v9)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4826 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4827 if (v9 != 5)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4828 return 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4829 SetWindowTextA(hDlg, "Wloz CD-ROM numer 2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4830 v10 = SetDlgItemTextA;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4831 SetDlgItemTextA(hDlg, 1010, "Wloz CD-ROM numer 2 Might and Magic® VII.");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4832 v11 = "Odwolaj";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4833 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4834 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4835 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4836 SetWindowTextA(hDlg, "Inserire il secondo CD");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4837 v10 = SetDlgItemTextA;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4838 SetDlgItemTextA(hDlg, 1010, "Inserire il secondo CD di Might and Magic® VII.");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4839 v11 = "Annulla";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4840 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4841 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4842 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4843 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4844 SetWindowTextA(hDlg, "Insérez le CD 2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4845 v10 = SetDlgItemTextA;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4846 SetDlgItemTextA(hDlg, 1010, "Insérez Might & Magic® VII CD 2.");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4847 v11 = "Supprimer";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4848 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4849 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4850 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4851 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4852 SetWindowTextA(hDlg, "Por favor, inserte disco 2");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4853 v10 = SetDlgItemTextA;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4854 SetDlgItemTextA(hDlg, 1010, "Por favor, inserte disco 2 de Might & Magic® VII.");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4855 v11 = "Cancelar";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4856 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4857 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4858 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4859 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4860 SetWindowTextA(hDlg, "Bitte CD 2 einlegen");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4861 v10 = SetDlgItemTextA;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4862 SetDlgItemTextA(hDlg, 1010, "Bitte CD 2 von Might and Magic® VII einlegen.");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4863 v11 = "Abbrechen";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4864 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4865 v10(hDlg, 2, v11);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4866 return 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4867 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4868 if (a2 == 273)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4869 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4870 if (a3 == 2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4871 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4872 v12 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4873 EndDialog(hDlg, v12);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4874 return 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4875 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4876 v4 = a3 == 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4877 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4878 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4879 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4880 v4 = a2 == 1025;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4881 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4882 if (v4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4883 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4884 v12 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4885 EndDialog(hDlg, v12);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4886 return 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4887 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4888 return 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4889 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4890
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4891 //----- (00465061) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4892 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4893 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4894 char drive[4] = { 'X', ':', '\\', 0 };
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4895
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4896 bool bGotCDFromRegistry = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4897
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4898 HKEY hSoftware = nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4899 hNWC = nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4900 hMM7 = nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4901 hVersion = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4902 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hSoftware))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4903 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4904 if (!RegOpenKeyExA(hSoftware, "New World Computing", 0, KEY_READ|KEY_WOW64_32KEY, &hNWC))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4905 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4906 if (!RegOpenKeyExA(hNWC, "Might and Magic VII", 0, KEY_READ|KEY_WOW64_32KEY, &hMM7))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4907 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4908 if (!RegOpenKeyExA(hMM7, "1.0", 0, KEY_READ|KEY_WOW64_32KEY, &hVersion))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4909 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4910 DWORD cbData = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4911 if (!RegQueryValueExA(hVersion, "CDDrive", 0, 0, (BYTE *)drive, &cbData))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4912 bGotCDFromRegistry = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4913 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4914 RegCloseKey(hVersion);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4915 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4916 RegCloseKey(hMM7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4917 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4918 RegCloseKey(hNWC);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4919 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4920 RegCloseKey(hSoftware);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4921
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4922 if (bGotCDFromRegistry)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4923 if (CheckMM7CD(*drive))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4924 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4925 cMM7GameCDDriveLetter = *drive;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4926 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4927 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4928
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4929 while (true)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4930 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4931 for (uint i = 0; i < 26; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4932 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4933 drive[0] = 'A' + i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4934
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4935 if (GetDriveTypeA(drive) == DRIVE_CDROM)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4936 if (CheckMM7CD(*drive))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4937 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4938 cMM7GameCDDriveLetter = *drive;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4939 WriteWindowsRegistryString("CDDrive", drive);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4940 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4941 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4942 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4943
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4944 if (DialogBoxParamA(GetModuleHandleW(nullptr), "InsertCD", hWnd, (DLGPROC)InsertMM7CDDialogFunc, 0))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4945 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4946 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4947 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4948 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4949
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4950 //----- (004651F4) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4951 bool MM7_Initialize(int game_width, int game_height)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4952 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4953 wchar_t pCurrentDir[1024];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4954 _wgetcwd(pCurrentDir, 1024);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4955
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4956 wchar_t pMM6IniFile[1024];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4957 wsprintfW(pMM6IniFile, L"%s\\mm6.ini", pCurrentDir);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4958
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4959 bCanLoadFromCD = GetPrivateProfileIntW(L"settings", L"use_cd", 1, pMM6IniFile);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4960 if (bNoCD)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4961 bCanLoadFromCD = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4962 if (bCanLoadFromCD)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4963 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4964 Log::Warning(L"Checking for CD...");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4965 if (!FindMM7CD(nullptr, &cMM7GameCDDriveLetter))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4966 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4967 Log::Warning(L"...done.");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4968 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4969
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4970
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4971 srand(GetTickCount());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4972
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4973 pEventTimer = Timer::Create();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4974 pEventTimer->Initialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4975 window = OSWindow::Create(L"Might and Magic® Trilogy", game_width, game_height);//Create game window
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4976
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4977 bool use_d3d11 = false;
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4978 if (use_d3d11)
2511
fb1c61a82a55 uHouseID - 1
Ritor1
parents: 2508
diff changeset
4979 pRenderer = RenderD3D11::Create();
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
4980 else
2511
fb1c61a82a55 uHouseID - 1
Ritor1
parents: 2508
diff changeset
4981 pRenderer = Render::Create();//Create DirectX
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4982 if (!pRenderer)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4983 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4984 Log::Warning(L"Render creation failed");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4985 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4986 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4987 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4988 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4989 //bool bWindowMode = ReadWindowsRegistryInt("startinwindow", false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4990 //uint uDefaultDevice = ReadWindowsRegistryInt("D3D Device", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4991
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4992 if (!pRenderer->Initialize(window/*, bColoredLights, uLevelOfDetail, bTinting*/))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4993 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4994 Log::Warning(L"Render failed to initialize");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4995 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4996 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4997 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4998
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4999 game_starting_year = 1168;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5000
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5001 pParty = new Party;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5002 memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5003 pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5004 pParty->uDefaultEyelevel = GetPrivateProfileIntW(L"party", L"eyelevel", 160, pMM6IniFile);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5005 pParty->sEyelevel = pParty->uDefaultEyelevel;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5006 pParty->uDefaultPartyHeight = GetPrivateProfileIntW(L"party", L"height", 192, pMM6IniFile);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5007 pParty->uPartyHeight = pParty->uDefaultPartyHeight;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5008
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5009 MM6_Initialize(pMM6IniFile);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5010
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5011 pKeyActionMap = new KeyboardActionMapping;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5012
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5013 OnTimer(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5014 GameUI_StatusBar_UpdateTimedString(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5015 pGame = Game::Create();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5016 pMouse = pGame->pMouseInstance;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5017
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5018
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5019 pIcons_LOD = new LODFile_IconsBitmaps;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5020 if (!pIcons_LOD->Load("data\\icons.lod", "icons"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5021 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5022 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.",
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5023 L"Files Missing", MB_ICONEXCLAMATION);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5024 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5025 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5026 pIcons_LOD->dword_011BA4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5027
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5028 pEvents_LOD = new LODFile_IconsBitmaps;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5029 if (!pEvents_LOD->Load("data\\events.lod", "icons"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5030 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5031 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.",
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5032 L"Files Missing", MB_ICONEXCLAMATION);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5033 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5034 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5035
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5036 InitializeGameText();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5037
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5038 pBitmaps_LOD = new LODFile_IconsBitmaps;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5039 if (!pBitmaps_LOD->Load("data\\bitmaps.lod", "bitmaps"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5040 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5041 MessageBoxA(nullptr, pGlobalTXT_LocalizationStrings[63],
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5042 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5043 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5044 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5045
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5046 pSprites_LOD = new LODFile_Sprites;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5047 if (!pSprites_LOD->LoadSprites("data\\sprites.lod"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5048 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5049 MessageBoxA(nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5050 pGlobalTXT_LocalizationStrings[63],
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5051 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5052 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5053 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5054
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5055
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5056 #if 0
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5057 if (_access("../MM_VI/data/icons.lod", 0) == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5058 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5059 pIcons_LOD_mm6 = new LODFile_IconsBitmaps;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5060 if (!pIcons_LOD_mm6->Load("../MM_VI/data/icons.lod", "icons"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5061 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5062 delete pIcons_LOD_mm6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5063 pIcons_LOD_mm6 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5064 Log::Warning(L"Unable to load mm6:icons.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5065 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5066 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5067 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5068 Log::Warning(L"Unable to find mm6:icons.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5069
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5070 if (_access("../MM_VI/data/bitmaps.lod", 0) == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5071 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5072 pBitmaps_LOD_mm6 = new LODFile_IconsBitmaps;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5073 if (!pBitmaps_LOD_mm6->Load("../MM_VI/data/bitmaps.lod", "bitmaps"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5074 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5075 delete pBitmaps_LOD_mm6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5076 pBitmaps_LOD_mm6 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5077 Log::Warning(L"Unable to load mm6:bitmaps.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5078 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5079 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5080 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5081 Log::Warning(L"Unable to find mm6:bitmaps.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5082
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5083 auto mm6_sprite_container_name = bUseLoResSprites ? "../MM_VI/data/spriteLO.lod"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5084 : "../MM_VI/data/sprites.lod";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5085 if (_access(mm6_sprite_container_name, 0) == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5086 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5087 pSprites_LOD_mm6 = new LODFile_Sprites;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5088 if (!pSprites_LOD_mm6->LoadSprites(mm6_sprite_container_name))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5089 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5090 delete pSprites_LOD_mm6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5091 pSprites_LOD_mm6 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5092 Log::Warning(L"Unable to load mm6:sprites.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5093 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5094 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5095 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5096 Log::Warning(L"Unable to find mm6:sprites.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5097
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5098
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5099 if (_access("../mm8/data/icons.lod", 0) == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5100 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5101 pIcons_LOD_mm8 = new LODFile_IconsBitmaps;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5102 if (!pIcons_LOD_mm8->Load("../mm8/data/icons.lod", "icons"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5103 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5104 delete pIcons_LOD_mm8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5105 pIcons_LOD_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5106 Log::Warning(L"Unable to load mm8:icons.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5107 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5108 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5109 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5110 Log::Warning(L"Unable to find mm8:icons.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5111
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5112
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5113 if (_access("../mm8/data/bitmaps.lod", 0) == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5114 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5115 pBitmaps_LOD_mm8 = new LODFile_IconsBitmaps;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5116 if (!pBitmaps_LOD_mm8->Load("../mm8/data/bitmaps.lod", "bitmaps"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5117 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5118 delete pBitmaps_LOD_mm8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5119 pBitmaps_LOD_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5120 Log::Warning(L"Unable to load mm8:bitmaps.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5121 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5122 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5123 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5124 Log::Warning(L"Unable to find mm8:bitmaps.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5125
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5126
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5127 if (_access("../mm8/data/sprites.lod", 0) == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5128 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5129 pSprites_LOD_mm8 = new LODFile_Sprites;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5130 if (!pSprites_LOD_mm8->LoadSprites("../mm8/data/sprites.lod"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5131 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5132 delete pSprites_LOD_mm8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5133 pSprites_LOD_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5134 Log::Warning(L"Unable to load mm8:sprites.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5135 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5136 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5137 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5138 Log::Warning(L"Unable to find mm8:sprites.lod");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5139 #endif
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5140
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5141 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5142 void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5143 *sft_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5144 void *sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5145 pSpriteFrameTable = new SpriteFrameTable;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5146 pSpriteFrameTable->FromFile(sft_mm6, sft_mm7, sft_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5147 free(sft_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5148 free(sft_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5149 free(sft_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5150
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5151 void *tft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtft.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5152 *tft_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5153 void *tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5154 pTextureFrameTable = new TextureFrameTable;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5155 pTextureFrameTable->FromFile(tft_mm6, tft_mm7, tft_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5156 free(tft_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5157 free(tft_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5158 free(tft_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5159
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5160 void *tiles_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtile.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5161 *tiles_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5162 void *tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5163 pTileTable = new TileTable;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5164 pTileTable->FromFile(tiles_mm6, tiles_mm7, tiles_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5165 free(tiles_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5166 free(tiles_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5167 free(tiles_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5168
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5169 void *pft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dpft.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5170 *pft_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5171 void *pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5172 pPlayerFrameTable = new PlayerFrameTable;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5173 pPlayerFrameTable->FromFile(pft_mm6, pft_mm7, pft_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5174 free(pft_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5175 free(pft_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5176 free(pft_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5177
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5178 void *ift_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dift.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5179 *ift_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5180 void *ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5181 pIconsFrameTable = new IconFrameTable;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5182 pIconsFrameTable->FromFile(ift_mm6, ift_mm7, ift_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5183 free(ift_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5184 free(ift_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5185 free(ift_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5186
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5187 void *decs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("ddeclist.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5188 *decs_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5189 void *decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5190 pDecorationList = new DecorationList;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5191 pDecorationList->FromFile(decs_mm6, decs_mm7, decs_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5192 free(decs_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5193 free(decs_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5194 free(decs_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5195
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5196 void *objs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dobjlist.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5197 *objs_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5198 void *objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5199 pObjectList = new ObjectList;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5200 pObjectList->FromFile(objs_mm6, objs_mm7, objs_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5201 free(objs_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5202 free(objs_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5203 free(objs_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5204
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5205 void *mons_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dmonlist.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5206 *mons_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5207 void *mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5208 pMonsterList = new MonsterList;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5209 pMonsterList->FromFile(mons_mm6, mons_mm7, mons_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5210 free(mons_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5211 free(mons_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5212 free(mons_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5213
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5214 void *chests_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dchest.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5215 *chests_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5216 void *chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5217 pChestList = new ChestList;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5218 pChestList->FromFile(chests_mm6, chests_mm7, chests_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5219 free(chests_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5220 free(chests_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5221 free(chests_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5222
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5223 void *overlays_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("doverlay.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5224 *overlays_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5225 void *overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5226 pOverlayList = new OverlayList;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5227 pOverlayList->FromFile(overlays_mm6, overlays_mm7, overlays_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5228 free(overlays_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5229 free(overlays_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5230 free(overlays_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5231
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5232 void *sounds_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsounds.bin", 1) : nullptr,
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5233 *sounds_mm8 = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5234 void *sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5235 pSoundList = new SoundList;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5236 pSoundList->FromFile(sounds_mm6, sounds_mm7, sounds_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5237 free(sounds_mm6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5238 free(sounds_mm7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5239 free(sounds_mm8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5240 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5241
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5242
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5243
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5244
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5245 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_RUN_IN_WIDOW)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5246 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5247 //window->SetWindowedMode(game_width, game_height);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5248 pRenderer->SwitchToWindow();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5249 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5250 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5251 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5252 __debugbreak(); // Nomad
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5253 window->SetFullscreenMode();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5254 pRenderer->InitializeFullscreen();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5255 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5256
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5257 uSoundVolumeMultiplier = min(9, ReadWindowsRegistryInt("soundflag", 9));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5258 uMusicVolimeMultiplier = min(9, ReadWindowsRegistryInt("musicflag", 9));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5259 uVoicesVolumeMultiplier = min(9, ReadWindowsRegistryInt("CharVoices", 9));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5260 bShowDamage = ReadWindowsRegistryInt("ShowDamage", 1) != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5261
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5262 uGammaPos = min(4, ReadWindowsRegistryInt("GammaPos", 4));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5263 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5264
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5265 if (ReadWindowsRegistryInt("Bloodsplats", 1))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5266 pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5267 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5268 pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5269
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5270 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5271
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5272 if (!bNoSound)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5273 pAudioPlayer->Initialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5274
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5275 pMediaPlayer = new Media::MPlayer();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5276 pMediaPlayer->Initialize(window);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5277
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5278 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5279
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5280 switch (uTurnSpeed)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5281 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5282 case 0: // undefined turn option
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5283 __debugbreak(); // really shouldn't use this mode
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5284 uTurnSpeed = (unsigned int)uCPUSpeed < 199 ? 128 : 64; // adjust turn speed to estimated fps
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5285 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5286
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5287 case 1: // 16x
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5288 Log::Warning(L"x16 Turn Speed"); // really shouldn't use this mode
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5289 uTurnSpeed = 128;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5290 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5291
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5292 case 2: // 32x
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5293 Log::Warning(L"x32 Turn Speed"); // really shouldn't use this mode
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5294 uTurnSpeed = 64;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5295 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5296
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5297 case 3: // smooth
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5298 uTurnSpeed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5299 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5300 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5301
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5302 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5303 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5304
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5305 //----- (00465D0B) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5306 void SecondaryInitialization()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5307 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5308 pMouse->Initialize(window);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5309
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5310 pItemsTable = new ItemsTable;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5311 pItemsTable->Initialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5312
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5313 //pBitmaps_LOD->can_load_hardware_sprites = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5314 //pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5315 pBitmaps_LOD->SetupPalettes(5, 6, 5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5316 //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5317 pIcons_LOD->SetupPalettes(5, 6, 5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5318 //pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5319 pPaletteManager->SetColorChannelInfo(5, 6, 5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5320
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5321 pPaletteManager->SetMistColor(128, 128, 128);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5322 pPaletteManager->RecalculateAll();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5323 //pSprites_LOD->can_load_hardware_sprites = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5324 pObjectList->InitializeSprites();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5325 pOverlayList->InitializeSprites();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5326
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5327 if (!bNoSound)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5328 pSoundList->Initialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5329
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5330
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5331 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5332 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5333 static const char *pUIAnimNames[4] =
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5334 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5335 "glow03", "glow05",
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5336 "torchA", "wizeyeA"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5337 };
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5338 static unsigned short _4E98D0[4][4] =
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5339 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5340 { 479, 0, 329, 0 },
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5341 { 585, 0, 332, 0 },
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5342 { 468, 0, 0, 0 },
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5343 { 606, 0, 0, 0 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5344 };
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5345
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5346 pUIAnims[i]->uIconID = pIconsFrameTable->FindIcon(pUIAnimNames[i]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5347 pIconsFrameTable->InitializeAnimation(pUIAnims[i]->uIconID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5348
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5349 pUIAnims[i]->uAnimLength = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5350 pUIAnims[i]->uAnimTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5351 pUIAnims[i]->x = _4E98D0[i][0];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5352 pUIAnims[i]->y = _4E98D0[i][2];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5353 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5354
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5355 for (unsigned int i = 0; i < pObjectList->uNumObjects; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5356 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5357 pObjectList->pObjects[i].uParticleTrailColor = pObjectList->pObjects[i].uParticleTrailColorB |
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5358 ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorG << 8) |
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5359 ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorR << 16);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5360 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5361
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5362 MainMenuUI_Create();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5363 pGame->pStru6Instance->LoadAnimations();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5364
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5365 for (uint i = 0; i < 7; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5366 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5367 char container_name[64];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5368 sprintf(container_name, "HDWTR%03u", i);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5369 pRenderer->pHDWaterBitmapIDs[i] = pBitmaps_LOD->LoadTexture(container_name);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5370 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5371
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5372 pNPCStats = new NPCStats;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5373 memset(pNPCStats->pNPCData, 0, 0x94BCu);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5374 pNPCStats->Initialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5375
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5376 Initialize_GlobalEVT();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5377 pBitmaps_LOD->_inlined_sub0();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5378 pSprites_LOD->_inlined_sub0();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5379 pPaletteManager->LockAll();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5380
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5381 _mkdir("Saves");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5382 for (uint i = 0; i < 5; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5383 for (uint j = 0; j < 6; ++j)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5384 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5385 sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5386 remove(pTmpBuf.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5387 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5388
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5389 Initialize_GamesLOD_NewLOD();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5390 _576E2C_current_minimap_zoom = 512;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5391 dword_576E28 = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5392 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5393
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5394 bool new_sky = false; //new sky(need texture)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5395 int max_flight_height = 4000; //maximum altitude
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5396 bool use_MMT = false;
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5397 bool use_music_folder = true;
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5398 bool for_refactoring = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5399
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5400 //----- (00462C94) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5401 bool MM_Main(const wchar_t *pCmdLine)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5402 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5403 IntegrityTest();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5404
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5405 char test[1024];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5406 sprintfex(test, "^Pi[%s]: çíàõàð^R[ü;êà;]", "Çîëòàí");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5407
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5408 lua = new LuaVM;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5409 lua->Initialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5410
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5411 bool bNoMargareth = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5412 if (pCmdLine && *pCmdLine)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5413 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5414 //if (wcsstr(pCmdLine, L"-usedefs"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5415 // bDebugResouces = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5416 if (wcsstr(pCmdLine, L"-window"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5417 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5418
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5419 if (wcsstr(pCmdLine, L"-nointro"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5420 bNoIntro = true;//dword_6BE364_game_settings_1 |= 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5421 if (wcsstr(pCmdLine, L"-nologo"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5422 bNoLogo = true;//dword_6BE364_game_settings_1 |= 8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5423 if (wcsstr(pCmdLine, L"-nosound"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5424 bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5425
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5426 bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5427 if (wcsstr(pCmdLine, L"-nowalksound"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5428 bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5429 if (wcsstr(pCmdLine, L"-novideo"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5430 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5431 dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5432 bNoVideo = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5433 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5434 if (wcsstr(pCmdLine, L"-nocd"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5435 bNoCD = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5436 if (wcsstr(pCmdLine, L"-new_sky"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5437 new_sky = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5438 if (wcsstr(pCmdLine, L"-nomarg"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5439 bNoMargareth = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5440 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5441
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5442 /*v8 = _4AC1C9_get_cpu_speed(0, (Vec4_int_ *)a2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5443 Rect.left = *(int *)v8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5444 Rect.top = *(int *)(v8 + 4);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5445 Rect.right = *(int *)(v8 + 8);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5446 Rect.bottom = *(int *)(v8 + 12);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5447 uCPUSpeed = Rect.bottom;*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5448 uCPUSpeed = 2048; // about 2GHz
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5449
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5450 //_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF );//Ritor1: for memory test
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5451
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5452 if (!MM7_Initialize(640, 480))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5453 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5454 Log::Warning(L"MM init: failed");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5455 pGame->Deinitialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5456 return 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5457 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5458
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5459 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5460
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5461 SetUserInterface(PartyAlignment_Neutral, false);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5462
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5463 ShowLogoVideo();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5464 //ShowIntroVideo_and_LoadingScreen();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5465 WriteWindowsRegistryInt("Ran once", 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5466 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5467 pGame->InitializeGammaController();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5468 SecondaryInitialization();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5469 pRenderer->SetRasterClipRect(0, 0, window->GetWidth() - 1, window->GetHeight() - 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5470 FinalInitialization();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5471
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5472 //Ritor1: include
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5473 if (use_MMT)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5474 MMT_MainMenu_Loop();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5475
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5476 Log::Warning(L"MM: entering main loop");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5477 while (1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5478 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5479 MainMenuWindow* main_menu_window = MainMenuWindow::Create();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5480 window->AddControl(main_menu_window);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5481 MainMenu_Loop();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5482 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5483 while (1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5484 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5485 if (uGameState == GAME_FINISHED || GetCurrentMenuID() == MENU_EXIT_GAME)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5486 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5487 pGame->Deinitialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5488 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5489 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5490
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5491 if (GetCurrentMenuID() == MENU_NEWGAME)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5492 {
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5493 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5494 alSourceStop(mSourceID);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5495 else
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5496 {
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5497 if (pAudioPlayer->hAILRedbook)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5498 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5499 }
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5500 pParty->Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5501 pOtherOverlayList->Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5502 strcpy(pCurrentMapName, pStartingMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5503 pParty->CreateDefaultParty(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5504 PlayerCreationUI_Initialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5505 if (PlayerCreationUI_Loop())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5506 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5507 DeleteCCharFont();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5508 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5509 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5510 DeleteCCharFont();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5511 bFlashQuestBook = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5512 pMediaPlayer->PlayFullscreenMovie(MOVIE_Emerald, true);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5513 SaveNewGame();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5514 if (bNoMargareth)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5515 _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5516 pGame->Loop();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5517 if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5518 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5519 SetCurrentMenuID(MENU_NEWGAME);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5520 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5521 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5522 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5523 else if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5524 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5525 assert(false && "Invalid game state");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5526 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5527 if (GetCurrentMenuID() == MENU_CREDITS)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5528 {
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5529 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5530 alSourceStop(mSourceID);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5531 else
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5532 {
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5533 if (pAudioPlayer->hAILRedbook)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5534 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5535 }
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5536 MainMenuUI_Credits_Loop();
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5537 break;
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5538 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5539 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5540 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5541 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5542 pGame->Loop();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5543 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5544 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5545 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5546 if (GetCurrentMenuID() == MENU_DebugBLVLevel)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5547 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5548 pMouse->ChangeActivation(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5549 pParty->Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5550 pParty->CreateDefaultParty(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5551
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5552 __debugbreak();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5553 /*extern void CreateDefaultBLVLevel();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5554 CreateDefaultBLVLevel();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5555
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5556 OPENFILENAMEA ofn;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5557 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5558 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5559 pMouse->ChangeActivation(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5560 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5561 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5562 _chdir("..\\");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5563 strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5564 pMouse->ChangeActivation(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5565 pGame->Loop();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5566 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5567 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5568 if (uGameState == GAME_STATE_LOADING_GAME)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5569 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5570 SetCurrentMenuID(MENU_5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5571 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5572 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5573 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5574 if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5575 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5576 SetCurrentMenuID(MENU_NEWGAME);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5577 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5578 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5579 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5580 if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)// from the loaded game
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5581 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5582 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5583 uGameState = GAME_STATE_PLAYING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5584 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5585 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5586 }
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5587 if (!bNoSound )
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5588 {
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5589 if ( use_music_folder )
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5590 {
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5591 PlayAudio(L"Music\\14.mp3");
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5592 alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5593 }
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5594 else if ( pAudioPlayer->hAILRedbook)
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5595 {
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5596 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5597 AIL_redbook_stop(pAudioPlayer->hAILRedbook);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5598 unsigned int startms, end_ms;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5599 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &startms, &end_ms);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5600 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms);
2508
491f0babd563 use_music_folder
Ritor1
parents: 2506
diff changeset
5601 }
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5602 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5603 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5604 //lua_close(L);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5605 pGame->Deinitialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5606 return 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5607 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5608
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5609
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5610
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5611 //----- (00466082) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5612 void MM6_Initialize(const wchar_t *pIniFilename)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5613 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5614 size_t v2; // eax@31
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5615 size_t v3; // ebx@32
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5616 size_t v4; // edi@36
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5617 char pDefaultGroundTexture[16]; // [sp+FCh] [bp-8Ch]@32
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5618 unsigned int v9; // [sp+184h] [bp-4h]@28
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5619
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5620 //_getcwd(v5, 120);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5621 //sprintfex(pIniFilename, "%s\\mm6.ini", v5);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5622 viewparams = new ViewingParams;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5623 game_viewport_x = viewparams->uScreen_topL_X = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5624 game_viewport_y = viewparams->uScreen_topL_Y = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5625 game_viewport_z = viewparams->uScreen_BttmR_X = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5626 game_viewport_w = viewparams->uScreen_BttmR_Y = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5627 game_viewport_width = game_viewport_z - game_viewport_x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5628 game_viewport_height = game_viewport_w - game_viewport_y + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5629
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5630
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5631 pAudioPlayer = new AudioPlayer;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5632 pAudioPlayer->uMixerChannels = GetPrivateProfileIntW(L"settings", L"mixerchannels", 16, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5633 if (pAudioPlayer->uMixerChannels > 16)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5634 pAudioPlayer->uMixerChannels = 16;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5635
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5636
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5637 if (GetPrivateProfileIntW(L"debug", L"nomonster", 0, pIniFilename))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5638 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_ACTORS;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5639 if (ReadWindowsRegistryInt("startinwindow", 0))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5640 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5641 if (GetPrivateProfileIntW(L"debug", L"showFR", 0, pIniFilename))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5642 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_0002_SHOW_FR;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5643 if (GetPrivateProfileIntW(L"debug", L"nodamage", 0, pIniFilename))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5644 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DAMAGE;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5645 if (GetPrivateProfileIntW(L"debug", L"nodecoration", 0, pIniFilename))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5646 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DECORATIONS;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5647
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5648 wchar_t pStartingMapNameW[1024];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5649 GetPrivateProfileStringW(L"file", L"startmap", L"out01.odm", pStartingMapNameW, 0x20u, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5650 sprintf(pStartingMapName, "%S", pStartingMapNameW);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5651
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5652 v9 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5653 if (strlen(pStartingMapName))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5654 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5655 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5656 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5657 if (pStartingMapName[v9] == ' ')
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5658 pStartingMapName[v9] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5659 ++v9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5660 v2 = strlen(pStartingMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5661 } while (v9 < v2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5662 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5663
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5664 pODMRenderParams = new ODMRenderParams;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5665 pODMRenderParams->outdoor_no_mist = GetPrivateProfileIntW(L"debug", L"noMist", 0, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5666 pODMRenderParams->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5667 pODMRenderParams->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5668 pODMRenderParams->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5669 outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5670 outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5671 outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5672 pODMRenderParams->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5673 pODMRenderParams->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5674 pODMRenderParams->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5675 pODMRenderParams->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5676
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5677 pODMRenderParams->shading_dist_mist = GetPrivateProfileIntW(L"shading", L"dist_mist", 0x2000, pIniFilename);//drawing dist 0x2000
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5678
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5679 wchar_t pDefaultSkyTextureW[1024];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5680 GetPrivateProfileStringW(L"textures", L"sky", L"plansky1", pDefaultSkyTextureW, 0x10u, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5681 sprintf(pDefaultSkyTexture.data(), "%S", pDefaultSkyTextureW);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5682
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5683 wchar_t pDefaultGroundTextureW[1024];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5684 GetPrivateProfileStringW(L"textures", L"default", L"dirt", pDefaultGroundTextureW, 0x10u, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5685 sprintf(pDefaultGroundTexture, "%S", pDefaultGroundTextureW);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5686
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5687 wchar_t pFloat[1024];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5688 GetPrivateProfileStringW(L"debug", L"recmod1", L"1.0", pFloat, 0x10u, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5689 swscanf(pFloat, L"%f", &flt_6BE3A4_debug_recmod1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5690
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5691 GetPrivateProfileStringW(L"debug", L"recmod2", L"1.0", pFloat, 0x10u, pIniFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5692 swscanf(pFloat, L"%f", &flt_6BE3A8_debug_recmod2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5693
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5694 flt_6BE3AC_debug_recmod1_x_1_6 = flt_6BE3A4_debug_recmod1 * 1.666666666666667;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5695
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5696 v3 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5697 if (strlen(pDefaultSkyTexture.data()))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5698 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5699 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5700 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5701 if (pDefaultSkyTexture[v3] == ' ')
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5702 pDefaultSkyTexture[v3] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5703 ++v3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5704 } while (v3 < strlen(pDefaultSkyTexture.data()));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5705 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5706 v4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5707 if (strlen(pDefaultGroundTexture))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5708 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5709 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5710 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5711 if (pDefaultGroundTexture[v4] == ' ')
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5712 pDefaultGroundTexture[v4] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5713 ++v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5714 } while (v4 < strlen(pDefaultGroundTexture));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5715 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5716
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5717 MM7Initialization();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5718 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5719
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5720 //----- (004666D5) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5721 void MM7Initialization()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5722 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5723 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5724 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5725 /*if (byte_6BE388_graphicsmode == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5726 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5727 outdoor_grid_band_1 = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5728 outdoor_grid_band_2 = 15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5729 outdoor_grid_band_3 = 20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5730 pODMRenderParams->shading_dist_mist = 8192;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5731 pODMRenderParams->bNoSky = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5732 LOBYTE(viewparams->field_20) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5733 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5734 pODMRenderParams->shading_dist_shade = 2048;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5735 pODMRenderParams->terrain_gamma = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5736 pODMRenderParams->building_gamme = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5737 pODMRenderParams->shading_dist_shademist = 4096;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5738 pODMRenderParams->outdoor_no_wavy_water = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5739 //_47F4D3_initialize_terrain_bezier_stuff(outdoor_grid_band_1, outdoor_grid_band_2, outdoor_grid_band_3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5740 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5741 pODMRenderParams->outdoor_grid_band_3 = outdoor_grid_band_3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5742 pODMRenderParams->uPickDepth = outdoor_grid_band_3 * 512;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5743 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5744 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5745 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5746 LOBYTE(viewparams->field_20) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5747 pParty->uFlags |= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5748 viewparams->uSomeY = viewparams->uScreen_topL_Y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5749 viewparams->uSomeX = viewparams->uScreen_topL_X;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5750 viewparams->uSomeZ = viewparams->uScreen_BttmR_X;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5751 viewparams->uSomeW = viewparams->uScreen_BttmR_Y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5752
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5753 pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5754 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5755 pODMRenderParams->Initialize();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5756 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5757
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5758 //----- (004610AA) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5759 void __fastcall PrepareToLoadODM(unsigned int bLoading, ODMRenderParams *a2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5760 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5761 pGameLoadingUI_ProgressBar->Reset(27);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5762 pSoundList->_4A9D79(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5763 uCurrentlyLoadedLevelType = LEVEL_Outdoor;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5764 ODM_LoadAndInitialize(pCurrentMapName, a2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5765 if (!bLoading)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5766 TeleportToStartingPoint(uLevel_StartingPointType);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5767 viewparams->_443365();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5768 PlayLevelMusic();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5769 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5770 // 6BE35C: using guessed type int uLevel_StartingPointType;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5771
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5772
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5773 //----- (004627B7) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5774 void MainMenu_Loop()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5775 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5776 GUIButton *pButton; // eax@27
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5777 unsigned int pControlParam; // ecx@35
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5778 unsigned int pY; // [sp-18h] [bp-54h]@39
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5779 Texture *pTexture; // [sp-14h] [bp-50h]@39
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5780 GUIWindow *pWindow; // [sp+4h] [bp-38h]@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5781 MSG msg;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5782
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5783 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5784
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5785 pGUIWindow2 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5786 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5787 pMouse->RemoveHoldingItem();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5788
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5789 pIcons_LOD->_inlined_sub2();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5790
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5791 pWindow_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5792 Texture* pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5793 Texture* pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5794 Texture* pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5795 Texture* pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5796
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5797 pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", pNew, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5798 pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", pLoad, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5799 pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 'C', "", pCredits, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5800 pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5801
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5802 pTexture_PCX.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5803 pTexture_PCX.Load("title.pcx", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5804 SetCurrentMenuID(MENU_MAIN);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5805 SetForegroundWindow(window->GetApiHandle());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5806 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5807 while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5808 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5809 POINT pt;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5810 pMouse->GetCursorPos(&pt);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5811 pWindow = pWindow_MainMenu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5812 if (GetCurrentMenuID() == MENU_SAVELOAD)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5813 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5814 if (pCurrentScreen != SCREEN_LOADGAME)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5815 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5816 pTexture_PCX.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5817 pTexture_PCX.Load("lsave640.pcx", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5818 pGUIWindow2 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5819 pCurrentScreen = SCREEN_LOADGAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5820 LoadUI_Load(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5821 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5822 pWindow = pGUIWindow_CurrentMenu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5823 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5824
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5825 while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5826 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5827 if (msg.message == WM_QUIT)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5828 Game_DeinitializeAndTerminate(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5829 TranslateMessage(&msg);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5830 DispatchMessageW(&msg);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5831 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5832
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5833 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5834 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5835 WaitMessage();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5836 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5837 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5838
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5839 pRenderer->BeginScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5840 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5841
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5842 GUI_MainMenuMessageProc();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5843 GUI_UpdateWindows();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5844
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5845 if (GetCurrentMenuID() != MENU_MAIN)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5846 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5847 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5848 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5849 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5850 pGUIWindow_CurrentMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5851 pGUIWindow_CurrentMenu = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5852 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5853 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5854 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5855 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5856 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5857 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5858 if (!pModalWindow)// ???
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5859 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5860 pButton = pWindow->pControlsHead;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5861 for (pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5862 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5863 if (pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5864 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5865 && pWindow == pWindow_MainMenu)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5866 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5867 pControlParam = pButton->msg_param;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5868 switch (pControlParam) // backlight for buttons
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5869 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5870 case 0:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5871 pTexture = pNew;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5872 pY = 172;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5873 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5874 case 1:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5875 pTexture = pLoad;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5876 pY = 227;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5877 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5878 case 2:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5879 pTexture = pCredits;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5880 pY = 282;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5881 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5882 case 3:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5883 pTexture = pExit;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5884 pY = 337;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5885 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5886 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5887 pRenderer->DrawTextureIndexed(495, pY, pTexture);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5888 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5889 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5890 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5891 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5892 pRenderer->EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5893 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5894 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5895 GUI_MainMenuMessageProc();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5896 pRenderer->BeginScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5897 GUI_UpdateWindows();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5898 pRenderer->EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5899 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5900 pTexture_PCX.Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5901 if (pGUIWindow2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5902 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5903 pGUIWindow2->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5904 pGUIWindow2 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5905 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5906 pWindow_MainMenu->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5907 pIcons_LOD->RemoveTexturesPackFromTextureList();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5908 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5909
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5910 //----- (004BF91E) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5911 unsigned int GameOverMenu(void *ecx0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5912 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5913 const char *v1; // eax@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5914 unsigned int result; // eax@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5915 const char *v6; // eax@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5916 const char *v7; // edx@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5917 const char *v8; // ecx@12
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5918 const char *v9; // eax@14
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5919 unsigned int v10; // eax@25
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5920 GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5921 unsigned int v14; // [sp+A4h] [bp-2Ch]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5922 void *v15; // [sp+A8h] [bp-28h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5923 const char *pInString; // [sp+ACh] [bp-24h]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5924 unsigned int v17; // [sp+B0h] [bp-20h]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5925 unsigned int v18; // [sp+B4h] [bp-1Ch]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5926 unsigned int v19; // [sp+B8h] [bp-18h]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5927 int v20; // [sp+BCh] [bp-14h]@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5928 GUIFont *pFont; // [sp+C4h] [bp-Ch]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5929 unsigned __int64 v23; // [sp+C8h] [bp-8h]@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5930 MSG msg;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5931
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5932 v15 = ecx0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5933
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5934 RGBTexture _this; // [sp+Ch] [bp-C4h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5935 //RGBTexture::RGBTexture(&this);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5936
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5937 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5938 bGameoverLoop = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5939 pMediaPlayer->bStopBeforeSchedule = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5940 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5941 pRenderer->BeginScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5942 pRenderer->ClearBlack();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5943 pRenderer->EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5944 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5945 //pMediaPlayer->pResetflag = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5946 _449B57_test_bit(pParty->_quest_bits, 99);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5947 _this.Load("winbg.pcx", 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5948 pRenderer->BeginScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5949 pRenderer->DrawTextureRGB(0, 0, &_this);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5950 pRenderer->EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5951 free(_this.pPixels);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5952 _this.pPixels = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5953 window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5954 pWindow.uFrameX = 75;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5955 pWindow.uFrameY = 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5956 pWindow.uFrameWidth = 469;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5957 pWindow.uFrameHeight = 338;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5958 pWindow.uFrameZ = 543;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5959 pWindow.uFrameW = 397;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5960 pFont = LoadFont("endgame.fnt", "FONTPAL", NULL);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5961 if (pParty->IsPartyGood())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5962 v1 = pGlobalTXT_LocalizationStrings[675];//"Splendid job! With the activation of the Gate, a thousand worlds lie at your feet. Perhaps on one of them you will find the Ancients themselves, and return with the fruits their great civilization has to offer your world and your kingdom."
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5963 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5964 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5965 result = pParty->IsPartyEvil();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5966 if (!(short)result)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5967 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5968 v1 = pGlobalTXT_LocalizationStrings[676];//"Brilliant! The completion of the Heavenly Forge has provided enough Ancient weapons to crush all resistance to your plans. Soon the world will bow to your every whim! Still, you can't help but wonder what was beyond the Gate the other side was trying so hard to build."
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5969 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5970 pInString = v1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5971 v23 = pParty->uTimePlayed - 138240;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5972 v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5973 v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C / 0xC;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5974 v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C % 0xC;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5975 v17 = v19 % 0x1C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5976 if (!v19)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5977 v19 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5978 pRenderer->BeginScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5979 pWindow.DrawTitleText(pFont, 1, 0x23, 1, pGlobalTXT_LocalizationStrings[9], 3);//Congratulations!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5980 v23 = 0i64;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5981 v20 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5982 for (uint i = 0; i < 4; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5983 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5984 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], pParty->pPlayers[i].pName, pParty->pPlayers[i].GetBaseLevel(), pClassNames[pParty->pPlayers[i].classType]);//%s the Level %u %s
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5985 pWindow.DrawTitleText(pFont, 1, i * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 1, pTmpBuf.data(), 3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5986 v23 += pParty->pPlayers[i].uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5987 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5988 v23 = (signed __int64)v23 / v19;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5989 v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5990 pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5991 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5992
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5993 v7 = pGlobalTXT_LocalizationStrings[56];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5994 if (v17 != 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5995 v7 = pGlobalTXT_LocalizationStrings[57];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5996
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5997 v8 = pGlobalTXT_LocalizationStrings[146];//Month
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5998 if (v18 != 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
5999 v8 = pGlobalTXT_LocalizationStrings[148];//Months
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6000
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6001 v9 = pGlobalTXT_LocalizationStrings[245];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6002 if (v14 != 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6003 v9 = pGlobalTXT_LocalizationStrings[132];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6004
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6005 sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6006 strcat(pTmpBuf.data(), pTmpBuf2.data());
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6007 pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1, pTmpBuf.data(), 3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6008 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6009 pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1, pTmpBuf.data(), 3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6010 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6011 pRenderer->EndScene();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6012 pRenderer->Present();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6013 //if ( pRenderer->pRenderD3D )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6014 pRenderer->pBeforePresentFunction();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6015 pRenderer->SaveWinnersCertificate("MM7_Win.Pcx");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6016 free(pFont);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6017 window_SpeakInHouse->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6018 window_SpeakInHouse = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6019 if (v15 == (void *)2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6020 result = pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6021 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6022 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6023 LODWORD(v23) = GetTickCount() + 5000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6024 while ((unsigned int)v23 > GetTickCount())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6025 ;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6026 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6027 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6028 if (msg.message == WM_QUIT)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6029 Game_DeinitializeAndTerminate(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6030 TranslateMessage(&msg);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6031 DispatchMessage(&msg);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6032 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6033 if (pMessageQueue_50CBD0->uNumMessages)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6034 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6035 LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6036 pMessageQueue_50CBD0->uNumMessages = v10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6037 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6038 pKeyActionMap->ResetKeys();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6039 pKeyActionMap->uLastKeyPressed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6040 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6041 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6042 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6043 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6044 if (msg.message == WM_QUIT)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6045 Game_DeinitializeAndTerminate(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6046 TranslateMessage(&msg);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6047 DispatchMessage(&msg);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6048 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6049 } while (!pKeyActionMap->uLastKeyPressed);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6050 result = pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6051 if (pMessageQueue_50CBD0->uNumMessages)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6052 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6053 result = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6054 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6055 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6056 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6057 if (v15)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6058 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6059 /*if ( (signed int)result < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6060 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6061 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6062 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6063 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Quit, 1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6064 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6065 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6066 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6067 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ShowFinalWindow, 1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6068 /*if ( (signed int)result < 40 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6069 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6070 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6071 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6072 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6073 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6074 ++pMessageQueue_50CBD0->uNumMessages;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6075 }*/
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6076 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6077 bGameoverLoop = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6078 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6079 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6080
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6081 //----- (00464479) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6082 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6083 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6084 int v0; // esi@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6085
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6086 if (pMouse)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6087 pMouse->SetCursorBitmap("MICON1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6088
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6089 pPaletteManager->ResetNonLocked();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6090 pBitmaps_LOD->ReleaseAll2();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6091 pSprites_LOD->DeleteSomeOtherSprites();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6092 pIcons_LOD->ReleaseAll2();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6093
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6094 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6095 pIndoor->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6096 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6097 pOutdoor->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6098
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6099 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6100 pSoundList->_4A9D79(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6101 uCurrentlyLoadedLevelType = LEVEL_null;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6102 pSpriteFrameTable->ResetSomeSpriteFlags();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6103 v0 = uNumVisibleWindows;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6104 pParty->armageddon_timer = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6105 while (v0 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6106 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6107 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6108
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6109 //----- (00461103) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6110 void _461103_load_level_sub()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6111 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6112 int v4; // edx@8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6113 signed int v6; // esi@14
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6114 signed int v8; // ecx@16
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6115 int v12; // esi@25
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6116 int v13; // eax@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6117 __int16 v14; // ax@41
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6118 signed int v17; // [sp+14h] [bp-48h]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6119 signed int v18; // [sp+14h] [bp-48h]@23
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6120 int v19; // [sp+18h] [bp-44h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6121 signed int v20; // [sp+18h] [bp-44h]@14
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6122 int v21[16]; // [sp+1Ch] [bp-40h]@17
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6123
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6124 GenerateItemsInChest();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6125 pGameLoadingUI_ProgressBar->Progress();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6126 pParty->uFlags |= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6127 pParty->field_7B5_in_arena_quest = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6128 dword_5C6DF8 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6129 pNPCStats->uNewlNPCBufPos = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6130 v19 = pMapStats->GetMapInfo(pCurrentMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6131
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6132 //v15 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6133 for (uint i = 0; i < uNumActors; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6134 //if ( (signed int)uNumActors > 0 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6135 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6136 //Actor* pActor = &pActors[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6137 //v2 = (char *)&pActors[0].uNPC_ID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6138 //do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6139 //{
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6140 //v3 = pActors[i].pMonsterInfo.uID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6141 v17 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6142 if (pActors[i].pMonsterInfo.uID >= 115 && pActors[i].pMonsterInfo.uID <= 186
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6143 || pActors[i].pMonsterInfo.uID >= 232 && pActors[i].pMonsterInfo.uID <= 249)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6144 v17 = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6145 //v1 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6146 v4 = (pActors[i].pMonsterInfo.uID - 1) % 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6147 if (2 == v4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6148 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6149 if (pActors[i].sNPC_ID && pActors[i].sNPC_ID < 5000)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6150 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6151 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6152 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6153 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6154 if (v4 != 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6155 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6156 if (v4 == 0 && pActors[i].sNPC_ID == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6157 pActors[i].sNPC_ID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6158 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6159 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6160 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6161 if (pActors[i].sNPC_ID > 0 && pActors[i].sNPC_ID < 5000)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6162 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6163 if (v17)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6164 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6165 pNPCStats->InitializeAdditionalNPCs(&pNPCStats->pAdditionalNPC[pNPCStats->uNewlNPCBufPos], pActors[i].pMonsterInfo.uID, 0, v19);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6166 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6167 ++pNPCStats->uNewlNPCBufPos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6168 pActors[i].sNPC_ID = v14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6169 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6170 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6171 pActors[i].sNPC_ID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6172 //++v15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6173 //v2 += 836;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6174 //}
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6175 //while ( v15 < (signed int)uNumActors );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6176 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6177
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6178 pGameLoadingUI_ProgressBar->Progress();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6179
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6180 //v5 = uNumActors;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6181 v6 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6182 v20 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6183 //v16 = v1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6184
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6185 for (uint i = 0; i < uNumActors; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6186 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6187 //v7 = (char *)&pActors[0].pMonsterInfo;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6188 //do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6189 //{
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6190 for (v8 = 0; v8 < v6; ++v8)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6191 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6192 if (v21[v8] == pActors[i].pMonsterInfo.uID - 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6193 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6194 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6195
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6196 if (v8 == v6)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6197 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6198 v21[v6++] = pActors[i].pMonsterInfo.uID - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6199 v20 = v6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6200 if (v6 == 16)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6201 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6202 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6203 //++v16;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6204 //v7 += 836;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6205 //}
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6206 //while ( v16 < (signed int)v5 );
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6207 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6208
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6209 pGameLoadingUI_ProgressBar->Progress();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6210
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6211 for (int _v0 = 0; _v0 < v6; ++_v0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6212 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6213 for (v18 = 4; v18; --v18)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6214 pSoundList->LoadSound(pMonsterList->pMonsters[v21[_v0]].pSoundSampleIDs[4 - v18], 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6215 v12 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6216 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6217 v13 = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[pMonsterStats->pInfos[v21[_v0] + 1].uSpell1ID], 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6218 while (v13);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6219 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6220 //v0 = pGameLoadingUI_ProgressBar;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6221 //v1 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6222
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6223 pGameLoadingUI_ProgressBar->Progress();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6224
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6225 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_ACTORS)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6226 uNumActors = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6227 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DECORATIONS)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6228 uNumLevelDecorations = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6229 init_event_triggers();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6230
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6231 pGameLoadingUI_ProgressBar->Progress();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6232
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6233 pGame->pIndoorCameraD3D->vPartyPos.x = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6234 pGame->pIndoorCameraD3D->vPartyPos.y = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6235 pGame->pIndoorCameraD3D->vPartyPos.z = 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6236 pGame->pIndoorCameraD3D->sRotationX = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6237 pGame->pIndoorCameraD3D->sRotationY = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6238 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6239 uLevel_StartingPointType = MapStartPoint_Party;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6240 pSprites_LOD->_461397();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6241 pPaletteManager->LockTestAll();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6242 if (pParty->pPickedItem.uItemID != 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6243 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6244 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6245
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6246 //----- (0042F3D6) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6247 void InitializeTurnBasedAnimations(void *_this)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6248 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6249 for (unsigned int i = 0; i < pIconIDs_Turn.size(); ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6250 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6251 char icon_name[32];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6252 sprintf(icon_name, "turn%u", i);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6253 pIconIDs_Turn[i] = pIconsFrameTable->FindIcon(icon_name);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6254 pIconsFrameTable->InitializeAnimation(pIconIDs_Turn[i]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6255 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6256
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6257 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6258 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6259 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6260 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6261 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6262
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6263 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6264 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6265 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6266 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6267 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6268
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6269 //----- (00466C40) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6270 const wchar_t *MENU_STATE_to_string(MENU_STATE m)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6271 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6272 switch (m)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6273 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6274 case -1: return L"-1";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6275 case MENU_MAIN: return L"MENU_MAIN";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6276 case MENU_NEWGAME: return L"MENU_NEWGAME";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6277 case MENU_CREDITS: return L"MENU_CREDITS";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6278 case MENU_SAVELOAD: return L"MENU_SAVELOAD";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6279 case MENU_EXIT_GAME: return L"MENU_EXIT_GAME";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6280 case MENU_5: return L"MENU_5";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6281 case MENU_CREATEPARTY: return L"MENU_CREATEPARTY";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6282 case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6283 case MENU_CREDITSPROC: return L"MENU_CREDITSPROC";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6284 case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6285 case MENU_DebugBLVLevel: return L"MENU_DebugBLVLevel";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6286 case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6287 case MENU_MMT_MAIN_MENU: return L"MENU_MMT_MAIN_MENU";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6288 default: return L"unk";
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6289 };
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6290 };
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6291 void SetCurrentMenuID(MENU_STATE uMenu)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6292 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6293 sCurrentMenuID = uMenu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6294
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6295 Log::Warning(L"CurrentMenu = %s \n", MENU_STATE_to_string(uMenu));
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6296 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6297
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6298 //----- (00466CA0) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6299 MENU_STATE GetCurrentMenuID()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6300 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6301 return sCurrentMenuID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6302 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6303
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6304 //----- (0046BDA8) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6305 unsigned int GetGravityStrength()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6306 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6307 int v0; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6308
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6309 v0 = ~LOBYTE(pGame->uFlags2) & 8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6310 LOBYTE(v0) = v0 | 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6311 return (unsigned int)v0 >> 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6312 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6313
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6314 //----- (00448B45) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6315 void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6316 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6317 if (bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6318 GameUI_Footer_TimeLeft = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6319 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6320
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6321 //----- (0044861E) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6322 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6323 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6324 unsigned int texture; // eax@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6325
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6326 if (uFaceCog)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6327 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6328 texture = pBitmaps_LOD->LoadTexture(pFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6329 if (texture != -1 ? (int)&pBitmaps_LOD->pTextures[texture] : 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6330 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6331 pBitmaps_LOD->pTextures[texture].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[texture].palette_id1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6332
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6333 if (uCurrentlyLoadedLevelType == 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6334 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6335 if ((signed int)pIndoor->uNumFaceExtras > 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6336 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6337 for (uint i = 1; i < (signed int)pIndoor->uNumFaceExtras; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6338 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6339 if (pIndoor->pFaceExtras[i].sCogNumber == uFaceCog)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6340 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6341 if (pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes & FACE_TEXTURE_FRAME)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6342 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6343 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = pTextureFrameTable->FindTextureByName(pFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6344 if (pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6345 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6346 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6347 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6348 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6349 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6350 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = texture;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6351 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes &= 0xFFFFBFFF;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6352 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6353 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6354 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6355 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6356 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = texture;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6357 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6358 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6359 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6360 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6361 pParty->uFlags |= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6362 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6363 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6364 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6365 for (uint j = 0; j < (unsigned int)pOutdoor->uNumBModels; ++j)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6366 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6367 for (uint i = 0; i < pOutdoor->pBModels[j].uNumFaces; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6368 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6369 if (pOutdoor->pBModels[j].pFaces[i].sCogNumber == uFaceCog)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6370 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6371 if (pOutdoor->pBModels[j].pFaces[i].uAttributes & FACE_TEXTURE_FRAME)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6372 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6373 pOutdoor->pBModels[j].pFaces[i].uTextureID = pTextureFrameTable->FindTextureByName(pFilename);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6374 if (pOutdoor->pBModels[j].pFaces[i].uTextureID)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6375 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pOutdoor->pBModels[j].pFaces[i].uTextureID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6376 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6377 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6378 pOutdoor->pBModels[j].pFaces[i].uTextureID = texture;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6379 pOutdoor->pBModels[j].pFaces[i].uAttributes &= 0xFFFFBFFF;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6380 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6381 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6382 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6383 pOutdoor->pBModels[j].pFaces[i].uTextureID = texture;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6384 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6385 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6386 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6387 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6388 pParty->uFlags |= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6389 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6390 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6391 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6392
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6393 //----- (0044892E) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6394 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6395 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6396 if (sCogNumber)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6397 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6398 if (uCurrentlyLoadedLevelType == 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6399 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6400 for (uint i = 1; i < (unsigned int)pIndoor->uNumFaceExtras; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6401 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6402 if (pIndoor->pFaceExtras[i].sCogNumber == sCogNumber)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6403 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6404 if (on)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6405 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes |= bit;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6406 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6407 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes &= ~bit;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6408 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6409 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6410 pParty->uFlags |= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6411 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6412 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6413 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6414 for (uint j = 0; j < (unsigned int)pOutdoor->uNumBModels; ++j)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6415 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6416 for (uint i = 0; i < (unsigned int)pOutdoor->pBModels[j].uNumFaces; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6417 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6418 if (pOutdoor->pBModels[j].pFaces[i].sCogNumber == sCogNumber)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6419 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6420 if (on)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6421 pOutdoor->pBModels[j].pFaces[i].uAttributes |= bit;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6422 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6423 pOutdoor->pBModels[j].pFaces[i].uAttributes &= ~bit;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6424 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6425 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6426 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6427 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6428 pParty->uFlags |= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6429 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6430 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6431
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6432 //----- (0044882F) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6433 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6434 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6435 for (size_t i = 0; i < uNumLevelDecorations; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6436 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6437 if (pLevelDecorations[i].uCog == uCog)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6438 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6439 if (pFileName && strcmp(pFileName, "0"))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6440 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6441 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6442 pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6443 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6444
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6445 if (bHide)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6446 pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6447 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6448 pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6449
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6450 pParty->uFlags |= 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6451 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6452 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6453 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6454
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6455 //----- (004356FF) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6456 void back_to_game()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6457 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6458 dword_507BF0_is_there_popup_onscreen = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6459 dword_4E455C = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6460
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6461 extern int no_rightlick_in_inventory;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6462 no_rightlick_in_inventory = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6463
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6464 if (pGUIWindow_ScrollWindow)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6465 free_book_subwindow();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6466 if (!pCurrentScreen && !pGUIWindow_Settings)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6467 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6468 viewparams->bRedrawGameUI = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6469 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6470
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6471 //----- (00494035) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6472 void _494035_timed_effects__water_walking_damage__etc()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6473 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6474 signed __int64 v0; // qax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6475 unsigned int v4; // edi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6476 // signed int v12; // edi@29
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6477 int v24; // ecx@60
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6478 int v26; // ecx@64
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6479 int v28; // ecx@68
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6480 int v30; // ecx@72
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6481 int v32; // ecx@76
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6482 int v34; // ecx@80
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6483 int v36; // ecx@84
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6484 int v38; // ecx@88
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6485 int v40; // ecx@92
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6486 int v42; // ecx@96
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6487 bool v43; // ebx@102
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6488 bool v46; // edi@111
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6489 // unsigned int v56; // [sp-8h] [bp-38h]@55
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6490 // int v59; // [sp-4h] [bp-34h]@55
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6491 // unsigned int v61; // [sp+14h] [bp-1Ch]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6492 signed int a2a; // [sp+18h] [bp-18h]@47
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6493 signed int old_day; // [sp+1Ch] [bp-14h]@47
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6494 signed int old_hour;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6495
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6496 old_day = pParty->uDaysPlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6497 old_hour = pParty->uCurrentHour;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6498 //auto prev_time = pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6499 pParty->uTimePlayed += pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6500 v0 = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60) / 60i64;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6501 v4 = (unsigned int)(((unsigned int)v0 / 24) / 7) >> 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6502 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6503 pParty->uCurrentMinute = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60) % 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6504 pParty->uCurrentHour = v0 % 24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6505 pParty->uCurrentMonthWeek = ((unsigned int)v0 / 24) / 7 & 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6506 pParty->uDaysPlayed = (unsigned int)((unsigned int)v0 / 24) % 28;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6507 pParty->uCurrentMonth = v4 % 12;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6508 pParty->uCurrentYear = v4 / 0xC + game_starting_year;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6509 if (pParty->uCurrentHour >= 3 && (old_hour < 3 || pParty->uDaysPlayed > old_day)) // new day dawns
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6510 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6511 pParty->pHirelings[0].bHasUsedTheAbility = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6512 pParty->pHirelings[1].bHasUsedTheAbility = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6513
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6514 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6515 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6516
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6517 ++pParty->days_played_without_rest;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6518 if (pParty->days_played_without_rest > 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6519 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6520 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6521 pParty->pPlayers[i].SetCondWeakWithBlockCheck(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6522
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6523 if (pParty->uNumFoodRations)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6524 Party::TakeFood(1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6525 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6526 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6527 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6528
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6529 if (pParty->days_played_without_rest > 3)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6530 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6531 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6532 pParty->pPlayers[i].Zero();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6533 if (!pParty->pPlayers[i].IsPertified() && !pParty->pPlayers[i].IsEradicated()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6534 && !pParty->pPlayers[i].IsDead())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6535 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6536 if (rand() % 100 < 5 * pParty->days_played_without_rest)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6537 pParty->pPlayers[i].SetCondDeadWithBlockCheck(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6538 if (rand() % 100 < 10 * pParty->days_played_without_rest)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6539 pParty->pPlayers[i].SetCondInsaneWithBlockCheck(0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6540 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6541 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6542 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6543 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6544 pOutdoor->SetFog();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6545
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6546 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6547 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6548 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6549
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6550 if (pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed)//water damage
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6551 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6552 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6553 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6554 for (uint pl = 1; pl <= 4; ++pl)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6555 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6556 if (pPlayers[pl]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6557 || pPlayers[pl]->HasEnchantedItemEquipped(71)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6558 || pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].uExpireTime > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6559 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6560 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6561 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6562 if (!pPlayers[pl]->HasUnderwaterSuitEquipped())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6563 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6564 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6565 if (pParty->uFlags & 4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6566 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6567 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);// Âû òîíåòå!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6568 GameUI_Footer_TimeLeft = 128;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6569 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6570 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6571 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6572 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6573 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6574 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6575 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6576 if (pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed) //lava damage
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6577 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6578 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6579 pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6580
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6581 for (uint pl = 1; pl <= 4; pl++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6582 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6583 pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6584 if (pParty->uFlags & 0x200)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6585 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6586 strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); //Âû ãîðèòå!
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6587 GameUI_Footer_TimeLeft = 128;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6588 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6589 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6590 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6591 _493938_regenerate();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6592 uint party_condition_flag = 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6593 a2a = pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6594 if (pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)//çàìåäëåíèå âîññòàíîâëåíèÿ ïðè áåãå
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6595 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6596 a2a *= 0.5f;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6597 if (a2a < 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6598 a2a = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6599 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6600
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6601 for (uint pl = 1; pl <= 4; pl++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6602 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6603 if (pPlayers[pl]->uTimeToRecovery)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6604 pPlayers[pl]->Recover(a2a);//âîññòàíîâëåíèå àêòèâíîñòè
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6605 if (pPlayers[pl]->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + pPlayers[pl]->sHealth + pPlayers[pl]->uEndurance >= 1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6606 || (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6607 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6608 if (pPlayers[pl]->sHealth < 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6609 pPlayers[pl]->SetCondition(Condition_Unconcious, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6610 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6611 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6612 pPlayers[pl]->SetCondition(Condition_Dead, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6613 if (pPlayers[pl]->field_E0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6614 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6615 v24 = pPlayers[pl]->field_E0 - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6616 if (v24 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6617 pPlayers[pl]->field_E0 = v24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6618 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6619 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6620 pPlayers[pl]->field_E0 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6621 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6622 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6623 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6624 if (pPlayers[pl]->field_E4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6625 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6626 v26 = pPlayers[pl]->field_E4 - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6627 if (v26 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6628 pPlayers[pl]->field_E4 = v26;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6629 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6630 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6631 pPlayers[pl]->field_E4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6632 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6633 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6634 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6635 if (pPlayers[pl]->field_E8)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6636 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6637 v28 = pPlayers[pl]->field_E8 - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6638 if (v28 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6639 pPlayers[pl]->field_E8 = v28;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6640 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6641 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6642 pPlayers[pl]->field_E8 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6643 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6644 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6645 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6646 if (pPlayers[pl]->field_EC)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6647 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6648 v30 = pPlayers[pl]->field_EC - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6649 if (v30 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6650 pPlayers[pl]->field_EC = v30;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6651 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6652 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6653 pPlayers[pl]->field_EC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6654 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6655 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6656 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6657 if (pPlayers[pl]->field_F0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6658 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6659 v32 = pPlayers[pl]->field_F0 - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6660 if (v32 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6661 pPlayers[pl]->field_F0 = v32;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6662 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6663 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6664 pPlayers[pl]->field_F0 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6665 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6666 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6667 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6668 if (pPlayers[pl]->field_F4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6669 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6670 v34 = pPlayers[pl]->field_F4 - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6671 if (v34 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6672 pPlayers[pl]->field_F4 = v34;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6673 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6674 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6675 pPlayers[pl]->field_F4 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6676 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6677 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6678 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6679 if (pPlayers[pl]->field_F8)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6680 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6681 v36 = pPlayers[pl]->field_F8 - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6682 if (v36 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6683 pPlayers[pl]->field_F8 = v36;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6684 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6685 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6686 pPlayers[pl]->field_F8 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6687 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6688 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6689 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6690 if (pPlayers[pl]->field_FC)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6691 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6692 v38 = pPlayers[pl]->field_FC - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6693 if (v38 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6694 pPlayers[pl]->field_FC = v38;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6695 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6696 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6697 pPlayers[pl]->field_FC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6698 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6699 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6700 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6701 if (pPlayers[pl]->field_100)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6702 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6703 v40 = pPlayers[pl]->field_100 - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6704 if (v40 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6705 pPlayers[pl]->field_100 = v40;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6706 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6707 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6708 pPlayers[pl]->field_100 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6709 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6710 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6711 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6712 if (pPlayers[pl]->field_104)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6713 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6714 v42 = pPlayers[pl]->field_104 - pEventTimer->uTimeElapsed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6715 if (v42 > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6716 pPlayers[pl]->field_104 = v42;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6717 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6718 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6719 pPlayers[pl]->field_104 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6720 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6721 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6722 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6723 if (pPlayers[pl]->pConditions[Condition_Sleep] | pPlayers[pl]->pConditions[Condition_Paralyzed]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6724 | pPlayers[pl]->pConditions[Condition_Unconcious] | pPlayers[pl]->pConditions[Condition_Dead]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6725 | pPlayers[pl]->pConditions[Condition_Pertified] | pPlayers[pl]->pConditions[Condition_Eradicated])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6726 --party_condition_flag;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6727 v43 = (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0; //ñïåøêà
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6728
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6729 for (uint k = 0; k < 24; ++k)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6730 pPlayers[pl]->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6731
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6732 if (v43 && (signed __int64)pPlayers[pl]->pPlayerBuffs[7].uExpireTime <= 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6733 pPlayers[pl]->SetCondition(Condition_Weak, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6734 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6735
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6736 v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6737
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6738 for (uint i = 0; i < 20; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6739 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6740 if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6741 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6742 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6743
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6744 if (v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6745 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6746 for (uint i = 0; i < 4; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6747 pParty->pPlayers[i].SetCondition(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6748 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6749
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6750 for (uint i = 0; i < 2; ++i)//Ïðîâåðêà â ñîçíàíèè ëè ïåðñ ñäåëàâøèé çàêë íà ïîë¸ò è õîæäåíèå ïî âîäå
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6751 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6752 SpellBuff* pBuf = &pParty->pPartyBuffs[Party_Spec_Motion_status_ids[i]];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6753 if (pBuf->uExpireTime == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6754 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6755
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6756 if (!(pBuf->uFlags & 1))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6757 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6758 if (!pPlayers[pBuf->uCaster]->CanAct())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6759 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6760 pBuf->Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6761 if (Party_Spec_Motion_status_ids[i] == PARTY_BUFF_FLY)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6762 pParty->bFlying = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6763 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6764 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6765 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6766
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6767 if (!party_condition_flag)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6768 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6769 if (pCurrentScreen != SCREEN_REST)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6770 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6771 for (uint pl = 1; pl <= 4; pl++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6772 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6773 if (pPlayers[pl]->pConditions[Condition_Sleep])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6774 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6775 pPlayers[pl]->pConditions[Condition_Sleep] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6776 party_condition_flag = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6777 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6778 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6779 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6780 if (!party_condition_flag || _5C35C0_force_party_death)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6781 uGameState = GAME_STATE_PARTY_DIED;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6782 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6783 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6784
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6785 if (uActiveCharacter)//âûáîð ñëåäóþùåãî ïîñëå ïðîïóñêàþùåãî õîä
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6786 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6787 if (pCurrentScreen != SCREEN_REST)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6788 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6789 if (pPlayers[uActiveCharacter]->pConditions[Condition_Sleep]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6790 || pPlayers[uActiveCharacter]->pConditions[Condition_Paralyzed]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6791 || pPlayers[uActiveCharacter]->pConditions[Condition_Unconcious]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6792 || pPlayers[uActiveCharacter]->pConditions[Condition_Dead]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6793 || pPlayers[uActiveCharacter]->pConditions[Condition_Pertified]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6794 || pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6795 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6796 viewparams->bRedrawGameUI = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6797 uActiveCharacter = pParty->GetNextActiveCharacter();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6798 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6799 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6800 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6801 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6802
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6803 //----- (00493938) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6804 void _493938_regenerate()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6805 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6806 int current_time; // edi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6807 int last_reg_time; // qax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6808 int v4; // eax@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6809 int v5; // edi@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6810 long long *v6; // ecx@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6811 char v7; // sf@5
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6812 int *v8; // ecx@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6813 int v9; // edi@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6814 signed int v10; // eax@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6815 // __int16 *v11; // edx@16
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6816 // int v12; // eax@20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6817 int numberOfActorsAffected; // ebx@20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6818 unsigned int v14; // esi@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6819 //unsigned int v15; // ecx@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6820 //unsigned int v16; // eax@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6821 // int v18; // eax@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6822 signed int v19; // eax@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6823 bool recovery_HP; // ebx@25
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6824 // ITEM_EQUIP_TYPE v22; // edi@30
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6825 signed int v25; // eax@33
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6826 // int v26; // eax@35
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6827 // int v27; // eax@36
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6828 // int v28; // eax@37
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6829 signed int v31; // ecx@53
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6830 int actorsAffectedByImmolation[100]; // [sp+4h] [bp-22Ch]@20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6831 SpriteObject a1; // [sp+194h] [bp-9Ch]@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6832 Vec3_int_ a3; // [sp+204h] [bp-2Ch]@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6833 bool has_dragon_flag; // [sp+210h] [bp-20h]@22
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6834 bool lich_jar_flag; // [sp+214h] [bp-1Ch]@25
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6835 bool zombie_flag; // [sp+218h] [bp-18h]@25
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6836 bool decrease_HP; // [sp+21Ch] [bp-14h]@25
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6837 bool lich_flag; // [sp+220h] [bp-10h]@25
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6838 int v49; // [sp+224h] [bp-Ch]@24
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6839 bool recovery_SP; // [sp+228h] [bp-8h]@25
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6840 bool redraw_flag; // [sp+22Ch] [bp-4h]@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6841
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6842 current_time = (signed int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6843 last_reg_time = (signed int)(signed __int64)((double)pParty->uLastRegenerationTime * 0.234375) / 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6844 if (current_time >= (signed int)last_reg_time + 5)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6845 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6846 redraw_flag = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6847 v4 = (current_time - last_reg_time) / 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6848 if (pParty->FlyActive())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6849 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6850 if (pParty->bFlying)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6851 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6852 if (!(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6853 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6854 v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6855 //cursed_flag = pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[Condition_Cursed];//cursed
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6856 //v7 = cursed_flag < v5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6857 //cursed_flag -= v5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6858
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6859 v6 = &pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[Condition_Cursed];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6860
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6861 if (*v6 < v5)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6862 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6863 v6 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6864 pParty->uFlags &= 0xFFFFFFBFu;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6865 pParty->bFlying = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6866 redraw_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6867 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6868 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6869 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6870 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6871
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6872 if (pParty->WaterWalkActive())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6873 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6874 if (pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6875 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6876 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6877 { // taking on water
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6878 v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].pConditions[Condition_Cursed];//&AA1058_PartyQuickSpellSound[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster + 2000];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6879 v7 = *v8 < v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6880 *v8 -= v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6881 if (v7)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6882 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6883 *v8 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6884 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6885 redraw_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6886 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6887 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6888 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6889 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6890
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6891 if (pParty->ImmolationActive())//Æåðòâà
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6892 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6893 a3.z = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6894 a3.y = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6895 a3.x = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6896 a1.stru_24.Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6897 a1.spell_level = pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uPower;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6898 a1.spell_skill = pParty->ImmolationSkillLevel();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6899 v10 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6900 a1.uType = 1070;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6901 a1.spell_id = SPELL_FIRE_IMMOLATION;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6902 v10 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6903 for (uint i = 0; i > pObjectList->uNumObjects; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6904 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6905 if (pObjectList->pObjects[i].uObjectID == stru_4E3ACC[8].uType)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6906 v10 = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6907 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6908 a1.uObjectDescID = v10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6909 a1.field_60_distance_related_prolly_lod = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6910 a1.uAttributes = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6911 a1.uSectorID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6912 a1.uSpriteFrameID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6913 a1.spell_caster_pid = PID(OBJECT_Player, pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].uCaster);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6914 a1.uFacing = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6915 a1.uSoundID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6916 numberOfActorsAffected = pParty->_46A89E_immolation_effect(actorsAffectedByImmolation, 100, 307);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6917 for (v9 = 0; v9 < numberOfActorsAffected; ++v9)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6918 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6919 v14 = actorsAffectedByImmolation[v9];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6920 a1.vPosition.x = pActors[v14].vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6921 a1.vPosition.y = pActors[v14].vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6922 a1.vPosition.z = pActors[v14].vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6923 a1.spell_target_pid = PID(OBJECT_Actor, v14);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6924 v19 = a1.Create(0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6925 Actor::DamageMonsterFromParty(PID(OBJECT_Item, v19), v14, &a3);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6926 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6927 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6928
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6929 has_dragon_flag = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6930 if (PartyHasDragon())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6931 has_dragon_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6932
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6933 for (v49 = 0; v49 < 4; v49++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6934 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6935 recovery_HP = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6936 recovery_SP = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6937 decrease_HP = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6938 lich_flag = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6939 lich_jar_flag = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6940 zombie_flag = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6941
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6942 for (int v22 = 0; (signed int)v22 < 16; v22++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6943 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6944 if (pParty->pPlayers[v49].HasItemEquipped((ITEM_EQUIP_TYPE)v22))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6945 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6946 uint _idx = pParty->pPlayers[v49].pEquipment.pIndices[v22];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6947 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID > 134)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6948 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6949 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_RELIC_ETHRICS_STAFF)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6950 decrease_HP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6951 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HERMES_SANDALS)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6952 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6953 recovery_HP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6954 recovery_SP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6955 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6956 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_MINDS_EYE)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6957 recovery_SP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6958 if (pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uItemID == ITEM_ARTIFACT_HEROS_BELT)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6959 recovery_HP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6960 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6961 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6962 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6963 v25 = pParty->pPlayers[v49].pInventoryItemList[_idx - 1].uSpecEnchantmentType;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6964 if (v25 == 37 //of Regeneration("Regenerate 1hp/x while walking, etc")
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6965 || v25 == 44 //of Life("HP (+10), Regen hpts")
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6966 || v25 == 50 //of The Phoenix("Fire Res (+30), Regen hpts") &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6967 || v25 == 54)// of The Troll("End (+15), Regen hpts")
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6968 recovery_HP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6969 if (v25 == 38 //of Mana("Regenerate 1sp/x while walking, etc")
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6970 || v25 == 47 //of The Eclipse("SP (+10), Regen spts")
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6971 || v25 == 55)//of The Unicorn("Luck (+15), Regen spts")
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6972 recovery_SP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6973 if (v25 == 66)// of Plenty("Regenerate 1 hp/x and 1 sp/x while walking, etc.")
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6974 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6975 recovery_HP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6976 recovery_SP = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6977 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6978 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6979
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6980 if (recovery_HP &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6981 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6982 !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6983 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6984 if (pParty->pPlayers[v49].sHealth < pParty->pPlayers[v49].GetMaxHealth())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6985 ++pParty->pPlayers[v49].sHealth;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6986 if (pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6987 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6988 redraw_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6989 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6990
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6991 if (recovery_SP &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6992 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6993 !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6994 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6995 if (pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6996 ++pParty->pPlayers[v49].sMana;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6997 redraw_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6998 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
6999
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7000 if (decrease_HP &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7001 !pParty->pPlayers[v49].pConditions[Condition_Dead] &&
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7002 !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7003 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7004 --pParty->pPlayers[v49].sHealth;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7005 if (!(pParty->pPlayers[v49].pConditions[Condition_Unconcious]) && pParty->pPlayers[v49].sHealth < 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7006 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7007 if (pParty->pPlayers[v49].sHealth < 1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7008 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7009 if (pParty->pPlayers[v49].sHealth + pParty->pPlayers[v49].uEndurance + pParty->pPlayers[v49].GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) >= 1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7010 || (signed __int64)pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7011 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7012 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7013 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7014 if (!pParty->pPlayers[v49].pConditions[Condition_Dead])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7015 pParty->pPlayers[v49].pConditions[Condition_Dead] = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7016 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7017 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7018 redraw_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7019 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7020 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7021 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7022
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7023 //regeneration
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7024 if (pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uExpireTime > 0
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7025 && !pParty->pPlayers[v49].pConditions[Condition_Dead]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7026 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7027 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7028 pParty->pPlayers[v49].sHealth += 5 * pParty->pPlayers[v49].pPlayerBuffs[PLAYER_BUFF_REGENERATION].uPower;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7029 if (pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7030 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].GetMaxHealth();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7031 if (pParty->pPlayers[v49].pConditions[Condition_Unconcious] && pParty->pPlayers[v49].sHealth > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7032 pParty->pPlayers[v49].pConditions[Condition_Unconcious] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7033 redraw_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7034 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7035
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7036 //for warlock
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7037 if (has_dragon_flag && pParty->pPlayers[v49].classType == PLAYER_CLASS_WARLOCK)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7038 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7039 if (pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7040 ++pParty->pPlayers[v49].sMana;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7041 redraw_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7042 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7043
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7044 //for lich
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7045 if (pParty->pPlayers[v49].classType == PLAYER_CLASS_LICH)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7046 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7047 for (v31 = 0; v31 < 126; ++v31)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7048 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7049 if (pParty->pPlayers[v49].pInventoryItemList[v31].uItemID == ITEM_LICH_JAR_FULL)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7050 lich_jar_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7051 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7052 lich_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7053 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7054 if (lich_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7055 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7056 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7057 if (pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7058 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7059 if (pParty->pPlayers[v49].sMana > pParty->pPlayers[v49].GetMaxMana() / 2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7060 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7061 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7062 if (lich_jar_flag)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7063 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7064 if (pParty->pPlayers[v49].sMana < pParty->pPlayers[v49].GetMaxMana())
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7065 ++pParty->pPlayers[v49].sMana;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7066 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7067
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7068 //for zombie
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7069 if (pParty->pPlayers[v49].pConditions[Condition_Zombie])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7070 zombie_flag = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7071 if (zombie_flag && !pParty->pPlayers[v49].pConditions[Condition_Dead]
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7072 && !pParty->pPlayers[v49].pConditions[Condition_Eradicated])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7073 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7074 if (pParty->pPlayers[v49].sHealth > pParty->pPlayers[v49].GetMaxHealth() / 2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7075 pParty->pPlayers[v49].sHealth = pParty->pPlayers[v49].sHealth - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7076 if (pParty->pPlayers[v49].sMana > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7077 pParty->pPlayers[v49].sMana = pParty->pPlayers[v49].sMana - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7078 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7079 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7080 pParty->uLastRegenerationTime = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7081 if (!viewparams->bRedrawGameUI)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7082 viewparams->bRedrawGameUI = redraw_flag;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7083 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7084 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7085
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7086 //----- (00491E3A) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7087 void sub_491E3A()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7088 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7089 signed int v1; // esi@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7090 unsigned int v3; // eax@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7091 unsigned int v4; // edx@8
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7092 int v6; // edi@17
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7093
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7094 //__debugbreak();//Ritor1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7095 for (uint pl = 0; pl < 4; pl++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7096 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7097 if (SoundSetAction[24][0])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7098 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7099 v3 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7100 for (v1 = 0; v1 < (signed int)pSoundList->sNumSounds; ++v1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7101 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7102 int ps = 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998;//6728
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7103 if (pSoundList->pSL_Sounds[v1].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4998)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7104 v3 = v1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7105 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7106 pSoundList->UnloadSound(v3, 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7107 for (v4 = 0; (signed int)v4 < (signed int)pSoundList->sNumSounds; ++v4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7108 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7109 if (pSoundList->pSL_Sounds[v4].uSoundID == 2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[pl].uVoiceID) + 4999)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7110 pSoundList->UnloadSound(v4, 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7111 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7112 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7113 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7114 v6 = pIcons_LOD->uNumLoadedFiles - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7115 if (v6 >= pIcons_LOD->pFacesLock)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7116 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7117 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7118 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7119 pIcons_LOD->pTextures[v6].Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7120 if (pIcons_LOD->pHardwareTextures)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7121 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7122 if (pIcons_LOD->pHardwareTextures[v6])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7123 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7124 pIcons_LOD->pHardwareTextures[v6]->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7125 pIcons_LOD->pHardwareTextures[v6] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7126 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7127 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7128 if (pIcons_LOD->pHardwareSurfaces)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7129 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7130 if (pIcons_LOD->pHardwareSurfaces[v6])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7131 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7132 pIcons_LOD->pHardwareSurfaces[v6]->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7133 pIcons_LOD->pHardwareSurfaces[v6] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7134 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7135 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7136 --v6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7137 } while (v6 >= pIcons_LOD->pFacesLock);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7138 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7139 pIcons_LOD->uNumLoadedFiles = pIcons_LOD->pFacesLock;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7140 pIcons_LOD->pFacesLock = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7141 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7142 // 4ED498: using guessed type char byte_4ED498;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7143
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7144 //----- (00494820) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7145 unsigned int __fastcall _494820_training_time(unsigned int a1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7146 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7147 signed int v1; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7148
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7149 v1 = 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7150 if (a1 % 24 >= 5)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7151 v1 = 29;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7152 return v1 - a1 % 24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7153 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7154
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7155 //----- (00494836) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7156 int stru339_spell_sound::AddPartySpellSound(int uSoundID, int a6)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7157 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7158 int v3; // esi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7159 int result; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7160 //stru339_spell_sound *v5; // ebx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7161 //int *v6; // edi@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7162 unsigned int v7; // eax@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7163 int v8; // [sp+Ch] [bp-8h]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7164 int v9; // [sp+10h] [bp-4h]@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7165 int a2a; // [sp+1Ch] [bp+8h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7166 //return 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7167 v3 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7168 result = word_4EE088_sound_ids[uSoundID];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7169 //v5 = this;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7170 a2a = word_4EE088_sound_ids[uSoundID];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7171 if (word_4EE088_sound_ids[uSoundID])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7172 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7173 //v6 = this->pSoundsOffsets;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7174 for (v9 = 0; v9 < 2; ++v9)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7175 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7176 v7 = a2a++;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7177 result = pSoundList->LoadSound(v7, (char *)this + v3, 44744 - v3, &v8, a6);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7178 if (!result)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7179 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7180 a6 += 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7181 result = v8 + 256;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7182 this->pSoundsOffsets[v9] = v3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7183 v3 += result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7184 this->pSoundsSizes[v9] = v8 + 256;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7185 //++v6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7186 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7187 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7188 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7189 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7190 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7191
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7192 //----- (00443E31) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7193 void LoadLevel_InitializeLevelStr()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7194 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7195
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7196 // char Args[100];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7197 int string_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7198 int max_string_length;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7199 // int current_string_length;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7200 int prev_string_offset;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7201
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7202 if (sizeof(pLevelStrOffsets) != 2000)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7203 Log::Warning(L"pLevelStrOffsets: deserialization warning");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7204 memset(pLevelStrOffsets.data(), 0, 2000);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7205
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7206 max_string_length = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7207 string_num = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7208 prev_string_offset = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7209 pLevelStrOffsets[0] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7210 for (uint i = 0; i < uLevelStrFileSize; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7211 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7212 if (!pLevelStr[i])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7213 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7214 pLevelStrOffsets[string_num] = i + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7215 ++string_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7216 if (i - prev_string_offset > max_string_length)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7217 max_string_length = i - prev_string_offset;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7218 prev_string_offset = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7219 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7220 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7221
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7222 uLevelStrNumStrings = string_num - 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7223 if (max_string_length > 800)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7224 Error("MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length + 1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7225
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7226 if (uLevelStrNumStrings > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7227 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7228 for (uint i = 0; i <uLevelStrNumStrings; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7229 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7230 if (RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]])
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7231 ++pLevelStrOffsets[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7232 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7233 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7234 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7235
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7236 //----- (00443F95) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7237 void OnMapLeave()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7238 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7239 _evt_raw *test_event;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7240 if (uLevelEVT_NumEvents > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7241 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7242 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7243 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7244 test_event = (_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7245 if (test_event->_e_type == EVENT_OnMapLeave)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7246 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7247 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7248 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7249 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7250 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7251 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7252
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7253 //----- (00443FDC) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7254 void OnMapLoad()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7255 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7256 int v6; // eax@9
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7257 unsigned __int64 v8; // qax@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7258 int hours; // ebx@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7259 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7260 unsigned int seconds; // [sp+14h] [bp-3Ch]@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7261 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7262 unsigned int minutes; // [sp+2Ch] [bp-24h]@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7263 unsigned int years; // [sp+34h] [bp-1Ch]@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7264 unsigned int weeks; // [sp+38h] [bp-18h]@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7265 int v26; // [sp+3Ch] [bp-14h]@15
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7266 unsigned int days; // [sp+3Ch] [bp-14h]@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7267 unsigned int months; // [sp+40h] [bp-10h]@26
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7268
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7269 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7270 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7271 EventIndex pEvent = pLevelEVT_Index[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7272
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7273 _evt_raw* _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7274
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7275 if (_evt->_e_type == EVENT_PlaySound)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7276 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7277 else if (_evt->_e_type == EVENT_OnMapReload)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7278 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7279 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7280 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7281 //v3 = &MapsLongTimersList[MapsLongTimers_count];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7282 v20 = pOutdoor->loc_time.uLastVisitDay;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7283 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7284 v20 = pIndoor->stru1.uLastVisitDay;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7285
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7286 MapsLongTimersList[MapsLongTimers_count].timer_evt_type = _evt->_e_type;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7287 MapsLongTimersList[MapsLongTimers_count].timer_evt_ID = pEvent.uEventID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7288 MapsLongTimersList[MapsLongTimers_count].timer_evt_seq_num = pEvent.event_sequence_num;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7289
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7290 MapsLongTimersList[MapsLongTimers_count].YearsInterval = _evt->v5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7291 MapsLongTimersList[MapsLongTimers_count].MonthsInterval = _evt->v6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7292 MapsLongTimersList[MapsLongTimers_count].WeeksInterval = _evt->v7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7293 MapsLongTimersList[MapsLongTimers_count].HoursInterval = _evt->v8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7294 MapsLongTimersList[MapsLongTimers_count].MinutesInterval = _evt->v9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7295 MapsLongTimersList[MapsLongTimers_count].SecondsInterval = _evt->v10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7296
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7297
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7298 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7299
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7300 MapsLongTimersList[MapsLongTimers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7301 MapsLongTimersList[MapsLongTimers_count].IntervalHalfMins = ((unsigned short)_evt->v12 << 8) + _evt->v11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7302 if (MapsLongTimersList[MapsLongTimers_count].timer_evt_type == EVENT_Initialize && !(short)v6)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7303 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7304 if (v20)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7305 v18 = pParty->uTimePlayed - v20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7306 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7307 v18 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7308 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7309
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7310 if (v26 / 7 / 4 / 12 != 0 && MapsLongTimersList[MapsLongTimers_count].YearsInterval ||
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7311 v26 / 7 / 4 != 0 && MapsLongTimersList[MapsLongTimers_count].MonthsInterval != 0 ||
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7312 v26 / 7 != 0 && MapsLongTimersList[MapsLongTimers_count].WeeksInterval != 0 ||
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7313 v26 != 0 || !v20)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7314 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7315 ++MapsLongTimers_count;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7316 MapsLongTimersList[MapsLongTimers_count].NextStartTime = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7317 continue;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7318 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7319 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7320 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7321 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7322 v8 = (__int64)((double)pParty->uTimePlayed * 0.234375);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7323 seconds = v8 % 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7324 minutes = (v8 / 60) % 60;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7325 hours = ((v8 / 60) / 60) % 24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7326 days = (((v8 / 60) / 60) / 24) % 7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7327 weeks = ((((v8 / 60) / 60) / 24) / 7) % 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7328 months = (((((v8 / 60) / 60) / 24) / 7) / 4) % 12;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7329 years = (((((v8 / 60) / 60) / 24) / 7) / 4) / 12;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7330
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7331 if (MapsLongTimersList[MapsLongTimers_count].YearsInterval)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7332 ++years;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7333 else if (MapsLongTimersList[MapsLongTimers_count].MonthsInterval)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7334 ++months;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7335 else if (MapsLongTimersList[MapsLongTimers_count].WeeksInterval)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7336 ++weeks;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7337 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7338 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7339 ++days;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7340 hours = MapsLongTimersList[MapsLongTimers_count].HoursInterval;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7341 minutes = MapsLongTimersList[MapsLongTimers_count].MinutesInterval;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7342 seconds = MapsLongTimersList[MapsLongTimers_count].SecondsInterval;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7343 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7344 MapsLongTimersList[MapsLongTimers_count].NextStartTime = (signed __int64)((double)((seconds
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7345 + 60 * minutes
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7346 + 3600 * hours
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7347 + 86400 * days
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7348 + 604800 * weeks
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7349 + 2419200 * months
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7350 + 29030400 * years) << 7)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7351 * 0.033333335);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7352
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7353 ++MapsLongTimers_count;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7354 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7355 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7356 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7357 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7358
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7359 //----- (00444360) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7360 void Level_LoadEvtAndStr(const char *pLevelName)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7361 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7362 char pContainerName[120]; // [sp+8h] [bp-98h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7363
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7364 sprintf(pContainerName, "%s.evt", pLevelName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7365 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7366
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7367 sprintf(pContainerName, "%s.str", pLevelName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7368 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7369 if (uLevelStrFileSize)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7370 LoadLevel_InitializeLevelStr();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7371 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7372
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7373 //----- (004452BB) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7374 void sub_4452BB()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7375 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7376 pGUIWindow2->Release();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7377 pGUIWindow2 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7378 activeLevelDecoration = _591094_decoration;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7379 EventProcessor(dword_5C3418, 0, 1, dword_5C341C);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7380 activeLevelDecoration = nullptr;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7381 pEventTimer->Resume();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7382 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7383
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7384 //----- (0044100D) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7385 bool _44100D_should_alter_right_panel()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7386 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7387 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS ||
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7388 pCurrentScreen == SCREEN_HOUSE || pCurrentScreen == SCREEN_E ||
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7389 pCurrentScreen == SCREEN_CHANGE_LOCATION || pCurrentScreen == SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7390 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7391
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7392 //----- (0044987B) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7393 void Transition_StopSound_Autosave(const char *pMapName, MapStartPoint start_point)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7394 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7395 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7396 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7397 if (_stricmp(pCurrentMapName, pMapName))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7398 SaveGame(1, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7399
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7400 uGameState = GAME_STATE_CHANGE_LOCATION;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7401 strcpy(pCurrentMapName, pMapName);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7402 uLevel_StartingPointType = start_point;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7403 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7404 // 6BE35C: using guessed type int uLevel_StartingPointType;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7405
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7406 //----- (004451A8) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7407 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7408 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7409 if (!pGUIWindow2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7410 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7411 if (pParty->uFlags & 2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7412 pGame->Draw();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7413 pAudioPlayer->StopChannels(-1, -1);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7414 pMiscTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7415 pEventTimer->Pause();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7416 dword_5C3418 = a1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7417 dword_5C341C = a2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7418 _591094_decoration = activeLevelDecoration;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7419 pGUIWindow2 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_GreetingNPC, a4, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7420 pGUIWindow2->CreateButton(61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7421 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7422 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7423 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7424 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7425 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7426
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7427
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7428
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7429
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7430 //----- (00448B67) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7431 void OnTimer(int)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7432 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7433 if (pEventTimer->bPaused)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7434 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7435
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7436 long long v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7437 if (!v13)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7438 return;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7439
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7440 //uint _v2v3 = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7441 //v3 = HIDWORD(pParty->uTimePlayed);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7442 //v2 = LODWORD(pParty->uTimePlayed);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7443
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7444 _5773B8_event_timer = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7445
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7446 for (uint i = 0; i < MapsLongTimers_count; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7447 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7448 //v4 = (char *)&array_5B5928_timers[0].field_C;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7449 MapsLongTimer* timer = &MapsLongTimersList[i];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7450 //while ( 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7451 //{
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7452 //v5 = *(short *)v4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7453 if (timer->time_left_to_fire)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7454 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7455 if (v13 < timer->time_left_to_fire)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7456 timer->time_left_to_fire -= v13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7457 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7458 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7459 timer->time_left_to_fire = timer->IntervalHalfMins;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7460 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7461 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7462 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7463 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7464 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7465 if (timer->NextStartTime < pParty->uTimePlayed)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7466 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7467 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7468 if (timer->YearsInterval)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7469 next_trigger_time = 336 * 60 * 60 * 24; // 1 year
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7470 else if (timer->MonthsInterval)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7471 next_trigger_time = 28 * 60 * 60 * 24; // 1 month
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7472 else if (timer->WeeksInterval)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7473 next_trigger_time = 7 * 60 * 60 * 24; // 1 week
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7474
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7475 timer->NextStartTime += (next_trigger_time * 128) / 3.0f;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7476 if (timer->NextStartTime < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7477 timer->NextStartTime = pParty->uTimePlayed;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7478
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7479 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7480 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7481 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7482 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7483 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7484
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7485
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7486
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7487
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7488
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7489
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7490
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7491 //----- (0044C28F) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7492 bool TeleportToNWCDungeon()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7493 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7494 if (!_stricmp("nwc.blv", pCurrentMapName))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7495 return false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7496
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7497 _5B65A8_npcdata_uflags_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7498 _5B65AC_npcdata_fame_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7499 _5B65B0_npcdata_rep_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7500 _5B65B4_npcdata_loword_house_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7501 _5B65B8_npcdata_hiword_house_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7502 dword_5B65BC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7503 dword_5B65C0 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7504
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7505 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7506 Transition_StopSound_Autosave("nwc.blv", MapStartPoint_Party);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7507 pCurrentScreen = SCREEN_GAME;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7508 return true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7509 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7510
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7511 //----- (00401000) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7512 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int(*constructor)(int))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7513 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7514 void *v4; // esi@2
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7515
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7516 if (numObjs > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7517 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7518 v4 = a1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7519 for (int i = numObjs; i; --i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7520 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7521 constructor((int)v4);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7522 v4 = (char *)v4 + objSize;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7523 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7524 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7525 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7526
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7527
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7528