Mercurial > might-and-magic-trilogy
changeset 2:2ca04ccb612a
NoCD, main menu, various
author | Nomad |
---|---|
date | Wed, 10 Oct 2012 14:21:15 +0200 |
parents | ac0fb48cd27a |
children | 540178ef9b18 1ac6c35cf106 |
files | Actor.cpp Arcomage.cpp AudioPlayer.cpp AudioPlayer.h CShow.h DecalBuilder.cpp GUIProgressBar.cpp GUIWindow.cpp GUIWindow.h Game.cpp Indoor.cpp IndoorCamera.h IndoorCameraD3D.cpp LOD.cpp LOD.h LightmapBuilder.cpp Mouse.cpp NPC.h Player.cpp Render.cpp Render.h Texture.h VideoPlayer.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp mm7_data.h |
diffstat | 31 files changed, 1277 insertions(+), 1253 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/Actor.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -237,7 +237,7 @@ LABEL_17: if ( (uDialogue_SpeakingActorNPC_ID & 0x80000000u) != 0 ) v9 = 4; - v11 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)10, v9, 0); + v11 = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)10, v9, 0); pDialogueWindow = v11; if ( v5->uFlags & 0x80 ) {
--- a/Arcomage.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/Arcomage.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -225,7 +225,7 @@ TranslateMessage(&pArcomageGame->msg); DispatchMessageA(&pArcomageGame->msg); } - if ( pAsyncMouse ) + if (pAsyncMouse) { EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); v4 = *((unsigned int *)pAsyncMouse + 7); @@ -1381,7 +1381,7 @@ ++v3; } while ( (signed int)v3 < (signed int)&unk_5052C8 ); - if ( pAsyncMouse ) + if (pAsyncMouse) { pAsyncMouse->_409E3D(*((unsigned char *)pAsyncMouse + 103)); pAsyncMouse->_46B944(); @@ -5714,7 +5714,7 @@ int pXY[2]; // [sp+18h] [bp-Ch]@5 int v10; // [sp+20h] [bp-4h]@3 - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_409E3D(1); pAudioPlayer->StopChannels(-1, -1); strcpy(pArcomageGame->pPlayer1Name, pArcomagePlayer1Name);
--- a/AudioPlayer.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/AudioPlayer.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -76,7 +76,7 @@ v2 = 1; while ( 1 ) { - if ( v1->pSounds[v2].uType != 1 + if ( v1->pSounds[v2].eType != SOUND_DESC_SYSTEM || (sprintf(pSoundName, "%s", pSounds[v2].pSoundName), v1->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (char *)0xFFFFFFFF, pSounds[v2].uSoundID), !pAudioPlayer->b3DSoundInitialized) @@ -367,8 +367,8 @@ for ( i = 0; i < (signed int)v2->uNumSounds; ++v3 ) { v5 = &v2->pSounds[v3]; - v6 = v5->uType; - if ( v6 != 1 && (a2 || v6 != 4) ) + v6 = v5->eType; + if ( v6 != SOUND_DESC_SYSTEM && (a2 || v6 != SOUND_DESC_LOCK) ) { v7 = v5->pSoundData[0]; if ( v7 ) @@ -386,32 +386,32 @@ void SoundList::_4A9DCD(unsigned int uSoundID, char a3) { unsigned int v3; // esi@1 - SoundList *v4; // edi@1 + //SoundList *v4; // edi@1 SoundDesc *v5; // eax@1 void *v6; // ecx@8 v3 = uSoundID; - v4 = this; + //v4 = this; v5 = &this->pSounds[uSoundID]; - if ( v5->uType != 1 ) + if ( v5->eType != SOUND_DESC_SYSTEM ) { if ( v5->uFlags & 2 && v5->p3DSound && a3 ) { if ( LOBYTE(v5->bDecompressed) ) AIL_mem_free_lock(v5->p3DSound); - v4->pSounds[v3].p3DSound = 0; - v4->pSounds[v3].uFlags &= 0xFFFFFFFEu; + pSounds[v3].p3DSound = 0; + pSounds[v3].uFlags &= 0xFFFFFFFEu; } - v6 = v4->pSounds[v3].pSoundData[0]; + v6 = pSounds[v3].pSoundData[0]; if ( v6 ) { ReleaseSoundData(v6); - v4->pSounds[v3].pSoundData[0] = 0; - v4->pSounds[v3].uFlags &= 0xFFFFFFFEu; + pSounds[v3].pSoundData[0] = 0; + pSounds[v3].uFlags &= 0xFFFFFFFEu; } } } -// 4D830C: using guessed type int __stdcall AIL_mem_free_lock(int); + //----- (004A9E3D) -------------------------------------------------------- void SoundList::ToFile() @@ -513,18 +513,18 @@ v13 = v11 == 0; v14 = v2->uNumSounds; if ( v13 ) - v12[v14].uType = SOUND_DESC_LOCK; + v12[v14].eType = SOUND_DESC_LOCK; else - v12[v14].uType = SOUND_DESC_LEVEL; + v12[v14].eType = SOUND_DESC_LEVEL; } else { - v2->pSounds[v2->uNumSounds].uType = SOUND_DESC_SWAP; + v2->pSounds[v2->uNumSounds].eType = SOUND_DESC_SWAP; } } else { - v2->pSounds[v2->uNumSounds].uType = SOUND_DESC_SYSTEM; + v2->pSounds[v2->uNumSounds].eType = SOUND_DESC_SYSTEM; } if ( v19.field_0 >= 4 && !_strcmpi(v19.pProperties[3], "3D") ) { @@ -850,7 +850,7 @@ v71 = &pSoundList->pSounds[v92]; if ( !v71->pSoundData[0] ) { - if ( v71->uType == 2 ) + if (v71->eType == SOUND_DESC_SWAP) pSoundList->_4A9A67(eSoundID, 0); } } @@ -1775,32 +1775,32 @@ //----- (004AB71F) -------------------------------------------------------- void AudioPlayer::StopChannels(int uStartChannel, int uEndChannel) { - AudioPlayer *v3; // esi@1 + //AudioPlayer *v3; // esi@1 int v4; // ecx@1 char *v5; // edi@4 int v6; // ebx@12 MixerChannel *pChannel; // edi@14 - _STREAM *v8; // esi@23 + //_STREAM *v8; // esi@23 int v9; // [sp+4h] [bp-4h]@3 - v3 = this; + //v3 = this; v4 = 0; - if ( v3->bPlayerReady ) + if ( bPlayerReady ) { - if ( v3->b3DSoundInitialized ) + if ( b3DSoundInitialized ) { v9 = 0; - if ( v3->uNum3DSamples > 0 ) + if ( uNum3DSamples > 0 ) { - v5 = (char *)&v3->p3DSamples[0].field_8; + v5 = (char *)&p3DSamples[0].field_8; do { if ( (uStartChannel == -1 || v4 < uStartChannel || v4 > uEndChannel) && *(int *)v5 - && pSoundList->pSounds[*(int *)v5].uType != 1 ) + && pSoundList->pSounds[*(int *)v5].eType != SOUND_DESC_SYSTEM) { AIL_end_3D_sample(*((int **)v5 - 2)); - v3->_4ABF23((AudioPlayer_3DSample *)(v5 - 8)); + _4ABF23((AudioPlayer_3DSample *)(v5 - 8)); *((int *)v5 - 1) = 0; v4 = v9; } @@ -1808,32 +1808,32 @@ v5 += 16; v9 = v4; } - while ( v4 < v3->uNum3DSamples ); + while ( v4 < uNum3DSamples ); } } v6 = 0; - if ( v3->hDigDriver && v3->uMixerChannels > 0 ) + if ( hDigDriver && uMixerChannels > 0 ) { - pChannel = v3->pMixerChannels; + pChannel = pMixerChannels; do { if ( (uStartChannel == -1 || v6 < uStartChannel || v6 > uEndChannel) - && pSoundList->pSounds[pChannel->uSourceTrackIdx].uType != 1 ) + && pSoundList->pSounds[pChannel->uSourceTrackIdx].eType != SOUND_DESC_SYSTEM) { AIL_end_sample(pChannel->hSample); - v3->_4ABE55(pChannel); + _4ABE55(pChannel); pChannel->dword_000004 = 0; } ++v6; ++pChannel; } - while ( v6 < v3->uMixerChannels ); + while (v6 < uMixerChannels); } - if ( v3->hSequence ) - AIL_end_sequence(v3->hSequence); - v8 = v3->hStream; - if ( v8 ) - AIL_pause_stream(v8, 1); + if (hSequence) + AIL_end_sequence(hSequence); + //v8 = hStream; + if (hStream) + AIL_pause_stream(hStream, 1); } } @@ -2142,7 +2142,7 @@ void AudioPlayer::_4ABE55(MixerChannel *pChannel) { int v2; // ebx@1 - AudioPlayer *v3; // esi@1 + //AudioPlayer *v3; // esi@1 SoundDesc *v4; // eax@2 unsigned __int8 v5; // zf@5 unsigned __int8 v6; // sf@5 @@ -2158,11 +2158,11 @@ int v16; // [sp+50h] [bp-4h]@5 v2 = 0; - v3 = this; + //v3 = this; if ( pSoundList->pSounds ) { v4 = &pSoundList->pSounds[pChannel->uSourceTrackIdx]; - if ( v4->uType == 2 ) + if ( v4->eType == SOUND_DESC_SWAP) { if ( v4->pSoundData[0] && !(v4->uFlags & 1) ) { @@ -2187,7 +2187,7 @@ ++v2; v7 += 16; } - while ( v2 < v3->uMixerChannels ); + while ( v2 < uMixerChannels ); if ( !v15 ) { LABEL_16: @@ -2199,10 +2199,10 @@ { v11 = v14[v10]; v12 = 16 * (v14[v10++] + 47); - v3->pMixerChannels[v11].uSourceTrackID = 0; + pMixerChannels[v11].uSourceTrackID = 0; v13 = __OFSUB__(v10, v16); v6 = v10 - v16 < 0; - *(unsigned int *)((char *)&v3->bEAXSupported + v12) = 0; + *(unsigned int *)((char *)&bEAXSupported + v12) = 0; } while ( v6 ^ v13 ); } @@ -2286,7 +2286,7 @@ void AudioPlayer::_4ABF23(AudioPlayer_3DSample *a2) { int v2; // ebx@1 - AudioPlayer *v3; // esi@1 + //AudioPlayer *v3; // esi@1 SoundDesc *v4; // eax@2 unsigned __int8 v5; // zf@5 unsigned __int8 v6; // sf@5 @@ -2301,11 +2301,11 @@ int v15; // [sp+50h] [bp-4h]@5 v2 = 0; - v3 = this; + //v3 = this; if ( pSoundList->pSounds ) { v4 = &pSoundList->pSounds[a2->field_8]; - if ( v4->uType == 2 ) + if ( v4->eType == SOUND_DESC_SWAP) { if ( v4->p3DSound && !(v4->uFlags & 1) ) { @@ -2330,7 +2330,7 @@ ++v2; v7 += 16; } - while ( v2 < v3->uNum3DSamples ); + while ( v2 < uNum3DSamples ); if ( !v14 ) { LABEL_16: @@ -2341,10 +2341,10 @@ do { v11 = v13[v10++]; - *(&v3->bEAXSupported + 4 * (v11 + 2)) = 0; + *(&bEAXSupported + 4 * (v11 + 2)) = 0; v12 = __OFSUB__(v10, v15); v6 = v10 - v15 < 0; - v3->p3DSamples[v11].field_8 = 0; + p3DSamples[v11].field_8 = 0; } while ( v6 ^ v12 ); }
--- a/AudioPlayer.h Tue Oct 09 13:09:08 2012 +0200 +++ b/AudioPlayer.h Wed Oct 10 14:21:15 2012 +0200 @@ -55,6 +55,10 @@ #pragma pack(push, 1) struct MixerChannel { + inline MixerChannel(): + hSample(nullptr), dword_000004(0), uSourceTrackIdx(0), uSourceTrackID(0) + {} + _SAMPLE *hSample; int dword_000004; unsigned int uSourceTrackIdx; @@ -95,7 +99,8 @@ { //----- (004A9669) -------------------------------------------------------- AudioPlayer(): - bPlayerReady(false) + bPlayerReady(false), b3DSoundInitialized(false), + hStream(nullptr) { uMixerChannels = 16; field_2D0_time_left = 256; @@ -197,7 +202,7 @@ { char pSoundName[32]; unsigned int uSoundID; - SOUND_DESC_TYPE uType; + SOUND_DESC_TYPE eType; int uFlags; void *pSoundData[17]; void *p3DSound;
--- a/CShow.h Tue Oct 09 13:09:08 2012 +0200 +++ b/CShow.h Wed Oct 10 14:21:15 2012 +0200 @@ -41,7 +41,7 @@ char v10; // [sp+4h] [bp-8h]@4 int a3; // [sp+Bh] [bp-1h]@14 - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); switch ( eVideo ) { @@ -100,7 +100,7 @@ } if ( bShowMouseAfterPlayback ) { - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); } }
--- a/DecalBuilder.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/DecalBuilder.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -73,24 +73,28 @@ //----- (0049B490) -------------------------------------------------------- bool DecalBuilder::AddBloodsplat(float x, float y, float z, float r, float g, float b, float radius, int a8, int a9) { - double v10; // ST1C_8@1 + //double v10; // ST1C_8@1 char v11; // ST24_1@1 - double v12; // ST1C_8@1 - double v13; // ST1C_8@1 + //double v12; // ST1C_8@1 + //double v13; // ST1C_8@1 int a7a; // [sp+40h] [bp+18h]@1 - float arg14a; // [sp+44h] [bp+1Ch]@1 - float arg14b; // [sp+44h] [bp+1Ch]@1 - float arg14c; // [sp+44h] [bp+1Ch]@1 + //float arg14a; // [sp+44h] [bp+1Ch]@1 + //float arg14b; // [sp+44h] [bp+1Ch]@1 + //float arg14c; // [sp+44h] [bp+1Ch]@1 - arg14a = b * 255.0; + /*arg14a = b * 255.0; v10 = arg14a + 6.7553994e15; v11 = LOBYTE(v10); arg14b = g * 255.0; v12 = arg14b + 6.7553994e15; a7a = LODWORD(v12); arg14c = r * 255.0; - v13 = arg14c + 6.7553994e15; - return pBloodsplatContainer->AddBloodsplat(x, y, z, radius, SLOBYTE(v13), a7a, v11); + v13 = arg14c + 6.7553994e15;*/ + return pBloodsplatContainer->AddBloodsplat(x, y, z, radius, + //SLOBYTE(v13), a7a, v11); + r * 255.0f, + g * 255.0f, + b * 255.0f); } //----- (0049B525) --------------------------------------------------------
--- a/GUIProgressBar.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/GUIProgressBar.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -28,7 +28,7 @@ char Str1[64]; // [sp+4h] [bp-78h]@16 v2 = this; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); if ( v2->pLoadingBg.pPixels ) return 0; @@ -120,7 +120,7 @@ int v3; // edi@7 v1 = this; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( v1->uType == 1 ) {
--- a/GUIWindow.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/GUIWindow.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -362,7 +362,7 @@ v1 = this; if ( !this ) return; - v2 = this->uWindowType; + v2 = this->eWindowType; if ( (signed int)v2 > 18 ) { v5 = v2 - 19; @@ -452,7 +452,7 @@ v1->pControlsHead = 0; v1->pControlsTail = 0; v1->uNumControls = 0; - v1->uWindowType = 0; + v1->eWindowType = WINDOW_null; v10 = v1->field_3C; v11 = uNumVisibleWindows; while ( v10 < v11 ) @@ -2123,11 +2123,11 @@ //----- (0041C432) -------------------------------------------------------- -GUIWindow *GUIWindow::Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uWindowType, int a4, int a5) +GUIWindow *GUIWindow::Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, WindowType eWindowType, int a4, int a5) { unsigned int uNextFreeWindowID; // ebp@1 - int *v8; // eax@1 - GUIWindow *pWindow; // esi@4 + //int *v8; // eax@1 + //GUIWindow *pWindow; // esi@4 int v10; // eax@4 unsigned int v11; // ebx@15 NPCData *v12; // ebp@15 @@ -2152,16 +2152,14 @@ int a4a; // [sp+20h] [bp+10h]@15 uNextFreeWindowID = 0; - v8 = (int *)&pWindowList[0].uWindowType; - do + for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) { - if ( !*v8 ) + if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null) break; - v8 += 21; - ++uNextFreeWindowID; } - while ( (signed int)v8 < (signed int)&pVisibleWindowsIdxs[6] ); - pWindow = &pWindowList[uNextFreeWindowID]; + + + auto pWindow = &pWindowList[uNextFreeWindowID]; pWindow->uFrameWidth = uWidth; pWindow->uFrameZ = uX + uWidth - 1; pWindow->uFrameW = uY + uHeight - 1; @@ -2172,21 +2170,21 @@ ++v10; pWindow->uFrameY = uY; pWindow->uFrameHeight = uHeight; - pWindow->uWindowType = uWindowType; + pWindow->eWindowType = eWindowType; pWindow->field_44 = 0; uNumVisibleWindows = v10; pWindow->field_3C = v10; pVisibleWindowsIdxs[v10] = uNextFreeWindowID + 1; - if ( (signed int)uWindowType <= 20 ) + if ( (signed int)eWindowType <= 20 ) { - if ( uWindowType != 20 ) + if (eWindowType != WINDOW_Chest) { - switch ( uWindowType ) + switch (eWindowType) { - case 9u: + case WINDOW_Book: pWindow->InitializeBookView(); break; - case 0xAu: + case WINDOW_A: dword_506978 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 4; ptr_5076F4 = pWindow->CreateButton( @@ -2199,8 +2197,8 @@ 0x71u, 0, 0, - pGlobalTXT_LocalizationStrings[79], - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), + pGlobalTXT_LocalizationStrings[79], //"Exit" + (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); if ( pWindow->ptr_1C != (void *)1 ) { @@ -2211,7 +2209,7 @@ { if ( v12->joins ) { - pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0xDu, 0, nullstring, 0); + pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0xDu, 0, "", 0); a4a = 1; } v13 = (void *)v12->bDrawSomeAnim; @@ -2383,7 +2381,7 @@ pWindow->_41D08F(a4a, 1, 0, 1); } break; - case 0x11u: + case WINDOW_11: dword_506978 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 17; ptr_5076F4 = pWindow->CreateButton( @@ -2428,11 +2426,11 @@ 0); pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x5Au, 1u, 0, pWindow->str_48, 0); break; - case 0x12u: + case WINDOW_12: InitializeBookTextures(); pWindow->_411621(); break; - case 0x13u: + case WINDOW_13: dword_506978 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; pKeyActionMap->_459E5A(0, 15, pWindow); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 19; @@ -2448,7 +2446,7 @@ pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, nullstring, 0); return pWindow; } - if ( uWindowType == 25 ) + if (eWindowType == WINDOW_HouseInterior) { uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 13; ptr_5076F4 = pWindow->CreateButton( @@ -2514,7 +2512,7 @@ } else { - if ( uWindowType == 26 ) + if (eWindowType == WINDOW_1A) { dword_506978 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 18; @@ -2559,7 +2557,7 @@ pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x19Bu, 1u, 0, pWindow->str_48, 0); return pWindow; } - if ( uWindowType == 27 ) + if (eWindowType == WINDOW_1B) { pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); @@ -2567,9 +2565,9 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u); return pWindow; } - if ( uWindowType == 30 ) + if (eWindowType == WINDOW_1E) goto LABEL_62; - if ( uWindowType == 31 ) + if (eWindowType == WINDOW_1F) { pMouse->SetCursorBitmap("MICON2"); ptr_5076F4 = pWindow->CreateButton(
--- a/GUIWindow.h Tue Oct 09 13:09:08 2012 +0200 +++ b/GUIWindow.h Wed Oct 10 14:21:15 2012 +0200 @@ -30,17 +30,26 @@ /* 298 */ -enum WindowType +enum WindowType: unsigned __int32 { - WINDOW_Credits = 0x1, + WINDOW_null = 0, + WINDOW_MainMenu = 0x1, WINDOW_CharacterRecord = 0x4, WINDOW_Options = 0x6, WINDOW_Book = 0x9, + WINDOW_A = 10, + WINDOW_11 = 17, + WINDOW_12 = 18, + WINDOW_13 = 19, WINDOW_Chest = 0x14, WINDOW_HouseInterior = 0x19, + WINDOW_1A = 26, + WINDOW_1B = 27, + WINDOW_1E = 30, + WINDOW_1F = 31, WINDOW_FinalWindow = 0x46, WINDOW_KeyMappingOptions = 0x69, - WINDOW_VideoOptions = 0x6A, + WINDOW_VideoOptions = 0x6A }; /* 155 */ @@ -63,7 +72,7 @@ char _41D3B7(); char _41D73D_draw_buff_tooltip(); - static GUIWindow *Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uWindowType, int a4, int a5); + static GUIWindow *Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eType, int a4, int a5); unsigned int uFrameX; unsigned int uFrameY; @@ -71,7 +80,7 @@ unsigned int uFrameHeight; unsigned int uFrameZ; unsigned int uFrameW; - unsigned int uWindowType; + WindowType eWindowType; void *ptr_1C; unsigned int uNumControls; int field_24; @@ -100,6 +109,7 @@ UIMSG_00 = 0x0, UIMSG_ChangeGameState = 0x5, UIMSG_PlayArcomage = 0x1D, + UIMSG_ExitToWindows = 0x39, UIMSG_LoadGame = 0x52, UIMSG_SaveGame = 0x53, UIMSG_ShowStatus_DateTime = 0x5C,
--- a/Game.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/Game.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -51,7 +51,7 @@ Render *v0; // esi@3 int _null; // ebx@6 float v2; // ST24_4@11 - double v3; // ST28_8@11 + //double v3; // ST28_8@11 int v4; // edi@26 int v5; // eax@35 @@ -100,8 +100,9 @@ if ( pRenderer->pRenderD3D ) { v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0; - v3 = v2 + 6.7553994e15; - pRenderer->field_1036A8_bitmapid = LODWORD(v3); + //v3 = v2 + 6.7553994e15; + //pRenderer->field_1036A8_bitmapid = LODWORD(v3); + pRenderer->field_1036A8_bitmapid = floorf(v2); } if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) @@ -260,7 +261,7 @@ LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 | 0x80; dword_6BE340 = 2; uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Resume(); @@ -292,7 +293,7 @@ v2->Present(); continue; } - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(v3); if ( pVideoPlayer->pSmackerMovie && !SmackWait(pVideoPlayer->pSmackerMovie) ) { @@ -743,9 +744,9 @@ { struct tagRECT Rect; // [sp+0h] [bp-10h]@6 - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); - if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) + if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard) pAsyncKeyboard->Suspend(); WriteWindowsRegistryInt("startinwindow", pRenderer->bWindowMode); if ( GetWindowRect(hWnd, &Rect) && pRenderer->bWindowMode ) @@ -757,10 +758,13 @@ WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); pItemsTable->Release(); pNPCStats->Release(); - pAsyncKeyboard->Release(); - pAsyncMouse->Release(); - if ( pMouse ) + if (pAsyncKeyboard) + pAsyncKeyboard->Release(); + if (pAsyncMouse) + pAsyncMouse->Release(); + if (pMouse) pMouse->Deactivate(); + pAudioPlayer->Release(); pNew_LOD->FreeSubIndexAndIO(); pGames_LOD->FreeSubIndexAndIO(); @@ -783,12 +787,12 @@ int Game::_44EC23(stru148 *a2, int *a3, signed int a4) { double v4; // st7@4 - double v5; // ST00_8@4 + //double v5; // ST00_8@4 signed int v6; // eax@5 - double v7; // ST00_8@6 + //double v7; // ST00_8@6 signed int result; // eax@8 - double v9; // ST00_8@9 - double v10; // ST00_8@11 + //double v9; // ST00_8@9 + //double v10; // ST00_8@11 float a2a; // [sp+14h] [bp+8h]@4 float a3a; // [sp+18h] [bp+Ch]@4 float a3b; // [sp+18h] [bp+Ch]@6 @@ -801,12 +805,14 @@ a2a = v4; *a3 |= 2u; a3a = (1.0 - this->_E28_timed_gamma_strength) * v4; - v5 = a3a + 6.7553994e15; - if ( SLODWORD(v5) >= 0 ) + //v5 = a3a + 6.7553994e15; + //if ( SLODWORD(v5) >= 0 ) + if (floorf(a3a) >= 0 ) { a3b = (1.0 - this->_E28_timed_gamma_strength) * a2a; - v7 = a3b + 6.7553994e15; - v6 = LODWORD(v7); + //v7 = a3b + 6.7553994e15; + //v6 = LODWORD(v7); + v6 = floorf(a3b); } else { @@ -814,13 +820,15 @@ } if ( a4 >= v6 ) { - a4a = (1.0 - this->_E28_timed_gamma_strength) * a2a; - v9 = a4a + 6.7553994e15; - if ( SLODWORD(v9) >= 0 ) + a4a = (1.0 - _E28_timed_gamma_strength) * a2a; + //v9 = a4a + 6.7553994e15; + //if ( SLODWORD(v9) >= 0 ) + if (floorf(a4a) >= 0) { - a4b = (1.0 - this->_E28_timed_gamma_strength) * a2a; - v10 = a4b + 6.7553994e15; - result = LODWORD(v10); + a4b = (1.0 - _E28_timed_gamma_strength) * a2a; + //v10 = a4b + 6.7553994e15; + //result = LODWORD(v10); + result = floorf(a4b); } else { @@ -861,10 +869,10 @@ double v4; // st7@3 double v5; // ST00_8@3 signed int v6; // eax@4 - double v7; // ST00_8@5 + //double v7; // ST00_8@5 signed int result; // eax@7 double v9; // ST00_8@8 - double v10; // ST00_8@10 + //double v10; // ST00_8@10 float v11; // [sp+14h] [bp+8h]@3 float v12; // [sp+18h] [bp+Ch]@3 float v13; // [sp+18h] [bp+Ch]@5 @@ -881,8 +889,9 @@ if ( SLODWORD(v5) >= 0 ) { v13 = (1.0 - this->_E28_timed_gamma_strength) * v11; - v7 = v13 + 6.7553994e15; - v6 = LODWORD(v7); + //v7 = v13 + 6.7553994e15; + //v6 = LODWORD(v7); + v6 = floorf(v13); } else { @@ -890,13 +899,14 @@ } if ( a4 >= v6 ) { - v14 = (1.0 - this->_E28_timed_gamma_strength) * v11; + v14 = (1.0 - _E28_timed_gamma_strength) * v11; v9 = v14 + 6.7553994e15; if ( SLODWORD(v9) >= 0 ) { - v15 = (1.0 - this->_E28_timed_gamma_strength) * v11; - v10 = v15 + 6.7553994e15; - result = LODWORD(v10); + v15 = (1.0 - _E28_timed_gamma_strength) * v11; + //v10 = v15 + 6.7553994e15; + //result = LODWORD(v10); + result = floorf(v15); } else {
--- a/Indoor.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/Indoor.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -53,16 +53,16 @@ void __fastcall sub_43F39E(IndoorLocation_drawstru *_this) { int *v1; // ecx@1 - double v2; // ST30_8@3 - double v3; // ST30_8@6 - double v4; // ST28_8@6 + //double v2; // ST30_8@3 + //double v3; // ST30_8@6 + //double v4; // ST28_8@6 int v5; // eax@4 int v6; // eax@7 unsigned int v7; // ebx@8 BLVSector *v8; // esi@8 unsigned __int16 *v9; // edi@8 int i; // [sp+18h] [bp-8h]@7 - unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3 + //unsigned __int8 v11; // [sp+1Ch] [bp-4h]@3 signed int v12; // [sp+1Ch] [bp-4h]@8 pBLVRenderParams->Set(_this); @@ -73,24 +73,24 @@ uNumBillboardsToDraw = 0; if ( !byte_4D864C || !(BYTE1(pGame->uFlags) & 0x10) ) { - v2 = pParty->flt_TorchlightColorB + 6.7553994e15; - v11 = LOBYTE(v2); + //v2 = pParty->flt_TorchlightColorB + 6.7553994e15; + //v11 = LOBYTE(v2); if ( (signed __int64)pParty->pPartyBuffs[16].uExpireTime <= 0 ) v5 = 800; else v5 = 800 * pParty->pPartyBuffs[16].uPower; LOBYTE(v1) = byte_4E94D0; - v4 = pParty->flt_TorchlightColorR + 6.7553994e15; - v3 = pParty->flt_TorchlightColorG + 6.7553994e15; + //v4 = pParty->flt_TorchlightColorR + 6.7553994e15; + //v3 = pParty->flt_TorchlightColorG + 6.7553994e15; pMobileLightsStack->AddLight( SLOWORD(pBLVRenderParams->vPartyPos.x), SLOWORD(pBLVRenderParams->vPartyPos.y), SLOWORD(pBLVRenderParams->vPartyPos.z), SLOWORD(pBLVRenderParams->uRadius), v5, - LOBYTE(v4), - LOBYTE(v3), - v11, + floorf(pParty->flt_TorchlightColorR), + floorf(pParty->flt_TorchlightColorG), + floorf(pParty->flt_TorchlightColorB), v1); } PrepareWallsRenderList_BLV();
--- a/IndoorCamera.h Tue Oct 09 13:09:08 2012 +0200 +++ b/IndoorCamera.h Wed Oct 10 14:21:15 2012 +0200 @@ -10,11 +10,8 @@ { sRotationX = 0; sRotationY = 0; - __debugbreak(); - { - //LODWORD(flt_1C_fov) = 0x44FA0000u; - //LODWORD(flt_20_inv_1C) = 0x4203126Fu; - } + flt_1C_fov = 2000.0f; + flt_20_inv_1C = 32.768002f; field_4C = 0; }
--- a/IndoorCameraD3D.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/IndoorCameraD3D.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -505,12 +505,12 @@ RenderVertexSoft vert[20]; // [sp+0h] [bp-680h]@1 RenderVertexD3D3 pD3DVertices[5]; // [sp+3C0h] [bp-2C0h]@15 RenderVertexSoft a1; // [sp+640h] [bp-40h]@1 - double v24; // [sp+670h] [bp-10h]@25 - double v25; // [sp+678h] [bp-8h]@1 + //double v24; // [sp+670h] [bp-10h]@25 + //double v25; // [sp+678h] [bp-8h]@1 v7 = this; a1.flt_2C = 0.0; - HIDWORD(v25) = (int)this; + //HIDWORD(v25) = (int)this; v8 = (char *)&vert[0].flt_2C; v9 = 20; do @@ -640,8 +640,12 @@ do { LODWORD(a7) = *((int *)v13 - 3); - v25 = a7 + 6.7553994e15; - v24 = *((float *)v13 - 4) + 6.7553994e15; + //v25 = a7 + 6.7553994e15; + auto _v25 = floorf(a7); + + //v24 = *((float *)v13 - 4) + 6.7553994e15; + auto _v24 = floorf(*((float *)v13 - 4)); + v14 = *(int *)v13; v15 = *(int *)v13; v16 = (*(int *)v13 >> 3) & 0x1F; @@ -657,7 +661,7 @@ } v13 += 32; --uNumD3DVertices; - pRenderer->pTargetSurface[LODWORD(v24) + pRenderer->uTargetSurfacePitch * LODWORD(v25)] = v18 | v16 | (unsigned __int16)v17; + pRenderer->pTargetSurface[(uint)_v24 + pRenderer->uTargetSurfacePitch * (uint)_v25] = v18 | v16 | (unsigned __int16)v17; } while ( uNumD3DVertices ); }
--- a/LOD.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/LOD.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -1910,34 +1910,34 @@ //----- (00461954) -------------------------------------------------------- void LOD::File::AllocSubIndicesAndIO(unsigned int uNumSubIndices, unsigned int uBufferSize) { - LOD::File *v3; // esi@1 + //LOD::File *v3; // esi@1 LOD::Directory *pSubIndices_dup; // eax@3 char v5; // zf@3 - v3 = this; - if ( this->pSubIndices ) + //v3 = this; + if (pSubIndices) { MessageBoxA(0, "Attempt to reset a LOD subindex!", "MM6", MB_ICONEXCLAMATION); - pAllocator->FreeChunk(v3->pSubIndices); - v3->pSubIndices = 0; + pAllocator->FreeChunk(pSubIndices); + pSubIndices = nullptr; } pSubIndices_dup = (LOD::Directory *)pAllocator->AllocNamedChunk( - v3->pSubIndices, + pSubIndices, 32 * uNumSubIndices, "LODsub"); - v5 = v3->pIOBuffer == 0; - v3->pSubIndices = pSubIndices_dup; + v5 = pIOBuffer == 0; + pSubIndices = pSubIndices_dup; if ( !v5 ) { MessageBoxA(0, "Attempt to reset a LOD IObuffer!", "MM6", MB_ICONEXCLAMATION); - pAllocator->FreeChunk(v3->pIOBuffer); - v3->pIOBuffer = 0; - v3->uIOBufferSize = 0; + pAllocator->FreeChunk(pIOBuffer); + pIOBuffer = 0; + uIOBufferSize = 0; } if ( uBufferSize ) { - v3->pIOBuffer = (unsigned __int8 *)pAllocator->AllocNamedChunk(v3->pIOBuffer, uBufferSize, "LODio"); - v3->uIOBufferSize = uBufferSize; + pIOBuffer = (unsigned __int8 *)pAllocator->AllocNamedChunk(pIOBuffer, uBufferSize, "LODio"); + uIOBufferSize = uBufferSize; } } @@ -2861,7 +2861,7 @@ strcpy(v8->pName, pContainer); if (pRenderer->pRenderD3D && v8->pBits & 2 && dword_011BA8) { - if ( !pHardwareSurfaces || !pHardwareTextures ) + if (!pHardwareSurfaces || !pHardwareTextures) { pHardwareSurfaces = new IDirectDrawSurface *[1000]; memset(pHardwareSurfaces, 0, 1000 * sizeof(IDirectDrawSurface4 *)); @@ -3108,6 +3108,17 @@ } +Texture *LODFile_IconsBitmaps::LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType) +{ + uint id = LoadTexture(pContainer, uTextureType); + if (id == -1) + { + Log::Warning(L"LOD error\\no container: \"%S\"", pContainer); + return nullptr; + } + return &pTextures[id]; +} + //----- (0040FB20) -------------------------------------------------------- unsigned int LODFile_IconsBitmaps::LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType) {
--- a/LOD.h Tue Oct 09 13:09:08 2012 +0200 +++ b/LOD.h Wed Oct 10 14:21:15 2012 +0200 @@ -134,6 +134,7 @@ bool LoadIconsOrEvents(const char *pLODFilename); void ReleaseAll(); unsigned int LoadTexture(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT); + Texture *LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType = TEXTURE_DEFAULT); int LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType); int ReloadTexture(Texture *pDst, const char *pContainer, int mode); void ReleaseHardwareTextures();
--- a/LightmapBuilder.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/LightmapBuilder.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -72,9 +72,9 @@ int arg0; // [sp+2Ch] [bp-40h]@21 int v29; // [sp+30h] [bp-3Ch]@21 int v30; // [sp+34h] [bp-38h]@21 - double v31; // [sp+38h] [bp-34h]@21 - double v32; // [sp+40h] [bp-2Ch]@21 - double v33; // [sp+48h] [bp-24h]@21 + //double v31; // [sp+38h] [bp-34h]@21 + //double v32; // [sp+40h] [bp-2Ch]@21 + //double v33; // [sp+48h] [bp-24h]@21 int v34; // [sp+50h] [bp-1Ch]@24 LightmapBuilder *thisa; // [sp+54h] [bp-18h]@1 int v36; // [sp+58h] [bp-14h]@21 @@ -163,15 +163,17 @@ a6 = v20; v36 = v21; v37 = v19[20]; - v33 = a6 + 6.7553994e15; + //v33 = a6 + 6.7553994e15; a6 = *((float *)v19 + 100) * 255.0; - v32 = a6 + 6.7553994e15; + //v32 = a6 + 6.7553994e15; a6 = *((float *)v19 + 120) * 255.0; - v31 = a6 + 6.7553994e15; - v38 = __PAIR__(LODWORD(v32), LODWORD(v31)); - v22 = LODWORD(v31) | ((LODWORD(v32) | (LODWORD(v33) << 8)) << 8); - if ( !(LODWORD(v31) | ((LODWORD(v32) | (LODWORD(v33) << 8)) << 8)) ) - v22 = 0xFFFFFFu; + //v31 = a6 + 6.7553994e15; + //v38 = __PAIR__(LODWORD(v32), LODWORD(v31)); + v38 = __PAIR__((int)floorf(a6), (int)floorf(a6)); + //v22 = LODWORD(v31) | ((LODWORD(v32) | (LODWORD(v33) << 8)) << 8); + v22 = (int)floorf(a6) | (((int)floorf(a6) | ((int)floorf(a6) << 8)) << 8); + if (!v22) + v22 = 0x00FFFFFF; v27 = a7; v23 = (int)a5; v26 = (Vec3_float_ *)a9; @@ -257,7 +259,7 @@ float v61; // [sp+24h] [bp-28h]@8 float v62; // [sp+28h] [bp-24h]@8 Vec3_float_ a1; // [sp+2Ch] [bp-20h]@8 - double v64; // [sp+38h] [bp-14h]@8 + //double v64; // [sp+38h] [bp-14h]@8 int pLightmapVertices_; // [sp+40h] [bp-Ch]@5 float v66; // [sp+44h] [bp-8h]@5 char v67; // [sp+4Bh] [bp-1h]@2 @@ -359,28 +361,31 @@ a1.z = a5; a1.y = v30; a1.Normalize(); - v64 = v62 + 6.7553994e15; - LODWORD(a5) = LODWORD(v64); - v64 = v61 + 6.7553994e15; - arg0c = LODWORD(v64); - v64 = v60 + 6.7553994e15; - arg8 = LODWORD(v64); - HIDWORD(v64) = abs(*(int *)(v25 + 8) - (signed)LODWORD(a5)); + //v64 = v62 + 6.7553994e15; + //LODWORD(a5) = LODWORD(v64); + LODWORD(a5) = floorf(v62); + //v64 = v61 + 6.7553994e15; + //arg0c = LODWORD(v64); + arg0c = floorf(v61); + //v64 = v60 + 6.7553994e15; + //arg8 = LODWORD(v64); + arg8 = floorf(v60); + auto v64 /*HIDWORD(v64)*/ = abs(*(int *)(v25 + 8) - (signed)LODWORD(a5)); arg0a = abs(*(int *)(v25 + 4) - arg0c); v31 = abs(*(int *)v25 - arg8); LODWORD(a5) = v31; v32 = arg0a; - v33 = HIDWORD(v64); + v33 = v64;//HIDWORD(v64); if ( v31 < arg0a ) { v34 = v31; v31 = arg0a; v32 = v34; } - if ( v31 < SHIDWORD(v64) ) + if ( v31 < v64)//SHIDWORD(v64) ) { v35 = v31; - v31 = HIDWORD(v64); + v31 = v64;//HIDWORD(v64); v33 = v35; } if ( v32 < (signed int)v33 ) @@ -806,7 +811,7 @@ char v21; // c2@12 char v22; // c3@12 signed int v23; // [sp+10h] [bp-4h]@2 - float pLighta; // [sp+1Ch] [bp+8h]@13 + //float pLighta; // [sp+1Ch] [bp+8h]@13 signed int a2a; // [sp+20h] [bp+Ch]@4 v7 = pLight; @@ -841,8 +846,8 @@ stru_F8AD28._blv_lights_rs[*pSlot] = (double)pLight->uLightColorR * 0.0039215689; stru_F8AD28._blv_lights_gs[*pSlot] = (double)pLight->uLightColorG * 0.0039215689; stru_F8AD28._blv_lights_bs[*pSlot] = (double)pLight->uLightColorB * 0.0039215689; - pLighta = v13; - stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = abs(COERCE_UNSIGNED_INT64(pLighta + 6.7553994e15)); + //pLighta = v13; + stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = abs((int)floorf(v13));//COERCE_UNSIGNED_INT64(pLighta + 6.7553994e15)); result = (BLVFace *)*pSlot; stru_F8AD28._blv_lights_smthngs[(*pSlot)++] = v7->field_B; LOBYTE(result) = 1; @@ -1035,16 +1040,20 @@ v7 = a5; LODWORD(a5) = *(unsigned int *)(LODWORD(a5) + 8); - v24 = a5 + 6.7553994e15; - v26 = LODWORD(v24); + //v24 = a5 + 6.7553994e15; + v26 = floorf(a5);//LODWORD(v24); LODWORD(a5) = *(unsigned int *)(LODWORD(v7) + 4); - v24 = a5 + 6.7553994e15; + //v24 = a5 + 6.7553994e15; + auto _v24 = floorf(a5); LODWORD(a5) = *(unsigned int *)LODWORD(v7); - v23 = a5 + 6.7553994e15; - *(_QWORD *)((char *)&v24 + 4) = __PAIR__(LODWORD(v24), LODWORD(v23)); + //v23 = a5 + 6.7553994e15; + auto _v23 = floorf(a5); + //*(_QWORD *)((char *)&v24 + 4) = __PAIR__(LODWORD(v24), LODWORD(v23)); v26 = abs((signed)LODWORD(a1.z) - v26); - v25 = abs((signed)LODWORD(a1.y) - (signed)LODWORD(v24)); - v8 = abs((int)a1.x - (signed)LODWORD(v23)); + //v25 = abs((signed)LODWORD(a1.y) - (signed)LODWORD(v24)); + //v8 = abs((int)a1.x - (signed)LODWORD(v23)); + v25 = abs((signed)LODWORD(a1.y) - (signed)_v24); + v8 = abs((int)a1.x - (signed)_v23); LODWORD(a5) = v8; v9 = v25; v10 = v26; @@ -1548,8 +1557,8 @@ float v17; // ST04_4@17 double v18; // st7@17 int result; // eax@19 - double v20; // ST14_8@20 - double v21; // ST14_8@20 + //double v20; // ST14_8@20 + //double v21; // ST14_8@20 double v22; // st7@20 int v23; // ecx@20 double v24; // st6@20 @@ -1633,11 +1642,13 @@ else { a5a = ((double)a1->field_A - v15->field_2C) * v15->field_4 + v15->field_24 - 0.5; - v20 = a5a + 6.7553994e15; - a5b = (double)SLODWORD(v20); + //v20 = a5a + 6.7553994e15; + //a5b = (double)SLODWORD(v20); + a5b = (double)floorf(a5a); a1a = ((double)a1->field_A - *(float *)(v14 + 44)) * *(float *)(v14 + 4) + *(float *)(v14 + 36) + 0.5; - v21 = a1a + 6.7553994e15; - v22 = (double)SLODWORD(v21); + //v21 = a1a + 6.7553994e15; + //v22 = (double)SLODWORD(v21); + v22 = (double)floorf(a1a); result = v9->field_8; v23 = v9->field_C; v24 = -((a3a - a2a) / (v22 - a5b)); @@ -1985,17 +1996,22 @@ v30 = a1->field_C10 & 0xFFi64; a1b = BYTE2(a1->field_C10); v7 = arg4; - v31 = v6; + //v31 = v6; *((float *)&v30 + 1) = (double)v30 * v4->flt_C14; a1c = (double)a1b * v4->flt_C14 * arg4->x; - v29 = a1c + 6.7553994e15; - arg4a = LODWORD(v29); - a1d = v31 * v7->y; + //v29 = a1c + 6.7553994e15; + //arg4a = LODWORD(v29); + arg4a = floorf(a1c); + + a1d = v6 * v7->y; v29 = a1d + 6.7553994e15; LODWORD(v31) = LODWORD(v29); + a1e = *((float *)&v30 + 1) * v7->z; + v29 = a1e + 6.7553994e15; HIDWORD(v30) = LODWORD(v29); + v8 = uCurrentlyLoadedLevelType; v9 = LODWORD(v29) | ((LODWORD(v31) | (arg4a << 8)) << 8); if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
--- a/Mouse.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/Mouse.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -25,7 +25,7 @@ { unsigned int v3; // eax@2 - if ( pAsyncMouse ) + if (pAsyncMouse) { *pX = *((int *)pAsyncMouse + 6); v3 = *((int *)pAsyncMouse + 7); @@ -41,11 +41,8 @@ //----- (004698A6) -------------------------------------------------------- void Mouse::RemoveHoldingItem() { - Mouse *v1; // esi@1 - - v1 = this; pParty->pPickedItem.Reset(); - if ( _strcmpi(v1->pCurrentCursorName, "MICON2") ) + if (strcmpi(pCurrentCursorName, "MICON2")) SetCursorBitmap("MICON1"); } @@ -109,7 +106,7 @@ v3 = LoadCursorA(GetModuleHandleW(nullptr), "Arrow"); SetClassLongA(hWnd, GCL_HCURSOR, (LONG)v3); v4 = (int)pAsyncMouse; - if ( pAsyncMouse ) + if (pAsyncMouse) { v10 = 0.0; v5 = 0.0; @@ -125,7 +122,7 @@ v7 = (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Target"); SetClassLongA(hWnd, -12, v7); v4 = (int)pAsyncMouse; - if ( pAsyncMouse ) + if (pAsyncMouse) { v10 = 14.0; v5 = 14.0; @@ -157,7 +154,7 @@ v1 = this; this->field_8 = 1; - if ( pAsyncMouse ) + if (pAsyncMouse) { v2 = *((int *)pAsyncMouse + 6); Point.x = *((int *)pAsyncMouse + 6); @@ -175,7 +172,7 @@ v1->uMouseClickY = result; if ( pRenderer->bWindowMode ) goto LABEL_16; - if ( pAsyncMouse ) + if (pAsyncMouse) goto LABEL_24; if ( v2 < 0 ) v2 = 0; @@ -187,7 +184,7 @@ { result = 479; LABEL_16: - if ( pAsyncMouse ) + if (pAsyncMouse) goto LABEL_24; if ( pRenderer->bWindowMode && (v2 < 0 || result < 0 || v2 > 639 || result > 479) ) goto LABEL_23; @@ -253,7 +250,7 @@ v2 = pAsyncMouse; result = a2; - if ( pAsyncMouse ) + if (pAsyncMouse) { a2->x = *((int *)pAsyncMouse + 6); v4 = *((int *)v2 + 7); @@ -475,7 +472,7 @@ pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); - if ( pAsyncMouse ) + if (pAsyncMouse) { v4 = *((int *)pAsyncMouse + 6); v5 = *((int *)pAsyncMouse + 7); @@ -612,10 +609,10 @@ //----- (00465C2C) -------------------------------------------------------- void AsyncMouse::Release() { - if ( pAsyncMouse ) + if (pAsyncMouse) { pAsyncMouse->Suspend(); - if ( pAsyncMouse ) + if (pAsyncMouse) (**(void (__stdcall ***)(int))pAsyncMouse)(1); } pAsyncMouse = 0;
--- a/NPC.h Tue Oct 09 13:09:08 2012 +0200 +++ b/NPC.h Wed Oct 10 14:21:15 2012 +0200 @@ -1,6 +1,18 @@ #pragma once +struct NPCTopic +{ + const char *pTopic; + const char *pText; +}; + +extern NPCTopic pNPCTopics[789]; + + + + + /* 136 */ #pragma pack(push, 1) struct NPCData @@ -65,6 +77,10 @@ #pragma pack(push, 1) struct NPCStats { + inline NPCStats(): + pNPCTextTXT_Raw(nullptr), pNPCTopicTXT_Raw(nullptr), pNPCDistTXT_Raw(nullptr) + {} + void Initialize2(); void Initialize1(); void Initialize();
--- a/Player.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/Player.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -7649,7 +7649,7 @@ if ( v36 != 13 ) { LABEL_178: - if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->uWindowType ) + if ( pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) { if ( !v73 ) goto LABEL_187; @@ -7740,7 +7740,7 @@ } if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions && pGUIWindow_CurrentMenu - && pGUIWindow_CurrentMenu->uWindowType + && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null && (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
--- a/Render.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/Render.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -5485,10 +5485,10 @@ { if ( v1->field_40110 ) { - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46BAEC(); pRenderD3D->Present(0); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46BB0A(); } } @@ -6463,7 +6463,7 @@ result = pSurface->Lock(0, pDesc, uLockFlags, 0); if ( result == DDERR_SURFACELOST ) { - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); v6 = v4->Restore(); if ( v6 ) @@ -6493,7 +6493,7 @@ if ( pRenderer->pRenderD3D ) pRenderD3D->HandleLostResources(); result = pRenderer->pDirectDraw4->RestoreAllSurfaces(); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); } else @@ -8759,7 +8759,7 @@ //HWLTexture *pHWLTexture; // esi@1 //signed int result; // eax@1 //IDirectDrawSurface **v9; // ebx@9 - IDirectDrawSurface4 *v10; // edi@11 + //IDirectDrawSurface4 *v10; // edi@11 //int v11; // ebx@11 HRESULT v12; // eax@14 unsigned __int16 *v13; // ecx@19 @@ -8767,9 +8767,9 @@ DWORD v15; // edx@20 HRESULT v16; // eax@23 stru350 Dst; // [sp+Ch] [bp-F8h]@12 - DDSURFACEDESC2 desc; // [sp+6Ch] [bp-98h]@13 - DDSCAPS2 v19; // [sp+E8h] [bp-1Ch]@13 - int v20; // [sp+100h] [bp-4h]@12 + //DDSURFACEDESC2 desc; // [sp+6Ch] [bp-98h]@13 + //DDSCAPS2 v19; // [sp+E8h] [bp-1Ch]@13 + //int v20; // [sp+100h] [bp-4h]@12 auto pHWLTexture = pD3DBitmaps.LoadTexture(pName, bMipMaps); if ( pHWLTexture ) @@ -8784,50 +8784,60 @@ bMipMaps, uMinDeviceTextureDim) ) Abortf("HiScreen16::LoadTexture - D3Drend->CreateTexture() failed: %x", 0); - v10 = *pOutSurface; + //v10 = *pOutSurface; //v11 = 0; if ( bMipMaps ) { Dst._450DDE(); - v20 = 0; - Dst._450DF1((const char *)dword_4EFCBC, (const char *)dword_4EFCBC); + //v20 = 0; + Dst._450DF1(&stru_4EFCBC, &stru_4EFCBC); + + IDirectDrawSurface4 *pNextSurf = *pOutSurface; while ( 1 ) { - memset(&v19, 0, 0x10u); - v19.dwCaps = 0x401000u; // DDSCAPS_TEXTURE | DDSCAPS_MIPMAP - memset(&desc, 0, 0x7Cu); - desc.dwSize = 124; - if ( LockSurface_DDraw4(v10, &desc, 0x21u) ) + DDSCAPS2 v19; + memset(&v19, 0, sizeof(DDSCAPS2)); + v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; + + DDSURFACEDESC2 desc; + memset(&desc, 0, sizeof(DDSURFACEDESC2)); + desc.dwSize = sizeof(DDSURFACEDESC2); + + if ( LockSurface_DDraw4(pNextSurf, &desc, 0x21u) ) { Dst.sub_451007_scale_image_bicubic( - (int)pHWLTexture->pPixels, + pHWLTexture->pPixels, pHWLTexture->uWidth, pHWLTexture->uHeight, pHWLTexture->uWidth, - (signed int)desc.lpSurface, + (unsigned short *)desc.lpSurface, desc.dwWidth, desc.dwHeight, desc.lPitch >> 1, 0, 0); - ErrD3D(v10->Unlock(0)); - bMipMaps = 0x4D86ACu; - } - if ( v10->GetAttachedSurface(&v19, (LPDIRECTDRAWSURFACE4 *)&pName) ) + ErrD3D(pNextSurf->Unlock(0)); + //bMipMaps = 0x4D86ACu; + } + if (FAILED(pNextSurf->GetAttachedSurface(&v19, &pNextSurf))) break; - v10 = (IDirectDrawSurface4 *)pName; + //v10 = (IDirectDrawSurface4 *)pName; //v11 = 0; } - v20 = -1; + //v20 = -1; //nullsub_1(); } else { - memset(&v19, 0, 0x10u); - v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; - memset(&desc, 0, 0x7Cu); - desc.dwSize = 124; - if ( LockSurface_DDraw4(v10, &desc, 0x21u) ) + DDSCAPS2 v19; + memset(&v19, 0, sizeof(DDSCAPS2)); + v19.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP; + + DDSURFACEDESC2 desc; + memset(&desc, 0, sizeof(DDSURFACEDESC2)); + desc.dwSize = sizeof(DDSURFACEDESC2); + + if ( LockSurface_DDraw4(*pOutSurface, &desc, 0x21u) ) { bMipMaps = 0; v13 = pHWLTexture->pPixels; @@ -8853,11 +8863,11 @@ } while ( bMipMaps < desc.dwHeight ); } - ErrD3D(v10->Unlock(0)); - } - } - free(pHWLTexture->pPixels); - free(pHWLTexture); + ErrD3D((*pOutSurface)->Unlock(0)); + } + } + delete [] pHWLTexture->pPixels; + delete pHWLTexture; return true; } return false; @@ -10972,7 +10982,7 @@ pMiscTimer->Resume(); pAsyncMouse->Release(); CreateAsyncMouse(); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Clip(); } } @@ -11021,14 +11031,6 @@ //----- (004524D8) -------------------------------------------------------- HWLTexture *RenderHWLContainer::LoadTexture(const char *pName, int bMipMaps) { - //RenderHWLContainer *v3; // esi@1 - unsigned int v4; // eax@1 - int v5; // ebx@2 - int v6; // edi@3 - //HWLTexture *result; // eax@8 - //HWLTexture *pTex; // edi@9 - //char *v9; // ebx@9 - //unsigned __int16 *v10; // eax@9 int v11; // eax@13 int v12; // ecx@13 void *v13; // eax@13 @@ -11042,60 +11044,68 @@ int v21; // ecx@16 int v22; // eax@16 int v23; // esi@16 - //char Str1[20]; // [sp+Ch] [bp-28h]@1 - unsigned int pSource; // [sp+20h] [bp-14h]@10 unsigned __int16 *v26; // [sp+24h] [bp-10h]@13 int v27; // [sp+28h] [bp-Ch]@14 int v28; // [sp+2Ch] [bp-8h]@13 - unsigned int DstBuf; // [sp+30h] [bp-4h]@9 - int pDesta; // [sp+3Ch] [bp+8h]@2 - void *pDestc; // [sp+3Ch] [bp+8h]@10 int pDestb; // [sp+3Ch] [bp+8h]@15 //v3 = this; //sprintf(Str1, "%s", pName); - v4 = uNumItems; - if ( v4 && (v5 = 0, pDesta = uNumItems, (signed int)v4 > 0) ) - { - while ( 1 ) - { - v6 = v5 + (pDesta - v5) / 2; - if ( !_strcmpi(pName, pSpriteNames[v6]) ) - break; - if ( _strcmpi(pName, pSpriteNames[v6]) <= 0 ) - pDesta = v5 + (pDesta - v5) / 2; - else - v5 = v6 + 1; - if ( v5 >= pDesta ) - return false; - } - fseek(pFile, pSpriteOffsets[v6], SEEK_SET); + //v4 = uNumItems; + if (!uNumItems) + return nullptr; + + //{ + //v5 = 0, pDesta = uNumItems; + uint idx1 = 0, + idx2 = uNumItems; + while (true) + { + auto i = idx1 + (idx2 - idx1) / 2; + + auto res = strcmpi(pName, pSpriteNames[i]); + if (!res) + { + fseek(pFile, pSpriteOffsets[i], SEEK_SET); + break; + } + else if (res < 0) + idx2 = idx1 + (idx2 - idx1) / 2; + else + idx1 = i + 1; + + if ( idx1 >= idx2 ) + return false; + } + + + uint uCompressedSize = 0; + fread(&uCompressedSize, 4, 1, pFile); auto pTex = new HWLTexture; - fread(&DstBuf, 4u, 1u, pFile); - fread(&pTex->field_18, 4u, 1u, pFile); - fread(&pTex->field_1C, 4u, 1u, pFile); - fread(&pTex->field_20, 4u, 1u, pFile); - fread(&pTex->field_24, 4u, 1u, pFile); - //v9 = (char *)&pTex->uWidth; - fread(&pTex->uWidth, 4u, 1u, pFile); - fread(&pTex->uHeight, 4u, 1u, pFile); - fread(&pTex->field_30, 4u, 1u, pFile); - fread(&pTex->field_34, 4u, 1u, pFile); - //v10 = new unsigned __int16[pTex->uWidth * pTex->uHeight]; + fread(&pTex->field_18, 4, 1, pFile); + fread(&pTex->field_1C, 4, 1, pFile); + fread(&pTex->field_20, 4, 1, pFile); + fread(&pTex->field_24, 4, 1, pFile); + fread(&pTex->uWidth, 4, 1, pFile); + fread(&pTex->uHeight, 4, 1, pFile); + fread(&pTex->field_30, 4, 1, pFile); + fread(&pTex->field_34, 4, 1, pFile); + pTex->pPixels = new unsigned __int16[pTex->uWidth * pTex->uHeight]; - if ( DstBuf ) - { - pDestc = new char[DstBuf]; - fread(pDestc, 1u, DstBuf, pFile); - pSource = 2 * pTex->uWidth * pTex->uHeight; - zlib::MemUnzip(pTex->pPixels, &pSource, pDestc, DstBuf); - delete [] pDestc; + if (uCompressedSize) + { + auto pCompressedData = new char[uCompressedSize]; + { + fread(pCompressedData, 1, uCompressedSize, pFile); + auto uDecompressedSize = pTex->uWidth * pTex->uHeight * sizeof(short); + zlib::MemUnzip(pTex->pPixels, &uDecompressedSize, pCompressedData, uCompressedSize); + } + delete [] pCompressedData; } else - { fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); - } + if ( field_61A94_scale_hwls_to_half ) { v11 = pTex->uHeight / 2; @@ -11142,12 +11152,12 @@ } return pTex; //result = pTex; - } - else - { +// } +// else +// { //LABEL_8: - return nullptr; - } +// return nullptr; +// } } //----- (0045271F) --------------------------------------------------------
--- a/Render.h Tue Oct 09 13:09:08 2012 +0200 +++ b/Render.h Wed Oct 10 14:21:15 2012 +0200 @@ -116,6 +116,11 @@ #pragma pack(push, 1) struct HWLTexture { + inline HWLTexture(): + field_0(0), field_4(0), field_8(0), + field_C(0), field_10(0), field_14(0) + {} + int field_0; int field_4; int field_8;
--- a/Texture.h Tue Oct 09 13:09:08 2012 +0200 +++ b/Texture.h Wed Oct 10 14:21:15 2012 +0200 @@ -331,19 +331,32 @@ +struct stru355 +{ + int field_0; + int field_4; + int field_8; + int field_C; + int field_10; + int field_14; + int field_18; + int field_1C; +}; /* 390 */ #pragma pack(push, 1) struct stru350 { stru350 *_450DDE(); - void *_450DF1(const char *Src, const char *a3); + bool _450DF1(const stru355 *p1, const stru355 *p2); unsigned int _450F55(int a2); int _450FB1(int a2); - int sub_451007_scale_image_bicubic(int a2, signed int a3, signed int a4, int a5, signed int a6, signed int a7, signed int a8, int a9, int a10, int a11); + int sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, + unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, + int a9, int a10); - int field_0[8]; - int array_20[8]; + stru355 field_0; + stru355 field_20; int field_40; int field_44; int field_48;
--- a/VideoPlayer.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/VideoPlayer.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -1130,7 +1130,7 @@ if ( EnterHouse((enum HOUSE_TYPE)165) ) { pAudioPlayer->PlaySound(SOUND_0, 0, 0, -1, 0, 0, 0, 0); - ptr_507BC0 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior, 165, 0); + ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, nullstring, 0); ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, nullstring, 0); ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, nullstring, 0);
--- a/mm7_1.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_1.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -1569,7 +1569,7 @@ { while ( 2 ) { - v4 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v2]]; + v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; for ( result = v4->pControlsHead; result; result = result->pNext ) { if ( result->uHotkey == v3 ) @@ -1619,14 +1619,16 @@ for ( i = uNumVisibleWindows; i >= 0; --i ) { result = 84 * pVisibleWindowsIdxs[i]; - for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) + //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) + for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) j->field_28 = 0; } } for ( k = uNumVisibleWindows; k >= 0; --k ) { result = 84 * pVisibleWindowsIdxs[k]; - for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) + //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) + for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) { LOBYTE(result) = v10; if ( l->uHotkey == v10 ) @@ -1671,7 +1673,7 @@ pFontCreate->field_3 = 0; for (uint i = 0; i < 20; ++i) - pWindowList[i].uWindowType = 0; + pWindowList[i].eWindowType = WINDOW_null; uNumVisibleWindows = -1; memset(pVisibleWindowsIdxs, 0, sizeof(pVisibleWindowsIdxs)); @@ -1753,7 +1755,8 @@ uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE); uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE); uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE); - pGUIWindow0 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Credits, 0, 0); + + pGUIWindow0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); pGUIWindow0->CreateButton(7u, 8u, 0x1CCu, 0x157u, 1, 0, 0xAu, 0, 0, nullstring, 0); pGUIWindow0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, nullstring, 0); pGUIWindow0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, nullstring, 0); @@ -3922,7 +3925,7 @@ char v4; // al@17 bool v5; // eax@21 GUIButton Dst; // [sp+8h] [bp-DCh]@19 - double v7; // [sp+C4h] [bp-20h]@17 + //double v7; // [sp+C4h] [bp-20h]@17 float v8; // [sp+CCh] [bp-18h]@17 __int64 v9; // [sp+D0h] [bp-14h]@17 unsigned int v10; // [sp+D8h] [bp-Ch]@9 @@ -3973,11 +3976,11 @@ } v9 = v3; v8 = (double)v3 * 0.001953125 * 120.0; - v7 = v8 + 6.7553994e15; - HIDWORD(v9) = LODWORD(v7); - v4 = LOBYTE(v7) + 1; - byte_4E2BC8 = LOBYTE(v7) + 1; - if ( (unsigned __int8)(LOBYTE(v7) + 1) >= 0x78u ) + //v7 = v8 + 6.7553994e15; + HIDWORD(v9) = floorf(v8);//LODWORD(v7); + v4 = (int)floorf(v8) % 256 + 1;//LOBYTE(v7) + 1; + byte_4E2BC8 = v4; + if ( (unsigned __int8)(v4) >= 0x78u ) { v4 = 1; byte_4E2BC8 = 1; @@ -5077,7 +5080,7 @@ if ( !v25 ) { if ( v23->IsInteractive() ) - v26 = (const char *)dword_722240[2 * stru_5E4C90.field_0[v24->field_1C]]; + v26 = pNPCTopics[stru_5E4C90.field_0[v24->field_1C] + 379].pTopic; else v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; goto LABEL_87; @@ -5365,7 +5368,7 @@ bRingsShownInCharScreen = 0; CharacterUI_LoadPaperdollTextures(); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = v1; - v2 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_CharacterRecord, uActiveCharacter, 0); + v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0); pCharacterScreen_StatsBtn = v2->CreateButton( pViewport->uViewportX + 12, pViewport->uViewportY + 308, @@ -5474,7 +5477,7 @@ bRingsShownInCharScreen = 0; CharacterUI_LoadPaperdollTextures(); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 23; - v2 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_HouseInterior|WINDOW_Options, v1, 0); + v2 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|WINDOW_Options), v1, 0); ptr_50767C = v2->CreateButton( 394u, 318u,
--- a/mm7_2.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_2.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -546,7 +546,7 @@ { v65 = pFontArrus; pOutString = pFontArrus; - strcpy(pTmpBuf, pStr_72217C); + strcpy(pTmpBuf, pNPCTopics[354].pText); v78.uFrameWidth = 460; v78.uFrameZ = 452; v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; @@ -596,7 +596,7 @@ v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; goto LABEL_98; } - strcpy(pTmpBuf, *(const char **)&dword_721E24[8 * (unsigned int)ptr_507BC0->ptr_1C]); + strcpy(pTmpBuf, pNPCTopics[(uint)ptr_507BC0->ptr_1C + 247].pText); v78.uFrameWidth = 460; v78.uFrameZ = 452; v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); @@ -3132,7 +3132,7 @@ // 50C9DC: using guessed type int dword_50C9DC; //----- (004BBA85) -------------------------------------------------------- -int __cdecl sub_4BBA85_bounties() +const char *sub_4BBA85_bounties() { int v0; // edi@1 signed __int64 v1; // qax@2 @@ -3142,11 +3142,11 @@ __int16 v5; // ax@14 char v6; // zf@14 Player *v7; // ebx@16 - int result; // eax@19 + const char *result; // eax@19 uDialogueType = 83; pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640u, 350u, WINDOW_Credits, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0); ptr_5076F4 = pDialogueWindow->CreateButton( 471u, 445u, @@ -3158,7 +3158,7 @@ 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), + (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, nullstring, 0); pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, nullstring, 0); @@ -3193,9 +3193,9 @@ if ( v6 ) { v6 = v5 == 0; - result = dword_722164; + result = pNPCTopics[351].pText; if ( v6 ) - result = dword_722174; + result = pNPCTopics[353].pText; } else { @@ -3213,16 +3213,11 @@ pParty->field_750[v4] = 0; pParty->field_75A[v4] = 0; } - result = dword_72216C; + result = pNPCTopics[352].pText; } dword_F8B1A4 = (char *)result; return result; } -// 722164: using guessed type int dword_722164; -// 72216C: using guessed type int dword_72216C; -// 722174: using guessed type int dword_722174; -// F8B19C: using guessed type int dword_F8B19C; -// F8B1A0: using guessed type __int16 word_F8B1A0; //----- (004BBCDD) -------------------------------------------------------- void __cdecl sub_4BBCDD() @@ -3698,7 +3693,7 @@ GUIButton *__cdecl sub_4BCA33() { pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x159u, WINDOW_Credits, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); ptr_5076F4 = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, @@ -3814,12 +3809,12 @@ { LABEL_9: pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x159u, WINDOW_Credits, v1, v1); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1); ptr_5076F4 = pDialogueWindow->CreateButton( - 526u, - 445u, - 75u, - 33u, + 526, + 445, + 75, + 33, 1, v1, 0x71u, @@ -4081,9 +4076,9 @@ { v1 = 0; v27 = v26 == v13; - v29 = dword_722164; + v29 = (int)pNPCTopics[351].pText; if ( v27 ) - v29 = dword_722174; + v29 = (int)pNPCTopics[353].pText; dword_F8B1A4 = (char *)v29; } else @@ -4103,7 +4098,7 @@ pParty->field_75A[v25] = v13; } v1 = 0; - dword_F8B1A4 = (char *)dword_72216C; + dword_F8B1A4 = pNPCTopics[352].pText; } goto LABEL_196; } @@ -4121,12 +4116,12 @@ switch ( v55 ) { case 96: - pDialogueWindow->uWindowType = 1; + pDialogueWindow->eWindowType = WINDOW_MainMenu; sub_4BCA33(); sub_4B3703((void *)dword_F8B198); break; case 101: - pDialogueWindow->uWindowType = 1; + pDialogueWindow->eWindowType = WINDOW_MainMenu; sub_4BCA33(); sub_4B3A72(dword_F8B198); break; @@ -4203,7 +4198,7 @@ { if ( v55 == 94 ) { - pDialogueWindow->uWindowType = 1; + pDialogueWindow->eWindowType = WINDOW_MainMenu; sub_4BCA33(); sub_4B3AD4(dword_F8B198); } @@ -5115,7 +5110,7 @@ pRenderer->EndScene(); free(_this.pPixels); _this.pPixels = 0; - ptr_507BC0 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_Credits, 0, 0); + ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); pWindow.uFrameX = 75; pWindow.uFrameY = 60; pWindow.uFrameWidth = 469; @@ -6120,12 +6115,14 @@ //----- (00451007) -------------------------------------------------------- -int stru350::sub_451007_scale_image_bicubic(int a2, signed int a3, signed int a4, int a5, signed int a6, signed int a7, signed int a8, int a9, int a10, int a11) -{ - signed int v11; // esi@1 - signed int result; // eax@1 - signed int v13; // edi@8 - signed int v14; // ecx@10 +int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, + unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, + int a10, int a11) +{ + int v11; // esi@1 + int result; // eax@1 + int v13; // edi@8 + int v14; // ecx@10 double v15; // st7@11 double v16; // st6@11 float v17; // ST3C_4@12 @@ -6135,9 +6132,9 @@ int v21; // eax@18 unsigned int v22; // ecx@25 unsigned int v23; // eax@29 - signed int v24; // ecx@29 - signed int v25; // edi@33 - signed int v26; // ecx@35 + unsigned __int16 *v24; // ecx@29 + int v25; // edi@33 + int v26; // ecx@35 double v27; // st7@36 double v28; // st6@36 float v29; // ST34_4@37 @@ -6146,10 +6143,10 @@ int v32; // eax@41 int v33; // eax@43 unsigned int v34; // ecx@50 - __int16 v35; // ax@54 - signed int v36; // ecx@54 - signed int v37; // edi@58 - signed int v38; // ecx@60 + unsigned __int16 v35; // ax@54 + unsigned __int16 *v36; // ecx@54 + int v37; // edi@58 + int v38; // ecx@60 double v39; // st7@61 double v40; // st6@61 float v41; // ST34_4@62 @@ -6159,9 +6156,9 @@ int v45; // eax@68 unsigned int v46; // ecx@75 char v47; // al@79 - signed int v48; // ecx@79 - signed int v49; // edi@86 - signed int v50; // ecx@88 + unsigned __int16 *v48; // ecx@79 + int v49; // edi@86 + int v50; // ecx@88 double v51; // st7@89 double v52; // st6@89 float v53; // ST34_4@90 @@ -6171,9 +6168,9 @@ int v57; // eax@96 unsigned int v58; // ecx@103 unsigned int v59; // eax@107 - signed int v60; // ecx@107 - signed int v61; // edi@111 - signed int v62; // ecx@113 + unsigned __int16 *v60; // ecx@107 + int v61; // edi@111 + int v62; // ecx@113 double v63; // st7@114 double v64; // st6@114 float v65; // ST34_4@115 @@ -6182,10 +6179,10 @@ int v68; // eax@119 int v69; // eax@121 unsigned int v70; // ecx@128 - __int16 v71; // ax@132 - signed int v72; // ecx@132 - signed int v73; // edi@136 - signed int v74; // ecx@138 + unsigned __int16 v71; // ax@132 + unsigned __int16 *v72; // ecx@132 + int v73; // edi@136 + int v74; // ecx@138 double v75; // st7@139 double v76; // st6@139 float v77; // ST34_4@140 @@ -6195,9 +6192,9 @@ int v81; // eax@146 unsigned int v82; // ecx@153 char v83; // al@157 - signed int v84; // ecx@157 - signed int v85; // edi@164 - signed int v86; // ecx@166 + unsigned __int16 *v84; // ecx@157 + int v85; // edi@164 + int v86; // ecx@166 double v87; // st7@167 double v88; // st6@167 float v89; // ST34_4@168 @@ -6208,9 +6205,9 @@ int v94; // eax@173 unsigned int v95; // ecx@181 unsigned int v96; // eax@185 - signed int v97; // ecx@185 - signed int v98; // edi@189 - signed int v99; // ecx@191 + unsigned __int16 *v97; // ecx@185 + int v98; // edi@189 + int v99; // ecx@191 double v100; // st7@192 double v101; // st6@192 float v102; // ST34_4@193 @@ -6220,10 +6217,10 @@ int v106; // eax@196 int v107; // eax@198 unsigned int v108; // ecx@206 - __int16 v109; // ax@210 - signed int v110; // ecx@210 - signed int v111; // edi@214 - signed int v112; // ecx@216 + unsigned __int16 v109; // ax@210 + unsigned __int16 *v110; // ecx@210 + int v111; // edi@214 + int v112; // ecx@216 double v113; // st7@217 double v114; // st6@217 float v115; // ST34_4@218 @@ -6234,12 +6231,13 @@ int v120; // eax@223 unsigned int v121; // ecx@231 char v122; // al@235 - signed int v123; // ecx@235 + unsigned __int16 *v123; // ecx@235 double v124; // [sp+Ch] [bp-7Ch]@12 double v125; // [sp+Ch] [bp-7Ch]@37 double v126; // [sp+Ch] [bp-7Ch]@62 double v127; // [sp+Ch] [bp-7Ch]@90 - double v128; // [sp+Ch] [bp-7Ch]@115 + //double v128; // [sp+Ch] [bp-7Ch]@115 + uint _v128; double v129; // [sp+Ch] [bp-7Ch]@140 double v130; // [sp+Ch] [bp-7Ch]@168 double v131; // [sp+Ch] [bp-7Ch]@193 @@ -6248,7 +6246,8 @@ double v134; // [sp+14h] [bp-74h]@37 double v135; // [sp+14h] [bp-74h]@62 double v136; // [sp+14h] [bp-74h]@90 - double v137; // [sp+14h] [bp-74h]@115 + //double v137; // [sp+14h] [bp-74h]@115 + uint _v137; double v138; // [sp+14h] [bp-74h]@140 double v139; // [sp+14h] [bp-74h]@168 double v140; // [sp+14h] [bp-74h]@193 @@ -6257,7 +6256,8 @@ double v143; // [sp+1Ch] [bp-6Ch]@37 double v144; // [sp+1Ch] [bp-6Ch]@62 double v145; // [sp+1Ch] [bp-6Ch]@90 - double v146; // [sp+1Ch] [bp-6Ch]@115 + //double v146; // [sp+1Ch] [bp-6Ch]@115 + uint _v146; double v147; // [sp+1Ch] [bp-6Ch]@140 double v148; // [sp+1Ch] [bp-6Ch]@168 double v149; // [sp+1Ch] [bp-6Ch]@193 @@ -6266,7 +6266,8 @@ double v152; // [sp+24h] [bp-64h]@37 double v153; // [sp+24h] [bp-64h]@62 double v154; // [sp+24h] [bp-64h]@90 - double v155; // [sp+24h] [bp-64h]@115 + //double v155; // [sp+24h] [bp-64h]@115 + uint _v155; double v156; // [sp+24h] [bp-64h]@140 double v157; // [sp+24h] [bp-64h]@168 double v158; // [sp+24h] [bp-64h]@193 @@ -6286,43 +6287,43 @@ int v172; // [sp+48h] [bp-40h]@91 int v173; // [sp+48h] [bp-40h]@116 int v174; // [sp+48h] [bp-40h]@141 - int v175; // [sp+4Ch] [bp-3Ch]@13 + unsigned __int16 *v175; // [sp+4Ch] [bp-3Ch]@13 int *v176; // [sp+50h] [bp-38h]@15 int *v177; // [sp+50h] [bp-38h]@40 int *v178; // [sp+50h] [bp-38h]@65 int *v179; // [sp+50h] [bp-38h]@93 int *v180; // [sp+50h] [bp-38h]@118 int *v181; // [sp+50h] [bp-38h]@143 - int v182; // [sp+50h] [bp-38h]@169 - int v183; // [sp+50h] [bp-38h]@194 - int v184; // [sp+50h] [bp-38h]@219 - int v185; // [sp+54h] [bp-34h]@38 - int v186; // [sp+54h] [bp-34h]@63 - int v187; // [sp+54h] [bp-34h]@91 - int v188; // [sp+54h] [bp-34h]@116 - int v189; // [sp+54h] [bp-34h]@141 + char *v182; // [sp+50h] [bp-38h]@169 + char *v183; // [sp+50h] [bp-38h]@194 + char *v184; // [sp+50h] [bp-38h]@219 + unsigned __int16 *v185; // [sp+54h] [bp-34h]@38 + unsigned __int16 *v186; // [sp+54h] [bp-34h]@63 + unsigned __int16 *v187; // [sp+54h] [bp-34h]@91 + unsigned __int16 *v188; // [sp+54h] [bp-34h]@116 + unsigned __int16 *v189; // [sp+54h] [bp-34h]@141 signed int v190; // [sp+54h] [bp-34h]@170 signed int v191; // [sp+54h] [bp-34h]@195 signed int v192; // [sp+54h] [bp-34h]@220 - signed int v193; // [sp+5Ch] [bp-2Ch]@7 - signed int v194; // [sp+5Ch] [bp-2Ch]@32 - signed int v195; // [sp+5Ch] [bp-2Ch]@57 - signed int v196; // [sp+5Ch] [bp-2Ch]@85 - signed int v197; // [sp+5Ch] [bp-2Ch]@110 - signed int v198; // [sp+5Ch] [bp-2Ch]@135 - signed int v199; // [sp+5Ch] [bp-2Ch]@163 - signed int v200; // [sp+5Ch] [bp-2Ch]@188 - signed int v201; // [sp+5Ch] [bp-2Ch]@213 - stru350 *v202; // [sp+60h] [bp-28h]@1 - signed int v203; // [sp+64h] [bp-24h]@12 - signed int v204; // [sp+64h] [bp-24h]@37 - signed int v205; // [sp+64h] [bp-24h]@62 - signed int v206; // [sp+64h] [bp-24h]@90 - signed int v207; // [sp+64h] [bp-24h]@115 - signed int v208; // [sp+64h] [bp-24h]@140 - signed int v209; // [sp+64h] [bp-24h]@168 - signed int v210; // [sp+64h] [bp-24h]@193 - signed int v211; // [sp+64h] [bp-24h]@218 + unsigned __int16 *v193; // [sp+5Ch] [bp-2Ch]@7 + unsigned __int16 *v194; // [sp+5Ch] [bp-2Ch]@32 + unsigned __int16 *v195; // [sp+5Ch] [bp-2Ch]@57 + unsigned __int16 *v196; // [sp+5Ch] [bp-2Ch]@85 + unsigned __int16 *v197; // [sp+5Ch] [bp-2Ch]@110 + unsigned __int16 *v198; // [sp+5Ch] [bp-2Ch]@135 + unsigned __int16 *v199; // [sp+5Ch] [bp-2Ch]@163 + unsigned __int16 *v200; // [sp+5Ch] [bp-2Ch]@188 + unsigned __int16 *v201; // [sp+5Ch] [bp-2Ch]@213 + //stru350 *v202; // [sp+60h] [bp-28h]@1 + int v203; // [sp+64h] [bp-24h]@12 + int v204; // [sp+64h] [bp-24h]@37 + int v205; // [sp+64h] [bp-24h]@62 + int v206; // [sp+64h] [bp-24h]@90 + int v207; // [sp+64h] [bp-24h]@115 + int v208; // [sp+64h] [bp-24h]@140 + int v209; // [sp+64h] [bp-24h]@168 + int v210; // [sp+64h] [bp-24h]@193 + int v211; // [sp+64h] [bp-24h]@218 float v212; // [sp+6Ch] [bp-1Ch]@11 float v213; // [sp+6Ch] [bp-1Ch]@36 float v214; // [sp+6Ch] [bp-1Ch]@61 @@ -6372,52 +6373,52 @@ unsigned int v258; // [sp+84h] [bp-4h]@168 unsigned int v259; // [sp+84h] [bp-4h]@193 unsigned int v260; // [sp+84h] [bp-4h]@218 - signed int v261; // [sp+A0h] [bp+18h]@10 - float v262; // [sp+A0h] [bp+18h]@12 - float v263; // [sp+A0h] [bp+18h]@12 - unsigned int v264; // [sp+A0h] [bp+18h]@12 - signed int v265; // [sp+A0h] [bp+18h]@35 - float v266; // [sp+A0h] [bp+18h]@37 - float v267; // [sp+A0h] [bp+18h]@37 - unsigned int v268; // [sp+A0h] [bp+18h]@37 - signed int v269; // [sp+A0h] [bp+18h]@60 - float v270; // [sp+A0h] [bp+18h]@62 - float v271; // [sp+A0h] [bp+18h]@62 - unsigned int v272; // [sp+A0h] [bp+18h]@62 - signed int v273; // [sp+A0h] [bp+18h]@88 - float v274; // [sp+A0h] [bp+18h]@90 - float v275; // [sp+A0h] [bp+18h]@90 - unsigned int v276; // [sp+A0h] [bp+18h]@90 - signed int v277; // [sp+A0h] [bp+18h]@113 - float v278; // [sp+A0h] [bp+18h]@115 - float v279; // [sp+A0h] [bp+18h]@115 - unsigned int v280; // [sp+A0h] [bp+18h]@115 - signed int v281; // [sp+A0h] [bp+18h]@138 - float v282; // [sp+A0h] [bp+18h]@140 - float v283; // [sp+A0h] [bp+18h]@140 - unsigned int v284; // [sp+A0h] [bp+18h]@140 - signed int v285; // [sp+A0h] [bp+18h]@166 - float v286; // [sp+A0h] [bp+18h]@168 - float v287; // [sp+A0h] [bp+18h]@168 - unsigned int v288; // [sp+A0h] [bp+18h]@168 - signed int v289; // [sp+A0h] [bp+18h]@191 - float v290; // [sp+A0h] [bp+18h]@193 - float v291; // [sp+A0h] [bp+18h]@193 - unsigned int v292; // [sp+A0h] [bp+18h]@193 - signed int v293; // [sp+A0h] [bp+18h]@216 - float v294; // [sp+A0h] [bp+18h]@218 - float v295; // [sp+A0h] [bp+18h]@218 - unsigned int v296; // [sp+A0h] [bp+18h]@218 - int v297; // [sp+ACh] [bp+24h]@8 - int v298; // [sp+ACh] [bp+24h]@33 - int v299; // [sp+ACh] [bp+24h]@86 - int v300; // [sp+ACh] [bp+24h]@111 - int v301; // [sp+ACh] [bp+24h]@164 - int v302; // [sp+ACh] [bp+24h]@189 + signed int a6a; // [sp+A0h] [bp+18h]@10 + float a6s; // [sp+A0h] [bp+18h]@12 + float a6t; // [sp+A0h] [bp+18h]@12 + unsigned int a6b; // [sp+A0h] [bp+18h]@12 + signed int a6c; // [sp+A0h] [bp+18h]@35 + float a6u; // [sp+A0h] [bp+18h]@37 + float a6v; // [sp+A0h] [bp+18h]@37 + unsigned int a6d; // [sp+A0h] [bp+18h]@37 + signed int a6e; // [sp+A0h] [bp+18h]@60 + float a6w; // [sp+A0h] [bp+18h]@62 + float a6x; // [sp+A0h] [bp+18h]@62 + unsigned int a6f; // [sp+A0h] [bp+18h]@62 + signed int a6g; // [sp+A0h] [bp+18h]@88 + float a6y; // [sp+A0h] [bp+18h]@90 + float a6z; // [sp+A0h] [bp+18h]@90 + unsigned int a6h; // [sp+A0h] [bp+18h]@90 + signed int a6i; // [sp+A0h] [bp+18h]@113 + float a6ba; // [sp+A0h] [bp+18h]@115 + float a6bb; // [sp+A0h] [bp+18h]@115 + unsigned int a6j; // [sp+A0h] [bp+18h]@115 + signed int a6k; // [sp+A0h] [bp+18h]@138 + float a6bc; // [sp+A0h] [bp+18h]@140 + float a6bd; // [sp+A0h] [bp+18h]@140 + unsigned int a6l; // [sp+A0h] [bp+18h]@140 + signed int a6m; // [sp+A0h] [bp+18h]@166 + float a6be; // [sp+A0h] [bp+18h]@168 + float a6bf; // [sp+A0h] [bp+18h]@168 + unsigned int a6n; // [sp+A0h] [bp+18h]@168 + signed int a6o; // [sp+A0h] [bp+18h]@191 + float a6bg; // [sp+A0h] [bp+18h]@193 + float a6bh; // [sp+A0h] [bp+18h]@193 + unsigned int a6p; // [sp+A0h] [bp+18h]@193 + signed int a6q; // [sp+A0h] [bp+18h]@216 + float a6bi; // [sp+A0h] [bp+18h]@218 + float a6bj; // [sp+A0h] [bp+18h]@218 + unsigned int a6r; // [sp+A0h] [bp+18h]@218 + int a9a; // [sp+ACh] [bp+24h]@8 + int a9b; // [sp+ACh] [bp+24h]@33 + int a9c; // [sp+ACh] [bp+24h]@86 + int a9d; // [sp+ACh] [bp+24h]@111 + int a9e; // [sp+ACh] [bp+24h]@164 + int a9f; // [sp+ACh] [bp+24h]@189 v11 = 0; - result = this->field_0[3]; - v202 = this; + result = this->field_0.field_C; + //v202 = this; v230 = 0; if ( result != 8 ) { @@ -6425,47 +6426,47 @@ { if ( result != 32 ) return result; - result = this->array_20[3]; + result = this->field_20.field_C; if ( result != 8 ) { if ( result != 16 ) { - if ( result != 32 || (result = a6, v193 = a6, v231 = 0, a8 <= 0) ) + if ( result != 32 || (result = (int)pDst, v193 = pDst, v231 = 0, dstHeight <= 0) ) return result; - v13 = a7; - v297 = 4 * (a9 - a7); + v13 = dstWidth; + a9a = 4 * (dstPitch - dstWidth); while ( 1 ) { v14 = 0; - v261 = 0; - if ( a7 > v11 ) + a6a = 0; + if ( dstWidth > v11 ) break; LABEL_30: - v193 += v297; + v193 = (unsigned __int16 *)((char *)v193 + a9a); ++v231; result = v231; - if ( v231 >= a8 ) + if ( v231 >= dstHeight ) return result; v11 = 0; } - v221 = (double)a7; - v212 = (double)a3; - v15 = (double)a8; - v16 = (double)a4; + v221 = (double)dstWidth; + v212 = (double)srcWidth; + v15 = (double)dstHeight; + v16 = (double)srcHeight; while ( 1 ) { - v262 = (double)v261 / v221 * v212; - v151 = v262 + 6.7553994e15; + a6s = (double)a6a / v221 * v212; + v151 = floorf(a6s);//a6s + 6.7553994e15; v203 = v14 + 1; - v263 = (double)(v14 + 1) / v221 * v212; - v142 = v263 + 6.7553994e15; + a6t = (double)(v14 + 1) / v221 * v212; + v142 = floorf(a6t);//a6t + 6.7553994e15; v17 = (double)v231 / v15 * v16; - v133 = v17 + 6.7553994e15; + v133 = floorf(v17);//v17 + 6.7553994e15; v18 = (double)(v231 + 1) / v15 * v16; - v124 = v18 + 6.7553994e15; + v124 = floorf(v18);//v18 + 6.7553994e15; v19 = (LODWORD(v124) - LODWORD(v133)) * (LODWORD(v142) - LODWORD(v151)); v252 = 0; - v264 = 0; + a6b = 0; v240 = 0i64; if ( SLODWORD(v133) < SLODWORD(v124) ) break; @@ -6473,27 +6474,27 @@ v22 = (unsigned int)v240 / ((LODWORD(v124) - LODWORD(v133)) * (LODWORD(v142) - LODWORD(v151))); if ( v19 ) { - v264 /= v19; + a6b /= v19; v252 /= v19; HIDWORD(v240) /= v19; } if ( v22 != 255 ) v22 &= 0x7FFFFFFFu; - v23 = v202->_450F55(HIDWORD(v240) | ((v252 | ((v264 | (v22 << 8)) << 8)) << 8)); + v23 = _450F55(HIDWORD(v240) | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); v24 = v193; - v193 += 4; - *(int *)v24 = v23; + v193 += 2; + *(_DWORD *)v24 = v23; v14 = v203; - v261 = v203; - if ( v203 >= a7 ) + a6a = v203; + if ( v203 >= dstWidth ) goto LABEL_30; } v160 = LODWORD(v124) - LODWORD(v133); - v175 = a2 + 4 * (LODWORD(v151) + a5 * LODWORD(v133)); + v175 = &pSrc[2 * (LODWORD(v151) + srcPitch * LODWORD(v133))]; while ( SLODWORD(v151) >= SLODWORD(v142) ) { LABEL_24: - v175 += 4 * a5; + v175 += 2 * srcPitch; --v160; if ( !v160 ) goto LABEL_25; @@ -6508,7 +6509,7 @@ v230 = 1; v13 = v20 != a11 ? 0xFF : 0; } - v21 = v202->_450FB1(v20); + v21 = _450FB1(v20); if ( !v230 ) break; LODWORD(v240) = v13 + v240; @@ -6524,50 +6525,50 @@ } LODWORD(v240) = ((unsigned int)v21 >> 24) + v240; LABEL_22: - v264 += BYTE2(v21); + a6b += BYTE2(v21); v252 += BYTE1(v21); HIDWORD(v240) += (unsigned __int8)v21; goto LABEL_23; } - result = a6; - v194 = a6; + result = (int)pDst; + v194 = pDst; v232 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v25 = a7; - v298 = 2 * (a9 - a7); + v25 = dstWidth; + a9b = 2 * (dstPitch - dstWidth); while ( 1 ) { v26 = 0; - v265 = 0; - if ( a7 > v11 ) + a6c = 0; + if ( dstWidth > v11 ) break; LABEL_55: - v194 += v298; + v194 = (unsigned __int16 *)((char *)v194 + a9b); ++v232; result = v232; - if ( v232 >= a8 ) + if ( v232 >= dstHeight ) return result; v11 = 0; } - v222 = (double)a7; - v213 = (double)a3; - v27 = (double)a8; - v28 = (double)a4; + v222 = (double)dstWidth; + v213 = (double)srcWidth; + v27 = (double)dstHeight; + v28 = (double)srcHeight; while ( 1 ) { - v266 = (double)v265 / v222 * v213; - v125 = v266 + 6.7553994e15; + a6u = (double)a6c / v222 * v213; + v125 = a6u + 6.7553994e15; v204 = v26 + 1; - v267 = (double)(v26 + 1) / v222 * v213; - v134 = v267 + 6.7553994e15; + a6v = (double)(v26 + 1) / v222 * v213; + v134 = a6v + 6.7553994e15; v29 = (double)v232 / v27 * v28; v143 = v29 + 6.7553994e15; v30 = (double)(v232 + 1) / v27 * v28; v152 = v30 + 6.7553994e15; v31 = (LODWORD(v152) - LODWORD(v143)) * (LODWORD(v134) - LODWORD(v125)); v253 = 0; - v268 = 0; + a6d = 0; v241 = 0i64; if ( SLODWORD(v143) < SLODWORD(v152) ) break; @@ -6575,27 +6576,27 @@ v34 = (unsigned int)v241 / ((LODWORD(v152) - LODWORD(v143)) * (LODWORD(v134) - LODWORD(v125))); if ( v31 ) { - v268 /= v31; + a6d /= v31; v253 /= v31; HIDWORD(v241) /= v31; } if ( v34 != 255 ) v34 &= 0x7FFFFFFFu; - v35 = v202->_450F55(HIDWORD(v241) | ((v253 | ((v268 | (v34 << 8)) << 8)) << 8)); + v35 = _450F55(HIDWORD(v241) | ((v253 | ((a6d | (v34 << 8)) << 8)) << 8)); v36 = v194; - v194 += 2; - *(short *)v36 = v35; + ++v194; + *v36 = v35; v26 = v204; - v265 = v204; - if ( v204 >= a7 ) + a6c = v204; + if ( v204 >= dstWidth ) goto LABEL_55; } v170 = LODWORD(v152) - LODWORD(v143); - v185 = a2 + 4 * (LODWORD(v125) + a5 * LODWORD(v143)); + v185 = &pSrc[2 * (LODWORD(v125) + srcPitch * LODWORD(v143))]; while ( SLODWORD(v125) >= SLODWORD(v134) ) { LABEL_49: - v185 += 4 * a5; + v185 += 2 * srcPitch; --v170; if ( !v170 ) goto LABEL_50; @@ -6610,7 +6611,7 @@ v230 = 1; v25 = v32 != a11 ? 0xFF : 0; } - v33 = v202->_450FB1(v32); + v33 = _450FB1(v32); if ( !v230 ) break; LODWORD(v241) = v25 + v241; @@ -6626,49 +6627,49 @@ } LODWORD(v241) = ((unsigned int)v33 >> 24) + v241; LABEL_47: - v268 += BYTE2(v33); + a6d += BYTE2(v33); v253 += BYTE1(v33); HIDWORD(v241) += (unsigned __int8)v33; goto LABEL_48; } - result = a6; - v195 = a6; + result = (int)pDst; + v195 = pDst; v233 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v37 = a7; + v37 = dstWidth; while ( 1 ) { v38 = 0; - v269 = 0; - if ( a7 > v11 ) + a6e = 0; + if ( dstWidth > v11 ) break; LABEL_80: - v195 += a9 - a7; + v195 = (unsigned __int16 *)((char *)v195 + dstPitch - dstWidth); ++v233; result = v233; - if ( v233 >= a8 ) + if ( v233 >= dstHeight ) return result; v11 = 0; } - v223 = (double)a7; - v214 = (double)a3; - v39 = (double)a8; - v40 = (double)a4; + v223 = (double)dstWidth; + v214 = (double)srcWidth; + v39 = (double)dstHeight; + v40 = (double)srcHeight; while ( 1 ) { - v270 = (double)v269 / v223 * v214; - v126 = v270 + 6.7553994e15; + a6w = (double)a6e / v223 * v214; + v126 = a6w + 6.7553994e15; v205 = v38 + 1; - v271 = (double)(v38 + 1) / v223 * v214; - v135 = v271 + 6.7553994e15; + a6x = (double)(v38 + 1) / v223 * v214; + v135 = a6x + 6.7553994e15; v41 = (double)v233 / v39 * v40; v144 = v41 + 6.7553994e15; v42 = (double)(v233 + 1) / v39 * v40; v153 = v42 + 6.7553994e15; v43 = (LODWORD(v153) - LODWORD(v144)) * (LODWORD(v135) - LODWORD(v126)); v254 = 0; - v272 = 0; + a6f = 0; v242 = 0i64; if ( SLODWORD(v144) < SLODWORD(v153) ) break; @@ -6676,26 +6677,27 @@ v46 = (unsigned int)v242 / ((LODWORD(v153) - LODWORD(v144)) * (LODWORD(v135) - LODWORD(v126))); if ( v43 ) { - v272 /= v43; + a6f /= v43; v254 /= v43; HIDWORD(v242) /= v43; } if ( v46 != 255 ) v46 &= 0x7FFFFFFFu; - v47 = v202->_450F55(HIDWORD(v242) | ((v254 | ((v272 | (v46 << 8)) << 8)) << 8)); - v48 = v195++; - *(char *)v48 = v47; + v47 = _450F55(HIDWORD(v242) | ((v254 | ((a6f | (v46 << 8)) << 8)) << 8)); + v48 = v195; + v195 = (unsigned __int16 *)((char *)v195 + 1); + *(_BYTE *)v48 = v47; v38 = v205; - v269 = v205; - if ( v205 >= a7 ) + a6e = v205; + if ( v205 >= dstWidth ) goto LABEL_80; } v171 = LODWORD(v153) - LODWORD(v144); - v186 = a2 + 4 * (LODWORD(v126) + a5 * LODWORD(v144)); + v186 = &pSrc[2 * (LODWORD(v126) + srcPitch * LODWORD(v144))]; while ( SLODWORD(v126) >= SLODWORD(v135) ) { LABEL_74: - v186 += 4 * a5; + v186 += 2 * srcPitch; --v171; if ( !v171 ) goto LABEL_75; @@ -6710,7 +6712,7 @@ v230 = 1; v37 = v44 != a11 ? 0xFF : 0; } - v45 = v202->_450FB1(v44); + v45 = _450FB1(v44); if ( !v230 ) break; LODWORD(v242) = v37 + v242; @@ -6726,52 +6728,52 @@ } LODWORD(v242) = ((unsigned int)v45 >> 24) + v242; LABEL_72: - v272 += BYTE2(v45); + a6f += BYTE2(v45); v254 += BYTE1(v45); HIDWORD(v242) += (unsigned __int8)v45; goto LABEL_73; } - result = this->array_20[3]; + result = this->field_20.field_C; if ( result != 8 ) { if ( result != 16 ) { - if ( result != 32 || (result = a6, v196 = a6, v234 = 0, a8 <= 0) ) + if ( result != 32 || (result = (int)pDst, v196 = pDst, v234 = 0, dstHeight <= 0) ) return result; - v49 = a7; - v299 = 4 * (a9 - a7); + v49 = dstWidth; + a9c = 4 * (dstPitch - dstWidth); while ( 1 ) { v50 = 0; - v273 = 0; - if ( a7 > v11 ) + a6g = 0; + if ( dstWidth > v11 ) break; LABEL_108: - v196 += v299; + v196 = (unsigned __int16 *)((char *)v196 + a9c); ++v234; result = v234; - if ( v234 >= a8 ) + if ( v234 >= dstHeight ) return result; v11 = 0; } - v224 = (double)a7; - v215 = (double)a3; - v51 = (double)a8; - v52 = (double)a4; + v224 = (double)dstWidth; + v215 = (double)srcWidth; + v51 = (double)dstHeight; + v52 = (double)srcHeight; while ( 1 ) { - v274 = (double)v273 / v224 * v215; - v127 = v274 + 6.7553994e15; + a6y = (double)a6g / v224 * v215; + v127 = a6y + 6.7553994e15; v206 = v50 + 1; - v275 = (double)(v50 + 1) / v224 * v215; - v136 = v275 + 6.7553994e15; + a6z = (double)(v50 + 1) / v224 * v215; + v136 = a6z + 6.7553994e15; v53 = (double)v234 / v51 * v52; v145 = v53 + 6.7553994e15; v54 = (double)(v234 + 1) / v51 * v52; v154 = v54 + 6.7553994e15; v55 = (LODWORD(v154) - LODWORD(v145)) * (LODWORD(v136) - LODWORD(v127)); v255 = 0; - v276 = 0; + a6h = 0; v243 = 0i64; if ( SLODWORD(v145) < SLODWORD(v154) ) break; @@ -6779,27 +6781,27 @@ v58 = (unsigned int)v243 / ((LODWORD(v154) - LODWORD(v145)) * (LODWORD(v136) - LODWORD(v127))); if ( v55 ) { - v276 /= v55; + a6h /= v55; v255 /= v55; HIDWORD(v243) /= v55; } if ( v58 != 255 ) v58 &= 0x7FFFFFFFu; - v59 = v202->_450F55(HIDWORD(v243) | ((v255 | ((v276 | (v58 << 8)) << 8)) << 8)); + v59 = _450F55(HIDWORD(v243) | ((v255 | ((a6h | (v58 << 8)) << 8)) << 8)); v60 = v196; - v196 += 4; - *(int *)v60 = v59; + v196 += 2; + *(_DWORD *)v60 = v59; v50 = v206; - v273 = v206; - if ( v206 >= a7 ) + a6g = v206; + if ( v206 >= dstWidth ) goto LABEL_108; } v172 = LODWORD(v154) - LODWORD(v145); - v187 = a2 + 2 * (LODWORD(v127) + a5 * LODWORD(v145)); + v187 = &pSrc[LODWORD(v127) + srcPitch * LODWORD(v145)]; while ( SLODWORD(v127) >= SLODWORD(v136) ) { LABEL_102: - v187 += 2 * a5; + v187 += srcPitch; --v172; if ( !v172 ) goto LABEL_103; @@ -6808,13 +6810,13 @@ v164 = LODWORD(v136) - LODWORD(v127); while ( 1 ) { - v56 = *(short *)v179; + v56 = *(_WORD *)v179; if ( a10 ) { v230 = 1; v49 = v56 != a11 ? 0xFF : 0; } - v57 = v202->_450FB1(v56); + v57 = _450FB1(v56); if ( !v230 ) break; LODWORD(v243) = v49 + v243; @@ -6830,93 +6832,104 @@ } LODWORD(v243) = ((unsigned int)v57 >> 24) + v243; LABEL_100: - v276 += BYTE2(v57); + a6h += BYTE2(v57); v255 += BYTE1(v57); HIDWORD(v243) += (unsigned __int8)v57; goto LABEL_101; } - result = a6; - v197 = a6; + result = (int)pDst; + v197 = pDst; v235 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v61 = a7; - v300 = 2 * (a9 - a7); + v61 = dstWidth; + a9d = 2 * (dstPitch - dstWidth); while ( 1 ) { v62 = 0; - v277 = 0; - if ( a7 > v11 ) + a6i = 0; + if ( dstWidth > v11 ) break; LABEL_133: - v197 += v300; + v197 = (unsigned __int16 *)((char *)v197 + a9d); ++v235; result = v235; - if ( v235 >= a8 ) + if ( v235 >= dstHeight ) return result; v11 = 0; } - v225 = (double)a7; - v216 = (double)a3; - v63 = (double)a8; - v64 = (double)a4; + v225 = (double)dstWidth; + v216 = (double)srcWidth; + v63 = (double)dstHeight; + v64 = (double)srcHeight; while ( 1 ) { - v278 = (double)v277 / v225 * v216; - v128 = v278 + 6.7553994e15; + a6ba = (double)a6i / v225 * v216; + _v128 = floorf(a6ba); + //v128 = a6ba + 6.7553994e15; v207 = v62 + 1; - v279 = (double)(v62 + 1) / v225 * v216; - v137 = v279 + 6.7553994e15; + a6bb = (double)(v62 + 1) / v225 * v216; + //v137 = a6bb + 6.7553994e15; + _v137 = floorf(a6bb); v65 = (double)v235 / v63 * v64; - v146 = v65 + 6.7553994e15; + //v146 = v65 + 6.7553994e15; + _v146 = floorf(v65); v66 = (double)(v235 + 1) / v63 * v64; - v155 = v66 + 6.7553994e15; - v67 = (LODWORD(v155) - LODWORD(v146)) * (LODWORD(v137) - LODWORD(v128)); + //v155 = v66 + 6.7553994e15; + _v155 = floorf(v66); + //v67 = (LODWORD(v155) - LODWORD(v146)) * (LODWORD(v137) - LODWORD(v128)); + v67 = (_v155 - _v146) * (_v137 - _v128); v256 = 0; - v280 = 0; + a6j = 0; v244 = 0i64; - if ( SLODWORD(v146) < SLODWORD(v155) ) + //if ( SLODWORD(v146) < SLODWORD(v155) ) + if (_v146 < _v155) break; LABEL_128: - v70 = (unsigned int)v244 / ((LODWORD(v155) - LODWORD(v146)) * (LODWORD(v137) - LODWORD(v128))); + //v70 = (unsigned int)v244 / ((LODWORD(v155) - LODWORD(v146)) * (LODWORD(v137) - LODWORD(v128))); + v70 = (unsigned int)v244 / ((_v155 - _v146) * (_v137 - _v128)); if ( v67 ) { - v280 /= v67; + a6j /= v67; v256 /= v67; HIDWORD(v244) /= v67; } if ( v70 != 255 ) v70 &= 0x7FFFFFFFu; - v71 = v202->_450F55(HIDWORD(v244) | ((v256 | ((v280 | (v70 << 8)) << 8)) << 8)); + v71 = _450F55(HIDWORD(v244) | ((v256 | ((a6j | (v70 << 8)) << 8)) << 8)); v72 = v197; - v197 += 2; - *(short *)v72 = v71; + ++v197; + *v72 = v71; v62 = v207; - v277 = v207; - if ( v207 >= a7 ) + a6i = v207; + if ( v207 >= dstWidth ) goto LABEL_133; } - v173 = LODWORD(v155) - LODWORD(v146); - v188 = a2 + 2 * (LODWORD(v128) + a5 * LODWORD(v146)); - while ( SLODWORD(v128) >= SLODWORD(v137) ) + //v173 = LODWORD(v155) - LODWORD(v146); + v173 = _v155 - _v146; + //v188 = &pSrc[LODWORD(v128) + srcPitch * LODWORD(v146)]; + v188 = &pSrc[_v128 + srcPitch * _v146]; + //while ( SLODWORD(v128) >= SLODWORD(v137) ) + while (_v128 >= _v137) { LABEL_127: - v188 += 2 * a5; + v188 += srcPitch; --v173; if ( !v173 ) goto LABEL_128; } v180 = (int *)v188; - v165 = LODWORD(v137) - LODWORD(v128); + //v165 = LODWORD(v137) - LODWORD(v128); + v165 = _v137 - _v128; while ( 1 ) { - v68 = *(short *)v180; + v68 = *(_WORD *)v180; if ( a10 ) { v230 = 1; v61 = v68 != a11 ? 0xFF : 0; } - v69 = v202->_450FB1(v68); + v69 = _450FB1(v68); if ( !v230 ) break; LODWORD(v244) = v61 + v244; @@ -6932,49 +6945,49 @@ } LODWORD(v244) = ((unsigned int)v69 >> 24) + v244; LABEL_125: - v280 += BYTE2(v69); + a6j += BYTE2(v69); v256 += BYTE1(v69); HIDWORD(v244) += (unsigned __int8)v69; goto LABEL_126; } - result = a6; - v198 = a6; + result = (int)pDst; + v198 = pDst; v236 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v73 = a7; + v73 = dstWidth; while ( 1 ) { v74 = 0; - v281 = 0; - if ( a7 > v11 ) + a6k = 0; + if ( dstWidth > v11 ) break; LABEL_158: - v198 += a9 - a7; + v198 = (unsigned __int16 *)((char *)v198 + dstPitch - dstWidth); ++v236; result = v236; - if ( v236 >= a8 ) + if ( v236 >= dstHeight ) return result; v11 = 0; } - v226 = (double)a7; - v217 = (double)a3; - v75 = (double)a8; - v76 = (double)a4; + v226 = (double)dstWidth; + v217 = (double)srcWidth; + v75 = (double)dstHeight; + v76 = (double)srcHeight; while ( 1 ) { - v282 = (double)v281 / v226 * v217; - v129 = v282 + 6.7553994e15; + a6bc = (double)a6k / v226 * v217; + v129 = a6bc + 6.7553994e15; v208 = v74 + 1; - v283 = (double)(v74 + 1) / v226 * v217; - v138 = v283 + 6.7553994e15; + a6bd = (double)(v74 + 1) / v226 * v217; + v138 = a6bd + 6.7553994e15; v77 = (double)v236 / v75 * v76; v147 = v77 + 6.7553994e15; v78 = (double)(v236 + 1) / v75 * v76; v156 = v78 + 6.7553994e15; v257 = 0; v79 = (LODWORD(v156) - LODWORD(v147)) * (LODWORD(v138) - LODWORD(v129)); - v284 = 0; + a6l = 0; v245 = 0i64; if ( SLODWORD(v147) < SLODWORD(v156) ) break; @@ -6982,26 +6995,27 @@ v82 = (unsigned int)v245 / ((LODWORD(v156) - LODWORD(v147)) * (LODWORD(v138) - LODWORD(v129))); if ( v79 ) { - v284 /= v79; + a6l /= v79; v257 /= v79; HIDWORD(v245) /= v79; } if ( v82 != 255 ) v82 &= 0x7FFFFFFFu; - v83 = v202->_450F55(HIDWORD(v245) | ((v257 | ((v284 | (v82 << 8)) << 8)) << 8)); - v84 = v198++; - *(char *)v84 = v83; + v83 = _450F55(HIDWORD(v245) | ((v257 | ((a6l | (v82 << 8)) << 8)) << 8)); + v84 = v198; + v198 = (unsigned __int16 *)((char *)v198 + 1); + *(_BYTE *)v84 = v83; v74 = v208; - v281 = v208; - if ( v208 >= a7 ) + a6k = v208; + if ( v208 >= dstWidth ) goto LABEL_158; } v174 = LODWORD(v156) - LODWORD(v147); - v189 = a2 + 2 * (LODWORD(v129) + a5 * LODWORD(v147)); + v189 = &pSrc[LODWORD(v129) + srcPitch * LODWORD(v147)]; while ( SLODWORD(v129) >= SLODWORD(v138) ) { LABEL_152: - v189 += 2 * a5; + v189 += srcPitch; --v174; if ( !v174 ) goto LABEL_153; @@ -7010,13 +7024,13 @@ v181 = (int *)v189; while ( 1 ) { - v80 = *(short *)v181; + v80 = *(_WORD *)v181; if ( a10 ) { v230 = 1; v73 = v80 != a11 ? 0xFF : 0; } - v81 = v202->_450FB1(v80); + v81 = _450FB1(v80); if ( !v230 ) break; LODWORD(v245) = v73 + v245; @@ -7032,37 +7046,37 @@ } LODWORD(v245) = ((unsigned int)v81 >> 24) + v245; LABEL_150: - v284 += BYTE2(v81); + a6l += BYTE2(v81); v257 += BYTE1(v81); HIDWORD(v245) += (unsigned __int8)v81; goto LABEL_151; } - result = this->array_20[3]; + result = this->field_20.field_C; if ( result == 8 ) { - result = a6; - v201 = a6; + result = (int)pDst; + v201 = pDst; v239 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v111 = a7; + v111 = dstWidth; while ( 1 ) { v112 = 0; - v293 = 0; - if ( a7 <= v11 ) + a6q = 0; + if ( dstWidth <= v11 ) goto LABEL_236; - v229 = (double)a7; - v220 = (double)a3; - v113 = (double)a8; - v114 = (double)a4; + v229 = (double)dstWidth; + v220 = (double)srcWidth; + v113 = (double)dstHeight; + v114 = (double)srcHeight; do { - v294 = (double)v293 / v229 * v220; - v132 = v294 + 6.7553994e15; + a6bi = (double)a6q / v229 * v220; + v132 = a6bi + 6.7553994e15; v211 = v112 + 1; - v295 = (double)(v112 + 1) / v229 * v220; - v141 = v295 + 6.7553994e15; + a6bj = (double)(v112 + 1) / v229 * v220; + v141 = a6bj + 6.7553994e15; v115 = (double)v239 / v113 * v114; v150 = v115 + 6.7553994e15; v116 = (double)(v239 + 1) / v113 * v114; @@ -7070,25 +7084,25 @@ v251 = 0; v117 = (LODWORD(v159) - LODWORD(v150)) * (LODWORD(v141) - LODWORD(v132)); v260 = 0; - v296 = 0; + a6r = 0; v248 = 0; if ( SLODWORD(v150) >= SLODWORD(v159) ) goto LABEL_231; v169 = LODWORD(v159) - LODWORD(v150); - v184 = a2 + a5 * LODWORD(v150); + v184 = (char *)pSrc + srcPitch * LODWORD(v150); do { v118 = LODWORD(v132); v192 = LODWORD(v132); while ( v118 < SLODWORD(v141) ) { - v119 = *(char *)(v184 + v192); + v119 = (unsigned __int8)v184[v192]; if ( a10 ) { v230 = 1; v111 = v119 != a11 ? 0xFF : 0; } - v120 = v202->_450FB1(v119); + v120 = _450FB1(v119); if ( v230 ) { v248 += v111; @@ -7103,14 +7117,14 @@ { v248 += (unsigned int)v120 >> 24; } - v296 += BYTE2(v120); + a6r += BYTE2(v120); v260 += BYTE1(v120); v251 += (unsigned __int8)v120; LABEL_228: ++v192; v118 = v192; } - v184 += a5; + v184 += srcPitch; --v169; } while ( v169 ); @@ -7118,54 +7132,55 @@ v121 = v248 / ((LODWORD(v159) - LODWORD(v150)) * (LODWORD(v141) - LODWORD(v132))); if ( v117 ) { - v296 /= v117; + a6r /= v117; v260 /= v117; v251 /= v117; } if ( v121 != 255 ) v121 &= 0x7FFFFFFFu; - v122 = v202->_450F55(v251 | ((v260 | ((v296 | (v121 << 8)) << 8)) << 8)); - v123 = v201++; - *(char *)v123 = v122; + v122 = _450F55(v251 | ((v260 | ((a6r | (v121 << 8)) << 8)) << 8)); + v123 = v201; + v201 = (unsigned __int16 *)((char *)v201 + 1); + *(_BYTE *)v123 = v122; v112 = v211; - v293 = v211; - } - while ( v211 < a7 ); + a6q = v211; + } + while ( v211 < dstWidth ); LABEL_236: - v201 += a9 - a7; + v201 = (unsigned __int16 *)((char *)v201 + dstPitch - dstWidth); ++v239; result = v239; - if ( v239 >= a8 ) + if ( v239 >= dstHeight ) return result; v11 = 0; } } if ( result == 16 ) { - result = a6; - v200 = a6; + result = (int)pDst; + v200 = pDst; v238 = 0; - if ( a8 <= 0 ) + if ( dstHeight <= 0 ) return result; - v98 = a7; - v302 = 2 * (a9 - a7); + v98 = dstWidth; + a9f = 2 * (dstPitch - dstWidth); while ( 1 ) { v99 = 0; - v289 = 0; - if ( a7 <= v11 ) + a6o = 0; + if ( dstWidth <= v11 ) goto LABEL_211; - v228 = (double)a7; - v219 = (double)a3; - v100 = (double)a8; - v101 = (double)a4; + v228 = (double)dstWidth; + v219 = (double)srcWidth; + v100 = (double)dstHeight; + v101 = (double)srcHeight; do { - v290 = (double)v289 / v228 * v219; - v131 = v290 + 6.7553994e15; + a6bg = (double)a6o / v228 * v219; + v131 = a6bg + 6.7553994e15; v210 = v99 + 1; - v291 = (double)(v99 + 1) / v228 * v219; - v140 = v291 + 6.7553994e15; + a6bh = (double)(v99 + 1) / v228 * v219; + v140 = a6bh + 6.7553994e15; v102 = (double)v238 / v100 * v101; v149 = v102 + 6.7553994e15; v103 = (double)(v238 + 1) / v100 * v101; @@ -7173,25 +7188,25 @@ v250 = 0; v104 = (LODWORD(v158) - LODWORD(v149)) * (LODWORD(v140) - LODWORD(v131)); v259 = 0; - v292 = 0; + a6p = 0; v247 = 0; if ( SLODWORD(v149) >= SLODWORD(v158) ) goto LABEL_206; v168 = LODWORD(v158) - LODWORD(v149); - v183 = a2 + a5 * LODWORD(v149); + v183 = (char *)pSrc + srcPitch * LODWORD(v149); do { v105 = LODWORD(v131); v191 = LODWORD(v131); while ( v105 < SLODWORD(v140) ) { - v106 = *(char *)(v183 + v191); + v106 = (unsigned __int8)v183[v191]; if ( a10 ) { v230 = 1; v98 = v106 != a11 ? 0xFF : 0; } - v107 = v202->_450FB1(v106); + v107 = _450FB1(v106); if ( v230 ) { v247 += v98; @@ -7206,14 +7221,14 @@ { v247 += (unsigned int)v107 >> 24; } - v292 += BYTE2(v107); + a6p += BYTE2(v107); v259 += BYTE1(v107); v250 += (unsigned __int8)v107; LABEL_203: ++v191; v105 = v191; } - v183 += a5; + v183 += srcPitch; --v168; } while ( v168 ); @@ -7221,50 +7236,50 @@ v108 = v247 / ((LODWORD(v158) - LODWORD(v149)) * (LODWORD(v140) - LODWORD(v131))); if ( v104 ) { - v292 /= v104; + a6p /= v104; v259 /= v104; v250 /= v104; } if ( v108 != 255 ) v108 &= 0x7FFFFFFFu; - v109 = v202->_450F55(v250 | ((v259 | ((v292 | (v108 << 8)) << 8)) << 8)); + v109 = _450F55(v250 | ((v259 | ((a6p | (v108 << 8)) << 8)) << 8)); v110 = v200; - v200 += 2; - *(short *)v110 = v109; + ++v200; + *v110 = v109; v99 = v210; - v289 = v210; - } - while ( v210 < a7 ); + a6o = v210; + } + while ( v210 < dstWidth ); LABEL_211: - v200 += v302; + v200 = (unsigned __int16 *)((char *)v200 + a9f); ++v238; result = v238; - if ( v238 >= a8 ) + if ( v238 >= dstHeight ) return result; v11 = 0; } } - if ( result != 32 || (result = a6, v199 = a6, v237 = 0, a8 <= 0) ) + if ( result != 32 || (result = (int)pDst, v199 = pDst, v237 = 0, dstHeight <= 0) ) return result; - v85 = a7; - v301 = 4 * (a9 - a7); + v85 = dstWidth; + a9e = 4 * (dstPitch - dstWidth); while ( 2 ) { v86 = 0; - v285 = 0; - if ( a7 <= v11 ) + a6m = 0; + if ( dstWidth <= v11 ) goto LABEL_186; - v227 = (double)a7; - v218 = (double)a3; - v87 = (double)a8; - v88 = (double)a4; - do - { - v286 = (double)v285 / v227 * v218; - v130 = v286 + 6.7553994e15; + v227 = (double)dstWidth; + v218 = (double)srcWidth; + v87 = (double)dstHeight; + v88 = (double)srcHeight; + do + { + a6be = (double)a6m / v227 * v218; + v130 = a6be + 6.7553994e15; v209 = v86 + 1; - v287 = (double)(v86 + 1) / v227 * v218; - v139 = v287 + 6.7553994e15; + a6bf = (double)(v86 + 1) / v227 * v218; + v139 = a6bf + 6.7553994e15; v89 = (double)v237 / v87 * v88; v148 = v89 + 6.7553994e15; v90 = (double)(v237 + 1) / v87 * v88; @@ -7272,25 +7287,25 @@ v249 = 0; v91 = (LODWORD(v157) - LODWORD(v148)) * (LODWORD(v139) - LODWORD(v130)); v258 = 0; - v288 = 0; + a6n = 0; v246 = 0; if ( SLODWORD(v148) >= SLODWORD(v157) ) goto LABEL_181; v167 = LODWORD(v157) - LODWORD(v148); - v182 = a2 + a5 * LODWORD(v148); + v182 = (char *)pSrc + srcPitch * LODWORD(v148); do { v92 = LODWORD(v130); v190 = LODWORD(v130); while ( v92 < SLODWORD(v139) ) { - v93 = *(char *)(v182 + v190); + v93 = (unsigned __int8)v182[v190]; if ( a10 ) { v230 = 1; v85 = v93 != a11 ? 0xFF : 0; } - v94 = v202->_450FB1(v93); + v94 = _450FB1(v93); if ( v230 ) { v246 += v85; @@ -7305,14 +7320,14 @@ { v246 += (unsigned int)v94 >> 24; } - v288 += BYTE2(v94); + a6n += BYTE2(v94); v258 += BYTE1(v94); v249 += (unsigned __int8)v94; LABEL_178: ++v190; v92 = v190; } - v182 += a5; + v182 += srcPitch; --v167; } while ( v167 ); @@ -7320,25 +7335,25 @@ v95 = v246 / ((LODWORD(v157) - LODWORD(v148)) * (LODWORD(v139) - LODWORD(v130))); if ( v91 ) { - v288 /= v91; + a6n /= v91; v258 /= v91; v249 /= v91; } if ( v95 != 255 ) v95 &= 0x7FFFFFFFu; - v96 = v202->_450F55(v249 | ((v258 | ((v288 | (v95 << 8)) << 8)) << 8)); + v96 = _450F55(v249 | ((v258 | ((a6n | (v95 << 8)) << 8)) << 8)); v97 = v199; - v199 += 4; - *(int *)v97 = v96; + v199 += 2; + *(_DWORD *)v97 = v96; v86 = v209; - v285 = v209; - } - while ( v209 < a7 ); + a6m = v209; + } + while ( v209 < dstWidth ); LABEL_186: - v199 += v301; + v199 = (unsigned __int16 *)((char *)v199 + a9e); ++v237; result = v237; - if ( v237 < a8 ) + if ( v237 < dstHeight ) { v11 = 0; continue; @@ -7351,6 +7366,8 @@ + + //----- (0044E1EC) -------------------------------------------------------- int TextureFrameTable::FromFileTxt(const char *Args) { @@ -8706,15 +8723,16 @@ //----- (00450DDE) -------------------------------------------------------- stru350 *stru350::_450DDE() { - _450DF1(" ", " "); + _450DF1(&stru_4E82A4, &stru_4E82A4); return this; } + //----- (00450DF1) -------------------------------------------------------- -void *stru350::_450DF1(const char *Src, const char *a3) -{ - stru350 *v3; // esi@1 - void *result; // eax@1 +bool stru350::_450DF1(const stru355 *p1, const stru355 *p2) +{ + //stru350 *v3; // esi@1 + //void *result; // eax@1 unsigned int v5; // ecx@2 int v6; // edi@2 int v7; // edx@2 @@ -8742,7 +8760,7 @@ int v29; // edx@31 int v30; // ebx@35 int v31; // ecx@35 - unsigned int v32; // edi@35 + int v32; // edi@35 int v33; // edx@35 unsigned int i; // ecx@35 int v35; // ecx@39 @@ -8750,13 +8768,14 @@ int v37; // ecx@39 int v38; // ebx@39 - v3 = this; - memcpy(this, Src, 0x20u); - result = memcpy(v3->array_20, a3, 0x20u); - (*(char *)&result) = 1; - if ( v3->field_0[1] & 1 ) - { - v5 = v3->field_0[7]; + //v3 = this; + memcpy(&field_0, p1, sizeof(stru355)); + memcpy(&field_20, p2, sizeof(stru355)); + //result = memcpy(&v3->field_20, p2, 0x20u); + //LOBYTE(result) = 1; + if (field_0.field_4 & 1) + { + v5 = field_0.field_1C; v6 = 0; v7 = 0; while ( !(v5 & 1) ) @@ -8770,13 +8789,13 @@ ++v7; } while ( v5 & 1 ); - v3->field_40 = 32 - v7 - v6; - } - else - { - v3->field_40 = 0; - } - v8 = v3->field_0[4]; + field_40 = 32 - v7 - v6; + } + else + { + field_40 = 0; + } + v8 = field_0.field_10; v9 = 0; v10 = 0; while ( !(v8 & 1) ) @@ -8792,8 +8811,8 @@ while ( v8 & 1 ); v11 = 24 - v10 - v9; v12 = 0; - v3->field_48 = v11; - v13 = v3->field_0[5]; + field_48 = v11; + v13 = field_0.field_14; v14 = 0; while ( !(v13 & 1) ) { @@ -8807,8 +8826,8 @@ } while ( v13 & 1 ); v15 = 16 - v14; - v16 = v3->field_0[6]; - v3->field_50 = v15 - v12; + v16 = field_0.field_18; + field_50 = v15 - v12; v17 = 0; v18 = 0; while ( !(v16 & 1) ) @@ -8822,15 +8841,15 @@ ++v18; } while ( v16 & 1 ); - v19 = (v3->array_20[1] & 1) == 0; - v3->field_58 = v17 - v18 + 8; + v19 = (field_20.field_4 & 1) == 0; + field_58 = v17 - v18 + 8; if ( v19 ) { - v3->field_44 = 0; - } - else - { - v20 = v3->array_20[7]; + field_44 = 0; + } + else + { + v20 = field_20.field_1C; v21 = 0; v22 = 0; while ( !(v20 & 1) ) @@ -8844,9 +8863,9 @@ ++v22; } while ( v20 & 1 ); - v3->field_44 = 32 - v22 - v21; - } - v23 = v3->array_20[4]; + field_44 = 32 - v22 - v21; + } + v23 = field_20.field_10; v24 = 0; v25 = 0; while ( !(v23 & 1) ) @@ -8862,8 +8881,8 @@ while ( v23 & 1 ); v26 = 24 - v25 - v24; v27 = 0; - v3->field_4C = v26; - v28 = v3->array_20[5]; + field_4C = v26; + v28 = field_20.field_14; v29 = 0; while ( !(v28 & 1) ) { @@ -8878,8 +8897,8 @@ while ( v28 & 1 ); v30 = 0; v31 = 16 - v29 - v27; - v32 = v3->array_20[6]; - v3->field_54 = v31; + v32 = field_20.field_18; + field_54 = v31; v33 = 0; for ( i = v32; !(i & 1); i >>= 1 ) ++v30; @@ -8891,7 +8910,7 @@ while ( i & 1 ); v35 = 32 - v33; v36 = v32; - v3->field_5C = v35 - v30; + field_5C = v35 - v30; v37 = 0; v38 = 0; while ( !(v36 & 1) ) @@ -8905,41 +8924,35 @@ ++v38; } while ( v36 & 1 ); - v3->field_5C = v37 - v38 + 8; - return result; -} + field_5C = v37 - v38 + 8; + return true; +} + //----- (00450F55) -------------------------------------------------------- unsigned int stru350::_450F55(int a2) { - int v2; // ebx@1 - - v2 = a2 & dword_4E82C0; - if ( this->array_20[1] & 1 ) + int v2 = a2 & stru_4E82A4.field_1C; + if (field_20.field_4 & 1) v2 = (unsigned int)v2 >> this->field_44; - return v2 & this->array_20[7] | this->array_20[4] & ((a2 & (unsigned int)dword_4E82B4) >> this->field_4C) | this->array_20[5] & ((a2 & (unsigned int)dword_4E82B8) >> this->field_54) | this->array_20[6] & ((a2 & (unsigned int)dword_4E82BC) >> this->field_5C); -} -// 4E82B4: using guessed type int dword_4E82B4; -// 4E82B8: using guessed type int dword_4E82B8; -// 4E82BC: using guessed type int dword_4E82BC; -// 4E82C0: using guessed type int dword_4E82C0; + return v2 & field_20.field_1C | + field_20.field_10 & ((a2 & (unsigned int)stru_4E82A4.field_10) >> field_4C) | + field_20.field_14 & ((a2 & (unsigned int)stru_4E82A4.field_14) >> field_54) | + field_20.field_18 & ((a2 & (unsigned int)stru_4E82A4.field_18) >> field_5C); +} //----- (00450FB1) -------------------------------------------------------- int stru350::_450FB1(int a2) { - int v2; // ebx@2 - int v4; // [sp+Ch] [bp-4h]@1 - - v4 = this->field_0[1] & 1; + int v2 = 0; + int v4 = field_0.field_4 & 1; if ( v4 ) - v2 = a2 & this->field_0[7]; - else - v2 = 0; + v2 = a2 & field_0.field_1C; if ( v4 ) - v2 <<= this->field_40; - return v2 | ((a2 & this->field_0[4]) << this->field_48) | ((a2 & this->field_0[5]) << this->field_50) | ((a2 & this->field_0[6]) << this->field_58); + v2 <<= field_40; + return v2 | ((a2 & field_0.field_10) << field_48) | ((a2 & field_0.field_14) << field_50) | ((a2 & field_0.field_18) << field_58); } @@ -11722,7 +11735,7 @@ uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (WindowType)(WINDOW_Chest|WINDOW_Credits|0x2), 0, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_Chest|WINDOW_MainMenu|0x2), 0, 0); pGUIWindow_CurrentMenu->CreateButton(21u, 198u, 0xBFu, 0x12u, 1, 0, 0xA5u, 0, 0, nullstring, 0); pGUIWindow_CurrentMenu->CreateButton(21u, 218u, 0xBFu, 0x12u, 1, 0, 0xA5u, 1u, 0, nullstring, 0); pGUIWindow_CurrentMenu->CreateButton(21u, 238u, 0xBFu, 0x12u, 1, 0, 0xA5u, 2u, 0, nullstring, 0); @@ -12833,10 +12846,12 @@ //----- (0046082C) -------------------------------------------------------- bool Initialize_GamesLOD_NewLOD() { - pGames_LOD->AllocSubIndicesAndIO(0x12Cu, 0); + pGames_LOD = new LODWriteableFile; + pGames_LOD->AllocSubIndicesAndIO(300, 0); if (pGames_LOD->LoadFile("data\\games.lod", 1)) { - pNew_LOD->AllocSubIndicesAndIO(0x12Cu, 0x186A0u); + pNew_LOD = new LODWriteableFile; + pNew_LOD->AllocSubIndicesAndIO(300, 0x186A0u); return true; } return false; @@ -13629,14 +13644,6 @@ //----- (004627B7) -------------------------------------------------------- void __cdecl MainMenu_Loop() { - unsigned int v0; // eax@8 - Texture *v1; // esi@8 - unsigned int v2; // eax@8 - Texture *v3; // edi@8 - unsigned int v4; // eax@8 - Texture *v5; // ebp@8 - unsigned int v6; // eax@8 - Texture *v7; // ebx@8 GUIButton *v8; // eax@27 unsigned int v9; // ecx@35 int v10; // ecx@36 @@ -13645,14 +13652,9 @@ Texture *v13; // [sp-14h] [bp-50h]@39 GUIButton *v14; // [sp+0h] [bp-3Ch]@27 GUIWindow *v15; // [sp+4h] [bp-38h]@11 - LONG uMouseX; // [sp+8h] [bp-34h]@11 - LONG uMouseY; // [sp+Ch] [bp-30h]@11 - POINT v18; // [sp+10h] [bp-2Ch]@11 - POINT v19; // [sp+18h] [bp-24h]@11 - MSG Msg; // [sp+20h] [bp-1Ch]@15 uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Resume(); @@ -13662,97 +13664,100 @@ ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pWindow_Credits = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_Credits, 0, 0); - v0 = pIcons_LOD->LoadTexture("title_new", TEXTURE_16BIT_PALETTE); - v1 = (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0); - pMainMenu_BtnNew = pWindow_Credits->CreateButton( - 0x1EFu, - 0xACu, - (v0 != -1 ? pIcons_LOD->pTextures[v0].uTextureWidth : 24), - (v0 != -1 ? pIcons_LOD->pTextures[v0].uTextureHeight : 26), - 1, - 0, - 0x36u, - 0, - 0x4Eu, - nullstring, - v1, - 0); - v2 = pIcons_LOD->LoadTexture("title_load", TEXTURE_16BIT_PALETTE); - v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); - pMainMenu_BtnLoad = pWindow_Credits->CreateButton( - 0x1EFu, - 0xE3u, - (v2 != -1 ? pIcons_LOD->pTextures[v2].uTextureWidth : 24), - (v2 != -1 ? pIcons_LOD->pTextures[v2].uTextureHeight : 26), - 1, - 0, - 0x37u, - 1u, - 0x4Cu, - nullstring, - v3, - 0); - v4 = pIcons_LOD->LoadTexture("title_cred", TEXTURE_16BIT_PALETTE); - v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); - pMainMenu_BtnCredits = pWindow_Credits->CreateButton( - 0x1EFu, - 0x11Au, - (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24), - (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureHeight : 26), - 1, - 0, - 0x38u, - 2u, - 0x43u, - nullstring, - v5, - 0); - v6 = pIcons_LOD->LoadTexture("title_exit", TEXTURE_16BIT_PALETTE); - v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); - pMainMenu_BtnExit = pWindow_Credits->CreateButton( - 0x1EFu, - 0x151u, - (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24), - (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureHeight : 26), - 1, - 0, - 0x39u, - 3u, - 0, - nullstring, - v7, - 0); + pWindow_Credits = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); + + auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); + //v0 = pIcons_LOD->LoadTexture("title_new", TEXTURE_16BIT_PALETTE); + //v1 = (Texture *)(v0 != -1 ? &pIcons_LOD->pTextures[v0] : 0); + pMainMenu_BtnNew = pWindow_Credits->CreateButton(495, 172, + pNew->uTextureWidth, + pNew->uTextureHeight, + 1, + 0, + 54, + 0, + 78, + "", + pNew, + 0); + //v2 = pIcons_LOD->LoadTexture("title_load", TEXTURE_16BIT_PALETTE); + //v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); + auto pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); + pMainMenu_BtnLoad = pWindow_Credits->CreateButton(495, 227, + pLoad->uTextureWidth, + pLoad->uTextureHeight, + 1, + 0, + 55, + 1, + 76, + "", + pLoad, + 0); + //v4 = pIcons_LOD->LoadTexture("title_cred", TEXTURE_16BIT_PALETTE); + //v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); + auto pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); + pMainMenu_BtnCredits = pWindow_Credits->CreateButton(495, 282, + pCredits->uTextureWidth, + pCredits->uTextureHeight, + 1, + 0, + 56, + 2, + 67, + "", + pCredits, + 0); + //v6 = pIcons_LOD->LoadTexture("title_exit", TEXTURE_16BIT_PALETTE); + //v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); + auto pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); + pMainMenu_BtnExit = pWindow_Credits->CreateButton(495, 337, + pExit->uTextureWidth, + pExit->uTextureHeight, + 1, + 0, + 57, + 3, + 0, + "", + pExit, + 0); + stru_506F20.Release(); stru_506F20.Load("title.pcx", 0); - SetCurrentMenuID(0); + SetCurrentMenuID(MENU_MAIN); SetForegroundWindow(hWnd); - SendMessageA(hWnd, 0x1Cu, 1u, 0); - while ( !uCurrentMenuID || uCurrentMenuID == 3 ) - { - uMouseX = pMouse->GetCursorPos(&v18)->x; - uMouseY = pMouse->GetCursorPos(&v19)->y; + SendMessageA(hWnd, WM_ACTIVATEAPP, 1, 0); + while (uCurrentMenuID == MENU_MAIN || + uCurrentMenuID == MENU_LOAD) + { + POINT pt; + pMouse->GetCursorPos(&pt); + //uMouseX = pMouse->GetCursorPos(&v18)->x; + //uMouseY = pMouse->GetCursorPos(&v19)->y; v15 = pWindow_Credits; - if ( uCurrentMenuID == 3 ) + if ( uCurrentMenuID == MENU_LOAD) { if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 12 ) { stru_506F20.Release(); stru_506F20.Load("lsave640.pcx", 0); - pGUIWindow2 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Credits, 0, 0); + pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 12; GameUI_DrawLoadMenu(0); } v15 = pGUIWindow_CurrentMenu; } - while ( PeekMessageA(&Msg, 0, 0, 0, 1u) ) - { - if ( Msg.message == 18 ) + + MSG msg; + while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) ) + { + if (msg.message == WM_QUIT) Game_DeinitializeAndTerminate(0); - TranslateMessage(&Msg); - DispatchMessageA(&Msg); - } - if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + if (dword_6BE364_game_settings_1 & 0x0100) { WaitMessage(); } @@ -13760,11 +13765,11 @@ { pRenderer->BeginScene(); pRenderer->DrawTextureRGB(0, 0, &stru_506F20); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); GUI_MainMenuMessageProc(); GUI_UpdateWindows(); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); if ( uCurrentMenuID ) { @@ -13789,10 +13794,10 @@ { while ( 1 ) { - if ( uMouseX >= (signed int)v8->uX - && uMouseX <= (signed int)v8->uZ - && uMouseY >= (signed int)v8->uY - && uMouseY <= (signed int)v8->uW + if ( pt.x >= (signed int)v8->uX + && pt.x <= (signed int)v8->uZ + && pt.y >= (signed int)v8->uY + && pt.y <= (signed int)v8->uW && v15 == pWindow_Credits ) { v9 = v8->uControlParam; @@ -13806,24 +13811,24 @@ { if ( v11 != 1 ) goto LABEL_44; - v13 = v7; + v13 = pExit; v12 = 337; } else { - v13 = v5; + v13 = pCredits; v12 = 282; } } else { - v13 = v3; + v13 = pLoad; v12 = 227; } } else { - v13 = v1; + v13 = pNew; v12 = 172; } pRenderer->DrawTextureIndexed(495u, v12, v13); @@ -13856,8 +13861,6 @@ pWindow_Credits->Release(); pIcons_LOD->_4114F2(); } -// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; -// 6BE364: using guessed type int dword_6BE364_game_settings_1; @@ -13921,7 +13924,7 @@ v28 = 0; if ( pArcomageGame->bGameInProgress ) { - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 7; v29 = 1; @@ -13940,7 +13943,7 @@ v31 = 0; if ( !pArcomageGame->bGameInProgress ) goto LABEL_240; - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 8; v29 = 1; @@ -13949,7 +13952,7 @@ v32 = 0; if ( !pArcomageGame->bGameInProgress ) goto LABEL_218; - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 3; v29 = 0; @@ -13964,7 +13967,7 @@ back_to_game(); return DefWindowProcA(hWnd, Msg, wParam, v4); } - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 4; v29 = 0; @@ -13973,7 +13976,7 @@ v28 = 0; if ( pArcomageGame->bGameInProgress ) { - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 7; return DefWindowProcA(hWnd, Msg, wParam, v4); @@ -14027,7 +14030,7 @@ } goto _def_wnd_proc; } - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pArcomageGame->stru1.field_0 = 8; return DefWindowProcA(hWnd, Msg, wParam, v4); @@ -14049,7 +14052,7 @@ case WM_MOUSEMOVE: if ( pArcomageGame->bGameInProgress ) { - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pXY[0] = (unsigned __int16)lParam; pXY[1] = lParam >> 16; @@ -14063,7 +14066,7 @@ } else { - if ( pAsyncMouse ) + if (pAsyncMouse) goto _def_wnd_proc; pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); } @@ -14364,7 +14367,7 @@ Abortf(pGlobalTXT_LocalizationStrings[62]); } BYTE1(dword_6BE364_game_settings_1) &= 0xFEu; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( pArcomageGame->bGameInProgress ) { @@ -14401,7 +14404,7 @@ dword_4E98BC_bApplicationActive = 0; if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie ) pVideoPlayer->bStopBeforeSchedule = 1; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); @@ -14448,7 +14451,7 @@ pAsyncKeyboard->_45B3A4(); } } - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46B1DD(); PostQuitMessage(0); return 0; @@ -14461,7 +14464,7 @@ if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); ClipCursor(0); - if ( pAsyncMouse ) + if (pAsyncMouse) { pAsyncMouse->Suspend(); return DefWindowProcA(hWnd, Msg, wParam, v4); @@ -14582,10 +14585,13 @@ { pViewport->SetScreen(viewparams->uSomeX, viewparams->uSomeY, viewparams->uSomeZ, viewparams->uSomeW); pViewport->_4C02F8((signed __int64)(flt_6BE3A0 * 65536.0)); + + pIndoorCamera = new IndoorCamera; pIndoorCamera->Initialize( 65, viewparams->uScreenZ - viewparams->uScreenX + 1, viewparams->uScreenW - viewparams->uScreenY + 1); + InitializeTurnBasedAnimations(&stru_50C198); pBitmaps_LOD->dword_11B84 = pBitmaps_LOD->uNumLoadedFiles; pSprites_LOD->field_ECA0 = pSprites_LOD->uNumLoadedSprites; @@ -15200,6 +15206,8 @@ bCanLoadFromCD = GetPrivateProfileIntW(L"settings", L"use_cd", 1, pMM6IniFile); + if (bNoCD) + bCanLoadFromCD = false; if (bCanLoadFromCD) { if (!FindMM7CD(hWnd, &cMM7GameCDDriveLetter)) @@ -15461,18 +15469,11 @@ //----- (00465D0B) -------------------------------------------------------- void __cdecl SecondaryInitialization() { - //_UNKNOWN *v0; // edi@3 - //char **v1; // ebp@3 - //char *v2; // esi@3 - //__int16 uIconID; // ax@4 __int16 v4; // ax@4 signed int v5; // esi@5 int v6; // ecx@6 int v7; // edx@7 ObjectDesc *v8; // eax@7 - //signed int v9; // esi@8 - signed int v10; // ebx@14 - signed int v11; // esi@15 char pContainer[32]; // [sp+10h] [bp-Ch]@9 pMouse->Initialize(hWnd); @@ -15558,9 +15559,15 @@ if ( pSprites_LOD->field_ECA0 < (signed int)pSprites_LOD->uNumLoadedSprites ) pSprites_LOD->field_ECA0 = pSprites_LOD->uNumLoadedSprites; pPaletteManager->LockAll(); + _mkdir("Saves"); - v10 = 1; - do + for (uint i = 0; i < 5; ++i) + for (uint j = 0; j < 6; ++j) + { + sprintf(pTmpBuf, "data\\lloyd%d%d.pcx", i, j); + remove(pTmpBuf); + } + /*do { v11 = 1; do @@ -15572,7 +15579,8 @@ while ( v11 < 6 ); ++v10; } - while ( v10 < 5 ); + while ( v10 < 5 );*/ + Initialize_GamesLOD_NewLOD(); dword_576E2C = 512; dword_576E28 = 9; @@ -15613,8 +15621,10 @@ if (wcsstr(pCmdLine, L"-noanim")) { dword_6BE364_game_settings_1 |= 0x40; - bNoVideo = 1; - } + bNoVideo = true; + } + if (wcsstr(pCmdLine, L"-nocd")) + bNoCD = true; } stru_51076C.registry_debug_flags = ReadWindowsRegistryInt("debug flags", 0); @@ -15659,7 +15669,7 @@ pGame->Deinitialize(); return true; } - if ( uCurrentMenuID == 1 ) + if (GetCurrentMenuID() == MENU_NEWGAME) { if ( pAudioPlayer->hAILRedbook ) AIL_redbook_stop(pAudioPlayer->hAILRedbook); @@ -15703,7 +15713,7 @@ if ( uCurrentMenuID != 10 ) goto LABEL_49; pMouse->Activate(0); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Suspend(); @@ -15714,7 +15724,7 @@ if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) { pMouse->Activate(1); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Resume(); @@ -15723,7 +15733,7 @@ _chdir("..\\"); strcpy(pCurrentMapName, ofn.lpstrFileTitle); pMouse->Activate(1); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) pAsyncKeyboard->Resume(); @@ -16069,7 +16079,7 @@ } //----- (00466CA0) -------------------------------------------------------- -unsigned int __cdecl GetCurrentMenuID() +unsigned int GetCurrentMenuID() { return uCurrentMenuID; } @@ -16649,7 +16659,7 @@ if ( a1 <= 782 ) { uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE); - ptr_507BC4 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)30, v1 - 700, 0); + ptr_507BC4 = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)30, v1 - 700, 0); } } } @@ -16934,7 +16944,7 @@ if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0) || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 ) { - if ( pAsyncMouse ) + if (pAsyncMouse) { v18 = *((int *)pAsyncMouse + 6); v19 = *((int *)pAsyncMouse + 7); @@ -17082,7 +17092,7 @@ } return; } - if ( pAsyncMouse ) + if (pAsyncMouse) { v32 = *((int *)pAsyncMouse + 6); v33 = *((int *)pAsyncMouse + 7); @@ -17932,7 +17942,7 @@ goto LABEL_36; } if ( v25->IsInteractive() ) - v24 = (const char *)dword_722240[2 * stru_5E4C90.field_0[v26->field_1C]]; + v24 = pNPCTopics[stru_5E4C90.field_0[v26->field_1C] + 379].pTopic; else v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; LABEL_51:
--- a/mm7_3.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_3.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -5674,7 +5674,7 @@ pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0); strtok(pAwardsTXT_Raw, "\r"); v7 = pAwards; - do + for (uint i = 0; i < 104; ++i) { v1 = strtok(v0, "\r") + 1; v6 = v0; @@ -5721,7 +5721,7 @@ while ( (signed int)(v6 - 1) <= 2 && (char *)v5 == v0 ); ++v7; } - while ( (signed int)v7 < (signed int)&dword_7241C8 ); + //while ( (signed int)v7 < (signed int)&dword_7241C8 ); } // 7241C8: using guessed type int dword_7241C8; @@ -5744,7 +5744,7 @@ pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0); strtok(pScrollsTXT_Raw, "\r"); v6 = pScrolls; - do + for (uint i = 0; i < 82; ++i) { v1 = strtok(v0, "\r") + 1; v2 = 0; @@ -5784,15 +5784,15 @@ while ( v2 - 1 <= 1 && (char *)v7 == v0 ); ++v6; } - while ( (signed int)v6 < (signed int)dword_723E80_award_related ); -} -// 723E80: using guessed type int dword_723E80_award_related[]; + //while ( (signed int)v6 < (signed int)dword_723E80_award_related ); +} + //----- (00476590) -------------------------------------------------------- void __cdecl InitializeMerchants() { char *v0; // ebx@1 - char **v1; // edi@3 + //char **v1; // edi@3 char *v2; // ecx@4 char v3; // dl@5 char *v4; // eax@5 @@ -5806,8 +5806,8 @@ pMerchantsTXT_Raw = 0; pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0); strtok(pMerchantsTXT_Raw, "\r"); - v1 = (char **)pMerchantsRepairPhrases; - do + //v1 = (char **)pMerchantsRepairPhrases; + for (uint i = 0; i < 7; ++i) { v7 = v0; v6 = (signed int)v0; @@ -5840,24 +5840,24 @@ { if ( v7 == (char *)1 ) { - *(v1 - 14) = RemoveQuotes(v2); + pMerchantsBuyPhrases[i] = RemoveQuotes(v2); } else { if ( v7 == (char *)2 ) { - *(v1 - 7) = RemoveQuotes(v2); + pMerchantsSellPhrases[i] = RemoveQuotes(v2); } else { if ( v7 == (char *)3 ) { - *v1 = RemoveQuotes(v2); + pMerchantsRepairPhrases[i] = RemoveQuotes(v2); } else { if ( v7 - 3 == (char *)1 ) - v1[7] = RemoveQuotes(v2); + pMerchantsIdentifyPhrases[i] = RemoveQuotes(v2); } } } @@ -5866,9 +5866,9 @@ v2 = (char *)(v5 + 1); } while ( (signed int)(v7 - 1) <= 4 && (char *)v6 == v0 ); - ++v1; - } - while ( (signed int)v1 < (signed int)pMerchantsIdentifyPhrases ); + //++v1; + } + //while ( (signed int)v1 < (signed int)pMerchantsIdentifyPhrases ); } //----- (00476682) -------------------------------------------------------- @@ -5890,7 +5890,7 @@ pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0); strtok(pTransitionsTXT_Raw, "\r"); v6 = pTransitionStrings; - do + for (uint i = 0; i < 464; ++i) { v1 = strtok(v0, "\r") + 1; v2 = 0; @@ -5930,7 +5930,7 @@ while ( v2 - 1 <= 1 && (char *)v7 == v0 ); ++v6; } - while ( (signed int)v6 < (signed int)"awards.txt" ); + //while ( (signed int)v6 < (signed int)"awards.txt" ); } //----- (00476750) -------------------------------------------------------- @@ -5950,7 +5950,7 @@ pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0); strtok(pAutonoteTXT_Raw, "\r"); v0 = (char *)&stru_723720[0].eType; - do + for (uint i = 0; i < 195; ++i) { v1 = 0; v2 = strtok(0, "\r") + 1; @@ -6016,9 +6016,9 @@ while ( v1 - 1 <= 2 && !v6 ); v0 += 8; } - while ( (signed int)v0 < (signed int)&pScrolls[1] ); -} -// 723720: using guessed type Autonote stru_723720[195]; + //while ( (signed int)v0 < (signed int)&pScrolls[1] ); +} + //----- (004768A9) -------------------------------------------------------- void __cdecl InitializeQuests() @@ -6029,7 +6029,7 @@ char v3; // dl@5 char *v4; // ecx@5 int v5; // esi@9 - const char **v6; // [sp+10h] [bp-8h]@3 + //const char **v6; // [sp+10h] [bp-8h]@3 signed int v7; // [sp+14h] [bp-4h]@4 v0 = 0; @@ -6038,8 +6038,10 @@ pQuestsTXT_Raw = 0; pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0); strtok(pQuestsTXT_Raw, "\r"); - v6 = pQuestTable; - do + + //v6 = pQuestTable; + for (uint i = 0; i < 512; ++i) + //do { v1 = strtok(v0, "\r") + 1; v2 = 0; @@ -6071,15 +6073,15 @@ else { if ( v2 == 1 ) - *v6 = RemoveQuotes(v1); + pQuestTable[i] = RemoveQuotes(v1); } ++v2; v1 = (char *)(v5 + 1); } while ( v2 - 1 <= 1 && (char *)v7 == v0 ); - ++v6; - } - while ( (signed int)v6 < (signed int)&unk_723714 ); + //++v6; + } + //while ( (signed int)v6 < (signed int)&unk_723714 ); } @@ -6087,19 +6089,14 @@ //----- (00476977) -------------------------------------------------------- void NPCStats::Initialize2() { - NPCStats *v1; // esi@1 - char *v2; // ebx@1 - char *v3; // eax@3 char *v4; // eax@4 char v5; // dl@5 char *v6; // ecx@5 int v7; // edi@9 - char *v8; // eax@20 char *v9; // eax@21 char v10; // dl@22 char *v11; // ecx@22 int v12; // edi@26 - char *v13; // eax@37 char *v14; // eax@39 char v15; // dl@40 int v16; // ecx@40 @@ -6110,29 +6107,28 @@ signed int v21; // ecx@58 char *v22; // [sp+10h] [bp-10h]@4 char *v23; // [sp+10h] [bp-10h]@21 - char *v24; // [sp+10h] [bp-10h]@39 char *v25; // [sp+14h] [bp-Ch]@4 char *v26; // [sp+14h] [bp-Ch]@21 signed int v27; // [sp+14h] [bp-Ch]@39 - signed int v28; // [sp+18h] [bp-8h]@3 - signed int v29; // [sp+18h] [bp-8h]@20 + //signed int v28; // [sp+18h] [bp-8h]@3 + //signed int v29; // [sp+18h] [bp-8h]@20 signed int v30; // [sp+18h] [bp-8h]@37 char *v31; // [sp+1Ch] [bp-4h]@37 - v1 = this; - v2 = 0; - if ( this->pNPCTextTXT_Raw ) - pAllocator->FreeChunk(this->pNPCTextTXT_Raw); - v1->pNPCTextTXT_Raw = 0; - v3 = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0); - v1->pNPCTextTXT_Raw = v3; - strtok(v3, "\r"); - v28 = (signed int)&unk_72166C_pNPCText; - do - { - v4 = strtok(v2, "\r") + 1; - v22 = v2; - v25 = v2; + //v1 = this; + //v2 = 0; + if (pNPCTextTXT_Raw) + pAllocator->FreeChunk(pNPCTextTXT_Raw); + + //v3 = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0); + pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0); + strtok(pNPCTextTXT_Raw, "\r"); + + for (uint i = 0; i < 789; ++i) + { + v4 = strtok(nullptr, "\r") + 1; + v22 = nullptr; + v25 = nullptr; do { v5 = *v4; @@ -6147,40 +6143,39 @@ v5 = v4[(int)v6]; } while ( v5 != 9 ); - v2 = 0; + //v2 = 0; } v7 = (int)&v4[(int)v6]; if ( !v4[(int)v6] ) v25 = (char *)1; *(char *)v7 = 0; - if ( v6 == v2 ) + if ( v6 == nullptr ) { v25 = (char *)1; } else { if ( v22 == (char *)1 ) - *(int *)v28 = (int)RemoveQuotes(v4); + pNPCTopics[i].pText = RemoveQuotes(v4); } ++v22; v4 = (char *)(v7 + 1); } - while ( (signed int)(v22 - 1) <= 1 && v25 == v2 ); - v28 += 8; - } - while ( v28 < (signed int)pQuestTable ); - if ( v1->pNPCTopicTXT_Raw != v2 ) - pAllocator->FreeChunk(v1->pNPCTopicTXT_Raw); - v1->pNPCTopicTXT_Raw = v2; - v8 = (char *)pEvents_LOD->LoadRaw("npctopic.txt", (int)v2); - v1->pNPCTopicTXT_Raw = v8; - strtok(v8, "\r"); - v29 = (signed int)&unk_721668_pNPCTopic; - do - { - v9 = strtok(v2, "\r") + 1; - v23 = v2; - v26 = v2; + while ( (signed int)(v22 - 1) <= 1 && v25 == nullptr ); + } + + if (pNPCTopicTXT_Raw) + pAllocator->FreeChunk(pNPCTopicTXT_Raw); + + //v8 = (char *)pEvents_LOD->LoadRaw("npctopic.txt", (int)v2); + pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0); + strtok(pNPCTopicTXT_Raw, "\r"); + + for (uint i = 0; i < 579; ++i) + { + v9 = strtok(nullptr, "\r") + 1; + v23 = nullptr; + v26 = nullptr; do { v10 = *v9; @@ -6195,42 +6190,43 @@ v10 = v9[(int)v11]; } while ( v10 != 9 ); - v2 = 0; + //v2 = 0; } v12 = (int)&v9[(int)v11]; if ( !v9[(int)v11] ) v26 = (char *)1; *(char *)v12 = 0; - if ( v11 == v2 ) + if ( v11 == nullptr ) { v26 = (char *)1; } else { if ( v23 == (char *)1 ) - *(int *)v29 = (int)RemoveQuotes(v9); + pNPCTopics[i].pTopic = RemoveQuotes(v9); } ++v23; v9 = (char *)(v12 + 1); } - while ( (signed int)(v23 - 1) <= 1 && v26 == v2 ); - v29 += 8; - } - while ( v29 < (signed int)&unk_722880 ); - if ( v1->pNPCDistTXT_Raw != v2 ) - pAllocator->FreeChunk(v1->pNPCDistTXT_Raw); - v1->pNPCDistTXT_Raw = v2; - v13 = (char *)pEvents_LOD->LoadRaw("npcdist.txt", (int)v2); - v1->pNPCDistTXT_Raw = v13; - strtok(v13, "\r"); - strtok(v2, "\r"); + while ( (signed int)(v23 - 1) <= 1 && v26 == nullptr ); + } + + if (pNPCDistTXT_Raw) + pAllocator->FreeChunk(pNPCDistTXT_Raw); + + //v13 = (char *)pEvents_LOD->LoadRaw("npcdist.txt", (int)v2); + pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0); + strtok(pNPCDistTXT_Raw, "\r"); + strtok(nullptr, "\r"); v30 = 1; - v31 = &v1->array_16544[0].field_4[1]; + v31 = &array_16544[0].field_4[1]; + + char *v2 = 0; while ( 2 ) { - v14 = strtok(v2, "\r") + 1; + v14 = strtok(nullptr, "\r") + 1; v27 = 0; - v24 = v2; + char *v24 = nullptr; do { v15 = *v14; @@ -6261,7 +6257,7 @@ { if ( (signed int)v2 < 77 ) { - v1->array_16544[(int)v2].field_4[v30] = atoi(v14); + array_16544[(int)v2].field_4[v30] = atoi(v14); goto LABEL_54; } v18 = v2 == 0; @@ -6283,7 +6279,7 @@ } break; } - v19 = v1->array_16544; + v19 = array_16544; v20 = 77; do { @@ -6296,10 +6292,11 @@ --v20; } while ( v20 ); - if ( v1->pNPCDistTXT_Raw ) - { - pAllocator->FreeChunk(v1->pNPCDistTXT_Raw); - v1->pNPCDistTXT_Raw = 0; + + if (pNPCDistTXT_Raw) + { + pAllocator->FreeChunk(pNPCDistTXT_Raw); + pNPCDistTXT_Raw = nullptr; } } @@ -6569,13 +6566,13 @@ //----- (0047702F) -------------------------------------------------------- void NPCStats::Initialize() { - NPCStats *v1; // edi@1 + //NPCStats *v1; // edi@1 char *v2; // ebx@1 - char *v3; // eax@1 + //char *v3; // eax@1 char *v4; // ebx@3 char v5; // al@4 int v6; // ecx@4 - char *v7; // eax@18 + //char *v7; // eax@18 char *v8; // ebx@18 char *v9; // ecx@19 char v10; // dl@20 @@ -6590,8 +6587,7 @@ char *v19; // [sp+18h] [bp-8h]@18 signed int v20; // [sp+1Ch] [bp-4h]@3 signed int v21; // [sp+1Ch] [bp-4h]@19 - - v1 = this; + //v1 = this; Initialize1(); Initialize2(); @@ -6603,13 +6599,13 @@ InitializeMerchants(); InitializeScrolls(); v2 = 0; - v1->field_17FC0 = 0; - v1->pNPCNamesTXT_Raw = 0; - v3 = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0); - v1->pNPCNamesTXT_Raw = v3; - strtok(v3, "\r"); + field_17FC0 = 0; + pNPCNamesTXT_Raw = 0; + //v3 = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0); + pNPCNamesTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0); + strtok(pNPCNamesTXT_Raw, "\r"); v18 = 0; - v16 = (char *)v1->pNPCNames; + v16 = (char *)pNPCNames; while ( 1 ) { v4 = strtok(v2, "\r") + 1; @@ -6648,8 +6644,8 @@ else { LABEL_45: - if ( v20 == 1 && !v1->uNumNPCNames[1] ) - v1->uNumNPCNames[1] = v18; + if ( v20 == 1 && !uNumNPCNames[1] ) + uNumNPCNames[1] = v18; } ++v20; v4 += v14 + 1; @@ -6661,16 +6657,16 @@ break; v2 = 0; } - v1->pNPCProfTXT_Raw = 0; - v1->uNumNPCNames[0] = v18; - v7 = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0); - v1->pNPCProfTXT_Raw = v7; - strtok(v7, "\r"); + pNPCProfTXT_Raw = 0; + uNumNPCNames[0] = v18; + //v7 = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0); + pNPCProfTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0); + strtok(pNPCProfTXT_Raw, "\r"); strtok(0, "\r"); strtok(0, "\r"); strtok(0, "\r"); - v8 = (char *)&v1->pProfessions[0].pJoinText; - v19 = (char *)&v1->pProfessions[0].pJoinText; + v8 = (char *)&pProfessions[0].pJoinText; + v19 = (char *)&pProfessions[0].pJoinText; v13 = 58; do { @@ -6732,7 +6728,7 @@ v19 = v8; } while ( !v12 ); - v1->uNumNPCProfessions = 59; + uNumNPCProfessions = 59; } //----- (00477266) -------------------------------------------------------- @@ -16876,7 +16872,7 @@ sprintfex(byte_591098, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" else strcpy(byte_591098, pGlobalTXT_LocalizationStrings[79]);// "Exit" - result = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)17, 0, (int)byte_591098); + result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)byte_591098); pDialogueWindow = result; return result; } @@ -17066,10 +17062,8 @@ //----- (00445308) -------------------------------------------------------- -int __fastcall sub_445308(int a1) -{ - int result; // eax@12 - +const char *__fastcall sub_445308(int a1) +{ if ( a1 == 10 || a1 == 11 || a1 == 12 @@ -17081,12 +17075,11 @@ || a1 == 42 || a1 == 43 || a1 == 52 ) - result = *(&pNPCStats->field_13A60 + 5 * a1); - else - result = dword_722320; - return result; -} -// 722320: using guessed type int dword_722320; + return (const char *)*(&pNPCStats->field_13A60 + 5 * a1); + else + return pNPCTopics[407].pTopic; +} + //----- (00445350) -------------------------------------------------------- void __cdecl DrawDialogueUI() @@ -17246,7 +17239,7 @@ } if ( byte_5B0938[0] ) goto LABEL_24; - v7 = ptr_F8B1E8; + v7 = (char *)ptr_F8B1E8; LABEL_37: v8 = 0; goto LABEL_38; @@ -18154,7 +18147,7 @@ pVideoPlayer->Unload(); pVideoPlayer->bStopBeforeSchedule = 0; pVideoPlayer->field_40 = 0; - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); v128 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; v13 = &pSomeEVT[v9]; @@ -18193,7 +18186,7 @@ if ( v128 == 13 ) pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); } - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); goto LABEL_291; case EVENT_CheckSkill: @@ -18339,13 +18332,13 @@ if ( EnterHouse((enum HOUSE_TYPE)170) ) { pAudioPlayer->StopChannels(-1, -1); - ptr_507BC0 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior, 170, 0); + ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, v7, 0); ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, v7, 0); ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, v7, 0); ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, v7, 0); ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, v7, 0); - ptr_F8B1E8 = (char *)dword_72193C; + ptr_F8B1E8 = pNPCTopics[90].pText; } } } @@ -18417,7 +18410,7 @@ if ( EnterHouse((enum HOUSE_TYPE)165) ) { pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); - v47 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior, 165, 0); + v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); ptr_507BC0 = v47; v48 = v47->pControlsHead; if ( v48 ) @@ -19140,7 +19133,7 @@ v104 = 187; if ( uCurrentHouse_Animation != 167 ) v104 = v103; - ptr_507BC0 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior, v104, 0); + ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, v7, 0); ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, v7, 0); ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, v7, 0);
--- a/mm7_4.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_4.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -5139,7 +5139,7 @@ } else { - v11 = (char *)dword_721824; + v11 = (char *)pNPCTopics[55].pText; } pPlayer = v61; v13 = a3; @@ -6000,7 +6000,7 @@ pTextures_arrowr[v4] = &pIcons_LOD->pTextures[v3]; } while ( uControlParam < 20 ); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Credits, 0, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); uControlParama = 0; uXa = 8; do @@ -6478,7 +6478,7 @@ v26 = 0; stru_506F20.Release(); stru_506F20.Load("makeme.pcx", 0); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Resume(); v2 = 6; pGUIWindow_CurrentMenu->field_40 = 0; @@ -6714,7 +6714,7 @@ } while ( (signed int)v10 < (signed int)((char *)&pParty->field_871C[455] + 2) ); pAudioPlayer->StopChannels(-1, -1); - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->Suspend(); return v26; } @@ -6832,7 +6832,7 @@ v21.pPixels, (signed __int16)v21.uWidth); free(pString); - pWindow_Credits = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Credits, 0, (int)ptr); + pWindow_Credits = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr); pWindow_Credits->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, nullstring, 0); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 9; SetCurrentMenuID(8u); @@ -6862,7 +6862,7 @@ } else { - if ( pAsyncMouse ) + if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); if ( dword_A74C88 ) { @@ -10110,7 +10110,7 @@ dword_F8B1A8 = 0; v11 = 0; uDialogueType = 84; - ptr_F8B1E8 = (char *)dword_722B44; + ptr_F8B1E8 = (char *)pNPCTopics[667].pText; v0 = _4F0882_evt_VAR_PlayerItemInHands_vals; while ( 1 ) { @@ -10135,7 +10135,7 @@ if ( (signed int)v0 >= (signed int)((char *)dword_4F08EC + 2) ) goto LABEL_10; } - ptr_F8B1E8 = (char *)dword_722B3C; + ptr_F8B1E8 = (char *)pNPCTopics[666].pText; v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; dword_F8B1A8 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11]; pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4); @@ -10231,7 +10231,7 @@ if ( a1 == 13 ) { ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); - ptr_F8B1E8 = sub_495461(ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); + ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); sub_4B40E6(); byte_F8B1EC = 0; goto _return; @@ -10432,7 +10432,7 @@ byte_F8B1EC = 0; uDialogueType = 13; ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); - ptr_F8B1E8 = sub_495461(ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); + ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(38, 0); v19 = pGlobalTXT_LocalizationStrings[155]; @@ -10477,13 +10477,7 @@ _return: pVideoPlayer->_4BF5B2(); } -// 591080: using guessed type int dword_591080; -// F8B19C: using guessed type int dword_F8B19C; -// F8B1A8: using guessed type int dword_F8B1A8; -// F8B1B0: using guessed type int dword_F8B1B0; -// F8B1B4: using guessed type int dword_F8B1B4; -// F8B1D8: using guessed type int dword_F8B1D8; -// F8B1EC: using guessed type char byte_F8B1EC; + //----- (004B254D) -------------------------------------------------------- char *__thiscall _4B254D_SkillMasteryTeacher(int _this) @@ -10528,7 +10522,7 @@ v2 = (_this - 200) % 3; v3 = (_this - 200) / 3; v4 = v2; - v35 = (char *)dword_721A64; + v35 = (char *)pNPCTopics[127].pText; dword_F8B1AC_something_todo_with_awards = v3; if ( v2 ) { @@ -10613,12 +10607,12 @@ return pTmpBuf; } if ( !v1->CanAct() ) - return _721A3C_npc_text; + return (char *)pNPCTopics[122].pText; if ( !v7 ) - return (char *)_721A84_npc_text; + return (char *)pNPCTopics[131].pText; v16 = SkillToMastery(a1[0]); if ( (signed int)v16 > v4 + 1 ) - return (char *)_721A6C_npc_text[2 * v4]; + return (char *)pNPCTopics[v4 + 128].pText; if ( v34 != 2 ) { if ( v34 == 3 ) @@ -10785,7 +10779,7 @@ dword_F8B1B4 = 1000; LABEL_42: if ( dword_F8B1B4 > pParty->uNumGold ) - return (char *)dword_721A4C; + return (char *)pNPCTopics[124].pText; LABEL_79: dword_F8B1A8 = 1; if ( v34 == 2 ) @@ -10816,13 +10810,12 @@ //----- (004B29F2) -------------------------------------------------------- -int __fastcall sub_4B29F2(int a1) +const char *__fastcall sub_4B29F2(int a1) { int v1; // esi@1 Player *v2; // edi@1 int v3; // eax@1 Player *v4; // ecx@1 - int result; // eax@2 v1 = a1; dword_F8B1A8 = 0; @@ -10835,26 +10828,25 @@ { if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)v2->field_152, dword_F8B1AC_something_todo_with_awards) ) { - result = dword_721A44; + return pNPCTopics[123].pText; } else { if ( dword_F8B1B4 <= pParty->uNumGold ) { - result = dword_7219DC[2 * v1]; dword_F8B1A8 = 1; + return pNPCTopics[v1 + 110].pText; } else { - result = dword_721A4C; - } - } - } - else - { - result = (int)_721A3C_npc_text; - } - return result; + return pNPCTopics[124].pText; + } + } + } + else + { + return pNPCTopics[122].pText; + } } @@ -11863,9 +11855,9 @@ v0 = GetNPCData(uDialogue_SpeakingActorNPC_ID); v1 = 0; - pDialogueWindow->uWindowType = 1; + pDialogueWindow->eWindowType = WINDOW_MainMenu; pDialogueWindow->Release(); - v2 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)10, 1, 0); + v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_A, 1, 0); pDialogueWindow = v2; if ( *(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) { @@ -11905,22 +11897,22 @@ v1 = a4; uDialogueType = 81; - ptr_F8B1E8 = (char *)dword_721984[2 * a4]; + ptr_F8B1E8 = (char *)pNPCTopics[a4 + 99].pText; sub_4B29F2(a4); pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x15Eu, WINDOW_Credits, v1, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, v1, 0); ptr_5076F4 = pDialogueWindow->CreateButton( - 0x1D7u, - 0x1BDu, - 0xA9u, - 0x23u, + 0x1D7, + 0x1BD, + 0xA9, + 0x23, 1, 0, - 0x71u, + 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), + (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, nullstring, 0); pDialogueWindow->CreateButton( @@ -11948,10 +11940,10 @@ v1 = a4; uDialogueType = 78; - ptr_F8B1E8 = (char *)dword_721BAC[2 * a4]; + ptr_F8B1E8 = (char *)pNPCTopics[a4 + 168].pText; _4B254D_SkillMasteryTeacher(a4); pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x15Eu, WINDOW_Credits, v1, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); v2 = nullstring; ptr_5076F4 = pDialogueWindow->CreateButton( 0x1D7u, @@ -11985,7 +11977,7 @@ v0 = 0; v1 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x15Eu, WINDOW_Credits, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); ptr_5076F4 = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, @@ -12059,7 +12051,7 @@ if ( _this + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) { pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_Credits, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); sprintfex(byte_591098, pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[uHouse_ExitPic].pName); ptr_5076F4 = pDialogueWindow->CreateButton( 0x236u, @@ -12114,7 +12106,7 @@ GUIButton::_41D0D8((GUIButton *)array_5913D8[i + 7]); } v4 = 1; - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x159u, WINDOW_Credits, 0, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); ptr_5076F4 = pDialogueWindow->CreateButton( 471u, 445u, @@ -12518,9 +12510,9 @@ } if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { - v31 = _721A3C_npc_text; + v31 = pNPCTopics[122].pText; v32 = v71; - v33 = pFontArrus->CalcTextHeight(_721A3C_npc_text, &v65, 0, 0); + v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); v65.DrawText2(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u); result = (int)pDialogueWindow; pDialogueWindow->field_28 = 0; @@ -13915,9 +13907,9 @@ (unsigned __int8 *)v1->field_152, word_4F0704[2 * (unsigned int)ptr_507BC0->ptr_1C]) ) { - v36 = dword_721A34; + v36 = pNPCTopics[121].pText; v37 = v57; - v38 = pFontArrus->CalcTextHeight(dword_721A34, &v52, 0, 0); + v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &v52, 0, 0); v52.DrawText2(pFontArrus, 0, (212 - v38) / 2 + 101, v37, v36, 3u); result = (int)pDialogueWindow; pDialogueWindow->field_28 = 0; @@ -14612,9 +14604,9 @@ (unsigned __int8 *)v1->field_152, word_4F0754[2 * (unsigned int)ptr_507BC0->ptr_1C]) ) { - v24 = dword_721BC4; + v24 = pNPCTopics[171].pText; v25 = v31; - v26 = pFontArrus->CalcTextHeight(dword_721BC4, &v28, 0, 0); + v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0); v28.DrawText2(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u); result = (int)pDialogueWindow; pDialogueWindow->field_28 = 0; @@ -15689,7 +15681,7 @@ LABEL_19: strcpy(byte_591098, v21); LABEL_20: - pDialogueWindow = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)26, 0, (int)byte_591098); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)26, 0, (int)byte_591098); //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_C) ) if ( BYTE1(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].field_C) ) HousePlaySomeSound(v9, 1);
--- a/mm7_5.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_5.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -583,7 +583,7 @@ uTextureID_507CB0 = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); uTextureID_507CB8 = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); uTextureID_507CB4 = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_Options, 0, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); pGUIWindow_CurrentMenu->CreateButton( 0x16u, 0x10Eu, @@ -785,7 +785,7 @@ uTextureID_507BFC = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); uTextureID_507C00 = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); uTextureID_507C04 = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_KeyMappingOptions, 0, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0); pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, 0x71u, 0, 0, nullstring, 0); pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A0u, 0, 0, nullstring, 0); pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A1u, 0, 0, nullstring, 0); @@ -891,7 +891,7 @@ uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_VideoOptions, 0, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, 0x71u, 0, 0, v1, 0); if ( pRenderer->pRenderD3D ) { @@ -1175,7 +1175,7 @@ } goto LABEL_184; } - ModalWindow(pstr_722494, 0); + ModalWindow(pNPCTopics[453].pText, 0); goto _continue; case UIMSG_SkillUp|0x2: pGUIWindow_CurrentMenu->Release(); @@ -1225,7 +1225,7 @@ pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); - v26 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_Book, uMessage, 0); + v26 = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); v27 = 354; v28 = 570; v170 = 0; @@ -1241,7 +1241,7 @@ pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_Book, uMessage, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); ptr_507BE0 = GUIWindow::Create(0x258u, 0x169u, 0, 0, (enum WindowType)99, (int)ptr_507A00, 0); bFlashHistoryBook = 0; goto _continue; @@ -1588,7 +1588,7 @@ uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = v0; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)3, 0, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)3, 0, 0); uTextureID_507944 = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); uTextureID_507940 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); uTextureID_50793C = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); @@ -2041,7 +2041,7 @@ LABEL_438: v141 = (WindowType)9; LABEL_439: - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, v141, v148, v162); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, v141, v148, v162); goto _continue; case UIMSG_B2: v165 = 0; @@ -2468,7 +2468,7 @@ if ( !uActiveCharacter || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) goto LABEL_90; - ptr_507BC8 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)104, uMessageParam, 0); + ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)104, uMessageParam, 0); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 25; pEventTimer->Pause(); goto _continue; @@ -2881,7 +2881,7 @@ GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, (enum WindowType)90, (int)ptr_5079F8, 0); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 8; pEventTimer->Pause(); - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)18, 0, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)18, 0, 0); pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); viewparams->field_48 = v0; goto _continue; @@ -2902,7 +2902,7 @@ pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 104; - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)12, 5, 0); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)12, 5, 0); papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); ptr_5076F4 = pGUIWindow_CurrentMenu->CreateButton( 0x187u, @@ -2944,12 +2944,12 @@ dword_50651C = -1; goto _continue; case UIMSG_A9: - GUIWindow::Create(ptr_507B9C->uX, ptr_507B9C->uY, 0, 0, WINDOW_HouseInterior|0x42, (int)ptr_507B9C, 0); + GUIWindow::Create(ptr_507B9C->uX, ptr_507B9C->uY, 0, 0, (WindowType)(WINDOW_HouseInterior|0x42), (int)ptr_507B9C, 0); LABEL_707: dword_506548 = v0; goto _continue; case UIMSG_AA: - GUIWindow::Create(ptr_507BA0->uX, ptr_507BA0->uY, 0, 0, WINDOW_HouseInterior|0x42, (int)ptr_507BA0, 0); + GUIWindow::Create(ptr_507BA0->uX, ptr_507BA0->uY, 0, 0, (WindowType)(WINDOW_HouseInterior|0x42), (int)ptr_507BA0, 0); LABEL_709: dword_506544 = v0; goto _continue; @@ -3069,7 +3069,7 @@ pCharacterScreen_AwardsBtn->uY, 0, 0, - WINDOW_HouseInterior|0x42, + (WindowType)(WINDOW_HouseInterior|0x42), (int)pCharacterScreen_AwardsBtn, 0); sub_419100(); @@ -3371,7 +3371,7 @@ //----- (00435748) -------------------------------------------------------- void __cdecl GUI_MainMenuMessageProc() { - AudioPlayer *v0; // ebp@2 + //AudioPlayer *v0; // ebp@2 char *v1; // ebx@2 unsigned int v2; // ecx@18 void *v3; // edi@21 @@ -3421,7 +3421,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) { - v0 = pAudioPlayer; + //v0 = pAudioPlayer; v1 = (char *)pParty->pPlayers; do { @@ -3521,7 +3521,7 @@ (enum WindowType)92, (int)pCreationUI_BtnPressLeft[v25], 1); - v0 = pAudioPlayer; + //v0 = pAudioPlayer; pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); v22 = (Player *)v23; goto LABEL_117; @@ -3550,7 +3550,7 @@ (enum WindowType)92, (int)pCreationUI_BtnPressRight[v21], 1); - v0 = pAudioPlayer; + //v0 = pAudioPlayer; pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); v22 = (Player *)v19; LABEL_117: @@ -3904,7 +3904,7 @@ v40 = 2; goto LABEL_89; } - if ( v45 == 57 ) + if ( v45 == UIMSG_ExitToWindows ) { GUIWindow::Create(0x1EFu, 0x151u, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnExit, 0); v40 = 4; @@ -14245,7 +14245,7 @@ v3 = a4; pEventTimer->Pause(); dword_506F0C[0] = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; - result = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_FinalWindow, v3, (int)v2); + result = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, v3, (int)v2); ptr_507BDC = result; uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 22; return result; @@ -14903,12 +14903,13 @@ GUIButton Dst; // [sp+28h] [bp-E0h]@133 ItemGen v51; // [sp+E4h] [bp-24h]@129 - if ( GetCurrentMenuID() != 6 ) - sub_41CD4F(0x22u); + if (GetCurrentMenuID() != MENU_CREATEPARTY) + sub_41CD4F(34); for ( i = 1; i <= uNumVisibleWindows; ++i ) { - v0 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[i]]; - v1 = v0->uWindowType; + //v0 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[i]]; + v0 = &pWindowList[pVisibleWindowsIdxs[i] - 1]; + v1 = v0->eWindowType; if ( (signed int)v1 > 70 ) { if ( (signed int)v1 > 95 ) @@ -15889,7 +15890,7 @@ if ( v5 ) { if ( a2 == 57 ) - v7 = (const CHAR *)dword_72266C; + v7 = pNPCTopics[512].pText; else v7 = (const CHAR *)*(&pNPCStats->field_13A5C + 5 * v5->uProfession); lpsz = v7; @@ -16406,7 +16407,8 @@ return; while ( 1 ) { - v8 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v7]]; + //v8 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v7]]; + v8 = &pWindowList[pVisibleWindowsIdxs[v7] - 1]; if ( x >= (signed int)v8->uFrameX ) { if ( x <= (signed int)v8->uFrameZ && y >= (signed int)v8->uFrameY && y <= (signed int)v8->uFrameW ) @@ -16516,7 +16518,7 @@ { if ( pArcomageGame->bGameInProgress == 1 ) { - if ( pAsyncMouse ) + if (pAsyncMouse) pArcomageGame->stru1.field_0 = 7; } } @@ -16526,7 +16528,7 @@ { if ( pArcomageGame->bGameInProgress == 1 ) { - if ( pAsyncMouse ) + if (pAsyncMouse) pArcomageGame->stru1.field_0 = 8; } }
--- a/mm7_6.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_6.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -2342,7 +2342,7 @@ { if ( ptr_507BD4 ) return result; - ptr_507BD4 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior|0x2, (int)&pStru277[result], 0); + ptr_507BD4 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); ptr_507BD4->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 0, 0x31u, nullstring, 0); ptr_507BD4->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 1u, 0x32u, nullstring, 0); ptr_507BD4->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x45u, 2u, 0x33u, nullstring, 0); @@ -2353,7 +2353,7 @@ { if ( ptr_507BD4 ) return result; - v17 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior|0x2, (int)&pStru277[result], 0); + v17 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); v29 = 0; v28 = nullstring; v27 = 0; @@ -2376,7 +2376,7 @@ { if ( ptr_507BD4 ) return result; - v17 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior|0x2, (int)&pStru277[result], 0); + v17 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); v29 = 0; v28 = nullstring; v27 = 0; @@ -2400,7 +2400,7 @@ { if ( ptr_507BD4 ) return result; - ptr_507BD4 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior|0x2, 20 * result + 5292232, 0); + ptr_507BD4 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), 20 * result + 5292232, 0); ptr_507BD4->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 0, 0x31u, nullstring, 0); ptr_507BD4->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 1u, 0x32u, nullstring, 0); ptr_507BD4->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, 0x8Du, 2u, 0x33u, nullstring, 0); @@ -2421,7 +2421,7 @@ } if ( HIBYTE(v6) & 2 && !ptr_507BD4 ) { - ptr_507BD4 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior|0x2, 20 * result + 5292232, 0); + ptr_507BD4 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), 20 * result + 5292232, 0); ptr_5079EC = ptr_507BD4->CreateButton( 0x1D5u, 0xB2u,
--- a/mm7_data.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_data.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -1,5 +1,6 @@ #include "mm7_data.h" +#include "NPC.h" @@ -324,6 +325,7 @@ int (__cdecl *sprintfex)(char *a1, const char *a2, ...) = nullptr; +int pWindowList_at_506F50_minus1_indexing[1]; int dword_4C9890[10]; // weak int dword_4C9920[16]; // weak _UNKNOWN unk_4D8548; // weak @@ -1060,24 +1062,13 @@ char aGammaControlNo[777]; // idb __int16 word_4E8152[11]; char byte_4E8168[116]; -char aEWorkMsdevMm7Mm7CodeGenerate_cpp[777]; // idb -char aCanTCreateRandomMonsterSSeeMapstats_txtAndMonsters[777]; // idb -char aSC[777]; // idb -char aSB[5]; // weak -char aSA[777]; // idb -char aElementalLightA[777]; // idb -char aElementalLightB[18]; // weak -char aElementalLightC[18]; // weak -char asc_4E82A4[2]; // weak -int dword_4E82B4; // weak -int dword_4E82B8; // weak -int dword_4E82BC; // weak -int dword_4E82C0; // weak char aD3dTextureName[777]; // idb char aLogd3d_txt[777]; // idb char byte_4E8398[777]; // weak _UNKNOWN unk_4E83B0; // weak _UNKNOWN unk_4E8408; // weak +stru355 stru_4E82A4 = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000}; +stru355 stru_4EFCBC = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000}; char aGlobal_txt[777]; // idb char aMagic[777]; // idb char aDark_0[777]; // idb @@ -2084,7 +2075,6 @@ char aDirect3dRender[777]; // idb char aD3drendInitFai[777]; // idb char aThereArenTAn_0[777]; // idb -int dword_4EFCBC[8]; char aErrorExecuting[777]; // idb char aEWorkMsdevM_23[777]; // idb char aHiscreen16Load[777]; // idb @@ -2370,7 +2360,6 @@ int dword_506E68; // weak __int16 word_506E6C[18]; // weak unsigned int pPrevVirtualCidesMapping[27]; -int pWindowList_at_506F50_minus1_indexing[777]; // idb int dword_506F08; // weak int dword_506F0C[777]; // idb int uRestUI_FoodRequiredToRest; @@ -2702,7 +2691,7 @@ int dword_6BE368_debug_settings_2; // weak unsigned __int8 bUseLoResSprites; unsigned __int8 bUseRegistry; -unsigned __int8 bCanLoadFromCD; +unsigned __int8 bCanLoadFromCD = false; int bShowDamage; // idb unsigned int bAlwaysRun; unsigned int bFlipOnExit; @@ -2721,6 +2710,7 @@ char _702ACC_unused; // weak int bDebugResouces; // weak unsigned int bNoVideo; +bool bNoCD = false; int aborting_app; // weak int dword_720020_zvalues[100]; int dword_7201B0_zvalues[299]; @@ -2755,33 +2745,7 @@ int blv_prev_party_y; // weak char *dword_721660; // idb char *dword_721664; // idb -_UNKNOWN unk_721668_pNPCTopic; // weak -_UNKNOWN unk_72166C_pNPCText; // weak -int dword_721824; // weak -int dword_72193C; // weak -int dword_721984[22]; -int dword_7219DC[777]; // weak -char *dword_721A34; // idb -char *_721A3C_npc_text; // idb -int dword_721A44; // weak -int dword_721A4C; // weak -int dword_721A64; // weak -int _721A6C_npc_text[777]; // weak -int _721A84_npc_text; // weak -int dword_721BAC[6]; -char *dword_721BC4; // idb -_UNKNOWN dword_721E24[777]; // idb -int dword_722164; // weak -int dword_72216C; // weak -int dword_722174; // weak -char *pStr_72217C; // idb -int dword_722240[777]; // idb -int dword_722320; // weak -char *pstr_722494; -int dword_72266C; // weak -_UNKNOWN unk_722880; // weak -int dword_722B3C; // weak -int dword_722B44; // weak +NPCTopic pNPCTopics[789]; char *dword_722F10; // idb const char *pQuestTable[512]; _UNKNOWN unk_723714; // weak @@ -2791,7 +2755,7 @@ int dword_723E80_award_related[777]; // weak int dword_723E84[777]; // weak int dword_7241C8; // weak -struct NPCStats *pNPCStats; +struct NPCStats *pNPCStats = nullptr; char *aNPCProfessionNames[59]; char *pAwardsTXT_Raw; char *pScrollsTXT_Raw; @@ -2895,7 +2859,7 @@ int dword_F8B198; // weak int dword_F8B19C; // weak __int16 word_F8B1A0; // weak -char *dword_F8B1A4; // idb +const char *dword_F8B1A4; // idb int dword_F8B1A8; // weak int dword_F8B1AC_something_todo_with_awards; // idb int dword_F8B1B0; // weak @@ -2906,7 +2870,7 @@ int dword_F8B1DC; // weak int dword_F8B1E0; // weak int dword_F8B1E4; // weak -char *ptr_F8B1E8; // idb +const char *ptr_F8B1E8; // idb char byte_F8B1EC; // weak char byte_F8B1EF[777]; // weak char byte_F8B1F0[4];
--- a/mm7_data.h Tue Oct 09 13:09:08 2012 +0200 +++ b/mm7_data.h Wed Oct 10 14:21:15 2012 +0200 @@ -312,6 +312,7 @@ // Data declarations extern int (__cdecl *sprintfex)(char *a1, const char *a2, ...); +extern int pWindowList_at_506F50_minus1_indexing[1]; extern int dword_4C9890[10]; // weak extern int dword_4C9920[16]; // weak extern _UNKNOWN unk_4D8548; // weak @@ -1048,24 +1049,14 @@ extern char aGammaControlNo[]; // idb extern __int16 word_4E8152[11]; extern char byte_4E8168[116]; -extern char aEWorkMsdevMm7Mm7CodeGenerate_cpp[]; // idb -extern char aCanTCreateRandomMonsterSSeeMapstats_txtAndMonsters[]; // idb -extern char aSC[]; // idb -extern char aSB[5]; // weak -extern char aSA[]; // idb -extern char aElementalLightA[]; // idb -extern char aElementalLightB[18]; // weak -extern char aElementalLightC[18]; // weak -extern char asc_4E82A4[2]; // weak -extern int dword_4E82B4; // weak -extern int dword_4E82B8; // weak -extern int dword_4E82BC; // weak -extern int dword_4E82C0; // weak extern char aD3dTextureName[]; // idb extern char aLogd3d_txt[]; // idb extern char byte_4E8398[]; // weak extern _UNKNOWN unk_4E83B0; // weak extern _UNKNOWN unk_4E8408; // weak +#include "Texture.h" +extern stru355 stru_4E82A4;// = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000}; +extern stru355 stru_4EFCBC;// = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000}; extern char aGlobal_txt[]; // idb extern char aMagic[]; // idb extern char aDark_0[]; // idb @@ -2072,7 +2063,6 @@ extern char aDirect3dRender[]; // idb extern char aD3drendInitFai[]; // idb extern char aThereArenTAn_0[]; // idb -extern int dword_4EFCBC[8]; extern char aErrorExecuting[]; // idb extern char aEWorkMsdevM_23[]; // idb extern char aHiscreen16Load[]; // idb @@ -2359,7 +2349,6 @@ extern int dword_506E68; // weak extern __int16 word_506E6C[18]; // weak extern unsigned int pPrevVirtualCidesMapping[27]; -extern int pWindowList_at_506F50_minus1_indexing[]; // idb extern int dword_506F08; // weak extern int dword_506F0C[]; // idb extern int uRestUI_FoodRequiredToRest; @@ -2710,6 +2699,7 @@ extern char _702ACC_unused; // weak extern int bDebugResouces; // weak extern unsigned int bNoVideo; +extern bool bNoCD; extern int aborting_app; // weak extern int dword_720020_zvalues[100]; extern int dword_7201B0_zvalues[299]; @@ -2744,33 +2734,6 @@ extern int blv_prev_party_y; // weak extern char *dword_721660; // idb extern char *dword_721664; // idb -extern _UNKNOWN unk_721668_pNPCTopic; // weak -extern _UNKNOWN unk_72166C_pNPCText; // weak -extern int dword_721824; // weak -extern int dword_72193C; // weak -extern int dword_721984[22]; -extern int dword_7219DC[]; // weak -extern char *dword_721A34; // idb -extern char *_721A3C_npc_text; // idb -extern int dword_721A44; // weak -extern int dword_721A4C; // weak -extern int dword_721A64; // weak -extern int _721A6C_npc_text[]; // weak -extern int _721A84_npc_text; // weak -extern int dword_721BAC[6]; -extern char *dword_721BC4; // idb -extern _UNKNOWN dword_721E24[]; // idb -extern int dword_722164; // weak -extern int dword_72216C; // weak -extern int dword_722174; // weak -extern char *pStr_72217C; // idb -extern int dword_722240[]; // idb -extern int dword_722320; // weak -extern char *pstr_722494; -extern int dword_72266C; // weak -extern _UNKNOWN unk_722880; // weak -extern int dword_722B3C; // weak -extern int dword_722B44; // weak extern char *dword_722F10; // idb extern const char *pQuestTable[512]; extern _UNKNOWN unk_723714; // weak @@ -2884,7 +2847,7 @@ extern int dword_F8B198; // weak extern int dword_F8B19C; // weak extern __int16 word_F8B1A0; // weak -extern char *dword_F8B1A4; // idb +extern const char *dword_F8B1A4; // idb extern int dword_F8B1A8; // weak extern int dword_F8B1AC_something_todo_with_awards; // idb extern int dword_F8B1B0; // weak @@ -2895,7 +2858,7 @@ extern int dword_F8B1DC; // weak extern int dword_F8B1E0; // weak extern int dword_F8B1E4; // weak -extern char *ptr_F8B1E8; // idb +extern const char *ptr_F8B1E8; // idb extern char byte_F8B1EC; // weak extern char byte_F8B1EF[]; // weak extern char byte_F8B1F0[4]; @@ -3214,7 +3177,7 @@ void __cdecl DrawBranchlessDialogueUI(); void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4); void __cdecl sub_4452BB(); -int __fastcall sub_445308(int a1); +const char *__fastcall sub_445308(int a1); void __cdecl DrawDialogueUI(); struct NPCData *__fastcall GetNPCData(unsigned int npcid); struct NPCData *__fastcall GetNewNPCData(signed int npcid, int a2); @@ -3519,7 +3482,7 @@ void __cdecl sub_4B1ECE(); void __fastcall sub_4B2001(signed int a1); char *__thiscall _4B254D_SkillMasteryTeacher(int _this); -int __fastcall sub_4B29F2(int a1); +const char *__fastcall sub_4B29F2(int a1); char __cdecl sub_4B2A74(); struct GUIButton *__fastcall sub_4B36CC(int a1, unsigned int a2); int __thiscall sub_4B3703(void *_this); @@ -3550,7 +3513,7 @@ POINT *__cdecl sub_4B9CC6(); void __cdecl sub_4BA928(); signed int __fastcall sub_4BB756(signed int a1); -int __cdecl sub_4BBA85_bounties(); +const char *sub_4BBA85_bounties(); void __cdecl sub_4BBCDD(); void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb void __cdecl ArenaFight();