Mercurial > mm7
changeset 718:a5ee769b02c6
Слияние
author | Ritor1 |
---|---|
date | Mon, 18 Mar 2013 01:51:31 +0600 |
parents | d5473972234d (current diff) 1d05543f522d (diff) |
children | d394cc892106 |
files | Indoor.cpp Render.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp |
diffstat | 29 files changed, 2128 insertions(+), 1740 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Actor.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -3933,20 +3933,10 @@ //----- (0045959A) -------------------------------------------------------- void Actor::PrepareSprites(char load_sounds_if_bit1_set) { - //Actor *v2; // edi@1 - MonsterDesc *v3; // esi@1 - //__int16 v4; // ax@2 - unsigned __int16 *v5; // ecx@4 - unsigned __int16 *v6; // eax@4 - signed int v7; // edx@4 - //char pSpriteName[120]; // [sp+Ch] [bp-88h]@2 + + MonsterDesc *v3; // esi@1 MonsterInfo *v9; // [sp+84h] [bp-10h]@1 - //int v10; // [sp+88h] [bp-Ch]@1 - //char *Source; // [sp+8Ch] [bp-8h]@1 - //unsigned __int16 *v12; // [sp+90h] [bp-4h]@1 - - //v2 = this; - //v10 = 8; + v3 = &pMonsterList->pMonsters[pMonsterInfo.uID - 1]; v9 = &pMonsterStats->pInfos[pMonsterInfo.uID - 1 + 1]; //v12 = pSpriteIDs; @@ -3956,29 +3946,15 @@ { //strcpy(pSpriteName, v3->pSpriteNames[i]); pSpriteIDs[i] = pSpriteFrameTable->FastFindSprite(v3->pSpriteNames[i]); - //*v12 = v4; pSpriteFrameTable->InitializeSprite(pSpriteIDs[i]); - //++v12; - //Source += 10; - //--v10; } - //while ( v10 ); uActorHeight = v3->uMonsterHeight; uActorRadius = v3->uMonsterRadius; uMovementSpeed = v9->uBaseSpeed; if ( !(load_sounds_if_bit1_set & 1) ) { - v5 = pSoundSampleIDs; - v6 = v3->pSoundSampleIDs; - v7 = 4; - do - { - *v5 = *v6; - ++v6; - ++v5; - --v7; - } - while ( v7 ); + for (int i=0;i<4;++i ) + pSoundSampleIDs[i]=v3->pSoundSampleIDs[i]; } }
--- a/Allocator.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Allocator.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -75,7 +75,7 @@ AbortWithError(); } - pMemoryBuffers[uNumBuffersUsed] = (char *)(pBigBufferAligned) + uNextFreeOffsetInBigBuffer; + pMemoryBuffers[uNumBuffersUsed] = (char *)pBigMemoryBuffer + uNextFreeOffsetInBigBuffer;//(char *)(pBigBufferAligned) + uNextFreeOffsetInBigBuffer; uMemoryBuffersSizes[uNumBuffersUsed] =aligned_size; if (pName) @@ -201,8 +201,8 @@ for (indx = 0; indx <=uNumBuffersUsed; ++indx) if (pMemoryBuffers[indx] == ptr) break; - // if ((indx>uNumBuffersUsed)&& !aborting_app ) -// AbortWithError(); to detect memory problems - uncomment + if ((indx>uNumBuffersUsed)&& !aborting_app ) + AbortWithError(); //to detect memory problems - uncomment if (!bUseBigBuffer) free(pMemoryBuffers[indx]); pMemoryBuffers[indx] = NULL;
--- a/GUIButton.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/GUIButton.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -113,12 +113,14 @@ //----- (0041D0D8) -------------------------------------------------------- -void GUIButton::_41D0D8(GUIButton *ptr) +void GUIButton::Release() { GUIWindow *v1; // eax@2 GUIButton *v2; // edx@2 GUIButton *v3; // eax@6 + GUIButton *ptr; + ptr=this; if ( ptr ) { v1 = ptr->pParent;
--- a/GUIButton.h Mon Mar 18 01:50:50 2013 +0600 +++ b/GUIButton.h Mon Mar 18 01:51:31 2013 +0600 @@ -7,7 +7,7 @@ { char DrawLabel(const char *edx0, struct GUIFont *pFont, int a5, int *a9); - static void _41D0D8(GUIButton *ptr); + void Release(); unsigned int uX;
--- a/GUIWindow.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/GUIWindow.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -294,11 +294,6 @@ void GUIWindow::Release() { GUIWindow *v1; // esi@1 - unsigned int v2; // eax@2 - int v3; // eax@5 - int v4; // eax@6 - int v5; // eax@14 - int v6; // eax@15 int i; // edi@20 GUIButton *v8; // eax@26 GUIButton *v9; // edi@27 @@ -309,82 +304,78 @@ v1 = this; if ( !this ) return; - v2 = this->eWindowType; - if ( (signed int)v2 > 18 ) + + switch( this->eWindowType ) { - v5 = v2 - 19; - if ( !v5 ) - { - pIcons_LOD->_40F9C5(); - pCurrentScreen = pMainScreenNum; - pKeyActionMap->_459ED1(3); - goto LABEL_26; - } - v6 = v5 - 6; - if ( !v6 ) - { - for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) - pDialogueNPCPortraits[i]->Release(); - uNumDialogueNPCPortraits = 0; - pTexture_Dialogue_Background->Release(); + case WINDOW_GreetingNPC: + { + pIcons_LOD->_40F9C5(); + pCurrentScreen = pMainScreenNum; + pKeyActionMap->_459ED1(3); + break; + } + case WINDOW_HouseInterior: + { + for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) + pDialogueNPCPortraits[i]->Release(); + uNumDialogueNPCPortraits = 0; + pTexture_Dialogue_Background->Release(); - pIcons_LOD->_40F9C5(); - pIcons_LOD->_4114F2(); - dword_5C35D4 = 0; - if ( bFlipOnExit ) - { - pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi - + pIndoorCamera->sRotationY); - pParty->sRotationY = pIndoorCamera->sRotationY; - } - pParty->uFlags |= 2u; - goto LABEL_26; - } - if ( v6 == 1 ) - { - pVideoPlayer->Unload(); - goto LABEL_18; - } - } - else - { - if ( v2 == 18 ) - { - sub_41140B(); - sub_411473(); - } - else - { - if ( !v2 ) - return; - v3 = v2 - 9; - if ( v3 ) - { - v4 = v3 - 1; - if ( !v4 ) - { - if ( !dword_591084 ) - pDialogueNPCPortraits[0]->Release(); - uNumDialogueNPCPortraits = 0; - pTexture_Dialogue_Background->Release(); - - pIcons_LOD->_40F9C5(); - goto LABEL_19; - } - if ( v4 != 7 ) - goto LABEL_26; -LABEL_18: + pIcons_LOD->_40F9C5(); + pIcons_LOD->_4114F2(); + dword_5C35D4 = 0; + if ( bFlipOnExit ) + { + pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + + pIndoorCamera->sRotationY); + pParty->sRotationY = pIndoorCamera->sRotationY; + } + pParty->uFlags |= 2u; + break; + } + case WINDOW_Transition: + { + pVideoPlayer->Unload(); + pTexture_outside->Release(); + pTexture_Dialogue_Background->Release(); + pIcons_LOD->_40F9C5(); + pCurrentScreen = pMainScreenNum; + break; + } + case WINDOW_SpellBook: + { + sub_41140B(); + sub_411473(); + break; + } + case WINDOW_Book: + { + OnCloseSpellook(); + break; + } + case WINDOW_ChangeLocation: + { pTexture_outside->Release(); pTexture_Dialogue_Background->Release(); pIcons_LOD->_40F9C5(); -LABEL_19: pCurrentScreen = pMainScreenNum; - goto LABEL_26; - } - OnCloseSpellook(); - } + break; + } + case WINDOW_Dialogue: + { + if ( !dword_591084 ) + pDialogueNPCPortraits[0]->Release(); + uNumDialogueNPCPortraits = 0; + pTexture_Dialogue_Background->Release(); + + pIcons_LOD->_40F9C5(); + pCurrentScreen = pMainScreenNum; + } + default: + { + break; + } } -LABEL_26: v8 = v1->pControlsHead; if ( v8 ) { @@ -548,10 +539,10 @@ pTex_tab_an_7b__zoot_on = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-7b", TEXTURE_16BIT_PALETTE)]; pTex_tab_an_6a__zoom_off = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-6a", TEXTURE_16BIT_PALETTE)]; pTex_tab_an_7a__zoot_off = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-7a", TEXTURE_16BIT_PALETTE)]; - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportX + 398, pViewport->uViewportY + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, + pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, 0x47u, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportX + 398, pViewport->uViewportY + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, + pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, 0x47u, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" pTex_tab_an_7b__zoot_on, 0); awards_count = 0; @@ -590,21 +581,21 @@ pTexture_506370 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-4a", TEXTURE_16BIT_PALETTE)]; pTexture_50636C = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-8b", TEXTURE_16BIT_PALETTE)]; pTexture_506368 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-8a", TEXTURE_16BIT_PALETTE)]; - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportX + 398, pViewport->uViewportY + 1, 0x32u, 0x22u, 1, 0, 0x47u, 0xBu, 0, + pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 0x32u, 0x22u, 1, 0, 0x47u, 0xBu, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportX + 398, pViewport->uViewportY + 38, 0x32u, 0x22u, 1, 0, 0x47u, 0xAu, 0, + pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 0x32u, 0x22u, 1, 0, 0x47u, 0xAu, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0); - pBtn_Book_3 = v1->CreateButton(pViewport->uViewportX + 398, pViewport->uViewportY + 113, 0x32u, 0x22u, 1, 0, 0x47u, 2u, 0, + pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 0x32u, 0x22u, 1, 0, 0x47u, 2u, 0, pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0);// "Potion Notes" - pBtn_Book_4 = v1->CreateButton(pViewport->uViewportX + 399, pViewport->uViewportY + 150, 0x32u, 0x22u, 1, 0, 0x47u, 3u, 0, + pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 0x32u, 0x22u, 1, 0, 0x47u, 3u, 0, pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0);// "Fountain Notes" - pBtn_Book_5 = v1->CreateButton(pViewport->uViewportX + 397, pViewport->uViewportY + 188, 0x32u, 0x22u, 1, 0, 0x47u, 4u, 0, + pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 0x32u, 0x22u, 1, 0, 0x47u, 4u, 0, pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0);// "Obelisk Notes" - pBtn_Book_6 = v1->CreateButton(pViewport->uViewportX + 397, pViewport->uViewportY + 226, 0x32u, 0x22u, 1, 0, 0x47u, 5u, 0, + pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 0x32u, 0x22u, 1, 0, 0x47u, 5u, 0, pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0);// "Seer Notes" - pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportX + 397, pViewport->uViewportY + 264, 0x32u, 0x22u, 1, 0, 0x47u, 6u, 0, + pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 0x32u, 0x22u, 1, 0, 0x47u, 6u, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0);// "Miscellaneous Notes" - v9 = v1->CreateButton(pViewport->uViewportX + 397, pViewport->uViewportY + 302, 0x32u, 0x22u, 1, 0, 0x47u, 7u, 0, + v9 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 0x32u, 0x22u, 1, 0, 0x47u, 7u, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0);// "Instructors" v10 = dword_506528; pBtn_Autonotes_Instructors = v9; @@ -644,17 +635,17 @@ pTexture_506380 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tabEoff", TEXTURE_16BIT_PALETTE)]; pTexture_50637C = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tabWon", TEXTURE_16BIT_PALETTE)]; pTexture_506378 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tabWoff", TEXTURE_16BIT_PALETTE)]; - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportX + 398, pViewport->uViewportY + 1, 0x32u, 0x22u, 1, 0, 0x47u, 0, 0, + pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 0x32u, 0x22u, 1, 0, 0x47u, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In" - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportX + 398, pViewport->uViewportY + 38, 0x32u, 0x22u, 1, 0, 0x47u, 1, 0, + pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 0x32u, 0x22u, 1, 0, 0x47u, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out" - pBtn_Book_3 = v1->CreateButton(pViewport->uViewportX + 397, pViewport->uViewportY + 113, 0x32u, 0x22u, 1, 0, 0x47u, 2, 0, + pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 0x32u, 0x22u, 1, 0, 0x47u, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up - pBtn_Book_4 = v1->CreateButton(pViewport->uViewportX + 397, pViewport->uViewportY + 150, 0x32u, 0x22u, 1, 0, 0x47u, 3, 0, + pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 0x32u, 0x22u, 1, 0, 0x47u, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down - pBtn_Book_5 = v1->CreateButton(pViewport->uViewportX + 397, pViewport->uViewportY + 188, 0x32u, 0x22u, 1, 0, 0x47u, 4, 0, + pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 0x32u, 0x22u, 1, 0, 0x47u, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right" - pBtn_Book_6 = v1->CreateButton(pViewport->uViewportX + 397, pViewport->uViewportY + 226, 0x32u, 0x22u, 1, 0, 0x47u, 5, 0, + pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 0x32u, 0x22u, 1, 0, 0x47u, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left" } break; @@ -675,8 +666,8 @@ pTex_tab_an_6a__zoom_off = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-6a", TEXTURE_16BIT_PALETTE)]; pTex_tab_an_7a__zoot_off = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("tab-an-7a", TEXTURE_16BIT_PALETTE)]; pBtn_Book_1 = v1->CreateButton( - pViewport->uViewportX + 398, - pViewport->uViewportY + 1, + pViewport->uViewportTL_X + 398, + pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, @@ -688,8 +679,8 @@ pTex_tab_an_6b__zoom_on, 0); pBtn_Book_2 = v1->CreateButton( - pViewport->uViewportX + 398, - pViewport->uViewportY + 38, + pViewport->uViewportTL_X + 398, + pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, @@ -782,10 +773,10 @@ v3 = this; if ( arg0 ) { - v4 = pViewport->uViewportX; - v5 = pViewport->uViewportZ; - v2 = pViewport->uViewportY; - v22 = pViewport->uViewportW; + v4 = pViewport->uViewportTL_X; + v5 = pViewport->uViewportBR_X; + v2 = pViewport->uViewportTL_Y; + v22 = pViewport->uViewportBR_Y; } else { @@ -972,8 +963,8 @@ continue; v4= pPlayer->lastOpenedSpellbookPage; //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); - CreateButton(pViewport->uViewportX + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos, - pViewport->uViewportY + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0 + CreateButton(pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos, + pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0 dword_506408[i + 1]->uTextureWidth, dword_506408[i + 1]->uTextureHeight, 1, 79, 0x56u, i, 0, "", 0);
--- a/Game.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Game.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -142,8 +142,8 @@ if (v4) { if ( !PauseGameDrawing() && pRenderer->pRenderD3D) // clear game viewport with transparent color - pRenderer->FillRectFast(pViewport->uViewportX, pViewport->uViewportY, pViewport->uViewportZ - pViewport->uViewportX, - pViewport->uViewportW - pViewport->uViewportY + 1, + pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pViewport->uViewportBR_X - pViewport->uViewportTL_X, + pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, pRenderer->uTargetGMask | pRenderer->uTargetBMask); viewparams->field_48 = 0; } @@ -1034,10 +1034,10 @@ return false; } - if (uMouseX >= (signed int)pViewport->uScreenX && - uMouseX <= (signed int)pViewport->uScreenZ && - uMouseY >= (signed int)pViewport->uScreenY && - uMouseY <= (signed int)pViewport->uScreenW) + if (uMouseX >= (signed int)pViewport->uScreen_TL_X && + uMouseX <= (signed int)pViewport->uScreen_BR_X && + uMouseY >= (signed int)pViewport->uScreen_TL_Y && + uMouseY <= (signed int)pViewport->uScreen_BR_Y) { pVisInstance->PickMouse(fPickDepth, uMouseX, uMouseY, sprite_filter, face_filter);
--- a/Indoor.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Indoor.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -380,10 +380,10 @@ _this.sRotationX = pParty->sRotationX; _this.sRotationY = pParty->sRotationY; _this.pRenderTarget = pRenderer->pTargetSurface; - _this.uViewportX = pViewport->uScreenX; - _this.uViewportY = pViewport->uScreenY; - _this.uViewportZ = pViewport->uScreenZ; - _this.uViewportW = pViewport->uScreenW; + _this.uViewportX = pViewport->uScreen_TL_X; + _this.uViewportY = pViewport->uScreen_TL_Y; + _this.uViewportZ = pViewport->uScreen_BR_X; + _this.uViewportW = pViewport->uScreen_BR_Y; _this.field_3C = pViewport->field_30; _this.uTargetWidth = 640;
--- a/IndoorCameraD3D.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/IndoorCameraD3D.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -674,10 +674,10 @@ } else { - if ( (double)(signed int)pViewport->uViewportX <= vert[0].vWorldViewProjX - 1.0 - && (double)(signed int)pViewport->uViewportZ > vert[0].vWorldViewProjX + 2.0 - && (double)(signed int)pViewport->uViewportY <= vert[0].vWorldViewProjY - 1.0 - && (double)(signed int)pViewport->uViewportW > vert[0].vWorldViewProjY + 2.0 + if ( (double)(signed int)pViewport->uViewportTL_X <= vert[0].vWorldViewProjX - 1.0 + && (double)(signed int)pViewport->uViewportBR_X > vert[0].vWorldViewProjX + 2.0 + && (double)(signed int)pViewport->uViewportTL_Y <= vert[0].vWorldViewProjY - 1.0 + && (double)(signed int)pViewport->uViewportBR_Y > vert[0].vWorldViewProjY + 2.0 && uNumD3DVertices > 0 ) { v13 = (char *)&pD3DVertices[0].diffuse; @@ -1064,7 +1064,7 @@ if ( fov_x > fov ) fov = fov_x; screenCenterX = (double)pViewport->uScreenCenterX; - screenCenterY = (double)(pViewport->uScreenCenterY - pViewport->uScreenY); + screenCenterY = (double)(pViewport->uScreenCenterY - pViewport->uScreen_TL_Y); } @@ -1609,7 +1609,7 @@ v7 = 1.0 / pVertices[i].vWorldViewPosition.x; pVertices[i].vWorldViewProjX = pVertices[i].vWorldViewPosition.y * fov * v7 + screenCenterX; - pVertices[i].vWorldViewProjY = (signed int)pViewport->uViewportW - (pVertices[i].vWorldViewPosition.z * fov * v7 + screenCenterY); + pVertices[i].vWorldViewProjY = (signed int)pViewport->uViewportBR_Y - (pVertices[i].vWorldViewPosition.z * fov * v7 + screenCenterY); } else { @@ -1620,12 +1620,12 @@ if ( a4 ) { // __debugbreak(); - v8 = (double)(signed int)pViewport->uViewportZ; + v8 = (double)(signed int)pViewport->uViewportBR_X; if ( v8 >= pVertices[i].vWorldViewProjX ) v9 = pVertices[i].vWorldViewProjX; else v9 = v8; - v10 = (double)(signed int)pViewport->uViewportX; + v10 = (double)(signed int)pViewport->uViewportTL_X; if ( v10 <= v9 ) { if ( v8 >= pVertices[i].vWorldViewProjX) @@ -1637,12 +1637,12 @@ v8 = uNumVerticesa; } pVertices[i].vWorldViewProjX = v8; - v11 = (double)(signed int)pViewport->uViewportW; + v11 = (double)(signed int)pViewport->uViewportBR_Y; if ( v11 >= pVertices[i].vWorldViewProjY) v12 = pVertices[i].vWorldViewProjY; else v12 = v11; - v13 = (double)(signed int)pViewport->uViewportY; + v13 = (double)(signed int)pViewport->uViewportTL_Y; if ( v13 <= v12 ) { if ( v11 >= pVertices[i].vWorldViewProjY) @@ -1678,7 +1678,7 @@ *a5 = floorf(a2a + 0.5f); a2b = (double)z * fov * v6 + screenCenterY; //v8 = a2b + 6.7553994e15; - *a6 = pViewport->uViewportW - floorf(a2b + 0.5f); + *a6 = pViewport->uViewportBR_Y - floorf(a2b + 0.5f); } else {
--- a/LOD.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/LOD.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -251,7 +251,7 @@ } } - if (uNumLoadedSprites == 1500 ) + if (uNumLoadedSprites >= 1500 ) return -1; //if not loaded - load from file @@ -275,7 +275,8 @@ sprite_file = FindContainer(pContainerName, 0); if ( !sprite_file ) return -1; - fread(&temp_sprite_hdr, 1, sizeof(LODSprite), sprite_file); + //fread(&temp_sprite_hdr, 1, sizeof(LODSprite), sprite_file); + fread(&temp_sprite_hdr, 1, 0x20, sprite_file); pHardwareSprites[uNumLoadedSprites].uBufferWidth = temp_sprite_hdr.uWidth; pHardwareSprites[uNumLoadedSprites].uBufferHeight = temp_sprite_hdr.uHeight; pSpriteHeaders[uNumLoadedSprites].uWidth = temp_sprite_hdr.uWidth;
--- a/Monsters.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Monsters.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -16,6 +16,388 @@ struct MonsterStats *pMonsterStats; struct MonsterList *pMonsterList; +unsigned int __fastcall ParseSpellType(struct FrameTableTxtLine *, int a2); + +int ParseAttackType(const char *damage_type_str); +void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus ); +int ParseMissleAttackType(const char *missle_attack_str); +int ParseSpecialAttack(const char *spec_att_str); + +//----- (004548E2) -------------------------------------------------------- + unsigned int __fastcall ParseSpellType(FrameTableTxtLine *a1, int a2) + { + int v2; // edi@1 + int v3; // esi@1 + unsigned int result; // eax@1 + std::string v5; // [sp-18h] [bp-28h]@75 + const char *v6; // [sp-8h] [bp-18h]@75 + signed int v7; // [sp-4h] [bp-14h]@3 + std::string *v8; // [sp+8h] [bp-8h]@75 + int a3; // [sp+Fh] [bp-1h]@75 + + v2 = (int)a1; + v3 = a2; + result = (int)a1->pProperties[0]; + if ( result ) + { + if ( !_strcmpi((const char *)result, "Dispel") ) + { + v7 = 80; +LABEL_71: + result = v7; +LABEL_76: + ++*(int *)v3; + return result; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Day") ) + { + if ( _strcmpi(*(const char **)(v2 + 4), "Hour") ) + { + if ( _strcmpi(*(const char **)(v2 + 4), "Shield") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Spirit") ) + { + v7 = 52; + goto LABEL_71; + } + if ( !_strcmpi(*(const char **)(v2 + 4), "Power") ) + { + v7 = 77; + goto LABEL_71; + } + if ( !_strcmpi(*(const char **)(v2 + 4), "Meteor") ) + { + v7 = 9; + goto LABEL_71; + } + if ( !_strcmpi(*(const char **)(v2 + 4), "Lightning") ) + { + v7 = 18; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Implosion") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Stone") ) + { + v7 = 38; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Haste") ) + { + if ( _strcmpi(*(const char **)(v2 + 4), "Heroism") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Pain") ) + { + v7 = 95; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Sparks") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Light") ) + { + v7 = 78; + goto LABEL_71; + } + if ( !_strcmpi(*(const char **)(v2 + 4), "Toxic") ) + { + v7 = 90; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "ShrapMetal") ) + { + if ( _strcmpi(*(const char **)(v2 + 4), "Paralyze") ) + { + if ( _strcmpi(*(const char **)(v2 + 4), "Fireball") ) + { + if ( _strcmpi(*(const char **)(v2 + 4), "Incinerate") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Fire") ) + { + v7 = 2; + goto LABEL_71; + } + if ( !_strcmpi(*(const char **)(v2 + 4), "Rock") ) + { + v7 = 41; + goto LABEL_71; + } + if ( !_strcmpi(*(const char **)(v2 + 4), "Mass") ) + { + v7 = 44; + goto LABEL_71; + } + if ( !_strcmpi(*(const char **)(v2 + 4), "Ice") ) + { + v7 = 26; + goto LABEL_71; + } + if ( !_strcmpi(*(const char **)(v2 + 4), "Acid") ) + { + v7 = 29; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Bless") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Dragon") ) + { + v7 = 97; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Reanimate") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Summon") ) + { + v7 = 82; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Fate") ) + { + if ( _strcmpi(*(const char **)(v2 + 4), "Harm") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Mind") ) + { + v7 = 57; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Blades") ) + { + if ( !_strcmpi(*(const char **)(v2 + 4), "Psychic") ) + { + v7 = 65; + goto LABEL_71; + } + if ( _strcmpi(*(const char **)(v2 + 4), "Hammerhands") ) + { + sprintf(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4)); + MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); + result = 0; + goto LABEL_76; + } + v7 = 73; + } + else + { + v7 = 39; + } + } + else + { + v7 = 70; + } + } + else + { + v7 = 47; + } + } + else + { + v7 = 89; + } + } + else + { + v7 = 46; + } + } + else + { + v7 = 11; + } + } + else + { + v7 = 6; + } + } + else + { + v7 = 81; + } + } + else + { + v7 = 93; + } + } + else + { + v7 = 15; + } + } + else + { + v7 = 51; + } + } + else + { + v7 = 5; + } + } + else + { + v7 = 20; + } + } + else + { + v7 = 17; + } + return v7; + } + v7 = 86; + } + else + { + v7 = 85; + } + *(int *)v3 += 2; + result = v7; + } + return result; + } + +//----- (00454CB4) -------------------------------------------------------- +int ParseAttackType( const char *damage_type_str ) + { + + switch (tolower(*damage_type_str)) + { + case 'f': return 0; //fire + case 'a': return 1; //air + case 'w': return 2; //water + case 'e': return 3; //earth + + case 's': return 6; //spirit + case 'm': return 7; //mind + //m ?? 8 + case 'l': return 9; //light + case 'd': return 10; //dark + // d?? 11 + } + return 4; //phis + + } + +//----- (00454D7D) -------------------------------------------------------- +void ParseDamage( char *damage_str, unsigned __int8* dice_rolls, unsigned __int8* dice_sides, unsigned __int8* dmg_bonus ) + { + int str_len=0; + int str_pos=0; + bool dice_flag=false; + + *dice_rolls = 0; + *dice_sides = 1; + *dmg_bonus = 0; + + str_len = strlen(damage_str); + if (str_len<=0) + return; + for (str_pos=0;str_pos<str_len;++str_pos ) + { + if (tolower(damage_str[str_pos])=='d') + { + damage_str[str_pos]='\0'; + *dice_rolls=atoi(damage_str); + *dice_sides=atoi(&damage_str[str_pos+1]); + dice_flag=true; + damage_str[str_pos]='d'; + } + else if (tolower(damage_str[str_pos])=='+') + *dmg_bonus=atoi(&damage_str[str_pos+1]); + } + if (!dice_flag) + { + if ((*damage_str>='0')&&(*damage_str<='9')) + { + *dice_rolls =atoi(damage_str); + *dice_sides = 1; + } + } + } + +//----- (00454E3A) -------------------------------------------------------- +int ParseMissleAttackType(const char *missle_attack_str) + { + if ( !_strcmpi(missle_attack_str, "ARROW") ) + return 1; + else if ( !_strcmpi(missle_attack_str, "ARROWF") ) + return 2; + else if ( !_strcmpi(missle_attack_str, "FIRE") ) + return 3; + else if ( !_strcmpi(missle_attack_str, "AIR") ) + return 4; + else if ( !_strcmpi(missle_attack_str, "WATER") ) + return 5; + else if ( !_strcmpi(missle_attack_str, "EARTH") ) + return 6; + else if ( !_strcmpi(missle_attack_str, "SPIRIT") ) + return 7; + else if ( !_strcmpi(missle_attack_str, "MIND") ) + return 8; + else if ( !_strcmpi(missle_attack_str, "BODY") ) + return 9; + else if ( !_strcmpi(missle_attack_str, "LIGHT") ) + return 10; + else if ( !_strcmpi(missle_attack_str, "DARK") ) + return 11; + else if ( !_strcmpi(missle_attack_str, "ENER") ) + return 13; + else return 0; + } + + +int ParseSpecialAttack(const char *spec_att_str) + { + if ( strstr(spec_att_str, "curse") ) + return 1; + else if ( strstr(spec_att_str, "weak") ) + return 2; + else if ( strstr(spec_att_str, "asleep") ) + return 3; + else if ( strstr(spec_att_str, "afraid") ) + return 23; + else if ( strstr(spec_att_str, "drunk") ) + return 4; + else if ( strstr(spec_att_str, "insane") ) + return 5; + else if ( strstr(spec_att_str, "poison1") ) + return 6; + else if ( strstr(spec_att_str, "poison2") ) + return 7; + else if ( strstr(spec_att_str, "poison3") ) + return 8; + else if ( strstr(spec_att_str, "disease1") ) + return 9; + else if ( strstr(spec_att_str, "disease2") ) + return 10; + else if ( strstr(spec_att_str, "disease3") ) + return 11; + else if ( strstr(spec_att_str, "paralyze") ) + return 12; + else if ( strstr(spec_att_str, "uncon") ) + return 13; + else if ( strstr(spec_att_str, "dead") ) + return 14; + else if ( strstr(spec_att_str, "stone") ) + return 15; + else if ( strstr(spec_att_str, "errad") ) + return 16; + else if ( strstr(spec_att_str, "brkitem") ) + return 17; + else if ( strstr(spec_att_str, "brkarmor") ) + return 18; + else if ( strstr(spec_att_str, "brkweapon") ) + return 19; + else if ( strstr(spec_att_str, "steal") ) + return 20; + else if ( strstr(spec_att_str, "age") ) + return 21; + else if ( strstr(spec_att_str, "drainsp") ) + return 22; + else return 0; + } //----- (004598FC) -------------------------------------------------------- bool MonsterList::FromFileTxt(const char *Args) @@ -159,8 +541,8 @@ void MonsterList::FromFile(void *pSerialized) { uNumMonsters = *(int *)pSerialized; - pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, 152 * uNumMonsters, "Mon Race"); - memcpy(pMonsters, (char *)pSerialized + 4, 152 * uNumMonsters); + pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, sizeof(MonsterDesc) * uNumMonsters, "Mon Race"); + memcpy(pMonsters, (char *)pSerialized + 4, sizeof(MonsterDesc) * uNumMonsters); } //----- (00459860) -------------------------------------------------------- @@ -182,13 +564,20 @@ //----- (004563FF) -------------------------------------------------------- -signed int MonsterStats::_4563FF(const char *Str2) +signed int MonsterStats::FindMonsterByName(const char *Str2) { MonsterStats *v2; // esi@1 signed int v3; // ebx@1 MonsterInfo *v4; // edi@2 signed int result; // eax@6 - +/* + for (int i=1; i<=uNumMonsters; ++i) + { + if() + return i; + } + return -1; + */ v2 = this; v3 = 1; if ( (signed int)this->uNumMonsters <= 1 ) @@ -199,7 +588,7 @@ else { v4 = &this->pInfos[1]; - while ( !v4->pName || _strcmpi(v4->pTexture, Str2) ) + while ( !v4->pName || _strcmpi(v4->pPictureName, Str2) ) { ++v3; ++v4; @@ -262,126 +651,585 @@ //----- (0045501E) -------------------------------------------------------- void MonsterStats::Initialize() -{ - MonsterStats *v1; // ebx@1 - int v2; // ebx@4 - char v3; // cl@5 - int v4; // eax@5 - size_t v5; // eax@19 - signed int v6; // edi@19 - MonsterStats *v7; // ecx@23 - int v8; // eax@23 - unsigned int *pHP; // esi@23 - size_t v10; // eax@29 - signed int v11; // edi@29 - MonsterStats *v12; // ecx@33 - int v13; // eax@33 - unsigned int *pExp; // esi@33 - signed int v15; // edi@36 - size_t v16; // esi@36 - int v17; // eax@37 - MonsterInfo *v18; // esi@45 - size_t v19; // edi@50 - int v20; // eax@51 - unsigned __int8 v21; // al@55 - size_t v22; // edi@59 - char v23; // cl@63 - const char *v24; // edi@63 - unsigned __int16 *v25; // esi@114 - int v26; // eax@118 - size_t v27; // eax@136 - int v28; // edi@137 - MonsterStats *v29; // esi@137 - int v30; // eax@138 - int v31; // eax@142 - int v32; // eax@143 - int v33; // eax@144 - int v34; // eax@151 - int v35; // eax@152 - int v36; // eax@153 - int v37; // eax@162 - int v38; // eax@163 - int v39; // eax@164 - int v40; // eax@171 - int v41; // eax@172 - size_t v42; // eax@180 - int v43; // edi@180 - MonsterInfo *v44; // esi@180 - int v45; // edi@184 - MonsterInfo *v46; // eax@232 - char *v47; // edx@232 - char *v48; // ecx@232 - MonsterInfo *v49; // eax@236 - FrameTableTxtLine *v50; // esi@240 - int v51; // eax@240 - int v52; // eax@241 - int v53; // esi@242 - int v54; // edi@242 - char v55; // al@242 - char *v56; // edi@242 - FrameTableTxtLine *v57; // esi@249 - int v58; // eax@249 - MonsterInfo *v59; // eax@250 - MonsterInfo *v60; // esi@251 - int v61; // edi@251 - char v62; // al@251 - char *v63; // edi@251 - char v64; // al@258 - char v65; // al@262 - char v66; // al@266 - char v67; // al@270 - char v68; // al@274 - char v69; // al@278 - char v70; // al@282 - char v71; // al@286 - char v72; // al@290 - unsigned __int8 v73; // al@294 - int v74; // edi@298 - MonsterInfo *v75; // esi@300 - MonsterInfo *v76; // esi@302 - char **v77; // edi@306 - __int16 v78; // ax@316 - MonsterInfo *v79; // esi@323 - const char *v80; // ecx@323 - std::string v81; // [sp-14h] [bp-46Ch]@317 - const char *v82; // [sp-8h] [bp-460h]@306 - char *v83; // [sp-4h] [bp-45Ch]@23 - char *v84; // [sp+0h] [bp-458h]@37 - FrameTableTxtLine v85; // [sp+10h] [bp-448h]@297 - FrameTableTxtLine v86; // [sp+8Ch] [bp-3CCh]@249 - FrameTableTxtLine v87; // [sp+108h] [bp-350h]@240 - char Src[120]; // [sp+184h] [bp-2D4h]@317 - FrameTableTxtLine v89; // [sp+1FCh] [bp-25Ch]@249 - FrameTableTxtLine v90; // [sp+278h] [bp-1E0h]@240 - char Str[64]; // [sp+2F4h] [bp-164h]@240 - char Dest[64]; // [sp+334h] [bp-124h]@249 - char v93[64]; // [sp+374h] [bp-E4h]@297 - FrameTableTxtLine v94; // [sp+3B4h] [bp-A4h]@297 - int v95; // [sp+430h] [bp-28h]@317 - int v96; // [sp+434h] [bp-24h]@9 - int v97; // [sp+438h] [bp-20h]@4 - char a3[5]; // [sp+43Fh] [bp-19h]@4 - int a2; // [sp+444h] [bp-14h]@36 - int v100; // [sp+448h] [bp-10h]@36 - size_t v101; // [sp+44Ch] [bp-Ch]@19 - MonsterStats *v102; // [sp+450h] [bp-8h]@1 - int v103; // [sp+454h] [bp-4h]@3 + { + MonsterStats *v1; // ebx@1 + int v2; // ebx@4 + char v3; // cl@5 + int v4; // eax@5 + size_t v5; // eax@19 + signed int v6; // edi@19 + MonsterStats *v7; // ecx@23 + int v8; // eax@23 + unsigned int *pHP; // esi@23 + size_t v10; // eax@29 + signed int v11; // edi@29 + MonsterStats *v12; // ecx@33 + int v13; // eax@33 + unsigned int *pExp; // esi@33 + signed int v15; // edi@36 + size_t v16; // esi@36 + int v17; // eax@37 + MonsterInfo *v18; // esi@45 + size_t v19; // edi@50 + int v20; // eax@51 + unsigned __int8 v21; // al@55 + size_t v22; // edi@59 + char v23; // cl@63 + const char *v24; // edi@63 + unsigned __int16 *v25; // esi@114 + int v26; // eax@118 + size_t v27; // eax@136 + int v28; // edi@137 + MonsterStats *v29; // esi@137 + int v30; // eax@138 + int v31; // eax@142 + int v32; // eax@143 + int v33; // eax@144 + int v34; // eax@151 + int v35; // eax@152 + int v36; // eax@153 + int v37; // eax@162 + int v38; // eax@163 + int v39; // eax@164 + int v40; // eax@171 + int v41; // eax@172 + size_t v42; // eax@180 + int v43; // edi@180 + MonsterInfo *v44; // esi@180 + int v45; // edi@184 + MonsterInfo *v46; // eax@232 + char *v47; // edx@232 + char *v48; // ecx@232 + MonsterInfo *v49; // eax@236 + FrameTableTxtLine *v50; // esi@240 + int v51; // eax@240 + int v52; // eax@241 + int v53; // esi@242 + int v54; // edi@242 + char v55; // al@242 + char *v56; // edi@242 + FrameTableTxtLine *v57; // esi@249 + int v58; // eax@249 + MonsterInfo *v59; // eax@250 + MonsterInfo *v60; // esi@251 + int v61; // edi@251 + char v62; // al@251 + char *v63; // edi@251 + char v64; // al@258 + char v65; // al@262 + char v66; // al@266 + char v67; // al@270 + char v68; // al@274 + char v69; // al@278 + char v70; // al@282 + char v71; // al@286 + char v72; // al@290 + unsigned __int8 v73; // al@294 + int v74; // edi@298 + MonsterInfo *v75; // esi@300 + MonsterInfo *v76; // esi@302 + char **v77; // edi@306 + __int16 v78; // ax@316 + MonsterInfo *v79; // esi@323 + const char *v80; // ecx@323 + std::string v81; // [sp-14h] [bp-46Ch]@317 + const char *v82; // [sp-8h] [bp-460h]@306 + char *v83; // [sp-4h] [bp-45Ch]@23 + char *v84; // [sp+0h] [bp-458h]@37 + FrameTableTxtLine v85; // [sp+10h] [bp-448h]@297 + FrameTableTxtLine v86; // [sp+8Ch] [bp-3CCh]@249 + FrameTableTxtLine v87; // [sp+108h] [bp-350h]@240 + char Src[120]; // [sp+184h] [bp-2D4h]@317 + FrameTableTxtLine v89; // [sp+1FCh] [bp-25Ch]@249 + FrameTableTxtLine v90; // [sp+278h] [bp-1E0h]@240 + char Str[64]; // [sp+2F4h] [bp-164h]@240 + char Dest[64]; // [sp+334h] [bp-124h]@249 + char v93[64]; // [sp+374h] [bp-E4h]@297 + FrameTableTxtLine v94; // [sp+3B4h] [bp-A4h]@297 + int v95; // [sp+430h] [bp-28h]@317 + int v96; // [sp+434h] [bp-24h]@9 + int v97; // [sp+438h] [bp-20h]@4 + char a3[5]; // [sp+43Fh] [bp-19h]@4 + int a2; // [sp+444h] [bp-14h]@36 + int v100; // [sp+448h] [bp-10h]@36 + size_t v101; // [sp+44Ch] [bp-Ch]@19 + MonsterStats *v102; // [sp+450h] [bp-8h]@1 + int v103; // [sp+454h] [bp-4h]@3 + + int i,j; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + int curr_rec_num; + + v1 = this; + v102 = this; + if ( pMonstersTXT_Raw ) + pAllocator->FreeChunk(pMonstersTXT_Raw); + pMonstersTXT_Raw = NULL; + pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0); + strtok(pMonstersTXT_Raw, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + strtok(NULL, "\r"); + uNumMonsters = 265; + curr_rec_num=0; + for (i=0;i<uNumMonsters-1;++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 0: + curr_rec_num=atoi(test_string); + pInfos[curr_rec_num].uID=curr_rec_num; + break; + case 1: + pInfos[curr_rec_num].pName=RemoveQuotes(test_string); + break; + case 2: + pInfos[curr_rec_num].pPictureName=RemoveQuotes(test_string); + break; + case 3: + pInfos[curr_rec_num].uLevel=atoi(test_string); + break; + case 4: + { + int str_len=0; + int str_pos=0; + pInfos[curr_rec_num].uHP=0; + if (test_string[0]=='"') + test_string[0]=' '; + str_len=strlen(test_string); + if (str_len==0) + break; + while ((test_string[str_pos]!=',')&&(str_pos<str_len)) + ++str_pos; + if (str_len==str_pos) + pInfos[curr_rec_num].uHP=atoi(test_string); + else + { + test_string[str_pos]='\0'; + pInfos[curr_rec_num].uHP=1000*atoi(test_string); + pInfos[curr_rec_num].uHP+=atoi(&test_string[str_pos+1]); + test_string[str_pos]=','; + } + } + break; + case 5: + pInfos[curr_rec_num].uAC=atoi(test_string); + break; + case 6: + { + int str_len=0; + int str_pos=0; + pInfos[curr_rec_num].uExp=0; + if (test_string[0]=='"') + test_string[0]=' '; + str_len=strlen(test_string); + if (str_len==0) + break; + while ((test_string[str_pos]!=',')&&(str_pos<str_len)) + ++str_pos; + if (str_len==str_pos) + pInfos[curr_rec_num].uExp=atoi(test_string); + else + { + test_string[str_pos]='\0'; + pInfos[curr_rec_num].uExp=1000*atoi(test_string); + pInfos[curr_rec_num].uExp+=atoi(&test_string[str_pos+1]); + test_string[str_pos]=','; + } + } + break; + case 7: + { + int str_len=0; + int str_pos=0; + bool chance_flag=false; + bool dice_flag=false; + bool item_type_flag=false; + char* item_name; + pInfos[curr_rec_num].uTreasureDropChance=0; + pInfos[curr_rec_num].uTreasureDiceRolls=0; + pInfos[curr_rec_num].uTreasureDiceSides=0; + pInfos[curr_rec_num].uTreasureType=0; + pInfos[curr_rec_num].uTreasureLevel=0; + if (test_string[0]=='"') + test_string[0]=' '; + str_len=strlen(test_string); + do + { + switch(tolower(test_string[str_pos])) + { + case '%': chance_flag=true; break; + case 'd': dice_flag=true; break; + case 'l': item_type_flag=true; break; + } + ++str_pos; + } + while(str_pos<str_len); + if (chance_flag) + { + pInfos[curr_rec_num].uTreasureDropChance=atoi(test_string); + } + else + { + if ((!dice_flag)&&(!item_type_flag)) + break; + pInfos[curr_rec_num].uTreasureDropChance=100; + } + if (dice_flag) + { + str_pos=0; + dice_flag=false; + do + { + switch(tolower(test_string[str_pos])) + { + case '%': + pInfos[curr_rec_num].uTreasureDiceRolls=atoi(&test_string[str_pos+1]); + dice_flag=true; + break; + case 'd': + if(!dice_flag) + pInfos[curr_rec_num].uTreasureDiceRolls=atoi(test_string); + pInfos[curr_rec_num].uTreasureDiceSides=atoi(&test_string[str_pos+1]); + str_pos=str_len; + break; - v1 = this; - v102 = this; - if ( pMonstersTXT_Raw ) - pAllocator->FreeChunk(pMonstersTXT_Raw); - pMonstersTXT_Raw = 0; - pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0); - strtok(pMonstersTXT_Raw, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); + } + ++str_pos; + } + while(str_pos<str_len); + } + if (item_type_flag) + { + str_pos=0; + do + { + if (tolower(test_string[str_pos])=='l') + break; + ++str_pos; + } + while(str_pos<str_len); + + pInfos[curr_rec_num].uTreasureLevel=test_string[str_pos+1]-'0'; + item_name=&test_string[str_pos+2]; + if (*item_name) + { + if ( !_strcmpi(item_name, "WEAPON")) + pInfos[curr_rec_num].uTreasureType= 20; + else if ( !_strcmpi(item_name, "ARMOR")) + pInfos[curr_rec_num].uTreasureType= 21; + else if ( !_strcmpi(item_name, "MISC")) + pInfos[curr_rec_num].uTreasureType= 22; + else if ( !_strcmpi(item_name, "SWORD")) + pInfos[curr_rec_num].uTreasureType= 23; + else if ( !_strcmpi(item_name, "DAGGER")) + pInfos[curr_rec_num].uTreasureType= 24; + else if ( !_strcmpi(item_name, "AXE")) + pInfos[curr_rec_num].uTreasureType= 25; + else if ( !_strcmpi(item_name, "SPEAR")) + pInfos[curr_rec_num].uTreasureType= 26; + else if ( !_strcmpi(item_name, "BOW")) + pInfos[curr_rec_num].uTreasureType= 27; + else if ( !_strcmpi(item_name, "MACE")) + pInfos[curr_rec_num].uTreasureType= 28; + else if ( !_strcmpi(item_name, "CLUB")) + pInfos[curr_rec_num].uTreasureType= 29; + else if ( !_strcmpi(item_name, "STAFF")) + pInfos[curr_rec_num].uTreasureType= 30; + else if ( !_strcmpi(item_name, "LEATHER")) + pInfos[curr_rec_num].uTreasureType= 31; + else if ( !_strcmpi(item_name, "CHAIN")) + pInfos[curr_rec_num].uTreasureType= 32; + else if ( !_strcmpi(item_name, "PLATE")) + pInfos[curr_rec_num].uTreasureType= 33; + else if ( !_strcmpi(item_name, "SHIELD")) + pInfos[curr_rec_num].uTreasureType= 34; + else if ( !_strcmpi(item_name, "HELM")) + pInfos[curr_rec_num].uTreasureType= 35; + else if ( !_strcmpi(item_name, "BELT")) + pInfos[curr_rec_num].uTreasureType= 36; + else if ( !_strcmpi(item_name, "CAPE")) + pInfos[curr_rec_num].uTreasureType= 37; + else if ( !_strcmpi(item_name, "GAUNTLETS")) + pInfos[curr_rec_num].uTreasureType= 38; + else if ( !_strcmpi(item_name, "BOOTS")) + pInfos[curr_rec_num].uTreasureType= 39; + else if ( !_strcmpi(item_name, "RING")) + pInfos[curr_rec_num].uTreasureType= 40; + else if ( !_strcmpi(item_name, "AMULET")) + pInfos[curr_rec_num].uTreasureType= 41; + else if ( !_strcmpi(item_name, "WAND")) + pInfos[curr_rec_num].uTreasureType= 42; + else if ( !_strcmpi(item_name, "SCROLL")) + pInfos[curr_rec_num].uTreasureType= 43; + else if ( !_strcmpi(item_name, "GEM")) + pInfos[curr_rec_num].uTreasureType= 46; + } + } + + } + break; + case 8: + { + pInfos[curr_rec_num].bQuestMonster=0; + if (atoi(test_string)) + pInfos[curr_rec_num].bQuestMonster=1; + } + break; + case 9: + { + pInfos[curr_rec_num].uFlying=false; + if (_strnicmp(test_string, "n",1)) + pInfos[curr_rec_num].uFlying=true; + } + break; + case 10: + { + switch(tolower(test_string[0])) + { + case 's': pInfos[curr_rec_num].uMovementType=0;// short + if (tolower(test_string[1])!='h') + pInfos[curr_rec_num].uMovementType=5; //?? + break; //short + case 'l': pInfos[curr_rec_num].uMovementType=2; break; //long + case 'm': pInfos[curr_rec_num].uMovementType=1; break; //med + case 'g': pInfos[curr_rec_num].uMovementType=3; break; //??? + default: + pInfos[curr_rec_num].uMovementType=4; //free + } + } + break; + case 11: + { + switch(tolower(test_string[0])) + { + case 's': pInfos[curr_rec_num].uAIType=0; break; // suicide + case 'w': pInfos[curr_rec_num].uAIType=1; break; //wimp + case 'n': pInfos[curr_rec_num].uAIType=2; break; //normal + default: + pInfos[curr_rec_num].uAIType=3; //Agress + } + } + break; + case 12: + pInfos[curr_rec_num].uHostilityType=(MonsterInfo::HostilityRadius)atoi(test_string); + break; + case 13: + pInfos[curr_rec_num].uBaseSpeed=atoi(test_string); + break; + case 14: + pInfos[curr_rec_num].uRecoveryTime=atoi(test_string); + break; + case 15: + { + int str_len=0; + int str_pos=0; + pInfos[curr_rec_num].uAttackPreference=0; + pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=0; + str_len=strlen(test_string); + for (str_pos=0;str_pos<str_len;++str_pos ) + { + switch(tolower(test_string[str_pos])) + { + case '0': pInfos[curr_rec_num].uAttackPreference|=0x0004; break; + case '2': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=2; break; + case '3': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=3; break; + case '4': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=4; break; + case 'c': pInfos[curr_rec_num].uAttackPreference|=0x0010; break; + case 'd': pInfos[curr_rec_num].uAttackPreference|=0x0008; break; + case 'e': pInfos[curr_rec_num].uAttackPreference|=0x1000; break; + case 'f': pInfos[curr_rec_num].uAttackPreference|=0x0400; break; + case 'h': pInfos[curr_rec_num].uAttackPreference|=0x0800; break; + case 'k': pInfos[curr_rec_num].uAttackPreference|=0x0001; break; + case 'm': pInfos[curr_rec_num].uAttackPreference|=0x0100; break; + case 'o': pInfos[curr_rec_num].uAttackPreference|=0x0400; break; + case 'p': pInfos[curr_rec_num].uAttackPreference|=0x0002; break; + case 'r': pInfos[curr_rec_num].uAttackPreference|=0x0040; break; + case 's': pInfos[curr_rec_num].uAttackPreference|=0x0020; break; + case 't': pInfos[curr_rec_num].uAttackPreference|=0x0080; break; + case 'w': pInfos[curr_rec_num].uAttackPreference|=0x2000; break; + case 'x': pInfos[curr_rec_num].uAttackPreference|=0x0200; break; + } + } + } + break; + case 16: + { + + } + break; + case 17: + pInfos[curr_rec_num].uAttack1Type=ParseAttackType(test_string); + break; + case 18: + { + ParseDamage(test_string, &pInfos[curr_rec_num].uAttack1DamageDiceRolls, + &pInfos[curr_rec_num].uAttack1DamageDiceSides, + &pInfos[curr_rec_num].uAttack1DamageBonus); + } + break; + case 19: + pInfos[curr_rec_num].uMissleAttack1Type=ParseMissleAttackType(test_string); + break; + case 20: + pInfos[curr_rec_num].uAttack2Chance=atoi(test_string); + break; + case 21: + pInfos[curr_rec_num].uAttack2Type=ParseAttackType(test_string); + break; + case 22: + { + ParseDamage(test_string, &pInfos[curr_rec_num].uAttack2DamageDiceRolls, + &pInfos[curr_rec_num].uAttack2DamageDiceSides, + &pInfos[curr_rec_num].uAttack2DamageBonus); + } + break; + case 23: + pInfos[curr_rec_num].uMissleAttack2Type=ParseMissleAttackType(test_string); + break; + case 24: + pInfos[curr_rec_num].uSpell1UseChance=atoi(test_string); + break; + case 25: + { + + } + break; + case 26: + pInfos[curr_rec_num].uSpell2UseChance=atoi(test_string); + break; + case 27: + { + + } + break; + case 28: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResFire=200; + else + pInfos[curr_rec_num].uResFire=atoi(test_string); + } + break; + case 29: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResAir=200; + else + pInfos[curr_rec_num].uResAir=atoi(test_string); + } + break; + case 30: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResWater=200; + else + pInfos[curr_rec_num].uResWater=atoi(test_string); + } + break; + case 31: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResEarth=200; + else + pInfos[curr_rec_num].uResEarth=atoi(test_string); + } + break; + case 32: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResMind=200; + else + pInfos[curr_rec_num].uResMind=atoi(test_string); + } + break; + case 33: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResSpirit=200; + else + pInfos[curr_rec_num].uResSpirit=atoi(test_string); + } + break; + case 34: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResBody=200; + else + pInfos[curr_rec_num].uResBody=atoi(test_string); + } + break; + case 35: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResLight=200; + else + pInfos[curr_rec_num].uResLight=atoi(test_string); + } + break; + case 36: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResDark=200; + else + pInfos[curr_rec_num].uResDark=atoi(test_string); + } + break; + case 37: + { + if (tolower(test_string[0])=='i') + pInfos[curr_rec_num].uResPhysical=200; + else + pInfos[curr_rec_num].uResPhysical=atoi(test_string); + } + break; + case 38: + { + + } + break; + } + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<39)&&!break_loop); + } + uNumMonsters = i; + +/* v103 = 0; v1->uNumMonsters = 265; do { - v2 = (int)(strtok(0, "\r") + 1); + v2 = (int)(strtok(NULL, "\r") + 1); *(_DWORD *)&a3[1] = 0; v97 = 0; do @@ -401,12 +1249,12 @@ { switch ( *(_DWORD *)&a3[1] ) { - case 0: + /* case 0: v103 = atoi((const char *)v2); v102->pInfos[v103].uID = v103; goto LABEL_325; case 2: - v102->pInfos[v103].pTexture = RemoveQuotes((char *)v2); + v102->pInfos[v103].pPictureName = RemoveQuotes((char *)v2); goto LABEL_325; case 1: v102->pInfos[v103].pName = RemoveQuotes((char *)v2); @@ -1459,6 +2307,7 @@ } while ( v103 < 265 ); v102->uNumMonsters = v103; + */ }
--- a/Monsters.h Mon Mar 18 01:50:50 2013 +0600 +++ b/Monsters.h Mon Mar 18 01:51:31 2013 +0600 @@ -87,7 +87,7 @@ }; char *pName; - char *pTexture; + char *pPictureName; unsigned __int8 uLevel; unsigned __int8 uTreasureDropChance; unsigned __int8 uTreasureDiceRolls; @@ -155,12 +155,12 @@ { void Initialize(); void InitializePlacements(); - signed int _4563FF(const char *Str2); + signed int FindMonsterByName(const char *Str2); static bool BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype); MonsterInfo pInfos[265]; //0 - 5b18h - char *pPlaceStrings[31];; //5B18h placement counts from 1 + char *pPlaceStrings[31]; //5B18h placement counts from 1 unsigned int uNumMonsters; //5B94h unsigned int uNumPlacements; //5B98h int field_5B9C;
--- a/Outdoor.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Outdoor.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -3158,7 +3158,7 @@ v36 = actor->pMonsterInfo.uID; v28->field_1E = v62 | 0x200; v28->pSpriteFrame = v15; - v28->uTintColor = *((int *)&v35[v36] - 36); + v28->uTintColor = pMonsterList->pMonsters[actor->pMonsterInfo.uID-1].uTintColor;//*((int *)&v35[v36] - 36); if (actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) v28->field_1E = v62 | 0x200; }
--- a/PaletteManager.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/PaletteManager.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -1,7 +1,10 @@ +#include <assert.h> + #include "PaletteManager.h" #include "Texture.h" #include "Game.h" #include "LOD.h" +#include "Log.h" #include "mm7_data.h" @@ -244,41 +247,41 @@ //----- (00489BE0) -------------------------------------------------------- -int PaletteManager::CalcPalettes_LUT(int a2) +void PaletteManager::CalcPalettes_LUT(int a2) { PaletteManager *v2; // esi@1 - char *v3; // edi@1 - signed int v4; // ebx@4 - float v5; // ST08_4@5 - float v6; // ST04_4@5 - float v7; // ST00_4@5 - int v8; // eax@7 - float *v9; // edx@8 - float *v10; // ST0C_4@8 - float *v11; // ecx@8 - int v12; // ebx@8 - int v13; // eax@8 - float v14; // ebx@8 + //char *v3; // edi@1 + //signed int v4; // ebx@4 + //float v5; // ST08_4@5 + //float v6; // ST04_4@5 + //float v7; // ST00_4@5 + //int v8; // eax@7 + //float *v9; // edx@8 + //float *v10; // ST0C_4@8 + //float *v11; // ecx@8 + //int v12; // ebx@8 + //int v13; // eax@8 + //float v14; // ebx@8 float v15; // ST08_4@8 float v16; // ST04_4@8 float v17; // ST00_4@8 - unsigned __int8 v18; // sf@8 - unsigned __int8 v19; // of@8 - int v20; // eax@10 + //unsigned __int8 v18; // sf@8 + //unsigned __int8 v19; // of@8 + //int v20; // eax@10 double v21; // st5@11 - float v22; // ST0C_4@13 + //float v22; // ST0C_4@13 unsigned int v23; // eax@13 - __int16 v24; // bx@16 - int v25; // eax@16 + //__int16 v24; // bx@16 + //int v25; // eax@16 double v26; // st7@20 - float v27; // ST0C_4@22 + //float v27; // ST0C_4@22 unsigned int v28; // eax@22 - __int16 v29; // bx@25 - __int16 *v30; // eax@25 - int v31; // eax@27 + //__int16 v29; // bx@25 + //__int16 *v30; // eax@25 + //int v31; // eax@27 double v32; // st5@28 - float v33; // ST0C_4@30 - float v34; // ST08_4@30 + //float v33; // ST0C_4@30 + //float v34; // ST08_4@30 unsigned int v35; // ebx@30 signed __int64 v36; // qax@33 signed int v37; // edx@33 @@ -287,15 +290,15 @@ signed int v40; // edi@33 unsigned int v41; // ecx@33 unsigned int v42; // ecx@35 - int v43; // eax@39 + //int v43; // eax@39 signed int v44; // edx@39 - unsigned __int8 v45; // al@40 - double v46; // st6@43 - signed int v47; // eax@43 - int v48; // eax@45 + //unsigned __int8 v45; // al@40 + //double v46; // st6@43 + //signed int v47; // eax@43 + //int v48; // eax@45 double v49; // st6@47 - float v50; // ST08_4@49 - unsigned int v51; // ebx@49 + //float v50; // ST08_4@49 + //unsigned int v51; // ebx@49 int v52; // edi@55 int v53; // ebx@55 signed __int64 v54; // qax@55 @@ -306,59 +309,68 @@ unsigned int v59; // ecx@61 unsigned int v60; // eax@63 char v61; // cl@63 - int result; // eax@63 + //int result; // eax@63 float v63[256]; // [sp+1Ch] [bp-C38h]@5 float v64[256]; // [sp+41Ch] [bp-838h]@5 - int a6[256]; // [sp+81Ch] [bp-438h]@5 + float a6[256]; // [sp+81Ch] [bp-438h]@5 int v66; // [sp+C1Ch] [bp-38h]@43 float v67; // [sp+C20h] [bp-34h]@43 float v68; // [sp+C24h] [bp-30h]@43 - PaletteManager *v69; // [sp+C28h] [bp-2Ch]@9 - float v70; // [sp+C2Ch] [bp-28h]@43 - double v71; // [sp+C30h] [bp-24h]@10 - int v72; // [sp+C38h] [bp-1Ch]@9 - int v73; // [sp+C3Ch] [bp-18h]@9 - int i; // [sp+C40h] [bp-14h]@7 - float v75; // [sp+C44h] [bp-10h]@5 + //PaletteManager *v69; // [sp+C28h] [bp-2Ch]@9 + //float v70; // [sp+C2Ch] [bp-28h]@43 + //double v71; // [sp+C30h] [bp-24h]@10 + //int v72; // [sp+C38h] [bp-1Ch]@9 + //int v73; // [sp+C3Ch] [bp-18h]@9 + //int i; // [sp+C40h] [bp-14h]@7 + //float v75; // [sp+C44h] [bp-10h]@5 float a2a; // [sp+C48h] [bp-Ch]@13 float a1; // [sp+C4Ch] [bp-8h]@13 float a3; // [sp+C50h] [bp-4h]@13 signed int v79; // [sp+C5Ch] [bp+8h]@33 - signed int v80; // [sp+C5Ch] [bp+8h]@43 + //signed int v80; // [sp+C5Ch] [bp+8h]@43 int v81; // [sp+C5Ch] [bp+8h]@57 v2 = this; - v3 = (char *)this + 768 * a2; + //v3 = (char *)pBaseColors[a2]; if (pPalette_tintColor[0] || pPalette_tintColor[1] || pPalette_tintColor[2]) { - v8 = 0; - i = 0; - do - { - v9 = (float *)((char *)v63 + v8); - v10 = (float *)((char *)a6 + v8); - v11 = (float *)((char *)v64 + v8); - v12 = pPalette_tintColor[1]; - LODWORD(v75) = pPalette_tintColor[2] + (unsigned __int8)v3[2]; - v13 = v12 + (unsigned __int8)v3[1]; - LODWORD(v14) = (unsigned __int8)*v3; - v15 = (double)SLODWORD(v75) * 0.00196078431372549; - LODWORD(v75) = v13; - LODWORD(v75) = LODWORD(v14) + pPalette_tintColor[0]; - v16 = (double)v13 * 0.00196078431372549; - v17 = (double)SLODWORD(v75) * 0.00196078431372549; - RGB2HSV(v11, v9, v17, v16, v15, v10); - v3 += 3; - v8 = i + 4; - v19 = __OFSUB__(i + 4, 1024); - v18 = i - 1020 < 0; - i += 4; - } - while ( v18 ^ v19 ); + //v8 = 0; + //i = 0; + + for (uint i = 0; i < 256; ++i) + RGB2HSV(&v64[i], &v63[i], (pBaseColors[a2][i][0] + pPalette_tintColor[0]) / (255.0f + 255.0f), + (pBaseColors[a2][i][1] + pPalette_tintColor[1]) / (255.0f + 255.0f), + (pBaseColors[a2][i][2] + pPalette_tintColor[2]) / (255.0f + 255.0f), &a6[i]); + //do + //{ + //v9 = (float *)((char *)v63 + v8); + //v10 = (float *)((char *)a6 + v8); + //v11 = (float *)((char *)v64 + v8); + //v12 = pPalette_tintColor[1]; + //LODWORD(v75) = pPalette_tintColor[2] + (unsigned __int8)v3[2]; + //v13 = pPalette_tintColor[1] + (unsigned __int8)v3[1]; + //LODWORD(v14) = (unsigned __int8)*v3; + //v15 = (double)((unsigned __int8)v3[2] + pPalette_tintColor[2]) / (2.0f * 255.0f); + //LODWORD(v75) = v13; + //LODWORD(v75) = (unsigned __int8)*v3 + pPalette_tintColor[0]; + //v16 = (double)((unsigned __int8)v3[1] + pPalette_tintColor[1]) / 510.0f; + //v17 = (double)((unsigned __int8)*v3 + pPalette_tintColor[0]) / 510.0f; + //RGB2HSV(&v64[i], &v63[i], v17, v16, v15, &a6[i]); + //v3 += 3; + //v8 = i + 4; + //v19 = __OFSUB__(i + 4, 1024); + //v18 = i - 1020 < 0; + //i += 4; + //} + //while ( i < ); } else { - v4 = 0; + for (uint i = 0; i < 256; ++i) + RGB2HSV(&v64[i], &v63[i], pBaseColors[a2][i][0] / 255.0f, + pBaseColors[a2][i][1] / 255.0f, + pBaseColors[a2][i][2] / 255.0f, &a6[i]); + /*v4 = 0; do { LODWORD(v75) = (unsigned __int8)v3[2]; @@ -367,66 +379,80 @@ v6 = (double)SLODWORD(v75) * 0.00392156862745098; LODWORD(v75) = (unsigned __int8)*v3; v7 = (double)SLODWORD(v75) * 0.00392156862745098; - RGB2HSV(&v64[v4], &v63[v4], v7, v6, v5, (float *)&a6[v4]); + RGB2HSV(&v64[v4], &v63[v4], v7, v6, v5, &a6[v4]); ++v4; v3 += 3; } - while ( v4 < 256 ); + while ( v4 < 256 );*/ } - v69 = (PaletteManager *)((char *)v2 + 16384 * a2); - v72 = 0; - v73 = (int)v69->pPalette1; - do + + //v69 = (PaletteManager *)((char *)v2 + 16384 * a2); + //v72 = 0; + //v73 = (int)pPalette1[a2]; + for (uint i = 0; i < 32; ++i) + //do { - v20 = 0; - i = 0; - v71 = 1.0 - (double)v72 * 0.03225806451612903; - do + //v20 = 0; + //i = 0; + //v71 = 1.0 - (double)v72 / 31.0f; + //do + for (uint j = 0; j < 256; ++j) { - v21 = *(float *)((char *)a6 + v20) * v71; + v21 = a6[j] * (1.0f - i / 32.0f); if ( v21 < 0.0 ) v21 = 0.0; - v22 = v21; - HSV2RGB(&a1, &a2a, &a3, *(float *)((char *)v64 + v20), *(float *)((char *)v63 + v20), v22); + + //v22 = v21; + HSV2RGB(&a1, &a2a, &a3, v64[j], v63[j], v21); v23 = v2->uNumTargetGBits; - if ( v23 == 6 ) + if ( v23 == 6 ) // r5g6b5 { a1 = a1 * 31.0; a2a = a2a * 62.0; a3 = a3 * 31.0; } - else + else if (v23 == 5) // r5g5b5 { a1 = a1 * 31.0; a2a = a2a * 31.0; a3 = a3 * 31.0; } - v24 = (unsigned __int64)(signed __int64)a3 | ((unsigned __int16)(signed __int64)a2a << v2->uNumTargetBBits) | (unsigned __int16)((unsigned __int16)(signed __int64)a1 << (v2->uNumTargetBBits + v23)); - v25 = v73; - v73 += 2; - *(short *)v25 = v24; - v20 = i + 4; - v19 = __OFSUB__(i + 4, 1024); - v18 = i - 1020 < 0; - i += 4; + else if (v23 == 0) + Log::Warning(L"Calling palette manager with num_target_bits == 0"); + else assert(false); + //v24 = (unsigned __int32)a3 | ((unsigned __int32)a2a << v2->uNumTargetBBits) | ((unsigned __int32)a1 << (v2->uNumTargetBBits + v2->uNumTargetGBits)); + //v25 = v73; + //v73 += 2; + //*(short *)v25 = v24; + pPalette1[a2][i][j] = (unsigned __int32)a3 | + ((unsigned __int32)a2a << v2->uNumTargetBBits) | + ((unsigned __int32)a1 << (v2->uNumTargetBBits + v2->uNumTargetGBits)); + //v20 = i + 4; + //v19 = __OFSUB__(i + 4, 1024); + //v18 = i - 1020 < 0; + //i += 4; } - while ( v18 ^ v19 ); - ++v72; + //while ( v18 ^ v19 ); + //++v72; } - while ( v72 < 32 ); - v72 = 0; - v73 = (int)v69->field_199600_palettes; - do + //while ( v72 < 32 ); + + //v72 = 0; + //v73 = (int)v69->field_199600_palettes; + //do + for (uint i = 0; i < 32; ++i) { - i = 0; - v71 = 1.0 - (double)v72 * 0.03225806451612903; - do + //i = 0; + //v71 = 1.0 - (double)v72 / 31.0f; + //do + for (uint j = 0; j < 256; ++j) { - v26 = *(float *)&a6[i] * v71; + v26 = a6[j] * (1.0 - i / 31.0f); if ( v26 < 0.0 ) v26 = 0.0; - v27 = v26; - HSV2RGB(&a1, &a2a, &a3, 1.0, 1.0, v27); + + //v27 = v26; + HSV2RGB(&a1, &a2a, &a3, 1.0, 1.0, v26); v28 = v2->uNumTargetGBits; if ( v28 == 6 ) { @@ -434,35 +460,44 @@ a2a = a2a * 62.0; a3 = a3 * 31.0; } - else + else if (v28 == 5) { a1 = a1 * 31.0; a2a = a2a * 31.0; a3 = a3 * 31.0; } - v29 = (unsigned __int64)(signed __int64)a3 | ((unsigned __int16)(signed __int64)a2a << v2->uNumTargetBBits) | (unsigned __int16)((unsigned __int16)(signed __int64)a1 << (v2->uNumTargetBBits + v28)); - v30 = (__int16 *)v73; - ++i; - v73 += 2; - v19 = __OFSUB__(i, 256); - v18 = i - 256 < 0; - *v30 = v29; + else if (v23 == 0) + Log::Warning(L"Calling palette manager with num_target_bits == 0"); + else assert(false); + + //v29 = (unsigned __int64)(signed __int64)a3 | ((unsigned __int16)(signed __int64)a2a << v2->uNumTargetBBits) | (unsigned __int16)((unsigned __int16)(signed __int64)a1 << (v2->uNumTargetBBits + v28)); + //v30 = (__int16 *)v73; + //++i; + //v73 += 2; + //v19 = __OFSUB__(i, 256); + //v18 = i - 256 < 0; + //*v30 = v29; + field_199600_palettes[a2][i][j] = (unsigned __int64)(signed __int64)a3 | ((unsigned __int16)(signed __int64)a2a << v2->uNumTargetBBits) | (unsigned __int16)((unsigned __int16)(signed __int64)a1 << (v2->uNumTargetBBits + v28)); } - while ( v18 ^ v19 ); - ++v72; + //while ( v18 ^ v19 ); + //++v72; } - while ( v72 < 32 ); - v73 = (int)((char *)v2 + 512 * (a2 + 4875)); - v31 = 0; - i = 0; - do + //while ( v72 < 32 ); + + //v73 = (int)((char *)v2 + 512 * (a2 + 4875)); // field_261600[a2] + //v31 = 0; + //i = 0; + for (uint i = 0; i < 256; ++i) + //do { - v32 = (*(float *)((char *)a6 + v31) - 0.8) * 0.8387096774193549 + 0.8; + //v32 = (*(float *)((char *)a6 + v31) - 0.8) * 0.8387096774193549 + 0.8; + v32 = (a6[i] - 0.8f) * 0.8387096774193549 + 0.8; if ( v32 < 0.0 ) v32 = 0.0; - v33 = v32; - v34 = *(float *)((char *)v63 + v31) * 0.7034339229968783; - HSV2RGB(&a1, &a2a, &a3, *(float *)((char *)v64 + v31), v34, v33); + + //v33 = v32; + //v34 = v63[i] * 0.7034339229968783; + HSV2RGB(&a1, &a2a, &a3, v64[i], v63[i] * 0.7034339229968783, v32); v35 = v2->uNumTargetGBits; if ( v35 == 6 ) { @@ -470,12 +505,16 @@ a2a = a2a * 62.0; a3 = a3 * 31.0; } - else + else if (v35 == 5) { a1 = a1 * 31.0; a2a = a2a * 31.0; a3 = a3 * 31.0; } + else if (v23 == 0) + Log::Warning(L"Calling palette manager with num_target_bits == 0"); + else assert(false); + v36 = (signed __int64)((a1 + a2a + a3) * 0.3333333333333333 * 8.0); v37 = (signed int)v36 >> (8 - v2->uNumTargetRBits); v38 = 8 - v35; @@ -490,60 +529,74 @@ v40 = (1 << v42) - 1; if ( v79 > (1 << v39) - 1 ) v79 = (1 << v39) - 1; - v43 = v73; + //v43 = v73; v44 = v37 << (v39 + v2->uNumTargetGBits); - v73 += 2; - *(short *)v43 = v79 | ((short)v40 << v39) | (unsigned __int16)v44; - v31 = i + 4; - v19 = __OFSUB__(i + 4, 1024); - v18 = i - 1020 < 0; - i += 4; + //v73 += 2; + //*(short *)v43 = v79 | ((short)v40 << v39) | (unsigned __int16)v44; + field_261600[a2][i] = v79 | ((unsigned short)v40 << v39) | (unsigned __int16)v44; + //v31 = i + 4; + //v19 = __OFSUB__(i + 4, 1024); + //v18 = i - 1020 < 0; + //i += 4; } - while ( v18 ^ v19 ); - v45 = pPalette_mistColor[0]; - if (v45 || pPalette_mistColor[1] || pPalette_mistColor[2]) + //while ( v18 ^ v19 ); + + //v45 = pPalette_mistColor[0]; + float mist_a, mist_b, mist_c; + if (pPalette_mistColor[0] || pPalette_mistColor[1] || pPalette_mistColor[2]) { - v46 = (double)v45; - v80 = pPalette_mistColor[1]; - v47 = pPalette_mistColor[2]; - v70 = v46 * 0.00392156862745098; - *((float *)&v71 + 1) = (double)v80 * 0.00392156862745098; - v75 = (double)v47 * 0.00392156862745098; - RGB2HSV(&v68, &v67, v70, *((float *)&v71 + 1), v75, (float *)&v66); + //v46 = (double)v45; + //v80 = pPalette_mistColor[1]; + //v47 = pPalette_mistColor[2]; + //v70 = v46 * 0.00392156862745098; + //*((float *)&v71 + 1) = (double)v80 * 0.00392156862745098; + //v75 = (double)v47 * 0.00392156862745098; + mist_a = pPalette_mistColor[0] / 255.0f; + mist_b = pPalette_mistColor[1] / 255.0f; + mist_c = pPalette_mistColor[2] / 255.0f; + + float unused; + RGB2HSV(&v68, &v67, mist_a, mist_b, mist_c, &unused); } - v72 = 0; - v73 = (int)v69->field_D1600; - - do + //v72 = 0; + //v73 = (int)v69->field_D1600; + //do + for (uint i = 0; i < 32; ++i) { - v48 = 0; - for ( i = 0; ; v48 = i ) + //v48 = 0; + //for ( i = 0; ; v48 = i ) + for (uint j = 0; j < 256; ++j) { - v49 = *(float *)((char *)v63 + v48); + v49 = v63[j]; if ( v49 < 0.0 ) v49 = 0.0; - v50 = v49; - HSV2RGB(&a1, &a2a, &a3, *(float *)((char *)v64 + v48), v50, *(float *)((char *)a6 + v48)); - v51 = v2->uNumTargetGBits; - if ( v51 == 6 ) + + //v50 = v49; + HSV2RGB(&a1, &a2a, &a3, v64[j], v49, a6[j]); + //v51 = v2->uNumTargetGBits; + if ( v2->uNumTargetGBits == 6 ) { a1 = a1 * 31.0; a2a = a2a * 62.0; a3 = a3 * 31.0; } - else + else if (v2->uNumTargetGBits == 5) { a1 = a1 * 31.0; a2a = a2a * 31.0; a3 = a3 * 31.0; } + else if (v23 == 0) + Log::Warning(L"Calling palette manager with num_target_bits == 0"); + else assert(false); + if (pPalette_mistColor[0] || pPalette_mistColor[1] || pPalette_mistColor[2]) { - v55 = (double)v72 * 0.03225806451612903; - v52 = (signed __int64)((double)(1 << v2->uNumTargetRBits) * v70 * v55 + a1 * (1.0 - v55)); - v53 = (signed __int64)((double)(1 << v51) * *((float *)&v71 + 1) * v55 + a2a * (1.0 - v55)); - v54 = (signed __int64)((double)(1 << v2->uNumTargetBBits) * v75 * v55 + a3 * (1.0 - v55)); + v55 = (double)i / 31.0f; + v52 = (signed __int64)((double)(1 << v2->uNumTargetRBits) * mist_a * v55 + a1 * (1.0 - v55)); + v53 = (signed __int64)((double)(1 << v2->uNumTargetGBits) * mist_b * v55 + a2a * (1.0 - v55)); + v54 = (signed __int64)((double)(1 << v2->uNumTargetBBits) * mist_c * v55 + a3 * (1.0 - v55)); } else { @@ -551,6 +604,7 @@ v53 = (signed __int64)a2a; v54 = (signed __int64)a3; } + v56 = v2->uNumTargetRBits; v81 = v54; if ( v52 > (1 << v56) - 1 ) @@ -563,20 +617,20 @@ if ( (signed int)v54 > (1 << v59) - 1 ) v81 = (1 << v59) - 1; v60 = v2->uNumTargetGBits; - i += 4; + //i += 4; v61 = uNumTargetBBits + v60; - result = v73; - v73 += 2; - v19 = __OFSUB__(i, 1024); - v18 = i - 1024 < 0; - *(short *)result = v81 | ((short)v53 << uNumTargetBBits) | (v52 << v61); - if ( !(v18 ^ v19) ) - break; + //result = v73; + //v73 += 2; + //v19 = __OFSUB__(i, 1024); + //v18 = i - 1024 < 0; + //*(short *)result = v81 | ((short)v53 << uNumTargetBBits) | (v52 << v61); + field_D1600[a2][i][j] = v81 | ((short)v53 << uNumTargetBBits) | (v52 << v61); + //if ( !(v18 ^ v19) ) + // break; } - ++v72; + //++v72; } - while ( v72 < 32 ); - return result; + //while ( v72 < 32 ); } @@ -684,8 +738,8 @@ float v18; // [sp+38Ch] [bp-14h]@7 float a2a; // [sp+390h] [bp-10h]@7 float a1; // [sp+394h] [bp-Ch]@7 - int a6; // [sp+398h] [bp-8h]@7 - int a3; // [sp+39Ch] [bp-4h]@7 + float a6; // [sp+398h] [bp-8h]@7 + float a3; // [sp+39Ch] [bp-4h]@7 v15 = this; v2 = (unsigned int *)&this->pPaletteIDs[1]; @@ -707,14 +761,14 @@ v17 = 1 - (int)&v10; do { - LODWORD(a1) = tex.pPalette24[v4]; - a1 = (double)SLODWORD(a1) * 0.0039215689; + //LODWORD(a1) = tex.pPalette24[v4]; + a1 = (double)tex.pPalette24[v4] / 255.0f; LODWORD(a2a) = (unsigned __int8)*(&v10 + v4 + v17 + (unsigned int)tex.pPalette24); - a2a = (double)SLODWORD(a2a) * 0.0039215689; - a3 = tex.pPalette24[v4 + 2]; - *(float *)&a3 = (double)a3 * 0.0039215689; - RGB2HSV(&v16, &v18, a1, a2a, *(float *)&a3, (float *)&a6); - v5 = *(float *)&a6 * 1.1; + a2a = (double)tex.pPalette24[v4 + 1] / 255.0f; + //a3 = tex.pPalette24[v4 + 2]; + a3 = (double)tex.pPalette24[v4 + 2] / 255.0f; + RGB2HSV(&v16, &v18, a1, a2a, a3, &a6); + v5 = a6 * 1.1; if ( v5 >= 0.0 && v5 >= 1.0 ) { v5 = 1.0; @@ -724,7 +778,7 @@ if ( v5 < 0.0 ) v5 = 0.0; } - *(float *)&a6 = v5; + a6 = v5; v6 = v18 * 0.64999998; if ( v6 >= 0.0 && v6 >= 1.0 ) { @@ -736,18 +790,18 @@ v6 = 0.0; } v18 = v6; - HSV2RGB(&a1, &a2a, (float *)&a3, v16, v18, *(float *)&a6); + HSV2RGB(&a1, &a2a, &a3, v16, v18, a6); v7 = a2a * 255.0; v10[v4] = (signed __int64)(a1 * 255.0); v8 = (signed __int64)v7; - v9 = *(float *)&a3 * 255.0; + v9 = a3 * 255.0; v10[v4 + 1] = v8; v10[v4 + 2] = (signed __int64)v9; v4 += 3; } while ( v4 < 768 ); tex.Release(); - result = v15->MakePaletteLUT(uPaletteID, v10); + result = v15->MakeBasePaletteLut(uPaletteID, v10); } else { @@ -761,27 +815,28 @@ // 48A3BC: using guessed type char var_386[766]; //----- (0048A5A4) -------------------------------------------------------- -int PaletteManager::MakePaletteLUT(int a2, char *entries) +int PaletteManager::MakeBasePaletteLut(int idx, char *entries) { - PaletteManager *v3; // edi@1 - signed int result; // eax@1 - int *v5; // ecx@1 + //PaletteManager *v3; // edi@1 + //signed int result; // eax@1 + //int *v5; // ecx@1 int v6; // eax@4 int v7; // esi@4 - int v8; // eax@9 - signed int v9; // ecx@9 - int v10; // edx@9 + //int v8; // eax@9 + //signed int v9; // ecx@9 + //int v10; // edx@9 + + //v3 = this; + //result = 0; + //v5 = this->pPaletteIDs; - v3 = this; - result = 0; - v5 = this->pPaletteIDs; - while ( *v5 != a2 ) - { - ++result; - ++v5; - if ( result >= 50 ) - { - v6 = (int)&v3->pPaletteIDs[1]; + for (uint i = 0; i < 50; ++i) + if (pPaletteIDs[i] == idx) + return i; + + + + v6 = (int)&pPaletteIDs[1]; v7 = 1; while ( *(int *)v6 ) { @@ -790,7 +845,7 @@ if ( v7 >= 50 ) return 0; } - v8 = (int)((char *)v3 + 768 * v7); + /*v8 = (int)pBaseColors[v7];//(int)((char *)v3 + 768 * v7); v9 = 768; v10 = (int)(entries - v8); do @@ -799,13 +854,15 @@ ++v8; --v9; } - while ( v9 ); - v3->pPaletteIDs[v7] = a2; + while ( v9 );*/ + unsigned __int8 *dst = (unsigned __int8 *)pBaseColors[v7]; + for (uint i = 0; i < 768; ++i) + dst[i] = entries[i]; + + pPaletteIDs[v7] = idx; CalcPalettes_LUT(v7); return v7; - } - } - return result; + } //----- (0048A614) --------------------------------------------------------
--- a/PaletteManager.h Mon Mar 18 01:50:50 2013 +0600 +++ b/PaletteManager.h Mon Mar 18 01:51:31 2013 +0600 @@ -8,10 +8,10 @@ PaletteManager(); int ResetNonTestLocked(); - int CalcPalettes_LUT(int a2); + void CalcPalettes_LUT(int a2); int ResetNonLocked(); int LoadPalette(unsigned int uPaletteID); - int MakePaletteLUT(int a2, char *entries); + int MakeBasePaletteLut(int a2, char *entries); void RecalculateAll(); int LockAll(); int LockTestAll(); @@ -23,7 +23,7 @@ static unsigned __int16 *_47C30E_get_palette(int a1, char a2); static unsigned __int16 *_47C33F_get_palette(int a1, char a2); - char pBaseColors[50][256][3]; + unsigned __int8 pBaseColors[50][256][3]; unsigned __int16 pPalette1[50][32][256]; unsigned __int16 field_D1600[50][32][256]; unsigned __int16 field_199600_palettes[50][32][256];
--- a/ParticleEngine.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/ParticleEngine.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -577,14 +577,14 @@ v6->_screenspace_scale = (unsigned __int64)(_48B561_mess_with_scaling_along_z(/*v34, */v35) * (signed __int64)v6->_screenspace_scale) >> 16; v6->sZValue = X_4; v36 = v6->uScreenSpaceX; - if ( v36 >= (signed int)pViewport->uViewportX ) + if ( v36 >= (signed int)pViewport->uViewportTL_X ) { - if ( v36 < (signed int)pViewport->uViewportZ ) + if ( v36 < (signed int)pViewport->uViewportBR_X ) { v37 = v6->uScreenSpaceY; - if ( v37 >= (signed int)pViewport->uViewportY ) + if ( v37 >= (signed int)pViewport->uViewportTL_Y ) { - if ( v37 < (signed int)pViewport->uViewportW ) + if ( v37 < (signed int)pViewport->uViewportBR_Y ) return 1; } } @@ -686,10 +686,10 @@ v11 = 30; v12 = p->uScreenSpaceY - v11; v13 = p->uScreenSpaceX - (v11 >> 1); - if ( v13 + v11 < (signed int)pViewport->uViewportX - || v13 >= (signed int)pViewport->uViewportZ - || v12 + v11 < (signed int)pViewport->uViewportY - || v12 >= (signed int)pViewport->uViewportW ) + if ( v13 + v11 < (signed int)pViewport->uViewportTL_X + || v13 >= (signed int)pViewport->uViewportBR_X + || v12 + v11 < (signed int)pViewport->uViewportTL_Y + || v12 >= (signed int)pViewport->uViewportBR_Y ) { ; } @@ -801,10 +801,10 @@ v10 = 30; v11 = *(_DWORD *)(v7 - 18) - (v10 >> 1); v12 = *(_DWORD *)(v7 - 14) - v10; - if ( v11 + v10 < pViewport->uViewportX - || v11 >= pViewport->uViewportZ - || *(_DWORD *)(v7 - 14) < pViewport->uViewportY - || v12 >= (signed int)pViewport->uViewportW ) + if ( v11 + v10 < pViewport->uViewportTL_X + || v11 >= pViewport->uViewportBR_X + || *(_DWORD *)(v7 - 14) < pViewport->uViewportTL_Y + || v12 >= (signed int)pViewport->uViewportBR_Y ) { ; }
--- a/Render.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Render.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -332,7 +332,7 @@ v5 = v4->pTexture; if ( v5 ) { - if ( v3->field_8 >= (signed int)pViewport->uViewportX || v3->field_C != pViewport->uViewportX ) + if ( v3->field_8 >= (signed int)pViewport->uViewportTL_X || v3->field_C != pViewport->uViewportTL_X ) { LOBYTE(v4->field_32) |= 2u; v14 = *(int *)&v4->flags; @@ -650,17 +650,17 @@ v2 = (stru148 *)v30->field_E; if ( v2 != (stru148 *)unnamed_6BE060[1] ) { - LOWORD(v2) = LOWORD(pViewport->uViewportX); - if ( v30->field_8 >= (signed int)pViewport->uViewportX ) + LOWORD(v2) = LOWORD(pViewport->uViewportTL_X); + if ( v30->field_8 >= (signed int)pViewport->uViewportTL_X ) goto LABEL_124; - if ( v30->field_C == pViewport->uViewportX ) + if ( v30->field_C == pViewport->uViewportTL_X ) { v30->field_E = LOWORD(unnamed_6BE060[1]); } else { - v30->field_8 = LOWORD(pViewport->uViewportX); - v30->field_C -= LOWORD(pViewport->uViewportX); + v30->field_8 = LOWORD(pViewport->uViewportTL_X); + v30->field_C -= LOWORD(pViewport->uViewportTL_X); if ( v30->field_C >= 0 ) { LABEL_124: @@ -693,13 +693,13 @@ v2 = (stru148 *)v13->field_E; if ( v2 != (stru148 *)unnamed_6BE060[1] ) { - LOWORD(v2) = LOWORD(pViewport->uViewportX); - if ( v13->field_8 >= (signed int)pViewport->uViewportX ) + LOWORD(v2) = LOWORD(pViewport->uViewportTL_X); + if ( v13->field_8 >= (signed int)pViewport->uViewportTL_X ) goto LABEL_109; - if ( v13->field_C != pViewport->uViewportX ) - { - v13->field_8 = LOWORD(pViewport->uViewportX); - v13->field_C -= LOWORD(pViewport->uViewportX); + if ( v13->field_C != pViewport->uViewportTL_X ) + { + v13->field_8 = LOWORD(pViewport->uViewportTL_X); + v13->field_C -= LOWORD(pViewport->uViewportTL_X); if ( v13->field_C >= 0 ) { LABEL_109: @@ -790,7 +790,7 @@ v3 = a2; v4 = a1; - v5 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5 / tan(0.6457717418670654) + 0.5; + v5 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5 / tan(0.6457717418670654) + 0.5; v35 = v5 + 6.7553994e15; if ( LODWORD(v35) ) { @@ -824,7 +824,7 @@ break; v12 = a1a; } - if ( v11 <= (signed int)pViewport->uViewportY ) + if ( v11 <= (signed int)pViewport->uViewportTL_Y ) break; v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v12) >> 16) + v3->v_18.x; --v54; @@ -3004,10 +3004,10 @@ billboard.pTarget = pRenderer->pTargetSurface; billboard.pTargetZ = pRenderer->pActiveZBuffer; billboard.uTargetPitch = pRenderer->uTargetSurfacePitch; - billboard.uViewportX = pViewport->uViewportX; - billboard.uViewportY = pViewport->uViewportY; - billboard.uViewportZ = pViewport->uViewportZ - 1; - billboard.uViewportW = pViewport->uViewportW; + billboard.uViewportX = pViewport->uViewportTL_X; + billboard.uViewportY = pViewport->uViewportTL_Y; + billboard.uViewportZ = pViewport->uViewportBR_X - 1; + billboard.uViewportW = pViewport->uViewportBR_Y; pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; for (int i = 0; i < ::uNumBillboardsToDraw; ++i) @@ -3723,7 +3723,7 @@ v42 = pSprites_LOD->pSpriteHeaders[(signed __int16)*v37].uWidth >> 1; b = (unsigned __int64)(v42 * (signed __int64)v41) >> 16; } - if ( b + v25 >= (signed int)pViewport->uViewportX && v25 - b <= (signed int)pViewport->uViewportZ ) + if ( b + v25 >= (signed int)pViewport->uViewportTL_X && v25 - b <= (signed int)pViewport->uViewportBR_X ) { if (::uNumBillboardsToDraw >= 500) return; @@ -9246,11 +9246,11 @@ a3 = v4 * 255.0; v39 = a3 + 6.7553994e15; LODWORD(v40) = LODWORD(v39); - v5 = (double)(signed int)pViewport->uViewportX; + v5 = (double)(signed int)pViewport->uViewportTL_X; v36[0].pos.x = v5; - v6 = (double)(signed int)pViewport->uViewportY; + v6 = (double)(signed int)pViewport->uViewportTL_Y; v7 = this_ | (LODWORD(v39) << 24); - this_ = pViewport->uViewportW + 1; + this_ = pViewport->uViewportBR_Y + 1; v36[0].specular = 0; v36[0].pos.y = v6; v36[0].diffuse = v7; @@ -9265,13 +9265,13 @@ v36[3].specular = 0; v36[0].texcoord.y = 0.0; v36[1].pos.x = v5; - v8 = (double)(pViewport->uViewportW + 1); + v8 = (double)(pViewport->uViewportBR_Y + 1); v36[1].pos.y = v8; v36[1].pos.z = 0.0; v36[1].rhw = 1.0; v36[1].texcoord.x = 0.0; v36[1].texcoord.y = 0.0; - v9 = (double)(signed int)pViewport->uViewportZ; + v9 = (double)(signed int)pViewport->uViewportBR_X; v36[2].pos.x = v9; v36[2].pos.y = v8; v36[2].pos.z = 0.0; @@ -9310,10 +9310,10 @@ v40 = (1.0 - a3) * 65536.0; v39 = v40 + 6.7553994e15; LODWORD(a3) = LODWORD(v39); - v38 = (signed int)(pViewport->uViewportZ - pViewport->uViewportX) >> 1; - HIDWORD(v39) = pViewport->uViewportW - pViewport->uViewportY + 1; - v13 = pViewport->uViewportX + ecx0->uTargetSurfacePitch - pViewport->uViewportZ; - v14 = &ecx0->pTargetSurface[pViewport->uViewportX + pViewport->uViewportY * ecx0->uTargetSurfacePitch]; + v38 = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) >> 1; + HIDWORD(v39) = pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1; + v13 = pViewport->uViewportTL_X + ecx0->uTargetSurfacePitch - pViewport->uViewportBR_X; + v14 = &ecx0->pTargetSurface[pViewport->uViewportTL_X + pViewport->uViewportTL_Y * ecx0->uTargetSurfacePitch]; v37 = 2 * v13; LODWORD(v40) = (int)v14;
--- a/Sprites.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Sprites.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -48,7 +48,7 @@ //----- (0044D513) -------------------------------------------------------- void SpriteFrameTable::InitializeSprite( signed int uSpriteID ) - { +{ //SpriteFrameTable *v2; // esi@1 unsigned int v3; // ebx@3 //char *v4; // edx@3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Viewport.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -0,0 +1,258 @@ +#include "Viewport.h" + +#include "Party.h" +#include "VectorTypes.h" +#include "Indoor.h" +#include "Render.h" +#include "mm7_data.h" + + +//----- (004C0262) -------------------------------------------------------- +void Viewport::SetScreen( signed int sTL_X, signed int sTL_Y, signed int sBR_X, signed int sBR_Y ) + { + unsigned int tl_x; // edx@1 + unsigned int br_x; // esi@1 + unsigned int tl_y; // edi@3 + unsigned int br_y; // eax@3 + int v10; // eax@7 + + tl_x = sTL_X; + br_x = sBR_X; + if ( sTL_X > sBR_X ) + { + br_x = sBR_X ^ sTL_X ^ sBR_X; // swap x's + tl_x = br_x ^ sBR_X ^ sTL_X; + } + tl_y = sTL_Y; + br_y = sBR_Y; + if ( (signed int)sTL_Y > (signed int)sBR_Y ) + { + br_y = sBR_Y ^ sTL_Y ^ sBR_Y; // swap y's + tl_y = br_y ^ sBR_Y ^ sTL_Y; + } + this->uScreen_TL_X = tl_x; + this->uScreen_TL_Y = tl_y; + this->uScreen_BR_X = br_x; + this->uScreen_BR_Y = br_y; + this->uScreenWidth = br_x - tl_x + 1; + this->uScreenHeight = br_y - tl_y + 1; + this->uScreenCenterX = (signed int)(br_x + tl_x) /2; + if ( pRenderer->pRenderD3D == 0 ) + this->uScreenCenterY = this->uScreen_BR_Y - ((unsigned __int64)(this->field_30 * (signed __int64)(uScreenHeight)) >> 16); + else + this->uScreenCenterY = uScreenHeight/2; + SetViewport(this->uScreen_TL_X, this->uScreen_TL_Y, this->uScreen_BR_X, this->uScreen_BR_Y); + } + +//----- (004C02F8) -------------------------------------------------------- +void Viewport::_4C02F8(int a2) + { + this->field_30 = a2; + SetScreen(this->uScreen_TL_X, this->uScreen_TL_Y, this->uScreen_BR_X, this->uScreen_BR_Y); + } + +//----- (004C0312) -------------------------------------------------------- +void Viewport::SetViewport( signed int sTL_X, signed int sTL_Y, signed int sBR_X, signed int sBR_Y ) + { + signed int tl_x; // ebx@1 + signed int tl_y; // edi@3 + signed int br_x; // edx@5 + signed int br_y; // eax@7 + + tl_x = sTL_X; + if ( sTL_X < this->uScreen_TL_X ) + tl_x = this->uScreen_TL_X; + tl_y = sTL_Y; + if ( sTL_Y < this->uScreen_TL_Y ) + tl_y = this->uScreen_TL_Y; + br_x = sBR_X; + if ( sBR_X > this->uScreen_BR_X ) + br_x = this->uScreen_BR_X; + br_y = sBR_Y; + if ( sBR_Y > this->uScreen_BR_Y ) + br_y = this->uScreen_BR_Y; + this->uViewportTL_Y = tl_y; + this->uViewportTL_X = tl_x; + this->uViewportBR_X = br_x; + this->uViewportBR_Y = br_y; + } + +//----- (00443219) -------------------------------------------------------- + void ViewingParams::_443219() + { + this->sViewCenterY += 512; + AdjustPosition(); + } + +//----- (00443225) -------------------------------------------------------- +void ViewingParams::_443225() + { + this->sViewCenterX -= 512; + AdjustPosition(); + } + +//----- (00443231) -------------------------------------------------------- +void ViewingParams::_443231() + { + this->sViewCenterY -= 512; + AdjustPosition(); + } + +//----- (0044323D) -------------------------------------------------------- +void ViewingParams::_44323D() + { + this->sViewCenterX += 512; + AdjustPosition(); + } + +//----- (00443249) -------------------------------------------------------- +void ViewingParams::CenterOnParty() + { + int v1; // edx@1 + + v1 = (unsigned __int64)((signed __int64)this->field_2C << 15) >> 16; + this->field_2C = v1; + if ( v1 < 384 ) + this->field_2C = 384; + this->sViewCenterX = pParty->vPosition.x; + this->sViewCenterY = pParty->vPosition.y; + AdjustPosition(); + } + +//----- (00443291) -------------------------------------------------------- +void ViewingParams::CenterOnParty2() + { + int v1; // edx@1 + int v2; // eax@1 + + v1 = 2 * this->field_2C; + v2 = 1536; + this->field_2C = v1; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v2 = 3072; + if ( v1 > v2 ) + this->field_2C = v2; + this->sViewCenterX = pParty->vPosition.x; + this->sViewCenterY = pParty->vPosition.y; + AdjustPosition(); + } + +//----- (004432E7) -------------------------------------------------------- +void ViewingParams::AdjustPosition() + { + ViewingParams *v1; // esi@1 + int v2; // ebx@1 + signed int v3; // edx@1 + int v4; // ecx@1 + int v5; // edi@3 + int v6; // eax@3 + int v7; // eax@5 + + + v1 = this; + v2 = this->field_3A; + v3 = 88 >> this->field_2C / 384; + v4 = (44 - v3) << 9; + if ( v1->sViewCenterY > v2 + v4 ) + v1->sViewCenterY = v2 + v4; + + v5 = v1->field_38; + v6 = (v3 - 44) << 9; + if ( v1->sViewCenterX < v5 + v6 ) + v1->sViewCenterX = v5 + v6; + + v7 = v2 + v6; + if ( v1->sViewCenterY < v7 ) + v1->sViewCenterY = v7; + + if ( v1->sViewCenterX > v5 + v4 ) + v1->sViewCenterX = v5 + v4; + } + +//----- (00443343) -------------------------------------------------------- +void ViewingParams::InitGrayPalette() + { + for (unsigned short i=0; i<256; ++i) + pPalette[i]=GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(i, i, i); + } + +//----- (00443365) -------------------------------------------------------- +void ViewingParams::_443365() + { + ViewingParams *v1; // esi@1 + __int16 *v2; // edi@3 + Vec3_short_ *v3; // eax@4 + unsigned int v4; // edx@4 + signed int v5; // eax@8 + Vec3_short_ *v6; // eax@12 + signed int v7; // edi@12 + signed int v8; // eax@16 + char v9; // zf@20 + int result; // eax@21 + unsigned int v11; // [sp+4h] [bp-1Ch]@3 + unsigned int *v12; // [sp+8h] [bp-18h]@3 + unsigned int v13; // [sp+Ch] [bp-14h]@8 + unsigned int v14; // [sp+10h] [bp-10h]@2 + unsigned int v15; // [sp+14h] [bp-Ch]@2 + unsigned int v16; // [sp+18h] [bp-8h]@2 + unsigned int v17; // [sp+1Ch] [bp-4h]@2 + + v1 = this; + InitGrayPalette(); + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + v16 = 0x40000000u; + v14 = 0x40000000u; + v17 = 0xC0000000u; + v15 = 0xC0000000u; + if ( (signed int)pIndoor->pMapOutlines->uNumOutlines > 0 ) + { + v2 = (__int16 *)(pIndoor->pMapOutlines->pOutlines); + v11 = pIndoor->pMapOutlines->uNumOutlines; + v12 = (uint *)pIndoor->pMapOutlines->pOutlines; + do + { + v3 = &pIndoor->pVertices[*v2]; + v4 = v3->x; + if ( (signed int)v4 < (signed int)v16 ) + v16 = v3->x; + if ( (signed int)v4 > (signed int)v17 ) + v17 = v3->x; + v5 = v3->y; + v13 = v5; + if ( v5 < (signed int)v14 ) + v14 = v4; + if ( v5 > (signed int)v15 ) + v15 = v4; + v6 = &pIndoor->pVertices[v2[1]]; + v7 = v6->x; + if ( v7 < (signed int)v16 ) + v16 = v4; + if ( v7 > (signed int)v17 ) + v17 = v4; + v8 = v6->y; + if ( v8 < (signed int)v14 ) + v14 = v13; + if ( v8 > (signed int)v15 ) + v15 = v13; + v2 = (__int16 *)(v12 + 3); + v9 = v11-- == 1; + v12 += 3; + } + while ( !v9 ); + } + v1->uMinimapZoom = 1024; + v1->field_38 = (signed int)(v16 + v17) / 2; + v1->field_28 = 10; + result = (signed int)(v14 + v15) / 2; + v1->field_3A = result; + } + else + { + v1->field_38 = 0; + v1->field_3A = 0; + v1->uMinimapZoom = dword_576E2C; + v1->field_28 = dword_576E28; + } + v1->field_2C = 384; + } \ No newline at end of file
--- a/Viewport.h Mon Mar 18 01:50:50 2013 +0600 +++ b/Viewport.h Mon Mar 18 01:51:31 2013 +0600 @@ -4,19 +4,19 @@ #pragma pack(push, 1) struct Viewport { - void SetScreen(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); + void SetScreen(signed int uX, signed int uY, signed int uZ, signed int uW); void _4C02F8(int a2); - void SetViewport(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); + void SetViewport(signed int uX, signed int uY, signed int uZ, signed int uW); - unsigned int uScreenX; - unsigned int uScreenY; - unsigned int uScreenZ; - unsigned int uScreenW; - unsigned int uViewportX; - unsigned int uViewportY; - unsigned int uViewportZ; - unsigned int uViewportW; + signed int uScreen_TL_X; + signed int uScreen_TL_Y; + signed int uScreen_BR_X; + signed int uScreen_BR_Y; + signed int uViewportTL_X; + signed int uViewportTL_Y; + signed int uViewportBR_X; + signed int uViewportBR_Y; int uScreenWidth; int uScreenHeight; int uScreenCenterX; @@ -41,15 +41,15 @@ draw_d3d_outlines = false; } - void _443291(); + void CenterOnParty2(); void InitGrayPalette(); void _443219(); void _443225(); void _443231(); void _44323D(); - void _443249(); - void _4432E7(); - int _443365(); + void CenterOnParty(); + void AdjustPosition(); + void _443365(); @@ -57,16 +57,16 @@ int uSomeY; int uSomeZ; int uSomeW; - unsigned int uScreenX; - unsigned int uScreenY; - unsigned int uScreenZ; - unsigned int uScreenW; + unsigned int uScreen_topL_X; + unsigned int uScreen_topL_Y; + unsigned int uScreen_BttmR_X; + unsigned int uScreen_BttmR_Y; int field_20; unsigned int uMinimapZoom; int field_28; int field_2C; - int sPartyPosX; - int sPartyPosZ; + int sViewCenterX; + int sViewCenterY; __int16 field_38; __int16 field_3A; int field_3C;
--- a/Vis.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Vis.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -1743,10 +1743,10 @@ if (Vis_static_stru_F91E10.object_pointers[0]->actual_z > pBillboardRenderList[v3].actual_z) return 1; } - else if ((double)(pViewport->uScreenX) <= *(float *)&v35 && - (double)pViewport->uScreenZ >= *(float *)&v35 && - (double)pViewport->uScreenY <= *(float *)&v36 && - (double)pViewport->uScreenW >= *(float *)&v36) + else if ((double)(pViewport->uScreen_TL_X) <= *(float *)&v35 && + (double)pViewport->uScreen_BR_X >= *(float *)&v35 && + (double)pViewport->uScreen_TL_Y <= *(float *)&v36 && + (double)pViewport->uScreen_BR_Y >= *(float *)&v36) return 1; v40 = 0; v10 = (int)&pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.y; @@ -1757,13 +1757,13 @@ v11 = *(float *)v10; v13 = *(float *)(v10 - 4); Vis_static_stru_F91E10.uNumPointers = 0; - if ( v13 >= (double)(pViewport->uScreenX)) + if ( v13 >= (double)(pViewport->uScreen_TL_X)) { - if ( v12 <= (double)pViewport->uScreenZ ) + if ( v12 <= (double)pViewport->uScreen_BR_X ) { - if ( v11 >= (double)pViewport->uScreenY ) + if ( v11 >= (double)pViewport->uScreen_TL_Y ) { - if ( v11 <= (double)pViewport->uScreenW ) + if ( v11 <= (double)pViewport->uScreen_BR_Y ) { v14 = v11; v15 = v12; @@ -1811,10 +1811,10 @@ v41 = v38; Vis_static_stru_F91E10.uNumPointers = 0; v23 = (v20 - v21) * 0.5; - if ( v23 < (double)(pViewport->uScreenX) - || v23 > (double)pViewport->uScreenZ - || (double)pViewport->uScreenY > v41 - || (double)pViewport->uScreenW < v41 + if ( v23 < (double)(pViewport->uScreen_TL_X) + || v23 > (double)pViewport->uScreen_BR_X + || (double)pViewport->uScreen_TL_Y > v41 + || (double)pViewport->uScreen_BR_Y < v41 || ((v25 = v23, CastPickRay(local_80, SLODWORD(v25), v41, fDepth), uCurrentlyLoadedLevelType != 1) ? (PickOutdoorFaces_Mouse(fDepth, local_80, &Vis_static_stru_F91E10, &vis_face_filter, false)) : (PickIndoorFaces_Mouse(fDepth, local_80, &Vis_static_stru_F91E10, &vis_face_filter)),
--- a/Weather.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/Weather.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -49,13 +49,13 @@ signed int v32; // [sp+28h] [bp-4h]@10 v26 = this; - v25 = viewparams->uScreenZ; - v28 = viewparams->uScreenY; + v25 = viewparams->uScreen_BttmR_X; + v28 = viewparams->uScreen_topL_Y; v31 = 0; v1 = pRenderer->pTargetSurface; - v29 = viewparams->uScreenX; - v23 = viewparams->uScreenW; - v24 = viewparams->uScreenZ - viewparams->uScreenX; + v29 = viewparams->uScreen_topL_X; + v23 = viewparams->uScreen_BttmR_Y; + v24 = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X; do { v2 = &v26->field_0[2 * v31]; @@ -177,12 +177,12 @@ v1 = this; v2 = 0; - v3 = pViewport->uScreenZ - pViewport->uScreenX - 4; - v4 = pViewport->uScreenW - pViewport->uScreenY - 4; + v3 = pViewport->uScreen_BR_X - pViewport->uScreen_TL_X - 4; + v4 = pViewport->uScreen_BR_Y - pViewport->uScreen_TL_Y - 4; do { - v1->field_0[2 * v2++] = LOWORD(pViewport->uViewportX) + rand() % v3; - *((short *)v1 + 2 * v2 - 1) = LOWORD(pViewport->uViewportY) + rand() % v4; + v1->field_0[2 * v2++] = LOWORD(pViewport->uViewportTL_X) + rand() % v3; + *((short *)v1 + 2 * v2 - 1) = LOWORD(pViewport->uViewportTL_Y) + rand() % v4; } while ( v2 < 1000 ); return 0; @@ -211,11 +211,11 @@ v10 = this; if ( this->bRenderSnow != 1 ) return 0; - HIWORD(v3) = HIWORD(viewparams->uScreenX); + HIWORD(v3) = HIWORD(viewparams->uScreen_topL_X); v4 = 0; - screen_width = viewparams->uScreenZ - viewparams->uScreenX; - screen_x = viewparams->uScreenX; - screen_z_minus_4 = viewparams->uScreenZ - 4; + screen_width = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X; + screen_x = viewparams->uScreen_topL_X; + screen_z_minus_4 = viewparams->uScreen_BttmR_X - 4; auto _this = this->field_0; while ( 1 )
--- a/mm7_1.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/mm7_1.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -87,7 +87,7 @@ for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) { if ( BYTE1(i->field_1C) & 0x80 ) - GUIButton::_41D0D8(i); + i->Release(); } for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext ) { @@ -1459,7 +1459,7 @@ void __cdecl draw_right_panel() { pRenderer->DrawTextureTransparent( - pViewport->uViewportZ, + pViewport->uViewportBR_X, 0, (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); } @@ -4063,10 +4063,10 @@ if ( pRenderer->pRenderD3D ) { v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); - if ( (signed int)pX < (signed int)pViewport->uScreenX - || (signed int)pX > (signed int)pViewport->uScreenZ - || (signed int)pY < (signed int)pViewport->uScreenY - || (signed int)pY > (signed int)pViewport->uScreenW ) + if ( (signed int)pX < (signed int)pViewport->uScreen_TL_X + || (signed int)pX > (signed int)pViewport->uScreen_BR_X + || (signed int)pY < (signed int)pViewport->uScreen_TL_Y + || (signed int)pY > (signed int)pViewport->uScreen_BR_Y ) v18 = -1; if ( v18 == -1 ) //goto LABEL_61; @@ -4693,31 +4693,31 @@ CharacterUI_LoadPaperdollTextures(); pCurrentScreen = v1; pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0); - pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportX + 12, pViewport->uViewportY + 308, + pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308, (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureWidth : 24), (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureHeight : 26), 1, 0, 0x73u, 0, 0x53u, pGlobalTXT_LocalizationStrings[216],// Stats (Texture *)(papredoll_dbrds[10] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[10]] : 0), papredoll_dbrds[9] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[9]] : 0, 0); - pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportX + 102, pViewport->uViewportY + 308, + pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308, (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureWidth : 24), (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureHeight : 26), 1, 0, 0x72u, 0, 0x4Bu, pGlobalTXT_LocalizationStrings[205],//Skills (Texture *)(papredoll_dbrds[8] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[8]] : 0), papredoll_dbrds[7] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[7]] : 0, 0); - pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportX + 192, pViewport->uViewportY + 308, + pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308, (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureWidth : 24), (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureHeight : 26), 1, 0, 0x74u, 0, 0x49u, pGlobalTXT_LocalizationStrings[120], //Inventory (Texture *)(papredoll_dbrds[6] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[6]] : 0), papredoll_dbrds[5] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[5]] : 0, 0); - pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportX + 282, pViewport->uViewportY + 308, + pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308, (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureWidth : 24), (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureHeight : 26), 1, 0, 0x75u, 0, 0x41u, pGlobalTXT_LocalizationStrings[22], //Awards (Texture *)(papredoll_dbrds[4] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[4]] : 0), papredoll_dbrds[3] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[3]] : 0, 0); - pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportX + 371, pViewport->uViewportY + 308, + pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308, (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureWidth : 24), (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureHeight : 26), 1, 0, 0xA8u, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit
--- a/mm7_2.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/mm7_2.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -579,10 +579,10 @@ pRenderer->BeginScene(); if ( pRenderer->pRenderD3D ) pRenderer->FillRectFast( - pViewport->uViewportX, - pViewport->uViewportY, - pViewport->uViewportZ - pViewport->uViewportX, - pViewport->uViewportW - pViewport->uViewportY + 1, + pViewport->uViewportTL_X, + pViewport->uViewportTL_Y, + pViewport->uViewportBR_X - pViewport->uViewportTL_X, + pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, pRenderer->uTargetGMask | pRenderer->uTargetBMask); auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr); @@ -2884,87 +2884,6 @@ } -//----- (004C0262) -------------------------------------------------------- -void Viewport::SetScreen(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) -{ - unsigned int x; // edx@1 - unsigned int z; // esi@1 - unsigned int y; // edi@3 - unsigned int w; // eax@3 - char no_3d; // zf@5 - int v10; // eax@7 - - x = uX; - z = uZ; - if ( (signed int)uX > (signed int)uZ ) - { - z = uZ ^ uX ^ uZ; // swap x and z - x = z ^ uZ ^ uX; - } - y = uY; - w = uW; - if ( (signed int)uY > (signed int)uW ) - { - w = uW ^ uY ^ uW; // swap y and w - y = w ^ uW ^ uY; - } - this->uScreenX = x; - this->uScreenY = y; - this->uScreenZ = z; - this->uScreenW = w; - no_3d = pRenderer->pRenderD3D == 0; - this->uScreenWidth = z - x + 1; - this->uScreenCenterX = (signed int)(z + x) >> 1; - if ( no_3d ) - { - v10 = w - y + 1; - this->uScreenHeight = v10; - this->uScreenCenterY = this->uScreenW - ((unsigned __int64)(this->field_30 * (signed __int64)v10) >> 16); - } - else - { - this->uScreenHeight = w - y + 1; - this->uScreenCenterY = (signed int)(w + y) >> 1; - } - SetViewport(this->uScreenX, this->uScreenY, this->uScreenZ, this->uScreenW); -} - -//----- (004C02F8) -------------------------------------------------------- -void Viewport::_4C02F8(int a2) -{ - unsigned int v2; // ST0C_4@1 - - v2 = this->uScreenW; - this->field_30 = a2; - SetScreen(this->uScreenX, this->uScreenY, this->uScreenZ, v2); -} - -//----- (004C0312) -------------------------------------------------------- -void Viewport::SetViewport(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) -{ - unsigned int x; // ebx@1 - unsigned int y; // edi@3 - unsigned int z; // edx@5 - unsigned int w; // eax@7 - - x = uX; - if ( (signed int)uX < (signed int)this->uScreenX ) - x = this->uScreenX; - y = uY; - if ( (signed int)uY < (signed int)this->uScreenY ) - y = this->uScreenY; - z = uZ; - if ( (signed int)uZ > (signed int)this->uScreenZ ) - z = this->uScreenZ; - w = uW; - if ( (signed int)uW > (signed int)this->uScreenW ) - w = this->uScreenW; - this->uViewportY = y; - this->uViewportX = x; - this->uViewportZ = z; - this->uViewportW = w; -} - @@ -5336,7 +5255,7 @@ ExitProcess(0); } v27 = &pMonsterList->pMonsters[(signed __int16)v26]; - v28 = pMonsterStats->_4563FF(pTexture); + v28 = pMonsterStats->FindMonsterByName(pTexture); if ( !v28 ) v28 = 1; Src = &pMonsterStats->pInfos[v28]; @@ -7083,436 +7002,6 @@ } } -//----- (004548E2) -------------------------------------------------------- -unsigned int __fastcall ParseSpellType(FrameTableTxtLine *a1, int a2) -{ - int v2; // edi@1 - int v3; // esi@1 - unsigned int result; // eax@1 - std::string v5; // [sp-18h] [bp-28h]@75 - const char *v6; // [sp-8h] [bp-18h]@75 - signed int v7; // [sp-4h] [bp-14h]@3 - std::string *v8; // [sp+8h] [bp-8h]@75 - int a3; // [sp+Fh] [bp-1h]@75 - - v2 = (int)a1; - v3 = a2; - result = (int)a1->pProperties[0]; - if ( result ) - { - if ( !_strcmpi((const char *)result, "Dispel") ) - { - v7 = 80; -LABEL_71: - result = v7; -LABEL_76: - ++*(int *)v3; - return result; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Day") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Hour") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Shield") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Spirit") ) - { - v7 = 52; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Power") ) - { - v7 = 77; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Meteor") ) - { - v7 = 9; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Lightning") ) - { - v7 = 18; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Implosion") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Stone") ) - { - v7 = 38; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Haste") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Heroism") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Pain") ) - { - v7 = 95; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Sparks") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Light") ) - { - v7 = 78; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Toxic") ) - { - v7 = 90; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "ShrapMetal") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Paralyze") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Fireball") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Incinerate") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Fire") ) - { - v7 = 2; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Rock") ) - { - v7 = 41; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Mass") ) - { - v7 = 44; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Ice") ) - { - v7 = 26; - goto LABEL_71; - } - if ( !_strcmpi(*(const char **)(v2 + 4), "Acid") ) - { - v7 = 29; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Bless") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Dragon") ) - { - v7 = 97; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Reanimate") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Summon") ) - { - v7 = 82; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Fate") ) - { - if ( _strcmpi(*(const char **)(v2 + 4), "Harm") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Mind") ) - { - v7 = 57; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Blades") ) - { - if ( !_strcmpi(*(const char **)(v2 + 4), "Psychic") ) - { - v7 = 65; - goto LABEL_71; - } - if ( _strcmpi(*(const char **)(v2 + 4), "Hammerhands") ) - { - sprintf(pTmpBuf, "Unknown monster spell %s", *(int *)(v2 + 4)); - MessageBoxA(nullptr, pTmpBuf, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:1562", 0); - result = 0; - goto LABEL_76; - } - v7 = 73; - } - else - { - v7 = 39; - } - } - else - { - v7 = 70; - } - } - else - { - v7 = 47; - } - } - else - { - v7 = 89; - } - } - else - { - v7 = 46; - } - } - else - { - v7 = 11; - } - } - else - { - v7 = 6; - } - } - else - { - v7 = 81; - } - } - else - { - v7 = 93; - } - } - else - { - v7 = 15; - } - } - else - { - v7 = 51; - } - } - else - { - v7 = 5; - } - } - else - { - v7 = 20; - } - } - else - { - v7 = 17; - } - return v7; - } - v7 = 86; - } - else - { - v7 = 85; - } - *(int *)v3 += 2; - result = v7; - } - return result; -} - -//----- (00454CB4) -------------------------------------------------------- -int __thiscall ParseAttackType(unsigned __int8 *a1) -{ - unsigned __int8 *v1; // esi@1 - int result; // eax@4 - int v3; // eax@15 - int v4; // eax@18 - - v1 = a1; - if ( !a1 ) - return 4; - if ( tolower(*a1) == 'f' ) - return 0; - if ( tolower(*v1) == 'a' ) - return 1; - if ( tolower(*v1) == 'w' ) - return 2; - if ( tolower(*v1) == 'e' ) - { - tolower(v1[1]); - return 3; - } - if ( tolower(*v1) == 's' ) - return 6; - if ( tolower(*v1) == 'm' ) - { - v3 = -(tolower(v1[1]) != 'i'); - LOBYTE(v3) = v3 & 0xFE; - result = v3 + 7; - } - else - { - if ( tolower(*v1) == 'l' ) - return 9; - v4 = -(tolower(*v1) != 'd'); - LOBYTE(v4) = v4 & 0xFA; - result = v4 + 10; - } - return result; -} - -//----- (00454D7D) -------------------------------------------------------- -char __fastcall ParseDamage(const char *Str, int a2, int a3, int a4) -{ - int v4; // esi@1 - const char *v5; // edi@1 - signed int v6; // ebx@1 - int *v7; // esi@2 - int v8; // eax@3 - size_t v10; // [sp+Ch] [bp-Ch]@1 - int v11; // [sp+10h] [bp-8h]@1 - signed int v12; // [sp+14h] [bp-4h]@1 - - v4 = a2; - v5 = Str; - *(char *)a2 = 0; - *(char *)a3 = 1; - v11 = a2; - *(char *)a4 = 0; - v6 = 0; - v10 = strlen(Str); - v12 = 0; - if ( (signed int)v10 <= 0 ) - { -LABEL_9: - LOBYTE(v8) = *v5; - if ( (unsigned __int8)*v5 >= 0x30u && (unsigned __int8)v8 <= 0x39u ) - { - *(char *)v4 = atoi(v5); - LOBYTE(v8) = a3; - *(char *)a3 = 1; - } - return v8; - } - do - { - v7 = (int *)&v5[v6]; - if ( tolower((unsigned __int8)v5[v6]) == 100 ) - { - *(char *)v7 = 0; - *(char *)v11 = atoi(v5); - LOBYTE(v8) = atoi(&v5[v6 + 1]); - v12 = 1; - *(char *)a3 = v8; - *(char *)v7 = 100; - } - else - { - v8 = tolower(*(char *)v7); - if ( v8 == 43 ) - { - LOBYTE(v8) = atoi(&v5[v6 + 1]); - *(char *)a4 = v8; - } - } - ++v6; - } - while ( v6 < (signed int)v10 ); - if ( !v12 ) - { - v4 = v11; - goto LABEL_9; - } - return v8; -} - -//----- (00454E3A) -------------------------------------------------------- -int __fastcall ParseMissleAttackType(const char *Str1) -{ - const char *v1; // esi@1 - int v2; // edi@1 - int v4; // [sp-4h] [bp-Ch]@4 - - v1 = Str1; - v2 = 0; - if ( _strcmpi(Str1, "ARROW") ) - { - if ( _strcmpi(v1, "ARROWF") ) - { - if ( _strcmpi(v1, "FIRE") ) - { - if ( _strcmpi(v1, "AIR") ) - { - if ( _strcmpi(v1, "WATER") ) - { - if ( _strcmpi(v1, "EARTH") ) - { - if ( _strcmpi(v1, "SPIRIT") ) - { - if ( _strcmpi(v1, "MIND") ) - { - if ( _strcmpi(v1, "BODY") ) - { - if ( _strcmpi(v1, "LIGHT") ) - { - if ( _strcmpi(v1, "DARK") ) - { - if ( _strcmpi(v1, "ENER") ) - return v2; - v4 = 13; - } - else - { - v4 = 11; - } - } - else - { - v4 = 10; - } - } - else - { - v4 = 9; - } - } - else - { - v4 = 8; - } - } - else - { - v4 = 7; - } - } - else - { - v4 = 6; - } - } - else - { - v4 = 5; - } - } - else - { - v4 = 4; - } - } - else - { - v4 = 3; - } - } - else - { - v4 = 2; - } - return v4; - } - return 1; -} - @@ -9834,8 +9323,8 @@ pIndoorCamera = new IndoorCamera; pIndoorCamera->Initialize( 65, - viewparams->uScreenZ - viewparams->uScreenX + 1, - viewparams->uScreenW - viewparams->uScreenY + 1); + viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1, + viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1); InitializeTurnBasedAnimations(&stru_50C198); pBitmaps_LOD->dword_11B84 = pBitmaps_LOD->uNumLoadedFiles; @@ -10918,6 +10407,7 @@ assert(sizeof(Chest) == 5324); assert(sizeof(stru123) == 0xC8); assert(sizeof(BLVMapOutline) == 12); + assert(sizeof(LODSprite) == 0x28); } bool new_sky = false; @@ -11196,10 +10686,10 @@ //_getcwd(v5, 120); //sprintfex(pIniFilename, "%s\\mm6.ini", v5); viewparams = new ViewingParams; - viewparams->uScreenX = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename); - viewparams->uScreenY = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename); - viewparams->uScreenZ = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename); - viewparams->uScreenW = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename); + viewparams->uScreen_topL_X = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename); + viewparams->uScreen_topL_Y = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename); + viewparams->uScreen_BttmR_X = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename); + viewparams->uScreen_BttmR_Y = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename); pAudioPlayer = new AudioPlayer; @@ -11352,12 +10842,12 @@ LOBYTE(viewparams->field_20) = 0; } pParty->uFlags |= 2u; - viewparams->uSomeY = viewparams->uScreenY; - viewparams->uSomeX = viewparams->uScreenX; - viewparams->uSomeZ = viewparams->uScreenZ; - viewparams->uSomeW = viewparams->uScreenW; - - pViewport->SetScreen(viewparams->uScreenX, viewparams->uScreenY, viewparams->uScreenZ, viewparams->uScreenW); + viewparams->uSomeY = viewparams->uScreen_topL_Y; + viewparams->uSomeX = viewparams->uScreen_topL_X; + viewparams->uSomeZ = viewparams->uScreen_BttmR_X; + viewparams->uSomeW = viewparams->uScreen_BttmR_Y; + + pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y); if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) pOutdoorCamera->_485F64(); } @@ -12685,15 +12175,15 @@ DoInteractionWithTopmostZObject((unsigned __int16)v1, (signed int)(unsigned __int16)v1 >> 3); } v22 = 0; - v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1); - if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW ) + v1 = (int *)((signed int)(viewparams->uScreen_BttmR_X + viewparams->uScreen_topL_X) >> 1); + if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) { v2 = (char *)v1 - 50; v1 = (int *)((char *)v1 + 50); - v3 = 640 * viewparams->uScreenY; + v3 = 640 * viewparams->uScreen_topL_Y; v17 = v2; v20 = v1; - v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1; + v18 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1; do { if ( (signed int)v2 < (signed int)v20 ) @@ -12979,12 +12469,12 @@ else { v16 = 0; - v4 = viewparams->uScreenX; - v12 = viewparams->uScreenZ; - if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW ) - { - v15 = &pRenderer->pActiveZBuffer[viewparams->uScreenX + 640 * viewparams->uScreenY]; - v13 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1; + v4 = viewparams->uScreen_topL_X; + v12 = viewparams->uScreen_BttmR_X; + if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) + { + v15 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; + v13 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1; do { if ( (signed int)v4 < (signed int)v12 ) @@ -13225,8 +12715,8 @@ int v32; // [sp+20h] [bp-4h]@1 v0 = 0; - v1 = (signed int)(viewparams->uScreenW + viewparams->uScreenY) >> 1; - v2 = (signed int)(viewparams->uScreenX + viewparams->uScreenZ) >> 1; + v1 = (signed int)(viewparams->uScreen_BttmR_Y + viewparams->uScreen_topL_Y) >> 1; + v2 = (signed int)(viewparams->uScreen_topL_X + viewparams->uScreen_BttmR_X) >> 1; v3 = v1 - 50; v32 = 0; v4 = 100;
--- a/mm7_3.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/mm7_3.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -4479,10 +4479,10 @@ *((float *)v4 + 19) = v8 - v9; } *((int *)v4 + 21) = *((int *)v4 + 1); - if ( (double)(signed int)pViewport->uViewportX <= *((float *)v4 + 18) - && (double)(signed int)pViewport->uViewportZ > *((float *)v4 + 18) - && (double)(signed int)pViewport->uViewportY <= *((float *)v4 + 19) - && (double)(signed int)pViewport->uViewportW > *((float *)v4 + 19) ) + if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v4 + 18) + && (double)(signed int)pViewport->uViewportBR_X > *((float *)v4 + 18) + && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v4 + 19) + && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v4 + 19) ) v16 = 1; ++v3; v4 += 16; @@ -4505,10 +4505,10 @@ *((int *)v10 + 22) = LODWORD(v11); *((int *)v10 + 23) = *((int *)v10 + 3); *((float *)v10 + 21) = v13 - v14; - if ( (double)(signed int)pViewport->uViewportX <= *((float *)v10 + 20) - && (double)(signed int)pViewport->uViewportZ > *((float *)v10 + 20) - && (double)(signed int)pViewport->uViewportY <= *((float *)v10 + 21) - && (double)(signed int)pViewport->uViewportW > *((float *)v10 + 21) ) + if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v10 + 20) + && (double)(signed int)pViewport->uViewportBR_X > *((float *)v10 + 20) + && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v10 + 21) + && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v10 + 21) ) v16 = 1; ++v1; v10 += 16; @@ -5844,8 +5844,8 @@ draw: struct RenderVertexD3D3 v[6]; - v[0].pos.x = pViewport->uScreenX; - v[0].pos.y = pViewport->uScreenY; + v[0].pos.x = pViewport->uScreen_TL_X; + v[0].pos.y = pViewport->uScreen_TL_Y; v[0].pos.z = 0.99989998; v[0].rhw = 1; v[0].diffuse = 0xFFFFFFFF; @@ -5853,8 +5853,8 @@ v[0].texcoord.x = 0; v[0].texcoord.y = 0; - v[1].pos.x = pViewport->uScreenX + pViewport->uScreenWidth; - v[1].pos.y = pViewport->uScreenY + pViewport->uScreenHeight; + v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; + v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; v[1].pos.z = 0.99989998; v[1].rhw = 1; v[1].diffuse = 0xFFFFFFFF; @@ -5862,8 +5862,8 @@ v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; - v[2].pos.x = pViewport->uScreenX + pViewport->uScreenWidth; - v[2].pos.y = pViewport->uScreenY; + v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; + v[2].pos.y = pViewport->uScreen_TL_Y; v[2].pos.z = 0.99989998; v[2].rhw = 1; v[2].diffuse = 0xFFFFFFFF; @@ -5873,8 +5873,8 @@ memcpy(&v[3], &v[0], sizeof(*v)); - v[4].pos.x = pViewport->uScreenX; - v[4].pos.y = pViewport->uScreenY + pViewport->uScreenHeight; + v[4].pos.x = pViewport->uScreen_TL_X; + v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; v[4].pos.z = 0.99989998; v[4].rhw = 1; v[4].diffuse = 0xFFFFFFFF; @@ -6125,16 +6125,16 @@ _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; _this.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; - array_50AC10[0].vWorldViewProjX = pViewport->uViewportX; - array_50AC10[0].vWorldViewProjY = pViewport->uViewportY; - - array_50AC10[1].vWorldViewProjX = pViewport->uViewportX; + array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X; + array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y; + + array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X; array_50AC10[1].vWorldViewProjY = v38; - array_50AC10[2].vWorldViewProjX = pViewport->uViewportZ; - array_50AC10[2].vWorldViewProjY = pViewport->uViewportY; - - array_50AC10[3].vWorldViewProjX = pViewport->uViewportZ; + array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X; + array_50AC10[2].vWorldViewProjY = pViewport->uViewportTL_Y; + + array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; array_50AC10[3].vWorldViewProjY = v38; /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5; @@ -6445,7 +6445,7 @@ v21 = abs(v19 >> 14); if ( v21 <= abs(X) ) break; - if ( SLODWORD(v76) <= (signed int)pViewport->uViewportY ) + if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) break; v19 = v77; v20 = v79; @@ -6565,7 +6565,7 @@ v40 = abs(X); if ( abs((signed __int64)v65) <= v40 ) break; - if ( SLODWORD(v76) <= (signed int)pViewport->uViewportY ) + if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) break; v39 = v78; LABEL_36: @@ -12270,7 +12270,7 @@ //----- (00442955) -------------------------------------------------------- -void DrawBook_Map_sub( unsigned int x, unsigned int y, unsigned int width, int height, int _48074 ) +void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 ) { int v5; // ebx@1 int v6; // edi@1 @@ -12300,7 +12300,7 @@ double v30; // st7@23 signed __int64 v31; // qax@23 unsigned short *v32; // edx@23 - int v33; // esi@23 + int textr_width; // esi@23 signed int v34; // eax@23 signed int v35; // ecx@23 int v36; // esi@27 @@ -12342,42 +12342,51 @@ unsigned int v72; // [sp-8h] [bp-4806Ch]@80 signed int v73; // [sp-4h] [bp-48068h]@59 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 - unsigned short v75[131070]; // [sp+Ch] [bp-48058h]@23 + unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23 int v76; // [sp+4800Ch] [bp-58h]@23 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 - unsigned __int16 *v78; // [sp+48014h] [bp-50h]@23 - unsigned int v79; // [sp+48018h] [bp-4Ch]@1 - unsigned int y_; // [sp+4801Ch] [bp-48h]@1 + unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 + unsigned int surfPitch; // [sp+48018h] [bp-4Ch]@1 + int v81; // [sp+48020h] [bp-44h]@23 - unsigned int x_; // [sp+48024h] [bp-40h]@1 + unsigned __int16* render16_data; + unsigned char* texture8_data; + unsigned char* curr_line; + int scale_increment; + int scaled_posX; + int scaled_posY; + int stepX_r; + int stepY_r; + + unsigned int teal; // [sp+48028h] [bp-3Ch]@8 int v84; // [sp+4802Ch] [bp-38h]@1 - int v85; // [sp+48030h] [bp-34h]@1 + int screenCenter_X; // [sp+48030h] [bp-34h]@1 int v86; // [sp+48034h] [bp-30h]@1 int v87; // [sp+48038h] [bp-2Ch]@16 unsigned int v88; // [sp+4803Ch] [bp-28h]@16 int black; // [sp+48040h] [bp-24h]@8 - int v90; // [sp+48044h] [bp-20h]@1 + int screenCenterY; // [sp+48044h] [bp-20h]@1 unsigned int i; // [sp+48048h] [bp-1Ch]@9 - unsigned int v92; // [sp+4804Ch] [bp-18h]@16 + unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 - signed int v94; // [sp+48054h] [bp-10h]@8 + signed int screenWidth; // [sp+48054h] [bp-10h]@8 unsigned int v95; // [sp+48058h] [bp-Ch]@16 int v96; // [sp+4805Ch] [bp-8h]@10 const void *v97; // [sp+48060h] [bp-4h]@16 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 int a5a; // [sp+48070h] [bp+Ch]@86 - x_ = x; - y_ = y; - v85 = (signed int)(x + width) >> 1; - v90 = (signed int)(y + height) >> 1; - v79 = pRenderer->uTargetSurfacePitch; - pRenderer->Clip_v2(x, y, width, height); + tl_x = tl_x; + tl_y = tl_y; + screenCenter_X = (signed int)(tl_x + br_x) >> 1; + screenCenterY = (signed int)(tl_y + br_y) >> 1; + surfPitch = pRenderer->uTargetSurfacePitch; + pRenderer->Clip_v2(tl_x, tl_y, br_x, br_y); v5 = viewparams->field_2C; - v6 = viewparams->sPartyPosX; - v86 = viewparams->sPartyPosX; - v84 = viewparams->sPartyPosZ; + v6 = viewparams->sViewCenterX; + v86 = viewparams->sViewCenterX; + v84 = viewparams->sViewCenterY; if ( viewparams->field_2C != 384 ) { if ( viewparams->field_2C == 768 ) @@ -12396,92 +12405,52 @@ } if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { - v94 = width - x_ + 1; - v92 = height - y_ + 1; - v93 = &pRenderer->pTargetSurface[x_ + y_ * v79]; - v95 = (unsigned int)pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; - v78 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; - v87 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5; + screenWidth = br_x - tl_x + 1; + screenHeight = br_y - tl_y + 1; + render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch]; + texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; + pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; + scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5; + v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); - black = 22528 / (v5 / 384); - teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; + + + teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); - v96 = 32768 - black - v84; - v31 = (signed __int64)((double)v96 / v30); - v32 = v75; - v33 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; - v34 = (int)v31 << 16; - v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); + + v32 = map_texture_16; + textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; + stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16; + v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); - v76 = v33; - v35 = v34 >> 16; - if ( v95 && (signed int)v92 > 0 ) - { - v96 = v92; - do - { - v88 = 0; - if ( (signed int)v94 > 0 ) - { - v36 = v95 + v35 * v76; - i = v94; - v88 = v94; - v37 = black; - v77 = (unsigned __int16 *)v36; - do - { - *(short *)v32 = v78[*((char *)v77 + v37)];//crash - ++v32; - v97 = (char *)v97 + v87; - v37 = (signed int)v97 >> 16; - --i; - } - while ( i ); - } - v34 += v87; - v97 = (const void *)teal; - black = v81; - v32 += 2 * (v94 - v88); - v35 = v34 >> 16; - --v96; - } - while ( v96 ); - } - v97 = &v75; - if ( (signed int)v92 > 0 ) - { - v96 = v92; - v38 = 2 * (v79 - v94); - do - { - if ( (signed int)v94 > 0 ) - { - v39 = v94; - v40 = (short *)v97; - v41 = (short *)v93; - v42 = v94 & 1; - v43 = v94 >> 1; - memcpy(v93, v97, 2 * (v94 >> 1)); - v45 = &v40[2 * v43]; - v44 = &v41[2 * v43]; - v46 = v42; - v39 *= 2; - v93 = (unsigned __int16 *)((char *)v93 + v39); - v97 = (char *)v97 + v39; - while ( v46 ) - { - *v44 = *v45; - ++v45; - ++v44; - --v46; - } - v6 = v86; - } - v93 = (unsigned __int16 *)((char *)v93 + v38); - --v96; - } - while ( v96 ); - } + + v76 = textr_width; + scaled_posY = stepY_r >> 16; + //nearest neiborhood scaling + if ( texture8_data) + { + for(uint i=0; i<screenHeight;++i) + { + curr_line=&texture8_data[scaled_posY*textr_width]; + stepX_r=teal; + for(uint j=0; j<screenWidth;++j) + { + scaled_posX=stepX_r>>16; + map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)]; + stepX_r+=scale_increment; + } + stepY_r+=scale_increment; + scaled_posY=stepY_r>>16; + } + } + //move visible square to render + for(uint i=0; i<screenHeight;++i) + { + if ( screenWidth > 0 ) + { + memcpy((void*)&render16_data[surfPitch*i],(void*)&map_texture_16[i*screenWidth], screenWidth*2); + } + } } else { @@ -12491,7 +12460,7 @@ uNumBlueFacesInBLVMinimap = 0; v8 = pIndoor->pMapOutlines->uNumOutlines == 0; v9 = pIndoor->pMapOutlines->uNumOutlines < 0; - v94 = 0; + screenWidth = 0; if ( !(v9 | v8) ) { i = 0; @@ -12506,8 +12475,8 @@ { if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) { - v96 = (signed int)v94 >> 3; - v13 = v94; + v96 = (signed int)screenWidth >> 3; + v13 = screenWidth; *(short *)(v10 + 10) = v12 | 1; pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8); } @@ -12520,29 +12489,29 @@ v16 = v15->x; v17 = v15->y - v84; v93 = (unsigned __int16 *)(v16 - v6); - v92 = v17; + screenHeight = v17; v18 = &pIndoor->pVertices[*(short *)(v10 + 2)]; v19 = v18->x; v20 = v18->y - v84; v95 = v19 - v6; v97 = (const void *)v20; v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16; - v87 = (unsigned __int64)((signed int)v92 * (signed __int64)v5) >> 16; + v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)v5) >> 16; v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); - v92 = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; + screenHeight = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; pRenderer->Line2D( - v85 + v88, - v90 - v87, - v85 + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), - v90 - v92, + screenCenter_X + v88, + screenCenterY - v87, + screenCenter_X + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), + screenCenterY - screenHeight, black); v7 = pIndoor->pMapOutlines; } } - ++v94; + ++screenWidth; i += 12; } - while ( v94 < (signed int)v7->uNumOutlines ); + while ( screenWidth < (signed int)v7->uNumOutlines ); } v21 = 0; if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) @@ -12559,17 +12528,17 @@ v28 = v24->y - v84; v29 = v25->y - v84; v93 = v27; - v92 = v28; + screenHeight = v28; v97 = (const void *)v29; v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16; v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; pRenderer->Line2D( - v85 + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), - v90 - v88, - v85 + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), - v90 - v95, + screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), + screenCenterY - v88, + screenCenter_X + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), + screenCenterY - v95, teal); ++v21; if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) @@ -12579,40 +12548,40 @@ v6 = v86; } } - v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 3; + v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 3; v81 = pParty->vPosition.y - v84; v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16); v48 = 1; - v49 = v90 - (int)v97 - 3; - if ( v47 >= (signed int)x_ ) - { - if ( v47 > (signed int)width ) - { - if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 6) > (signed int)width ) + v49 = screenCenterY - (int)v97 - 3; + if ( v47 >= (signed int)tl_x ) + { + if ( v47 > (signed int)br_x ) + { + if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 6) > (signed int)br_x ) v48 = 0; - v47 = width; - } - } - else - { - if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85) < (signed int)x_ ) + v47 = br_x; + } + } + else + { + if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X) < (signed int)tl_x ) v48 = 0; - v47 = x_; - } - if ( v49 >= (signed int)y_ ) - { - if ( v49 > height ) - { - if ( v90 - (signed int)v97 - 6 > height ) + v47 = tl_x; + } + if ( v49 >= (signed int)tl_y ) + { + if ( v49 > br_y ) + { + if ( screenCenterY - (signed int)v97 - 6 > br_y ) v48 = 0; - v49 = height; - } - } - else - { - if ( v90 - (signed int)v97 < (signed int)y_ ) + v49 = br_y; + } + } + else + { + if ( screenCenterY - (signed int)v97 < (signed int)tl_y ) v48 = 0; - v49 = y_; + v49 = tl_y; } if ( v48 == 1 ) { @@ -12672,17 +12641,17 @@ v86 = result; if ( (signed int)uNumLevelDecorations > 0 ) { - v94 = (unsigned int)&pLevelDecorations[0].vPosition; + screenWidth = (unsigned int)&pLevelDecorations[0].vPosition; do { - if ( *(char *)(v94 - 2) & 8 ) - { - v53 = *(int *)(v94 + 4) - v84; - v93 = (unsigned __int16 *)(*(int *)v94 - v6); - v92 = v53; - v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + v85; + if ( *(char *)(screenWidth - 2) & 8 ) + { + v53 = *(int *)(screenWidth + 4) - v84; + v93 = (unsigned __int16 *)(*(int *)screenWidth - v6); + screenHeight = v53; + v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16); - v55 = v90 - (int)v97; + v55 = screenCenterY - (int)v97; if ( v54 >= pRenderer->field_1C_clipx ) { if ( v54 <= pRenderer->field_24_width && v55 >= pRenderer->field_20_clipy && v55 <= pRenderer->field_28_height ) @@ -12702,9 +12671,9 @@ } else { - v72 = v90 - (int)v97; - v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + v85; - v70 = v90 - (int)v97; + v72 = screenCenterY - (int)v97; + v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; + v70 = screenCenterY - (int)v97; } pRenderer->Line2D(v54, v70, v71, v72, v74); } @@ -12712,15 +12681,15 @@ } ++v95; result = v95; - v94 += 32; + screenWidth += 32; } while ( (signed int)v95 < (signed int)uNumLevelDecorations ); } if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { - v90 = width - x_ + 1; - v95 = height - y_ + 1; - v77 = &pRenderer->pTargetSurface[x_ + y_ * v79]; + screenCenterY = br_x - tl_x + 1; + v95 = br_y - tl_y + 1; + v77 = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch]; v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; black = (1 << (v56 + 16)) / v5; v57 = (double)(1 << (16 - v56)); @@ -12729,17 +12698,17 @@ v60 = (int)v59 << 16; v97 = (const void *)((int)v59 << 16); v61 = (signed __int64)((double)(32768 - v58 - v84) / v57); - v78 = (unsigned __int16 *)(v60 >> 16); + pPalette_16 = (unsigned __int16 *)(v60 >> 16); v62 = (int)v61 << 16; teal = v60 >> 16; v63 = (signed __int16)v61; - a4a = v75; + a4a = map_texture_16; result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu); - v85 = 0; - for ( i = result; v85 < (signed int)v95; result = v85 ) + screenCenter_X = 0; + for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X ) { a5a = 0; - if ( v90 > 0 ) + if ( screenCenterY > 0 ) { v96 = (v63 - 80) / 4; v64 = teal; @@ -12750,7 +12719,7 @@ { if ( pOutdoor->_47F097(v81, v96) ) { - if ( !((a5a + v85) % 2) ) + if ( !((a5a + screenCenter_X) % 2) ) *a4a = i; } else @@ -12763,26 +12732,26 @@ v64 = (signed int)v97 >> 16; ++a5a; } - while ( a5a < v90 ); + while ( a5a < screenCenterY ); } v62 += black; v97 = (const void *)v60; - a4a += v90 - a5a; + a4a += screenCenterY - a5a; v63 = v62 >> 16; - ++v85; - teal = (unsigned int)v78; + ++screenCenter_X; + teal = (unsigned int)pPalette_16; } v65 = v95; - v66 = v75; + v66 = map_texture_16; if ( (signed int)v95 > 0 ) { v67 = v77; - result = 2 * (v79 - v90); + result = 2 * (surfPitch - screenCenterY); do { - if ( v90 > 0 ) - { - v68 = v90; + if ( screenCenterY > 0 ) + { + v68 = screenCenterY; do { v69 = *(short *)v66; @@ -12802,188 +12771,7 @@ } } -//----- (00443219) -------------------------------------------------------- -void ViewingParams::_443219() - { - this->sPartyPosZ += 512; - _4432E7(); -} - -//----- (00443225) -------------------------------------------------------- -void ViewingParams::_443225() - { - this->sPartyPosX -= 512; - _4432E7(); -} - -//----- (00443231) -------------------------------------------------------- -void ViewingParams::_443231() - { - this->sPartyPosZ -= 512; - _4432E7(); -} - -//----- (0044323D) -------------------------------------------------------- -void ViewingParams::_44323D() - { - this->sPartyPosX += 512; - _4432E7(); -} - -//----- (00443249) -------------------------------------------------------- -void ViewingParams::_443249() - { - int v1; // edx@1 - - v1 = (unsigned __int64)((signed __int64)this->field_2C << 15) >> 16; - this->field_2C = v1; - if ( v1 < 384 ) - this->field_2C = 384; - this->sPartyPosX = pParty->vPosition.x; - this->sPartyPosZ = pParty->vPosition.y; - _4432E7(); -} - -//----- (00443291) -------------------------------------------------------- -void ViewingParams::_443291() - { - int v1; // edx@1 - int v2; // eax@1 - - v1 = 2 * this->field_2C; - v2 = 1536; - this->field_2C = v1; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v2 = 3072; - if ( v1 > v2 ) - this->field_2C = v2; - this->sPartyPosX = pParty->vPosition.x; - this->sPartyPosZ = pParty->vPosition.y; - _4432E7(); -} - -//----- (004432E7) -------------------------------------------------------- -void ViewingParams::_4432E7() - { - ViewingParams *v1; // esi@1 - int v2; // ebx@1 - signed int v3; // edx@1 - int v4; // ecx@1 - int v5; // edi@3 - int v6; // eax@3 - int v7; // eax@5 - int result; // eax@7 - - v1 = this; - v2 = this->field_3A; - v3 = 88 >> this->field_2C / 384; - v4 = (44 - v3) << 9; - if ( v1->sPartyPosZ > v2 + v4 ) - v1->sPartyPosZ = v2 + v4; - - v5 = v1->field_38; - v6 = (v3 - 44) << 9; - if ( v1->sPartyPosX < v5 + v6 ) - v1->sPartyPosX = v5 + v6; - - v7 = v2 + v6; - if ( v1->sPartyPosZ < v7 ) - v1->sPartyPosZ = v7; - - result = v5 + v4; - if ( v1->sPartyPosX > v5 + v4 ) - v1->sPartyPosX = result; -} - -//----- (00443343) -------------------------------------------------------- -void ViewingParams::InitGrayPalette() - { - for (unsigned short i=0; i<256; ++i) - pPalette[i]=GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(i, i, i); -} - -//----- (00443365) -------------------------------------------------------- -int ViewingParams::_443365() -{ - ViewingParams *v1; // esi@1 - __int16 *v2; // edi@3 - Vec3_short_ *v3; // eax@4 - unsigned int v4; // edx@4 - signed int v5; // eax@8 - Vec3_short_ *v6; // eax@12 - signed int v7; // edi@12 - signed int v8; // eax@16 - char v9; // zf@20 - int result; // eax@21 - unsigned int v11; // [sp+4h] [bp-1Ch]@3 - unsigned int *v12; // [sp+8h] [bp-18h]@3 - unsigned int v13; // [sp+Ch] [bp-14h]@8 - unsigned int v14; // [sp+10h] [bp-10h]@2 - unsigned int v15; // [sp+14h] [bp-Ch]@2 - unsigned int v16; // [sp+18h] [bp-8h]@2 - unsigned int v17; // [sp+1Ch] [bp-4h]@2 - - v1 = this; - InitGrayPalette(); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - v16 = 0x40000000u; - v14 = 0x40000000u; - v17 = 0xC0000000u; - v15 = 0xC0000000u; - if ( (signed int)pIndoor->pMapOutlines->uNumOutlines > 0 ) - { - v2 = (__int16 *)(pIndoor->pMapOutlines->pOutlines); - v11 = pIndoor->pMapOutlines->uNumOutlines; - v12 = (uint *)pIndoor->pMapOutlines->pOutlines; - do - { - v3 = &pIndoor->pVertices[*v2]; - v4 = v3->x; - if ( (signed int)v4 < (signed int)v16 ) - v16 = v3->x; - if ( (signed int)v4 > (signed int)v17 ) - v17 = v3->x; - v5 = v3->y; - v13 = v5; - if ( v5 < (signed int)v14 ) - v14 = v4; - if ( v5 > (signed int)v15 ) - v15 = v4; - v6 = &pIndoor->pVertices[v2[1]]; - v7 = v6->x; - if ( v7 < (signed int)v16 ) - v16 = v4; - if ( v7 > (signed int)v17 ) - v17 = v4; - v8 = v6->y; - if ( v8 < (signed int)v14 ) - v14 = v13; - if ( v8 > (signed int)v15 ) - v15 = v13; - v2 = (__int16 *)(v12 + 3); - v9 = v11-- == 1; - v12 += 3; - } - while ( !v9 ); - } - v1->uMinimapZoom = 1024; - v1->field_38 = (signed int)(v16 + v17) / 2; - v1->field_28 = 10; - result = (signed int)(v14 + v15) / 2; - v1->field_3A = result; - } - else - { - v1->field_38 = 0; - v1->field_3A = 0; - v1->uMinimapZoom = dword_576E2C; - result = dword_576E28; - v1->field_28 = dword_576E28; - } - v1->field_2C = 384; - return result; -} + //----- (00443801) -------------------------------------------------------- @@ -13573,11 +13361,9 @@ int v1; // ebx@3 int v2; // edi@3 int v3; // eax@3 - int v4; // esi@5 int v5; // edi@6 int v6; // eax@6 int v7; // eax@6 - BSPModel **v8; // ecx@6 unsigned __int8 v9; // zf@7 unsigned __int8 v10; // sf@7 ODMFace *v11; // eax@9 @@ -13589,13 +13375,13 @@ const char *v17; // [sp+4h] [bp-1Ch]@3 unsigned int pY; // [sp+8h] [bp-18h]@3 float v19; // [sp+Ch] [bp-14h]@1 - int v20; // [sp+10h] [bp-10h]@1 + int v20; int v21; // [sp+14h] [bp-Ch]@1 unsigned int v22; // [sp+18h] [bp-8h]@8 int pX; // [sp+1Ch] [bp-4h]@3 - v20 = viewparams->sPartyPosX; - v21 = viewparams->sPartyPosZ; + v20 = viewparams->sViewCenterX; + v21 = viewparams->sViewCenterY; v19 = (double)viewparams->field_2C * 0.000015258789; if ( viewparams->field_2C == 384 ) { @@ -13610,29 +13396,25 @@ LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0); v2 = abs(v1 + 22528) / 512; v3 = abs((signed)LODWORD(v19) - 22528); + result = 0; if ( pOutdoor->_47F04C(v2, v3 / 512) && uCurrentlyLoadedLevelType == LEVEL_Outdoor - && (v4 = 0, v20 = 0, (signed int)v16 > 0) ) - { - while ( 1 ) - { - pX = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.x) - v1; - pY = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.y) - LODWORD(v19); + && (signed int)v16 > 0 ) + { + for(int i = 0; i < pOutdoor->uNumBModels && !v17; i++) + { + pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1; + pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19); v5 = abs((signed)pY); v6 = abs((signed)pX); v7 = int_get_vector_length(v6, v5, 0); - v8 = &pOutdoor->pBModels; - if ( v7 < *(int *)((char *)&pOutdoor->pBModels[v4].sBoundingRadius) ) - { - v9 = pOutdoor->pBModels[v4].uNumFaces == 0; - v10 = pOutdoor->pBModels[v4].uNumFaces < 0; - v21 = 0; - if ( !(v10 | v9) ) - { - v22 = 0; - do - { - v11 = &v8[v4]->pFaces[v22 / 0x134]; + if ( v7 < pOutdoor->pBModels[i].sBoundingRadius ) + { + if ( pOutdoor->pBModels[i].uNumFaces > 0 ) + { + for(int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++) + { + v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134]; v12 = v11->sCogTriggeredID; if ( v12 ) { @@ -13647,26 +13429,11 @@ } } } - ++v21; - v8 = &pOutdoor->pBModels; - v22 += 308; - } - while ( v21 < pOutdoor->pBModels[v4].uNumFaces ); + } } result = v17; - if ( v17 ) - break; - } - ++v20; - v4 += 188; - if ( v20 >= (signed int)v16 ) - goto LABEL_17; - } - } - else - { -LABEL_17: - result = 0; + } + } } return result; }
--- a/mm7_4.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/mm7_4.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -1384,11 +1384,11 @@ v0 = pSpans; stru_80C9D8.pSurf = &stru_80C980; - stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportX; + stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; stru_80C9A4.pSurf = &stru_80C980; stru_80C980.pPrev = &stru_80C980; stru_80C980.pNext = &stru_80C980; - stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportZ; + stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; stru_80C980.field_8 = 0.0; stru_80C980.field_4 = 0.0; stru_80C9D8.pNext = &stru_80C9A4; @@ -1398,16 +1398,16 @@ stru_80C9A4.pPrev = &stru_80C9D8; stru_80C9A4.field_8 = 0; LODWORD(stru_80C980.field_0) = 0xC97423F0u; - v27 = pViewport->uViewportY; - if ( (signed int)pViewport->uViewportY > (signed int)pViewport->uViewportW ) + v27 = pViewport->uViewportTL_Y; + if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) { LABEL_51: v0->field_8 = -1; } else { - v1 = 52 * pViewport->uViewportY; - v24 = 52 * pViewport->uViewportY; + v1 = 52 * pViewport->uViewportTL_Y; + v24 = 52 * pViewport->uViewportTL_Y; while ( 1 ) { v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); @@ -1564,7 +1564,7 @@ ++v27; v1 = v24 + 52; v24 += 52; - if ( (signed int)v27 > (signed int)pViewport->uViewportW ) + if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) goto LABEL_51; } while ( 1 ) @@ -6506,15 +6506,15 @@ v5 = a4; v23 = _z >> 16; z = x + v5; - if ( z >= (signed int)pViewport->uViewportX - && (signed int)x <= (signed int)pViewport->uViewportZ - && y >= (signed int)pViewport->uViewportY - && y <= (signed int)pViewport->uViewportW ) - { - if ( (signed int)x < (signed int)pViewport->uViewportX ) - x = pViewport->uViewportX; - if ( z > (signed int)pViewport->uViewportZ ) - z = pViewport->uViewportZ; + if ( z >= (signed int)pViewport->uViewportTL_X + && (signed int)x <= (signed int)pViewport->uViewportBR_X + && y >= (signed int)pViewport->uViewportTL_Y + && y <= (signed int)pViewport->uViewportBR_Y ) + { + if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) + x = pViewport->uViewportTL_X; + if ( z > (signed int)pViewport->uViewportBR_X ) + z = pViewport->uViewportBR_X; pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; v22 = z - x; pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; @@ -6635,48 +6635,48 @@ { if ( pRenderer->field_40110 ) { - a2.bottom = pViewport->uViewportY; + a2.bottom = pViewport->uViewportTL_Y; a2.left = 0; a2.top = 0; a2.right = 640; ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); a2.right = 640; a2.left = 0; - a2.top = pViewport->uViewportW + 1; + a2.top = pViewport->uViewportBR_Y + 1; a2.bottom = 480; ErrD3D(pRenderer->pBackBuffer4->BltFast( 0, - pViewport->uViewportW + 1, + pViewport->uViewportBR_Y + 1, pRenderer->pColorKeySurface4, &a2, 16u)); - a2.right = pViewport->uViewportX; - a2.bottom = pViewport->uViewportW + 1; + a2.right = pViewport->uViewportTL_X; + a2.bottom = pViewport->uViewportBR_Y + 1; a2.left = 0; - a2.top = pViewport->uViewportY; + a2.top = pViewport->uViewportTL_Y; ErrD3D(pRenderer->pBackBuffer4->BltFast( 0, - pViewport->uViewportY, + pViewport->uViewportTL_Y, pRenderer->pColorKeySurface4, &a2, 16u)); - a2.left = pViewport->uViewportZ; - a2.top = pViewport->uViewportY; + a2.left = pViewport->uViewportBR_X; + a2.top = pViewport->uViewportTL_Y; a2.right = 640; - a2.bottom = pViewport->uViewportW + 1; + a2.bottom = pViewport->uViewportBR_Y + 1; ErrD3D(pRenderer->pBackBuffer4->BltFast( - pViewport->uViewportZ, - pViewport->uViewportY, + pViewport->uViewportBR_X, + pViewport->uViewportTL_Y, pRenderer->pColorKeySurface4, &a2, 16u)); - a2.right = pViewport->uViewportZ; - a2.bottom = pViewport->uViewportW + 1; - a2.left = pViewport->uViewportX; - a2.top = pViewport->uViewportY; + a2.right = pViewport->uViewportBR_X; + a2.bottom = pViewport->uViewportBR_Y + 1; + a2.left = pViewport->uViewportTL_X; + a2.top = pViewport->uViewportTL_Y; ErrD3D(pRenderer->pBackBuffer4->BltFast( - pViewport->uViewportX, - pViewport->uViewportY, + pViewport->uViewportTL_X, + pViewport->uViewportTL_Y, pRenderer->pColorKeySurface4, &a2, 17u)); @@ -6760,11 +6760,11 @@ pSrc + y * 640, 640 * sizeof(__int16)); - auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportY + pViewport->uViewportX; + auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; - auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportY + pViewport->uViewportX; + auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); - v9 = ((signed int)pViewport->uViewportX >> 1) - ((signed int)pViewport->uViewportZ >> 1); + v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); v22 = 4 * ((Dst.lPitch / 4) + v9); v21 = 4 * v9 + 1280; @@ -6773,14 +6773,14 @@ //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); v10 = (int)pSrc_x1y1; v11 = (int)pDst_x1y1; - auto uHalfWidth = v20 = (pViewport->uViewportZ - pViewport->uViewportX) / 2; + auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; v13 = v24; - for (uint y = pViewport->uViewportY; y < pViewport->uViewportW + 1; ++y) + for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) { //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); - for (uint x = pViewport->uViewportX; x < pViewport->uViewportZ; ++x) + for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) { if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; @@ -10707,7 +10707,7 @@ else { for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) - GUIButton::_41D0D8((GUIButton *)HouseNPCData[i + 7]); + ((GUIButton *)HouseNPCData[i + 7])->Release(); } pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton( 471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0,
--- a/mm7_5.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/mm7_5.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -963,8 +963,8 @@ if ( pCurrentScreen ) pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); - viewparams->sPartyPosX = pParty->vPosition.x; - viewparams->sPartyPosZ = pParty->vPosition.y; + viewparams->sViewCenterX = pParty->vPosition.x; + viewparams->sViewCenterY = pParty->vPosition.y; pAudioPlayer->StopChannels(-1, -1); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); pBooksWindow = GUIWindow::Create(546, 353, 0, 0, (enum WindowType)99, (int)pBtn_Maps, 0); @@ -3049,8 +3049,8 @@ continue; case UIMSG_55: bRingsShownInCharScreen ^= v0; - GUIButton::_41D0D8(pCharacterScreen_DetalizBtn); - GUIButton::_41D0D8(pCharacterScreen_DollBtn); + pCharacterScreen_DetalizBtn->Release(); + pCharacterScreen_DollBtn->Release(); if ( bRingsShownInCharScreen ) { v128 = (uTextureID_5118C8 != -1 ? pIcons_LOD->pTextures[uTextureID_5118C8].uTextureHeight : 26); @@ -13409,8 +13409,8 @@ { v7 = v0->lastOpenedSpellbookPage; // v7 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]); - v19 = pViewport->uViewportY + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos; - v17 = pViewport->uViewportX + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos; + v19 = pViewport->uViewportTL_Y + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Ypos; + v17 = pViewport->uViewportTL_X + pIconPos[v7][pSpellbookSpellIndices[v7][v4]].Xpos; if ( BYTE1(v6->pBits) & 2 ) pRenderer->DrawTextureTransparent(v17, v19, v6); else @@ -13434,8 +13434,8 @@ v21 = dword_5063D8[v10]; v12 = v0->lastOpenedSpellbookPage; // v12 = (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]); - v20 = pViewport->uViewportY + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos; - v18 = pViewport->uViewportX + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos; + v20 = pViewport->uViewportTL_Y + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Ypos; + v18 = pViewport->uViewportTL_X + pIconPos[v12][pSpellbookSpellIndices[v12][v10]].Xpos; if ( BYTE1(v11->pBits) & 2 ) pRenderer->DrawTextureTransparent(v18, v20, v21); else @@ -13570,31 +13570,31 @@ Texture *v14; // [sp-4h] [bp-60h]@7 GUIWindow a1; // [sp+8h] [bp-54h]@10 - pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pSpellBookPagesTextr_11); + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11); if ( dword_506548 || !dword_506528 ) { v13 = pTex_tab_an_6a__zoom_off; - v11 = pViewport->uViewportY + 2; - v0 = pViewport->uViewportX + 407; + v11 = pViewport->uViewportTL_Y + 2; + v0 = pViewport->uViewportTL_X + 407; } else { v13 = pTex_tab_an_6b__zoom_on; - v11 = pViewport->uViewportY + 1; - v0 = pViewport->uViewportX + 398; + v11 = pViewport->uViewportTL_Y + 1; + v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v11, v13); if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) { v14 = pTex_tab_an_7a__zoot_off; - v12 = pViewport->uViewportY + 38; - v1 = pViewport->uViewportX + 407; + v12 = pViewport->uViewportTL_Y + 38; + v1 = pViewport->uViewportTL_X + 407; } else { v14 = pTex_tab_an_7b__zoot_on; - v12 = pViewport->uViewportY + 38; - v1 = pViewport->uViewportX + 398; + v12 = pViewport->uViewportTL_Y + 38; + v1 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v1, v12, v14); if ( !byte_5C6D50[dword_506528] ) @@ -13676,31 +13676,31 @@ Texture *v11; // [sp-4h] [bp-64h]@7 GUIWindow a1; // [sp+Ch] [bp-54h]@9 - pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pTexture_CurrentBook); + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); if ( dword_506548 || !dword_506528 ) { v10 = pTex_tab_an_6a__zoom_off; - v8 = pViewport->uViewportY + 2; - v0 = pViewport->uViewportX + 407; + v8 = pViewport->uViewportTL_Y + 2; + v0 = pViewport->uViewportTL_X + 407; } else { v10 = pTex_tab_an_6b__zoom_on; - v8 = pViewport->uViewportY + 1; - v0 = pViewport->uViewportX + 398; + v8 = pViewport->uViewportTL_Y + 1; + v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v8, v10); if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) { v11 = pTex_tab_an_7a__zoot_off; - v9 = pViewport->uViewportY + 38; - v1 = pViewport->uViewportX + 407; + v9 = pViewport->uViewportTL_Y + 38; + v1 = pViewport->uViewportTL_X + 407; } else { v11 = pTex_tab_an_7b__zoot_on; - v9 = pViewport->uViewportY + 38; - v1 = pViewport->uViewportX + 398; + v9 = pViewport->uViewportTL_Y + 38; + v1 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v1, v9, v11); a1.uFrameWidth = 460; @@ -13794,31 +13794,31 @@ GUIWindow a1; // [sp+14h] [bp-54h]@46 v31 = 0; - pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pTexture_AutonotesBook); + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); if ( dword_506548 || !dword_506528 ) { v24 = pTex_tab_an_6a__zoom_off; - v17 = pViewport->uViewportY + 2; - v0 = pViewport->uViewportX + 407; + v17 = pViewport->uViewportTL_Y + 2; + v0 = pViewport->uViewportTL_X + 407; } else { v24 = pTex_tab_an_6b__zoom_on; - v17 = pViewport->uViewportY + 1; - v0 = pViewport->uViewportX + 398; + v17 = pViewport->uViewportTL_Y + 1; + v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v17, v24); if ( dword_506544 || dword_506528 + awards_count >= awards_count2 ) { v25 = pTex_tab_an_7a__zoot_off; - v18 = pViewport->uViewportY + 38; - v1 = pViewport->uViewportX + 407; + v18 = pViewport->uViewportTL_Y + 38; + v1 = pViewport->uViewportTL_X + 407; } else { v25 = pTex_tab_an_7b__zoot_on; - v18 = pViewport->uViewportY + 38; - v1 = pViewport->uViewportX + 398; + v18 = pViewport->uViewportTL_Y + 38; + v1 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v1, v18, v25); if ( !dword_506540 ) @@ -13826,8 +13826,8 @@ if ( dword_506568 ) { pRenderer->DrawTextureTransparent( - pViewport->uViewportX + 408, - pViewport->uViewportY + 113, + pViewport->uViewportTL_X + 408, + pViewport->uViewportTL_Y + 113, pTexture_506390); v2 = 1; goto LABEL_16; @@ -13845,7 +13845,7 @@ pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); LABEL_15: dword_506568 = 0; - pRenderer->DrawTextureTransparent(pViewport->uViewportX + 398, pViewport->uViewportY + 113, pTexture_506394); + pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); LABEL_16: if ( dword_50653C ) { @@ -13860,15 +13860,15 @@ if ( dword_506568 != v2 ) { v26 = pTexture_506388; - v19 = pViewport->uViewportY + 150; - v3 = pViewport->uViewportX + 408; + v19 = pViewport->uViewportTL_Y + 150; + v3 = pViewport->uViewportTL_X + 408; goto LABEL_22; } } v26 = pTexture_50638C; dword_506568 = v2; - v19 = pViewport->uViewportY + 150; - v3 = pViewport->uViewportX + 399; + v19 = pViewport->uViewportTL_Y + 150; + v3 = pViewport->uViewportTL_X + 399; LABEL_22: pRenderer->DrawTextureTransparent(v3, v19, v26); if ( dword_506538 ) @@ -13884,15 +13884,15 @@ if ( dword_506568 != 2 ) { v27 = pTexture_506380; - v20 = pViewport->uViewportY + 188; - v4 = pViewport->uViewportX + 408; + v20 = pViewport->uViewportTL_Y + 188; + v4 = pViewport->uViewportTL_X + 408; goto LABEL_28; } } v27 = pTexture_506384; dword_506568 = 2; - v20 = pViewport->uViewportY + 188; - v4 = pViewport->uViewportX + 397; + v20 = pViewport->uViewportTL_Y + 188; + v4 = pViewport->uViewportTL_X + 397; LABEL_28: pRenderer->DrawTextureTransparent(v4, v20, v27); if ( dword_506534 ) @@ -13908,15 +13908,15 @@ if ( dword_506568 != 3 ) { v28 = pTexture_506378; - v21 = pViewport->uViewportY + 226; - v5 = pViewport->uViewportX + 408; + v21 = pViewport->uViewportTL_Y + 226; + v5 = pViewport->uViewportTL_X + 408; goto LABEL_34; } } v28 = pTexture_50637C; dword_506568 = 3; - v21 = pViewport->uViewportY + 226; - v5 = pViewport->uViewportX + 397; + v21 = pViewport->uViewportTL_Y + 226; + v5 = pViewport->uViewportTL_X + 397; LABEL_34: pRenderer->DrawTextureTransparent(v5, v21, v28); if ( dword_506530 ) @@ -13932,15 +13932,15 @@ if ( dword_506568 != 4 ) { v29 = pTexture_506370; - v22 = pViewport->uViewportY + 263; - v6 = pViewport->uViewportX + 408; + v22 = pViewport->uViewportTL_Y + 263; + v6 = pViewport->uViewportTL_X + 408; goto LABEL_40; } } v29 = pTexture_506374; dword_506568 = 4; - v22 = pViewport->uViewportY + 264; - v6 = pViewport->uViewportX + 397; + v22 = pViewport->uViewportTL_Y + 264; + v6 = pViewport->uViewportTL_X + 397; LABEL_40: pRenderer->DrawTextureTransparent(v6, v22, v29); if ( dword_50652C ) @@ -13956,15 +13956,15 @@ if ( dword_506568 != 5 ) { v30 = pTexture_506368; - v23 = pViewport->uViewportY + 302; - v7 = pViewport->uViewportX + 408; + v23 = pViewport->uViewportTL_Y + 302; + v7 = pViewport->uViewportTL_X + 408; goto LABEL_46; } } v30 = pTexture_50636C; dword_506568 = 5; - v23 = pViewport->uViewportY + 302; - v7 = pViewport->uViewportX + 397; + v23 = pViewport->uViewportTL_Y + 302; + v7 = pViewport->uViewportTL_X + 397; LABEL_46: pRenderer->DrawTextureTransparent(v7, v23, v30); a1.uFrameWidth = 460; @@ -14073,89 +14073,89 @@ GUIWindow map_window; // [sp+84h] [bp-54h]@35 unsigned int textrX, textrY; - pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pSpellBookPagesTextr_12); + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); if ( dword_506548 || viewparams->field_2C / 128 >= 12 ) { buttnTxtr = pTex_tab_an_6a__zoom_off; - textrY = pViewport->uViewportY + 2; - textrX = pViewport->uViewportX + 408; + textrY = pViewport->uViewportTL_Y + 2; + textrX = pViewport->uViewportTL_X + 408; } else { buttnTxtr = pTex_tab_an_6b__zoom_on; - textrY = pViewport->uViewportY + 1; - textrX = pViewport->uViewportX + 398; + textrY = pViewport->uViewportTL_Y + 1; + textrX = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); if ( dword_506544 || viewparams->field_2C / 128 <= 3 ) { buttnTxtr = pTex_tab_an_7a__zoot_off; - textrY = pViewport->uViewportY + 38; - textrX = pViewport->uViewportX + 408; + textrY = pViewport->uViewportTL_Y + 38; + textrX = pViewport->uViewportTL_X + 408; } else { buttnTxtr = pTex_tab_an_7b__zoot_on; - textrY = pViewport->uViewportY + 38; - textrX = pViewport->uViewportX + 398; + textrY = pViewport->uViewportTL_Y + 38; + textrX = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); if ( dword_506540 ) { buttnTxtr = pTexture_506390; - textrY = pViewport->uViewportY + 113; - textrX = pViewport->uViewportX + 408; + textrY = pViewport->uViewportTL_Y + 113; + textrX = pViewport->uViewportTL_X + 408; } else { buttnTxtr = pTexture_506394; - textrY = pViewport->uViewportY + 113; - textrX = pViewport->uViewportX + 398; + textrY = pViewport->uViewportTL_Y + 113; + textrX = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); if ( dword_50653C ) { buttnTxtr = pTexture_506388; - textrY = pViewport->uViewportX + 150; - textrX = pViewport->uViewportY + 408; + textrY = pViewport->uViewportTL_X + 150; + textrX = pViewport->uViewportTL_Y + 408; } else { buttnTxtr = pTexture_50638C; - textrY = pViewport->uViewportX + 150; - textrX = pViewport->uViewportY + 399; + textrY = pViewport->uViewportTL_X + 150; + textrX = pViewport->uViewportTL_Y + 399; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); if ( dword_506538 ) { buttnTxtr = pTexture_506380; - textrY = pViewport->uViewportY + 188; - textrX = pViewport->uViewportX + 408; + textrY = pViewport->uViewportTL_Y + 188; + textrX = pViewport->uViewportTL_X + 408; } else { buttnTxtr = pTexture_506384; - textrY = pViewport->uViewportY + 188; - textrX = pViewport->uViewportX + 397; + textrY = pViewport->uViewportTL_Y + 188; + textrX = pViewport->uViewportTL_X + 397; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); if ( dword_506534 ) { buttnTxtr = pTexture_506378; - textrY = pViewport->uViewportY + 226; - textrX = pViewport->uViewportX + 408; + textrY = pViewport->uViewportTL_Y + 226; + textrX = pViewport->uViewportTL_X + 408; } else { buttnTxtr = pTexture_50637C; - textrY = pViewport->uViewportY + 226; - textrX = pViewport->uViewportX + 397; + textrY = pViewport->uViewportTL_Y + 226; + textrX = pViewport->uViewportTL_X + 397; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); if ( dword_506544 ) - viewparams->_443291(); + viewparams->CenterOnParty2(); if ( dword_506548 ) - viewparams->_443249(); + viewparams->CenterOnParty(); if ( dword_506540 ) viewparams->_443219(); if ( dword_50653C ) @@ -14253,7 +14253,7 @@ v0 = pParty->uCurrentHour; v6 = pMapStats->GetMapInfo(pCurrentMapName); a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x4Bu, 0x4Bu, 0x4Bu); - pRenderer->DrawTextureIndexed(pViewport->uViewportX, pViewport->uViewportY, pSpellBookPagesTextr_13); + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); v7 = (unsigned __int8)pDayMoonPhase[pParty->uDaysPlayed]; if ( (signed int)v0 <= 12 ) { @@ -15053,8 +15053,8 @@ case WINDOW_3: { pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0);//pWindowType == 3 (0x3) - pY = pViewport->uViewportY; - pX = pViewport->uViewportX; + pY = pViewport->uViewportTL_Y; + pX = pViewport->uViewportTL_X; pRenderer->DrawTextureIndexed(pX, pY, pTexture); viewparams->bRedrawGameUI = 1; break; @@ -15959,7 +15959,7 @@ if (GetCurrentMenuID() > 0) break; - if ( (signed int)pY > (signed int)pViewport->uViewportW ) + if ( (signed int)pY > (signed int)pViewport->uViewportBR_Y ) { pWindow.ptr_1C = (void *)((signed int)pX / 118); if ( (signed int)pX / 118 < 4 ) @@ -15973,7 +15973,7 @@ pWindow.DrawQuickCharRecord(); } } - else if ( (signed int)pX > (signed int)pViewport->uViewportZ ) + else if ( (signed int)pX > (signed int)pViewport->uViewportBR_X ) { if ( (signed int)pY >= 130 ) { @@ -16061,10 +16061,10 @@ case SCREEN_BOOKS: { if ( !dword_506364 - || (signed int)pX < (signed int)pViewport->uViewportX - || (signed int)pX > (signed int)pViewport->uViewportZ - || (signed int)pY < (signed int)pViewport->uViewportY - || (signed int)pY > (signed int)pViewport->uViewportW + || (signed int)pX < (signed int)pViewport->uViewportTL_X + || (signed int)pX > (signed int)pViewport->uViewportBR_X + || (signed int)pY < (signed int)pViewport->uViewportTL_Y + || (signed int)pY > (signed int)pViewport->uViewportBR_Y || (v2 = (char *)sub_444564(), (pWindow.Hint = v2) == 0) ) break; v30 = (double)(pFontArrus->GetLineWidth(v2) + 32); @@ -16255,8 +16255,8 @@ v4 = GetCurrentMenuID(); x = pX; if ( (v4 & 0x80000000u) == 0 - || (signed int)pX < (signed int)pViewport->uViewportX - || (signed int)pX > (signed int)pViewport->uViewportZ ) + || (signed int)pX < (signed int)pViewport->uViewportTL_X + || (signed int)pX > (signed int)pViewport->uViewportBR_X ) { y = pY; LABEL_30: @@ -16311,7 +16311,7 @@ goto LABEL_45; } y = pY; - if ( (signed int)pY < (signed int)pViewport->uViewportY || (signed int)pY > (signed int)pViewport->uViewportW ) + if ( (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y ) goto LABEL_30; if ( pRenderer->pRenderD3D ) v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); @@ -17447,9 +17447,9 @@ if ( dword_507CBC ) { dword_507CBC = 0; - GUIButton::_41D0D8(ptr_507BA4); - GUIButton::_41D0D8(pBtn_Up); - GUIButton::_41D0D8(pBtn_Down); + ptr_507BA4->Release(); + pBtn_Up->Release(); + pBtn_Down->Release(); pBtn_Down = 0; pBtn_Up = 0; for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext )
--- a/mm7_6.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/mm7_6.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -684,12 +684,12 @@ char *v139; // [sp+D4h] [bp-4h]@48 char *v140; // [sp+D4h] [bp-4h]@65 - v101 = (double)(signed int)pViewport->uViewportX; - v100 = (double)(signed int)pViewport->uViewportZ; + v101 = (double)(signed int)pViewport->uViewportTL_X; + v100 = (double)(signed int)pViewport->uViewportBR_X; v117 = a1; v136 = 1; - v104 = (double)(signed int)pViewport->uViewportY; - v102 = (double)(pViewport->uViewportW + 1); + v104 = (double)(signed int)pViewport->uViewportTL_Y; + v102 = (double)(pViewport->uViewportBR_Y + 1); if ( a1 <= 0 ) return v117; v127 = a1; @@ -711,7 +711,7 @@ v110 = 0; memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; - v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportX; + v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; if ( v117 < 1 ) goto LABEL_112; v6 = (char *)&array_50A2B0[0].vWorldViewProjY; @@ -724,11 +724,11 @@ do { v103 = *((float *)v7 + 7) + 6.7553994e15; - v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportX; + v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; if ( !(v5 ^ v106) ) goto LABEL_25; v8 = v101; - if ( SLODWORD(v103) >= (signed int)pViewport->uViewportX ) + if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) { v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); @@ -802,7 +802,7 @@ || (v115 = 0, memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, - v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportZ, + v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, v110 < 1) ) goto LABEL_112; v25 = (char *)&array_509950[0]._rhw; @@ -817,12 +817,12 @@ while ( 2 ) { v97 = *((float *)v26 + 7) + 6.7553994e15; - v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportZ; - v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportZ; + v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; + v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; if ( v24 != v27 ) { v28 = v100; - if ( SLODWORD(v97) <= (signed int)pViewport->uViewportZ ) + if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) { v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); @@ -899,7 +899,7 @@ || (v123 = 0, memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, - v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportY, + v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, v115 < 1) ) goto LABEL_112; v44 = (char *)&array_508FF0[0].vWorldViewProjX; @@ -913,12 +913,12 @@ while ( 2 ) { v98 = *((float *)v45 + 8) + 6.7553994e15; - v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportY; - v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportY; + v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; + v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; if ( v43 != v46 ) { v47 = v104; - if ( SLODWORD(v98) >= (signed int)pViewport->uViewportY ) + if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) { v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); @@ -990,7 +990,7 @@ || (v116 = 0, memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, - v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportW, + v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, v123 < 1) ) goto LABEL_112; v63 = (char *)&array_508690[0].vWorldViewProjX; @@ -1004,12 +1004,12 @@ while ( 2 ) { v99 = *((float *)v64 + 8) + 6.7553994e15; - v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportW; - v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportW; + v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; + v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; if ( v62 != v65 ) { v66 = v102; - if ( SLODWORD(v99) <= (signed int)pViewport->uViewportW ) + if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) { v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); @@ -1090,10 +1090,10 @@ LODWORD(v83) = *(int *)v81; *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); v84 = v83 + 6.7553994e15; - if ( SLODWORD(v84) <= (signed int)pViewport->uViewportZ ) + if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) { v86 = *(float *)v81 + 6.7553994e15; - if ( SLODWORD(v86) >= (signed int)pViewport->uViewportX ) + if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) goto LABEL_88; v85 = v101; } @@ -1104,7 +1104,7 @@ *(int *)v81 = LODWORD(v85); LABEL_88: v87 = *((float *)v81 + 1) + 6.7553994e15; - if ( SLODWORD(v87) > (signed int)pViewport->uViewportW ) + if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) { v88 = v102; LABEL_92: @@ -1112,7 +1112,7 @@ goto LABEL_93; } v89 = *((float *)v81 + 1) + 6.7553994e15; - if ( SLODWORD(v89) < (signed int)pViewport->uViewportY ) + if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) { v88 = v104; goto LABEL_92; @@ -7897,13 +7897,13 @@ v30 = 0; if ( pRenderer->pActiveZBuffer ) { - v29 = viewparams->uScreenX; - v23 = viewparams->uScreenZ; - if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW ) + v29 = viewparams->uScreen_topL_X; + v23 = viewparams->uScreen_BttmR_X; + if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) { - v25 = viewparams->uScreenW - viewparams->uScreenY; - v9 = &pRenderer->pActiveZBuffer[viewparams->uScreenX + 640 * viewparams->uScreenY]; - v26 = &pRenderer->pActiveZBuffer[viewparams->uScreenX + 640 * viewparams->uScreenY]; + v25 = viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y; + v9 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; + v26 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; do { if ( (signed int)v29 < (signed int)v23 )
--- a/mm7_data.h Mon Mar 18 01:50:50 2013 +0600 +++ b/mm7_data.h Mon Mar 18 01:51:31 2013 +0600 @@ -1998,7 +1998,7 @@ void GameUI_DrawPartySpells(); __int16 __fastcall sub_441A4E(int a1); void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap); -void DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb +void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb void Initialize2DA(); void LoadLevel_InitializeLevelStr(); @@ -2073,10 +2073,7 @@ // int __cdecl crt_452B74(); int __cdecl j_SetSomeItemsNames(); -unsigned int __fastcall ParseSpellType(struct FrameTableTxtLine *, int a2); -int __thiscall ParseAttackType(unsigned __int8 *_this); -char __fastcall ParseDamage(const char *Str, int a2, int a3, int a4); -int __fastcall ParseMissleAttackType(const char *Str1); + unsigned int __fastcall SkillToMastery(unsigned __int16 a1); unsigned int __fastcall GetSpellColor(signed int a1); void *__thiscall unknown_vdtor_6(void *_this, bool a2);
--- a/stru6.cpp Mon Mar 18 01:50:50 2013 +0600 +++ b/stru6.cpp Mon Mar 18 01:51:31 2013 +0600 @@ -1456,22 +1456,22 @@ uAnimLength -= pEventTimer->uTimeElapsed; if ( pRenderer->pRenderD3D ) { - v12 = (double)(signed int)pViewport->uViewportX; + v12 = (double)(signed int)pViewport->uViewportTL_X; vd3d[0].pos.x = v12; vd3d[1].pos.x = v12; - v13 = (double)(signed int)pViewport->uViewportZ; - v26 = pViewport->uViewportW + 1; + v13 = (double)(signed int)pViewport->uViewportBR_X; + v26 = pViewport->uViewportBR_Y + 1; vd3d[0].diffuse = 0x7F7F7Fu; vd3d[1].diffuse = 0x7F7F7Fu; vd3d[2].pos.x = v13; vd3d[3].pos.x = v13; - v14 = (double)(signed int)pViewport->uViewportY; + v14 = (double)(signed int)pViewport->uViewportTL_Y; vd3d[2].diffuse = 0x7F7F7Fu; vd3d[3].diffuse = 0x7F7F7Fu; vd3d[0].specular = 0; vd3d[1].specular = 0; vd3d[0].pos.y = v14; - v15 = (double)(pViewport->uViewportW + 1); + v15 = (double)(pViewport->uViewportBR_Y + 1); vd3d[2].specular = 0; vd3d[3].specular = 0; vd3d[1].pos.y = v15; @@ -1521,24 +1521,24 @@ vsr.pTarget = pRenderer->pTargetSurface; vsr.uParentBillboardID = -1; vsr.pTargetZ = pRenderer->pActiveZBuffer; - vsr.uScreenSpaceX = (signed int)(pViewport->uViewportZ - pViewport->uViewportX) / 2; - vsr.uScreenSpaceY = pViewport->uViewportW; + vsr.uScreenSpaceX = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; + vsr.uScreenSpaceY = pViewport->uViewportBR_Y; v24 = 16777216; LODWORD(v18) = 0; - HIDWORD(v18) = (signed __int16)(LOWORD(pViewport->uViewportZ) - LOWORD(pViewport->uViewportX)); + HIDWORD(v18) = (signed __int16)(LOWORD(pViewport->uViewportBR_X) - LOWORD(pViewport->uViewportTL_X)); vsr._screenspace_x_scaler_packedfloat = v18 / 0x1000000; LODWORD(v18) = 0; - HIDWORD(v18) = (signed __int16)(LOWORD(pViewport->uViewportW) - LOWORD(pViewport->uViewportY)); + HIDWORD(v18) = (signed __int16)(LOWORD(pViewport->uViewportBR_Y) - LOWORD(pViewport->uViewportTL_Y)); v26 = v18 / 16777216; vsr._screenspace_y_scaler_packedfloat = v18 / 0x1000000; vsr.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v70->uPaletteIndex, 0, 1); vsr.uTargetPitch = pRenderer->uTargetSurfacePitch; vsr.uParentBillboardID = -1; - vsr.uViewportX = pViewport->uViewportX; - vsr.uViewportZ = pViewport->uViewportZ; - vsr.uViewportY = pViewport->uViewportY; + vsr.uViewportX = pViewport->uViewportTL_X; + vsr.uViewportZ = pViewport->uViewportBR_X; + vsr.uViewportY = pViewport->uViewportTL_Y; vsr.sZValue = 0; - vsr.uViewportW = pViewport->uViewportW; + vsr.uViewportW = pViewport->uViewportBR_Y; vsr.uFlags = 0; if ( v11 >= 0 ) pSprites_LOD->pSpriteHeaders[v11]._4ACC38(&vsr, 1);