diff --git a/devtools/tasmrecover/dreamweb/sprite.asm b/devtools/tasmrecover/dreamweb/sprite.asm index 06b06c76e39..658484db11c 100644 --- a/devtools/tasmrecover/dreamweb/sprite.asm +++ b/devtools/tasmrecover/dreamweb/sprite.asm @@ -244,7 +244,7 @@ Reelroutines db 1,44,0 ;Room number and x,y db 255 -Lenofreelrouts equ $-reelroutines +Lenofreelrouts equ 457 ; $-reelroutines Reelcalls dw gamer,sparkydrip,eden,edeninbath,sparky,smokebloke diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index 36e04a22684..b1f861d77b3 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -87,6 +87,7 @@ p = parser(skip_binary_data = [ 'speechfilename', 'speechfile', # sprite.asm + 'reelroutines', 'reelcalls', 'facelist', 'rainlocations', diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index 9a5d68436c8..6de854f452e 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -34,6 +34,9 @@ namespace DreamWeb { namespace DreamGen { + +const unsigned int kNumReelRoutines = 57; + /** * This class is one of the parent classes of DreamGenContext. Its sole purpose * is to allow us to incrementally move things out of DreamGenContext into this @@ -60,6 +63,9 @@ protected: // from vgagrafx.cpp uint8 _workspace[(0x1000 + 2) * 16]; + // from people.cpp + ReelRoutine _reelRoutines[kNumReelRoutines+1]; + public: DreamBase(DreamWeb::DreamWebEngine *en); @@ -158,6 +164,7 @@ public: void workoutFrames(); // from people.cpp + void setupInitialReelRoutines(); void updatePeople(); void madmanText(); void madman(ReelRoutine &routine); @@ -232,6 +239,8 @@ public: void showMainOps(); void showDiscOps(); void showNames(); + void loadPosition(unsigned int slot); + void savePosition(unsigned int slot, const char *descbuf); // from sound.cpp bool loadSpeech(byte type1, int idx1, byte type2, int idx2); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 6d303e62bf6..33bac8299e2 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -1773,14 +1773,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1120; + si = 663; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1136; + si = 679; _add(si, ax); ax = pop(); } @@ -1832,7 +1832,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1120); + _add(bx, 663); es.byte(bx) = 0; } @@ -1852,7 +1852,7 @@ dirroot: si = offset_rootdir; _inc(si); es = cs; - di = 1045; + di = 588; _inc(di); cx = 12; _movsb(cx, true); @@ -1954,7 +1954,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1154; + si = 697; checkpass: _lodsw(); ah = es.byte(bx); @@ -1998,7 +1998,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 1045; + di = 588; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -2128,7 +2128,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 1045+1; + di = 588+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -2210,7 +2210,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1154; + si = 697; notspace1: _lodsw(); _cmp(al, 32); @@ -2391,113 +2391,57 @@ void DreamGenContext::__start() { //0x0190: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x01a0: .... .... .... .... - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01, 0x2c, 0x00, 0x14, 0x00, 0x02, 0x00, - //0x01b0: .... .... ..,. .... - 0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x32, 0x14, 0x00, 0x18, 0x16, 0x00, 0x4a, 0x00, 0x01, 0x00, - //0x01c0: ..7. ..2. .... J... - 0x00, 0x18, 0x21, 0x0a, 0x4b, 0x00, 0x01, 0x00, 0x01, 0x01, 0x2c, 0x00, 0x1b, 0x00, 0x02, 0x00, - //0x01d0: ..!. K... ..,. .... - 0x02, 0x01, 0x2c, 0x00, 0x60, 0x00, 0x03, 0x00, 0x04, 0x01, 0x2c, 0x00, 0x76, 0x00, 0x02, 0x00, - //0x01e0: ..,. `... ..,. v... - 0x05, 0x01, 0x2c, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x00, 0x05, 0x16, 0x14, 0x35, 0x00, 0x03, 0x00, - //0x01f0: ..,. .... .... 5... - 0x00, 0x05, 0x16, 0x14, 0x28, 0x00, 0x01, 0x00, 0x02, 0x05, 0x16, 0x14, 0x32, 0x00, 0x01, 0x00, - //0x0200: .... (... .... 2... - 0x03, 0x02, 0x0b, 0x0a, 0xc0, 0x00, 0x01, 0x00, 0x00, 0x02, 0x0b, 0x0a, 0xb6, 0x00, 0x02, 0x00, - //0x0210: .... .... .... .... - 0x01, 0x08, 0x0b, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x01, 0x17, 0x00, 0x32, 0x00, 0x00, 0x03, 0x00, - //0x0220: .... .... ...2 .... - 0x00, 0x1c, 0x0b, 0x14, 0xfa, 0x00, 0x04, 0x00, 0x00, 0x17, 0x00, 0x32, 0x2b, 0x00, 0x02, 0x00, - //0x0230: .... .... ...2 +... - 0x08, 0x17, 0x0b, 0x28, 0x82, 0x00, 0x02, 0x00, 0x01, 0x17, 0x16, 0x28, 0x7a, 0x00, 0x02, 0x00, - //0x0240: ...( .... ...( z... - 0x02, 0x17, 0x16, 0x28, 0x69, 0x00, 0x02, 0x00, 0x03, 0x17, 0x16, 0x28, 0x51, 0x00, 0x02, 0x00, - //0x0250: ...( i... ...( Q... - 0x04, 0x17, 0x0b, 0x28, 0x87, 0x00, 0x02, 0x00, 0x05, 0x17, 0x16, 0x28, 0x91, 0x00, 0x02, 0x00, - //0x0260: ...( .... ...( .... - 0x06, 0x04, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0xc8, 0x00, 0x00, 0x00, - //0x0270: .... .... .-.. .... - 0x14, 0x2d, 0x16, 0x1e, 0x27, 0x00, 0x02, 0x00, 0x00, 0x2d, 0x16, 0x1e, 0x19, 0x00, 0x02, 0x00, - //0x0280: .-.. '... .-.. .... - 0x00, 0x08, 0x16, 0x28, 0x20, 0x00, 0x02, 0x00, 0x00, 0x07, 0x0b, 0x14, 0x40, 0x00, 0x02, 0x00, - //0x0290: ...( ... .... @... - 0x00, 0x16, 0x16, 0x14, 0x52, 0x00, 0x02, 0x00, 0x00, 0x1b, 0x0b, 0x1e, 0x00, 0x00, 0x02, 0x00, - //0x02a0: .... R... .... .... - 0x00, 0x14, 0x00, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x21, 0x28, 0x15, 0x00, 0x01, 0x00, - //0x02b0: .... .... ..!( .... - 0x00, 0x1d, 0x0b, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, + //0x01b0: .... .... .DRE AMWE + 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x01, 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, + //0x01c0: B.V9 9... PUBL IC + 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + //0x01d0: PUBL IC . + 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, + //0x01e0: ..BL ACKD RAGO N RY + 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, + //0x01f0: AN ... HEND + 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, + //0x0200: RIX LOUI S + 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, + //0x0210: . ..SE PTIM US + 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, + //0x0220: BE CKET T ... + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, + //0x0230: ."R + 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, + //0x0240: OOT . " + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, + //0x0250: ... ..$. + 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, + //0x0260: .... .... .... .... + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0270: .... ...D :... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0280: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0290: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, + //0x02a0: .... .... .... .... + 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x02b0: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x02c0: .... .... .... .... - 0x00, 0x19, 0x00, 0x32, 0x04, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x1e, 0x79, 0x00, 0x02, 0x00, - //0x02d0: ...2 .... .2.. y... - 0x00, 0x32, 0x16, 0x1e, 0x00, 0x00, 0x14, 0x00, 0x00, 0x34, 0x16, 0x1e, 0xc0, 0x00, 0x02, 0x00, - //0x02e0: .2.. .... .4.. .... - 0x00, 0x34, 0x16, 0x1e, 0xe9, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x68, 0x00, 0x37, 0x00, - //0x02f0: .4.. .... .2.( h.7. - 0x00, 0x35, 0x21, 0x00, 0x63, 0x00, 0x02, 0x00, 0x00, 0x32, 0x16, 0x28, 0x00, 0x00, 0x03, 0x00, - //0x0300: .5!. c... .2.( .... - 0x00, 0x32, 0x16, 0x1e, 0xa2, 0x00, 0x02, 0x00, 0x00, 0x34, 0x16, 0x1e, 0x39, 0x00, 0x02, 0x00, - //0x0310: .2.. .... .4.. 9... - 0x00, 0x34, 0x16, 0x1e, 0x00, 0x00, 0x02, 0x00, 0x00, 0x36, 0x00, 0x00, 0x48, 0x00, 0x03, 0x00, - //0x0320: .4.. .... .6.. H... - 0x00, 0x37, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, - //0x0330: .7,. .... .... .... - 0x00, 0x0e, 0x16, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x0e, 0x16, 0x00, 0x2c, 0x01, 0x01, 0x00, - //0x0340: .... .... .... ,... - 0x00, 0x0a, 0x16, 0x1e, 0xae, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x16, 0x14, 0x00, 0x00, 0x01, 0x00, - //0x0350: .... .... .... .... - 0x00, 0x0b, 0x0b, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0b, 0x0b, 0x1e, 0x00, 0x00, 0x32, 0x14, - //0x0360: .... ..2. .... ..2. - 0x00, 0x0b, 0x16, 0x14, 0x00, 0x00, 0x32, 0x14, 0x00, 0x0e, 0x21, 0x28, 0x00, 0x00, 0x32, 0x14, - //0x0370: .... ..2. ..!( ..2. - 0x00, 0xff, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x01, - //0x0380: ..DR EAMW EB.V 99.. - 0x00, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x50, 0x55, 0x42, - //0x0390: .PUB LIC PUB - 0x4c, 0x49, 0x43, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x41, 0x43, 0x4b, - //0x03a0: LIC ...B LACK - 0x44, 0x52, 0x41, 0x47, 0x4f, 0x4e, 0x20, 0x52, 0x59, 0x41, 0x4e, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03b0: DRAG ON R YAN - 0x20, 0x20, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4e, 0x44, 0x52, 0x49, 0x58, 0x20, 0x20, 0x20, 0x20, - //0x03c0: .. .HEN DRIX - 0x20, 0x4c, 0x4f, 0x55, 0x49, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x53, - //0x03d0: LOU IS ...S - 0x45, 0x50, 0x54, 0x49, 0x4d, 0x55, 0x53, 0x20, 0x20, 0x20, 0x20, 0x42, 0x45, 0x43, 0x4b, 0x45, - //0x03e0: EPTI MUS B ECKE - 0x54, 0x54, 0x20, 0x20, 0x20, 0x20, 0x00, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x03f0: TT .. . - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x52, 0x4f, 0x4f, 0x54, 0x20, 0x20, 0x20, 0x20, - //0x0400: ." ROOT - 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0410: ." - 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, - //0x0420: .. ...$ .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, - //0x0430: .... .... .... .... - 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0440: D:.. .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0450: .... .... .... .... - 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0460: .... .... .... .... - 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, - //0x0470: .... .... .... .... + //0x02d0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0480: .... .... .... .... + //0x02e0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0490: .... .... .... .... + //0x02f0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04a0: .... .... .... .... + //0x0300: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04b0: .... .... .... .... + //0x0310: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04c0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04d0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04e0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x04f0: .... .... .... .... - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, }; + //0x0320: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + //0x0330: .... .... .... .... + 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b7a644fe1f9..47be37a20af 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,9 +32,9 @@ namespace DreamGen { -static const uint16 offset_rootdir = 0x0407; -static const uint16 offset_operand1 = 0x03f9; -static const uint16 offset_keys = 0x038f; +static const uint16 offset_keys = 0x01c6; +static const uint16 offset_rootdir = 0x023e; +static const uint16 offset_operand1 = 0x0230; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -357,17 +357,16 @@ static const uint16 kCh1blockstocopy = 435; static const uint16 kSoundbufferwrite = 437; static const uint16 kCurrentsample = 439; static const uint16 kRoomssample = 440; -static const uint16 kReelroutines = 441; -static const uint16 kBasicsample = 898; -static const uint16 kCurrentfile = 1045; -static const uint16 kRoomscango = 1120; -static const uint16 kRoompics = 1136; -static const uint16 kOplist = 1151; -static const uint16 kInputline = 1154; -static const uint16 kPresslist = 1282; -static const uint16 kQuitrequested = 1288; -static const uint16 kSubtitles = 1289; -static const uint16 kForeignrelease = 1290; +static const uint16 kBasicsample = 441; +static const uint16 kCurrentfile = 588; +static const uint16 kRoomscango = 663; +static const uint16 kRoompics = 679; +static const uint16 kOplist = 694; +static const uint16 kInputline = 697; +static const uint16 kPresslist = 825; +static const uint16 kQuitrequested = 831; +static const uint16 kSubtitles = 832; +static const uint16 kForeignrelease = 833; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -406,8 +405,8 @@ static const uint16 kListofchanges = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768 static const uint16 kUndertimedtext = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)); static const uint16 kRainlist = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)); static const uint16 kInitialreelrouts = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)); -static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441); -static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+898-441+68-0); +static const uint16 kInitialvars = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+457); +static const uint16 kLengthofbuffer = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80)+(250*4)+(256*30)+(6*64)+457+68-0); static const uint16 kReellist = (0+(36*144)); static const uint16 kIntext = (0+(38*2)); static const uint16 kLengthofmap = (0+(66*60)); @@ -440,6 +439,7 @@ static const uint16 kTablesize = (32); static const uint16 kScreenwidth = (320); static const uint16 kKeypadx = (36+112); static const uint16 kItempicsize = (44); +static const uint16 kLenofreelrouts = (457); static const uint16 kDiaryy = (48+12); static const uint16 kOpsy = (52); static const uint16 kSymboly = (56); @@ -458,7 +458,6 @@ static const uint16 kKeypady = (72); static const uint16 kZoomx = (8); static const uint16 kInventx = (80); static const uint16 kMenux = (80+40); -static const uint16 kLenofreelrouts = (898-441); static const uint16 kHeaderlen = (96); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 801e959a135..4d66134e960 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -56,12 +56,6 @@ static void (DreamBase::*reelCallbacks[57])(ReelRoutine &) = { &DreamBase::carParkDrip }; -#if 0 -// TODO: Enable this when the ReelRoutine list has been moved out of the -// data segment, all ReelCallbacks are in DreamBase, and the -// ReelRoutine::reelPointer field is a real member. -// See also struct ReelRoutine, clearBuffers, clearChanges, syncReelRoutine - static const ReelRoutine g_initialReelRoutines[] = { // Room number and x,y // reel pointer @@ -126,28 +120,25 @@ static const ReelRoutine g_initialReelRoutines[] = { { 255,0,0, 0, 0,0,0 } }; -void DreamBase::setupInitialReelRoutines(ReelRoutine *dest) { - for (unsigned int i = 0; i < ARRAYSIZE(g_initialReelRoutines); ++i) { - dest[i] = g_initialReelRoutines[i]; - if (dest[i].period == 55 && isCD() && engine->getLanguage() == Common::DE_DEU) - dest[i].period = 65; +void DreamBase::setupInitialReelRoutines() { + for (unsigned int i = 0; i < kNumReelRoutines + 1; ++i) { + _reelRoutines[i] = g_initialReelRoutines[i]; + if (_reelRoutines[i].period == 55 && isCD() && engine->getLanguage() == Common::DE_DEU) + _reelRoutines[i].period = 65; } } -#endif void DreamBase::updatePeople() { data.word(kListpos) = kPeoplelist; memset(getSegment(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People)); ++data.word(kMaintimer); - ReelRoutine *r = (ReelRoutine *)data.ptr(kReelroutines, 0); - - for (int i = 0; r[i].reallocation != 255; ++i) { - if (r[i].reallocation == data.byte(kReallocation) && - r[i].mapX == data.byte(kMapx) && - r[i].mapY == data.byte(kMapy)) { + for (int i = 0; _reelRoutines[i].reallocation != 255; ++i) { + if (_reelRoutines[i].reallocation == data.byte(kReallocation) && + _reelRoutines[i].mapX == data.byte(kMapx) && + _reelRoutines[i].mapY == data.byte(kMapy)) { assert(reelCallbacks[i]); - (this->*(reelCallbacks[i]))(r[i]); + (this->*(reelCallbacks[i]))(_reelRoutines[i]); } } } diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 4001cb14486..cd32e4fa348 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -38,12 +38,7 @@ void syncReelRoutine(Common::Serializer &s, ReelRoutine *reel) { s.syncAsByte(reel->reallocation); s.syncAsByte(reel->mapX); s.syncAsByte(reel->mapY); -#if 1 - s.syncAsByte(reel->b3); - s.syncAsByte(reel->b4); -#else s.syncAsUint16LE(reel->_reelPointer); -#endif s.syncAsByte(reel->period); s.syncAsByte(reel->counter); s.syncAsByte(reel->b7); @@ -380,7 +375,7 @@ void DreamGenContext::actualLoad() { data.byte(kGetback) = 1; } -void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { +void DreamBase::savePosition(unsigned int slot, const char *descbuf) { const Room ¤tRoom = g_roomData[data.byte(kLocation)]; @@ -411,7 +406,7 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { // fill length fields in savegame file header uint16 len[6] = { 17, kLengthofvars, kLengthofextra, - 4*kNumchanges, 48, kLenofreelrouts }; + 4*kNumchanges, 48, kNumReelRoutines*8+1 }; for (int i = 0; i < 6; ++i) header.setLen(i, len[i]); @@ -432,11 +427,11 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { // TODO: Convert more to serializer? Common::Serializer s(0, outSaveFile); - for (unsigned int i = 0; 8*i < kLenofreelrouts - 1; ++i) { - syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8*i, 8)); + for (unsigned int i = 0; i < kNumReelRoutines; ++i) { + syncReelRoutine(s, &_reelRoutines[i]); } // Terminator - s.syncAsByte(*data.ptr(kReelroutines + kLenofreelrouts - 1, 1)); + s.syncAsByte(_reelRoutines[kNumReelRoutines].reallocation); // ScummVM data block outSaveFile->writeUint32BE(SCUMMVM_HEADER); @@ -460,7 +455,7 @@ void DreamGenContext::savePosition(unsigned int slot, const char *descbuf) { delete outSaveFile; } -void DreamGenContext::loadPosition(unsigned int slot) { +void DreamBase::loadPosition(unsigned int slot) { data.word(kTimecount) = 0; clearChanges(); @@ -500,11 +495,11 @@ void DreamGenContext::loadPosition(unsigned int slot) { // TODO: Use serializer for more Common::Serializer s(inSaveFile, 0); - for (unsigned int i = 0; 8*i < kLenofreelrouts - 1; ++i) { - syncReelRoutine(s, (ReelRoutine *)data.ptr(kReelroutines + 8*i, 8)); + for (unsigned int i = 0; i < kNumReelRoutines; ++i) { + syncReelRoutine(s, &_reelRoutines[i]); } // Terminator - s.syncAsByte(*data.ptr(kReelroutines + kLenofreelrouts - 1, 1)); + s.syncAsByte(_reelRoutines[kNumReelRoutines].reallocation); // Check if there's a ScummVM data block if (header.len(6) == SCUMMVM_BLOCK_MAGIC_SIZE) { @@ -686,10 +681,4 @@ void DreamGenContext::selectSlot() { delPointer(); } -void DreamGenContext::selectSlot2() { - if (data.word(kMousebutton)) - data.byte(kLoadingorsave) = 2; - selectSlot(); -} - } // End of namespace DreamGen diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index d96469fbd57..313f3caf0bf 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -168,18 +168,10 @@ struct ReelRoutine { uint8 reallocation; uint8 mapX; uint8 mapY; -#if 0 uint16 _reelPointer; uint16 reelPointer() const { return _reelPointer; } void setReelPointer(uint16 v) { _reelPointer = v; } void incReelPointer() { _reelPointer++; } -#else - uint8 b3; - uint8 b4; - uint16 reelPointer() const { return READ_LE_UINT16(&b3); } - void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b3, v); } - void incReelPointer() { setReelPointer(reelPointer() + 1); } -#endif uint8 period; uint8 counter; uint8 b7; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4ac13ea3fbb..98d961ef2be 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -4540,10 +4540,6 @@ void DreamBase::clearBuffers() { memset(getSegment(data.word(kExtras)).ptr(0, kLengthofextra), 0xFF, kLengthofextra); - // TODO: Remove this line - // (once the ReelRoutines are no longer in the data segment) - memcpy(getSegment(data.word(kBuffers)).ptr(kInitialreelrouts, kLenofreelrouts), data.ptr(kReelroutines, kLenofreelrouts), kLenofreelrouts); - memcpy(getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), data.ptr(kStartvars, kLengthofvars), kLengthofvars); clearChanges(); @@ -4552,9 +4548,7 @@ void DreamBase::clearBuffers() { void DreamBase::clearChanges() { memset(getSegment(data.word(kBuffers)).ptr(kListofchanges, 4*kNumchanges), 0xFF, 4*kNumchanges); - // TODO: Call setupInitialReelRoutines instead - // (once the ReelRoutines are no longer in the data segment) - memcpy(data.ptr(kReelroutines, kLenofreelrouts), getSegment(data.word(kBuffers)).ptr(kInitialreelrouts, kLenofreelrouts), kLenofreelrouts); + setupInitialReelRoutines(); memcpy(data.ptr(kStartvars, kLengthofvars), getSegment(data.word(kBuffers)).ptr(kInitialvars, kLengthofvars), kLengthofvars); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index de03e45c628..3f38ad4beba 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -174,8 +174,6 @@ void showSecondUse(); void actualSave(); void actualLoad(); - void loadPosition(unsigned int slot); - void savePosition(unsigned int slot, const char *descbuf); void restoreAll(); void enterSymbol(); void viewFolder();