annotate Game.cpp @ 23:509744251c8e

Player-related members
author Nomad
date Sun, 14 Oct 2012 00:27:38 +0200
parents 540178ef9b18
children 93bf1d5f6a6d
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include "Game.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2 #include "Party.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3 #include "IndoorCamera.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "Math.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5 #include "LightmapBuilder.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6 #include "Viewport.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7 #include "Time.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8 #include "Outdoor.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9 #include "Overlays.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10 #include "stru279.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11 #include "AudioPlayer.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12 #include "LOD.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13 #include "OSInfo.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14 #include "GUIWindow.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15 #include "Party.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16 #include "TurnEngine.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17 #include "stru157.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18 #include "VideoPlayer.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19 #include "Bink_Smacker.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20 #include "Events.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 #include "Arcomage.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23 //#include "MM7.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 Game *pGame;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 //----- (00435694) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 void Game::ToggleFlags2(unsigned int uFlag)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39 unsigned int v2; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 v2 = this->uFlags2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 if ( v2 & uFlag )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 this->uFlags2 = v2 & ~uFlag;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45 this->uFlags2 = uFlag | v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
46 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
48 //----- (0044103C) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
49 void Game::Draw()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
50 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
51 Render *v0; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
52 int _null; // ebx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
53 float v2; // ST24_4@11
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
54 //double v3; // ST28_8@11
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
55 int v4; // edi@26
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
56 int v5; // eax@35
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
57
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
58 uFlags2 &= 0xFFFFFFFDu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
59 if ( pParty->_497FC5_check_party_perception_against_level() )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
60 uFlags2 |= 2u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61 pIndoorCamera->sRotationX = pParty->sRotationX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
62 pIndoorCamera->sRotationY = pParty->sRotationY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
63 pIndoorCamera->pos.x = pParty->vPosition.x
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
64 - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
65 * (signed __int64)pParty->field_18) >> 16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
66 pIndoorCamera->pos.y = pParty->vPosition.z
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
67 - ((unsigned __int64)(stru_5C6E00->SinCos(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
68 pParty->sRotationY - stru_5C6E00->uIntegerHalfPi)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
69 * (signed __int64)pParty->field_18) >> 16);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
70 pIndoorCamera->pos.z = pParty->vPosition.y + pParty->sEyelevel;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
71 pIndoorCamera->Initialize2();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72 pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
73 pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
74 //v0 = &pRenderer;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
75 if ( pVideoPlayer->AnyMovieLoaded() )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
76 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
77 _null = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
78 if ( pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
79 goto LABEL_22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
80 pRenderer->SetGameRenderStates();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
81 pMouse->_469E3B();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
82 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
83 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
84 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 if ( pParty->vPosition.x != pParty->vPrevPosition.x | pParty->sRotationY != pParty->sPrevRotationY | pParty->vPosition.z != pParty->vPrevPosition.z | pParty->sRotationX != pParty->sPrevRotationX | pParty->vPosition.y != pParty->vPrevPosition.y | pParty->sEyelevel != pParty->sPrevEyelevel )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86 pParty->uFlags |= 2u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87 pParty->vPrevPosition.x = pParty->vPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
88 pParty->vPrevPosition.y = pParty->vPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
89 //v0 = &pRenderer;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
90 pParty->sPrevRotationY = pParty->sRotationY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
91 pParty->vPrevPosition.z = pParty->vPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
92 pParty->sPrevRotationX = pParty->sRotationX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
93 pParty->sPrevEyelevel = pParty->sEyelevel;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
94 pRenderer->SetGameRenderStates();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
95 _null = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
96 if ( !pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
97 pMouse->_469E3B();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
98 if ( !sub_4226C2() || viewparams->field_48 == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
99 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
100 if ( pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
101 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
102 v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0;
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
103 //v3 = v2 + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
104 //pRenderer->field_1036A8_bitmapid = LODWORD(v3);
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
105 pRenderer->field_1036A8_bitmapid = floorf(v2 + 0.5f);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
106 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
107
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
108 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
109 pIndoor->Draw();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
110 else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
111 pOutdoor->Draw();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
113 if ( pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 pDecalBuilder->DrawBloodsplats();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
116 if ( pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
117 pGame->pLightmapBuilder->DrawLightmaps(2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
118 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
120 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
121 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
122 LABEL_22:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
123 pRenderer->BeginScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
124 if ( pRenderer->pRenderD3D != (RenderD3D *)_null )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
125 pMouse->_469E3B();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
126 if ( pOtherOverlayList->field_3EC != _null )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
127 viewparams->bRedrawGameUI = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
128 v4 = viewparams->bRedrawGameUI;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
129 GameUI_DrawStatusBar();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
130 if ( viewparams->bRedrawGameUI == _null )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
131 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
132 //nullsub_1();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
133 GameUI_DrawRightPanelItems();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
134 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
135 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
136 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
137 GameUI_DrawRightPanelFrames();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
138 GameUI_DrawStatusBar_2();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
139 viewparams->bRedrawGameUI = _null;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
140 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
141 if ( pVideoPlayer->pSmackerMovie == (_SMACK *)_null )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
142 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
143 GameUI_DrawMinimap(0x1E8u, 0x10u, 0x271u, 0x85u, viewparams->uMinimapZoom, pParty->uFlags & 2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
144 if ( v4 != _null )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
145 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
146 if ( !sub_4226C2() && pRenderer->pRenderD3D != (RenderD3D *)_null )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
147 pRenderer->FillRect2(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
148 _null,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
149 pViewport->uViewportX,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
150 pViewport->uViewportY,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
151 pViewport->uViewportZ - pViewport->uViewportX,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
152 pViewport->uViewportW - pViewport->uViewportY + 1,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
153 LOWORD(pRenderer->uTargetGMask) | LOWORD(pRenderer->uTargetBMask));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
154 viewparams->field_48 = _null;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
155 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
156 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
157 v5 = pOtherOverlayList->field_3EC;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
158 pOtherOverlayList->field_3EC = _null;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
159 viewparams->bRedrawGameUI = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
160 GameUI_DrawPartySpells();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
161 if ( v4 != _null || pParty->pHirelings[0].evtc != _null || pParty->pHirelings[1].evtc != _null )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
162 DrawHiredNPCs();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
163 GameUI_DrawPortraits(v4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
164 GameUI_DrawLifeManaBars();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
165 GameUI_DrawCharacterSelectionFrame();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
166 if ( sub_44100D() )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
167 draw_right_panel();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
168 if ( !pVideoPlayer->AnyMovieLoaded() )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
169 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
170 pStru6Instance->DrawPlayerBuffAnims();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
171 pOtherOverlayList->_441964(v4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
172 GameUI_DrawTorchlightAndWizardEye();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
173 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
174 GUI_UpdateWindows();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
175 pParty->_4909F4();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
176 ++stru_51076C.field_8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
177 dword_5B5924 = _null;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
178 if ( v4 != _null )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
179 pMouse->field_14 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
180 pMouse->_469EA4();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
181 pMouse->DrawCursor();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
182 pMouse->_469E1C();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
183 pRenderer->EndScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
184 pRenderer->Present();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
185 pParty->uFlags &= 0xFFFFFFFDu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
186 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
187 // 5B5924: using guessed type int dword_5B5924;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
188
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
189
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
190 //----- (0047A815) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
191 void Game::DrawParticles()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
192 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
193 pParticleEngine->Draw();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
194 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
195
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
196 //----- (00463149) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
197 void Game::Loop()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
198 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
199 signed int v0; // ebp@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
200 signed int v1; // esi@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
201 Render *v2; // edi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
202 signed int v3; // esi@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
203 signed int v4; // ecx@58
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
204 char *v5; // eax@59
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
205 Player *v6; // esi@65
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
206 OtherOverlay *v7; // esi@67
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
207 signed int v8; // edi@67
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
208 int v9; // edi@69
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
209 int *pHealth; // esi@71
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
210 signed int v11; // esi@78
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
211 int v12; // eax@83
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
212 const char *v13; // [sp-4h] [bp-68h]@74
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
213 bool bLoading; // [sp+10h] [bp-54h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
214 signed int bLoadinga; // [sp+10h] [bp-54h]@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
215 signed int v16; // [sp+14h] [bp-50h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
216 int v17[4]; // [sp+18h] [bp-4Ch]@80
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
217 MSG Msg; // [sp+28h] [bp-3Ch]@20
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
218 char Source[64]; // [sp+44h] [bp-20h]@76
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
219
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
220 bLoading = uCurrentMenuID == MENU_LOAD;
23
509744251c8e Player-related members
Nomad
parents: 3
diff changeset
221 SetCurrentMenuID((MENU_STATE)-1);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
222 if ( bLoading )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
223 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
224 pParty->Reset();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
225 dword_6BE340 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
226 uGameState = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
227 LoadGame(uLoadGameUI_SelectedSlot);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
228 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
229 v0 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
230 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
231 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
232 v1 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
233 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
234 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
235 sprintfex(pTmpBuf, "data\\lloyd%d%d.pcx", v0, v1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
236 remove(pTmpBuf);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
237 ++v1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
238 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
239 while ( v1 < 6 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
240 ++v0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
241 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
242 while ( v0 < 5 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
243 LoadPlayerPortraintsAndVoices();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
244 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
245 pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
246 v2 = pRenderer;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
247 v3 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
248 while ( 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
249 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
250 v16 = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
251 if ( pMessageQueue_50CBD0->uNumMessages )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
252 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
253 pPartyActionQueue->uNumActions = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
254 if ( pParty->bTurnBasedModeOn == v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
255 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
256 pTurnEngine->End(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
257 pParty->bTurnBasedModeOn = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
258 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
259 DoPrepareWorld(bLoading, v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
260 pEventTimer->Resume();
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
261 dword_6BE364_game_settings_1 |= 0x80;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
262 dword_6BE340 = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
263 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
264 if (pAsyncMouse)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
265 pAsyncMouse->Resume();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
266 if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
267 pAsyncKeyboard->Resume();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
268 if ( pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
269 pGame->pVisInstance->_4C1A02();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
270 bLoadinga = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
271 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
272 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
273 while ( PeekMessageA(&Msg, 0, 0, 0, v3) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
274 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
275 if ( Msg.message == WM_QUIT )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
276 Game_DeinitializeAndTerminate(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
277 TranslateMessage(&Msg);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
278 DispatchMessageA(&Msg);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
279 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
280 if ( BYTE1(dword_6BE364_game_settings_1) & 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
281 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
282 WaitMessage();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
283 continue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
284 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
285 pGame->_44EEA7();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
286 GameUI_WritePointedObjectStatusString();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
287 ProcessInputActions();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
288 GameUI_MsgProc();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
289 if ( pArcomageGame->bGameInProgress )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
290 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
291 ArcomageGame::Loop();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
292 LABEL_89:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
293 v2->Present();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
294 continue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
295 }
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
296 if (pAsyncMouse)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
297 pAsyncMouse->_46B736_consume_click_lists(v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
298 if ( pVideoPlayer->pSmackerMovie && !SmackWait(pVideoPlayer->pSmackerMovie) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
299 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
300 v2->BeginScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
301 pMouse->_469E3B();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
302 pVideoPlayer->SmackUpdatePalette(pVideoPlayer->hWindow);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
303 pMouse->_469EA4();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
304 v2->EndScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
305 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
306 if ( pVideoPlayer->pBinkMovie && !BinkWait(pVideoPlayer->pBinkMovie) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
307 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
308 v2->BeginScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
309 pMouse->_469E3B();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
310 pVideoPlayer->BinkUpdatePalette(pVideoPlayer->hWindow);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
311 pMouse->_469EA4();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
312 v2->EndScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
313 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
314 pEventTimer->Update();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
315 pMiscTimer->Update();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
316 OnTimer(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
317 GameUI_StatusBar_UpdateTimedString(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
318 if ( pMiscTimer->bPaused && !pEventTimer->bPaused )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
319 pMiscTimer->Resume();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
320 if ( pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
321 pEventTimer->bTackGameTime = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
322 if ( !pEventTimer->bPaused && !uGameState )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
323 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
324 if ( !pEventTimer->bTackGameTime )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
325 _494035_timed_effects__water_walking_damage__etc();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
326 if ( dword_6BE364_game_settings_1 & 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
327 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
328 dword_6BE364_game_settings_1 &= 0xFFFFFFFEu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
329 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
330 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
331 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
332 sub_401A91_AI();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
333 sub_46BDC0_UpdateUserInput_and_MapSpecificStuff();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
334 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
335 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
336 if ( v16 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
337 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
338 v16 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
339 viewparams->bRedrawGameUI = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
340 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
341 pAudioPlayer->_4AAFCF();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
342 if ( uGameState == v3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
343 goto LABEL_96;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
344 if ( uGameState == 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
345 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
346 pAudioPlayer->StopChannels(-1, -1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
347 PrepareWorld(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
348 uGameState = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
349 continue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
350 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
351 if ( (signed int)uGameState <= 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
352 goto LABEL_85;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
353 if ( (signed int)uGameState <= 5 || uGameState == 7 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
354 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
355 LABEL_96:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
356 bLoadinga = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
357 continue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
358 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
359 if ( uGameState != 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
360 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
361 if ( uGameState != 9 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
362 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
363 LABEL_85:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
364 pGame->Draw();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
365 continue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
366 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
367 pRenderer->BeginScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
368 GUI_UpdateWindows();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
369 pRenderer->EndScene();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
370 goto LABEL_89;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
371 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
372 pAudioPlayer->StopChannels(-1, -1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
373 memset(pParty->pHirelings, 0, 0x4Cu);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
374 memset(&pParty->pHirelings[1], 0, 0x4Cu);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
375 v4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
376 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
377 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
378 v5 = (char *)&pNPCStats->pNewNPCData[0].uFlags;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
379 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
380 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
381 if ( *((int *)v5 + 6) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
382 *v5 &= 0x7Fu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
383 ++v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
384 v5 += 76;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
385 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
386 while ( v4 < (signed int)pNPCStats->uNumNewNPCs );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
387 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
388 pVideoPlayer->PlayDeathMovie();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
389 if ( pVideoPlayer->AnyMovieLoaded() )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
390 pVideoPlayer->Unload();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
391 SaveGame(0, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
392 ++pParty->uNumDeaths;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
393 v6 = pParty->pPlayers;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
394 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
395 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
396 v6->SetVariable(VAR_Award, 85);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
397 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
398 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
399 while ( (signed int)v6 < (signed int)pParty->pHirelings );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
400 pParty->field_764 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
401 pParty->uTimePlayed += 0x276000ui64;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
402 LOWORD(pParty->uFlags) &= 0xFDFBu;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
403 pParty->SetGold(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
404 v7 = pOtherOverlayList->pOverlays;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
405 v8 = 50;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
406 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
407 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
408 v7->Reset();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
409 ++v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
410 --v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
411 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
412 while ( v8 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
413 memset(pParty->pPartyBuffs, 0, 0x140u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
414 v9 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
415 if ( pParty->bTurnBasedModeOn == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
416 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
417 pTurnEngine->End(1u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
418 pParty->bTurnBasedModeOn = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
419 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
420 pHealth = &pParty->pPlayers[0].sHealth;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
421 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
422 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
423 memset(pHealth - 0x64F, 0, 0xA0u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
424 memset(pHealth - 0x67, 0, 0x180u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
425 *pHealth = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
426 pHealth += 1743;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
427 uActiveCharacter = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
428 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
429 while ( (signed int)pHealth < (signed int)&pParty->field_871C[567] );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
430 if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 136) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
431 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
432 pParty->vPosition.x = -17331; // respawn in harmondale
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
433 pParty->vPosition.z = 12547;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
434 pParty->vPosition.y = 465;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
435 pParty->sRotationY = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
436 v13 = "out02.odm";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
437 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
438 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
439 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
440 pParty->vPosition.x = 12552; // respawn on emerald isle
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
441 pParty->vPosition.z = 1816;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
442 pParty->vPosition.y = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
443 pParty->sRotationY = 512;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
444 v13 = "out01.odm";
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
445 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
446 strcpy(Source, v13);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
447 pParty->uFallStartY = pParty->vPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
448 pParty->sRotationX = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
449 pParty->uFallSpeed = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
450 pParty->field_6E4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
451 pParty->field_6E0 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
452 if ( _strcmpi(Source, pCurrentMapName) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
453 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
454 strcpy(pCurrentMapName, Source);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
455 _5B65A8_npcdata_uflags_or_other = pParty->vPosition.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
456 _5B65AC_npcdata_fame_or_other = pParty->vPosition.z;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
457 _5B65B0_npcdata_rep_or_other = pParty->vPosition.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
458 _5B65B4_npcdata_loword_house_or_other = pParty->sRotationY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
459 _5B65B8_npcdata_hiword_house_or_other = pParty->sRotationX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
460 dword_5B65C0 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
461 PrepareWorld(1u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
462 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
463 UpdateActors();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
464 v11 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
465 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
466 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
467 if ( pPlayers[v9]->CanAct() )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
468 v17[v11++] = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
469 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
470 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
471 while ( v9 <= 4 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
472 if ( v11 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
473 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
474 v12 = rand();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
475 pPlayers[v17[v12 % v11]]->PlaySound(99, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
476 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
477 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2u);// "Once again you've cheated death!.."
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
478 uGameState = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
479 v3 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
480 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
481 while ( !bLoadinga );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
482 dword_6BE340 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
483 pEventTimer->Pause();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
484 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
485 if ( uGameState == 3 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
486 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
487 sub_491E3A();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
488 LoadPlayerPortraintsAndVoices();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
489 uGameState = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
490 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
491 bLoading = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
492 continue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
493 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
494 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
495 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
496 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 16;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
497 sub_491E3A();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
498 }
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
499
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
500
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
501
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
502
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
503 //----- (0044F192) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
504 void Game::PushStru165s()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
505 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
506 Game *v1; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
507 int v2; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
508 float *v3; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
509
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
510 auto a1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
511 v1 = a1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
512 v2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
513 if ( a1->array_708_size > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
514 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
515 v3 = &a1->array_708[0].flt_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
516 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
517 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
518 pBloodsplatContainer->AddBloodsplat(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
519 *(v3 - 4),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
520 *(v3 - 3),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
521 *(v3 - 2),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
522 v3[2],
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
523 (signed __int64)*(v3 - 1),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
524 (signed __int64)*v3,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
525 (signed __int64)v3[1]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
526 ++v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
527 v3 += 7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
528 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
529 while ( v2 < v1->array_708_size );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
530 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
531 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
532
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
533
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
534 //----- (0044F120) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
535 void Game::PushStationaryLights(int a2)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
536 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
537 signed int v3; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
538 char *v4; // esi@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
539
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
540 auto v2 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
541 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
542 if ( (signed int)this->uNumStationaryLights > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
543 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
544 v4 = (char *)&this->pStationaryLights[0].vRGBColor.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
545 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
546 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
547 pStationaryLightsStack->AddLight(
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
548 (signed __int64)*((float *)v4 - 4),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
549 (signed __int64)*((float *)v4 - 3),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
550 (signed __int64)*((float *)v4 - 2),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
551 (signed __int64)*((float *)v4 + 2),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
552 (int *)(signed __int64)*((float *)v4 - 1),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
553 (signed __int64)*(float *)v4,
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
554 (signed __int64)*((float *)v4 + 1),
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
555 byte_4E94D0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
556 ++v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
557 v4 += 28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
558 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
559 while ( v3 < (signed int)v2->uNumStationaryLights );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
560 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
561 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
562 // 4E94D0: using guessed type char byte_4E94D0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
563
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
564 //----- (0044F0FD) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
565 void Game::_44F0FD()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
566 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
567 ToggleFlags(0x40u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
568
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
569 if ( !(uFlags & 0x40) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
570 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
571 array_708_size = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
572 field_E0C = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
573 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
574 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
575
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
576 //----- (0044F0D8) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
577 void Game::ToggleFlags(uint uMask)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
578 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
579 if (uFlags & uMask)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
580 uFlags &= ~uMask;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
581 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
582 uFlags |= uMask;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
583 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
584
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
585
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
586 //----- (0044F07B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
587 bool Game::_44F07B()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
588 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
589 if (!pKeyboardInstance->IsKeyBeingHeld(VK_SHIFT) &&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
590 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) &&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
591 !pKeyboardInstance->IsKeyBeingHeld(VK_LSHIFT) ||
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
592
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
593 (pKeyboardInstance->WasKeyPressed(VK_F11) == 0 &&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
594 pKeyboardInstance->WasKeyPressed(VK_F11)))
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
595 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
596 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
597 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
598
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
599 //----- (0044EEA7) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
600 bool Game::_44EEA7()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
601 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
602 Game *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
603 double v2; // st7@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
604 float depth; // ST00_4@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
605 bool result; // eax@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
606 unsigned int v5; // eax@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
607 __int64 v6; // kr00_8@21
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
608 unsigned int y; // [sp+4h] [bp-24h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
609 unsigned int x; // [sp+8h] [bp-20h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
610 bool v9; // [sp+Ch] [bp-1Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
611 stru157 *v10; // [sp+10h] [bp-18h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
612 stru157 *v11; // [sp+14h] [bp-14h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
613 POINT a2; // [sp+20h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
614
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
615 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
616 ++qword_5C6DF0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
617 pParticleEngine->UpdateParticles();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
618 pMouseInstance->GetCursorPos(&a2);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
619 if ( sub_4637E0_is_there_popup_onscreen() )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
620 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
621 v11 = &a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
622 v10 = &stru_F93E30;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
623 v9 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
624 x = a2.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
625 y = a2.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
626 v2 = GetPickDepth();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
627 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
628 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
629 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
630 if ( v1->uFlags2 & 0x10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
631 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
632 v11 = &a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
633 v10 = &stru_F93E1C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
634 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
635 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
636 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
637 static bool __init_flag = false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
638 static stru157 static_sub_44EEA7_stru157;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
639 if (!__init_flag)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
640 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
641 __init_flag = true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
642 static_sub_44EEA7_stru157.field_8 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
643 static_sub_44EEA7_stru157.field_0 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
644 static_sub_44EEA7_stru157.field_4 = 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
645 static_sub_44EEA7_stru157.field_C = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
646 static_sub_44EEA7_stru157.field_10 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
647 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
648 v11 = &a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
649 v10 = &static_sub_44EEA7_stru157;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
650 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
651 v2 = 5120.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
652 v9 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
653 x = a2.y;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
654 y = a2.x;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
655 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
656 depth = v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
657
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
658 PickMouse(depth, y, x, v9, v10, v11);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
659 v1->pLightmapBuilder->std__vector_000004_size = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
660 v1->pLightmapBuilder->std__vector_183808_size = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
661 pDecalBuilder->std__vector_pDecals_size = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
662 pDecalBuilder->field_308008 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
663 result = _44F07B();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
664 if ( result )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
665 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
666 if ( uFlags & 8 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
667 LOBYTE(pStru10Instance->field_4) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
668 if ( pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
669 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
670 v5 = GetLevelFogColor();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
671 LODWORD(pRenderer->uFogColor) = v5 & 0xFFFFFF;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
672 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
673 if (uFlags & 0x0400)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
674 uFlags2 |= 0x01;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
675 if ( !pRenderer->pRenderD3D && uCurrentlyLoadedLevelType == LEVEL_Outdoor && uNumMobileLightsApplied )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
676 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
677 uFlags2 |= 0x01;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
678 field_E10 = qword_5C6DF0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
679 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
680 v6 = qword_5C6DF0 - v1->field_E10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
681 if ( qword_5C6DF0 - v1->field_E10 == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
682 v1->uFlags2 |= v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
683 if ( v1->uNumStationaryLights_in_pStationaryLightsStack != uNumStationaryLightsApplied )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
684 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
685 v1->uFlags2 |= 1u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
686 v1->uNumStationaryLights_in_pStationaryLightsStack = uNumStationaryLightsApplied;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
687 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
688 _44E904();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
689 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
690 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
691 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
692 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
693 // 519AB4: using guessed type int uNumStationaryLightsApplied;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
694 // 5C6DEC: using guessed type char static_sub_44EEA7_byte_5C6DEC__init_flag;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
695 // 5C6DF0: using guessed type __int64 qword_5C6DF0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
696 // F93E1C: using guessed type stru157 stru_F93E1C;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
697 // F93E30: using guessed type stru157 stru_F93E30;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
698
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
699 //----- (0044EDE4) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
700 bool Game::_44EDE4(BLVFace *pFace, int *a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
701 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
702 bool result; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
703
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
704 result = (bool)pGame;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
705 if ( pGame->uFlags2 & 2 && (result = (bool)pFace, pFace->uAttributes & 2) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
706 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
707 result = sub_48A959(*a3, 1.0, this->_E28_timed_gamma_strength, -1.0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
708 *a3 = result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
709 LOBYTE(result) = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
710 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
711 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
712 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
713 LOBYTE(result) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
714 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
715 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
716 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
717
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
718 //----- (0044EE30) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
719 bool Game::_44EE30(ODMFace *a2, int a3)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
720 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
721 if (uFlags2 & 0x2 && a2->uFaceAttributes & 0x02)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
722 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
723 *(int *)a3 = sub_48A959(*(int *)a3, 1.0, _E28_timed_gamma_strength, -1.0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
724 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
725 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
726 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
727 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
728 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
729
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
730
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
731 //----- (004645FA) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
732 void Game::Deinitialize()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
733 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
734 struct tagRECT Rect; // [sp+0h] [bp-10h]@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
735
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
736 if (pAsyncMouse)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
737 pAsyncMouse->Suspend();
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
738 if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
739 pAsyncKeyboard->Suspend();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
740 WriteWindowsRegistryInt("startinwindow", pRenderer->bWindowMode);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
741 if ( GetWindowRect(hWnd, &Rect) && pRenderer->bWindowMode )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
742 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
743 WriteWindowsRegistryInt("window X", Rect.left);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
744 WriteWindowsRegistryInt("window Y", Rect.top);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
745 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
746 WriteWindowsRegistryInt("debug flags", stru_51076C.registry_debug_flags);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
747 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
748 pItemsTable->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
749 pNPCStats->Release();
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
750 if (pAsyncKeyboard)
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
751 pAsyncKeyboard->Release();
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
752 if (pAsyncMouse)
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
753 pAsyncMouse->Release();
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
754 if (pMouse)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
755 pMouse->Deactivate();
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
756
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
757 pAudioPlayer->Release();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
758 pNew_LOD->FreeSubIndexAndIO();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
759 pGames_LOD->FreeSubIndexAndIO();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
760 ClipCursor(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
761 Game::Destroy();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
762 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
763
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
764 //----- (0044EE7C) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
765 bool Game::draw_debug_outlines()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
766 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
767 if (uFlags & 0x04)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
768 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
769 pLightmapBuilder->DrawDebugOutlines(-1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
770 pDecalBuilder->DrawDecalDebugOutlines();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
771 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
772 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
773 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
774
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
775 //----- (0044EC23) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
776 int Game::_44EC23(stru148 *a2, int *a3, signed int a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
777 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
778 double v4; // st7@4
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
779 //double v5; // ST00_8@4
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
780 signed int v6; // eax@5
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
781 //double v7; // ST00_8@6
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
782 signed int result; // eax@8
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
783 //double v9; // ST00_8@9
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
784 //double v10; // ST00_8@11
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
785 float a2a; // [sp+14h] [bp+8h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
786 float a3a; // [sp+18h] [bp+Ch]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
787 float a3b; // [sp+18h] [bp+Ch]@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
788 float a4a; // [sp+1Ch] [bp+10h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
789 float a4b; // [sp+1Ch] [bp+10h]@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
790
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
791 if ( this->uFlags2 & 2 && a2->field_59 == 5 && a2->pODMFace->uFaceAttributes & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
792 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
793 v4 = (double)a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
794 a2a = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
795 *a3 |= 2u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
796 a3a = (1.0 - this->_E28_timed_gamma_strength) * v4;
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
797 //v5 = a3a + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
798 //if ( SLODWORD(v5) >= 0 )
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
799 if (floorf(a3a + 0.5f) >= 0 )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
800 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
801 a3b = (1.0 - this->_E28_timed_gamma_strength) * a2a;
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
802 //v7 = a3b + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
803 //v6 = LODWORD(v7);
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
804 v6 = floorf(a3b + 0.5f);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
805 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
806 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
807 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
808 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
809 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
810 if ( a4 >= v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
811 {
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
812 a4a = (1.0 - _E28_timed_gamma_strength) * a2a;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
813 //v9 = a4a + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
814 //if ( SLODWORD(v9) >= 0 )
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
815 if (floorf(a4a + 0.5f) >= 0)
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
816 {
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
817 a4b = (1.0 - _E28_timed_gamma_strength) * a2a;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
818 //v10 = a4b + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
819 //result = LODWORD(v10);
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
820 result = floorf(a4b + 0.5f);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
821 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
822 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
823 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
824 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
825 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
826 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
827 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
828 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
829 result = a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
830 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
831 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
832 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
833 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
834 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
835 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
836 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
837 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
838
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
839
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
840
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
841 //----- (00465C8B) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
842 Game *Game::Create()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
843 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
844 return new Game;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
845 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
846
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
847 //----- (00465CF3) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
848 void Game::Destroy()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
849 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
850 if (pGame)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
851 delete pGame;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
852 pGame = nullptr;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
853 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
854
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
855 //----- (0044ED0A) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
856 signed int Game::_44ED0A(BLVFace *a2, int *a3, signed int a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
857 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
858 double v4; // st7@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
859 double v5; // ST00_8@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
860 signed int v6; // eax@4
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
861 //double v7; // ST00_8@5
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
862 signed int result; // eax@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
863 double v9; // ST00_8@8
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
864 //double v10; // ST00_8@10
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
865 float v11; // [sp+14h] [bp+8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
866 float v12; // [sp+18h] [bp+Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
867 float v13; // [sp+18h] [bp+Ch]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
868 float v14; // [sp+1Ch] [bp+10h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
869 float v15; // [sp+1Ch] [bp+10h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
870
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
871 if ( this->uFlags2 & 2 && a2->uAttributes & 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
872 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
873 v4 = (double)a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
874 v11 = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
875 *a3 |= 2u;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
876 v12 = (1.0 - this->_E28_timed_gamma_strength) * v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
877 v5 = v12 + 6.7553994e15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
878 if ( SLODWORD(v5) >= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
879 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
880 v13 = (1.0 - this->_E28_timed_gamma_strength) * v11;
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
881 //v7 = v13 + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
882 //v6 = LODWORD(v7);
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
883 v6 = floorf(v13 + 0.5f);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
884 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
885 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
886 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
887 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
888 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
889 if ( a4 >= v6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
890 {
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
891 v14 = (1.0 - _E28_timed_gamma_strength) * v11;
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
892 v9 = v14 + 6.7553994e15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
893 if ( SLODWORD(v9) >= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
894 {
2
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
895 v15 = (1.0 - _E28_timed_gamma_strength) * v11;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
896 //v10 = v15 + 6.7553994e15;
2ca04ccb612a NoCD, main menu, various
Nomad
parents: 0
diff changeset
897 //result = LODWORD(v10);
3
540178ef9b18 Main menu functionality
Nomad
parents: 2
diff changeset
898 result = floorf(v15 + 0.5f);
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
899 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
900 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
901 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
902 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
903 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
904 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
905 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
906 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
907 result = a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
908 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
909 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
910 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
911 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
912 result = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
913 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
914 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
915 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
916
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
917
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
918 //----- (0044E4B7) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
919 Game::Game()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
920 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
921 uNumStationaryLights = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
922 array_708_size = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
923 field_E0C = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
924 field_E10 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
925 uNumStationaryLights_in_pStationaryLightsStack = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
926 bGammaControlInitialized = false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
927 uFlags = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
928 uFlags2 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
929 uSomeGammaStartTime = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
930 uSomeGammaDeltaTime = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
931
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
932 pThreadWardInstance = new ThreadWard;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
933 pParticleEngine = new ParticleEngine;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
934 pMouseInstance = new Mouse(pThreadWardInstance);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
935 pLightmapBuilder = new LightmapBuilder;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
936 pVisInstance = new Vis;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
937 pStru6Instance = new stru6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
938 pIndoorCameraD3D = new IndoorCameraD3D;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
939 pStru9Instance = new stru9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
940 pStru10Instance = new stru10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
941 pStru11Instance = new stru11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
942 pStru12Instance = new stru12(pStru11Instance);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
943 pCShow = new CShow;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
944 pKeyboardInstance = new Keyboard;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
945 pGammaController = new GammaController;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
946
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
947 uFlags |= 0x0800;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
948 uFlags2 |= 0x24;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
949
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
950 _44F0FD();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
951
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
952 bWinNT4_0 = false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
953 if (pVersion->pVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
954 pVersion->pVersionInfo.dwMajorVersion == 4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
955 bWinNT4_0 = true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
956 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
957
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
958 //----- (0044E7F3) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
959 Game::~Game()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
960 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
961 if (pGammaController)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
962 delete pGammaController;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
963 if (pKeyboardInstance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
964 delete pKeyboardInstance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
965 if (pCShow)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
966 delete pCShow;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
967 if (pStru12Instance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
968 delete pStru12Instance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
969 if (pStru11Instance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
970 delete pStru11Instance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
971 if (pStru10Instance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
972 delete pStru10Instance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
973 if (pStru9Instance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
974 delete pStru9Instance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
975 if (pIndoorCameraD3D)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
976 delete pIndoorCameraD3D;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
977 if (pStru6Instance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
978 delete pStru6Instance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
979 if (pVisInstance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
980 delete pVisInstance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
981 if (pLightmapBuilder)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
982 delete pLightmapBuilder;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
983 if (pMouseInstance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
984 delete pMouseInstance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
985 if (pParticleEngine)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
986 delete pParticleEngine;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
987 if (pThreadWardInstance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
988 delete pThreadWardInstance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
989 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
990
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
991 //----- (0044E904) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
992 void Game::_44E904()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
993 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
994 Game *v1; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
995 unsigned __int64 v2; // qax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
996 unsigned int v3; // ecx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
997 int v4; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
998 unsigned __int8 v5; // cf@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
999 double v6; // st7@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1000 double v7; // st7@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1001 signed __int64 v8; // [sp+Ch] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1002
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1003 v1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1004 v2 = pEventTimer->Time();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1005 v4 = (v2 - v1->uSomeGammaStartTime) >> 32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1006 v3 = v2 - LODWORD(v1->uSomeGammaStartTime);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1007 v8 = v2 - v1->uSomeGammaStartTime;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1008 if ( v4 < 0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1009 || SHIDWORD(v2) < ((unsigned int)v2 < LODWORD(v1->uSomeGammaStartTime)) + HIDWORD(v1->uSomeGammaStartTime) | v4 == 0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1010 && v3 <= 0x80 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1011 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1012 if ( v4 > 0 || v4 >= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1013 goto LABEL_12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1014 v3 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1015 v4 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1016 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1017 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1018 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1019 if ( v1->uSomeGammaDeltaTime )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1020 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1021 LODWORD(v1->uSomeGammaDeltaTime) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1022 HIDWORD(v1->uSomeGammaDeltaTime) = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1023 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1024 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1025 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1026 LODWORD(v1->uSomeGammaDeltaTime) = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1027 HIDWORD(v1->uSomeGammaDeltaTime) = v4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1028 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1029 v5 = __CFADD__(v3, -128);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1030 v3 -= 128;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1031 v4 = v5 + v4 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1032 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1033 v1->uSomeGammaStartTime = v2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1034 v8 = __PAIR__(v4, v3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1035 LABEL_12:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1036 if ( v1->uSomeGammaDeltaTime )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1037 v6 = (double)(signed __int64)(v1->uSomeGammaDeltaTime - __PAIR__(v4, v3));
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1038 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1039 v6 = (double)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1040 v7 = v6 * 0.0078125;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1041 if ( v7 < 0.0 || v7 <= 1.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1042 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1043 if ( v7 < 0.0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1044 v7 = 0.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1045 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1046 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1047 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1048 v7 = 1.0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1049 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1050 if ( pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1051 v1->_E28_timed_gamma_strength = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1052 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1053 v1->_E28_timed_gamma_strength = (1.0 - 0.5) * v7 + 0.5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1054 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1055
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1056 //----- (0044EA17) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1057 bool Game::InitializeGammaController()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1058 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1059 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1060 pVersion->pVersionInfo.dwMajorVersion != 4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1061 pGammaController->InitializeFromSurface(pRenderer->pFrontBuffer4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1062
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1063 bGammaControlInitialized = true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1064 uSomeGammaStartTime = pEventTimer->Time();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1065 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1066 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1067
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1068 //----- (0044EA5E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1069 char Game::PickMouse(float fPickDepth, unsigned int uMouseX, unsigned int uMouseY, bool bOutline, stru157 *a5, stru157 *a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1070 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1071 char result; // al@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1072 std::string v10; // [sp-4h] [bp-24h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1073 float v11; // [sp+4h] [bp-1Ch]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1074 float v12; // [sp+8h] [bp-18h]@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1075 const char *v13; // [sp+Ch] [bp-14h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1076 int v14; // [sp+10h] [bp-10h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1077 std::string *v15; // [sp+18h] [bp-8h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1078 int a3; // [sp+1Fh] [bp-1h]@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1079
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1080 auto v7 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1081 if (!uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1082 && pRenderer->pRenderD3D)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1083 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1084 if (!pVisInstance)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1085 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1086 MessageBoxW(nullptr, L"The 'Vis' object pointer has not been instatiated, but CGame::Pick() is trying to call through it.", nullptr, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1087 ExitProcess(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1088 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1089
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1090 if ( (signed int)uMouseX >= (signed int)pViewport->uScreenX
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1091 && (signed int)uMouseX <= (signed int)pViewport->uScreenZ
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1092 && (signed int)uMouseY >= (signed int)pViewport->uScreenY
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1093 && (signed int)uMouseY <= (signed int)pViewport->uScreenW )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1094 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1095 v14 = (int)a6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1096 v12 = (double)(signed int)uMouseY;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1097 v11 = (double)(signed int)uMouseX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1098 pVisInstance->PickMouse(fPickDepth, v11, v12, a5, a6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1099
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1100 if (bOutline)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1101 OutlineSelection();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1102 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1103 return true;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1104 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1105 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1106 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1107 // 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1108
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1109 //----- (0044EB12) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1110 bool Game::_44EB12(bool bOutline, stru157 *a3, stru157 *a4)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1111 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1112 if ( !uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1113 && pVisInstance
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1114 && pRenderer->pRenderD3D )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1115 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1116 bool r = pVisInstance->_4C05CC(&pVisInstance->stru1, a3, a4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1117
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1118 if (bOutline)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1119 OutlineSelection();
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1120 return r;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1121 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1122 return false;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1123 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1124 // 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1125
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1126 //----- (0044EB5A) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1127 void Game::OutlineSelection()
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1128 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1129 Vis *v1; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1130 Vis_stru1_stru0 *v2; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1131 void *v3; // edx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1132 int v4; // eax@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1133 int v5; // eax@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1134 int v6; // eax@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1135 int v7; // eax@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1136 const char *v9; // [sp-8h] [bp-14h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1137 int v10; // [sp-4h] [bp-10h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1138 char v11; // [sp+0h] [bp-Ch]@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1139 int a3; // [sp+Ah] [bp-2h]@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1140
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1141 v1 = this->pVisInstance;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1142 if ( v1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1143 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1144 v2 = (Vis_stru1_stru0 *)((signed int)v1->stru1.uNumPointers <= 0 ? 0 : v1->stru1.array_1804[0]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1145 if ( v2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1146 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1147 if ( v2->uObjectType == 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1148 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1149 MessageBoxW(nullptr, L"Sprite outline currently Unsupported", nullptr, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1150 ExitProcess(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1151 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1152
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1153 if ( v2->uObjectType == 2 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1154 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1155 v3 = v2->pObjectInfo; // TODO 2 objects for indoor/outdoor
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1156 // some clues in header for Vis_stru1_stru0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1157 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1158 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1159 v4 = *((int *)v3 + 11);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1160 if ( v4 & 0x10000 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1161 v5 = v4 & 0xFFFEFFFF;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1162 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1163 v5 = v4 | 0x10000;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1164 *((int *)v3 + 11) = v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1165 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1166 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1167 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1168 v6 = *((int *)v3 + 7);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1169 if ( v6 & 0x10000 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1170 v7 = v6 & 0xFFFEFFFF;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1171 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1172 v7 = v6 | 0x10000;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1173 *((int *)v3 + 7) = v7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1174 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1175 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1176 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1177 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1178 MessageBoxW(nullptr, L"Undefined CObjectInfo type requested in CGame::outline_selection()", nullptr, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1179 ExitProcess(0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1180 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1181 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1182 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1183 }