diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 65 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/object.cpp | 59 | ||||
-rw-r--r-- | engines/dreamweb/people.cpp | 4 | ||||
-rw-r--r-- | engines/dreamweb/structs.h | 7 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 16 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/use.cpp | 2 |
8 files changed, 74 insertions, 81 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 72f2feca0e..04276c001e 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -519,71 +519,6 @@ foundmatch: bx = pop(); } -void DreamGenContext::setPickup() { - STACK_CHECK; - _cmp(data.byte(kObjecttype), 1); - if (flags.z()) - goto cantpick; - _cmp(data.byte(kObjecttype), 3); - if (flags.z()) - goto cantpick; - getAnyAd(); - al = es.byte(bx+2); - _cmp(al, 4); - if (!flags.z()) - goto canpick; -cantpick: - blank(); - return; -canpick: - _cmp(data.byte(kCommandtype), 209); - if (flags.z()) - goto alreadysp; - data.byte(kCommandtype) = 209; - bl = data.byte(kCommand); - bh = data.byte(kObjecttype); - al = 33; - commandWithOb(); -alreadysp: - ax = data.word(kMousebutton); - _cmp(ax, 1); - if (!flags.z()) - return /* (nosetpick) */; - _cmp(ax, data.word(kOldbutton)); - if (!flags.z()) - goto dosetpick; - return; -dosetpick: - createPanel(); - showPanel(); - showMan(); - showExit(); - examIcon(); - data.byte(kPickup) = 1; - data.byte(kInvopen) = 2; - _cmp(data.byte(kObjecttype), 4); - if (flags.z()) - goto pickupexob; - al = data.byte(kCommand); - data.byte(kItemframe) = al; - data.byte(kOpenedob) = 255; - transferToEx(); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = 4; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; - openInv(); - workToScreenM(); - return; -pickupexob: - al = data.byte(kCommand); - data.byte(kItemframe) = al; - data.byte(kOpenedob) = 255; - openInv(); - workToScreenM(); -} - void DreamGenContext::reExFromInv() { STACK_CHECK; findInvPos(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 29cd6e39ab..cbf4d558c8 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -506,7 +506,6 @@ public: void fillOpen(); void deleteExObject(); void getEitherAd(); - void setPickup(); void dropObject(); void showDiaryKeys(); void useOpened(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index e4abac14f2..4daa5091a5 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -108,10 +108,10 @@ void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { } void DreamBase::obPicture() { - if (data.byte(kObjecttype) == 1) + if (data.byte(kObjecttype) == kSetObjectType1) return; Frame *frames; - if (data.byte(kObjecttype) == 4) + if (data.byte(kObjecttype) == kExObjectType) frames = (Frame *)getSegment(data.word(kExtras)).ptr(0, 0); else frames = (Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); @@ -133,6 +133,7 @@ void DreamBase::obIcons() { void DreamGenContext::examineOb(bool examineAgain) { data.byte(kPointermode) = 0; data.word(kTimecount) = 0; + while (true) { if (examineAgain) { data.byte(kInmaparea) = 0; @@ -140,8 +141,7 @@ void DreamGenContext::examineOb(bool examineAgain) { data.byte(kOpenedob) = 255; data.byte(kOpenedtype) = 255; data.byte(kInvopen) = 0; - al = data.byte(kCommandtype); - data.byte(kObjecttype) = al; + data.byte(kObjecttype) = data.byte(kCommandtype); data.byte(kItemframe) = 0; data.byte(kPointerframe) = 0; createPanel(); @@ -167,6 +167,7 @@ void DreamGenContext::examineOb(bool examineAgain) { dumpTextLine(); delPointer(); data.byte(kGetback) = 0; + switch (data.byte(kInvopen)) { case 0: { RectWithCallback examList[] = { @@ -207,6 +208,7 @@ void DreamGenContext::examineOb(bool examineAgain) { break; } } + if (data.byte(kQuitrequested) != 0) break; if (data.byte(kExamagain) != 0) @@ -426,4 +428,53 @@ void DreamGenContext::selectOb() { } } +void DreamGenContext::setPickup() { + if (data.byte(kObjecttype) != kSetObjectType1 && data.byte(kObjecttype) != kSetObjectType3) { + // The original called getAnyAd() here. However, since object types + // 1 and 3 are excluded, the resulting object is a DynObject, so + // we can use getEitherAd() instead. + DynObject *object = getEitherAdCPP(); + if (object->mapad[0] == 4) { + blank(); + return; + } + } else { + blank(); + return; + } + + if (data.byte(kCommandtype) != 209) { + data.byte(kCommandtype) = 209; + commandWithOb(33, data.byte(kObjecttype), data.byte(kCommand)); + } + + if (data.word(kMousebutton) == 1 && data.word(kMousebutton) == data.word(kOldbutton)) + return; + + createPanel(); + showPanel(); + showMan(); + showExit(); + examIcon(); + data.byte(kPickup) = 1; + data.byte(kInvopen) = 2; + + if (data.byte(kObjecttype) != kExObjectType) { + data.byte(kItemframe) = data.byte(kCommand); + data.byte(kOpenedob) = 255; + transferToEx(); + data.byte(kItemframe) = data.byte(kCommand); + data.byte(kObjecttype) = kExObjectType; + DynObject *object = getEitherAdCPP(); + object->mapad[0] = 20; + object->mapad[1] = 255; + } else { + data.byte(kItemframe) = data.byte(kCommand); + data.byte(kOpenedob) = 255; + } + + openInv(); + workToScreenM(); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index af92d07439..8998e2f394 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -941,10 +941,10 @@ void DreamGenContext::mugger(ReelRoutine &routine) { findXYFromPath(); data.byte(kResetmanxy) = 1; data.byte(kCommand) = findExObject("WETA"); - data.byte(kObjecttype) = 4; + data.byte(kObjecttype) = kExObjectType; removeObFromInv(); data.byte(kCommand) = findExObject("WETB"); - data.byte(kObjecttype) = 4; + data.byte(kObjecttype) = kExObjectType; removeObFromInv(); makeMainScreen(); DreamBase::setupTimedUse(48, 70, 10, 68 - 32, 54 + 64); diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index 709a3d2a8e..d96469fbd5 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -296,6 +296,13 @@ struct Atmosphere { uint8 _repeat; }; +enum ObjectTypes { + kSetObjectType1 = 1, + kFreeObjectType = 2, + kSetObjectType3 = 3, + kExObjectType = 4 +}; + } // End of namespace DreamWeb #endif diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 7f1824d2bb..bf29cd05ea 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1354,24 +1354,24 @@ DynObject *DreamBase::getExAd(uint8 index) { } DynObject *DreamBase::getEitherAdCPP() { - if (data.byte(kObjecttype) == 4) + if (data.byte(kObjecttype) == kExObjectType) return getExAd(data.byte(kItemframe)); else return getFreeAd(data.byte(kItemframe)); } void *DreamBase::getAnyAd(uint8 *value1, uint8 *value2) { - if (data.byte(kObjecttype) == 4) { + if (data.byte(kObjecttype) == kExObjectType) { DynObject *exObject = getExAd(data.byte(kCommand)); *value1 = exObject->slotSize; *value2 = exObject->slotCount; return exObject; - } else if (data.byte(kObjecttype) == 2) { + } else if (data.byte(kObjecttype) == kFreeObjectType) { DynObject *freeObject = getFreeAd(data.byte(kCommand)); *value1 = freeObject->slotSize; *value2 = freeObject->slotCount; return freeObject; - } else { + } else { // 1 or 3. 0 should never happen SetObject *setObject = getSetAd(data.byte(kCommand)); // Note: the original returned slotCount/priority (bytes 4 and 5) // instead of slotSize/slotCount (bytes 3 and 4). @@ -1615,7 +1615,7 @@ void DreamBase::showPointer() { data.word(kOldpointery) = data.word(kMousey); if (data.byte(kPickup) == 1) { const Frame *frames; - if (data.byte(kObjecttype) != 4) + if (data.byte(kObjecttype) != kExObjectType) frames = (const Frame *)getSegment(data.word(kFreeframes)).ptr(0, 0); else frames = (const Frame *)getSegment(data.word(kExtras)).ptr(0, 0); @@ -3209,7 +3209,7 @@ void DreamBase::getBackToOps() { void DreamGenContext::pickupOb(uint8 command, uint8 pos) { data.byte(kLastinvpos) = pos; - data.byte(kObjecttype) = 2; + data.byte(kObjecttype) = kFreeObjectType; data.byte(kItemframe) = command; data.byte(kCommand) = command; getAnyAd(); @@ -3353,13 +3353,13 @@ void DreamGenContext::obsThatDoThings() { void DreamGenContext::describeOb() { const uint8 *obText = getObTextStartCPP(); uint16 y = 92; - if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1) + if (data.byte(kForeignrelease) && data.byte(kObjecttype) == kSetObjectType1) y = 82; data.word(kCharshift) = 91 + 91; printDirect(&obText, 33, &y, 241, 241 & 1); data.word(kCharshift) = 0; y = 104; - if (data.byte(kForeignrelease) && data.byte(kObjecttype) == 1) + if (data.byte(kForeignrelease) && data.byte(kObjecttype) == kSetObjectType1) y = 94; printDirect(&obText, 36, &y, 241, 241 & 1); obsThatDoThings(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 2305b93d53..e6726b664a 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -403,5 +403,6 @@ void selectOb(); void findInvPos(); uint16 findInvPosCPP(); + void setPickup(); #endif diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index 5b6e3f8dff..06cb5a9131 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -760,7 +760,7 @@ void DreamGenContext::useChurchGate() { void DreamGenContext::useGun() { - if (data.byte(kObjecttype) != 4) { + if (data.byte(kObjecttype) != kExObjectType) { // gun is not taken showSecondUse(); putBackObStuff(); |