SAGA2: Remove custom error handling

This commit is contained in:
Eugene Sandulenko 2021-05-26 22:59:45 +02:00
parent 10c78758f4
commit 04ecb9e275
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
42 changed files with 78 additions and 2168 deletions

View File

@ -271,7 +271,7 @@ public:
uint16 r,
bool trackFlag = FALSE) :
ActorAssignment(indefinitely) {
ASSERT(isActor(a) && a != getActor());
assert(isActor(a) && a != getActor());
initialize(SpecificActorTarget(a), r, trackFlag);
}
@ -282,7 +282,7 @@ public:
uint16 r,
bool trackFlag = FALSE) :
ActorAssignment(until) {
ASSERT(isActor(a) && a != getActor());
assert(isActor(a) && a != getActor());
initialize(SpecificActorTarget(a), r, trackFlag);
}
@ -354,7 +354,7 @@ public:
// Construct with no time limit and specific actor
HuntToKillAssignment(Actor *a, bool trackFlag = FALSE) :
ActorAssignment(indefinitely) {
ASSERT(isActor(a) && a != getActor());
assert(isActor(a) && a != getActor());
initialize(SpecificActorTarget(a), trackFlag, TRUE);
}
@ -364,7 +364,7 @@ public:
Actor *a,
bool trackFlag = FALSE) :
ActorAssignment(until) {
ASSERT(isActor(a) && a != getActor());
assert(isActor(a) && a != getActor());
initialize(SpecificActorTarget(a), trackFlag, TRUE);
}

View File

@ -73,11 +73,13 @@ int32 AIL_sample_volume(HSAMPLE S);
int32 AIL_sequence_volume(HSEQUENCE S);
void AIL_set_sequence_volume(HSEQUENCE S, int32 volume, int32 milliseconds);
inline void audioFatal(char *msg) {
error("Sound error %s", msg);
}
#include "saga2/rect.h"
#include "saga2/errclass.h"
#include "saga2/audiotmr.h"
#include "saga2/audiomem.h"
#include "saga2/audioerr.h"
#include "saga2/queues.h"
#include "saga2/audiobuf.h"
#include "saga2/audiodec.h"

View File

@ -28,8 +28,6 @@
#include "saga2/std.h"
#include "saga2/audio.h"
#include "saga2/audioerr.h"
#include "saga2/errclass.h"
namespace Saga2 {

View File

@ -292,7 +292,6 @@ public:
void setVolume(int8 val); // internal : set buffer to fill & play
void setLoopCount(int16 loops) {
VERIFY(audioSet);
loopCount = loops;
}
int16 getLoopCount(void) {

View File

@ -1,121 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#ifndef SAGA2_AUDIOERR_H
#define SAGA2_AUDIOERR_H 1
#include "saga2/errors.h"
#include "saga2/errclass.h"
namespace Saga2 {
const int32 audioErrorOffset = 0xE0;
enum soundErrors {
serrNoError = audioErrorOffset,
serrOpenFailed,
serrReadFailed,
serrNoFreeBuffers,
serrBufferSizeTooSmall,
serrPlayError,
serrCompUnexpectedEOF,
serrCompNoMagicNum,
serrCompBadAlign,
serrCompBadFloat,
serrCompBadType,
serrCompUnkType,
serrCompUnsupType,
serrCompOddType,
serrCompNoType,
serrCompInternal,
serrCompWriteFailed,
serrCompPutFailed,
serrCompReadFailed,
serrCompEOFInStream,
serrVersionMismatch,
serrFATAL,
serrMaxErr,
};
/* ===================================================================== *
Audio error classes
* ===================================================================== */
class AudioError : public gError {
public:
AudioError(soundErrors errID);
AudioError(char *msg);
};
class AudioFatal : public AudioError {
public:
AudioFatal();
AudioFatal(char *msg);
};
/* ===================================================================== *
Error macros
* ===================================================================== */
inline void SegFatal(soundErrors errID) {
error("Sound error %d", errID);
}
inline void audioFatal(char *msg) {
error("Sound error %s", msg);
}
char *IDName(long s);
/* ===================================================================== *
Logging macro
* ===================================================================== */
#if DEBUG
#include <io.h>
#define AUDIO_LOG_FILE "AUDIOERR.LOG"
#define AUDIO_MAX_LOG_SIZE 16384
inline void audioLog(char *s) {
FILE *fp = fopen(AUDIO_LOG_FILE, "at");
if (fp) {
if (filelength(fileno(fp)) > AUDIO_MAX_LOG_SIZE) {
fclose(fp);
remove(AUDIO_LOG_FILE);
fp = fopen(AUDIO_LOG_FILE, "at");
fprintf(fp, "LOG CLEARED AT TIME %d\n==========================", gameTime);
}
fprintf(fp, "%s\n", s);
fclose(fp);
}
}
#endif
} // end of namespace Saga2
#endif

View File

@ -85,27 +85,15 @@ bool hResCheckResID(hResContext *hrc, uint32 s[]) {
int16 hResSeek(Buffer &sb, soundSample &ss, hResContext *hrc, bool Cheksize) {
if (hrc->seek(ss.curSeg) == FALSE) {
#if DEBUG
char msg[80];
sprintf(msg, "Audio: %s is an invalid res ID\n", IDName(ss.curSeg));
audioLog(msg);
if (debugResource) {
WriteStatusF(6, msg);
}
#endif
return serrOpenFailed;
warning("Audio: %d is an invalid res ID", ss.curSeg);
return 1;
}
if (Cheksize && sb.wSize < hrc->bytesleft()) {
int bufferSize = sb.wSize;
int soundSize = hrc->bytesleft();
#if DEBUG
if (debugResource) {
char msg[80];
sprintf(msg, "Buffer too small %d sample: %d", bufferSize, soundSize);
audioLog(msg);
}
#endif
return serrBufferSizeTooSmall;
warning("Buffer too small %d sample: %d", bufferSize, soundSize);
return 1;
}
ss.channels = soundSample::channelMono;
ss.speed = soundRate22K;
@ -162,7 +150,8 @@ int16 hResFlush(Buffer &sb, soundSample &ss, hResContext *hrc) {
int16 bufSeek(Buffer &sb, soundSample &ss) {
if (ss.curSeg >= maxClicks) {
return serrOpenFailed;
warning("bufSeek: open failed");
return 1;
}
ss.channels = soundSample::channelMono;
ss.speed = soundRate22K;

View File

@ -27,7 +27,6 @@
#ifndef SAGA2_CONFIG_H
#define SAGA2_CONFIG_H
#include "saga2/nice_err.h"
#include "saga2/winini.h"
namespace Saga2 {
@ -73,4 +72,3 @@ extern configuration globalConfig;
} // end of namespace Saga2
#endif // CONFIG_H

View File

@ -28,7 +28,6 @@
#include "saga2/std.h"
#include "saga2/display.h"
#include "saga2/nice_err.h"
#include "saga2/floating.h"
#include "saga2/intrface.h"
#include "saga2/loadmsg.h"
@ -85,7 +84,6 @@ void resumeProcessResources(void);
#endif
static void switchOn(void);
static void switchOff(void);
void shutdownSave(void);
/* ===================================================================== *
@ -141,10 +139,6 @@ void resumeGame(void) {
// end game (normally)
void endGame(void) {
shutdownSave();
#ifdef _WIN32
localCursorOff();
#endif
blackOut();
displayDisable(GameEnded);
gameRunning = FALSE;
@ -251,19 +245,11 @@ void mainDisable(void) {
// On/Off hooks
static void switchOn(void) {
SetFatalMode(fhmGUI);
#ifdef _WIN32
resumeDDGraphics();
#endif
enableUserControls();
}
static void switchOff(void) {
disableUserControls();
#ifdef _WIN32
suspendDDGraphics();
#endif
SetFatalMode(fhmHold);
}
/* ===================================================================== *

View File

@ -1,112 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
/* ===================================================================== *
Includes
* ===================================================================== */
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
#include "saga2/std.h"
#include "saga2/errbase.h"
namespace Saga2 {
/* ===================================================================== *
Global constants
* ===================================================================== */
char ErrorList::noErrorString[] = "";
char ErrorList::unkErrorString[] = "Unknown error";
const ErrText noErrorText = (const char *) ErrorList::noErrorString;
const ErrText unkErrorText = (const char *) ErrorList::unkErrorString;
/* ===================================================================== *
ErrorList implementation
* ===================================================================== */
// ------------------------------------------------------------------
//
ErrorList::ErrorList() {
sourceID = nullErrorList;
errCount = 0;
errList = NULL;
}
// ------------------------------------------------------------------
//
ErrorList::~ErrorList() {
errCount = 0;
if (errList != NULL) delete [] errList;
errList = NULL;
}
// ------------------------------------------------------------------
//
ErrorList::ErrorList(ErrType et, uint32 ec) {
setErrorType(et);
setListSize(ec);
}
// ------------------------------------------------------------------
//
size_t ErrorList::setListSize(size_t s) {
if (s)
errList = new ErrorRec[s];
else
errList = NULL;
if (errList)
errCount = s;
else
errCount = 0;
return errCount;
}
// ------------------------------------------------------------------
//
void ErrorList::setEntry(uint32 i, ErrorID id, ErrText text) {
assert(i >= 0 && i < errCount);
errList[i].ID = id;
errList[i].text = text;
}
// ------------------------------------------------------------------
//
ErrText ErrorList::errMessage(ErrorID id) {
uint32 index = lookupMessage(id);
if (index == unkError)
return unkErrorText;
return errList[index].text;
}
}

View File

@ -1,108 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#ifndef SAGA2_ERRBASE_H
#define SAGA2_ERRBASE_H
namespace Saga2 {
/* ===================================================================== *
Base types and constants
* ===================================================================== */
// ------------------------------------------------------------------
//
typedef uint32 ErrorID;
const ErrorID noError = 0;
const ErrorID unkError = 0xFFFFFFFF;
// ------------------------------------------------------------------
//
typedef const char *ErrText;
// ------------------------------------------------------------------
//
typedef uint32 ErrType;
const ErrType nullErrorList = 0;
/* ===================================================================== *
Structures and classes
* ===================================================================== */
// ------------------------------------------------------------------
//
struct ErrorRec {
ErrorID ID;
ErrText text;
};
// ------------------------------------------------------------------
//
class ErrorList {
public:
static char noErrorString[];
static char unkErrorString[];
private:
ErrType sourceID;
size_t errCount;
protected:
ErrorRec *errList;
private:
ErrorList();
protected:
ErrorList(ErrType et, uint32 ec);
~ErrorList();
void setErrorType(ErrType et) {
sourceID = et;
}
size_t setListSize(size_t s);
void setEntry(uint32 i, ErrorID id, ErrText text);
size_t eLimit(void) {
return errCount;
}
virtual uint32 lookupMessage(ErrorID id) = 0;
public:
ErrText errMessage(ErrorID id);
};
extern const ErrText noErrorText;
extern const ErrText unkErrorText;
#endif
}

View File

@ -1,351 +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 2
* 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
* aint32 with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
#include "saga2/std.h"
#include "saga2/errclass.h"
namespace Saga2 {
void (*gError::dumpHandler)(char *);
char *gError::errBuf = new char[ 128 ];
int16 gError::errBufSize = 128,
gError::errBufOffset = 0;
uint8 gError::saveErrFlag = 0;
/****** errclass.cpp/gError [class] *******************************
*
* NAME
* class gError -- an error-handling exception class
*
* FUNCTION
* gError is (or will be) the basis for error-handling
* in the DGI libraries. It has the ability to store an
* ASCII error message text which can be printed to the
* display.
*
* The display of the error messages can be handled
* automatically by gError, or a custom error-reporting
* routine can be specified for things like an error
* window.
*
* SEE ALSO
* gError::gError
* gError::warn
* class MemoryError
* class DOSError
*
*******************************************************************/
/****** errclass.cpp/gError::gError *******************************
*
* NAME
* gError::gError -- constructor for gError class
*
* SYNOPSIS
* throw gError( "message", arg );
*
* gError::gError( char *msg, ... );
*
* FUNCTION
* The gError constructor is called whenever an exception is
* thrown. It appends the message (after it is expanded) into
* the internal error text buffer. If there is no custom error
* handler currently installed, then the error message is
* printed to stderr. If a custom error handler is installed,
* then the error message is left in the buffer until the
* "dump" member function is called.
*
* INPUTS
* message a text string, which can have printf-like
* formatting. The additional args are used just
* like printf.
* NOTE: A linefeed '\n' should be included
* at the end of the error message.
*
* args printf-like variable arguments.
*
* EXAMPLE
* /c/throw gError( "Attempt to open window failed.\n" );
*
* SEE ALSO
* gError [class]
* gError::warn
*
*******************************************************************/
gError::gError(char *msg, ...) {
va_list argptr;
va_start(argptr, msg);
append(msg, argptr);
va_end(argptr);
}
gError::gError(void) {}
/****** errclass.cpp/gError::dump *******************************
*
* NAME
* gError::dump -- prints out the error message
*
* SYNOPSIS
* gError::dump();
*
* static gError::dump( void );
*
* FUNCTION
* The dump member function can be called by the application
* to force printing of the error message. This is only needed
* when a dump-handler has been installed.
*
* INPUTS
* none
*
* SEE ALSO
* gError [class]
*
*******************************************************************/
void gError::dump(void) {
if (errBufOffset > 0) {
if (dumpHandler) dumpHandler(errBuf);
else fputs(errBuf, stderr);
errBuf[ 0 ] = 0;
errBufOffset = 0;
}
}
/****** errclass.cpp/gError::warn *******************************
*
* NAME
* gError::warn -- print a non-fatal error
*
* SYNOPSIS
* gError::warn( "message", arg );
*
* void gError::warn( char *msg, ... );
*
* FUNCTION
* the 'warn' member function appends an error message to
* the internal gError message buffer, but does not throw
* an exception. This can be useful for mixing non-fatal
* error messages in the same message stream.
*
* INPUTS
* message a text string, which can have printf-like
* formatting. The additional args are used just
* like printf.
* NOTE: A linefeed '\n' should be included
* at the end of the error message.
*
* args printf-like variable arguments.
*
* SEE ALSO
* gError [class]
* gError::gError [class]
*
*******************************************************************/
void gError::warn(char *msg, ...) {
va_list argptr;
va_start(argptr, msg);
append(msg, argptr);
va_end(argptr);
}
void gError::appendf(char *msg, ...) {
va_list argptr;
va_start(argptr, msg);
append(msg, argptr);
va_end(argptr);
}
void gError::append(char *msg, va_list args) {
uint8 tempBuf[ 256 ];
int16 size = vsprintf((char *) tempBuf, msg, args);
size = MIN<int16>(size, errBufSize - errBufOffset);
memcpy(errBuf + errBufOffset, tempBuf, size + 1);
errBufOffset += size;
if (!saveErrFlag) dump();
}
/****** errclass.cpp/gError::setErrBufSize *******************************
*
* NAME
* gError::setErrBufSize -- set the size of the internal error buffer
*
* SYNOPSIS
* gError::setErrBufSize( size );
*
* void gError::setErrBufSize( int32 );
*
* FUNCTION
* the default internal error buffer is 128 bytes. This is
* fine for most applications. However, applications which
* make substantial use of 'warn' to create a log of
* errors will quickly run out of room. This function can be
* used to allocate a larger buffer.
*
* Note that messages which overflow the error buffer are
* truncated.
*
* INPUTS
* size the desired size of the error text buffer.
*
* SEE ALSO
* gError [class]
* gError::gError [class]
*
*******************************************************************/
void gError::setErrBufSize(int32 size) {
if (errBuf) free(errBuf);
errBuf = new char[ size ];
errBufOffset = 0;
errBufSize = (int16) size;
}
/****** errclass.cpp/gError::setDumpHandler *******************************
*
* NAME
* gError::setDumpHandler -- set a custom error reporting function
*
* SYNOPSIS
* gError::setDumpHandler( handlerFunc );
*
* void gError::setDumpHandler( void (*dumpHand)( char * ) );
*
* FUNCTION
* This function can be used to set a custom "dump" handler
* for gError exceptions. The dump handler is called whenever
* an error occurs, unless the "saveErrors" flag has been set,
* in which case the dump handler is called whenever
* gError::dump() is called by the application.
*
* The "dump" function is called with a single argument, which
* is a character pointer to the error buffer( which is NULL
* terminated).
*
* INPUTS
* handlerFunc the custom error reporting function.
*
* SEE ALSO
* gError [class]
* gError::gError [class]
*
*******************************************************************/
/****** errclass.cpp/gError::saveErrs *******************************
*
* NAME
* gError::saveErrs -- tell gError to accumulate error messages.
*
* SYNOPSIS
* gError::saveErrs( save );
*
* void gError::saveErrs( bool );
*
* FUNCTION
* This member function affects the "saveErrorFlag" which
* determines if errors are dumped immediately when they
* occur, or if they are accumulated and dumped when the
* application calls gError::dump();
*
* INPUTS
* save TRUE - do not dump errors automatically,
* accumulate them in buffer.
* FALSE - dump errors immediately and clear buffer.
*
* (the gError class defaults to saveErrors=FALSE)
*
* SEE ALSO
* gError [class]
* gError::gError [class]
*
*******************************************************************/
/* ======================================================================= *
class MemoryError
* ======================================================================= */
/****** errclass.cpp/MemoryError [class] *******************************
*
* NAME
* class MemoryError -- exception class for memory errors
*
* FUNCTION
* MemoryError is a class designed to be used for
* out-of-memory errors. It is derived from class gError,
* and inherits most of it's behavior from that class.
*
* It has two forms:
*
* /c/
* /c/throw MemoryError( size );
* /c/throw MemoryError();
* /c/
*
* -- where 'size' is the amount of memory that the
* application was attempting to allocate.
*
* EXAMPLE
*
* the code:
*
* /c/
* /c/throw MemoryError( 1000 );
* /c/
*
* produces the message:
*
* /c/
* /c/"Attempt to allocate object size 1000 failed."
* /c/
*
* SEE ALSO
* gError::gError
* gError::warn
* class gError
* class DOSError
*
*******************************************************************/
MemoryError::MemoryError(int32 size)
: gError("Attempt to allocate object size %d failed.\n", size)
{}
MemoryError::MemoryError(void)
: gError("Memory allocation failed.\n")
{}
} // end of namespace Saga2

View File

@ -1,140 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#ifndef SAGA2_ERRCLASS_H
#define SAGA2_ERRCLASS_H 1
namespace Saga2 {
class gError {
protected:
static void (*dumpHandler)(char *);
static char *errBuf;
static int16 errBufSize,
errBufOffset;
static uint8 saveErrFlag;
// Special constructor for sub-classes which doesn't do
// anything.
gError(void);
// Append to error buffer (subclasses can use)
static void append(char *msg, va_list args);
static void appendf(char *msg, ...);
public:
gError(char *msg, ...);
static void dump(void);
static void setDumpHandler(void (*dumpHand)(char *)) {
dumpHandler = dumpHand;
}
static void saveErrs(bool flag) {
saveErrFlag = (uint8) flag;
}
static void warn(char *msg, ...);
static void setErrBufSize(int32 size);
};
class MemoryError : private gError {
public:
MemoryError(int32 allocSize);
MemoryError(void);
};
class DosError : private gError {
public:
DosError(char *msg, ...);
};
/* ===================================================================== *
Breakpoint code
* ===================================================================== */
/* ===================================================================== *
Assertion macros (VERIFY)
* ===================================================================== */
#undef verify
#define verify(expr) (expr)
#define assert2(__ignore,msg) ((void)0)
#define VERIFY assert
#ifndef ASSERT
#define ASSERT(x) assert(x)
#define ASSERTMSG assert2
#endif
// Extensions to set a breakpoint from code
#if DEBUG && defined(__WATCOMC__)
# ifdef __cplusplus
void debug_breakpoint(const int linenumber, const char filename[]);
void debug_dumptext(const char text[]);
# else
void cebug_breakpoint(const int linenumber, const char filename[]);
void cebug_dumptext(const char text[]);
# endif
# ifdef __cplusplus
# define DEBUG_BREAK debug_breakpoint(__LINE__,__FILE__)
# else
# define DEBUG_BREAK cebug_breakpoint(__LINE__,__FILE__)
# endif
# ifndef NO_BREAK_ON_VERIFAIL
# ifdef VERIFY
# undef VERIFY
# endif
# define VERIFY(expr) ((expr)?(void)0:(DEBUG_BREAK,__verify(#expr,__FILE__,__LINE__ )))
# endif // NO_BREAK_ON_VERIFAIL
# ifndef NO_RUNTIME_MESSAGES
# ifdef __cplusplus
# define DEBUG_DUMP(s) debug_dumptext(s)
# else // __cplusplus
# define DEBUG_DUMP(s) cebug_dumptext(s)
# endif // __cplusplus
# else // NO_RUNTIME_MESSAGES
# define DEBUG_DUMP(s) ((void)0)
# endif // NO_RUNTIME_MESSAGES
#else // DEBUG && defined(__WATCOMC__)
# define DEBUG_BREAK ((void)0)
# define DEBUG_DUMP(s) ((void)0)
#endif // DEBUG && defined(__WATCOMC__)
} // end of namespace Saga2
#endif

View File

@ -1,75 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#include "saga2/std.h"
#include "saga2/errlist.h"
namespace Saga2 {
SequentialErrorList::SequentialErrorList(ErrType et, uint32 ec, char *es[]) : ErrorList(et, ec) {
for (int i = 0; i < eLimit(); i++)
setEntry(i, i, es[i]);
}
SequentialErrorList::SequentialErrorList(ErrType et, const char *es[]) : ErrorList(et, stringCount(es)) {
for (int i = 0; i < eLimit(); i++)
setEntry(i, i, es[i]);
}
uint32 SequentialErrorList::stringCount(const char *es[]) {
uint32 rv = 0;
if (es == NULL)
return 0;
while (strlen(es[rv])) rv++;
return rv;
}
uint32 SequentialErrorList::lookupMessage(ErrorID id) {
if (id >= 0 && id < eLimit()) {
return id;
}
return unkError;
}
SparseErrorList::SparseErrorList(ErrType et, uint32 ec, ErrorID ei[], const char *es[]) : ErrorList(et, ec) {
for (int i = 0; i < eLimit(); i++)
setEntry(i, ei[i], es[i]);
}
SparseErrorList::SparseErrorList(ErrType et, uint32 ec, ErrorRec er[]) : ErrorList(et, ec) {
for (int i = 0; i < eLimit(); i++)
setEntry(i, er[i].ID, er[i].text);
}
uint32 SparseErrorList::lookupMessage(ErrorID id) {
for (int i = 0; i < eLimit(); i++) {
if (errList[i].ID == id)
return i;
}
return unkError;
}
}

View File

@ -1,55 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#ifndef SAGA2_ERRLIST_H
#define SAGA2_ERRLIST_H
#include "saga2/errbase.h"
namespace Saga2 {
class SequentialErrorList : public ErrorList {
static uint32 stringCount(const char *es[]);
protected:
virtual uint32 lookupMessage(ErrorID id);
public:
SequentialErrorList(ErrType et, uint32 ec, char *es[]);
SequentialErrorList(ErrType et, const char *es[]);
virtual ~SequentialErrorList() {}
};
class SparseErrorList : public ErrorList {
protected:
virtual uint32 lookupMessage(ErrorID id);
public:
SparseErrorList(ErrType et, uint32 ec, ErrorID ei[], const char *es[]);
SparseErrorList(ErrType et, uint32 ec, ErrorRec er[]);
virtual ~SparseErrorList() {}
};
}
#endif

View File

@ -1,100 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#include "saga2/std.h"
#include "saga2/errlist.h"
#include "saga2/errtype.h"
namespace Saga2 {
// ------------------------------------------------------------------
// FTA2 error text
const char *FTA2ProgramErrors[] = {
"No Error",
"Unknown command line argument",
"Minimum CPU not found",
"Get a real machine",
"Get a real machine",
"Not in a DOS Box",
"This program requires 8 Megabytes of RAM to run properly",
"You do not have sufficient memory available",
"This program requires more virtual memory to run properly",
"You do not have sufficient virtual memory available",
"No DPMI support", // Minimum memory
"You should run SETSOUND before running this program for the first time",
"You should run SETSOUND and set up a digital sound driver",
"You should run SETSOUND and set up a music driver",
"Unaccelerated video card detected",
"Get a real machine",
"This game requires a mouse. No mouse driver was detected.",
"Unable to allocate fault handler",
"Direct X does not recognize your display. You may have inappropriate drivers.",
"Could not initialize the audio",
"Could not initialize the game clock",
"A severe internal error has occurred",
"A program file cannot be opened",
"A necessary file can't be found. You may need to insert the game CD",
"The game CD is required to play a video.",
"Sound driver not detected. Continue anyway?",
"Music driver not detected. Continue anyway?",
"A program file is in use and cannot be opened",
"A program file may be corrupt or wrong size",
"A program file could not be read",
"A program file could not be written",
"A program file could not be closed",
"A saved game file could not be read",
"A saved game file could not be written",
"The display is in use by another program",
"An internal program error has been detected",
"Are you sure you want to exit",
"Direct X does not recognize your display. You may have inappropriate drivers. Emulation will allow you to continue, but perfomance will be severly degraded. Do you want to continue?",
"Game heap overflowed continue?",
""
};
SequentialErrorList programErrors(etiFTA2ErrorList, FTA2ProgramErrors);
}

View File

@ -1,61 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#ifndef SAGA2_ERRTYPE_H
#define SAGA2_ERRTYPE_H
namespace Saga2 {
/* ===================================================================== *
IDs for error lists
* ===================================================================== */
enum DGIErrorTypeIDs {
//system error lists
etiSystemErrorList = 0x00000001,
//application error lists
etiApplicationList = 0x10000000,
// Common error types
etiWin32ExceptionList = 0x10000002,
etiDDrawErrorList = 0x10000003,
//specific application error lists
etiFTA2ErrorList = 0x10001001,
};
#endif //ERRTYPE_H
}

View File

@ -32,12 +32,10 @@
#include "saga2/vpal.h"
#include "saga2/gpointer.h"
#include "saga2/fontlib.h"
#include "saga2/errclass.h"
#include "saga2/rmem.h"
#include "saga2/hresmgr.h"
#include "saga2/savefile.h"
#include "saga2/config.h"
#include "saga2/nice_err.h"
namespace Saga2 {
/* ===================================================================== *
@ -199,25 +197,7 @@ void restoreProgramDir(void); // chdir() to program directory
void *mustAlloc(uint32 size, const char desc[]); // alloc 'size' bytes or fail
RHANDLE mustAllocHandle(uint32 size, const char desc[]); // as above, but relocatable
//void checkAlloc( void *ptr ); // check allocation
#define checkAlloc(ptr) assertAlloc(ptr)
// Debugging routines
// We've replaced the old error-handling routines with an exception class,
// but not all source has been updated.
#if 1
#ifndef WIN32
#define fatal throw gError
#else
void fatal(char *msg, ...);
#endif
#else
#define fatal systemConfigError
#endif
#define debugf gError::warn
extern void TBlit(gPixelMap *d, gPixelMap *s, int32 x, int32 y);
#define checkAlloc(ptr) (ptr)
// Returns Random Number

View File

@ -30,7 +30,6 @@
#include "saga2/vdraw.h"
#include "saga2/gpointer.h"
#include "saga2/input.h"
#include "saga2/errclass.h"
namespace Saga2 {

View File

@ -29,7 +29,6 @@
#include "saga2/std.h"
#include "saga2/saga2.h"
#include "saga2/rmemfta.h"
#include "saga2/errclass.h"
#include "saga2/hresmgr.h"
#include "saga2/fta.h"
#include "common/debug.h"

View File

@ -27,8 +27,6 @@
#ifndef SAGA2_IOERRORS_H
#define SAGA2_IOERRORS_H
#include "saga2/nice_err.h"
namespace Saga2 {
#ifdef _WIN32

View File

@ -48,7 +48,6 @@
#include "saga2/intrface.h"
#include "saga2/palette.h"
#include "saga2/contain.h"
#include "saga2/nice_err.h"
namespace Saga2 {

View File

@ -111,7 +111,7 @@ void initializeSkill(SkillProto *oNo, SpellID sNo) {
error("Duplicate prototype for spell %d", sNo);
spellBook[sNo].setProto(oNo);
} else
gError::warn("Spell prototype has invalid spell ID %d (lockType)", sNo);
warning("Spell prototype has invalid spell ID %d (lockType)", sNo);
}
//-----------------------------------------------------------------------

View File

@ -41,6 +41,7 @@
#include "saga2/messager.h"
#include "saga2/intrface.h"
#include "saga2/script.h"
#include "saga2/localize.h"
#include "saga2/mainmap.h"
#include "saga2/display.h"
#include "saga2/tower.h"
@ -49,7 +50,7 @@
#include "saga2/ioerrors.h"
#include "saga2/loadsave.h"
#include "saga2/gamerate.h"
#include "saga2/msgbox.h"
namespace Saga2 {
@ -176,7 +177,6 @@ frameCounter irate(TICKSPERSECOND, gameTime);
* ===================================================================== */
bool readCommandLine(int argc, char *argv[]);
void errDumper(char *s);
void findProgramDir(char *argv); // save program home directory
APPFUNC(cmdWindowFunc); // main window event handler
@ -329,16 +329,9 @@ void processEventLoop(bool updateScreen) {
statusshow("starting event loop");
irate.updateFrameCount();
statusshow("checking for exceptions");
if (FatalErrorFlag()) {
//gameRunning=false;
endGame();
return;
}
statusshow("checking user abort");
breakEventLoop();
if (checkExit && verifyUserExit()) { //( SystemError::SystemErrorRetry(cpUserAbort,"")!=0 ) )
if (checkExit && verifyUserExit()) {
//gameRunning=false;
endGame();
return;
@ -470,14 +463,9 @@ char *getExeFromCommandLine(int argc, char *argv[]) {
// Adds error handling to command line parsing
bool readCommandLine(int argc, char *argv[]) {
SimpleErrorMessager cmdLineFatal;
//SystemError::useHandler(&cmdLineFatal);
parseCommandLine(argc, argv);
return true;
//SystemError::useHandler(NULL);
}
/********************************************************************/
@ -703,21 +691,20 @@ static bool openResource(
char *basePath, // path to data file
char *defaultPath, // backup path
char *fileName, // file name & extension
char *description, // description of this resource
configProblem errID) { // in case something goes wrong
char *description) {
if (hr) delete hr;
hr = NULL;
hr = NEW_PRES hResource(fileName, defaultPath, description);
while ((hr == NULL || !hr->_valid) && retryConfigError(cpResDiskMissing, description)) {
while (hr == NULL || !hr->_valid) {
if (hr) delete hr;
hr = NULL;
hr = NEW_PRES hResource(fileName, defaultPath, description);
}
if (hr == NULL || !hr->_valid) {
error("openResource: %s: %d", fileName, errID);
error("openResource: Cannot open resource: %s, %s", fileName, description);
// return false;
}
return true;
@ -731,25 +718,25 @@ bool openResources(void) {
if (
openResource(resFile, globalConfig.imageResfilePath,
"..\\resfile\\", IMAGE_RESFILE,
"Imagery resource file", cpResFileMissing) &&
"Imagery resource file") &&
openResource(objResFile, globalConfig.mainResfilePath,
"..\\resfile\\", OBJECT_RESFILE,
"Object resource file", cpResFileMissing) &&
"Object resource file") &&
openResource(auxResFile, globalConfig.dataResfilePath,
"..\\resfile\\", AUX_RESFILE,
"Data resource file", cpResFileMissing) &&
"Data resource file") &&
openResource(scriptResFile, globalConfig.scriptResfilePath,
"..\\scripts\\", SCRIPT_RESFILE,
"Script resource file", cpResFileMissing) &&
"Script resource file") &&
openResource(voiceResFile, globalConfig.voiceResfilePath,
"..\\sound\\", VOICE_RESFILE,
"Voice resource file", cpResFileMissing) &&
"Voice resource file") &&
openResource(soundResFile, globalConfig.soundResfilePath,
"..\\sound\\", SOUND_RESFILE,
"Sound resource file", cpResFileMissing)) {
"Sound resource file")) {
return true;
}
return false;
@ -893,7 +880,7 @@ void loadGlobals(SaveFileReader &saveGame) {
bool verifyUserExit(void) {
if (!gameRunning)
return true;
if (SystemError::SystemErrorRetry(cpUserAbort, "") != 0)
if (FTAMessageBox("Are you sure you want to exit", ERROR_YE_BUTTON, ERROR_NO_BUTTON) != 0)
return true;
return false;
}
@ -981,17 +968,6 @@ void WriteStatusF(int16, char *, ...) {}
void WriteStatusF2(int16, char *, ...) {}
#endif
//---------------------------------------------------------
//
// Assorted kludgy messaging routines
//
//
void errDumper(char *s) {
SystemError::SystemErrorNotify(s);
}
void logStr(bool onOff, bool newLn, char *st);
void memoryWarning(char *msg, ...) {

View File

@ -110,7 +110,6 @@ void displayEventLoop(void);
// major parts of main that are actually in main.cpp
void cleanupGame(void); // auto-cleanup function
void errDumper(char *s);
bool setupGame(void);
void cleanupPalettes(void);

View File

@ -23,10 +23,6 @@ MODULE_OBJS := \
document.o \
effects.o \
enchant.o \
errbase.o \
errclass.o \
errlist.o \
errors.o \
exit.o \
floating.o \
gamemode.o \
@ -61,7 +57,6 @@ MODULE_OBJS := \
msgbox.o \
noise.o \
mouseimg.o \
nice_err.o \
objects.o \
objproto.o \
osexcept.o \

View File

@ -27,6 +27,7 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
#include "saga2/std.h"
#include "saga2/localize.h"
#include "saga2/msgbox.h"
namespace Saga2 {

View File

@ -1,501 +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 2
* 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
* aint32 with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
#include "saga2/std.h"
#include "saga2/rmemfta.h"
#include "saga2/cmisc.h"
#include "saga2/fta.h"
#include "saga2/errors.h"
#include "saga2/program.h"
#include "saga2/messager.h"
#include "saga2/display.h"
#include "saga2/localize.h"
namespace Saga2 {
pMessager basicFatal = NULL;
pMessager delayedFatal = NULL;
pMessager activeFatal = NULL;
bool cleaningUp = FALSE;
static bool FatalFlag = FALSE;
static int lasterrno;
void BackToSysPalette(void);
/* ===================================================================== *
Functions
* ===================================================================== */
// ------------------------------------------------------------------
// niceFatal is a happy joyful way to tell the user his disk is full
void niceFatal(char *msg, ...) {
char dump[256];
va_list argptr;
va_start(argptr, msg);
vsprintf(dump, msg, argptr);
va_end(argptr);
error("Program ended : %s", dump);
}
int16 FTAMessageBox(char *msg, char *btnMsg1, char *btnMsg2) {
warning("STUB: FTAMessageBox()");
return 0;
}
// ------------------------------------------------------------------
// shutdownSave offers a chance to save the game on fatal exits
void shutdownSave(void) {
#if !DEBUG
cleaningUp = TRUE;
#endif
}
/* ===================================================================== *
SystemError member functions
* ===================================================================== */
pMessager SystemError::fatalMessager = NULL;
// ------------------------------------------------------------------
// Constructors
SystemError::SystemError(const char *nmsg, ...) {
va_list argptr;
notifyFlag = FALSE;
cp = cpInternal;
va_start(argptr, nmsg);
buildMsg(nmsg, argptr);
va_end(argptr);
}
SystemError::SystemError(configProblem errID, const char *nmsg, ...) {
va_list argptr;
notifyFlag = FALSE;
cp = errID;
va_start(argptr, nmsg);
buildMsg(nmsg, argptr);
va_end(argptr);
}
#if DEBUG
void SystemError::buildMsg(const char *fmt, va_list vl)
#else
void SystemError::buildMsg(const char *, va_list)
#endif
{
#if 0
char dosErr[256];
if (errno && (cp >= cpResFileLocked && cp <= cpSavFileRead)) { // unable to read save file
sprintf(dosErr, "(%s)\n", strerror(errno));
lasterrno = errno;
errno = 0;
} else
dosErr[0] = '\0';
#if DEBUG
SureLogMessager slm = SureLogMessager("SYSERRS.LOG", (int16) 0, SureLogMessager::logOpenAppend);
char tmsg[256];
vsprintf(tmsg, fmt, vl);
sprintf(msg, "%s\n%s%s\n", sysMessage(cp), dosErr, tmsg);
slm("FATAL: %s\n", msg);
#else
sprintf(msg, "%s\n%s", sysMessage(cp), dosErr);
#endif
if (getRetry(cp) != rcIgnore)
if (!notifyFlag) {
//#if DEBUG
// warn(msg);
//#else
SystemErrorNotify(msg);
notifyFlag = TRUE;
//#endif
}
#endif
warning("STUB: SystemError::buildMsg");
}
// ------------------------------------------------------------------
// Code to get the textual version of an error message
#include "saga2/errlist.h"
extern SequentialErrorList programErrors;
const char *SystemError::sysMessage(configProblem prob) {
ErrText et = programErrors.errMessage(prob);
return et;
}
// ------------------------------------------------------------------
// Code to get the appropriate action for an error
SystemError::RetryClasses SystemError::getRetry(configProblem prob) {
switch (prob) {
case cpMinCPU :
case cpMinCPUSpeed :
case cpMinDOSVer :
case cpInDOSBox :
case cpInsufPhysRAM :
case cpInsufPhysMemFree :
case cpInsufVirtRAM :
case cpInsufVirtMemFree :
case cpNoDPMISupport :
case cpNoAudioDrivers :
case cpNoDIGAudio :
case cpNoMDIAudio :
case cpNoMouseDriver :
case cpLowSVGAThruput :
case cpLowCDROMThruput :
case cpDDrawInitFail :
case cpDSoundInitFail :
case cpDTimerInitFail :
case cpProcessorExcept :
case cpGPHandlerFail :
case cpInternal :
case cpResFileLocked :
case cpResFileSeek :
case cpResFileRead :
case cpResFileWrite :
case cpResFileClose :
return rcFatal;
case cpResFileMissing :
case cpResDiskMissing :
case cpVidDiskMissing :
case cpDDrawReInitFail :
return rcRetry;
case cpUserAbort :
case cpVideoCompat :
case cpHeapOverflow :
case cpNoDIGAudioCheck :
case cpNoMDIAudioCheck :
return rcYesNo;
case cpExitQuietly :
return rcIgnore;
default :
return rcFatal;
}
}
// ------------------------------------------------------------------
// needed for error handling
#ifdef _WIN32
#include "saga2/ftawin.h"
extern HWND hWndMain;
void localCursorOn(void);
void localCursorOff(void);
#else
int textUserDialog(char *, char *msg, char *b1, char *b2, char *b3);
#endif
// ------------------------------------------------------------------
// Simple error handling
SimpleErrorMessager::SimpleErrorMessager() {
}
SimpleErrorMessager::~SimpleErrorMessager() {
}
int SimpleErrorMessager::dumpit(char *s, size_t size) {
#ifdef _WIN32
MessageBox(hWndMain, s, PROGRAM_FULL_NAME, MB_APPLMODAL | MB_ICONSTOP | MB_OK);
#else
textUserDialog(PROGRAM_FULL_NAME, s, NULL, NULL, NULL);
#endif
return size;
}
// ------------------------------------------------------------------
// delayed Simple error handling
int BufferedErrorMessager::dumpit(char *t, size_t s) {
if (cleaningUp)
return s;
return BufferedTextMessager::dumpit(t, s);
}
BufferedErrorMessager::BufferedErrorMessager(size_t s) :
BufferedTextMessager(s) {
}
BufferedErrorMessager::~BufferedErrorMessager() {
if (dumpText) {
if (bufPos) {
#ifdef _WIN32
MessageBox(hWndMain, dumpText, PROGRAM_FULL_NAME, MB_APPLMODAL | MB_ICONSTOP | MB_OK);
#else
textUserDialog(PROGRAM_FULL_NAME, dumpText, NULL, NULL, NULL);
#endif
}
bufPos = 0;
}
}
// ------------------------------------------------------------------
// full screen mode error handling
int GUIErrorMessager::dumpit(char *s, size_t size) {
FTAMessageBox(s, NULL, "OK");
return size;
}
GUIErrorMessager::GUIErrorMessager() {
}
GUIErrorMessager::~GUIErrorMessager() {
}
#define errDialog(t,m,b1,b2,b3) FTAMessageBox(m,b1,b2)
#ifdef _WIN32
extern CFTWindow *pWindow;
extern char TITLE[];
#else
int textUserDialog(char *, char *msg, char *b1, char *b2, char *b3);
int16 userDialog(char *title, char *msg, char *btnMsg1,
char *btnMsg2,
char *btnMsg3);
// ------------------------------------------------------------------
// in DOS, if Graphics haven't been initialized we still need a Retry
// capability
int textUserDialog(char *, char *msg, char *bt1, char *bt2, char *bt3) {
int bs = 0;
char l[5];
char b1[32];
char b2[32];
char b3[32];
char c = '\0';
for (int i = 0; i < 5; i++)
l[i] = '\0';
if (bt1) strncpy(b1, bt1, 32);
else b1[0] = '\0';
if (bt2) strncpy(b2, bt2, 32);
else b2[0] = '\0';
if (bt3) strncpy(b3, bt3, 32);
else b3[0] = '\0';
if (isalpha(*b1)) l[bs++] = toupper(*b1);
if (isalpha(*b2)) l[bs++] = toupper(*b2);
if (isalpha(*b3)) l[bs++] = toupper(*b3);
fprintf(stderr, "%s\n%s %s %s %s", msg, b1, b2, b3, bs > 1 ? "?" : " ");
if (strlen(l) < 2 || c == 27)
return -1;
#if 0
c = toupper(getch());
#else
c = 27;
#endif
warning("STUB: textUserDialog");
fprintf(stderr, "\n");
#if 0
while (strlen(l) > 1 && c != 27 && NULL == strchr(l, c))
c = toupper(getch());
#endif
return abs(strchr(l, c) - l);
}
#endif
// ------------------------------------------------------------------
// Static member functions to pop up a retry box
bool SystemError::SystemErrorRetry(configProblem errID, const char *nmsg, ...) {
#if 0
char t[256];
char t2[256];
char dosErr[256];
if (errno && (errID >= cpResFileLocked && errID <= cpSavFileRead)) // unable to read save file
sprintf(dosErr, "(%s)\n", strerror(errno));
else
dosErr[0] = '\0';
va_list argptr;
va_start(argptr, nmsg);
vsprintf(t, nmsg, argptr);
va_end(argptr);
#if DEBUG
sprintf(t2, "%s\n%s%s\n", sysMessage(errID), dosErr, t);
#else
sprintf(t2, "%s\n%s", sysMessage(errID), dosErr);
#endif
return SystemError::SystemErrorRetry(t2, getRetry(errID));
#endif
warning("STUB: SystemError::SystemErrorRetry()");
return false;
}
bool SystemError::SystemErrorRetry(char *nmsg, SystemError::RetryClasses rc) {
#ifdef _WIN32
int r = 1;
if (
#if DEBUG
0 && (
#endif
!displayEnabled(WindowInactive) || !pWindow->m_fullScreen || !displayEnabled(GraphicsInit)
#if DEBUG
)
#endif
) {
BackToSysPalette();
switch (rc) {
case rcRetry:
r = (IDCANCEL != MessageBox(hWndMain,
nmsg,
PROGRAM_FULL_NAME,
MB_APPLMODAL | MB_ICONSTOP | MB_RETRYCANCEL));
break;
case rcYesNo:
r = (IDYES == MessageBox(hWndMain,
nmsg,
PROGRAM_FULL_NAME,
MB_APPLMODAL | MB_ICONQUESTION | MB_YESNO));
break;
default:
return FALSE;
}
} else {
switch (rc) {
case rcRetry:
r = errDialog(PROGRAM_FULL_NAME, nmsg, ERROR_RE_BUTTON, ERROR_CA_BUTTON, NULL);
break;
case rcYesNo:
r = errDialog(PROGRAM_FULL_NAME, nmsg, ERROR_YE_BUTTON, ERROR_NO_BUTTON, NULL);
break;
default:
return FALSE;
}
}
return (r);
#else
int r = 1;
if (displayEnabled(GraphicsInit)) {
switch (rc) {
case rcRetry:
r = errDialog(PROGRAM_FULL_NAME, nmsg, ERROR_RE_BUTTON, ERROR_CA_BUTTON, NULL);
break;
case rcYesNo:
r = errDialog(PROGRAM_FULL_NAME, nmsg, ERROR_YE_BUTTON, ERROR_NO_BUTTON, NULL);
break;
default:
return FALSE;
}
} else {
switch (rc) {
case rcRetry:
r = textUserDialog(PROGRAM_FULL_NAME, nmsg, ERROR_RE_BUTTON, ERROR_CA_BUTTON, NULL);
break;
case rcYesNo:
r = textUserDialog(PROGRAM_FULL_NAME, nmsg, ERROR_YE_BUTTON, ERROR_NO_BUTTON, NULL);
break;
default:
return FALSE;
}
}
return (r == 0);
#endif
}
void SystemError::SystemErrorNotify(const char *nmsg, ...) {
#ifdef _WIN32
BackToSysPalette();
#endif
#if DEBUG
SureLogMessager slm = SureLogMessager("SYSERRS.LOG", (int16) 0, SureLogMessager::logOpenAppend);
#endif
va_list argptr;
FatalFlag = TRUE;
#if DEBUG
va_start(argptr, nmsg);
slm.va((char *)nmsg, argptr);
va_end(argptr);
#endif
va_start(argptr, nmsg);
if (fatalMessager) {
fatalMessager->va((char *)nmsg, argptr);
}
va_end(argptr);
}
// ------------------------------------------------------------------------
// Fatal error handling
bool FatalErrorFlag(void) {
return FatalFlag;
}
bool SetFatalMode(FatalHandlingModes fhm) {
if (basicFatal) delete basicFatal;
basicFatal = NULL;
if (delayedFatal) delete delayedFatal;
delayedFatal = NULL;
if (activeFatal) delete activeFatal;
activeFatal = NULL;
SystemError::useHandler(NULL);
switch (fhm) {
case fhmSimple:
basicFatal = new SimpleErrorMessager;
if (basicFatal == NULL)
return FALSE;
SystemError::useHandler(basicFatal);
return TRUE;
case fhmHold:
delayedFatal = new BufferedErrorMessager(4096);
if (delayedFatal == NULL)
return FALSE;
SystemError::useHandler(delayedFatal);
return TRUE;
case fhmGUI:
activeFatal = new GUIErrorMessager;
if (activeFatal == NULL)
return FALSE;
SystemError::useHandler(activeFatal);
return TRUE;
}
return TRUE;
}
} // end of namespace Saga2

View File

@ -1,297 +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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Based on the original sources
* Faery Tale II -- The Halls of the Dead
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#ifndef SAGA2_NICE_ERR_H
#define SAGA2_NICE_ERR_H
/* ===================================================================== *
Includes
* ===================================================================== */
#include "saga2/errclass.h"
#include "saga2/errors.h"
#include "saga2/messager.h"
#include "saga2/errlist.h"
#include "saga2/localize.h"
/* ===================================================================== *
Types
* ===================================================================== */
// ------------------------------------------------------------------
// error codes used by SystemError
namespace Saga2 {
enum configProblem {
cpNoError = 0,
cpBadCLArgs, // Bad command line args
// Hardware minimums
cpMinCPU, // Minimum CPU type
cpMinCPUSpeed, // Minimum CPU speed
cpMinDOSVer, // Minimum DOS version
cpInDOSBox, // Running in a DOS box
cpInsufPhysRAM, // Minimum Physical RAM
cpInsufPhysMemFree, // Minimum Free Physical RAM
cpInsufVirtRAM, // Minimum memory
cpInsufVirtMemFree, // Minimum free memory
cpNoDPMISupport, // Minimum memory
// DOS problems
cpNoAudioDrivers, // audio drivers missing
cpNoDIGAudio, // no AIL dig driver
cpNoMDIAudio, // no AIL midi driver
cpLowSVGAThruput, // low frame rate
cpLowCDROMThruput, // low CD throughput
cpNoMouseDriver, // mouse driver not loaded
// Win problems
cpGPHandlerFail, // couldn't add GP handler
cpDDrawInitFail, // direct draw initfailure
cpDSoundInitFail, // direct sound init failure
cpDTimerInitFail, // direct sound init failure
// Runtime failures
cpProcessorExcept, // GPF et al.
// Resource file failures
cpResFileMissing, // unable to open resource file
cpResDiskMissing, // unable to open resource file
cpVidDiskMissing, // unable to open video file
cpNoDIGAudioCheck, // no AIL dig driver
cpNoMDIAudioCheck, // no AIL midi driver
cpResFileLocked, // unable to open resource file for read
cpResFileSeek, // unable to seek in resource file
cpResFileRead, // unable to read resource file
cpResFileWrite, // unable to write resource file
cpResFileClose, // unable to close resource file
cpSavFileWrite, // unable to write save file
cpSavFileRead, // unable to read save file
// Multitasking errors
cpDDrawReInitFail, // unable to reinitialize screen
// Internal
cpInternal, // internal game error
// User cancel
cpUserAbort, // user hit break
cpVideoCompat, // video card warning
cpHeapOverflow, // heap overflow debugging
// Quiet
cpExitQuietly,
maxConfigProblem, // bounding value
};
// ------------------------------------------------------------------
// SystemError class
// A gError variant aimed at release versions
class SystemError : public gError {
// ------------------------------------------------------------------
// internal types
enum RetryClasses {
rcFatal,
rcClose,
rcRetry,
rcYesNo,
rcIgnore,
};
// ------------------------------------------------------------------
// member data
configProblem cp;
char msg[256];
BOOL notifyFlag;
static pMessager fatalMessager;
// ------------------------------------------------------------------
// internal member functions
static const char *sysMessage(configProblem prob);
static RetryClasses getRetry(configProblem prob);
static bool SystemErrorRetry(char *msg, RetryClasses rc);
void buildMsg(const char *fmt, va_list vl);
public:
// ------------------------------------------------------------------
// external member functions
static void useHandler(pMessager m) {
fatalMessager = m;
}
static void SystemErrorFatal(SystemError &se) {
error("%s", se.msg);
}
static bool SystemErrorRetry(configProblem errID, const char *notes, ...);
static void SystemErrorNotify(const char *nmsg, ...);
SystemError(const char *msg, ...);
SystemError(configProblem errID, const char *msg, ...);
void notify(void) {
if (!notifyFlag) SystemErrorNotify(msg);
notifyFlag = TRUE;
}
};
// ------------------------------------------------------------------
// Messagers for errors
// ------------------------------------------------------------------
// For use with unititialized screens
class SimpleErrorMessager : public Messager {
protected:
int dumpit(char *s, size_t size);
public:
SimpleErrorMessager();
~SimpleErrorMessager();
void *operator new (size_t s) {
return calloc(1, s);
}
void operator delete (void *m) {
free(m);
}
};
// ------------------------------------------------------------------
// During init/cleanup
class BufferedErrorMessager : public BufferedTextMessager {
protected:
int dumpit(char *, size_t);
public:
BufferedErrorMessager(size_t s);
~BufferedErrorMessager();
void *operator new (size_t s) {
return calloc(1, s);
}
void operator delete (void *m) {
free(m);
}
};
// ------------------------------------------------------------------
// full screen mode error handling
class GUIErrorMessager : public Messager {
protected:
int dumpit(char *s, size_t size);
public:
GUIErrorMessager();
~GUIErrorMessager();
void *operator new (size_t s) {
return calloc(1, s);
}
void operator delete (void *m) {
free(m);
}
};
extern SequentialErrorList systemErrors;
extern SequentialErrorList programErrors;
#ifdef _WIN32
extern SparseErrorList win32ExceptionList;
extern SparseErrorList directDrawErrorList;
#endif
/* ===================================================================== *
Prototypes
* ===================================================================== */
// ------------------------------------------------------------------
// Error descriptions for processor faults
const char *ExceptDescript(unsigned long ExCode); //, LPEXCEPTION_POINTERS );
// ------------------------------------------------------------------
// Old system error call
void niceFatal(char *msg, ...);
// ------------------------------------------------------------------
// dialog using no resources / little memory
int16 FTAMessageBox(char *msg, char *btnMsg1, char *btnMsg2);
/* ===================================================================== *
Inlines & aliases
* ===================================================================== */
// ------------------------------------------------------------------
// alias to build & throw error
#define systemConfigError throw SystemError
// ------------------------------------------------------------------
// alias to do a retry box
#define retryConfigError SystemError::SystemErrorRetry
// ------------------------------------------------------------------
// alias to do a warning box
#define systemWarning SystemError::SystemErrorNotify
// ------------------------------------------------------------------
// ASSERT variation
#define REQUIRE(requirement,whenfails) if (!requirement) throw SystemError(whenfails,"")
inline void assertAlloc(void *ptr) {
if (NULL == ptr)
error(ALLOCATION_ERROR);
}
enum FatalHandlingModes {
fhmNone = 0,
fhmSimple,
fhmHold,
fhmGUI,
};
bool SetFatalMode(FatalHandlingModes fhm);
bool FatalErrorFlag(void);
} // end of namespace Saga2
#endif

View File

@ -33,7 +33,6 @@
#include "saga2/audiores.h"
#include "saga2/tcoords.h"
#include "saga2/button.h"
#include "saga2/nice_err.h"
#include "saga2/annoy.h"
#include "saga2/objproto.h"
#include "saga2/player.h"

View File

@ -31,7 +31,6 @@
#define NO_LOCAL_MEMORY_OVERRIDES 1
#include "saga2/rmembase.h"
#include "saga2/errors.h"
#include "saga2/errclass.h"
namespace Saga2 {

View File

@ -44,36 +44,6 @@ void getSaveFileName(int16 saveNo, char *fileName) {
sprintf(fileName, "%s%3.3d.SAV", globalConfig.savedGamePath, saveNo);
}
/* ===================================================================== *
SaveFileWriteError member functions
* ===================================================================== */
//----------------------------------------------------------------------
// Constructor
SaveFileWriteError::SaveFileWriteError(char *msg, ...) {
va_list argptr;
va_start(argptr, msg);
append(msg, argptr);
va_end(argptr);
}
/* ===================================================================== *
SaveFileReadError member functions
* ===================================================================== */
//----------------------------------------------------------------------
// Constructor
SaveFileReadError::SaveFileReadError(char *msg, ...) {
va_list argptr;
va_start(argptr, msg);
append(msg, argptr);
va_end(argptr);
}
/* ===================================================================== *
SaveFileConstructor member functions
* ===================================================================== */

View File

@ -28,7 +28,6 @@
#define SAGA2_SAVEFILE_H
#include "saga2/iff.h"
#include "saga2/errclass.h"
namespace Saga2 {
@ -45,29 +44,6 @@ const ChunkID gameID = MKTAG('F', 'T', 'A', '2');
const ChunkID gameID = MKTAG('D', 'I', 'N', 'O');
#endif
/* ===================================================================== *
SaveFileWriteError class
* ===================================================================== */
// This is an exception class for detecting write errors. This will allow
// a graceful recovery from a failed save attempt.
class SaveFileWriteError : public gError {
public:
SaveFileWriteError(char *msg, ...);
};
/* ===================================================================== *
SaveFileWriteError class
* ===================================================================== */
// The is an exception class for detecting read errors.
class SaveFileReadError : public gError {
public:
SaveFileReadError(char *msg, ...);
};
/* ===================================================================== *
SaveFileHeader class
* ===================================================================== */

View File

@ -119,27 +119,21 @@ class EffectDisplayPrototype {
#pragma off (unreferenced) ;
#endif
static SPELLLOCATIONFUNCTION(nullLocation) {
VERIFY(0);
return TilePoint(0, 0, 0);
}
static SPELLSPRITATIONFUNCTION(nullSpritation) {
VERIFY(0);
return 0;
}
static SPELLSTATUSFUNCTION(nullStatus) {
VERIFY(0);
return effectronDead;
}
static SPELLHEIGHTFUNCTION(nullHeight) {
VERIFY(0);
return 0;
}
static SPELLBREADTHFUNCTION(nullBreadth) {
VERIFY(0);
return 0;
}
static SPELLINITFUNCTION(nullInit) {
VERIFY(0);
}
#ifdef __WATCOMC__
#pragma on (unreferenced) ;

View File

@ -31,6 +31,9 @@
#include "saga2/rmemfta.h"
#define ASSERT assert // FIXME
#define VERIFY assert // FIXME
#define FTA
// #define LEAVE goto exitit // bail out of function

View File

@ -4713,8 +4713,7 @@ extern int32 gameTime;
}
tclock1 = gameTime;
debugf( "Time = %d\n",
tclock1 - tclock0 );
debug( "Time = %d", tclock1 - tclock0 );
*/

View File

@ -119,12 +119,7 @@ INITIALIZER(programInit) {
if (r) {
setInitState(initializationState + 1);
} else {
SystemError se = SystemError(
tower[tLevel].onFail,
"Tower Initialization Step %d Failed (record %d)",
initializationState,
tLevel);
se.notify();
error("Tower Initialization Step %d Failed (record %d)", initializationState, tLevel);
return FALSE;
}
}
@ -160,8 +155,7 @@ TERMINATOR(termTowerBase) {
// This pair should be the first thing in the tower list
INITIALIZER(initErrorManagers) {
//initErrorHandlers();
return SetFatalMode(fhmSimple);
return true;
}
// defining VERIFY_EXIT will give you a message box when the program has
@ -173,35 +167,26 @@ INITIALIZER(initErrorManagers) {
#endif
TERMINATOR(termErrorManagers) {
#ifdef VERIFY_EXIT
extern HWND hWndMain;
#endif
SetFatalMode(fhmNone);
#ifdef VERIFY_EXIT
MessageBox(hWndMain, "Cleanup complete", PROGRAM_FULL_NAME, MB_APPLMODAL | MB_OK);
#endif
}
// ------------------------------------------------------------------------
// This pair should be used before the display is initialized
INITIALIZER(initDelayedErrors) {
return SetFatalMode(fhmHold);
return true;
}
TERMINATOR(termDelayedErrors) {
SetFatalMode(fhmSimple);
}
// ------------------------------------------------------------------------
// This pair should be used once everything is working
INITIALIZER(initActiveErrors) {
return SetFatalMode(fhmGUI);
return true;
}
TERMINATOR(termActiveErrors) {
SetFatalMode(fhmHold);
}

View File

@ -27,8 +27,6 @@
#ifndef SAGA2_TOWER_H
#define SAGA2_TOWER_H
#include "saga2/nice_err.h"
namespace Saga2 {
/* ===================================================================== *
@ -59,7 +57,6 @@ struct TowerLayer {
int ord;
pPROGRAM_INITIALIZER init;
pPROGRAM_TERMINATOR term;
configProblem onFail;
};
/* ===================================================================== *

View File

@ -59,43 +59,43 @@ namespace Saga2 {
int maxInitState = fullyInitialized;
TowerLayer tower[fullyInitialized] = {
{ nothingInitialized, &initTowerBase, &termTowerBase, cpInternal },
{ errHandlersInitialized, &initErrorManagers, &termErrorManagers, cpInternal },
{ delayedErrInitialized, &initDelayedErrors, &termDelayedErrors, cpInternal },
{ activeErrInitialized, &initActiveErrors, &termActiveErrors, cpInternal },
{ messagersInitialized, &initSysMessagers, &termSysMessagers, cpInternal },
{ errLoggersInitialized, &initErrorLoggers, &termErrorLoggers, cpInternal },
{ breakHandlerInitialized, &initCtlBreakTrap, &termCtlBreakTrap, cpInternal },
{ configTestInitialized, &initSystemConfig, &termTowerBase, cpInternal },
{ memoryInitialized, &initMemPool, &termMemPool, cpInsufVirtMemFree },
{ graphicsSystemInitialized, &initGraphicsSystem, &termGraphicsSystem, cpDDrawInitFail },
{ videoInitialized, &initVideoPlayer, &termVideoPlayer, cpInternal },
{ introInitialized, &initPlayIntro, &termPlayOutro, cpInternal },
{ timerInitialized, &initSystemTimer, &termSystemTimer, cpDTimerInitFail },
{ resourcesInitialized, &initResourceFiles, &termResourceFiles, cpResFileMissing },
{ serversInitialized, &initResourceServers, &termResourceServers, cpInternal },
{ pathFinderInitialized, &initPathFinders, &termPathFinders, cpInternal },
{ scriptsInitialized, &initSAGAInterpreter, &termSAGAInterpreter, cpInternal },
{ audStartInitialized, &initAudioChannels, &termAudioChannels, cpInternal },
{ tileResInitialized, &initResourceHandles, &termResourceHandles, cpInternal },
{ palettesInitialized, &initPalettes, &termPalettes, cpInternal },
{ mainWindowInitialized, &initDisplayPort, &termDisplayPort, cpInternal },
{ panelsInitialized, &initPanelSystem, &termPanelSystem, cpInternal },
{ mainWindowOpenInitialized, &initMainWindow, &termMainWindow, cpInternal },
{ guiMessInitialized, &initGUIMessagers, &termGUIMessagers, cpInternal },
{ mouseImageInitialized, &initMousePointer, &termMousePointer, cpNoMouseDriver },
{ displayInitialized, &initDisplay, &termDisplay, cpInternal },
{ mapsInitialized, &initGameMaps, &termGameMaps, cpInternal },
{ patrolsInitialized, &initRouteData, &termRouteData, cpInternal },
{ spritesInitialized, &initActorSprites, &termActorSprites, cpInternal },
{ weaponsInitialized, &initWeaponData, &termWeaponData, cpInternal },
{ magicInitialized, &initSpellData, &termSpellData, cpInternal },
{ objectSoundFXInitialized, &initObjectSoundFX, &termObjectSoundFX, cpInternal },
{ prototypesInitialized, &initObjectPrototypes, &termObjectPrototypes, cpInternal },
{ gameStateInitialized, &initDynamicGameData, &termDynamicGameData, cpInternal },
{ gameModeInitialized, &initGameMode, &termGameMode, cpInternal },
{ gameDisplayEnabled, &initTop, &termTop, cpInternal },
{ procResEnabled, &initProcessResources, &termProcessResources, cpInternal },
{ nothingInitialized, &initTowerBase, &termTowerBase },
{ errHandlersInitialized, &initErrorManagers, &termErrorManagers },
{ delayedErrInitialized, &initDelayedErrors, &termDelayedErrors },
{ activeErrInitialized, &initActiveErrors, &termActiveErrors },
{ messagersInitialized, &initSysMessagers, &termSysMessagers },
{ errLoggersInitialized, &initErrorLoggers, &termErrorLoggers },
{ breakHandlerInitialized, &initCtlBreakTrap, &termCtlBreakTrap },
{ configTestInitialized, &initSystemConfig, &termTowerBase },
{ memoryInitialized, &initMemPool, &termMemPool },
{ graphicsSystemInitialized, &initGraphicsSystem, &termGraphicsSystem },
{ videoInitialized, &initVideoPlayer, &termVideoPlayer },
{ introInitialized, &initPlayIntro, &termPlayOutro },
{ timerInitialized, &initSystemTimer, &termSystemTimer },
{ resourcesInitialized, &initResourceFiles, &termResourceFiles },
{ serversInitialized, &initResourceServers, &termResourceServers },
{ pathFinderInitialized, &initPathFinders, &termPathFinders },
{ scriptsInitialized, &initSAGAInterpreter, &termSAGAInterpreter },
{ audStartInitialized, &initAudioChannels, &termAudioChannels },
{ tileResInitialized, &initResourceHandles, &termResourceHandles },
{ palettesInitialized, &initPalettes, &termPalettes },
{ mainWindowInitialized, &initDisplayPort, &termDisplayPort },
{ panelsInitialized, &initPanelSystem, &termPanelSystem },
{ mainWindowOpenInitialized, &initMainWindow, &termMainWindow },
{ guiMessInitialized, &initGUIMessagers, &termGUIMessagers },
{ mouseImageInitialized, &initMousePointer, &termMousePointer },
{ displayInitialized, &initDisplay, &termDisplay },
{ mapsInitialized, &initGameMaps, &termGameMaps },
{ patrolsInitialized, &initRouteData, &termRouteData },
{ spritesInitialized, &initActorSprites, &termActorSprites },
{ weaponsInitialized, &initWeaponData, &termWeaponData },
{ magicInitialized, &initSpellData, &termSpellData },
{ objectSoundFXInitialized, &initObjectSoundFX, &termObjectSoundFX },
{ prototypesInitialized, &initObjectPrototypes, &termObjectPrototypes },
{ gameStateInitialized, &initDynamicGameData, &termDynamicGameData },
{ gameModeInitialized, &initGameMode, &termGameMode },
{ gameDisplayEnabled, &initTop, &termTop },
{ procResEnabled, &initProcessResources, &termProcessResources }
};
/* ===================================================================== *

View File

@ -34,7 +34,6 @@
#include "saga2/videos.h"
#include "saga2/player.h"
#include "saga2/tromode.h"
#include "saga2/nice_err.h"
#include "saga2/messager.h"
#include "saga2/config.h"
#include "saga2/display.h"
@ -249,10 +248,6 @@ void waitForVideoFile(char *fileName) { // file name & extension
fe = fileExists(filespec);
while (!fe && retryConfigError(cpVidDiskMissing, "Trying to open a video")) {
fe = fileExists(filespec);
}
if (!fe) {
abortFlag = TRUE;
return;

View File

@ -27,7 +27,6 @@
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
#include "saga2/std.h"
#include "saga2/errclass.h"
namespace Saga2 {

View File

@ -37,8 +37,6 @@
#define USE_MOV 0
#include "saga2/errclass.h"
namespace Saga2 {
typedef int HDIGDRIVER;

View File

@ -29,7 +29,6 @@
#include "saga2/std.h"
#include "saga2/vwpage.h"
#include "saga2/display.h"
#include "saga2/errclass.h"
namespace Saga2 {