HPL1: move hplMain to engine run

This commit is contained in:
grisenti 2022-08-24 12:16:48 +02:00 committed by Eugene Sandulenko
parent 3c005d841e
commit 8a85e1c2b9
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
4 changed files with 12 additions and 61 deletions

View File

@ -19,6 +19,7 @@
*
*/
#include "hpl1/penumbra-overture/Init.h"
#include "engine/engine.h"
#include "hpl1/hpl1.h"
#include "common/config-manager.h"
@ -34,8 +35,6 @@
#include "audio/mixer.h"
#include "common/savefile.h"
extern int hplMain(const hpl::tString &asCommandLine);
namespace Hpl1 {
Hpl1Engine *g_engine;
@ -58,7 +57,14 @@ Common::String Hpl1Engine::getGameId() const {
}
Common::Error Hpl1Engine::run() {
hplMain("");
_gameInit = new cInit(); // TODO: remove allocation
if (!_gameInit->Init("")) {
delete _gameInit;
return Common::kUnknownError; // TODO: better errors
};
_gameInit->Run();
_gameInit->Exit();
delete _gameInit;
return Common::kNoError;
}

View File

@ -37,6 +37,8 @@
#include "hpl1/detection.h"
class cInit;
namespace Hpl1 {
struct Hpl1GameDescription;
@ -45,6 +47,7 @@ class Hpl1Engine : public Engine {
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
cInit* _gameInit;
protected:
// Engine APIs

View File

@ -271,7 +271,6 @@ MODULE_OBJS := \
penumbra-overture/Init.o \
penumbra-overture/IntroStory.o \
penumbra-overture/Inventory.o \
penumbra-overture/Main.o \
penumbra-overture/MainMenu.o \
penumbra-overture/MapHandler.o \
penumbra-overture/MapLoadText.o \

View File

@ -1,57 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/*
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of Penumbra Overture.
*/
//#include <vld.h>
#include "hpl1/penumbra-overture/Init.h"
#if 0//def WIN32
#include <windows.h>
#endif
int hplMain(const tString &asCommandLine) {
cInit *pInit = hplNew(cInit, ());
bool bRet = pInit->Init(asCommandLine);
if (bRet == false) {
hplDelete(pInit->mpGame);
CreateMessageBoxW(_W("Error!"), pInit->msErrorMessage.c_str());
OpenBrowserWindow(_W("http://support.frictionalgames.com"));
return 1;
}
pInit->Run();
pInit->Exit();
hplDelete(pInit);
cMemoryManager::LogResults();
return 0;
}