aboutsummaryrefslogtreecommitdiff
path: root/sword2/sword2.h
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-11-03 07:47:42 +0000
committerTorbjörn Andersson2003-11-03 07:47:42 +0000
commitb3b0118292df23a5d4bf0e9b32a56fb4ddfba1ea (patch)
treedf5851f12ebb885d05db421078980e122698243e /sword2/sword2.h
parent0ece8aab8b03e0aead5f18e33797ec85294bf158 (diff)
downloadscummvm-rg350-b3b0118292df23a5d4bf0e9b32a56fb4ddfba1ea.tar.gz
scummvm-rg350-b3b0118292df23a5d4bf0e9b32a56fb4ddfba1ea.tar.bz2
scummvm-rg350-b3b0118292df23a5d4bf0e9b32a56fb4ddfba1ea.zip
The resource and memory managers are now created dynamically.
Renamed the resource manager's open/close methods openResource() and closeResource() to avoid confusion. (It was I who originally shortened their names to open() and close(), but I've changed my mind now.) Moved more stuff into Sword2Engine. svn-id: r11088
Diffstat (limited to 'sword2/sword2.h')
-rw-r--r--sword2/sword2.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/sword2/sword2.h b/sword2/sword2.h
index 8d44e81f96..8abc60d0c7 100644
--- a/sword2/sword2.h
+++ b/sword2/sword2.h
@@ -28,10 +28,13 @@
#include "sword2/build_display.h"
#include "sword2/console.h"
#include "sword2/events.h"
+#include "sword2/header.h"
#include "sword2/icons.h"
#include "sword2/layers.h"
#include "sword2/mouse.h"
#include "sword2/object.h"
+#include "sword2/save_rest.h"
+#include "sword2/sound.h"
#include "sword2/driver/d_sound.h"
#include "sword2/driver/d_draw.h"
@@ -129,6 +132,14 @@ private:
void startNewPalette(void);
void processLayer(uint32 layer_number);
+ void getPlayerStructures(void);
+ void putPlayerStructures(void);
+
+ uint32 saveData(uint16 slotNo, uint8 *buffer, uint32 bufferSize);
+ uint32 restoreData(uint16 slotNo, uint8 *buffer, uint32 bufferSize);
+
+ uint32 calcChecksum(uint8 *buffer, uint32 size);
+
public:
Sword2Engine(GameDetector *detector, OSystem *syst);
~Sword2Engine();
@@ -276,6 +287,91 @@ public:
void registerMouse(Object_mouse *ob_mouse);
+ uint8 *fetchPalette(uint8 *screenFile);
+ _screenHeader *fetchScreenHeader(uint8 *screenFile);
+ _layerHeader *fetchLayerHeader(uint8 *screenFile, uint16 layerNo);
+ uint8 *fetchShadingMask(uint8 *screenFile);
+
+ _animHeader *fetchAnimHeader(uint8 *animFile);
+ _cdtEntry *fetchCdtEntry(uint8 *animFile, uint16 frameNo);
+ _frameHeader *fetchFrameHeader(uint8 *animFile, uint16 frameNo);
+ _parallax *fetchBackgroundParallaxLayer(uint8 *screenFile, int layer);
+ _parallax *fetchBackgroundLayer(uint8 *screenFile);
+ _parallax *fetchForegroundParallaxLayer(uint8 *screenFile, int layer);
+ uint8 *fetchTextLine(uint8 *file, uint32 text_line);
+ uint8 checkTextLine(uint8 *file, uint32 text_line);
+ uint8 *fetchPaletteMatchTable(uint8 *screenFile);
+ uint8 *fetchObjectName(int32 resourceId);
+
+ // savegame file header
+
+ struct _savegameHeader {
+ // sum of all bytes in file, excluding this uint32
+ uint32 checksum;
+
+ // player's description of savegame
+ char description[SAVE_DESCRIPTION_LEN];
+
+ uint32 varLength; // length of global variables resource
+ uint32 screenId; // resource id of screen file
+ uint32 runListId; // resource id of run list
+ uint32 feet_x; // copy of _thisScreen.feet_x
+ uint32 feet_y; // copy of _thisScreen.feet_y
+ uint32 music_id; // copy of 'looping_music_id'
+ _object_hub player_hub; // copy of player object's object_hub structure
+ Object_logic logic; // copy of player character logic structure
+
+ // copy of player character graphic structure
+ Object_graphic graphic;
+
+ // copy of player character mega structure
+ Object_mega mega;
+ };
+
+ _savegameHeader g_header;
+
+ uint32 saveGame(uint16 slotNo, uint8 *description);
+ uint32 restoreGame(uint16 slotNo);
+ uint32 getSaveDescription(uint16 slotNo, uint8 *description);
+ bool saveExists(uint16 slotNo);
+ void fillSaveBuffer(mem *buffer, uint32 size, uint8 *desc);
+ uint32 restoreFromBuffer(mem *buffer, uint32 size);
+ uint32 findBufferSize(void);
+
+ uint8 _scrollFraction;
+
+ void setScrolling(void);
+
+ struct _fxq_entry {
+ uint32 resource; // resource id of sample
+ uint32 fetchId; // Id of resource in PSX CD queue. :)
+ uint16 delay; // cycles to wait before playing (or 'random chance' if FX_RANDOM)
+ uint8 volume; // 0..16
+ int8 pan; // -16..16
+ uint8 type; // FX_SPOT, FX_RANDOM or FX_LOOP
+ };
+
+ _fxq_entry _fxQueue[FXQ_LENGTH];
+
+ // used to store id of tunes that loop, for save & restore
+ uint32 _loopingMusicId;
+
+ // to be called during system initialisation
+ void initFxQueue(void);
+
+ // to be called from the main loop, once per cycle
+ void processFxQueue(void);
+
+ // stops all fx & clears the queue - eg. when leaving a location
+ void clearFxQueue(void);
+
+ void pauseAllSound(void);
+ void unpauseAllSound(void);
+
+ void killMusic(void);
+
+ void triggerFx(uint8 j);
+
void errorString(const char *buf_input, char *buf_output);
void initialiseFontResourceFlags(void);
void initialiseFontResourceFlags(uint8 language);