[Scummvm-cvs-logs] CVS: scummvm/saga actionmap.cpp,1.4,1.5 actor.cpp,1.8,1.9 saga.h,1.10,1.11
Eugene Sandulenko
sev at users.sourceforge.net
Mon May 3 16:08:05 CEST 2004
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28366
Modified Files:
actionmap.cpp actor.cpp saga.h
Log Message:
Started work on moving from ys_read/write to MemoryReadStream
Index: actionmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- actionmap.cpp 1 May 2004 06:31:50 -0000 1.4
+++ actionmap.cpp 3 May 2004 23:06:57 -0000 1.5
@@ -22,7 +22,7 @@
*/
/* Action map module */
-
+#include "saga.h"
#include "reinherit.h"
#include "yslib.h"
@@ -57,16 +57,13 @@
int exit_ct;
int i, pt;
- const byte *read_p = exmap_res;
- size_t read_len = exmap_res_len;
-
assert(ActmapModule.init);
assert(exmap_res != NULL);
- (void)read_len;
+ MemoryReadStream *exmapStream = new MemoryReadStream(exmap_res, exmap_res_len);
// Load exits
- exit_ct = ys_read_s16_le(read_p, &read_p);
+ exit_ct = exmapStream->readSint16LE();
if (exit_ct < 0) {
return R_FAILURE;
}
@@ -78,12 +75,12 @@
}
for (i = 0; i < exit_ct; i++) {
- exmap_entry[i].unknown00 = ys_read_s16_le(read_p, &read_p);
- exmap_entry[i].unknown02 = ys_read_s16_le(read_p, &read_p);
- exmap_entry[i].exit_scene = ys_read_s16_le(read_p, &read_p);
- exmap_entry[i].unknown06 = ys_read_s16_le(read_p, &read_p);
+ exmap_entry[i].unknown00 = exmapStream->readSint16LE();
+ exmap_entry[i].unknown02 = exmapStream->readSint16LE();
+ exmap_entry[i].exit_scene = exmapStream->readSint16LE();
+ exmap_entry[i].unknown06 = exmapStream->readSint16LE();
- exmap_entry[i].pt_count = ys_read_s16_le(read_p, &read_p);
+ exmap_entry[i].pt_count = exmapStream->readSint16LE();
if (exmap_entry[i].pt_count < 0) {
free(exmap_entry);
return R_FAILURE;
@@ -96,8 +93,8 @@
}
for (pt = 0; pt < exmap_entry[i].pt_count; pt++) {
- exmap_pt_tbl[pt].x = ys_read_s16_le(read_p, &read_p);
- exmap_pt_tbl[pt].y = ys_read_s16_le(read_p, &read_p);
+ exmap_pt_tbl[pt].x = exmapStream->readSint16LE();
+ exmap_pt_tbl[pt].y = exmapStream->readSint16LE();
}
exmap_entry[i].pt_tbl = exmap_pt_tbl;
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- actor.cpp 2 May 2004 00:00:37 -0000 1.8
+++ actor.cpp 3 May 2004 23:06:57 -0000 1.9
@@ -654,7 +654,6 @@
int LoadActorSpriteIndex(R_ACTOR * actor, int si_rn, int *last_frame_p) {
byte *res_p;
size_t res_len;
- const byte *read_p;
int s_action_ct;
R_ACTORACTION *action_p;
int last_frame;
@@ -667,11 +666,12 @@
return R_FAILURE;
}
- read_p = res_p;
s_action_ct = res_len / 16;
R_printf(R_STDOUT, "Sprite resource contains %d sprite actions.\n", s_action_ct);
action_p = (R_ACTORACTION *)malloc(sizeof(R_ACTORACTION) * s_action_ct);
+ MemoryReadStream *resStream = new MemoryReadStream(res_p, res_len);
+
if (action_p == NULL) {
R_printf(R_STDERR, "Couldn't allocate memory for sprite actions.\n");
RSC_FreeResource(res_p);
@@ -683,8 +683,8 @@
for (i = 0; i < s_action_ct; i++) {
for (orient = 0; orient < 4; orient++) {
// Load all four orientations
- action_p[i].dir[orient].frame_index = ys_read_u16_le(read_p, &read_p);
- action_p[i].dir[orient].frame_count = ys_read_u16_le(read_p, &read_p);
+ action_p[i].dir[orient].frame_index = resStream->readUint16LE();
+ action_p[i].dir[orient].frame_count = resStream->readUint16LE();
if (action_p[i].dir[orient].frame_index > last_frame) {
last_frame = action_p[i].dir[orient].frame_index;
}
Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- saga.h 1 May 2004 19:41:47 -0000 1.10
+++ saga.h 3 May 2004 23:06:57 -0000 1.11
@@ -29,6 +29,7 @@
#include "base/engine.h"
#include "base/gameDetector.h"
#include "common/util.h"
+#include "common/stream.h"
#include <limits.h>
#include <stddef.h>
@@ -41,6 +42,8 @@
class Sound;
class Music;
+typedef Common::MemoryReadStream MemoryReadStream;
+
#define R_PBOUNDS(n,max) (((n)>=(0))&&((n)<(max)))
enum SAGAGameId {
More information about the Scummvm-git-logs
mailing list