aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/avalanche/trip6.cpp94
-rw-r--r--engines/avalanche/trip6.h6
2 files changed, 94 insertions, 6 deletions
diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp
index 7fe643c9da..f5faa5b77c 100644
--- a/engines/avalanche/trip6.cpp
+++ b/engines/avalanche/trip6.cpp
@@ -41,6 +41,7 @@
#include "common/scummsys.h"
#include "common/textconsole.h"
+#include "common/file.h"
/*#include "Dropdown.h"*/
@@ -48,10 +49,97 @@
namespace Avalanche {
-triptype *triptype::init(byte spritenum, bool do_check, Trip *tr) {
- warning("STUB: Trip::init()");
+void triptype::init(byte spritenum, bool do_check, Trip *tr) {
+ const int32 idshould = -1317732048;
+ int16 gd, gm;
+ byte fv/*,nds*/;
+ int32 id;
+ uint16 soa;
+ Common::File inf;
+
+ if (spritenum == 177)
+ return; /* Already running! */
+
+ Common::String filename;
+ filename = filename.format("sprite%d.avd", spritenum);
+ if (!inf.open(filename)) {
+ warning("AVALANCHE: Trip: File not found: %s", filename.c_str());
+ return;
+ }
+
+ inf.seek(177);
+
+ id = inf.readSint32LE();
+ if (id != idshould) {
+ //output << '\7';
+ inf.close();
+ return;
+ }
+
+ soa = inf.readUint16LE(); // Only used in the original code.
+ // I use it just to jump forward in the file. Should be replaced with seek().
+
+ byte size = inf.readByte(); // Same purpose as soa.
+ for (byte i = 0; i < 12; i++) {
+ byte be = inf.readByte();
+ a.name += be;
+ }
+
+ size = inf.readByte(); // Same purpose as soa.
+ for (byte i = 0; i < 16; i++) {
+ byte be = inf.readByte();
+ a.comment += be;
+ }
+
+ a.num = inf.readByte();
+ a.xl = inf.readByte();
+ a.yl = inf.readByte();
+ a.seq = inf.readByte();
+ a.size = inf.readUint16LE();
+ a.fgc = inf.readByte();
+ a.bgc = inf.readByte();
+ a.accinum = inf.readByte();
+
+ totalnum = 0; // = 1;
+ xw = a.xl / 8;
+ if ((a.xl % 8) > 0)
+ xw++;
+ for (byte aa = 0; aa < /*nds*seq*/a.num; aa++) {
+
+ sil[totalnum] = new siltype[11 * (a.yl + 1)];
+ //getmem(sil[totalnum-1], 11 * (a.yl + 1));
+ mani[totalnum] = new manitype[a.size - 6];
+ //getmem(mani[totalnum-1], a.size - 6);
+ for (fv = 0; fv <= a.yl; fv ++)
+ inf.read((*sil[totalnum])[fv], xw);
+ //blockread(inf, (*sil[totalnum-1])[fv], xw);
+ inf.read(*mani[totalnum], a.size - 6);
+ //blockread(inf, *mani[totalnum-1], a.size - 6);
+
+ totalnum ++;
+ }
+
+ /* on; */
+ x = 0;
+ y = 0;
+ quick = true;
+ visible = false;
+ xs = 3;
+ ys = 1;
+ /* if spritenum=1 then newspeed; { Just for the lights. }*/
+
+ homing = false;
+ ix = 0;
+ iy = 0;
+ step = 0;
+ check_me = do_check;
+ count = 0;
+ whichsprite = spritenum;
+ vanishifstill = false;
+ call_eachstep = false;
+ inf.close();
+
_tr = tr;
- return this;
}
void triptype::original() {
diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h
index 954b870f1b..1c45037508 100644
--- a/engines/avalanche/trip6.h
+++ b/engines/avalanche/trip6.h
@@ -44,8 +44,8 @@ typedef byte manitype[2049]; // manitype = array[5..2053] of byte;
typedef byte siltype[51][11]; /* 35, 4 */
struct adxtype { /* Second revision of ADX type */
- Common::String name; /* name of character */
- Common::String comment; /* comment */
+ Common::String name/*[13]*/; /* name of character */ // uruk: Note to self: TRAILING /0 !!! Real size: 12
+ Common::String comment/*[17]*/; /* comment */ // uruk: Same here, but 16.
byte num; /* number of pictures */
byte xl, yl; /* x & y lengths of pictures */
byte seq; /* how many in one stride */
@@ -99,7 +99,7 @@ public:
bool call_eachstep; /* Do we call the eachstep procedure? */
byte eachstep;
- triptype *init(byte spritenum, bool do_check, Trip *tr);
+ void init(byte spritenum, bool do_check, Trip *tr);
/* loads & sets up the sprite */
void original(); /* just sets Quick to false */
void andexor(); /* drops sprite onto screen */