Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DREAMWEB: Port 'intoinv', 'outofinv' to C++
- Loading branch information
Showing
5 changed files
with
86 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -562,5 +562,87 @@ void DreamBase::removeObFromInv() { | |
deleteExObject(data.byte(kCommand)); | ||
} | ||
|
||
void DreamGenContext::inToInv() { | ||
if (!data.byte(kPickup)) { | ||
outOfInv(); | ||
return; | ||
} | ||
|
||
findInvPos(); | ||
ax = es.word(bx); | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bluegr
Author
Member
|
||
if (al != 255) { | ||
swapWithInv(); | ||
return; | ||
} | ||
|
||
al = data.byte(kItemframe); | ||
ah = data.byte(kObjecttype); | ||
|
||
if (ax == data.word(kOldsubject) && data.byte(kCommandtype) != 220) | ||
data.byte(kCommandtype) = 220; | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
wjp
Contributor
|
||
data.word(kOldsubject) = ax; | ||
commandWithOb(35, data.byte(kObjecttype), data.byte(kItemframe)); | ||
|
||
if (data.word(kMousebutton) == data.word(kOldbutton) || !(data.word(kMousebutton) & 1)) | ||
return; // notletgo2 | ||
|
||
delPointer(); | ||
DynObject *object = getExAd(data.byte(kItemframe)); | ||
object->mapad[0] = 4; | ||
object->mapad[1] = 255; | ||
object->mapad[2] = data.byte(kLastinvpos); | ||
data.byte(kPickup) = 0; | ||
fillRyan(); | ||
readMouse(); | ||
showPointer(); | ||
outOfInv(); | ||
workToScreen(); | ||
delPointer(); | ||
} | ||
|
||
void DreamGenContext::outOfInv() { | ||
findInvPos(); | ||
ax = es.word(bx); | ||
|
||
if (al == 255) { | ||
blank(); | ||
return; | ||
} | ||
|
||
if (data.word(kMousebutton) == 2) { | ||
reExFromInv(); | ||
return; | ||
} | ||
|
||
if (ax == data.word(kOldsubject) && data.byte(kCommandtype) != 221) | ||
data.byte(kCommandtype) = 221; | ||
|
||
data.word(kOldsubject) = ax; | ||
commandWithOb(36, ah, al); | ||
|
||
if (data.word(kMousebutton) == data.word(kOldbutton)) | ||
return; // notletgo | ||
|
||
if (!(data.word(kMousebutton) & 1)) | ||
return; | ||
|
||
delPointer(); | ||
data.byte(kPickup) = 1; | ||
findInvPos(); | ||
ax = es.word(bx); | ||
data.byte(kItemframe) = al; | ||
data.byte(kObjecttype) = ah; | ||
DynObject *object = getExAd(data.byte(kItemframe)); | ||
object->mapad[0] = 20; | ||
object->mapad[1] = 255; | ||
fillRyan(); | ||
readMouse(); | ||
showPointer(); | ||
inToInv(); | ||
workToScreen(); | ||
delPointer(); | ||
} | ||
|
||
} // End of namespace DreamGen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -375,5 +375,7 @@ | |
} | ||
void signOn(); | ||
void lookAtPlace(); | ||
void inToInv(); | ||
void outOfInv(); | ||
|
||
#endif |
Why are you using ax/es/bx here, instead of the return value of findInvPosCPP for bx, getSegment(data.word(kBuffers)) for es, and a regular local for ax, given that its value is only used for the al != 255 check directly below? (swapWithInv doesn't use ax as input.) Same question for the other usage of ax further down, and also for outOfInv.