DREAMWEB: Cleaned up findFirstPath(), fixed a regression and moved it to DreamBase

This commit is contained in:
Filippos Karapetis 2011-12-26 02:50:02 +02:00
parent 9ba55105fc
commit 7945a0fbb0
5 changed files with 26 additions and 32 deletions

View file

@ -341,32 +341,6 @@ void DreamGenContext::openOb() {
_openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx;
}
uint8 DreamGenContext::findFirstPath(uint16 param) {
es = data.word(kReels);
uint16 ptr = 144 * data.byte(kRoomnum);
// TODO: Replace ax, cx usage with temporary uint8/16 variables...
cx = param;
for (uint8 pathLoop = 0; pathLoop < 12; pathLoop++, ptr += 8) {
ax = es.word(ptr+2);
if (ax == 0x0ffff)
continue; // "nofirst"
if (cl < al || ch < ah)
continue; // "nofirst"
ax = es.word(ptr+4);
if (cl > al || ch > ah)
continue; // "nofirst"
return es.byte(ptr+6); // "gotfirst"
}
return 0;
}
void DreamGenContext::identifyOb() {
if (data.word(kWatchingtime) != 0) {
blank();
@ -388,7 +362,7 @@ void DreamGenContext::identifyOb() {
data.byte(kPointerspath) = dl;
ax = pop();
push(ax);
data.byte(kPointerfirstpath) = findFirstPath(ax);
data.byte(kPointerfirstpath) = findFirstPath(al, ah);
ax = pop();
byte x = al;