Mercurial > mm7
diff Engine/Engine.cpp @ 2543:b6140dfeac27
GameOver h/cpp
author | a.parshin |
---|---|
date | Sun, 10 May 2015 03:21:14 +0200 |
parents | a902abdfc7f2 |
children | c674d547cc7c |
line wrap: on
line diff
--- a/Engine/Engine.cpp Sun May 10 02:04:52 2015 +0200 +++ b/Engine/Engine.cpp Sun May 10 03:21:14 2015 +0200 @@ -68,6 +68,7 @@ #include "GUI/NewUI\MainMenu.h" #include "Game/Game.h" +#include "Game/MainMenu.h" #include <direct.h> @@ -164,11 +165,11 @@ if (pParty->_497FC5_check_party_perception_against_level()) uFlags2 |= 2; - pEngine->pIndoorCameraD3D->sRotationX = pParty->sRotationX; - pEngine->pIndoorCameraD3D->sRotationY = pParty->sRotationY; - pEngine->pIndoorCameraD3D->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * pi_double * pParty->sRotationY / 2048.0); - pEngine->pIndoorCameraD3D->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * pi_double * pParty->sRotationY / 2048.0); - pEngine->pIndoorCameraD3D->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353 + pIndoorCameraD3D->sRotationX = pParty->sRotationX; + pIndoorCameraD3D->sRotationY = pParty->sRotationY; + pIndoorCameraD3D->vPartyPos.x = pParty->vPosition.x - pParty->y_rotation_granularity * cosf(2 * pi_double * pParty->sRotationY / 2048.0); + pIndoorCameraD3D->vPartyPos.y = pParty->vPosition.y - pParty->y_rotation_granularity * sinf(2 * pi_double * pParty->sRotationY / 2048.0); + pIndoorCameraD3D->vPartyPos.z = pParty->vPosition.z + pParty->sEyelevel;//193, but real 353 //pIndoorCamera->Initialize2(); pIndoorCameraD3D->CalculateRotations(pParty->sRotationX, pParty->sRotationY); @@ -440,7 +441,7 @@ { v11 = &vis_face_filter; v10 = &vis_sprite_filter_2; - depth = pEngine->pIndoorCameraD3D->GetPickDepth(); + depth = pIndoorCameraD3D->GetPickDepth(); } else { @@ -1858,7 +1859,7 @@ break; assert(false && "Invalid game state"); } - if (GetCurrentMenuID() == MENU_CREDITS) + else if (GetCurrentMenuID() == MENU_CREDITS) { if (use_music_folder) alSourceStop(mSourceID); @@ -1870,34 +1871,31 @@ MainMenuUI_Credits_Loop(); break; } - if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) + else if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) { uGameState = GAME_STATE_PLAYING; Game_Loop(); } - else + else if (GetCurrentMenuID() == MENU_DebugBLVLevel) { - if (GetCurrentMenuID() == MENU_DebugBLVLevel) + pMouse->ChangeActivation(0); + pParty->Reset(); + pParty->CreateDefaultParty(1); + + __debugbreak(); + /*extern void CreateDefaultBLVLevel(); + CreateDefaultBLVLevel(); + + OPENFILENAMEA ofn; + if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) { - pMouse->ChangeActivation(0); - pParty->Reset(); - pParty->CreateDefaultParty(1); - - __debugbreak(); - /*extern void CreateDefaultBLVLevel(); - CreateDefaultBLVLevel(); - - OPENFILENAMEA ofn; - if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) - { - pMouse->ChangeActivation(1); - break; - } - _chdir("..\\"); - strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/ - pMouse->ChangeActivation(1); - Game_Loop(); + pMouse->ChangeActivation(1); + break; } + _chdir("..\\"); + strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/ + pMouse->ChangeActivation(1); + Game_Loop(); } if (uGameState == GAME_STATE_LOADING_GAME) { @@ -2000,9 +1998,9 @@ pODMRenderParams->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename); pODMRenderParams->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename); pODMRenderParams->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename); - outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename); - outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename); - outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename); + //outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename); + //outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename); + //outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename); pODMRenderParams->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename); pODMRenderParams->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename); pODMRenderParams->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename); @@ -2072,12 +2070,13 @@ pODMRenderParams->outdoor_no_wavy_water = 0; //_47F4D3_initialize_terrain_bezier_stuff(outdoor_grid_band_1, outdoor_grid_band_2, outdoor_grid_band_3); { - pODMRenderParams->outdoor_grid_band_3 = outdoor_grid_band_3; - pODMRenderParams->uPickDepth = outdoor_grid_band_3 * 512; + pODMRenderParams->outdoor_grid_band_3 = 25;//outdoor_grid_band_3; + pODMRenderParams->uPickDepth = 25 * 512;//outdoor_grid_band_3 * 512; } } else LOBYTE(viewparams->field_20) = 0; + pParty->uFlags |= 2; viewparams->uSomeY = viewparams->uScreen_topL_Y; viewparams->uSomeX = viewparams->uScreen_topL_X; @@ -2101,180 +2100,7 @@ viewparams->_443365(); PlayLevelMusic(); } -// 6BE35C: using guessed type int uLevel_StartingPointType; - - - -//----- (004BF91E) -------------------------------------------------------- -unsigned int GameOverMenu(void *ecx0) -{ - const char *v1; // eax@2 - unsigned int result; // eax@3 - const char *v6; // eax@10 - const char *v7; // edx@10 - const char *v8; // ecx@12 - const char *v9; // eax@14 - unsigned int v10; // eax@25 - GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1 - unsigned int v14; // [sp+A4h] [bp-2Ch]@5 - void *v15; // [sp+A8h] [bp-28h]@1 - const char *pInString; // [sp+ACh] [bp-24h]@5 - unsigned int v17; // [sp+B0h] [bp-20h]@5 - unsigned int v18; // [sp+B4h] [bp-1Ch]@5 - unsigned int v19; // [sp+B8h] [bp-18h]@5 - int v20; // [sp+BCh] [bp-14h]@7 - GUIFont *pFont; // [sp+C4h] [bp-Ch]@1 - unsigned __int64 v23; // [sp+C8h] [bp-8h]@5 - MSG msg; - - v15 = ecx0; - - RGBTexture _this; // [sp+Ch] [bp-C4h]@1 - //RGBTexture::RGBTexture(&this); - - dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000; - bGameoverLoop = 1; - pMediaPlayer->bStopBeforeSchedule = 0; - pAudioPlayer->StopChannels(-1, -1); - pRenderer->BeginScene(); - pRenderer->ClearBlack(); - pRenderer->EndScene(); - pRenderer->Present(); - //pMediaPlayer->pResetflag = 0; - _449B57_test_bit(pParty->_quest_bits, 99); - _this.Load("winbg.pcx", 2); - pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &_this); - pRenderer->EndScene(); - free(_this.pPixels); - _this.pPixels = 0; - window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); - pWindow.uFrameX = 75; - pWindow.uFrameY = 60; - pWindow.uFrameWidth = 469; - pWindow.uFrameHeight = 338; - pWindow.uFrameZ = 543; - pWindow.uFrameW = 397; - pFont = LoadFont("endgame.fnt", "FONTPAL", NULL); - if (pParty->IsPartyGood()) - v1 = pGlobalTXT_LocalizationStrings[675];//"Splendid job! With the activation of the Gate, a thousand worlds lie at your feet. Perhaps on one of them you will find the Ancients themselves, and return with the fruits their great civilization has to offer your world and your kingdom." - else - { - result = pParty->IsPartyEvil(); - if (!(short)result) - return result; - v1 = pGlobalTXT_LocalizationStrings[676];//"Brilliant! The completion of the Heavenly Forge has provided enough Ancient weapons to crush all resistance to your plans. Soon the world will bow to your every whim! Still, you can't help but wonder what was beyond the Gate the other side was trying so hard to build." - } - pInString = v1; - v23 = pParty->uTimePlayed - 138240; - v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24; - v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C / 0xC; - v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C % 0xC; - v17 = v19 % 0x1C; - if (!v19) - v19 = 1; - pRenderer->BeginScene(); - pWindow.DrawTitleText(pFont, 1, 0x23, 1, pGlobalTXT_LocalizationStrings[9], 3);//Congratulations! - v23 = 0i64; - v20 = 0; - for (uint i = 0; i < 4; i++) - { - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], pParty->pPlayers[i].pName, pParty->pPlayers[i].GetBaseLevel(), pClassNames[pParty->pPlayers[i].classType]);//%s the Level %u %s - pWindow.DrawTitleText(pFont, 1, i * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 1, pTmpBuf.data(), 3); - v23 += pParty->pPlayers[i].uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8)); - } - v23 = (signed __int64)v23 / v19; - v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0); - pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0); - strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time: - - v7 = pGlobalTXT_LocalizationStrings[56]; - if (v17 != 1) - v7 = pGlobalTXT_LocalizationStrings[57]; - - v8 = pGlobalTXT_LocalizationStrings[146];//Month - if (v18 != 1) - v8 = pGlobalTXT_LocalizationStrings[148];//Months - - v9 = pGlobalTXT_LocalizationStrings[245]; - if (v14 != 1) - v9 = pGlobalTXT_LocalizationStrings[132]; - - sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7); - strcat(pTmpBuf.data(), pTmpBuf2.data()); - pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1, pTmpBuf.data(), 3); - sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23); - pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1, pTmpBuf.data(), 3); - dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; - pRenderer->EndScene(); - pRenderer->Present(); - //if ( pRenderer->pRenderD3D ) - pRenderer->pBeforePresentFunction(); - pRenderer->SaveWinnersCertificate("MM7_Win.Pcx"); - free(pFont); - window_SpeakInHouse->Release(); - window_SpeakInHouse = 0; - if (v15 == (void *)2) - result = pMessageQueue_50CBD0->uNumMessages; - else - { - LODWORD(v23) = GetTickCount() + 5000; - while ((unsigned int)v23 > GetTickCount()) - ; - while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) - { - if (msg.message == WM_QUIT) - Engine_DeinitializeAndTerminate(0); - TranslateMessage(&msg); - DispatchMessage(&msg); - } - if (pMessageQueue_50CBD0->uNumMessages) - { - LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pMessageQueue_50CBD0->uNumMessages = v10; - } - pKeyActionMap->ResetKeys(); - pKeyActionMap->uLastKeyPressed = 0; - do - { - while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) - { - if (msg.message == WM_QUIT) - Engine_DeinitializeAndTerminate(0); - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } while (!pKeyActionMap->uLastKeyPressed); - result = pMessageQueue_50CBD0->uNumMessages; - if (pMessageQueue_50CBD0->uNumMessages) - { - result = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - } - } - if (v15) - { - /*if ( (signed int)result < 40 ) - { - pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit; - }*/ - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Quit, 1, 0); - } - else - { - pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ShowFinalWindow, 1, 0); - /*if ( (signed int)result < 40 ) - { - pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; - *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - } - bGameoverLoop = 0; - return result; -} + //----- (00464479) -------------------------------------------------------- void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() @@ -2428,11 +2254,11 @@ pGameLoadingUI_ProgressBar->Progress(); - pEngine->pIndoorCameraD3D->vPartyPos.x = 0; - pEngine->pIndoorCameraD3D->vPartyPos.y = 0; - pEngine->pIndoorCameraD3D->vPartyPos.z = 100; - pEngine->pIndoorCameraD3D->sRotationX = 0; - pEngine->pIndoorCameraD3D->sRotationY = 0; + pIndoorCameraD3D->vPartyPos.x = 0; + pIndoorCameraD3D->vPartyPos.y = 0; + pIndoorCameraD3D->vPartyPos.z = 100; + pIndoorCameraD3D->sRotationX = 0; + pIndoorCameraD3D->sRotationY = 0; viewparams->bRedrawGameUI = true; uLevel_StartingPointType = MapStartPoint_Party; pSprites_LOD->_461397();