diff mm7_2.cpp @ 1545:c4ab816fcc5e

assert, Abortf, AbortWithError -> Assert, Error refactors here and there
author Nomad
date Sat, 07 Sep 2013 20:05:20 +0200
parents 888157f45502
children 9a6567c6c76c
line wrap: on
line diff
--- a/mm7_2.cpp	Sat Sep 07 15:20:57 2013 +0200
+++ b/mm7_2.cpp	Sat Sep 07 20:05:20 2013 +0200
@@ -4,9 +4,8 @@
 
 #include <io.h>
 #include <direct.h>
-#include <assert.h>
-#include <windows.h>
-
+
+#include "OSAPI.h"
 
 #include "Texture.h"
 #include "mm7_data.h"
@@ -3088,32 +3087,6 @@
       event_triggers[num_event_triggers++] = i;
 }
 
-OPENFILENAMEA ofn;
-//----- (0046271C) --------------------------------------------------------
-void CreateDefaultBLVLevel()
-{
-  ofn.lStructSize = 0x4Cu;
-  ofn.hwndOwner = hWnd;
-  ofn.hInstance = 0;
-  ofn.lpstrFilter = "Indoor  BLV Files (*.blv)";
-  ofn.lpstrCustomFilter = 0;
-  ofn.nMaxCustFilter = 0;
-  ofn.nFilterIndex = 0;
-  ofn.lpstrFile = 0;
-  ofn.nMaxFile = 260;
-  ofn.nMaxFileTitle = 512;
-  ofn.lpstrInitialDir = "levels";
-  ofn.lpstrTitle = "Might and MagicŪ VII - Load Which Level?";
-  ofn.Flags = 4;
-  ofn.nFileOffset = 0;
-  ofn.nFileExtension = 0;
-  ofn.lpstrDefExt = "blv";
-  ofn.lCustData = 0;
-  ofn.lpfnHook = 0;
-  ofn.lpTemplateName = 0;
-  ofn.lpstrFileTitle = pTmpBuf.data();
-}
-
 //----- (004627B7) --------------------------------------------------------
 void MainMenu_Loop()
 {
@@ -3698,7 +3671,7 @@
             int planes = GetDeviceCaps(hDC, PLANES);
             ReleaseDC(hWnd, hDC);
             if (bitsPerPixel != 16 || planes != 1)
-              Abortf(pGlobalTXT_LocalizationStrings[62]);
+              Error(pGlobalTXT_LocalizationStrings[62]);
           }
           BYTE1(dword_6BE364_game_settings_1) &= 0xFEu;
 
@@ -5294,18 +5267,19 @@
 
 			  pParty->Reset();
 			  pParty->CreateDefaultParty(1);
-
-              extern void CreateDefaultBLVLevel();
+              
+              __debugbreak();
+              /*extern void CreateDefaultBLVLevel();
 			  CreateDefaultBLVLevel();
 
-			  extern OPENFILENAMEA ofn;
+			  OPENFILENAMEA ofn;
 			  if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
 			  {
 				pMouse->Activate(1);
 				break;
 			  }
 			  _chdir("..\\");
-			  strcpy(pCurrentMapName, ofn.lpstrFileTitle);
+			  strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/
 			  pMouse->Activate(1);
 			  pGame->Loop();
 		  }
@@ -5539,40 +5513,6 @@
     pOutdoorCamera->_485F64();
 }
 
-//----- (00466B8C) --------------------------------------------------------
-int  AbortWithError()
-{
-  if ( !aborting_app )
-  {
-    ClipCursor(0);
-    aborting_app = 1;
-    if ( !pRenderer->bWindowMode )
-      pRenderer->ChangeBetweenWinFullscreenModes();
-    if ( MessageBoxA(0, pGlobalTXT_LocalizationStrings[176], pGlobalTXT_LocalizationStrings[59], 0x34u) == 6 )
-      SaveGame(1, 0);                           // "Internal Error"
-                                                // "Might and Magic VII has detected an internal error and will be forced to close.  Would you like us to autosave your game before closing?"
-    Game_DeinitializeAndTerminate(1);
-  }
-  return 0;
-}
-// 720018: using guessed type int aborting_app;
-
-//----- (00466BE5) --------------------------------------------------------
-void Abortf(const char *Format, ...)
-{
-  va_list va; // [sp+8h] [bp+8h]@1
-
-  va_start(va, Format);
-  if ( !pRenderer->bWindowMode )
-    pRenderer->ChangeBetweenWinFullscreenModes();
-  vsprintf(pTmpBuf.data(), Format, va);
-  if ( pMouse )
-    pMouse->Activate(0);
-  ClipCursor(0);
-  MessageBoxA(0, pTmpBuf.data(), "Error", 0x30u);
-  Game_DeinitializeAndTerminate(1);
-}
-
 //----- (00466C40) --------------------------------------------------------
 const wchar_t *MENU_STATE_to_string(MENU_STATE m)
 {