DREAMWEB: Move openInvList, ryanInvList out of buffers

This commit is contained in:
Willem Jan Palenstijn 2011-12-26 16:57:27 +01:00
parent 017c1ed993
commit c86a830c4a
7 changed files with 367 additions and 364 deletions

View File

@ -210,6 +210,7 @@ p = parser(skip_binary_data = [
'timer1to', 'timer1to',
'timer2to', 'timer2to',
'timer3to', 'timer3to',
'oldsubject',
# vgagrafx.asm # vgagrafx.asm
'cityname', 'cityname',
'extragraphics1', 'extragraphics1',

View File

@ -69,6 +69,7 @@ protected:
// from object.cpp // from object.cpp
uint16 _openChangeSize; uint16 _openChangeSize;
ObjectRef _oldSubject;
// from pathfind.cpp // from pathfind.cpp
Common::Point _lineData[200]; // Output of Bresenham Common::Point _lineData[200]; // Output of Bresenham
@ -86,8 +87,8 @@ protected:
// from Buffers // from Buffers
uint8 _textUnder[kUnderTextBufSize]; uint8 _textUnder[kUnderTextBufSize];
// _openInvList (see fillOpen/findOpenPos) ObjectRef _openInvList[16];
// _ryanInvList (see findInvPos/findInvPosCPP) ObjectRef _ryanInvList[30];
uint8 _pointerBack[32*32]; uint8 _pointerBack[32*32];
uint8 _mapFlags[11*10*3]; uint8 _mapFlags[11*10*3];
uint8 _startPal[3*256]; uint8 _startPal[3*256];
@ -199,7 +200,7 @@ public:
// from object.cpp // from object.cpp
void obIcons(); void obIcons();
void fillRyan(); void fillRyan();
void findAllRyan(uint8 *inv); void findAllRyan();
void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y);
void obPicture(); void obPicture();
void removeObFromInv(); void removeObFromInv();
@ -211,12 +212,13 @@ public:
void wornError(); void wornError();
void makeWorn(DynObject *object); void makeWorn(DynObject *object);
void dropObject(); void dropObject();
uint16 findOpenPos(); ObjectRef findOpenPos();
byte getOpenedSlotSize(); byte getOpenedSlotSize();
byte getOpenedSlotCount(); byte getOpenedSlotCount();
void openOb(); void openOb();
void findAllOpen(); void findAllOpen();
void fillOpen(); void fillOpen();
ObjectRef findInvPos();
// from pathfind.cpp // from pathfind.cpp
void turnPathOn(uint8 param); void turnPathOn(uint8 param);

View File

@ -154,7 +154,7 @@ void DreamGenContext::read() {
return; return;
okcom: okcom:
es = cs; es = cs;
di = 422; di = 420;
ax = data.word(kTextfile1); ax = data.word(kTextfile1);
data.word(kMonsource) = ax; data.word(kMonsource) = ax;
ds = ax; ds = ax;
@ -284,7 +284,7 @@ keyok2:
ds = cs; ds = cs;
si = offset_operand1+1; si = offset_operand1+1;
es = cs; es = cs;
di = 422+1; di = 420+1;
cx = 12; cx = 12;
_movsb(cx, true); _movsb(cx, true);
monitorLogo(); monitorLogo();
@ -366,7 +366,7 @@ void DreamGenContext::parser() {
al = '='; al = '=';
_stosb(); _stosb();
ds = cs; ds = cs;
si = 497; si = 495;
notspace1: notspace1:
_lodsw(); _lodsw();
_cmp(al, 32); _cmp(al, 32);
@ -410,18 +410,18 @@ void DreamGenContext::__start() {
//0x0050: .... .... .... .... //0x0050: .... .... .... ....
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, 0x00,
//0x0060: .... .... .... .... //0x0060: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0070: .... ...h .&.. .... //0x0070: .... .h.& .... ....
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, 0x00,
//0x0080: .... .... .... .... //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, 0x00,
//0x0090: .... .... .... .... //0x0090: .... .... .... ....
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x00a0: .... .... .... .... //0x00a0: .... .... .... ....
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, 0x00,
//0x00b0: .... .... .... .... //0x00b0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x00c0: .... .. .... .... //0x00c0: .... .. .... ....
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, 0x00,
//0x00d0: .... .... .... .... //0x00d0: .... .... .... ....
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, 0x00,
@ -436,26 +436,26 @@ void DreamGenContext::__start() {
//0x0120: .... .... .... .... //0x0120: .... .... .... ....
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, 0x00,
//0x0130: .... .... .... .... //0x0130: .... .... .... ....
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0140: .... .... .... .... //0x0140: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
//0x0150: .... .... .... .... //0x0150: .... .... .... ....
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0x00,
//0x0160: .... .... .... .... //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, 0x00,
//0x0170: .... .... .... .... //0x0170: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x44, 0x52, 0x45, 0x41, 0x4d, 0x57, 0x45,
//0x0180: .... .... ...D REAM //0x0180: .... .... .DRE AMWE
0x57, 0x45, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x42, 0x2e, 0x56, 0x39, 0x39, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x0190: WEB. V99. //0x0190: B.V9 9.
0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x01a0: ." //0x01a0: . "
0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01,
//0x01b0: . .... $... .... //0x01b0: ... ..$. .... ....
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44,
//0x01c0: .... .... .... .... //0x01c0: .... .... .... ...D
0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x01d0: .D:. .... .... .... //0x01d0: :... .... .... ....
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, 0x00,
//0x01e0: .... .... .... .... //0x01e0: .... .... .... ....
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, 0x00,
@ -474,7 +474,7 @@ void DreamGenContext::__start() {
//0x0250: .... .... .... .... //0x0250: .... .... .... ....
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, 0x00,
//0x0260: .... .... .... .... //0x0260: .... .... .... ....
0x00, 0x00, 0x00, 0x00, }; 0x00, 0x00, };
ds.assign(src, src + sizeof(src)); ds.assign(src, src + sizeof(src));
dreamweb(); dreamweb();
} }

View File

@ -32,7 +32,7 @@
namespace DreamGen { namespace DreamGen {
static const uint16 offset_operand1 = 0x0198; static const uint16 offset_operand1 = 0x0196;
static const uint16 kStartvars = 0; static const uint16 kStartvars = 0;
static const uint16 kProgresspoints = 1; static const uint16 kProgresspoints = 1;
static const uint16 kWatchon = 2; static const uint16 kWatchon = 2;
@ -106,225 +106,224 @@ static const uint16 kIconleft = 86;
static const uint16 kItemframe = 88; static const uint16 kItemframe = 88;
static const uint16 kItemtotran = 89; static const uint16 kItemtotran = 89;
static const uint16 kRoomad = 90; static const uint16 kRoomad = 90;
static const uint16 kOldsubject = 92; static const uint16 kWithobject = 92;
static const uint16 kWithobject = 94; static const uint16 kWithtype = 93;
static const uint16 kWithtype = 95; static const uint16 kLookcounter = 94;
static const uint16 kLookcounter = 96; static const uint16 kCommand = 96;
static const uint16 kCommand = 98; static const uint16 kCommandtype = 97;
static const uint16 kCommandtype = 99; static const uint16 kOldcommandtype = 98;
static const uint16 kOldcommandtype = 100; static const uint16 kObjecttype = 99;
static const uint16 kObjecttype = 101; static const uint16 kGetback = 100;
static const uint16 kGetback = 102; static const uint16 kInvopen = 101;
static const uint16 kInvopen = 103; static const uint16 kMainmode = 102;
static const uint16 kMainmode = 104; static const uint16 kPickup = 103;
static const uint16 kPickup = 105; static const uint16 kLastinvpos = 104;
static const uint16 kLastinvpos = 106; static const uint16 kExamagain = 105;
static const uint16 kExamagain = 107; static const uint16 kNewtextline = 106;
static const uint16 kNewtextline = 108; static const uint16 kOpenedob = 107;
static const uint16 kOpenedob = 109; static const uint16 kOpenedtype = 108;
static const uint16 kOpenedtype = 110; static const uint16 kOldmapadx = 109;
static const uint16 kOldmapadx = 111; static const uint16 kOldmapady = 111;
static const uint16 kOldmapady = 113; static const uint16 kMapadx = 113;
static const uint16 kMapadx = 115; static const uint16 kMapady = 115;
static const uint16 kMapady = 117; static const uint16 kMapoffsetx = 117;
static const uint16 kMapoffsetx = 119; static const uint16 kMapoffsety = 119;
static const uint16 kMapoffsety = 121; static const uint16 kMapxstart = 121;
static const uint16 kMapxstart = 123; static const uint16 kMapystart = 123;
static const uint16 kMapystart = 125; static const uint16 kMapxsize = 125;
static const uint16 kMapxsize = 127; static const uint16 kMapysize = 126;
static const uint16 kMapysize = 128; static const uint16 kHavedoneobs = 127;
static const uint16 kHavedoneobs = 129; static const uint16 kManisoffscreen = 128;
static const uint16 kManisoffscreen = 130; static const uint16 kRainspace = 129;
static const uint16 kRainspace = 131; static const uint16 kFacing = 130;
static const uint16 kFacing = 132; static const uint16 kLeavedirection = 131;
static const uint16 kLeavedirection = 133; static const uint16 kTurntoface = 132;
static const uint16 kTurntoface = 134; static const uint16 kTurndirection = 133;
static const uint16 kTurndirection = 135; static const uint16 kMaintimer = 134;
static const uint16 kMaintimer = 136; static const uint16 kIntrocount = 136;
static const uint16 kIntrocount = 138; static const uint16 kArrowad = 137;
static const uint16 kArrowad = 139; static const uint16 kCurrentkey = 139;
static const uint16 kCurrentkey = 141; static const uint16 kOldkey = 140;
static const uint16 kOldkey = 142; static const uint16 kUseddirection = 141;
static const uint16 kUseddirection = 143; static const uint16 kTimercount = 142;
static const uint16 kTimercount = 144; static const uint16 kOldtimercount = 143;
static const uint16 kOldtimercount = 145; static const uint16 kMapx = 144;
static const uint16 kMapx = 146; static const uint16 kMapy = 145;
static const uint16 kMapy = 147; static const uint16 kNewscreen = 146;
static const uint16 kNewscreen = 148; static const uint16 kRyanx = 147;
static const uint16 kRyanx = 149; static const uint16 kRyany = 148;
static const uint16 kRyany = 150; static const uint16 kLastflag = 149;
static const uint16 kLastflag = 151; static const uint16 kOffsetx = 150;
static const uint16 kOffsetx = 152; static const uint16 kOffsety = 152;
static const uint16 kOffsety = 154; static const uint16 kCurrentob = 154;
static const uint16 kCurrentob = 156; static const uint16 kDestpos = 155;
static const uint16 kDestpos = 157; static const uint16 kReallocation = 156;
static const uint16 kReallocation = 158; static const uint16 kRoomnum = 157;
static const uint16 kRoomnum = 159; static const uint16 kNowinnewroom = 158;
static const uint16 kNowinnewroom = 160; static const uint16 kResetmanxy = 159;
static const uint16 kResetmanxy = 161; static const uint16 kNewlocation = 160;
static const uint16 kNewlocation = 162; static const uint16 kAutolocation = 161;
static const uint16 kAutolocation = 163; static const uint16 kDoorcheck1 = 162;
static const uint16 kDoorcheck1 = 164; static const uint16 kDoorcheck2 = 163;
static const uint16 kDoorcheck2 = 165; static const uint16 kDoorcheck3 = 164;
static const uint16 kDoorcheck3 = 166; static const uint16 kDoorcheck4 = 165;
static const uint16 kDoorcheck4 = 167; static const uint16 kMousex = 166;
static const uint16 kMousex = 168; static const uint16 kMousey = 168;
static const uint16 kMousey = 170; static const uint16 kMousebutton = 170;
static const uint16 kMousebutton = 172; static const uint16 kMousebutton1 = 172;
static const uint16 kMousebutton1 = 174; static const uint16 kMousebutton2 = 174;
static const uint16 kMousebutton2 = 176; static const uint16 kMousebutton3 = 176;
static const uint16 kMousebutton3 = 178; static const uint16 kMousebutton4 = 178;
static const uint16 kMousebutton4 = 180; static const uint16 kOldbutton = 180;
static const uint16 kOldbutton = 182; static const uint16 kOldx = 182;
static const uint16 kOldx = 184; static const uint16 kOldy = 184;
static const uint16 kOldy = 186; static const uint16 kLastbutton = 186;
static const uint16 kLastbutton = 188; static const uint16 kOldpointerx = 188;
static const uint16 kOldpointerx = 190; static const uint16 kOldpointery = 190;
static const uint16 kOldpointery = 192; static const uint16 kDelherex = 192;
static const uint16 kDelherex = 194; static const uint16 kDelherey = 194;
static const uint16 kDelherey = 196; static const uint16 kPointerxs = 196;
static const uint16 kPointerxs = 198; static const uint16 kPointerys = 197;
static const uint16 kPointerys = 199; static const uint16 kDelxs = 198;
static const uint16 kDelxs = 200; static const uint16 kDelys = 199;
static const uint16 kDelys = 201; static const uint16 kPointerframe = 200;
static const uint16 kPointerframe = 202; static const uint16 kPointerpower = 201;
static const uint16 kPointerpower = 203; static const uint16 kAuxpointerframe = 202;
static const uint16 kAuxpointerframe = 204; static const uint16 kPointermode = 203;
static const uint16 kPointermode = 205; static const uint16 kPointerspeed = 204;
static const uint16 kPointerspeed = 206; static const uint16 kPointercount = 205;
static const uint16 kPointercount = 207; static const uint16 kInmaparea = 206;
static const uint16 kInmaparea = 208; static const uint16 kTalkmode = 207;
static const uint16 kTalkmode = 209; static const uint16 kTalkpos = 208;
static const uint16 kTalkpos = 210; static const uint16 kCharacter = 209;
static const uint16 kCharacter = 211; static const uint16 kWatchdump = 210;
static const uint16 kWatchdump = 212; static const uint16 kLogonum = 211;
static const uint16 kLogonum = 213; static const uint16 kOldlogonum = 212;
static const uint16 kOldlogonum = 214; static const uint16 kNetseg = 213;
static const uint16 kNetseg = 215; static const uint16 kNetpoint = 215;
static const uint16 kNetpoint = 217; static const uint16 kCursorstate = 217;
static const uint16 kCursorstate = 219; static const uint16 kPressed = 218;
static const uint16 kPressed = 220; static const uint16 kPresspointer = 219;
static const uint16 kPresspointer = 221; static const uint16 kGraphicpress = 221;
static const uint16 kGraphicpress = 223; static const uint16 kPresscount = 222;
static const uint16 kPresscount = 224; static const uint16 kLightcount = 223;
static const uint16 kLightcount = 225; static const uint16 kFolderpage = 224;
static const uint16 kFolderpage = 226; static const uint16 kDiarypage = 225;
static const uint16 kDiarypage = 227; static const uint16 kMenucount = 226;
static const uint16 kMenucount = 228; static const uint16 kSymboltopx = 227;
static const uint16 kSymboltopx = 229; static const uint16 kSymboltopnum = 228;
static const uint16 kSymboltopnum = 230; static const uint16 kSymboltopdir = 229;
static const uint16 kSymboltopdir = 231; static const uint16 kSymbolbotx = 230;
static const uint16 kSymbolbotx = 232; static const uint16 kSymbolbotnum = 231;
static const uint16 kSymbolbotnum = 233; static const uint16 kSymbolbotdir = 232;
static const uint16 kSymbolbotdir = 234; static const uint16 kSymboltolight = 233;
static const uint16 kSymboltolight = 235; static const uint16 kSymbol1 = 234;
static const uint16 kSymbol1 = 236; static const uint16 kSymbol2 = 235;
static const uint16 kSymbol2 = 237; static const uint16 kSymbol3 = 236;
static const uint16 kSymbol3 = 238; static const uint16 kSymbolnum = 237;
static const uint16 kSymbolnum = 239; static const uint16 kDumpx = 238;
static const uint16 kDumpx = 240; static const uint16 kDumpy = 240;
static const uint16 kDumpy = 242; static const uint16 kWalkandexam = 242;
static const uint16 kWalkandexam = 244; static const uint16 kWalkexamtype = 243;
static const uint16 kWalkexamtype = 245; static const uint16 kWalkexamnum = 244;
static const uint16 kWalkexamnum = 246; static const uint16 kCurslocx = 245;
static const uint16 kCurslocx = 247; static const uint16 kCurslocy = 247;
static const uint16 kCurslocy = 249; static const uint16 kCurpos = 249;
static const uint16 kCurpos = 251; static const uint16 kMonadx = 251;
static const uint16 kMonadx = 253; static const uint16 kMonady = 253;
static const uint16 kMonady = 255; static const uint16 kMonsource = 255;
static const uint16 kMonsource = 257; static const uint16 kNumtodo = 257;
static const uint16 kNumtodo = 259; static const uint16 kTimecount = 259;
static const uint16 kTimecount = 261; static const uint16 kCounttotimed = 261;
static const uint16 kCounttotimed = 263; static const uint16 kTimedseg = 263;
static const uint16 kTimedseg = 265; static const uint16 kTimedoffset = 265;
static const uint16 kTimedoffset = 267; static const uint16 kTimedy = 267;
static const uint16 kTimedy = 269; static const uint16 kTimedx = 268;
static const uint16 kTimedx = 270; static const uint16 kNeedtodumptimed = 269;
static const uint16 kNeedtodumptimed = 271; static const uint16 kLoadingorsave = 270;
static const uint16 kLoadingorsave = 272; static const uint16 kCurrentslot = 271;
static const uint16 kCurrentslot = 273; static const uint16 kCursorpos = 272;
static const uint16 kCursorpos = 274; static const uint16 kColourpos = 273;
static const uint16 kColourpos = 275; static const uint16 kFadedirection = 274;
static const uint16 kFadedirection = 276; static const uint16 kNumtofade = 275;
static const uint16 kNumtofade = 277; static const uint16 kFadecount = 276;
static const uint16 kFadecount = 278; static const uint16 kAddtogreen = 277;
static const uint16 kAddtogreen = 279; static const uint16 kAddtored = 278;
static const uint16 kAddtored = 280; static const uint16 kAddtoblue = 279;
static const uint16 kAddtoblue = 281; static const uint16 kLastsoundreel = 280;
static const uint16 kLastsoundreel = 282; static const uint16 kSpeechloaded = 282;
static const uint16 kSpeechloaded = 284; static const uint16 kSpeechlength = 283;
static const uint16 kSpeechlength = 285; static const uint16 kVolume = 285;
static const uint16 kVolume = 287; static const uint16 kVolumeto = 286;
static const uint16 kVolumeto = 288; static const uint16 kVolumedirection = 287;
static const uint16 kVolumedirection = 289; static const uint16 kVolumecount = 288;
static const uint16 kVolumecount = 290; static const uint16 kWongame = 289;
static const uint16 kWongame = 291; static const uint16 kLasthardkey = 290;
static const uint16 kLasthardkey = 292; static const uint16 kBufferin = 291;
static const uint16 kBufferin = 293; static const uint16 kBufferout = 293;
static const uint16 kBufferout = 295; static const uint16 kExtras = 295;
static const uint16 kExtras = 297; static const uint16 kWorkspace = 297;
static const uint16 kWorkspace = 299; static const uint16 kMapstore = 299;
static const uint16 kMapstore = 301; static const uint16 kCharset1 = 301;
static const uint16 kCharset1 = 303; static const uint16 kBuffers = 303;
static const uint16 kBuffers = 305; static const uint16 kMainsprites = 305;
static const uint16 kMainsprites = 307; static const uint16 kBackdrop = 307;
static const uint16 kBackdrop = 309; static const uint16 kMapdata = 309;
static const uint16 kMapdata = 311; static const uint16 kSounddata = 311;
static const uint16 kSounddata = 313; static const uint16 kSounddata2 = 313;
static const uint16 kSounddata2 = 315; static const uint16 kRecordspace = 315;
static const uint16 kRecordspace = 317; static const uint16 kFreedat = 317;
static const uint16 kFreedat = 319; static const uint16 kSetdat = 319;
static const uint16 kSetdat = 321; static const uint16 kReel1 = 321;
static const uint16 kReel1 = 323; static const uint16 kReel2 = 323;
static const uint16 kReel2 = 325; static const uint16 kReel3 = 325;
static const uint16 kReel3 = 327; static const uint16 kRoomdesc = 327;
static const uint16 kRoomdesc = 329; static const uint16 kFreedesc = 329;
static const uint16 kFreedesc = 331; static const uint16 kSetdesc = 331;
static const uint16 kSetdesc = 333; static const uint16 kBlockdesc = 333;
static const uint16 kBlockdesc = 335; static const uint16 kSetframes = 335;
static const uint16 kSetframes = 337; static const uint16 kFreeframes = 337;
static const uint16 kFreeframes = 339; static const uint16 kPeople = 339;
static const uint16 kPeople = 341; static const uint16 kReels = 341;
static const uint16 kReels = 343; static const uint16 kCommandtext = 343;
static const uint16 kCommandtext = 345; static const uint16 kPuzzletext = 345;
static const uint16 kPuzzletext = 347; static const uint16 kTraveltext = 347;
static const uint16 kTraveltext = 349; static const uint16 kTempgraphics = 349;
static const uint16 kTempgraphics = 351; static const uint16 kTempgraphics2 = 351;
static const uint16 kTempgraphics2 = 353; static const uint16 kTempgraphics3 = 353;
static const uint16 kTempgraphics3 = 355; static const uint16 kTempsprites = 355;
static const uint16 kTempsprites = 357; static const uint16 kTextfile1 = 357;
static const uint16 kTextfile1 = 359; static const uint16 kTextfile2 = 359;
static const uint16 kTextfile2 = 361; static const uint16 kTextfile3 = 361;
static const uint16 kTextfile3 = 363; static const uint16 kBlinkframe = 363;
static const uint16 kBlinkframe = 365; static const uint16 kBlinkcount = 364;
static const uint16 kBlinkcount = 366; static const uint16 kReasseschanges = 365;
static const uint16 kReasseschanges = 367; static const uint16 kPointerspath = 366;
static const uint16 kPointerspath = 368; static const uint16 kManspath = 367;
static const uint16 kManspath = 369; static const uint16 kPointerfirstpath = 368;
static const uint16 kPointerfirstpath = 370; static const uint16 kFinaldest = 369;
static const uint16 kFinaldest = 371; static const uint16 kDestination = 370;
static const uint16 kDestination = 372; static const uint16 kLinestartx = 371;
static const uint16 kLinestartx = 373; static const uint16 kLinestarty = 373;
static const uint16 kLinestarty = 375; static const uint16 kLineendx = 375;
static const uint16 kLineendx = 377; static const uint16 kLineendy = 377;
static const uint16 kLineendy = 379; static const uint16 kLinepointer = 379;
static const uint16 kLinepointer = 381; static const uint16 kLinedirection = 380;
static const uint16 kLinedirection = 382; static const uint16 kLinelength = 381;
static const uint16 kLinelength = 383; static const uint16 kCh0blockstocopy = 382;
static const uint16 kCh0blockstocopy = 384; static const uint16 kCh0playing = 384;
static const uint16 kCh0playing = 386; static const uint16 kCh0repeat = 385;
static const uint16 kCh0repeat = 387; static const uint16 kCh1playing = 386;
static const uint16 kCh1playing = 388; static const uint16 kCh1blockstocopy = 387;
static const uint16 kCh1blockstocopy = 389; static const uint16 kSoundbufferwrite = 389;
static const uint16 kSoundbufferwrite = 391; static const uint16 kCurrentsample = 391;
static const uint16 kCurrentsample = 393; static const uint16 kRoomssample = 392;
static const uint16 kRoomssample = 394; static const uint16 kBasicsample = 393;
static const uint16 kBasicsample = 395; static const uint16 kCurrentfile = 420;
static const uint16 kCurrentfile = 422; static const uint16 kInputline = 495;
static const uint16 kInputline = 497; static const uint16 kQuitrequested = 623;
static const uint16 kQuitrequested = 625; static const uint16 kSubtitles = 624;
static const uint16 kSubtitles = 626; static const uint16 kForeignrelease = 625;
static const uint16 kForeignrelease = 627;
static const uint16 kBlocktextdat = (0); static const uint16 kBlocktextdat = (0);
static const uint16 kPersonframes = (0); static const uint16 kPersonframes = (0);
static const uint16 kDebuglevel1 = (0); static const uint16 kDebuglevel1 = (0);

View File

@ -29,30 +29,28 @@ void DreamBase::showRyanPage() {
showFrame(engine->icons1(), kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0); showFrame(engine->icons1(), kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0);
} }
void DreamBase::findAllRyan(uint8 *inv) { void DreamBase::findAllRyan() {
memset(inv, 0xff, 60); memset(_ryanInvList, 0xff, 60);
for (size_t i = 0; i < kNumexobjects; ++i) { for (size_t i = 0; i < kNumexobjects; ++i) {
DynObject *extra = getExAd(i); const DynObject *extra = getExAd(i);
if (extra->mapad[0] != 4) if (extra->mapad[0] != kExObjectType)
continue; continue;
if (extra->mapad[1] != 0xff) if (extra->mapad[1] != 0xff)
continue; continue;
uint8 slot = extra->mapad[2]; uint8 slot = extra->mapad[2];
assert(slot < 30); assert(slot < 30);
inv[2 * slot + 0] = i; _ryanInvList[slot]._index = i;
inv[2 * slot + 1] = 4; _ryanInvList[slot]._type = kExObjectType;
} }
} }
void DreamBase::fillRyan() { void DreamBase::fillRyan() {
uint8 *inv = getSegment(data.word(kBuffers)).ptr(kRyaninvlist, 60); ObjectRef *inv = &_ryanInvList[data.byte(kRyanpage) * 10];
findAllRyan(inv); findAllRyan();
inv += data.byte(kRyanpage) * 2 * 10;
for (size_t i = 0; i < 2; ++i) { for (size_t i = 0; i < 2; ++i) {
for (size_t j = 0; j < 5; ++j) { for (size_t j = 0; j < 5; ++j) {
uint8 objIndex = *inv++; obToInv(inv->_index, inv->_type, kInventx + j * kItempicsize, kInventy + i * kItempicsize);
uint8 objType = *inv++; ++inv;
obToInv(objIndex, objType, kInventx + j * kItempicsize, kInventy + i * kItempicsize);
} }
} }
showRyanPage(); showRyanPage();
@ -350,35 +348,30 @@ void DreamGenContext::identifyOb() {
blank(); blank();
} }
uint16 DreamGenContext::findInvPosCPP() { ObjectRef DreamBase::findInvPos() {
uint16 x = data.word(kMousex) - kInventx; uint16 x = data.word(kMousex) - kInventx;
uint16 y = data.word(kMousey) - kInventy; uint16 y = data.word(kMousey) - kInventy;
uint16 pos = (x / kItempicsize) + (y / kItempicsize) * 5; uint8 pos = (x / kItempicsize) + (y / kItempicsize) * 5;
uint16 invPos = data.byte(kRyanpage) * 10 + pos; uint8 invPos = data.byte(kRyanpage) * 10 + pos;
data.byte(kLastinvpos) = invPos & 0xFF; data.byte(kLastinvpos) = invPos;
return invPos * 2 + kRyaninvlist; return _ryanInvList[invPos];
}
void DreamGenContext::findInvPos() {
bx = findInvPosCPP();
es = data.word(kBuffers);
} }
void DreamGenContext::selectOb() { void DreamGenContext::selectOb() {
uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); ObjectRef objectId = findInvPos();
if ((objectId & 0xFF) == 255) { if (objectId._index == 255) {
blank(); blank();
return; return;
} }
data.byte(kWithobject) = objectId & 0x00FF; data.byte(kWithobject) = objectId._index;
data.byte(kWithtype) = objectId >> 8; data.byte(kWithtype) = objectId._type;
if (objectId != data.word(kOldsubject) || data.byte(kCommandtype) != 221) { if (objectId != _oldSubject || data.byte(kCommandtype) != 221) {
if (objectId == data.word(kOldsubject)) if (objectId == _oldSubject)
data.byte(kCommandtype) = 221; data.byte(kCommandtype) = 221;
data.word(kOldsubject) = objectId; _oldSubject = objectId;
commandWithOb(0, data.byte(kWithtype), data.byte(kWithobject)); commandWithOb(0, objectId._type, objectId._index);
} }
if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
@ -514,20 +507,21 @@ void DreamGenContext::inToInv() {
return; return;
} }
uint16 subject = getSegment(data.word(kBuffers)).word(findInvPosCPP()); ObjectRef subject = findInvPos();
if ((subject & 0xFF) != 255) { if (subject._index != 255) {
swapWithInv(); swapWithInv();
return; return;
} }
subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); subject._type = data.byte(kObjecttype);
subject._index = data.byte(kItemframe);
if (subject != data.word(kOldsubject) || data.byte(kCommandtype) != 220) { if (subject != _oldSubject || data.byte(kCommandtype) != 220) {
if (subject == data.word(kOldsubject)) if (subject == _oldSubject)
data.byte(kCommandtype) = 220; data.byte(kCommandtype) = 220;
data.word(kOldsubject) = subject; _oldSubject = subject;
commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); commandWithOb(35, subject._type, subject._index);
} }
if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
@ -548,9 +542,9 @@ void DreamGenContext::inToInv() {
} }
void DreamGenContext::outOfInv() { void DreamGenContext::outOfInv() {
uint16 subject = getSegment(data.word(kBuffers)).word(findInvPosCPP()); ObjectRef subject = findInvPos();
if ((subject & 0xFF) == 255) { if (subject._index == 255) {
blank(); blank();
return; return;
} }
@ -560,13 +554,11 @@ void DreamGenContext::outOfInv() {
return; return;
} }
if (subject != data.word(kOldsubject) || data.byte(kCommandtype) != 221) { if (subject != _oldSubject || data.byte(kCommandtype) != 221) {
if (subject == data.word(kOldsubject)) if (subject == _oldSubject)
data.byte(kCommandtype) = 221; data.byte(kCommandtype) = 221;
data.word(kOldsubject) = subject; _oldSubject = subject;
byte type = subject >> 8; commandWithOb(36, subject._type, subject._index);
byte frame = subject & 0xFF;
commandWithOb(36, type, frame);
} }
if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
@ -574,10 +566,11 @@ void DreamGenContext::outOfInv() {
delPointer(); delPointer();
data.byte(kPickup) = 1; data.byte(kPickup) = 1;
subject = getSegment(data.word(kBuffers)).word(findInvPosCPP()); subject = findInvPos();
data.byte(kObjecttype) = subject >> 8; data.byte(kObjecttype) = subject._type;
data.byte(kItemframe) = subject & 0xFF; data.byte(kItemframe) = subject._index;
DynObject *object = getExAd(data.byte(kItemframe)); assert(subject._type == kExObjectType);
DynObject *object = getExAd(subject._index);
object->mapad[0] = 20; object->mapad[0] = 20;
object->mapad[1] = 255; object->mapad[1] = 255;
fillRyan(); fillRyan();
@ -782,24 +775,26 @@ void DreamGenContext::selectOpenOb() {
} }
void DreamGenContext::reExFromInv() { void DreamGenContext::reExFromInv() {
uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); ObjectRef objectId = findInvPos();
data.byte(kCommandtype) = objectId >> 8; data.byte(kCommandtype) = objectId._type;
data.byte(kCommand) = objectId & 0x00FF; data.byte(kCommand) = objectId._index;
data.byte(kExamagain) = 1; data.byte(kExamagain) = 1;
data.byte(kPointermode) = 0; data.byte(kPointermode) = 0;
} }
void DreamGenContext::swapWithInv() { void DreamGenContext::swapWithInv() {
uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); ObjectRef subject;
if (subject == data.word(kOldsubject)) { subject._type = data.byte(kObjecttype);
subject._index = data.byte(kItemframe);
if (subject == _oldSubject) {
if (data.byte(kCommandtype) != 243) { if (data.byte(kCommandtype) != 243) {
data.byte(kCommandtype) = 243; data.byte(kCommandtype) = 243;
data.word(kOldsubject) = subject; _oldSubject = subject;
commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); commandWithOb(34, subject._type, subject._index);
} }
} else { } else {
data.word(kOldsubject) = subject; _oldSubject = subject;
commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); commandWithOb(34, subject._type, subject._index);
} }
if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
@ -807,9 +802,9 @@ void DreamGenContext::swapWithInv() {
byte prevType = data.byte(kObjecttype); byte prevType = data.byte(kObjecttype);
byte prevFrame = data.byte(kItemframe); byte prevFrame = data.byte(kItemframe);
uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP()); ObjectRef objectId = findInvPos();
data.byte(kItemframe) = objectId & 0x00FF; data.byte(kItemframe) = objectId._index;
data.byte(kObjecttype) = objectId >> 8; data.byte(kObjecttype) = objectId._type;
DynObject *object = getEitherAdCPP(); DynObject *object = getEitherAdCPP();
object->mapad[0] = 20; object->mapad[0] = 20;
object->mapad[1] = 255; object->mapad[1] = 255;
@ -817,7 +812,6 @@ void DreamGenContext::swapWithInv() {
byte prevFrame2 = data.byte(kItemframe); byte prevFrame2 = data.byte(kItemframe);
data.byte(kObjecttype) = prevType; data.byte(kObjecttype) = prevType;
data.byte(kItemframe) = prevFrame; data.byte(kItemframe) = prevFrame;
//findInvPosCPP(); // found in the original source, but it seems to be useless
delPointer(); delPointer();
object = getEitherAdCPP(); object = getEitherAdCPP();
object->mapad[0] = 4; object->mapad[0] = 4;
@ -841,9 +835,9 @@ void DreamGenContext::useOpened() {
return; return;
} }
uint16 objectId = getSegment(data.word(kBuffers)).word(findOpenPos()); ObjectRef objectId = findOpenPos();
if ((objectId & 0x00FF) != 255) { if (objectId._index != 255) {
swapWithOpen(); swapWithOpen();
return; return;
} }
@ -853,16 +847,17 @@ void DreamGenContext::useOpened() {
return; return;
} }
objectId = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); objectId._type = data.byte(kObjecttype);
if (objectId == data.word(kOldsubject)) { objectId._index = data.byte(kItemframe);
if (objectId == _oldSubject) {
if (data.byte(kCommandtype) != 227) { if (data.byte(kCommandtype) != 227) {
data.byte(kCommandtype) = 227; data.byte(kCommandtype) = 227;
data.word(kOldsubject) = objectId; _oldSubject = objectId;
commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); commandWithOb(35, objectId._type, objectId._index);
} }
} else { } else {
data.word(kOldsubject) = objectId; _oldSubject = objectId;
commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); commandWithOb(35, objectId._type, objectId._index);
} }
if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
@ -903,22 +898,22 @@ void DreamGenContext::outOfOpen() {
if (data.byte(kOpenedob) == 255) if (data.byte(kOpenedob) == 255)
return; // cannot use opened object return; // cannot use opened object
uint16 objectId = getSegment(data.word(kBuffers)).word(findOpenPos()); ObjectRef objectId = findOpenPos();
if ((objectId & 0x00FF) == 255) { if (objectId._index == 255) {
blank(); blank();
return; return;
} }
if (objectId == data.word(kOldsubject)) { if (objectId == _oldSubject) {
if (data.byte(kCommandtype) != 228) { if (data.byte(kCommandtype) != 228) {
data.byte(kCommandtype) = 228; data.byte(kCommandtype) = 228;
data.word(kOldsubject) = objectId; _oldSubject = objectId;
commandWithOb(36, objectId >> 8, objectId & 0x00FF); commandWithOb(36, objectId._type, objectId._index);
} }
} else { } else {
data.word(kOldsubject) = objectId; _oldSubject = objectId;
commandWithOb(36, objectId >> 8, objectId & 0x00FF); commandWithOb(36, objectId._type, objectId._index);
} }
if (data.word(kMousebutton) == data.word(kOldbutton)) if (data.word(kMousebutton) == data.word(kOldbutton))
@ -934,13 +929,13 @@ void DreamGenContext::outOfOpen() {
delPointer(); delPointer();
data.byte(kPickup) = 1; data.byte(kPickup) = 1;
objectId = getSegment(data.word(kBuffers)).word(findOpenPos()); objectId = findOpenPos();
data.byte(kObjecttype) = objectId >> 8; data.byte(kObjecttype) = objectId._type;
data.byte(kItemframe) = objectId & 0xFF; data.byte(kItemframe) = objectId._index;
if (data.byte(kObjecttype) != 4) { if (data.byte(kObjecttype) != kExObjectType) {
data.byte(kItemframe) = transferToEx(); data.byte(kItemframe) = transferToEx();
data.byte(kObjecttype) = 4; data.byte(kObjecttype) = kExObjectType;
} }
DynObject *object = getEitherAdCPP(); DynObject *object = getEitherAdCPP();
@ -957,16 +952,18 @@ void DreamGenContext::outOfOpen() {
} }
void DreamGenContext::swapWithOpen() { void DreamGenContext::swapWithOpen() {
uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); ObjectRef subject;
if (subject == data.word(kOldsubject)) { subject._type = data.byte(kObjecttype);
subject._index = data.byte(kItemframe);
if (subject == _oldSubject) {
if (data.byte(kCommandtype) != 242) { if (data.byte(kCommandtype) != 242) {
data.byte(kCommandtype) = 242; data.byte(kCommandtype) = 242;
data.word(kOldsubject) = subject; _oldSubject = subject;
commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); commandWithOb(34, subject._type, subject._index);
} }
} else { } else {
data.word(kOldsubject) = subject; _oldSubject = subject;
commandWithOb(34, data.byte(kObjecttype), data.byte(kItemframe)); commandWithOb(34, subject._type, subject._index);
} }
if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1))
@ -990,13 +987,13 @@ void DreamGenContext::swapWithOpen() {
byte prevType = data.byte(kObjecttype); byte prevType = data.byte(kObjecttype);
byte prevFrame = data.byte(kItemframe); byte prevFrame = data.byte(kItemframe);
uint16 objectId = getSegment(data.word(kBuffers)).word(findOpenPos()); ObjectRef objectId = findOpenPos();
data.byte(kObjecttype) = objectId >> 8; data.byte(kObjecttype) = objectId._type;
data.byte(kItemframe) = objectId & 0xFF; data.byte(kItemframe) = objectId._index;
if (data.byte(kObjecttype) != 4) { if (data.byte(kObjecttype) != kExObjectType) {
data.byte(kItemframe) = transferToEx(); data.byte(kItemframe) = transferToEx();
data.byte(kObjecttype) = 4; data.byte(kObjecttype) = kExObjectType;
} }
DynObject *object = getEitherAdCPP(); DynObject *object = getEitherAdCPP();
@ -1007,7 +1004,6 @@ void DreamGenContext::swapWithOpen() {
byte prevFrame2 = data.byte(kItemframe); byte prevFrame2 = data.byte(kItemframe);
data.byte(kObjecttype) = prevType; data.byte(kObjecttype) = prevType;
data.byte(kItemframe) = prevFrame; data.byte(kItemframe) = prevFrame;
//findOpenPos(); // was in the original source, looks to be unused
object = getEitherAdCPP(); object = getEitherAdCPP();
object->mapad[0] = data.byte(kOpenedtype); object->mapad[0] = data.byte(kOpenedtype);
object->mapad[1] = data.byte(kOpenedob); object->mapad[1] = data.byte(kOpenedob);
@ -1025,11 +1021,11 @@ void DreamGenContext::swapWithOpen() {
delPointer(); delPointer();
} }
uint16 DreamBase::findOpenPos() { ObjectRef DreamBase::findOpenPos() {
uint16 pos = (data.word(kMousex) - kInventx) / kItempicsize; uint8 pos = (data.word(kMousex) - kInventx) / kItempicsize;
data.byte(kLastinvpos) = pos & 0xFF; data.byte(kLastinvpos) = pos;
return pos * 2 + kOpeninvlist; // return the object position in the inventory data return _openInvList[pos];
} }
byte DreamGenContext::transferToEx() { byte DreamGenContext::transferToEx() {
@ -1063,24 +1059,19 @@ void DreamBase::fillOpen() {
if (size > 4) if (size > 4)
size = 4; size = 4;
findAllOpen(); findAllOpen();
uint8 *openInvList = getSegment(data.word(kBuffers)).ptr(kOpeninvlist, 32);
for (uint8 i = 0; i < size; ++i) { for (uint8 i = 0; i < size; ++i) {
uint8 index = openInvList[2*i]; uint8 index = _openInvList[i]._index;
uint8 type = openInvList[2*i + 1]; uint8 type = _openInvList[i]._type;
obToInv(index, type, kInventx + i * kItempicsize, kInventy + 96); obToInv(index, type, kInventx + i * kItempicsize, kInventy + 96);
} }
underTextLine(); underTextLine();
} }
void DreamBase::findAllOpen() { void DreamBase::findAllOpen() {
uint8 *openInvList = getSegment(data.word(kBuffers)).ptr(kOpeninvlist, 32); memset(_openInvList, 0xFF, 32);
memset(openInvList, 0xFF, 32); for (uint8 i = 0; i < kNumexobjects; ++i) {
const DynObject *obj = getExAd(i);
const DynObject *obj;
obj = (const DynObject *)getSegment(data.word(kExtras)).ptr(kExdata, 0);
for (uint8 i = 0; i < kNumexobjects; ++i, ++obj) {
if (obj->mapad[1] != data.byte(kOpenedob)) if (obj->mapad[1] != data.byte(kOpenedob))
continue; continue;
if (obj->mapad[0] != data.byte(kOpenedtype)) if (obj->mapad[0] != data.byte(kOpenedtype))
@ -1089,19 +1080,19 @@ void DreamBase::findAllOpen() {
continue; continue;
uint8 slot = obj->mapad[2]; uint8 slot = obj->mapad[2];
assert(slot < 16); assert(slot < 16);
openInvList[2*slot] = i; _openInvList[slot]._index = i;
openInvList[2*slot + 1] = kExObjectType; _openInvList[slot]._type = kExObjectType;
} }
obj = (const DynObject *)getSegment(data.word(kFreedat)).ptr(0, 0); for (uint8 i = 0; i < 80; ++i) {
for (uint8 i = 0; i < 80; ++i, ++obj) { const DynObject *obj = getFreeAd(i);
if (obj->mapad[1] != data.byte(kOpenedob)) if (obj->mapad[1] != data.byte(kOpenedob))
continue; continue;
if (obj->mapad[0] != data.byte(kOpenedtype)) if (obj->mapad[0] != data.byte(kOpenedtype))
continue; continue;
uint8 index = obj->mapad[2]; uint8 slot = obj->mapad[2];
openInvList[2*index] = i; _openInvList[slot]._index = i;
openInvList[2*index + 1] = kFreeObjectType; _openInvList[slot]._type = kFreeObjectType;
} }
} }

View File

@ -281,6 +281,18 @@ enum ObjectTypes {
kExObjectType = 4 kExObjectType = 4
}; };
struct ObjectRef {
uint8 _index;
uint8 _type; // enum ObjectTypes
bool operator==(const ObjectRef &r) const {
return _index == r._index && _type == r._type;
}
bool operator!=(const ObjectRef &r) const {
return _index != r._index || _type != r._type;
}
};
} // End of namespace DreamWeb } // End of namespace DreamWeb
#endif #endif

View File

@ -121,8 +121,6 @@
bool checkObjectSizeCPP(); bool checkObjectSizeCPP();
void identifyOb(); void identifyOb();
void selectOb(); void selectOb();
void findInvPos();
uint16 findInvPosCPP();
void setPickup(); void setPickup();
void getKeyAndLogo(); void getKeyAndLogo();
void signOn(); void signOn();