Mercurial > mm7
changeset 1214:0d6c7ff3cddd
simplified stru193_math constructor and class definition
GAME_STATE_3 to GAME_STATE_LOADING_GAME
author | Grumpy7 |
---|---|
date | Sun, 09 Jun 2013 16:06:12 +0200 |
parents | 8192b25d356c |
children | 68655becb94b |
files | Game.cpp Game.h Math.h mm7_2.cpp mm7_5.cpp |
diffstat | 5 files changed, 23 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/Game.cpp Sun Jun 09 16:04:02 2013 +0200 +++ b/Game.cpp Sun Jun 09 16:06:12 2013 +0200 @@ -550,7 +550,7 @@ dword_6BE340 = 0; pEventTimer->Pause(); ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); - if ( uGameState == GAME_STATE_3 ) + if ( uGameState == GAME_STATE_LOADING_GAME ) { sub_491E3A(); LoadPlayerPortraintsAndVoices();
--- a/Game.h Sun Jun 09 16:04:02 2013 +0200 +++ b/Game.h Sun Jun 09 16:06:12 2013 +0200 @@ -16,7 +16,7 @@ GAME_STATE_PLAYING = 0, GAME_FINISHED = 1, GAME_STATE_2 = 2, - GAME_STATE_3 = 3, + GAME_STATE_LOADING_GAME = 3, GAME_STATE_NEWGAME_OUT_GAMEMENU = 4, GAME_STATE_5 = 5, GAME_STATE_STARTING_NEW_GAME = 6,
--- a/Math.h Sun Jun 09 16:04:02 2013 +0200 +++ b/Math.h Sun Jun 09 16:06:12 2013 +0200 @@ -16,12 +16,12 @@ int pTanTable[520]; int pCosTable[520]; int pInvCosTable[520]; - unsigned int uIntegerPi; - unsigned int uIntegerHalfPi; - unsigned int uIntegerDoublePi; - unsigned int uDoublePiMask; - unsigned int uPiMask; - unsigned int uHalfPiMask; + static const unsigned int uIntegerPi = 1024; + static const unsigned int uIntegerHalfPi = 512; + static const unsigned int uIntegerDoublePi = 2048; + static const unsigned int uDoublePiMask = 2047; + static const unsigned int uPiMask = 1023; + static const unsigned int uHalfPiMask = 511; }; #pragma pack(pop)
--- a/mm7_2.cpp Sun Jun 09 16:04:02 2013 +0200 +++ b/mm7_2.cpp Sun Jun 09 16:06:12 2013 +0200 @@ -3769,50 +3769,23 @@ //----- (00452969) -------------------------------------------------------- stru193_math::stru193_math() { - stru193_math *v1; // esi@1 - char *v2; // edi@1 double v3; // ST18_8@2 - signed int v4; // edx@3 - int v5; // eax@4 - int v6; // ecx@4 - signed int v7; // [sp+20h] [bp-4h]@1 - - v1 = this; - this->uIntegerDoublePi = 2048; - this->uIntegerPi = 1024; - this->uIntegerHalfPi = 512; - this->uDoublePiMask = 2047; - this->uPiMask = 1023; - this->uHalfPiMask = 511; + this->pTanTable[0] = 0; this->pCosTable[0] = 65536; this->pInvCosTable[0] = 65536; - v7 = 1; - v2 = (char *)&this->pInvCosTable[1]; - do - { - v3 = (double)v7 * 3.141592653589793 * 0.0009765625; - *((int *)v2 - 1040) = (signed __int64)(tan(v3) * (double)v1->pCosTable[0] + 0.5); - *((int *)v2 - 520) = (signed __int64)(cos(v3) * (double)v1->pCosTable[0] + 0.5); - ++v7; - *(int *)v2 = (signed __int64)(1.0 / cos(v3) * (double)v1->pCosTable[0] + 0.5); - v2 += 4; - } - while ( v7 < (signed int)v1->uIntegerHalfPi ); - v4 = v1->uIntegerHalfPi; - if ( v4 < 520 ) - { - v5 = (int)&v1->pCosTable[v4]; - v6 = 520 - v4; - do - { - *(int *)v5 = 0; - *(int *)(v5 + 2080) = 0xEFFFFFFFu; - *(int *)(v5 - 2080) = 0xEFFFFFFFu; - v5 += 4; - --v6; - } - while ( v6 ); + for(int i = 1; i < (signed int)this->uIntegerHalfPi; i++) + { + v3 = (double)i * 3.141592653589793 / (double)uIntegerPi; + pTanTable[i] = (signed __int64)(tan(v3) * (double)this->pCosTable[0] + 0.5); + pCosTable[i] = (signed __int64)(cos(v3) * (double)this->pCosTable[0] + 0.5); + pInvCosTable[i] = (signed __int64)(1.0 / cos(v3) * (double)this->pCosTable[0] + 0.5); + } + for(int i = this->uIntegerHalfPi; i < 520; i++) + { + this->pTanTable[i] = 0xEFFFFFFFu; + this->pCosTable[i] = 0; + this->pInvCosTable[i] = 0xEFFFFFFFu; } } @@ -8218,7 +8191,7 @@ //LABEL_48: pGame->Loop(); LABEL_49: - if ( uGameState == GAME_STATE_3 ) + if ( uGameState == GAME_STATE_LOADING_GAME ) { SetCurrentMenuID(MENU_5); uGameState = GAME_STATE_PLAYING;
--- a/mm7_5.cpp Sun Jun 09 16:04:02 2013 +0200 +++ b/mm7_5.cpp Sun Jun 09 16:06:12 2013 +0200 @@ -486,7 +486,7 @@ if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) { LoadGame(uLoadGameUI_SelectedSlot); - uGameState = GAME_STATE_3; + uGameState = GAME_STATE_LOADING_GAME; } stru_506E40.Release(); continue;