From a668c33cd3349886f486e148b91d7fe05309e084 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 9 Dec 2011 01:04:39 +0200 Subject: DREAMWEB: Port 'dosaveload' to C++ and remove opslist from the blob --- engines/dreamweb/dreamgen.cpp | 139 ++++++++++++------------------------------ engines/dreamweb/dreamgen.h | 24 ++++---- engines/dreamweb/stubs.cpp | 75 +++++++++++++++++++---- engines/dreamweb/stubs.h | 1 + 4 files changed, 115 insertions(+), 124 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 9a07dc11ec..a6841506e7 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3380,14 +3380,14 @@ void DreamGenContext::getDestInfo() { push(ax); dx = data; es = dx; - si = 1539; + si = 1497; _add(si, ax); cl = es.byte(si); ax = pop(); push(cx); dx = data; es = dx; - si = 1555; + si = 1513; _add(si, ax); ax = pop(); } @@ -3439,7 +3439,7 @@ clearedlocations: bx = ax; dx = data; es = dx; - _add(bx, 1539); + _add(bx, 1497); es.byte(bx) = 0; } @@ -3475,7 +3475,7 @@ void DreamGenContext::execCommand() { es = cs; bx = offset_comlist; ds = cs; - si = 1573; + si = 1531; al = ds.byte(si); _cmp(al, 0); if (!flags.z()) @@ -3670,7 +3670,7 @@ notyetassigned: push(bx); _add(bx, 2); ds = cs; - si = 1573; + si = 1531; checkpass: _lodsw(); ah = es.byte(bx); @@ -3998,7 +3998,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 1573; + si = 1531; notspace1: _lodsw(); _cmp(al, 32); @@ -5819,61 +5819,6 @@ void DreamGenContext::findText1() { si = ax; } -void DreamGenContext::doSaveLoad() { - STACK_CHECK; - data.byte(kPointerframe) = 0; - data.word(kTextaddressx) = 70; - data.word(kTextaddressy) = 182-8; - data.byte(kTextlen) = 181; - data.byte(kManisoffscreen) = 1; - clearWork(); - createPanel2(); - underTextLine(); - getRidOfAll(); - loadSaveBox(); - showOpBox(); - showMainOps(); - workToScreen(); - goto donefirstops; -restartops: - showOpBox(); - showMainOps(); - workToScreenM(); -donefirstops: - data.byte(kGetback) = 0; -waitops: - _cmp(data.byte(kQuitrequested), 0); - if (!flags.z()) - goto justret; - readMouse(); - showPointer(); - vSync(); - dumpPointer(); - dumpTextLine(); - delPointer(); - bx = offset_opslist; - checkCoords(); - _cmp(data.byte(kGetback), 0); - if (flags.z()) - goto waitops; - _cmp(data.byte(kGetback), 2); - if (flags.z()) - goto restartops; - data.word(kTextaddressx) = 13; - data.word(kTextaddressy) = 182; - data.byte(kTextlen) = 240; - _cmp(data.byte(kGetback), 4); - if (flags.z()) - goto justret; - getRidOfTemp(); - restoreAll(); - redrawMainScrn(); - workToScreenM(); - data.byte(kCommandtype) = 200; -justret: - data.byte(kManisoffscreen) = 0; -} - void DreamGenContext::checkInput() { STACK_CHECK; _cmp(data.byte(kLoadingorsave), 3); @@ -5929,7 +5874,7 @@ void DreamGenContext::getNamePos() { _mul(cx); dx = data; es = dx; - bx = 1707; + bx = 1665; _add(bx, ax); al = data.byte(kCursorpos); ah = 0; @@ -6025,7 +5970,7 @@ void DreamGenContext::showNames() { STACK_CHECK; dx = data; es = dx; - si = 1707+1; + si = 1665+1; di = (60)+21; bx = (52)+10; cl = 0; @@ -6401,7 +6346,7 @@ void DreamGenContext::clearChanges() { di = 0; _stosw(cx, true); es = cs; - di = 1539; + di = 1497; al = 1; _stosb(2); al = 0; @@ -6766,31 +6711,31 @@ void DreamGenContext::__start() { //0x0540: .... .... .... .... 0xb8, 0x00, 0x50, 0xc7, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, //0x0550: ..P. ..@. .... .... - 0x77, 0x00, 0xae, 0x00, 0x52, 0x00, 0x80, 0x00, 0x34, 0xc8, 0x46, 0x00, 0x89, 0x00, 0x3e, 0x00, - //0x0560: w... R... 4.F. ..>. - 0x6f, 0x00, 0x80, 0xc8, 0xbc, 0x00, 0xfa, 0x00, 0x44, 0x00, 0x98, 0x00, 0x4c, 0xc8, 0x00, 0x00, - //0x0570: o... .... D... L... - 0x40, 0x01, 0x00, 0x00, 0xc8, 0x00, 0xa0, 0xca, 0xff, 0xff, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x53, - //0x0580: @... .... .... ..$S - 0x50, 0x45, 0x45, 0x43, 0x48, 0x52, 0x32, 0x34, 0x43, 0x30, 0x30, 0x30, 0x35, 0x2e, 0x52, 0x41, - //0x0590: PEEC HR24 C000 5.RA - 0x57, 0x00, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, - //0x05a0: W.OB JECT NAM E ON - 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x05b0: E - 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, - //0x05c0: .. .... - 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, - //0x05d0: .... .... .... .... - 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x05e0: ...D :... .... .... + 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x53, 0x50, 0x45, 0x45, 0x43, 0x48, 0x52, 0x32, 0x34, 0x43, 0x30, + //0x0560: .... $SPE ECHR 24C0 + 0x30, 0x30, 0x35, 0x2e, 0x52, 0x41, 0x57, 0x00, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x20, 0x4e, + //0x0570: 005. RAW. OBJE CT N + 0x41, 0x4d, 0x45, 0x20, 0x4f, 0x4e, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0580: AME ONE + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0590: + 0x00, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + //0x05a0: .... .... .... .... + 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x05b0: .... .... .D:. .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x05c0: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + //0x05d0: .... .... .... .... + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, + //0x05e0: .... .... .... .... + 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x05f0: .... .... .... .... - 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0600: .... .... .... .... - 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0610: .... .... .... .... - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0620: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0630: .... .... .... .... @@ -6800,29 +6745,23 @@ void DreamGenContext::__start() { //0x0650: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0660: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0670: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x0680: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x0690: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x06a0: .... .... .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x06b0: .... .... .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x06c0: .... .... .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x06d0: .... .... .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x06e0: .... .... .... .... - 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x06f0: .... .... .... .... - 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x0700: .... .... .... .... - 0x01, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - //0x0710: .... .... .... .... - 0x01, 0x01, 0x00, 0x00, 0x00, }; + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 776fbe0fd2..b0620648cf 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -33,17 +33,16 @@ namespace DreamGen { static const uint16 offset_money1poke = 0x052e; -static const uint16 offset_speechfile = 0x0595; +static const uint16 offset_commandline = 0x0578; static const uint16 offset_openchangesize = 0x0446; static const uint16 offset_operand1 = 0x0504; static const uint16 offset_comlist = 0x045e; -static const uint16 offset_opslist = 0x0560; static const uint16 offset_diarylist = 0x0536; +static const uint16 offset_speechfile = 0x056b; static const uint16 offset_rootdir = 0x0512; static const uint16 offset_money2poke = 0x0533; static const uint16 offset_keys = 0x049a; static const uint16 offset_quitlist = 0x0448; -static const uint16 offset_commandline = 0x05a2; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -425,15 +424,15 @@ static const uint16 kGungraphic = 1055; static const uint16 kMonkface = 1068; static const uint16 kTitle7graphics = 1081; static const uint16 kCurrentfile = 1312; -static const uint16 kRoomscango = 1539; -static const uint16 kRoompics = 1555; -static const uint16 kOplist = 1570; -static const uint16 kInputline = 1573; -static const uint16 kPresslist = 1701; -static const uint16 kSavenames = 1707; -static const uint16 kQuitrequested = 1826; -static const uint16 kSubtitles = 1827; -static const uint16 kForeignrelease = 1828; +static const uint16 kRoomscango = 1497; +static const uint16 kRoompics = 1513; +static const uint16 kOplist = 1528; +static const uint16 kInputline = 1531; +static const uint16 kPresslist = 1659; +static const uint16 kSavenames = 1665; +static const uint16 kQuitrequested = 1784; +static const uint16 kSubtitles = 1785; +static const uint16 kForeignrelease = 1786; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -679,7 +678,6 @@ public: void useControl(); void adjustRight(); void updateSymbolTop(); - void doSaveLoad(); void createName(); void getPersonText(); void parser(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index c39ca75b46..f0c49f4803 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1696,17 +1696,6 @@ void DreamGenContext::checkCoords() { checkCoords(diaryList); break; } - case offset_opslist: { - RectWithCallback opsList[] = { - { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getBackFromOps }, - { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamGenContext::DOSReturn }, - { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discOps }, - { 0,320,0,200,&DreamGenContext::blank }, - { 0xFFFF,0,0,0,0 } - }; - checkCoords(opsList); - break; - } default: ::error("Unimplemented checkcoords() call"); } @@ -4053,4 +4042,68 @@ void DreamGenContext::discOps() { } while (!data.byte(kGetback)); } +void DreamGenContext::doSaveLoad() { + data.byte(kPointerframe) = 0; + data.word(kTextaddressx) = 70; + data.word(kTextaddressy) = 182-8; + data.byte(kTextlen) = 181; + data.byte(kManisoffscreen) = 1; + clearWork(); + createPanel2(); + underTextLine(); + getRidOfAll(); + loadSaveBox(); + showOpBox(); + showMainOps(); + workToScreen(); + + RectWithCallback opsList[] = { + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamGenContext::getBackFromOps }, + { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamGenContext::DOSReturn }, + { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamGenContext::discOps }, + { 0,320,0,200,&DreamGenContext::blank }, + { 0xFFFF,0,0,0,0 } + }; + + bool firstOps = true; + + do { // restart ops + if (firstOps) { + firstOps = false; + } else { + showOpBox(); + showMainOps(); + workToScreenM(); + } + data.byte(kGetback) = 0; + + do { // wait ops + if (data.byte(kQuitrequested)) { + data.byte(kManisoffscreen) = 0; + return; + } + + readMouse(); + showPointer(); + vSync(); + dumpPointer(); + dumpTextLine(); + delPointer(); + checkCoords(opsList); + } while (!data.byte(kGetback)); + } while (data.byte(kGetback) == 2); + + data.word(kTextaddressx) = 13; + data.word(kTextaddressy) = 182; + data.byte(kTextlen) = 240; + if (data.byte(kGetback) != 4) { + getRidOfTemp(); + restoreAll(); + redrawMainScrn(); + workToScreenM(); + data.byte(kCommandtype) = 200; + } + data.byte(kManisoffscreen) = 0; +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 114b271aa5..422038e920 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -557,5 +557,6 @@ void decide(); void talk(); void discOps(); + void doSaveLoad(); #endif -- cgit v1.2.3