Skip to content

Commit

Permalink
Dropped ErrorHandling.h/cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
captainurist committed Nov 1, 2023
1 parent e788eb1 commit 7c6ef3f
Show file tree
Hide file tree
Showing 47 changed files with 193 additions and 330 deletions.
45 changes: 22 additions & 23 deletions src/Application/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ bool Game::loop() {
pParty->Reset();
pParty->createDefaultParty(true);

__debugbreak();
assert(false);
/*extern void CreateDefaultBLVLevel();
CreateDefaultBLVLevel();
Expand Down Expand Up @@ -508,13 +508,13 @@ void Game::processQueuedMessages() {
// Game_OpenLoadGameDialog(); continue; case UIMSG_Quit:
// Game_QuitGameWhilePlaying(uMessageParam); continue;
case UIMSG_80:
__debugbreak();
assert(false);
pGUIWindow_CurrentMenu->Release();
current_screen_type = SCREEN_OPTIONS;
__debugbreak(); // pGUIWindow_CurrentMenu =
// GUIWindow::Create(0, 0,
// window->GetWidth(), window->GetHeight(),
// WINDOW_8, 0, 0);
// pGUIWindow_CurrentMenu =
// GUIWindow::Create(0, 0,
// window->GetWidth(), window->GetHeight(),
// WINDOW_8, 0, 0);
continue;
case UIMSG_Cancel:
new OnCancel({350, 302}, {106, 42}, pBtnCancel);
Expand Down Expand Up @@ -734,7 +734,7 @@ void Game::processQueuedMessages() {
pEventTimer->Resume();
continue;
case SCREEN_19:
__debugbreak();
assert(false);
pWindow2 = ptr_507BC8;
pWindow2->Release();
current_screen_type = SCREEN_GAME;
Expand Down Expand Up @@ -840,20 +840,19 @@ void Game::processQueuedMessages() {
continue;

default:
__debugbreak(); // which GAME_MENU is
// this?
assert(false); // which GAME_MENU is this?
onEscape();
continue;
}
__debugbreak(); // which GAME_MENU is this?
assert(false); // which GAME_MENU is this?
onEscape();
continue;
}
__debugbreak(); // which GAME_MENU is this?
assert(false); // which GAME_MENU is this?
CharacterUI_ReleaseButtons();
//ReleaseAwardsScrollBar();
}
// __debugbreak(); // which GAME_MENU is this? debug / fallback
// assert(false); // which GAME_MENU is this? debug / fallback
onEscape();
continue;
}
Expand Down Expand Up @@ -1052,7 +1051,7 @@ void Game::processQueuedMessages() {
continue;

case UIMSG_HouseTransitionConfirmation:
__debugbreak();
assert(false);
playButtonSoundOnEscape = false;
pAudioPlayer->playUISound(SOUND_StartMainChoice02);
SaveGame(1, 0);
Expand Down Expand Up @@ -1129,11 +1128,11 @@ void Game::processQueuedMessages() {
}

// strcpy((char *)userInputHandler->pPressedKeysBuffer, "2");
// __debugbreak(); // missed break/continue?
// assert(false); // missed break/continue?
continue;

case UIMSG_DD: {
__debugbreak();
assert(false);
// sprintf(tmp_str.data(), "%s",
// pKeyActionMap->pPressedKeysBuffer);
FrameTableTxtLine frameTableTxtLine;
Expand Down Expand Up @@ -1198,12 +1197,12 @@ void Game::processQueuedMessages() {
continue;
}
case UIMSG_1C:
__debugbreak();
assert(false);
if (!pParty->hasActiveCharacter() || current_screen_type != SCREEN_GAME)
continue;
__debugbreak(); // ptr_507BC8 = GUIWindow::Create(0, 0,
// window->GetWidth(), window->GetHeight(),
// WINDOW_68, uMessageParam, 0);
assert(false); // ptr_507BC8 = GUIWindow::Create(0, 0,
// window->GetWidth(), window->GetHeight(),
// WINDOW_68, uMessageParam, 0);
current_screen_type = SCREEN_19;
pEventTimer->Pause();
continue;
Expand Down Expand Up @@ -1681,14 +1680,14 @@ void Game::processQueuedMessages() {
_engine->onGameViewportClick();
continue;
case UIMSG_F: // what event?
__debugbreak();
assert(false);
//pButton2 = (GUIButton *)(uint16_t)vis->get_picked_object_zbuf_val().object_pid;
__debugbreak(); // GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0);
assert(false); // GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0);
continue;
case UIMSG_54: // what event?
__debugbreak();
assert(false);
//pButton2 = (GUIButton *)uMessageParam;
__debugbreak(); // GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0);
assert(false); // GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0);
continue;
case UIMSG_Game_Action:
engine->_messageQueue->clear();
Expand Down
2 changes: 1 addition & 1 deletion src/Application/GameMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ void Menu::EventLoop() {
continue;

case UIMSG_SetGraphicsMode:
__debugbreak(); // Nomad: graphicsmode as it was now removed
assert(false); // Nomad: graphicsmode as it was now removed
continue;

case UIMSG_GameMenu_ReturnToGame:
Expand Down
5 changes: 2 additions & 3 deletions src/Application/GameWindowHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "Arcomage/Arcomage.h"

#include "Engine/ErrorHandling.h"
#include "Engine/Engine.h"
#include "Engine/EngineGlobals.h"
#include "Engine/Components/Control/EngineControlComponent.h"
Expand Down Expand Up @@ -335,11 +334,11 @@ void GameWindowHandler::OnKey(PlatformKey key) {
}

void GameWindowHandler::OnFocus() {
__debugbreak();
assert(false);
}

void GameWindowHandler::OnFocusLost() {
__debugbreak();
assert(false);
}

void GameWindowHandler::OnPaint() {
Expand Down
5 changes: 1 addition & 4 deletions src/Arcomage/Arcomage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,6 @@ void ArcomageGame::onKeyPress(PlatformKey key) {

explosion_effect_struct *explosion_effect_struct::New() {
explosion_effect_struct *v2 = (explosion_effect_struct *)malloc(sizeof(explosion_effect_struct));
if (v2 == nullptr) {
Error("Malloc - explosion_effect_struct::New()");
}
v2->mem_signature = SIG_MEMALOC;
v2->remaining_sparks_to_init = 0;
v2->prev_init_overflow = 0;
Expand Down Expand Up @@ -793,7 +790,7 @@ int CalculateCardPower(ArcomagePlayer *player, ArcomagePlayer *enemy,
}

bool OpponentsAITurn(int player_num) {
if (player_num == 0) __debugbreak();
assert(player_num != 0);

int ai_player_cards_count = GetPlayerHandCardCount(player_num);
if (ai_player_cards_count == 0) return true;
Expand Down
6 changes: 0 additions & 6 deletions src/Bin/OpenEnroth/OpenEnroth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "Engine/Components/Trace/EngineTraceRecorder.h"
#include "Engine/Components/Trace/EngineTraceStateAccessor.h"
#include "Engine/Engine.h"
#include "Engine/ErrorHandling.h"
#include "Engine/EngineGlobals.h"

#include "Library/Application/PlatformApplication.h"
Expand Down Expand Up @@ -50,11 +49,6 @@ int runRetrace(OpenEnrothOptions options) {
}

int runOpenEnroth(OpenEnrothOptions options) {
setErrorHandler([](const std::string &title, const std::string &message) {
if (platform)
platform->showMessageBox(title, message);
});

GameStarter(options).run();
return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions src/Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ set(ENGINE_SOURCES
Conditions.cpp
Engine.cpp
EngineGlobals.cpp
ErrorHandling.cpp
EngineIocContainer.cpp
GpuHints.cpp
LOD.cpp
Expand All @@ -32,7 +31,6 @@ set(ENGINE_HEADERS
Conditions.h
Engine.h
EngineGlobals.h
ErrorHandling.h
EngineIocContainer.h
LOD.h
LodTextureCache.h
Expand Down
14 changes: 4 additions & 10 deletions src/Engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ void Engine::drawWorld() {

if (uCurrentlyLoadedLevelType == LEVEL_INDOOR) {
pIndoor->Draw();
} else if (uCurrentlyLoadedLevelType == LEVEL_OUTDOOR) {
} else {
assert(uCurrentlyLoadedLevelType == LEVEL_OUTDOOR);
render->uFogColor = GetLevelFogColor();
pOutdoor->Draw();
} else {
Error("Invalid level type: %u", uCurrentlyLoadedLevelType);
}

decal_builder->DrawBloodsplats();
Expand Down Expand Up @@ -1748,7 +1747,7 @@ GameTime timeUntilDawn() {
return GameTime::FromDays(1) + dawnHour - currentTimeInDay;
}

void initLevelStrings(Blob &blob) {
void initLevelStrings(const Blob &blob) {
engine->_levelStrings.clear();

int offs = 0;
Expand All @@ -1761,12 +1760,7 @@ void initLevelStrings(Blob &blob) {
}

void Level_LoadEvtAndStr(const std::string &pLevelName) {
Blob blob = engine->_gameResourceManager->getEventsFile(pLevelName + ".str");
if (!blob || (blob.size() > 9216)) {
Error("File %s Size %lu - Buffer size %lu", (pLevelName + ".str").c_str(), blob.size(), 9216);
}

initLevelStrings(blob);
initLevelStrings(engine->_gameResourceManager->getEventsFile(pLevelName + ".str"));

engine->_localEventMap = EventMap::load(engine->_gameResourceManager->getEventsFile(pLevelName + ".evt"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ GameTime timeUntilDawn();
/**
* @offset 0x443E31
*/
void initLevelStrings(Blob &blob);
void initLevelStrings(const Blob &blob);
void Level_LoadEvtAndStr(const std::string &pLevelName);
bool _44100D_should_alter_right_panel();
void Transition_StopSound_Autosave(const std::string &pMapName, MapStartPoint point); // sub_44987B idb
Expand Down
44 changes: 0 additions & 44 deletions src/Engine/ErrorHandling.cpp

This file was deleted.

20 changes: 0 additions & 20 deletions src/Engine/ErrorHandling.h

This file was deleted.

15 changes: 7 additions & 8 deletions src/Engine/Events/EventInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ static bool checkSeason(Season season) {
monthPlusOne == 6 && daysPlusOne <= 20);

default:
Error("Unknown season");
assert(false);
return false;
}

return false;
}

/**
Expand Down Expand Up @@ -154,7 +153,7 @@ int EventInterpreter::executeOneEvent(int step, bool isNpc) {
break;
case EVENT_CanShowTopic_IsActorKilled:
// TODO: enconunter and process
__debugbreak();
assert(false);
#if 0
if (Actor::isActorKilled(ir.data.actor_descr.policy, ir.data.actor_descr.param, ir.data.actor_descr.num)) {
return ir.target_step;
Expand Down Expand Up @@ -351,7 +350,7 @@ int EventInterpreter::executeOneEvent(int step, bool isNpc) {
//
// TODO(Nik-RE-dev): this event is not used in MM7. In GrayFace's data it's called "Question" and must have additional arguments
// that control where events executions must be continued on correct/incorrect input.
__debugbreak();
assert(false);
#if 0
game_ui_status_bar_event_string = (ir.data.text_id < engine->_levelStrings.size()) ? engine->_levelStrings[ir.data.text_id] : "";
startBranchlessDialogue(_eventId, step + 1, EVENT_InputString);
Expand Down Expand Up @@ -479,7 +478,7 @@ int EventInterpreter::executeOneEvent(int step, bool isNpc) {
break;
case EVENT_SetActorGroup:
// TODO: enconunter and process
__debugbreak();
assert(false);
#if 0
*(&pActors[0].uGroup + 0x11000000 * _evt->v8 +
209 * (_evt->v5 +
Expand All @@ -505,7 +504,7 @@ int EventInterpreter::executeOneEvent(int step, bool isNpc) {
return -1;
case EVENT_ChangeGroup:
// TODO: enconunter and process
__debugbreak();
assert(false);
#if 0
v38 = EVT_DWORD(_evt->v5);
v39 = EVT_DWORD(_evt->v9);
Expand All @@ -517,7 +516,7 @@ int EventInterpreter::executeOneEvent(int step, bool isNpc) {
break;
case EVENT_ChangeGroupAlly:
// TODO: enconunter and process
__debugbreak();
assert(false);
#if 0
v42 = EVT_DWORD(_evt->v5);
v43 = EVT_DWORD(_evt->v9);
Expand Down
1 change: 1 addition & 0 deletions src/Engine/GameResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ void GameResourceManager::openGameResources() {
// TODO(captainurist):
// on exception:
// Error(localization->GetString(LSTR_PLEASE_REINSTALL), localization->GetString(LSTR_REINSTALL_NECESSARY));
// but we can't use localization object here cause it's not yet initialized.
}

Blob GameResourceManager::getEventsFile(const std::string &filename) {
Expand Down
Loading

0 comments on commit 7c6ef3f

Please sign in to comment.