scummvm/engines/tony/globals.h

288 lines
6.8 KiB
C
Raw Normal View History

/* 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/>.
*
*/
#ifndef TONY_GLOBALS
#define TONY_GLOBALS
#include "common/savefile.h"
#include "tony/gfxengine.h"
#include "tony/input.h"
#include "tony/inventory.h"
#include "tony/loc.h"
#include "tony/tonychar.h"
#include "tony/mpal/mpal.h"
#include "tony/mpal/mpaldll.h"
namespace Tony {
2012-06-20 22:20:16 +00:00
#define AMBIANCE_CRICKETS 1
#define AMBIANCE_CRICKETSMUFFLED 2
#define AMBIANCE_CRICKETSWIND 3
#define AMBIANCE_CRICKETSWIND1 4
#define AMBIANCE_WIND 5
#define AMBIANCE_SEA 6
#define AMBIANCE_SEAHALFVOLUME 7
struct CharacterStruct {
2012-06-08 06:44:14 +00:00
uint32 _code;
RMItem *_item;
byte _r, _g, _b;
int _talkPattern;
int _standPattern;
int _startTalkPattern, _endTalkPattern;
int _numTexts;
void save(Common::OutSaveFile *f) {
f->writeUint32LE(_code);
f->writeUint32LE(0);
2012-06-08 06:44:14 +00:00
f->writeByte(_r);
f->writeByte(_g);
f->writeByte(_b);
f->writeUint32LE(_talkPattern);
f->writeUint32LE(_standPattern);
f->writeUint32LE(_startTalkPattern);
f->writeUint32LE(_endTalkPattern);
f->writeUint32LE(_numTexts);
}
2012-06-08 06:44:14 +00:00
void load(Common::InSaveFile *f) {
_code = f->readUint32LE();
f->readUint32LE();
2012-06-08 06:44:14 +00:00
_item = NULL;
_r = f->readByte();
_g = f->readByte();
_b = f->readByte();
_talkPattern = f->readUint32LE();
_standPattern = f->readUint32LE();
_startTalkPattern = f->readUint32LE();
_endTalkPattern = f->readUint32LE();
_numTexts = f->readUint32LE();
}
};
struct MCharacterStruct {
2012-06-08 06:44:14 +00:00
uint32 _code;
RMItem *_item;
byte _r, _g, _b;
int _x, _y;
int _numTalks[10];
int _curGroup;
int _numTexts;
bool _bInTexts;
int _curTalk;
bool _bAlwaysBack;
void save(Common::OutSaveFile *f) {
f->writeUint32LE(_code);
f->writeUint32LE(0);
2012-06-08 06:44:14 +00:00
f->writeByte(_r);
f->writeByte(_g);
f->writeByte(_b);
f->writeUint32LE(_x);
f->writeUint32LE(_y);
for (int i = 0; i < 10; ++i)
2012-06-08 06:44:14 +00:00
f->writeUint32LE(_numTalks[i]);
f->writeUint32LE(_curGroup);
f->writeUint32LE(_numTexts);
f->writeByte(_bInTexts);
f->writeUint32LE(_curTalk);
f->writeByte(_bAlwaysBack);
}
2012-06-08 06:44:14 +00:00
void load(Common::InSaveFile *f) {
_code = f->readUint32LE();
f->readUint32LE();
2012-06-08 06:44:14 +00:00
_item = NULL;
_r = f->readByte();
_g = f->readByte();
_b = f->readByte();
_x = f->readUint32LE();
_y = f->readUint32LE();
for (int i = 0; i < 10; ++i)
2012-06-08 06:44:14 +00:00
_numTalks[i] = f->readUint32LE();
_curGroup = f->readUint32LE();
_numTexts = f->readUint32LE();
_bInTexts = f->readByte();
_curTalk = f->readUint32LE();
_bAlwaysBack = f->readByte();
}
};
struct ChangedHotspotStruct {
2012-06-08 06:44:14 +00:00
uint32 _dwCode;
uint32 _nX, _nY;
2012-06-08 06:44:14 +00:00
void save(Common::OutSaveFile *f) {
f->writeUint32LE(_dwCode);
f->writeUint32LE(_nX);
f->writeUint32LE(_nY);
}
2012-06-08 06:44:14 +00:00
void load(Common::InSaveFile *f) {
_dwCode = f->readUint32LE();
_nX = f->readUint32LE();
_nY = f->readUint32LE();
}
};
/**
* Description of a call to a custom function.
*/
typedef struct {
2012-06-10 20:02:31 +00:00
int _nCf;
int _arg1, _arg2, _arg3, _arg4;
2012-08-31 22:25:35 +00:00
} CfCall;
typedef CfCall *LpCfCall;
struct CoroutineMutex {
CoroutineMutex() : _eventId(0), _ownerPid(0), _lockCount(0) { }
uint32 _eventId;
uint32 _ownerPid;
uint32 _lockCount;
};
/****************************************************************************\
* Global variables
\****************************************************************************/
/**
* Globals class
*/
class Globals {
public:
Globals();
Common::String _nextMusic;
2012-06-08 06:44:14 +00:00
bool _nextLoop;
int _nextChannel;
int _nextSync;
int _curChannel;
int _flipflop;
2012-06-08 06:44:14 +00:00
CharacterStruct _character[16];
MCharacterStruct _mCharacter[10];
ChangedHotspotStruct _changedHotspot[256];
bool _isMChar[16];
bool _bAlwaysDisplay;
RMPoint _saveTonyPos;
int _saveTonyLoc;
2012-06-08 06:44:14 +00:00
RMTextDialog *_curBackText;
bool _bTonyIsSpeaking;
int _curChangedHotspot;
2012-06-08 22:52:38 +00:00
bool _bCfgInvLocked;
bool _bCfgInvNoScroll;
bool _bCfgTimerizedText;
bool _bCfgInvUp;
bool _bCfgAnni30;
bool _bCfgAntiAlias;
bool _bShowSubtitles;
2012-06-08 22:52:38 +00:00
bool _bCfgTransparence;
bool _bCfgInterTips;
bool _bCfgDubbing;
bool _bCfgMusic;
bool _bCfgSFX;
int _nCfgTonySpeed;
int _nCfgTextSpeed;
int _nCfgDubbingVolume;
int _nCfgMusicVolume;
int _nCfgSFXVolume;
2012-06-08 22:52:38 +00:00
bool _bSkipSfxNoLoop;
bool _bIdleExited;
bool _bNoBullsEye;
int _curDialog;
int _curSoundEffect;
2012-06-08 22:52:38 +00:00
bool _bFadeOutStop;
2012-06-10 20:02:31 +00:00
RMTony *_tony;
RMPointer *_pointer;
RMGameBoxes *_boxes;
RMLocation *_loc;
RMInventory *_inventory;
RMInput *_input;
RMGfxEngine *_gfxEngine;
void (*EnableGUI)();
void (*DisableGUI)();
2012-06-10 20:02:31 +00:00
uint32 _dwTonyNumTexts;
bool _bTonyInTexts;
bool _bStaticTalk;
RMTony::CharacterTalkType _nTonyNextTalkType;
2012-06-10 20:02:31 +00:00
RMPoint _startLocPos[256];
CoroutineMutex _mut[10];
2012-06-10 20:02:31 +00:00
bool _bSkipIdle;
uint32 _hSkipIdle;
2012-06-10 20:02:31 +00:00
int _lastMusic, _lastTappeto;
2012-06-20 22:20:16 +00:00
int _ambiance[200];
2012-06-18 06:03:02 +00:00
RMPoint _fullScreenMessagePt;
int _fullScreenMessageLoc;
/**
* @defgroup MPAL variables
*/
uint32 _mpalError;
LPITEMIRQFUNCTION _lpiifCustom;
LPLPCUSTOMFUNCTION _lplpFunctions;
Common::String *_lplpFunctionStrings;
uint16 _nObjs;
uint16 _nVars;
2012-08-31 22:25:35 +00:00
MpalHandle _hVars;
LpMpalVar _lpmvVars;
uint16 _nMsgs;
2012-08-31 22:25:35 +00:00
MpalHandle _hMsgs;
LpMpalMsg _lpmmMsgs;
uint16 _nDialogs;
2012-08-31 22:25:35 +00:00
MpalHandle _hDialogs;
LpMpalDialog _lpmdDialogs;
uint16 _nItems;
2012-08-31 22:25:35 +00:00
MpalHandle _hItems;
LpMpalItem _lpmiItems;
uint16 _nLocations;
2012-08-31 22:25:35 +00:00
MpalHandle _hLocations;
LpMpalLocation _lpmlLocations;
uint16 _nScripts;
2012-08-31 22:25:35 +00:00
MpalHandle _hScripts;
LpMpalScript _lpmsScripts;
Common::File _hMpr;
uint16 _nResources;
uint32 *_lpResources;
bool _bExecutingAction;
bool _bExecutingDialog;
uint32 _nPollingLocations[MAXPOLLINGLOCATIONS];
uint32 _hEndPollingLocations[MAXPOLLINGLOCATIONS];
uint32 _pollingThreads[MAXPOLLINGLOCATIONS];
uint32 _hAskChoice;
uint32 _hDoneChoice;
uint32 _nExecutingAction;
uint32 _nExecutingDialog;
uint32 _nExecutingChoice;
uint32 _nSelectedChoice;
};
} // End of namespace Tony
#endif // TONY_GLOBALS