[Scummvm-cvs-logs] CVS: scummvm/scumm util.cpp,1.1,2.1 util.h,1.1,2.1 module.mk,1.44,1.45 resource.cpp,1.286,1.287 scumm.cpp,1.283,1.284 scumm.h,1.521,1.522 sound.cpp,1.405,1.406
Max Horn
fingolfin at users.sourceforge.net
Fri Dec 17 14:28:02 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.37,1.38 actor.h,1.17,1.18 actordata.cpp,1.7,1.8 actordata.h,1.8,1.9 console.cpp,1.19,1.20 console.h,1.6,1.7 interface.cpp,1.37,1.38 sfuncs.cpp,1.45,1.46 sthread.cpp,1.41,1.42
- Next message: [Scummvm-cvs-logs] CVS: web/docs release.xml,1.96,1.97
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25439
Modified Files:
module.mk resource.cpp scumm.cpp scumm.h sound.cpp
Added Files:
util.cpp util.h
Log Message:
Reduce code size of resource.cpp to help PalmOS port, by moving util code to a new file util.cpp and sound resource code to sound.cpp
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- module.mk 27 Nov 2004 17:50:22 -0000 1.44
+++ module.mk 17 Dec 2004 22:27:08 -0000 1.45
@@ -49,6 +49,7 @@
scumm/sound.o \
scumm/string.o \
scumm/usage_bits.o \
+ scumm/util.o \
scumm/vars.o \
scumm/verbs.o \
scumm/wiz_he.o \
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.286
retrieving revision 1.287
diff -u -d -r1.286 -r1.287
--- resource.cpp 27 Nov 2004 13:10:41 -0000 1.286
+++ resource.cpp 17 Dec 2004 22:27:08 -0000 1.287
@@ -38,165 +38,6 @@
static const char *resTypeFromId(int id);
-
-ScummFile::ScummFile() : _encbyte(0), _subFileStart(0), _subFileLen(0) {
-}
-
-void ScummFile::setEnc(byte value) {
- _encbyte = value;
-}
-
[...1173 lines suppressed...]
- if (_features & GF_OLD_BUNDLE) {
- _fileHandle.seek(wa_offs, SEEK_SET);
- _fileHandle.read(createResource(type, idx, wa_size), wa_size);
- } else {
- _fileHandle.seek(wa_offs - 6, SEEK_SET);
- _fileHandle.read(createResource(type, idx, wa_size + 6), wa_size + 6);
- }
- return 1;
- } else if (ro_offs != 0) {
- _fileHandle.seek(ro_offs - 2, SEEK_SET);
- _fileHandle.read(createResource(type, idx, ro_size - 4), ro_size - 4);
- return 1;
- }
- res.roomoffs[type][idx] = 0xFFFFFFFF;
- return 0;
-}
-
int ScummEngine::getResourceRoomNr(int type, int idx) {
if (type == rtRoom && _heversion < 70)
return idx;
Index: scumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.cpp,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -d -r1.283 -r1.284
--- scumm.cpp 9 Dec 2004 15:06:44 -0000 1.283
+++ scumm.cpp 17 Dec 2004 22:27:14 -0000 1.284
@@ -2545,91 +2545,6 @@
}
}
-#pragma mark -
-#pragma mark --- Utilities ---
-#pragma mark -
-
-void checkRange(int max, int min, int no, const char *str) {
- if (no < min || no > max) {
- char buf[256];
- snprintf(buf, sizeof(buf), str, no);
- error("Value %d is out of bounds (%d,%d) (%s)", no, min, max, buf);
- }
-}
-
-/**
- * Convert an old style direction to a new style one (angle),
- */
-int newDirToOldDir(int dir) {
- if (dir >= 71 && dir <= 109)
- return 1;
- if (dir >= 109 && dir <= 251)
- return 2;
- if (dir >= 251 && dir <= 289)
- return 0;
- return 3;
-}
-
-/**
- * Convert an new style (angle) direction to an old style one.
- */
-int oldDirToNewDir(int dir) {
- assert(0 <= dir && dir <= 3);
- const int new_dir_table[4] = { 270, 90, 180, 0 };
- return new_dir_table[dir];
-}
-
-/**
- * Convert an angle to a simple direction.
- */
-int toSimpleDir(int dirType, int dir) {
- if (dirType) {
- const int16 directions[] = { 22, 72, 107, 157, 202, 252, 287, 337 };
- for (int i = 0; i < 7; i++)
- if (dir >= directions[i] && dir <= directions[i+1])
- return i+1;
- } else {
- const int16 directions[] = { 71, 109, 251, 289 };
- for (int i = 0; i < 3; i++)
- if (dir >= directions[i] && dir <= directions[i+1])
- return i+1;
- }
-
- return 0;
-}
-
-/**
- * Convert a simple direction to an angle.
- */
-int fromSimpleDir(int dirType, int dir) {
- if (dirType)
- return dir * 45;
- else
- return dir * 90;
-}
-
-/**
- * Normalize the given angle - that means, ensure it is positive, and
- * change it to the closest multiple of 45 degree by abusing toSimpleDir.
- */
-int normalizeAngle(int angle) {
- int temp;
-
- temp = (angle + 360) % 360;
-
- return toSimpleDir(1, temp) * 45;
-}
-
-const char *tag2str(uint32 tag) {
- static char str[5];
- str[0] = (char)(tag >> 24);
- str[1] = (char)(tag >> 16);
- str[2] = (char)(tag >> 8);
- str[3] = (char)tag;
- str[4] = '\0';
- return str;
-}
-
} // End of namespace Scumm
using namespace Scumm;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.521
retrieving revision 1.522
diff -u -d -r1.521 -r1.522
--- scumm.h 28 Nov 2004 21:24:01 -0000 1.521
+++ scumm.h 17 Dec 2004 22:27:14 -0000 1.522
@@ -31,6 +31,7 @@
#include "scumm/gfx.h"
#include "scumm/script.h"
+#include "scumm/util.h"
#include "scumm/wiz_he.h"
namespace GUI {
@@ -61,29 +62,6 @@
typedef Common::Map<Common::String, int> ObjectIDMap;
-class ScummFile : public File {
-private:
- byte _encbyte;
- uint32 _subFileStart;
- uint32 _subFileLen;
-public:
- ScummFile();
- void setEnc(byte value);
-
- void setSubfileRange(uint32 start, uint32 len);
- void resetSubfile();
-
- bool open(const char *filename, AccessMode mode = kFileReadMode);
- bool openSubFile(const char *filename);
-
- bool eof();
- uint32 pos();
- uint32 size();
- void seek(int32 offs, int whence = SEEK_SET);
- uint32 read(void *ptr, uint32 size);
- uint32 write(const void *ptr, uint32 size);
-};
-
// Use g_scumm from error() ONLY
extern ScummEngine *g_scumm;
@@ -1333,21 +1311,6 @@
byte VAR_WIZ_TCOLOR;
};
-// This is a constant lookup table of reverse bit masks
-extern const byte revBitMask[8];
-
-/* Direction conversion functions (between old dir and new dir format) */
-int newDirToOldDir(int dir);
-int oldDirToNewDir(int dir);
-
-int normalizeAngle(int angle);
-int fromSimpleDir(int dirtype, int dir);
-int toSimpleDir(int dirtype, int dir);
-
-void checkRange(int max, int min, int no, const char *str);
-
-const char *tag2str(uint32 tag);
-
} // End of namespace Scumm
#endif
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.405
retrieving revision 1.406
diff -u -d -r1.405 -r1.406
--- sound.cpp 11 Dec 2004 23:34:34 -0000 1.405
+++ sound.cpp 17 Dec 2004 22:27:15 -0000 1.406
@@ -1195,4 +1195,1050 @@
return soundEntries;
}
+
+#pragma mark -
+#pragma mark --- Sound resource handling ---
+#pragma mark -
+
+/*
+ * TODO: The way we handle sound/music resources really is one huge hack.
+ * We probably should reconsider how we do this, and maybe come up with a
[...1019 lines suppressed...]
+ } else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && wa_offs != 0) {
+ if (_features & GF_OLD_BUNDLE) {
+ _fileHandle.seek(wa_offs, SEEK_SET);
+ _fileHandle.read(createResource(type, idx, wa_size), wa_size);
+ } else {
+ _fileHandle.seek(wa_offs - 6, SEEK_SET);
+ _fileHandle.read(createResource(type, idx, wa_size + 6), wa_size + 6);
+ }
+ return 1;
+ } else if (ro_offs != 0) {
+ _fileHandle.seek(ro_offs - 2, SEEK_SET);
+ _fileHandle.read(createResource(type, idx, ro_size - 4), ro_size - 4);
+ return 1;
+ }
+ res.roomoffs[type][idx] = 0xFFFFFFFF;
+ return 0;
+}
+
+
} // End of namespace Scumm
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.37,1.38 actor.h,1.17,1.18 actordata.cpp,1.7,1.8 actordata.h,1.8,1.9 console.cpp,1.19,1.20 console.h,1.6,1.7 interface.cpp,1.37,1.38 sfuncs.cpp,1.45,1.46 sthread.cpp,1.41,1.42
- Next message: [Scummvm-cvs-logs] CVS: web/docs release.xml,1.96,1.97
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list