comparison mm7_2.cpp @ 1465:090ff42290c4

Слияние
author Ritor1
date Mon, 26 Aug 2013 10:39:24 +0600
parents 2ca62c9e7b3c
children 0a7ceb4b25b7
comparison
equal deleted inserted replaced
1464:b870630761df 1465:090ff42290c4
294 dword_F8B1A4 = (char *)result; 294 dword_F8B1A4 = (char *)result;
295 return result; 295 return result;
296 } 296 }
297 297
298 //----- (004BBCDD) -------------------------------------------------------- 298 //----- (004BBCDD) --------------------------------------------------------
299 void __cdecl sub_4BBCDD() 299 void sub_4BBCDD()
300 { 300 {
301 signed int v0; // ebp@3 301 signed int v0; // ebp@3
302 Actor *v1; // eax@4 302 Actor *v1; // eax@4
303 __int16 v2; // cx@5 303 __int16 v2; // cx@5
304 int v3; // esi@8 304 int v3; // esi@8
385 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); 385 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1);
386 } 386 }
387 } 387 }
388 388
389 //----- (004BC109) -------------------------------------------------------- 389 //----- (004BC109) --------------------------------------------------------
390 void __cdecl ArenaFight() 390 void ArenaFight()
391 { 391 {
392 int v0; // edi@1 392 int v0; // edi@1
393 char *v1; // eax@7 393 char *v1; // eax@7
394 Player *v2; // edi@9 394 Player *v2; // edi@9
395 int v3; // eax@10 395 int v3; // eax@10
596 } 596 }
597 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); 597 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0);
598 } 598 }
599 599
600 //----- (004BD8B5) -------------------------------------------------------- 600 //----- (004BD8B5) --------------------------------------------------------
601 signed int __cdecl sub_4BD8B5() 601 int sub_4BD8B5()
602 { 602 {
603 int v0; // eax@4 603 int v0; // eax@4
604 int v1; // eax@29 604 int v1; // eax@29
605 unsigned int v2; // esi@30 605 unsigned int v2; // esi@30
606 //const char *v3; // ebx@31 606 //const char *v3; // ebx@31
607 607
608 if ( pMessageQueue_50CBD0->uNumMessages ) 608 if ( pMessageQueue_50CBD0->uNumMessages )
609 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 609 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
610 pKeyActionMap->SetWindowInputStatus(3); 610 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
611 pKeyActionMap->ResetKeys(); 611 pKeyActionMap->ResetKeys();
612 activeLevelDecoration = NULL; 612 activeLevelDecoration = NULL;
613 current_npc_text = 0; 613 current_npc_text = 0;
614 if ( pDialogueNPCCount ) 614 if ( pDialogueNPCCount )
615 { 615 {
692 } 692 }
693 return 0; 693 return 0;
694 } 694 }
695 695
696 //----- (004BF91E) -------------------------------------------------------- 696 //----- (004BF91E) --------------------------------------------------------
697 unsigned int __thiscall GameOverMenu(void *ecx0) 697 unsigned int GameOverMenu(void *ecx0)
698 { 698 {
699 char *v1; // eax@2 699 char *v1; // eax@2
700 unsigned int result; // eax@3 700 unsigned int result; // eax@3
701 Player *v3; // eax@7 701 Player *v3; // eax@7
702 char *v4; // ST24_4@9 702 char *v4; // ST24_4@9
1576 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);; 1576 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);;
1577 return a1a.Create(0, 0, 0, 0); 1577 return a1a.Create(0, 0, 0, 0);
1578 } 1578 }
1579 1579
1580 //----- (00450521) -------------------------------------------------------- 1580 //----- (00450521) --------------------------------------------------------
1581 signed int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6) 1581 int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6)
1582 { 1582 {
1583 int v6; // edi@1 1583 int v6; // edi@1
1584 int v7; // esi@1 1584 int v7; // esi@1
1585 signed int v8; // edi@1 1585 signed int v8; // edi@1
1586 unsigned __int16 v9; // cx@1 1586 unsigned __int16 v9; // cx@1
1960 return result; 1960 return result;
1961 } 1961 }
1962 // 5C6DF8: using guessed type int dword_5C6DF8; 1962 // 5C6DF8: using guessed type int dword_5C6DF8;
1963 1963
1964 //----- (00450DA3) -------------------------------------------------------- 1964 //----- (00450DA3) --------------------------------------------------------
1965 int __cdecl GetAlertStatus() 1965 int GetAlertStatus()
1966 { 1966 {
1967 int result; // eax@2 1967 int result; // eax@2
1968 1968
1969 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 1969 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
1970 result = pOutdoor->ddm.field_C_alert; 1970 result = pOutdoor->ddm.field_C_alert;
3032 PlayLevelMusic(); 3032 PlayLevelMusic();
3033 } 3033 }
3034 // 6BE35C: using guessed type int uLevel_StartingPointType; 3034 // 6BE35C: using guessed type int uLevel_StartingPointType;
3035 3035
3036 //----- (00461103) -------------------------------------------------------- 3036 //----- (00461103) --------------------------------------------------------
3037 void __cdecl sub_461103() 3037 void _461103_load_level_sub()
3038 { 3038 {
3039 //GUIProgressBar *v0; // ebx@1 3039 //GUIProgressBar *v0; // ebx@1
3040 //signed int v1; // ebp@1 3040 //signed int v1; // ebp@1
3041 //char *v2; // esi@2 3041 //char *v2; // esi@2
3042 __int16 v3; // cx@3 3042 __int16 v3; // cx@3
3186 3186
3187 if ( dword_6BE368_debug_settings_2 & 4 ) 3187 if ( dword_6BE368_debug_settings_2 & 4 )
3188 uNumActors = 0; 3188 uNumActors = 0;
3189 if ( dword_6BE368_debug_settings_2 & 8 ) 3189 if ( dword_6BE368_debug_settings_2 & 8 )
3190 uNumLevelDecorations = 0; 3190 uNumLevelDecorations = 0;
3191 sub_4613C4(); 3191 init_event_triggers();
3192 3192
3193 pGameLoadingUI_ProgressBar->Progress(); 3193 pGameLoadingUI_ProgressBar->Progress();
3194 3194
3195 pIndoorCamera->pos.y = 0; 3195 pIndoorCamera->pos.y = 0;
3196 pIndoorCamera->pos.x = 0; 3196 pIndoorCamera->pos.x = 0;
3204 if ( pParty->pPickedItem.uItemID != 0 ) 3204 if ( pParty->pPickedItem.uItemID != 0 )
3205 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID); 3205 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID);
3206 } 3206 }
3207 3207
3208 //----- (004613C4) -------------------------------------------------------- 3208 //----- (004613C4) --------------------------------------------------------
3209 int __cdecl sub_4613C4() 3209 void init_event_triggers()
3210 { 3210 {
3211 unsigned __int16 v0; // ax@1 3211 uint id = pDecorationList->GetDecorIdByName("Event Trigger");
3212 size_t v1; // ecx@1 3212
3213 int v2; // esi@1 3213 num_event_triggers = 0;
3214 int result; // eax@1 3214 for (uint i = 0; i < uNumLevelDecorations; ++i)
3215 LevelDecoration *v4; // edx@2 3215 if (pLevelDecorations[i].uDecorationDescID == id)
3216 int v5; // edi@4 3216 event_triggers[num_event_triggers++] = i;
3217
3218 _6836C8_num_decorations_6807E8 = 0;
3219 v0 = pDecorationList->GetDecorIdByName("Event Trigger");
3220 v1 = uNumLevelDecorations;
3221 v2 = (signed __int16)v0;
3222 result = 0;
3223 if ( (signed int)uNumLevelDecorations > 0 )
3224 {
3225 v4 = pLevelDecorations.data();
3226 do
3227 {
3228 if ( v4->uDecorationDescID == v2 )
3229 {
3230 v5 = _6836C8_num_decorations_6807E8++;
3231 _6807E8_level_decorations_ids[v5] = result;
3232 }
3233 ++result;
3234 ++v4;
3235 }
3236 while ( result < (signed int)v1 );
3237 }
3238 return result;
3239 } 3217 }
3240 // 6836C8: using guessed type int 6836C8_num_decorations_6807E8;
3241 3218
3242 //----- (004621DA) -------------------------------------------------------- 3219 //----- (004621DA) --------------------------------------------------------
3243 int int_get_vector_length(signed int x, signed int y, signed int z) 3220 int int_get_vector_length(signed int x, signed int y, signed int z)
3244 { 3221 {
3245 signed int v3; // eax@2 3222 signed int v3; // eax@2
3265 return (11 * y >> 5) + x + (z >> 2); 3242 return (11 * y >> 5) + x + (z >> 2);
3266 } 3243 }
3267 3244
3268 OPENFILENAMEA ofn; 3245 OPENFILENAMEA ofn;
3269 //----- (0046271C) -------------------------------------------------------- 3246 //----- (0046271C) --------------------------------------------------------
3270 void __cdecl crt_init_globals_46271C() 3247 void CreateDefaultBLVLevel()
3271 { 3248 {
3272 ofn.lStructSize = 0x4Cu; 3249 ofn.lStructSize = 0x4Cu;
3273 ofn.hwndOwner = hWnd; 3250 ofn.hwndOwner = hWnd;
3274 ofn.hInstance = 0; 3251 ofn.hInstance = 0;
3275 ofn.lpstrFilter = "Indoor BLV Files (*.blv)"; 3252 ofn.lpstrFilter = "Indoor BLV Files (*.blv)";
3376 viewparams->bRedrawGameUI = 1; 3353 viewparams->bRedrawGameUI = 1;
3377 } 3354 }
3378 } 3355 }
3379 else 3356 else
3380 { 3357 {
3381 if ( !ptr_507BDC )// ??? 3358 if ( !pModalWindow )// ???
3382 { 3359 {
3383 pButton = pWindow->pControlsHead; 3360 pButton = pWindow->pControlsHead;
3384 for ( pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext ) 3361 for ( pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext )
3385 { 3362 {
3386 if ( pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ 3363 if ( pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ
3446 int pXY[2]; // [sp+64h] [bp-8h]@261 3423 int pXY[2]; // [sp+64h] [bp-8h]@261
3447 int a2; // [sp+7Ch] [bp+10h]@50 3424 int a2; // [sp+7Ch] [bp+10h]@50
3448 3425
3449 switch (Msg) 3426 switch (Msg)
3450 { 3427 {
3428 case WM_SIZING: return 1;
3451 case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam); 3429 case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
3452 case WM_CHAR: 3430 case WM_CHAR:
3453 { 3431 {
3454 if (!pKeyActionMap->_459F10(wParam) && !viewparams->field_4C) 3432 if (!pKeyActionMap->_459F10(wParam) && !viewparams->field_4C)
3455 GUI_HandleHotkey(wParam); 3433 GUI_HandleHotkey(wParam);
3456 } 3434 }
3457 return DefWindowProcA(hWnd, Msg, wParam, lParam); 3435 return DefWindowProcA(hWnd, Msg, wParam, lParam);
3436
3437
3438 case WM_DEVICECHANGE:
3439 {
3440 if (wParam == 0x8000) // CD or some device has been inserted - notify InsertCD dialog
3441 PostMessageA(hInsertCDWindow, WM_USER + 1, 0, 0);
3442 return 0;
3443 }
3458 3444
3459 case WM_COMMAND: 3445 case WM_COMMAND:
3460 { 3446 {
3461 switch (wParam) 3447 switch (wParam)
3462 { 3448 {
3638 3624
3639 if ( Msg > WM_SYSCOMMAND ) 3625 if ( Msg > WM_SYSCOMMAND )
3640 { 3626 {
3641 switch ( Msg ) 3627 switch ( Msg )
3642 { 3628 {
3643 case WM_DEVICECHANGE:
3644 if ( wParam == 0x8000 )
3645 PostMessageA(hInsertCDWindow, WM_CHOOSEFONT_GETLOGFONT, 0, 0);
3646 return 0;
3647 case WM_SIZING:
3648 return 1;
3649 case WM_LBUTTONDOWN: 3629 case WM_LBUTTONDOWN:
3650 if ( pArcomageGame->bGameInProgress ) 3630 if ( pArcomageGame->bGameInProgress )
3651 { 3631 {
3652 pArcomageGame->stru1.field_0 = 7; 3632 pArcomageGame->stru1.field_0 = 7;
3653 ArcomageGame::OnMouseClick(0, 1); 3633 ArcomageGame::OnMouseClick(0, 1);
3761 } 3741 }
3762 } 3742 }
3763 if ( !pGame ) 3743 if ( !pGame )
3764 //goto _def_wnd_proc; 3744 //goto _def_wnd_proc;
3765 return DefWindowProcA(hWnd, Msg, wParam, lParam); 3745 return DefWindowProcA(hWnd, Msg, wParam, lParam);
3766 sub_417871(0);
3767 return DefWindowProcA(hWnd, Msg, wParam, lParam); 3746 return DefWindowProcA(hWnd, Msg, wParam, lParam);
3768 case WM_MOUSEMOVE: 3747 case WM_MOUSEMOVE:
3769 if ( pArcomageGame->bGameInProgress ) 3748 if ( pArcomageGame->bGameInProgress )
3770 { 3749 {
3771 pXY[0] = (unsigned __int16)lParam; 3750 pXY[0] = (unsigned __int16)lParam;
3844 SendMessageA(hWnd, WM_COMMAND, 104, 0); 3823 SendMessageA(hWnd, WM_COMMAND, 104, 0);
3845 return 0; 3824 return 0;
3846 } 3825 }
3847 if ( wParam >= VK_LEFT && wParam <= VK_DOWN ) 3826 if ( wParam >= VK_LEFT && wParam <= VK_DOWN )
3848 { 3827 {
3849 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) 3828 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW )
3850 { 3829 {
3851 if ( !viewparams->field_4C ) 3830 if ( !viewparams->field_4C )
3852 UI_OnKeyDown(wParam); 3831 UI_OnKeyDown(wParam);
3853 return 0; 3832 return 0;
3854 } 3833 }
3855 } 3834 }
3856 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) 3835 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW )
3857 return 0; 3836 return 0;
3858 } 3837 }
3859 3838
3860 pArcomageGame->stru1.field_0 = 1; 3839 pArcomageGame->stru1.field_0 = 1;
3861 3840
4021 return DefWindowProcA(hWnd, Msg, wParam, lParam); 4000 return DefWindowProcA(hWnd, Msg, wParam, lParam);
4022 4001
4023 } 4002 }
4024 4003
4025 //----- (00464479) -------------------------------------------------------- 4004 //----- (00464479) --------------------------------------------------------
4026 void __cdecl ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() 4005 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
4027 { 4006 {
4028 int v0; // esi@9 4007 int v0; // esi@9
4029 4008
4030 if (pMouse) 4009 if (pMouse)
4031 pMouse->SetCursorBitmap("MICON1"); 4010 pMouse->SetCursorBitmap("MICON1");
4054 while ( v0 > 0 ) 4033 while ( v0 > 0 )
4055 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release(); 4034 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release();
4056 } 4035 }
4057 4036
4058 //----- (004646F0) -------------------------------------------------------- 4037 //----- (004646F0) --------------------------------------------------------
4059 void PrepareWorld(unsigned int this_) 4038 void PrepareWorld(unsigned int _0_box_loading_1_fullscreen)
4060 { 4039 {
4061 unsigned int v1; // ebx@1
4062
4063 v1 = this_;
4064 if ( pRenderer->pRenderD3D ) 4040 if ( pRenderer->pRenderD3D )
4065 pGame->pVisInstance->_4C1A02(); 4041 pGame->pVisInstance->_4C1A02();
4066 pEventTimer->Pause(); 4042 pEventTimer->Pause();
4067 pMiscTimer->Pause(); 4043 pMiscTimer->Pause();
4068 pParty->uFlags = 2; 4044 pParty->uFlags = 2;
4069 pCastSpellInfo.data()->_427D48(1); 4045 pCastSpellInfo.data()->_427D48(1);
4070 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); 4046 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
4071 DoPrepareWorld(0, (v1 == 0) + 1); 4047 DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1);
4072 pMiscTimer->Resume(); 4048 pMiscTimer->Resume();
4073 pEventTimer->Resume(); 4049 pEventTimer->Resume();
4074 } 4050 }
4075 4051
4076 //----- (00464761) -------------------------------------------------------- 4052 //----- (00464761) --------------------------------------------------------
4077 void __thiscall Game_DeinitializeAndTerminate(int exitCode) 4053 void Game_DeinitializeAndTerminate(int exitCode)
4078 { 4054 {
4079 int v1; // esi@1 4055 int v1; // esi@1
4080 HANDLE v2; // eax@1 4056 HANDLE v2; // eax@1
4081 4057
4082 v1 = exitCode; 4058 v1 = exitCode;
4107 pIcons_LOD->_inlined_sub1(); 4083 pIcons_LOD->_inlined_sub1();
4108 } 4084 }
4109 // 6BE3A0: using guessed type float flt_6BE3A0; 4085 // 6BE3A0: using guessed type float flt_6BE3A0;
4110 4086
4111 //----- (00464839) -------------------------------------------------------- 4087 //----- (00464839) --------------------------------------------------------
4112 char __cdecl Is_out15odm_underwater() 4088 char Is_out15odm_underwater()
4113 { 4089 {
4114 return _stricmp(pCurrentMapName.data(), "out15.odm") == 0; 4090 return _stricmp(pCurrentMapName.data(), "out15.odm") == 0;
4115 } 4091 }
4116 4092
4117 //----- (00464851) -------------------------------------------------------- 4093 //----- (00464851) --------------------------------------------------------
4118 void __cdecl SetUnderwaterFog() 4094 void SetUnderwaterFog()
4119 { 4095 {
4120 day_fogrange_1 = 50; 4096 day_fogrange_1 = 50;
4121 day_fogrange_2 = 5000; 4097 day_fogrange_2 = 5000;
4122 } 4098 }
4123 4099
4124 //----- (00464866) -------------------------------------------------------- 4100 //----- (00464866) --------------------------------------------------------
4125 void __fastcall DoPrepareWorld(unsigned int bLoading, int a2) 4101 void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box)
4126 { 4102 {
4127 int v2; // esi@1 4103 //int v2; // esi@1
4128 char *v3; // eax@1 4104 char *v3; // eax@1
4129 //char *v4; // eax@1 4105 //char *v4; // eax@1
4130 unsigned int v5; // eax@3 4106 unsigned int v5; // eax@3
4131 //size_t v6; // ecx@10 4107 //size_t v6; // ecx@10
4132 //char *v7; // eax@11 4108 //char *v7; // eax@11
4133 char Str1[20]; // [sp+Ch] [bp-18h]@1 4109 char Str1[20]; // [sp+Ch] [bp-18h]@1
4134 unsigned int v9; // [sp+20h] [bp-4h]@1 4110 unsigned int v9; // [sp+20h] [bp-4h]@1
4135 4111
4136 v2 = a2;
4137 v9 = bLoading; 4112 v9 = bLoading;
4138 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); 4113 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
4139 pDecalBuilder->Reset(0); 4114 pDecalBuilder->Reset(0);
4140 pGameLoadingUI_ProgressBar->Initialize((GUIProgressBar::Type)v2); 4115 pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen :
4116 GUIProgressBar::TYPE_Box);
4141 strcpy(Str1, pCurrentMapName.data()); 4117 strcpy(Str1, pCurrentMapName.data());
4142 v3 = strtok(Str1, "."); 4118 v3 = strtok(Str1, ".");
4143 strcpy(Str1, v3); 4119 strcpy(Str1, v3);
4144 Level_LoadEvtAndStr(Str1); 4120 Level_LoadEvtAndStr(Str1);
4145 LoadLevel_InitializeLevelEvt(); 4121 LoadLevel_InitializeLevelEvt();
4164 if ( _stricmp(Str1, "blv") ) 4140 if ( _stricmp(Str1, "blv") )
4165 PrepareToLoadODM(v9, 0); 4141 PrepareToLoadODM(v9, 0);
4166 else 4142 else
4167 PrepareToLoadBLV(v9); 4143 PrepareToLoadBLV(v9);
4168 pAudioPlayer->SetMapEAX(); 4144 pAudioPlayer->SetMapEAX();
4169 sub_461103(); 4145 _461103_load_level_sub();
4170 if ( !_stricmp(pCurrentMapName.data(), "d11.blv") || !_stricmp(pCurrentMapName.data(), "d10.blv") ) 4146 if ( !_stricmp(pCurrentMapName.data(), "d11.blv") || !_stricmp(pCurrentMapName.data(), "d10.blv") )
4171 { 4147 {
4172 //spawning grounds & good analogue - no loot & exp from monsters 4148 //spawning grounds & good analogue - no loot & exp from monsters
4173 4149
4174 for (uint i = 0; i < uNumActors; ++i) 4150 for (uint i = 0; i < uNumActors; ++i)
4179 } 4155 }
4180 } 4156 }
4181 bDialogueUI_InitializeActor_NPC_ID = 0; 4157 bDialogueUI_InitializeActor_NPC_ID = 0;
4182 OnMapLoad(); 4158 OnMapLoad();
4183 pGameLoadingUI_ProgressBar->Progress(); 4159 pGameLoadingUI_ProgressBar->Progress();
4184 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D)); 4160 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D));
4185 pGameLoadingUI_ProgressBar->Release(); 4161 pGameLoadingUI_ProgressBar->Release();
4186 _flushall(); 4162 _flushall();
4187 } 4163 }
4188 4164
4189 //----- (004649EF) -------------------------------------------------------- 4165 //----- (004649EF) --------------------------------------------------------
5085 initing = false; //ADDED Gloval 5061 initing = false; //ADDED Gloval
5086 return true; 5062 return true;
5087 } 5063 }
5088 5064
5089 //----- (00465D0B) -------------------------------------------------------- 5065 //----- (00465D0B) --------------------------------------------------------
5090 void __cdecl SecondaryInitialization() 5066 void SecondaryInitialization()
5091 { 5067 {
5092 __int16 v4; // ax@4 5068 __int16 v4; // ax@4
5093 signed int v5; // esi@5 5069 signed int v5; // esi@5
5094 int v6; // ecx@6 5070 int v6; // ecx@6
5095 int v7; // edx@7 5071 int v7; // edx@7
5454 uGameState = GAME_STATE_PLAYING; 5430 uGameState = GAME_STATE_PLAYING;
5455 pGame->Loop(); 5431 pGame->Loop();
5456 } 5432 }
5457 else 5433 else
5458 { 5434 {
5459 if (GetCurrentMenuID() == MENU_10) 5435 if (GetCurrentMenuID() == MENU_DebugBLVLevel)
5460 { 5436 {
5461 pMouse->Activate(0); 5437 pMouse->Activate(0);
5462 5438
5463 pParty->Reset(); 5439 pParty->Reset();
5464 pParty->CreateDefaultParty(1); 5440 pParty->CreateDefaultParty(1);
5465 crt_init_globals_46271C(); 5441
5442 extern void CreateDefaultBLVLevel();
5443 CreateDefaultBLVLevel();
5444
5466 extern OPENFILENAMEA ofn; 5445 extern OPENFILENAMEA ofn;
5467 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) 5446 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
5468 { 5447 {
5469 pMouse->Activate(1); 5448 pMouse->Activate(1);
5470 break; 5449 break;
5507 pGame->Deinitialize(); 5486 pGame->Deinitialize();
5508 return 1; 5487 return 1;
5509 } 5488 }
5510 5489
5511 //----- (004637E0) -------------------------------------------------------- 5490 //----- (004637E0) --------------------------------------------------------
5512 char __cdecl sub_4637E0_is_there_popup_onscreen() 5491 char sub_4637E0_is_there_popup_onscreen()
5513 { 5492 {
5514 return dword_507BF0_is_there_popup_onscreen == 1; 5493 return dword_507BF0_is_there_popup_onscreen == 1;
5515 } 5494 }
5516 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen; 5495 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen;
5517 5496
5657 5636
5658 MM7Initialization(); 5637 MM7Initialization();
5659 } 5638 }
5660 5639
5661 //----- (004666D5) -------------------------------------------------------- 5640 //----- (004666D5) --------------------------------------------------------
5662 void __cdecl MM7Initialization() 5641 void MM7Initialization()
5663 { 5642 {
5664 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 5643 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
5665 { 5644 {
5666 if ( !byte_6BE388_graphicsmode ) 5645 if ( !byte_6BE388_graphicsmode )
5667 { 5646 {
5703 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 5682 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
5704 pOutdoorCamera->_485F64(); 5683 pOutdoorCamera->_485F64();
5705 } 5684 }
5706 5685
5707 //----- (00466B8C) -------------------------------------------------------- 5686 //----- (00466B8C) --------------------------------------------------------
5708 int __cdecl AbortWithError() 5687 int AbortWithError()
5709 { 5688 {
5710 if ( !aborting_app ) 5689 if ( !aborting_app )
5711 { 5690 {
5712 ClipCursor(0); 5691 ClipCursor(0);
5713 aborting_app = 1; 5692 aborting_app = 1;
5752 case MENU_5: return L"MENU_5"; 5731 case MENU_5: return L"MENU_5";
5753 case MENU_CREATEPARTY: return L"MENU_CREATEPARTY"; 5732 case MENU_CREATEPARTY: return L"MENU_CREATEPARTY";
5754 case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC"; 5733 case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC";
5755 case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; 5734 case MENU_CREDITSPROC: return L"MENU_CREDITSPROC";
5756 case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu"; 5735 case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu";
5757 case MENU_10: return L"MENU_10"; 5736 case MENU_DebugBLVLevel: return L"MENU_DebugBLVLevel";
5758 case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE"; 5737 case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE";
5759 default: return L"unk"; 5738 default: return L"unk";
5760 }; 5739 };
5761 }; 5740 };
5762 void SetCurrentMenuID(MENU_STATE uMenu) 5741 void SetCurrentMenuID(MENU_STATE uMenu)
5770 MENU_STATE GetCurrentMenuID() 5749 MENU_STATE GetCurrentMenuID()
5771 { 5750 {
5772 return uCurrentMenuID; 5751 return uCurrentMenuID;
5773 } 5752 }
5774 5753
5775 // 720980: using guessed type int uTextureID_720980;
5776
5777 // 4E28F8: using guessed type int pCurrentScreen;
5778 5754
5779 //----- (0046A6AC) -------------------------------------------------------- 5755 //----- (0046A6AC) --------------------------------------------------------
5780 int __fastcall sub_46A6AC(int a1, int a2, int a3) 5756 int __fastcall _46A6AC_spell_render(int a1, int a2, int a3)
5781 { 5757 {
5782 int result; // eax@2 5758 int result; // eax@2
5783 unsigned int v4; // edx@3 5759 unsigned int v4; // edx@3
5784 int *v5; // esi@6 5760 int *v5; // esi@6
5785 unsigned int v6; // ebx@6 5761 unsigned int v6; // ebx@6
5796 5772
5797 v11 = a2; 5773 v11 = a2;
5798 v14 = a1; 5774 v14 = a1;
5799 if ( pRenderer->pRenderD3D ) 5775 if ( pRenderer->pRenderD3D )
5800 { 5776 {
5801 result = sub_46A7C8(a1, a2, a3); 5777 result = _46A6AC_spell_render_d3d(a1, a2, a3);
5802 } 5778 }
5803 else 5779 else
5804 { 5780 {
5781 __debugbreak(); // SW render never called
5805 v16 = 0; 5782 v16 = 0;
5806 v4 = viewparams->uScreen_topL_X; 5783 v4 = viewparams->uScreen_topL_X;
5807 v12 = viewparams->uScreen_BttmR_X; 5784 v12 = viewparams->uScreen_BttmR_X;
5808 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) 5785 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y )
5809 { 5786 {
5858 } 5835 }
5859 return result; 5836 return result;
5860 } 5837 }
5861 5838
5862 //----- (0046A7C8) -------------------------------------------------------- 5839 //----- (0046A7C8) --------------------------------------------------------
5863 int __fastcall sub_46A7C8(int a1, int a2, signed int a3) 5840 int __fastcall _46A6AC_spell_render_d3d(int a1, int a2, int a3)
5864 { 5841 {
5865 unsigned int v3; // eax@2 5842 unsigned int v3; // eax@2
5866 int v4; // ecx@2 5843 int v4; // ecx@2
5867 unsigned int v5; // eax@2 5844 unsigned int v5; // eax@2
5868 unsigned int v6; // eax@4 5845 unsigned int v6; // eax@4
5927 } 5904 }
5928 return v15; 5905 return v15;
5929 } 5906 }
5930 5907
5931 //----- (0046A89E) -------------------------------------------------------- 5908 //----- (0046A89E) --------------------------------------------------------
5932 int __fastcall sub_46A89E(int a1, int a2, signed int a3) 5909 int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3)
5933 { 5910 {
5934 signed int v3; // edi@1 5911 signed int v3; // edi@1
5935 Actor *v4; // esi@2 5912 Actor *v4; // esi@2
5936 int v5; // ebx@3 5913 int v5; // ebx@3
5937 int v6; // eax@3 5914 int v6; // eax@3
6011 } 5988 }
6012 return v19; 5989 return v19;
6013 } 5990 }
6014 5991
6015 //----- (0046A99B) -------------------------------------------------------- 5992 //----- (0046A99B) --------------------------------------------------------
6016 int __cdecl sub_46A99B() 5993 int sub_46A99B()
6017 { 5994 {
6018 int v0; // ebx@1 5995 int v0; // ebx@1
6019 signed int v1; // ecx@1 5996 signed int v1; // ecx@1
6020 signed int v2; // esi@1 5997 signed int v2; // esi@1
6021 int v3; // edx@1 5998 int v3; // edx@1
6217 GameUI_SetFooterString(v24); 6194 GameUI_SetFooterString(v24);
6218 return v19; 6195 return v19;
6219 } 6196 }
6220 6197
6221 //----- (0046BDA8) -------------------------------------------------------- 6198 //----- (0046BDA8) --------------------------------------------------------
6222 unsigned int __cdecl GetGravityStrength() 6199 unsigned int GetGravityStrength()
6223 { 6200 {
6224 int v0; // eax@1 6201 int v0; // eax@1
6225 6202
6226 v0 = ~LOBYTE(pGame->uFlags2) & 8; 6203 v0 = ~LOBYTE(pGame->uFlags2) & 8;
6227 LOBYTE(v0) = v0 | 2; 6204 LOBYTE(v0) = v0 | 2;
6228 return (unsigned int)v0 >> 1; 6205 return (unsigned int)v0 >> 1;
6229 } 6206 }
6230 6207
6231 //----- (0046BDC0) -------------------------------------------------------- 6208 //----- (0046BDC0) --------------------------------------------------------
6232 void __cdecl UpdateUserInput_and_MapSpecificStuff() 6209 void UpdateUserInput_and_MapSpecificStuff()
6233 { 6210 {
6234 if ( dword_6BE364_game_settings_1 & 0x80 ) 6211 if ( dword_6BE364_game_settings_1 & 0x80 )
6235 { 6212 {
6236 LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 & 0x7F; 6213 LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 & 0x7F;
6237 } 6214 }
6764 v16 = 0; 6741 v16 = 0;
6765 else 6742 else
6766 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 6743 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6767 v124 = 8 * v153; 6744 v124 = 8 * v153;
6768 LOBYTE(v124) = v124 | 2; 6745 LOBYTE(v124) = v124 | 2;
6769 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; 6746 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6770 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); 6747 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
6771 return 0; 6748 return 0;
6772 } 6749 }
6773 v59 = pSpriteObjects[uLayingItemID].uType + 2; 6750 v59 = pSpriteObjects[uLayingItemID].uType + 2;
6774 v60 = pObjectList->uNumObjects; 6751 v60 = pObjectList->uNumObjects;
6821 v16 = 0; 6798 v16 = 0;
6822 else 6799 else
6823 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 6800 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6824 v124 = 8 * v153; 6801 v124 = 8 * v153;
6825 LOBYTE(v124) = v124 | 2; 6802 LOBYTE(v124) = v124 | 2;
6826 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; 6803 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
6827 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); 6804 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
6828 return 0; 6805 return 0;
6829 } 6806 }
6830 if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) 6807 if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) )
6831 return 1; 6808 return 1;
6922 v16 = 0; 6899 v16 = 0;
6923 else 6900 else
6924 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 6901 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
6925 v124 = 8 * v153; 6902 v124 = 8 * v153;
6926 LOBYTE(v124) = v124 | 2; 6903 LOBYTE(v124) = v124 | 2;
6927 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; 6904 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1;
6928 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); 6905 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9);
6929 return 0; 6906 return 0;
6930 } 6907 }
6931 if ( pSpriteObjects[uLayingItemID].uType == 4092 ) 6908 if ( pSpriteObjects[uLayingItemID].uType == 4092 )
6932 { 6909 {
7056 v16 = 0; 7033 v16 = 0;
7057 else 7034 else
7058 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; 7035 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4;
7059 v124 = 8 * v153; 7036 v124 = 8 * v153;
7060 LOBYTE(v124) = v124 | 2; 7037 LOBYTE(v124) = v124 | 2;
7061 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; 7038 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1;
7062 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); 7039 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0);
7063 return 0; 7040 return 0;
7064 } 7041 }
7065 v17 = pObjectList->uNumObjects; 7042 v17 = pObjectList->uNumObjects;
7066 v18 = 0; 7043 v18 = 0;