Mercurial > mm7
diff Engine/Graphics/Outdoor.cpp @ 2541:a902abdfc7f2
1. Renamed class Game to class Engine.
2. Separated game logic as state of FSM from game logic as engine.
3. Found out that many UI screen initializers were optimized away, intially
they all returned newly created window as separate object like it is done
in CharacterUI_Initialize.
author | a.parshin |
---|---|
date | Sun, 10 May 2015 01:29:11 +0200 |
parents | 1bcadc6dd203 |
children | b6140dfeac27 |
line wrap: on
line diff
--- a/Engine/Graphics/Outdoor.cpp Sat May 09 12:55:58 2015 +0200 +++ b/Engine/Graphics/Outdoor.cpp Sun May 10 01:29:11 2015 +0200 @@ -3,39 +3,38 @@ #include <crtdbg.h> #define _CRT_SECURE_NO_WARNINGS -#include "../ErrorHandling.h" + +#include "Engine/Engine.h" #include "stru6.h" #include "Weather.h" #include "Sprites.h" #include "LightmapBuilder.h" #include "Outdoor.h" -#include "../Party.h" -#include "../Objects/SpriteObject.h" -#include "../LOD.h" +#include "Engine/Party.h" +#include "Engine/Objects/SpriteObject.h" +#include "Engine/LOD.h" #include "PaletteManager.h" #include "GUI/GUIProgressBar.h" #include "Media/Audio/AudioPlayer.h" #include "DecorationList.h" -#include "../OurMath.h" -#include "../Objects/ObjectList.h" -#include "../Game.h" -#include "../Objects/Actor.h" -#include "../Objects/Chest.h" -#include "../stru123.h" -#include "../Timer.h" +#include "Engine/OurMath.h" +#include "Engine/Objects/ObjectList.h" +#include "Engine/Objects/Actor.h" +#include "Engine/Objects/Chest.h" +#include "Engine/stru123.h" +#include "Engine/Timer.h" #include "Viewport.h" -#include "../Events.h" +#include "Engine/Events.h" #include "ParticleEngine.h" -#include "../TurnEngine/TurnEngine.h" - -#include "../MM7.h" +#include "Engine/TurnEngine/TurnEngine.h" + #include "Lights.h" #include "GUI/GUIWindow.h" #include "Level/Decoration.h" -#include "../ZlibWrapper.h" -#include "../MMT.h" +#include "Engine/ZlibWrapper.h" +#include "Engine/MMT.h" MapStartPoint uLevel_StartingPointType; // weak @@ -84,9 +83,9 @@ void OutdoorLocation::ExecDraw(unsigned int bRedraw) { - pGame->pIndoorCameraD3D->debug_flags = 0; + pEngine->pIndoorCameraD3D->debug_flags = 0; if (viewparams->draw_d3d_outlines) - pGame->pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES; + pEngine->pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES; if (bRedraw || true/*pRenderer->pRenderD3D*/) { @@ -105,7 +104,7 @@ if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute ) pOutdoor->UpdateSunlightVectors(); pOutdoor->UpdateFog(); - //pGame->pIndoorCameraD3D->sr_Reset_list_0037C(); + //pEngine->pIndoorCameraD3D->sr_Reset_list_0037C(); //if (pRenderer->pRenderD3D) // d3d - redraw always { @@ -133,17 +132,17 @@ /*if ( !pRenderer->pRenderD3D ) { pRenderer->ExecOutdoorDrawSW(); - pGame->pIndoorCameraD3D->sr_438240_draw_lits(); + pEngine->pIndoorCameraD3D->sr_438240_draw_lits(); }*/ - pGame->PushStationaryLights(-1); - pGame->PrepareBloodsplats(); + pEngine->PushStationaryLights(-1); + pEngine->PrepareBloodsplats(); if (bRedraw) pOutdoor->UpdateDiscoveredArea(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y), 1); - pGame->uFlags2 &= 0xFFFFFFFEu;//~0x00000001 + pEngine->uFlags2 &= 0xFFFFFFFEu;//~0x00000001 if (/*pRenderer->pRenderD3D*/true && pRenderer->bUsingSpecular) - pGame->pLightmapBuilder->uFlags |= 1; + pEngine->pLightmapBuilder->uFlags |= 1; else - pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu;//~0x00000001 + pEngine->pLightmapBuilder->uFlags &= 0xFFFFFFFEu;//~0x00000001 uNumDecorationsDrawnThisFrame = 0; uNumSpritesDrawnThisFrame = 0; @@ -162,11 +161,11 @@ void OutdoorLocation::Draw() { bool redrawWorld = true; - if ( !(pParty->uFlags & 2) && !(pGame->uFlags2 & 1) ) + if ( !(pParty->uFlags & 2) && !(pEngine->uFlags2 & 1) ) redrawWorld = false; pOutdoor->ExecDraw(redrawWorld); - pGame->DrawParticles(); + pEngine->DrawParticles(); //pWeather->Draw();//если раскомментировать скорость снега быстрее trail_particle_generator.UpdateParticles(); } @@ -623,9 +622,9 @@ currVertex--; } - if ( ((double)pGame->pIndoorCameraD3D->vPartyPos.x - a2->vWorldPosition.x) * v26 - + ((double)pGame->pIndoorCameraD3D->vPartyPos.z - a2->vWorldPosition.z) * v25 - + ((double)pGame->pIndoorCameraD3D->vPartyPos.y - a2->vWorldPosition.y) * v24 > 0.0 ) + if ( ((double)pEngine->pIndoorCameraD3D->vPartyPos.x - a2->vWorldPosition.x) * v26 + + ((double)pEngine->pIndoorCameraD3D->vPartyPos.z - a2->vWorldPosition.z) * v25 + + ((double)pEngine->pIndoorCameraD3D->vPartyPos.y - a2->vWorldPosition.y) * v24 > 0.0 ) { v19 = a2[1].vWorldViewPosition.x - a2->vWorldViewPosition.x; @@ -2438,7 +2437,7 @@ else { v49 = 1; - pGame->pStru6Instance->_4A7F74(pActors[i].vPosition.x, pActors[i].vPosition.y, z); + pEngine->pStru6Instance->_4A7F74(pActors[i].vPosition.x, pActors[i].vPosition.y, z); v4 = (1.0 - (double)pActors[i].uCurrentActionTime / (double)pActors[i].uCurrentActionLength) * (double)(2 * pActors[i].uActorHeight); z -= floorf(v4 + 0.5f); @@ -2446,8 +2445,8 @@ z = pActors[i].vPosition.z; } } - v8 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, - pActors[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); + v8 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x, + pActors[i].vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y); LOWORD(v9) = pActors[i].uYawAngle; v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; if ( pParty->bTurnBasedModeOn ) @@ -2486,34 +2485,34 @@ //LOBYTE(v16) = _4E94D3_light_type; pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type); } - v17 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; - if (pGame->pIndoorCameraD3D->sRotationX) + v17 = (x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16; + if (pEngine->pIndoorCameraD3D->sRotationX) { - v18 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v47 = (fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_sine_y)); - v50 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_sine_y); - v53 = fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_cosine_y); - v44 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; - v19 = (fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_cosine_x)); - X = fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_cosine_x); + v18 = (y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16; + v47 = (fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_sine_y)); + v50 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_sine_y); + v53 = fixpoint_mul(v18, pEngine->pIndoorCameraD3D->int_cosine_y); + v44 = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; + v19 = (fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_cosine_x)); + X = fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_cosine_x); if ( v19 < 262144 || v19 > pODMRenderParams->shading_dist_mist << 16 ) continue; v20 = v53 - v50; v42 = v53 - v50; - v21 = (fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_sine_x)); + v21 = (fixpoint_mul(v44, pEngine->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v47, pEngine->pIndoorCameraD3D->int_sine_x)); } else { - v48 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; - v51 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y); - v22 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_sine_y); + v48 = (y - pEngine->pIndoorCameraD3D->vPartyPos.y) << 16; + v51 = fixpoint_mul(v17, pEngine->pIndoorCameraD3D->int_cosine_y); + v22 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_sine_y); X = v22 + v51; if ( v22 + v51 < 262144 || v22 + v51 > pODMRenderParams->shading_dist_mist << 16 ) continue; - v23 = fixpoint_mul(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16), pGame->pIndoorCameraD3D->int_sine_y); - v20 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_cosine_y) - v23; - v42 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_cosine_y) - v23; - v21 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; + v23 = fixpoint_mul(((x - pEngine->pIndoorCameraD3D->vPartyPos.x) << 16), pEngine->pIndoorCameraD3D->int_sine_y); + v20 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_cosine_y) - v23; + v42 = fixpoint_mul(v48, pEngine->pIndoorCameraD3D->int_cosine_y) - v23; + v21 = (z - pEngine->pIndoorCameraD3D->vPartyPos.z) << 16; } v45 = v21; v24 = abs(v20); @@ -2545,7 +2544,7 @@ { if ( pActors[i].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0 ) { - pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(pGame->pStru6Instance->_4A806F(&pActors[i]), + pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(pEngine->pStru6Instance->_4A806F(&pActors[i]), pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat); LOWORD(v27) = v43; } @@ -4539,8 +4538,8 @@ strcpy(Source, &pFilename[v7]); strcpy(pOutdoor->pLevelFilename, Source); pWeather->Initialize(); - pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; - pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX; + pEngine->pIndoorCameraD3D->sRotationY = pParty->sRotationY; + pEngine->pIndoorCameraD3D->sRotationX = pParty->sRotationX; //pODMRenderParams->RotationToInts(); pOutdoor->UpdateSunlightVectors();