comparison Game.cpp @ 27:be2066176d89

On level initialization
author Nomad
date Tue, 16 Oct 2012 01:31:05 +0200
parents 93bf1d5f6a6d
children e62134245ab0
comparison
equal deleted inserted replaced
26:93bf1d5f6a6d 27:be2066176d89
196 //----- (00463149) -------------------------------------------------------- 196 //----- (00463149) --------------------------------------------------------
197 void Game::Loop() 197 void Game::Loop()
198 { 198 {
199 //signed int v0; // ebp@3 199 //signed int v0; // ebp@3
200 //signed int v1; // esi@4 200 //signed int v1; // esi@4
201 Render *v2; // edi@7 201 //Render *v2; // edi@7
202 signed int v3; // esi@7 202 //signed int v3; // esi@7
203 signed int v4; // ecx@58 203 signed int v4; // ecx@58
204 char *v5; // eax@59 204 char *v5; // eax@59
205 Player *v6; // esi@65 205 Player *v6; // esi@65
206 OtherOverlay *v7; // esi@67 206 OtherOverlay *v7; // esi@67
207 signed int v8; // edi@67 207 signed int v8; // edi@67
234 remove(pTmpBuf); 234 remove(pTmpBuf);
235 } 235 }
236 236
237 LoadPlayerPortraintsAndVoices(); 237 LoadPlayerPortraintsAndVoices();
238 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles; 238 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
239 pAudioPlayer->SetMusicVolume((signed __int64)(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0)); 239 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0);
240 v2 = pRenderer; 240
241 v3 = 1;
242 while ( 2 ) 241 while ( 2 )
243 { 242 {
244 v16 = v3; 243 v16 = 1;
245 if ( pMessageQueue_50CBD0->uNumMessages ) 244 if (pMessageQueue_50CBD0->uNumMessages)
246 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 245 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
246
247 pPartyActionQueue->uNumActions = 0; 247 pPartyActionQueue->uNumActions = 0;
248 if ( pParty->bTurnBasedModeOn == v3 ) 248 if (pParty->bTurnBasedModeOn)
249 { 249 {
250 pTurnEngine->End(0); 250 pTurnEngine->End(false);
251 pParty->bTurnBasedModeOn = 0; 251 pParty->bTurnBasedModeOn = false;
252 } 252 }
253 DoPrepareWorld(bLoading, v3); 253 DoPrepareWorld(bLoading, 1);
254 pEventTimer->Resume(); 254 pEventTimer->Resume();
255 dword_6BE364_game_settings_1 |= 0x80; 255 dword_6BE364_game_settings_1 |= 0x80;
256 dword_6BE340 = 2; 256 dword_6BE340 = 2;
257 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; 257 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
258 if (pAsyncMouse) 258 if (pAsyncMouse)
262 if ( pRenderer->pRenderD3D ) 262 if ( pRenderer->pRenderD3D )
263 pGame->pVisInstance->_4C1A02(); 263 pGame->pVisInstance->_4C1A02();
264 bLoadinga = 0; 264 bLoadinga = 0;
265 do 265 do
266 { 266 {
267 while ( PeekMessageA(&Msg, 0, 0, 0, v3) ) 267 while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) )
268 { 268 {
269 if ( Msg.message == WM_QUIT ) 269 if ( Msg.message == WM_QUIT )
270 Game_DeinitializeAndTerminate(0); 270 Game_DeinitializeAndTerminate(0);
271 TranslateMessage(&Msg); 271 TranslateMessage(&Msg);
272 DispatchMessageA(&Msg); 272 DispatchMessageA(&Msg);
282 GameUI_MsgProc(); 282 GameUI_MsgProc();
283 if ( pArcomageGame->bGameInProgress ) 283 if ( pArcomageGame->bGameInProgress )
284 { 284 {
285 ArcomageGame::Loop(); 285 ArcomageGame::Loop();
286 LABEL_89: 286 LABEL_89:
287 v2->Present(); 287 pRenderer->Present();
288 continue; 288 continue;
289 } 289 }
290 if (pAsyncMouse) 290 if (pAsyncMouse)
291 pAsyncMouse->_46B736_consume_click_lists(v3); 291 pAsyncMouse->_46B736_consume_click_lists(1);
292 if ( pVideoPlayer->pSmackerMovie && !SmackWait(pVideoPlayer->pSmackerMovie) ) 292 if ( pVideoPlayer->pSmackerMovie && !SmackWait(pVideoPlayer->pSmackerMovie) )
293 { 293 {
294 v2->BeginScene(); 294 pRenderer->BeginScene();
295 pMouse->_469E3B(); 295 pMouse->_469E3B();
296 pVideoPlayer->SmackUpdatePalette(pVideoPlayer->hWindow); 296 pVideoPlayer->SmackUpdatePalette(pVideoPlayer->hWindow);
297 pMouse->_469EA4(); 297 pMouse->_469EA4();
298 v2->EndScene(); 298 pRenderer->EndScene();
299 } 299 }
300 if ( pVideoPlayer->pBinkMovie && !BinkWait(pVideoPlayer->pBinkMovie) ) 300 if ( pVideoPlayer->pBinkMovie && !BinkWait(pVideoPlayer->pBinkMovie) )
301 { 301 {
302 v2->BeginScene(); 302 pRenderer->BeginScene();
303 pMouse->_469E3B(); 303 pMouse->_469E3B();
304 pVideoPlayer->BinkUpdatePalette(pVideoPlayer->hWindow); 304 pVideoPlayer->BinkUpdatePalette(pVideoPlayer->hWindow);
305 pMouse->_469EA4(); 305 pMouse->_469EA4();
306 v2->EndScene(); 306 pRenderer->EndScene();
307 } 307 }
308 pEventTimer->Update(); 308 pEventTimer->Update();
309 pMiscTimer->Update(); 309 pMiscTimer->Update();
310 OnTimer(0); 310 OnTimer(0);
311 GameUI_StatusBar_UpdateTimedString(0); 311 GameUI_StatusBar_UpdateTimedString(0);
328 } 328 }
329 } 329 }
330 if ( v16 ) 330 if ( v16 )
331 { 331 {
332 v16 = 0; 332 v16 = 0;
333 viewparams->bRedrawGameUI = v3; 333 viewparams->bRedrawGameUI = true;
334 } 334 }
335 pAudioPlayer->_4AAFCF(); 335 pAudioPlayer->_4AAFCF();
336 if ( uGameState == v3 ) 336 if (uGameState == 1)
337 goto LABEL_96; 337 goto LABEL_96;
338 if ( uGameState == 2 ) 338 if (uGameState == 2)
339 { 339 {
340 pAudioPlayer->StopChannels(-1, -1); 340 pAudioPlayer->StopChannels(-1, -1);
341 PrepareWorld(0); 341 PrepareWorld(0);
342 uGameState = 0; 342 uGameState = 0;
343 continue; 343 continue;
345 if ( (signed int)uGameState <= 2 ) 345 if ( (signed int)uGameState <= 2 )
346 goto LABEL_85; 346 goto LABEL_85;
347 if ( (signed int)uGameState <= 5 || uGameState == 7 ) 347 if ( (signed int)uGameState <= 5 || uGameState == 7 )
348 { 348 {
349 LABEL_96: 349 LABEL_96:
350 bLoadinga = v3; 350 bLoadinga = 1;
351 continue; 351 continue;
352 } 352 }
353 if ( uGameState != 8 ) 353 if ( uGameState != 8 )
354 { 354 {
355 if ( uGameState != 9 ) 355 if ( uGameState != 9 )
468 v12 = rand(); 468 v12 = rand();
469 pPlayers[v17[v12 % v11]]->PlaySound(99, 0); 469 pPlayers[v17[v12 % v11]]->PlaySound(99, 0);
470 } 470 }
471 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2u);// "Once again you've cheated death!.." 471 ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2u);// "Once again you've cheated death!.."
472 uGameState = 0; 472 uGameState = 0;
473 v3 = 1;
474 } 473 }
475 while ( !bLoadinga ); 474 while ( !bLoadinga );
476 dword_6BE340 = 0; 475 dword_6BE340 = 0;
477 pEventTimer->Pause(); 476 pEventTimer->Pause();
478 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); 477 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
480 { 479 {
481 sub_491E3A(); 480 sub_491E3A();
482 LoadPlayerPortraintsAndVoices(); 481 LoadPlayerPortraintsAndVoices();
483 uGameState = 0; 482 uGameState = 0;
484 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles; 483 pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles;
485 bLoading = v3; 484 bLoading = true;
486 continue; 485 continue;
487 } 486 }
488 break; 487 break;
489 } 488 }
490 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 16; 489 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 16;