From 6f85de6b6e9b2af820d0294db16881d41368d693 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 26 Dec 2011 19:35:47 +0100 Subject: DREAMWEB: Combine transferMap and transferInv --- engines/dreamweb/dreambase.h | 3 +- engines/dreamweb/dreamgen.cpp | 95 +++------ engines/dreamweb/dreamgen.h | 440 +++++++++++++++++++++--------------------- engines/dreamweb/object.cpp | 32 +-- engines/dreamweb/stubs.h | 1 - engines/dreamweb/vgagrafx.cpp | 38 ++-- 6 files changed, 284 insertions(+), 325 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h index b134159a2e..ef08738cf6 100644 --- a/engines/dreamweb/dreambase.h +++ b/engines/dreamweb/dreambase.h @@ -221,6 +221,7 @@ public: ObjectRef findInvPos(); void reExFromInv(); void swapWithInv(); + void transferText(uint8 from, uint8 to); // from pathfind.cpp void turnPathOn(uint8 param); @@ -726,7 +727,7 @@ public: void panelToMap(); void mapToPanel(); void dumpMap(); - void transferInv(); + void transferFrame(uint8 from, uint8 to, uint8 offset); void zoom(); void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height); void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height); diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 356ebc8d36..a0e255547b 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,53 +26,6 @@ namespace DreamGen { -void DreamGenContext::transferMap() { - STACK_CHECK; - di = data.word(kExframepos); - push(di); - al = data.byte(kExpos); - ah = 0; - bx = ax; - _add(ax, ax); - _add(ax, bx); - cx = 6; - _mul(cx); - es = data.word(kExtras); - bx = (0); - _add(bx, ax); - _add(di, (0+2080)); - push(bx); - al = data.byte(kItemtotran); - ah = 0; - bx = ax; - _add(ax, ax); - _add(ax, bx); - cx = 6; - _mul(cx); - ds = data.word(kFreeframes); - bx = (0); - _add(bx, ax); - si = (0+2080); - al = ds.byte(bx); - ah = 0; - cl = ds.byte(bx+1); - ch = 0; - _add(si, ds.word(bx+2)); - dx = ds.word(bx+4); - bx = pop(); - es.byte(bx+0) = al; - es.byte(bx+1) = cl; - es.word(bx+4) = dx; - _mul(cx); - cx = ax; - push(cx); - _movsb(cx, true); - cx = pop(); - ax = pop(); - es.word(bx+2) = ax; - _add(data.word(kExframepos), cx); -} - void DreamGenContext::read() { STACK_CHECK; cx = 40; @@ -85,7 +38,7 @@ void DreamGenContext::read() { return; okcom: es = cs; - di = 418; + di = 417; ax = data.word(kTextfile1); data.word(kMonsource) = ax; ds = ax; @@ -215,7 +168,7 @@ keyok2: ds = cs; si = offset_operand1+1; es = cs; - di = 418+1; + di = 417+1; cx = 12; _movsb(cx, true); monitorLogo(); @@ -297,7 +250,7 @@ void DreamGenContext::parser() { al = '='; _stosb(); ds = cs; - si = 493; + si = 492; notspace1: _lodsw(); _cmp(al, 32); @@ -341,18 +294,18 @@ void DreamGenContext::__start() { //0x0050: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0060: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0070: .... .h.& .... .... + 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x0070: .... h.&. .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0080: .... .... .... .... - 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, 0xff, //0x0090: .... .... .... .... - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00a0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00b0: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x00c0: .... .. .... .... + 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + //0x00c0: ... ... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00d0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -365,26 +318,26 @@ void DreamGenContext::__start() { //0x0110: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0120: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, //0x0130: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0140: .... .... .... .... 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x0150: .... .... .... .... - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0160: .... .... .... .... - 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, 0xff, //0x0170: .... .... .... .... - 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, - //0x0180: .... ...D REAM WEB. - 0x56, 0x39, 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, - //0x0190: V99. - 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, - //0x01a0: ." . - 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, - //0x01b0: .... $... .... .... - 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, - //0x01c0: .... .... .... .D:. + 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45, 0x42, 0x2e, 0x56, + //0x0180: .... ..DR EAMW EB.V + 0x39, 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + //0x0190: 99. + 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, + //0x01a0: ." .. + 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, + //0x01b0: ...$ .... .... .... + 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, + //0x01c0: .... .... .... D:.. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x01d0: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -403,9 +356,7 @@ void DreamGenContext::__start() { //0x0240: .... .... .... .... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0250: .... .... .... .... - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - //0x0260: .... .... .... .... - }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; ds.assign(src, src + sizeof(src)); dreamweb(); } diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 0c61a60a6e..492a8b3d02 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -32,7 +32,7 @@ namespace DreamGen { -static const uint16 offset_operand1 = 0x0194; +static const uint16 offset_operand1 = 0x0193; static const uint16 kStartvars = 0; static const uint16 kProgresspoints = 1; static const uint16 kWatchon = 2; @@ -104,225 +104,224 @@ static const uint16 kLastxpos = 82; static const uint16 kIcontop = 84; static const uint16 kIconleft = 86; static const uint16 kItemframe = 88; -static const uint16 kItemtotran = 89; -static const uint16 kRoomad = 90; -static const uint16 kWithobject = 92; -static const uint16 kWithtype = 93; -static const uint16 kLookcounter = 94; -static const uint16 kCommand = 96; -static const uint16 kCommandtype = 97; -static const uint16 kOldcommandtype = 98; -static const uint16 kObjecttype = 99; -static const uint16 kGetback = 100; -static const uint16 kInvopen = 101; -static const uint16 kMainmode = 102; -static const uint16 kPickup = 103; -static const uint16 kLastinvpos = 104; -static const uint16 kExamagain = 105; -static const uint16 kNewtextline = 106; -static const uint16 kOpenedob = 107; -static const uint16 kOpenedtype = 108; -static const uint16 kOldmapadx = 109; -static const uint16 kOldmapady = 111; -static const uint16 kMapadx = 113; -static const uint16 kMapady = 115; -static const uint16 kMapoffsetx = 117; -static const uint16 kMapoffsety = 119; -static const uint16 kMapxstart = 121; -static const uint16 kMapystart = 123; -static const uint16 kMapxsize = 125; -static const uint16 kMapysize = 126; -static const uint16 kHavedoneobs = 127; -static const uint16 kManisoffscreen = 128; -static const uint16 kRainspace = 129; -static const uint16 kFacing = 130; -static const uint16 kLeavedirection = 131; -static const uint16 kTurntoface = 132; -static const uint16 kTurndirection = 133; -static const uint16 kMaintimer = 134; -static const uint16 kIntrocount = 136; -static const uint16 kArrowad = 137; -static const uint16 kCurrentkey = 139; -static const uint16 kOldkey = 140; -static const uint16 kUseddirection = 141; -static const uint16 kTimercount = 142; -static const uint16 kOldtimercount = 143; -static const uint16 kMapx = 144; -static const uint16 kMapy = 145; -static const uint16 kNewscreen = 146; -static const uint16 kRyanx = 147; -static const uint16 kRyany = 148; -static const uint16 kLastflag = 149; -static const uint16 kOffsetx = 150; -static const uint16 kOffsety = 152; -static const uint16 kCurrentob = 154; -static const uint16 kDestpos = 155; -static const uint16 kReallocation = 156; -static const uint16 kRoomnum = 157; -static const uint16 kNowinnewroom = 158; -static const uint16 kResetmanxy = 159; -static const uint16 kNewlocation = 160; -static const uint16 kAutolocation = 161; -static const uint16 kDoorcheck1 = 162; -static const uint16 kDoorcheck2 = 163; -static const uint16 kDoorcheck3 = 164; -static const uint16 kDoorcheck4 = 165; -static const uint16 kMousex = 166; -static const uint16 kMousey = 168; -static const uint16 kMousebutton = 170; -static const uint16 kMousebutton1 = 172; -static const uint16 kMousebutton2 = 174; -static const uint16 kMousebutton3 = 176; -static const uint16 kMousebutton4 = 178; -static const uint16 kOldbutton = 180; -static const uint16 kOldx = 182; -static const uint16 kOldy = 184; -static const uint16 kLastbutton = 186; -static const uint16 kOldpointerx = 188; -static const uint16 kOldpointery = 190; -static const uint16 kDelherex = 192; -static const uint16 kDelherey = 194; -static const uint16 kPointerxs = 196; -static const uint16 kPointerys = 197; -static const uint16 kDelxs = 198; -static const uint16 kDelys = 199; -static const uint16 kPointerframe = 200; -static const uint16 kPointerpower = 201; -static const uint16 kAuxpointerframe = 202; -static const uint16 kPointermode = 203; -static const uint16 kPointerspeed = 204; -static const uint16 kPointercount = 205; -static const uint16 kInmaparea = 206; -static const uint16 kTalkmode = 207; -static const uint16 kTalkpos = 208; -static const uint16 kCharacter = 209; -static const uint16 kWatchdump = 210; -static const uint16 kLogonum = 211; -static const uint16 kOldlogonum = 212; -static const uint16 kNetseg = 213; -static const uint16 kNetpoint = 215; -static const uint16 kCursorstate = 217; -static const uint16 kPressed = 218; -static const uint16 kPresspointer = 219; -static const uint16 kGraphicpress = 221; -static const uint16 kPresscount = 222; -static const uint16 kLightcount = 223; -static const uint16 kFolderpage = 224; -static const uint16 kDiarypage = 225; -static const uint16 kMenucount = 226; -static const uint16 kSymboltopx = 227; -static const uint16 kSymboltopnum = 228; -static const uint16 kSymboltopdir = 229; -static const uint16 kSymbolbotx = 230; -static const uint16 kSymbolbotnum = 231; -static const uint16 kSymbolbotdir = 232; -static const uint16 kSymboltolight = 233; -static const uint16 kSymbol1 = 234; -static const uint16 kSymbol2 = 235; -static const uint16 kSymbol3 = 236; -static const uint16 kSymbolnum = 237; -static const uint16 kDumpx = 238; -static const uint16 kDumpy = 240; -static const uint16 kWalkandexam = 242; -static const uint16 kWalkexamtype = 243; -static const uint16 kWalkexamnum = 244; -static const uint16 kCurslocx = 245; -static const uint16 kCurslocy = 247; -static const uint16 kCurpos = 249; -static const uint16 kMonadx = 251; -static const uint16 kMonady = 253; -static const uint16 kMonsource = 255; -static const uint16 kNumtodo = 257; -static const uint16 kTimecount = 259; -static const uint16 kCounttotimed = 261; -static const uint16 kTimedseg = 263; -static const uint16 kTimedoffset = 265; -static const uint16 kTimedy = 267; -static const uint16 kTimedx = 268; -static const uint16 kNeedtodumptimed = 269; -static const uint16 kLoadingorsave = 270; -static const uint16 kCurrentslot = 271; -static const uint16 kCursorpos = 272; -static const uint16 kColourpos = 273; -static const uint16 kFadedirection = 274; -static const uint16 kNumtofade = 275; -static const uint16 kFadecount = 276; -static const uint16 kAddtogreen = 277; -static const uint16 kAddtored = 278; -static const uint16 kAddtoblue = 279; -static const uint16 kLastsoundreel = 280; -static const uint16 kSpeechloaded = 282; -static const uint16 kSpeechlength = 283; -static const uint16 kVolume = 285; -static const uint16 kVolumeto = 286; -static const uint16 kVolumedirection = 287; -static const uint16 kVolumecount = 288; -static const uint16 kWongame = 289; -static const uint16 kLasthardkey = 290; -static const uint16 kBufferin = 291; -static const uint16 kBufferout = 293; -static const uint16 kExtras = 295; -static const uint16 kWorkspace = 297; -static const uint16 kMapstore = 299; -static const uint16 kCharset1 = 301; -static const uint16 kMainsprites = 303; -static const uint16 kBackdrop = 305; -static const uint16 kMapdata = 307; -static const uint16 kSounddata = 309; -static const uint16 kSounddata2 = 311; -static const uint16 kRecordspace = 313; -static const uint16 kFreedat = 315; -static const uint16 kSetdat = 317; -static const uint16 kReel1 = 319; -static const uint16 kReel2 = 321; -static const uint16 kReel3 = 323; -static const uint16 kRoomdesc = 325; -static const uint16 kFreedesc = 327; -static const uint16 kSetdesc = 329; -static const uint16 kBlockdesc = 331; -static const uint16 kSetframes = 333; -static const uint16 kFreeframes = 335; -static const uint16 kPeople = 337; -static const uint16 kReels = 339; -static const uint16 kCommandtext = 341; -static const uint16 kPuzzletext = 343; -static const uint16 kTraveltext = 345; -static const uint16 kTempgraphics = 347; -static const uint16 kTempgraphics2 = 349; -static const uint16 kTempgraphics3 = 351; -static const uint16 kTempsprites = 353; -static const uint16 kTextfile1 = 355; -static const uint16 kTextfile2 = 357; -static const uint16 kTextfile3 = 359; -static const uint16 kBlinkframe = 361; -static const uint16 kBlinkcount = 362; -static const uint16 kReasseschanges = 363; -static const uint16 kPointerspath = 364; -static const uint16 kManspath = 365; -static const uint16 kPointerfirstpath = 366; -static const uint16 kFinaldest = 367; -static const uint16 kDestination = 368; -static const uint16 kLinestartx = 369; -static const uint16 kLinestarty = 371; -static const uint16 kLineendx = 373; -static const uint16 kLineendy = 375; -static const uint16 kLinepointer = 377; -static const uint16 kLinedirection = 378; -static const uint16 kLinelength = 379; -static const uint16 kCh0blockstocopy = 380; -static const uint16 kCh0playing = 382; -static const uint16 kCh0repeat = 383; -static const uint16 kCh1playing = 384; -static const uint16 kCh1blockstocopy = 385; -static const uint16 kSoundbufferwrite = 387; -static const uint16 kCurrentsample = 389; -static const uint16 kRoomssample = 390; -static const uint16 kBasicsample = 391; -static const uint16 kCurrentfile = 418; -static const uint16 kInputline = 493; -static const uint16 kQuitrequested = 621; -static const uint16 kSubtitles = 622; -static const uint16 kForeignrelease = 623; +static const uint16 kRoomad = 89; +static const uint16 kWithobject = 91; +static const uint16 kWithtype = 92; +static const uint16 kLookcounter = 93; +static const uint16 kCommand = 95; +static const uint16 kCommandtype = 96; +static const uint16 kOldcommandtype = 97; +static const uint16 kObjecttype = 98; +static const uint16 kGetback = 99; +static const uint16 kInvopen = 100; +static const uint16 kMainmode = 101; +static const uint16 kPickup = 102; +static const uint16 kLastinvpos = 103; +static const uint16 kExamagain = 104; +static const uint16 kNewtextline = 105; +static const uint16 kOpenedob = 106; +static const uint16 kOpenedtype = 107; +static const uint16 kOldmapadx = 108; +static const uint16 kOldmapady = 110; +static const uint16 kMapadx = 112; +static const uint16 kMapady = 114; +static const uint16 kMapoffsetx = 116; +static const uint16 kMapoffsety = 118; +static const uint16 kMapxstart = 120; +static const uint16 kMapystart = 122; +static const uint16 kMapxsize = 124; +static const uint16 kMapysize = 125; +static const uint16 kHavedoneobs = 126; +static const uint16 kManisoffscreen = 127; +static const uint16 kRainspace = 128; +static const uint16 kFacing = 129; +static const uint16 kLeavedirection = 130; +static const uint16 kTurntoface = 131; +static const uint16 kTurndirection = 132; +static const uint16 kMaintimer = 133; +static const uint16 kIntrocount = 135; +static const uint16 kArrowad = 136; +static const uint16 kCurrentkey = 138; +static const uint16 kOldkey = 139; +static const uint16 kUseddirection = 140; +static const uint16 kTimercount = 141; +static const uint16 kOldtimercount = 142; +static const uint16 kMapx = 143; +static const uint16 kMapy = 144; +static const uint16 kNewscreen = 145; +static const uint16 kRyanx = 146; +static const uint16 kRyany = 147; +static const uint16 kLastflag = 148; +static const uint16 kOffsetx = 149; +static const uint16 kOffsety = 151; +static const uint16 kCurrentob = 153; +static const uint16 kDestpos = 154; +static const uint16 kReallocation = 155; +static const uint16 kRoomnum = 156; +static const uint16 kNowinnewroom = 157; +static const uint16 kResetmanxy = 158; +static const uint16 kNewlocation = 159; +static const uint16 kAutolocation = 160; +static const uint16 kDoorcheck1 = 161; +static const uint16 kDoorcheck2 = 162; +static const uint16 kDoorcheck3 = 163; +static const uint16 kDoorcheck4 = 164; +static const uint16 kMousex = 165; +static const uint16 kMousey = 167; +static const uint16 kMousebutton = 169; +static const uint16 kMousebutton1 = 171; +static const uint16 kMousebutton2 = 173; +static const uint16 kMousebutton3 = 175; +static const uint16 kMousebutton4 = 177; +static const uint16 kOldbutton = 179; +static const uint16 kOldx = 181; +static const uint16 kOldy = 183; +static const uint16 kLastbutton = 185; +static const uint16 kOldpointerx = 187; +static const uint16 kOldpointery = 189; +static const uint16 kDelherex = 191; +static const uint16 kDelherey = 193; +static const uint16 kPointerxs = 195; +static const uint16 kPointerys = 196; +static const uint16 kDelxs = 197; +static const uint16 kDelys = 198; +static const uint16 kPointerframe = 199; +static const uint16 kPointerpower = 200; +static const uint16 kAuxpointerframe = 201; +static const uint16 kPointermode = 202; +static const uint16 kPointerspeed = 203; +static const uint16 kPointercount = 204; +static const uint16 kInmaparea = 205; +static const uint16 kTalkmode = 206; +static const uint16 kTalkpos = 207; +static const uint16 kCharacter = 208; +static const uint16 kWatchdump = 209; +static const uint16 kLogonum = 210; +static const uint16 kOldlogonum = 211; +static const uint16 kNetseg = 212; +static const uint16 kNetpoint = 214; +static const uint16 kCursorstate = 216; +static const uint16 kPressed = 217; +static const uint16 kPresspointer = 218; +static const uint16 kGraphicpress = 220; +static const uint16 kPresscount = 221; +static const uint16 kLightcount = 222; +static const uint16 kFolderpage = 223; +static const uint16 kDiarypage = 224; +static const uint16 kMenucount = 225; +static const uint16 kSymboltopx = 226; +static const uint16 kSymboltopnum = 227; +static const uint16 kSymboltopdir = 228; +static const uint16 kSymbolbotx = 229; +static const uint16 kSymbolbotnum = 230; +static const uint16 kSymbolbotdir = 231; +static const uint16 kSymboltolight = 232; +static const uint16 kSymbol1 = 233; +static const uint16 kSymbol2 = 234; +static const uint16 kSymbol3 = 235; +static const uint16 kSymbolnum = 236; +static const uint16 kDumpx = 237; +static const uint16 kDumpy = 239; +static const uint16 kWalkandexam = 241; +static const uint16 kWalkexamtype = 242; +static const uint16 kWalkexamnum = 243; +static const uint16 kCurslocx = 244; +static const uint16 kCurslocy = 246; +static const uint16 kCurpos = 248; +static const uint16 kMonadx = 250; +static const uint16 kMonady = 252; +static const uint16 kMonsource = 254; +static const uint16 kNumtodo = 256; +static const uint16 kTimecount = 258; +static const uint16 kCounttotimed = 260; +static const uint16 kTimedseg = 262; +static const uint16 kTimedoffset = 264; +static const uint16 kTimedy = 266; +static const uint16 kTimedx = 267; +static const uint16 kNeedtodumptimed = 268; +static const uint16 kLoadingorsave = 269; +static const uint16 kCurrentslot = 270; +static const uint16 kCursorpos = 271; +static const uint16 kColourpos = 272; +static const uint16 kFadedirection = 273; +static const uint16 kNumtofade = 274; +static const uint16 kFadecount = 275; +static const uint16 kAddtogreen = 276; +static const uint16 kAddtored = 277; +static const uint16 kAddtoblue = 278; +static const uint16 kLastsoundreel = 279; +static const uint16 kSpeechloaded = 281; +static const uint16 kSpeechlength = 282; +static const uint16 kVolume = 284; +static const uint16 kVolumeto = 285; +static const uint16 kVolumedirection = 286; +static const uint16 kVolumecount = 287; +static const uint16 kWongame = 288; +static const uint16 kLasthardkey = 289; +static const uint16 kBufferin = 290; +static const uint16 kBufferout = 292; +static const uint16 kExtras = 294; +static const uint16 kWorkspace = 296; +static const uint16 kMapstore = 298; +static const uint16 kCharset1 = 300; +static const uint16 kMainsprites = 302; +static const uint16 kBackdrop = 304; +static const uint16 kMapdata = 306; +static const uint16 kSounddata = 308; +static const uint16 kSounddata2 = 310; +static const uint16 kRecordspace = 312; +static const uint16 kFreedat = 314; +static const uint16 kSetdat = 316; +static const uint16 kReel1 = 318; +static const uint16 kReel2 = 320; +static const uint16 kReel3 = 322; +static const uint16 kRoomdesc = 324; +static const uint16 kFreedesc = 326; +static const uint16 kSetdesc = 328; +static const uint16 kBlockdesc = 330; +static const uint16 kSetframes = 332; +static const uint16 kFreeframes = 334; +static const uint16 kPeople = 336; +static const uint16 kReels = 338; +static const uint16 kCommandtext = 340; +static const uint16 kPuzzletext = 342; +static const uint16 kTraveltext = 344; +static const uint16 kTempgraphics = 346; +static const uint16 kTempgraphics2 = 348; +static const uint16 kTempgraphics3 = 350; +static const uint16 kTempsprites = 352; +static const uint16 kTextfile1 = 354; +static const uint16 kTextfile2 = 356; +static const uint16 kTextfile3 = 358; +static const uint16 kBlinkframe = 360; +static const uint16 kBlinkcount = 361; +static const uint16 kReasseschanges = 362; +static const uint16 kPointerspath = 363; +static const uint16 kManspath = 364; +static const uint16 kPointerfirstpath = 365; +static const uint16 kFinaldest = 366; +static const uint16 kDestination = 367; +static const uint16 kLinestartx = 368; +static const uint16 kLinestarty = 370; +static const uint16 kLineendx = 372; +static const uint16 kLineendy = 374; +static const uint16 kLinepointer = 376; +static const uint16 kLinedirection = 377; +static const uint16 kLinelength = 378; +static const uint16 kCh0blockstocopy = 379; +static const uint16 kCh0playing = 381; +static const uint16 kCh0repeat = 382; +static const uint16 kCh1playing = 383; +static const uint16 kCh1blockstocopy = 384; +static const uint16 kSoundbufferwrite = 386; +static const uint16 kCurrentsample = 388; +static const uint16 kRoomssample = 389; +static const uint16 kBasicsample = 390; +static const uint16 kCurrentfile = 417; +static const uint16 kInputline = 492; +static const uint16 kQuitrequested = 620; +static const uint16 kSubtitles = 621; +static const uint16 kForeignrelease = 622; static const uint16 kBlocktextdat = (0); static const uint16 kPersonframes = (0); static const uint16 kDebuglevel1 = (0); @@ -425,7 +424,6 @@ public: #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() void dirFile(); - void transferMap(); void dreamweb(); void read(); void searchForString(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 9799ca4726..0f0599b7f6 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -255,10 +255,11 @@ void DreamGenContext::inventory() { examineOb(false); } -void DreamGenContext::transferText() { - getSegment(data.word(kExtras)).word(kExtextdat + data.byte(kExpos) * 2) = data.word(kExtextpos); - uint16 freeTextOffset = data.byte(kItemtotran) * 2; +void DreamBase::transferText(uint8 from, uint8 to) { + getSegment(data.word(kExtras)).word(kExtextdat + 2*to) = data.word(kExtextpos); + uint16 freeTextOffset = 2*from; uint16 srcOffset = getSegment(data.word(kFreedesc)).word(kFreetextdat + freeTextOffset); + const char *src = (const char *)getSegment(data.word(kFreedesc)).ptr(kFreetext + srcOffset, 0); char *dst = (char *)getSegment(data.word(kExtras)).ptr(kExtext + data.word(kExtextpos), 0); @@ -1012,23 +1013,29 @@ ObjectRef DreamBase::findOpenPos() { byte DreamGenContext::transferToEx() { emergencyPurge(); + DynObject *exObject = getExPos(); // Also sets es:di byte pos = data.byte(kExpos); + DynObject *freeObject = getFreeAd(data.byte(kItemframe)); + memcpy(exObject, freeObject, sizeof(DynObject)); + exObject->currentLocation = data.byte(kReallocation); exObject->initialLocation = data.byte(kReallocation); exObject->index = data.byte(kItemframe); exObject->mapad[0] = 4; exObject->mapad[1] = 255; exObject->mapad[2] = data.byte(kLastinvpos); - data.byte(kItemtotran) = data.byte(kItemframe); - transferMap(); - transferInv(); - transferText(); - freeObject = getFreeAd(data.byte(kItemframe)); + + transferFrame(data.byte(kItemframe), pos, 0); + transferFrame(data.byte(kItemframe), pos, 1); + transferText(data.byte(kItemframe), pos); + freeObject->mapad[0] = 254; + pickupConts(); + return pos; } @@ -1084,14 +1091,13 @@ void DreamGenContext::pickupConts() { uint8 expos = data.byte(kExpos); - for (uint16 index = 0; index < 80; ++index) { + for (uint8 index = 0; index < 80; ++index) { DynObject *freeObj = getFreeAd(index); if (freeObj->mapad[0] != data.byte(kObjecttype)) continue; if (freeObj->mapad[1] != data.byte(kItemframe)) continue; - data.byte(kItemtotran) = index; DynObject *exObj = getExPos(); // Also sets es:di to exObj @@ -1102,9 +1108,9 @@ void DreamGenContext::pickupConts() { exObj->mapad[0] = 4; // kExObjectType? exObj->mapad[1] = expos; - transferMap(); - transferInv(); - transferText(); + transferFrame(index, data.byte(kExpos), 0); + transferFrame(index, data.byte(kExpos), 1); + transferText(index, data.byte(kExpos)); freeObj->mapad[0] = 0xFF; } diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 8bdc0b11c0..0c62abdc1b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -75,7 +75,6 @@ void useRoutine(); void examineOb(bool examineAgain = true); void dumpWatch(); - void transferText(); void watchCount(); void readSetData(); void useMon(); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index ce89711f87..ecb295a353 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -401,23 +401,6 @@ void DreamBase::dumpMap() { multiDump(data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize)); } -void DreamBase::transferInv() { - const Frame *freeFrames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(kFrframedata, 0); - const Frame *freeFrame = freeFrames + (3 * data.byte(kItemtotran) + 1); - Frame *exFrames = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata, 0); - Frame *exFrame = exFrames + (3 * data.byte(kExpos) + 1); - exFrame->width = freeFrame->width; - exFrame->height = freeFrame->height; - exFrame->x = freeFrame->x; - exFrame->y = freeFrame->y; - uint16 byteCount = freeFrame->width * freeFrame->height; - const uint8 *src = getSegment(data.word(kFreeframes)).ptr(kFrframes + freeFrame->ptr(), byteCount); - uint8 *dst = getSegment(data.word(kExtras)).ptr(kExframes + data.word(kExframepos), byteCount); - memcpy(dst, src, byteCount); - exFrame->setPtr(data.word(kExframepos)); - data.word(kExframepos) += byteCount; -} - bool DreamBase::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { x -= pos->xMin; y -= pos->yMin; @@ -466,4 +449,25 @@ void DreamBase::showPanel() { showFrame(engine->icons1(), 192, 0, 19, 0); } +void DreamBase::transferFrame(uint8 from, uint8 to, uint8 offset) { + const Frame *freeFrames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(kFrframedata, 0); + const Frame &freeFrame = freeFrames[3*from + offset]; + + Frame *exFrames = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata, 0); + Frame &exFrame = exFrames[3*to + offset]; + + exFrame.width = freeFrame.width; + exFrame.height = freeFrame.height; + exFrame.x = freeFrame.x; + exFrame.y = freeFrame.y; + uint16 byteCount = freeFrame.width * freeFrame.height; + + const uint8 *src = getSegment(data.word(kFreeframes)).ptr(kFrframes + freeFrame.ptr(), byteCount); + uint8 *dst = getSegment(data.word(kExtras)).ptr(kExframes + data.word(kExframepos), byteCount); + memcpy(dst, src, byteCount); + + exFrame.setPtr(data.word(kExframepos)); + data.word(kExframepos) += byteCount; +} + } // End of namespace DreamGen -- cgit v1.2.3