aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-07-16 21:03:14 +0000
committerMax Horn2002-07-16 21:03:14 +0000
commit0843a2510c579f5dcc0770ca4ce28f05a881d80a (patch)
treeede01066a4f0dcf24291273945d881f4401152b4
parent32e81beb4567d6d8b58fa583558082e8b42ccb42 (diff)
downloadscummvm-rg350-0843a2510c579f5dcc0770ca4ce28f05a881d80a.tar.gz
scummvm-rg350-0843a2510c579f5dcc0770ca4ce28f05a881d80a.tar.bz2
scummvm-rg350-0843a2510c579f5dcc0770ca4ce28f05a881d80a.zip
biiig checkin: removed more stuff from scumm.h; added new headers resource.h and object.h
svn-id: r4579
-rw-r--r--actor.cpp1
-rw-r--r--config-file.cpp16
-rw-r--r--debug.cpp4
-rw-r--r--gameDetector.cpp8
-rw-r--r--gfx.cpp3
-rw-r--r--init.cpp2
-rw-r--r--insane.cpp2
-rw-r--r--object.cpp4
-rw-r--r--object.h122
-rw-r--r--readme.txt2
-rw-r--r--resource.cpp6
-rw-r--r--resource.h58
-rw-r--r--saveload.cpp3
-rw-r--r--saveload.h10
-rw-r--r--script.cpp9
-rw-r--r--script_v2.cpp3
-rw-r--r--scumm.h151
-rw-r--r--scummvm.cpp16
-rw-r--r--sys.cpp24
-rw-r--r--v3/resource_v3.cpp25
-rw-r--r--verbs.cpp2
21 files changed, 266 insertions, 205 deletions
diff --git a/actor.cpp b/actor.cpp
index 742b9a8269..ae59b754c3 100644
--- a/actor.cpp
+++ b/actor.cpp
@@ -25,6 +25,7 @@
#include "actor.h"
#include "akos.h"
#include "costume.h"
+#include "resource.h"
#include <math.h>
diff --git a/config-file.cpp b/config-file.cpp
index 87304318b3..68c787b41b 100644
--- a/config-file.cpp
+++ b/config-file.cpp
@@ -68,7 +68,7 @@ private:
int nkeys;
};
-hashconfig::hashconfig (const char *dom):domain(dom ? Scumm::Strdup(dom) : 0),
+hashconfig::hashconfig (const char *dom):domain(dom ? strdup(dom) : 0),
keys(0), values(0), nkeys(0)
{
}
@@ -102,15 +102,15 @@ const char *hashconfig::set(const char *key, const char *value)
for (i = 0; i < nkeys; i++) {
if (!strcmp(key, keys[i])) {
xfree(values[i]);
- return values[i] = value ? Scumm::Strdup(value) : 0;
+ return values[i] = value ? strdup(value) : 0;
}
}
nkeys++;
keys = (char **)realloc(keys, nkeys * sizeof(char *));
values = (char **)realloc(values, nkeys * sizeof(char *));
- keys[nkeys - 1] = Scumm::Strdup(key);
- return values[nkeys - 1] = value ? Scumm::Strdup(value) : 0;
+ keys[nkeys - 1] = strdup(key);
+ return values[nkeys - 1] = value ? strdup(value) : 0;
}
const char *hashconfig::getdomain() const
@@ -138,7 +138,7 @@ void hashconfig::flush(FILE *cfg_file) const
void hashconfig::rename(const char *d)
{
xfree(domain);
- domain = d ? Scumm::Strdup(d) : 0;
+ domain = d ? strdup(d) : 0;
}
void hashconfig::merge(const hashconfig *h)
@@ -153,7 +153,7 @@ void hashconfig::merge(const hashconfig *h)
// The config-class itself.
Config::Config (const char *cfg, const char *d)
-: filename(Scumm::Strdup(cfg)), domain(d ? Scumm::Strdup(d) : 0), hash(0), ndomains(0), willwrite(false)
+: filename(strdup(cfg)), domain(d ? strdup(d) : 0), hash(0), ndomains(0), willwrite(false)
{
FILE *cfg_file;
char t[MAXLINELEN];
@@ -279,7 +279,7 @@ void Config::set_domain(const char *d)
{
int i;
xfree(domain);
- domain = d ? Scumm::Strdup(d) : 0;
+ domain = d ? strdup(d) : 0;
for (i = 0; i < ndomains; i++) {
if (hash[i]->is_domain(domain))
@@ -346,7 +346,7 @@ void Config::delete_domain(const char *d)
void Config::change_filename(const char *f)
{
xfree(filename);
- filename = f ? Scumm::Strdup(f) : 0;
+ filename = f ? strdup(f) : 0;
}
void Config::merge_config(const Config *c)
diff --git a/debug.cpp b/debug.cpp
index 10ac0dfc26..4fe0d6560c 100644
--- a/debug.cpp
+++ b/debug.cpp
@@ -102,7 +102,7 @@ bool ScummDebugger::do_command()
printf("Current room: %d [%d]\n", _s->_currentRoom, _s->_roomResource);
} else {
int room = atoi(_parameters);
- _s->actor[_s->_vars[_s->VAR_EGO]].room = room;
+ _s->_actors[_s->_vars[_s->VAR_EGO]].room = room;
_s->startScene(room, 0, 0);
_s->_fullRedraw = 1;
}
@@ -286,7 +286,7 @@ void ScummDebugger::printActors(int act)
printf("+--+----+--------+----+---+-----+---+---+--+-----+-----+---+---+\n");
for (i = 1; i < _s->NUM_ACTORS; i++) {
if (act == -1 || act == i) {
- a = &_s->actor[i];
+ a = &_s->_actors[i];
if (a->visible)
printf("|%2d|%4d|%3d %3d|%4d|%3d|%5d|%3d|%3d|%2d|%5d|%5d|%3d|%3d|\n",
i, a->room, a->x, a->y, a->elevation, a->costume, a->width,
diff --git a/gameDetector.cpp b/gameDetector.cpp
index 2536814a0e..691a1eb592 100644
--- a/gameDetector.cpp
+++ b/gameDetector.cpp
@@ -109,7 +109,7 @@ void GameDetector::updateconfig()
_noSubtitles = false;
if ((val = scummcfg->get("path")))
- _gameDataPath = Scumm::Strdup(val);
+ _gameDataPath = strdup(val);
if ((val = scummcfg->get("sfx_volume")))
_sfx_volume = atoi(val);
@@ -459,9 +459,9 @@ char *GameDetector::getGameName()
if (_gameText == NULL) {
char buf[256];
sprintf(buf, "Unknown game: \"%s\"", _exe_name);
- return Scumm::Strdup(buf);
+ return strdup(buf);
}
- return Scumm::Strdup(_gameText);
+ return strdup(_gameText);
}
int GameDetector::detectMain(int argc, char **argv)
@@ -541,7 +541,7 @@ int GameDetector::detectMain(int argc, char **argv)
if (!_gameDataPath) {
warning("No path was provided. Assuming the data files are in the current directory");
- _gameDataPath = Scumm::Strdup("");
+ _gameDataPath = strdup("");
} else if (_gameDataPath[strlen(_gameDataPath)-1] != '/'
#ifdef __MORPHOS__
&& _gameDataPath[strlen(_gameDataPath)-1] != ':'
diff --git a/gfx.cpp b/gfx.cpp
index a25cebaec0..962a570d8e 100644
--- a/gfx.cpp
+++ b/gfx.cpp
@@ -21,8 +21,9 @@
#include "stdafx.h"
#include "scumm.h"
-#include "gui.h"
#include "actor.h"
+#include "gui.h"
+#include "resource.h"
void Scumm::getGraphicsPerformance()
{
diff --git a/init.cpp b/init.cpp
index 79db4c4382..1f51baf3fe 100644
--- a/init.cpp
+++ b/init.cpp
@@ -30,6 +30,6 @@ Scumm::Scumm (void) {
}
Scumm::~Scumm (void) {
- delete [] actor;
+ delete [] _actors;
delete _newgui;
} \ No newline at end of file
diff --git a/insane.cpp b/insane.cpp
index 664f999064..4e82e86a7f 100644
--- a/insane.cpp
+++ b/insane.cpp
@@ -23,9 +23,9 @@
#define NEED_SDL_HEADERS
#endif
-
#include "stdafx.h"
#include "scumm.h"
+#include "smush.h"
//#define SWAP2(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000))
#define MAX_STREAMER 10
diff --git a/object.cpp b/object.cpp
index 2b968dd71b..f27cf9be78 100644
--- a/object.cpp
+++ b/object.cpp
@@ -23,6 +23,8 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "object.h"
+#include "resource.h"
bool Scumm::getClass(int obj, int cls)
{
@@ -807,7 +809,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint
if (findWhat & foCheckAlreadyLoaded && getObjectIndex(id) != -1) {
fo->obcd = obcdptr = getOBCDFromObject(id);
assert((byte *)obcdptr > (byte *)256);
- fo->obim = obimptr = obcdptr + READ_BE_UINT32_UNALIGNED(&((ResHdr *)obcdptr)->size);
+ fo->obim = obimptr = obcdptr + RES_SIZE(obcdptr);
fo->cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), obcdptr);
fo->imhd = (ImageHeader *)findResourceData(MKID('IMHD'), obimptr);
return;
diff --git a/object.h b/object.h
new file mode 100644
index 0000000000..39787ca0a3
--- /dev/null
+++ b/object.h
@@ -0,0 +1,122 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2002 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ */
+
+#ifndef OBJECT_H
+#define OBJECT_H
+
+#if !defined(__GNUC__)
+ #pragma START_PACK_STRUCTS
+#endif
+
+struct RoomHeader {
+ union {
+ struct {
+ uint32 version;
+ uint16 width, height;
+ uint16 numObjects;
+ } GCC_PACK v7;
+ struct {
+ uint16 width, height;
+ uint16 numObjects;
+ } GCC_PACK old;
+ } GCC_PACK;
+} GCC_PACK;
+
+struct CodeHeader {
+ union {
+ struct {
+ uint16 obj_id;
+ byte x, y, w, h;
+ byte flags;
+ byte parent;
+ int16 walk_x;
+ int16 walk_y;
+ byte actordir;
+ } GCC_PACK v5;
+
+ struct {
+ uint16 obj_id;
+ int16 x, y;
+ uint16 w, h;
+ byte flags, parent;
+ uint16 unk1;
+ uint16 unk2;
+ byte actordir;
+ } GCC_PACK v6;
+
+ struct {
+ uint32 version;
+ uint16 obj_id;
+ byte parent;
+ byte parentstate;
+ } GCC_PACK v7;
+
+ } GCC_PACK;
+} GCC_PACK;
+
+struct ImageHeader { /* file format */
+ union {
+ struct {
+ uint16 obj_id;
+ uint16 unk[5];
+ uint16 width;
+ uint16 height;
+ uint16 unk_2;
+ struct {
+ int16 x, y;
+ } GCC_PACK hotspot[15];
+ } GCC_PACK old;
+
+ struct {
+ uint32 version;
+ uint16 obj_id;
+ uint16 unk[1];
+ int16 x_pos, y_pos;
+ uint16 width, height;
+ byte unk2[3];
+ byte actordir;
+ uint16 unk_2;
+ struct {
+ int16 x, y;
+ } GCC_PACK hotspot[15];
+ } GCC_PACK v7;
+ } GCC_PACK;
+} GCC_PACK;
+
+#if !defined(__GNUC__)
+ #pragma END_PACK_STRUCTS
+#endif
+
+struct FindObjectInRoom {
+ CodeHeader *cdhd;
+ byte *obcd;
+ ImageHeader *imhd;
+ byte *obim;
+ byte *roomptr;
+};
+
+enum FindObjectWhat {
+ foCodeHeader = 1,
+ foImageHeader = 2,
+ foCheckAlreadyLoaded = 4
+};
+
+
+#endif
diff --git a/readme.txt b/readme.txt
index 12ce042591..5642fec020 100644
--- a/readme.txt
+++ b/readme.txt
@@ -482,7 +482,7 @@ An example config file is as follows:
[scummvm]
gfx_mode=supereagle
fullscreen=true
- savepath=C:\saves\
+ savepath=C:\saves\
[tentacle]
path=C:\tentacle\
diff --git a/resource.cpp b/resource.cpp
index ce59f4a777..61ebc58170 100644
--- a/resource.cpp
+++ b/resource.cpp
@@ -22,8 +22,14 @@
#include "stdafx.h"
#include "scumm.h"
+#include "resource.h"
+
#include <stdio.h>
+
+uint16 newTag2Old(uint32 oldTag);
+
+
/* Open a room */
void Scumm::openRoom(int room)
{
diff --git a/resource.h b/resource.h
new file mode 100644
index 0000000000..0628189cb2
--- /dev/null
+++ b/resource.h
@@ -0,0 +1,58 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2002 The ScummVM project
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ */
+
+#ifndef RESOURCE_H
+#define RESOURCE_H
+
+#if !defined(__GNUC__)
+ #pragma START_PACK_STRUCTS
+#endif
+
+struct ResHdr {
+ uint32 tag, size;
+} GCC_PACK;
+
+#if !defined(__GNUC__)
+ #pragma END_PACK_STRUCTS
+#endif
+
+#define RES_DATA(x) (((byte*)x) + sizeof(ResHdr))
+#define RES_SIZE(x) (READ_BE_UINT32_UNALIGNED(&((ResHdr* )x)->size))
+
+enum {
+ OF_OWNER_MASK = 0x0F,
+ OF_STATE_MASK = 0xF0,
+
+ OF_STATE_SHL = 4
+};
+
+enum {
+ RF_LOCK = 0x80,
+ RF_USAGE = 0x7F,
+ RF_USAGE_MAX = RF_USAGE
+};
+
+
+byte *findResource(uint32 tag, byte *searchin, int index);
+byte *findResourceSmall(uint32 tag, byte *searchin, int index);
+byte *findResource(uint32 tag, byte *searchin);
+byte *findResourceSmall(uint32 tag, byte *searchin);
+
+#endif
diff --git a/saveload.cpp b/saveload.cpp
index 9d93e97b70..a000c01659 100644
--- a/saveload.cpp
+++ b/saveload.cpp
@@ -26,6 +26,7 @@
#include "sound/imuse.h"
#include "actor.h"
#include "config-file.h"
+#include "resource.h"
#include "saveload.h"
struct SaveGameHeader {
@@ -622,7 +623,7 @@ void Scumm::saveOrLoad(Serializer *s)
else
s->saveLoadEntries(this, mainEntriesV8);
- s->saveLoadArrayOf(actor, NUM_ACTORS, sizeof(actor[0]), actorEntries);
+ s->saveLoadArrayOf(_actors, NUM_ACTORS, sizeof(_actors[0]), actorEntries);
if (_current_version < VER_V9)
s->saveLoadArrayOf(vm.slot, 25, sizeof(vm.slot[0]), scriptSlotEntries);
diff --git a/saveload.h b/saveload.h
index 70253734ac..8b715de3f6 100644
--- a/saveload.h
+++ b/saveload.h
@@ -22,6 +22,16 @@
#ifndef SAVELOAD_H
#define SAVELOAD_H
+enum {
+ sleByte = 1,
+ sleUint8 = 1,
+ sleInt8 = 1,
+ sleInt16 = 2,
+ sleUint16 = 3,
+ sleInt32 = 4,
+ sleUint32 = 5
+};
+
struct SaveLoadEntry {
uint32 offs;
uint8 type;
diff --git a/script.cpp b/script.cpp
index 9b33a1cd63..8afbbd4135 100644
--- a/script.cpp
+++ b/script.cpp
@@ -23,6 +23,15 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "resource.h"
+
+/* Script status type (slot.status) */
+enum {
+ ssDead = 0,
+ ssPaused = 1,
+ ssRunning = 2
+};
+
/* Start executing script 'script' with parameters 'a' and 'b' */
void Scumm::runScript(int script, int a, int b, int16 *lvarptr)
diff --git a/script_v2.cpp b/script_v2.cpp
index 59e548828a..784535092c 100644
--- a/script_v2.cpp
+++ b/script_v2.cpp
@@ -24,6 +24,7 @@
#include "stdafx.h"
#include "scumm.h"
#include "actor.h"
+#include "smush.h"
#include "sound/mididrv.h"
#include "sound/imuse.h"
@@ -1398,7 +1399,7 @@ void Scumm::o6_putActorInRoom()
void Scumm::o6_putActorAtObject()
{
- int room, obj, x, y, dir;
+ int room, obj, x, y;
Actor *a;
obj = popRoomAndObj(&room);
diff --git a/scumm.h b/scumm.h
index a9c4bd791d..f00fd51859 100644
--- a/scumm.h
+++ b/scumm.h
@@ -41,6 +41,7 @@ class IMuse;
class Actor;
struct ScummDebugger;
struct Serializer;
+struct FindObjectInRoom;
typedef void (Scumm::*OpcodeProc)();
@@ -66,13 +67,6 @@ enum {
KEY_SET_OPTIONS = 3456 // WinCE
};
-/* Script status type (slot.status) */
-enum {
- ssDead = 0,
- ssPaused = 1,
- ssRunning = 2
-};
-
struct ScummPoint {
int x, y;
};
@@ -81,97 +75,6 @@ struct MemBlkHeader {
uint32 size;
};
-#if !defined(__GNUC__)
- #pragma START_PACK_STRUCTS
-#endif
-
-struct ResHdr {
- uint32 tag, size;
-} GCC_PACK;
-
-#define RES_DATA(x) (((byte*)x) + sizeof(ResHdr))
-#define RES_SIZE(x) ( READ_BE_UINT32_UNALIGNED(&((ResHdr*)x)->size) )
-
-
-struct RoomHeader {
- union {
- struct {
- uint32 version;
- uint16 width, height;
- uint16 numObjects;
- } GCC_PACK v7;
- struct {
- uint16 width, height;
- uint16 numObjects;
- } GCC_PACK old;
- } GCC_PACK;
-} GCC_PACK;
-
-struct CodeHeader {
- union {
- struct {
- uint16 obj_id;
- byte x, y, w, h;
- byte flags;
- byte parent;
- int16 walk_x;
- int16 walk_y;
- byte actordir;
- } GCC_PACK v5;
-
- struct {
- uint16 obj_id;
- int16 x, y;
- uint16 w, h;
- byte flags, parent;
- uint16 unk1;
- uint16 unk2;
- byte actordir;
- } GCC_PACK v6;
-
- struct {
- uint32 version;
- uint16 obj_id;
- byte parent;
- byte parentstate;
- } GCC_PACK v7;
-
- } GCC_PACK;
-} GCC_PACK;
-
-struct ImageHeader { /* file format */
- union {
- struct {
- uint16 obj_id;
- uint16 unk[5];
- uint16 width;
- uint16 height;
- uint16 unk_2;
- struct {
- int16 x, y;
- } GCC_PACK hotspot[15];
- } GCC_PACK old;
-
- struct {
- uint32 version;
- uint16 obj_id;
- uint16 unk[1];
- int16 x_pos, y_pos;
- uint16 width, height;
- byte unk2[3];
- byte actordir;
- uint16 unk_2;
- struct {
- int16 x, y;
- } GCC_PACK hotspot[15];
- } GCC_PACK v7;
- } GCC_PACK;
-} GCC_PACK;
-
-#if !defined(__GNUC__)
- #pragma END_PACK_STRUCTS
-#endif
-
struct VerbSlot {
int16 x, y;
int16 right, bottom;
@@ -221,16 +124,6 @@ struct NestedScript {
uint8 slot;
};
-enum {
- sleByte = 1,
- sleUint8 = 1,
- sleInt8 = 1,
- sleInt16 = 2,
- sleUint16 = 3,
- sleInt32 = 4,
- sleUint32 = 5
-};
-
enum ResTypes {
rtFirst = 1,
rtRoom = 1,
@@ -263,25 +156,12 @@ enum {
};
enum {
- OF_OWNER_MASK = 0x0F,
- OF_STATE_MASK = 0xF0,
-
- OF_STATE_SHL = 4
-};
-
-enum {
MBS_LEFT_CLICK = 0x8000,
MBS_RIGHT_CLICK = 0x4000,
MBS_MOUSE_MASK = (MBS_LEFT_CLICK | MBS_RIGHT_CLICK),
MBS_MAX_KEY = 0x0200
};
-enum {
- RF_LOCK = 0x80,
- RF_USAGE = 0x7F,
- RF_USAGE_MAX = RF_USAGE
-};
-
#define _maxRooms res.num[rtRoom]
#define _maxScripts res.num[rtScript]
#define _maxCostumes res.num[rtCostume]
@@ -443,7 +323,6 @@ enum MouseButtonStatus {
#include "gfx.h"
#include "boxes.h"
-#include "smush.h"
class Scumm {
public:
@@ -540,7 +419,7 @@ public:
/* Core class/array definitions */
Gdi gdi;
- Actor *actor; // Has MAX_ACTORS elements, see init.cpp
+ Actor *_actors; // Has MAX_ACTORS elements, see init.cpp
uint16 *_inventory;
byte *_arrays;
@@ -750,19 +629,6 @@ public:
/* Should be in Object class */
byte OF_OWNER_ROOM;
- struct FindObjectInRoom {
- CodeHeader *cdhd;
- byte *obcd;
- ImageHeader *imhd;
- byte *obim;
- byte *roomptr;
- };
-
- enum FindObjectWhat {
- foCodeHeader = 1,
- foImageHeader = 2,
- foCheckAlreadyLoaded = 4
- };
int getInventorySlot();
void SamInventoryHack(int obj); // FIXME: Sam and Max hack
int findInventory(int owner, int index);
@@ -918,7 +784,7 @@ public:
/* Should be in Actor class */
Actor *derefActor(int id);
Actor *derefActorSafe(int id, const char *errmsg);
- Actor *getFirstActor() {return actor;}
+ Actor *getFirstActor() { return _actors; }
void putActor(Actor *a, int x, int y, byte room);
void showActors();
@@ -1186,8 +1052,6 @@ public:
uint fileReadWordLE(void *handle);
uint fileReadWordBE(void *handle);
- static char *Strdup(const char *);
-
/* Version 5 script opcodes */
void o5_actorFollowCamera();
void o5_actorFromPos();
@@ -1621,11 +1485,8 @@ struct ScummDebugger {
void printScripts();
};
-extern const uint32 IMxx_tags[];
-extern const byte default_scale_table[768];
extern uint16 _debugLevel;
-void outputdisplay2(Scumm *s, int disp);
extern const byte revBitMask[8];
//void blitToScreen(Scumm *s, byte *src, int x, int y, int w, int h);
@@ -1639,11 +1500,5 @@ void CDECL warning(const char *s, ...);
void CDECL debug(int level, const char *s, ...);
void checkHeap();
void blit(byte *dst, byte *src, int w, int h);
-byte *findResource(uint32 tag, byte *searchin, int index);
-byte *findResourceSmall(uint32 tag, byte *searchin, int index);
-byte *findResource(uint32 tag, byte *searchin);
-byte *findResourceSmall(uint32 tag, byte *searchin);
-void setWindowName(Scumm *s);
-uint16 newTag2Old(uint32 oldTag);
#endif
diff --git a/scummvm.cpp b/scummvm.cpp
index 486078fc83..fe0eed7281 100644
--- a/scummvm.cpp
+++ b/scummvm.cpp
@@ -24,11 +24,13 @@
#include "scumm.h"
#include "sound/mididrv.h"
#include "sound/imuse.h"
+#include "actor.h"
+#include "gameDetector.h"
#include "gui.h"
+#include "newgui.h"
+#include "object.h"
+#include "resource.h"
#include "string.h"
-#include "gameDetector.h"
-#include "actor.h"
-#include"newgui.h"
int autosave(int interval) /* Not in class to prevent being bound */
{
@@ -78,7 +80,7 @@ void Scumm::scummInit()
setupCursor();
/* Allocate and initilise actors */
- actor = new Actor[MAX_ACTORS];
+ _actors = new Actor[MAX_ACTORS];
for (i = 1, a = getFirstActor(); ++a, i < NUM_ACTORS; i++) {
a->number = i;
a->initActorClass(this);
@@ -260,9 +262,7 @@ int Scumm::scummLoop(int delta)
_vars[VAR_MI1_TIMER] += 6;
}
}
- } else if (_features & GF_OLD256)
-
- {
+ } else if (_features & GF_OLD256) {
if(tempMusic == 3) {
tempMusic = 0;
@@ -1027,7 +1027,7 @@ void Scumm::convertKeysToClicks()
Actor *Scumm::derefActor(int id)
{
- return &actor[id];
+ return &_actors[id];
}
Actor *Scumm::derefActorSafe(int id, const char *errmsg)
diff --git a/sys.cpp b/sys.cpp
index b8ec331985..7d27ed93a8 100644
--- a/sys.cpp
+++ b/sys.cpp
@@ -201,17 +201,6 @@ uint32 Scumm::fileReadDwordBE(void *handle)
return (b << 16) | a;
}
-char *Scumm::Strdup(const char *s)
-{
- if (s) {
- int l = strlen(s) + 1;
- char *r = (char *)malloc(l);
- memcpy(r, s, l);
- return r;
- }
- return NULL;
-}
-
bool Scumm::checkFixedDisk()
{
return true;
@@ -221,11 +210,14 @@ bool Scumm::checkFixedDisk()
#ifdef NEED_STRDUP
char *strdup(const char *s)
{
- int len = strlen(s) + 1;
- char *d = (char *)malloc(len);
- if (d)
- memcpy(d, s, len);
- return d;
+ if (s) {
+ int len = strlen(s) + 1;
+ char *d = (char *)malloc(len);
+ if (d)
+ memcpy(d, s, len);
+ return d;
+ }
+ return NULL;
}
#endif /* NEED_STRDUP */
diff --git a/v3/resource_v3.cpp b/v3/resource_v3.cpp
index 88d5fe51b6..c3af1c9ef2 100644
--- a/v3/resource_v3.cpp
+++ b/v3/resource_v3.cpp
@@ -22,6 +22,7 @@
#include "stdafx.h"
#include "scumm.h"
+#include "resource.h"
void Scumm_v3::readIndexFile()
@@ -43,22 +44,22 @@ void Scumm_v3::readIndexFile()
break;
switch (blocktype) {
- case 0x4E52:
+ case 0x4E52: // 'NR'
fileReadWordLE();
break;
- case 0x5230:
+ case 0x5230: // 'R0'
_numRooms = fileReadWordLE();
break;
- case 0x5330:
+ case 0x5330: // 'S0'
_numScripts = fileReadWordLE();
break;
- case 0x4E30:
+ case 0x4E30: // 'N0'
_numSounds = fileReadWordLE();
break;
- case 0x4330:
+ case 0x4330: // 'C0'
_numCostumes = fileReadWordLE();
break;
- case 0x4F30:
+ case 0x4F30: // 'O0'
_numGlobalObjects = fileReadWordLE();
break;
}
@@ -98,27 +99,27 @@ void Scumm_v3::readIndexFile()
switch (blocktype) {
- case 0x4E52:
+ case 0x4E52: // 'NR'
fileSeek(_fileHandle, itemsize - 6, SEEK_CUR);
break;
- case 0x5230:
+ case 0x5230: // 'R0'
readResTypeList(rtRoom, MKID('ROOM'), "room");
break;
- case 0x5330:
+ case 0x5330: // 'S0'
readResTypeList(rtScript, MKID('SCRP'), "script");
break;
- case 0x4E30:
+ case 0x4E30: // 'N0'
readResTypeList(rtSound, MKID('SOUN'), "sound");
break;
- case 0x4330:
+ case 0x4330: // 'C0'
readResTypeList(rtCostume, MKID('COST'), "costume");
break;
- case 0x4F30:
+ case 0x4F30: // 'O0'
num = fileReadWordLE();
assert(num == _numGlobalObjects);
for (i = 0; i != num; i++) {
diff --git a/verbs.cpp b/verbs.cpp
index 40f2274b5d..131bde0312 100644
--- a/verbs.cpp
+++ b/verbs.cpp
@@ -22,6 +22,8 @@
#include "stdafx.h"
#include "scumm.h"
+#include "object.h"
+#include "resource.h"
void Scumm::redrawVerbs()
{