DREAMWEB: Port 'intoinv', 'outofinv' to C++

This commit is contained in:
Filippos Karapetis 2011-12-19 03:23:16 +02:00
parent 9916d2e99c
commit f0eee81d32
5 changed files with 86 additions and 114 deletions

View File

@ -509,6 +509,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'input',
'interupttest',
'interviewer',
'intoinv',
'intro',
'intro1text',
'intro2text',
@ -638,6 +639,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'openyourneighbour',
'othersmoker',
'out22c',
'outofinv',
'paltoendpal',
'paltostartpal',
'panelicons1',

View File

@ -691,118 +691,6 @@ actuallyswap:
delPointer();
}
void DreamGenContext::inToInv() {
STACK_CHECK;
_cmp(data.byte(kPickup), 0);
if (!flags.z())
goto notout;
outOfInv();
return;
notout:
findInvPos();
ax = es.word(bx);
_cmp(al, 255);
if (flags.z())
goto canplace1;
swapWithInv();
return;
canplace1:
al = data.byte(kItemframe);
ah = data.byte(kObjecttype);
_cmp(ax, data.word(kOldsubject));
if (!flags.z())
goto difsub1;
_cmp(data.byte(kCommandtype), 220);
if (flags.z())
goto alreadyplce;
data.byte(kCommandtype) = 220;
difsub1:
data.word(kOldsubject) = ax;
bx = ax;
al = 35;
commandWithOb();
alreadyplce:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
if (flags.z())
return /* (notletgo2) */;
_and(ax, 1);
if (!flags.z())
goto doplace;
return;
doplace:
delPointer();
al = data.byte(kItemframe);
getExAd();
es.byte(bx+2) = 4;
es.byte(bx+3) = 255;
al = data.byte(kLastinvpos);
es.byte(bx+4) = al;
data.byte(kPickup) = 0;
fillRyan();
readMouse();
showPointer();
outOfInv();
workToScreen();
delPointer();
}
void DreamGenContext::outOfInv() {
STACK_CHECK;
findInvPos();
ax = es.word(bx);
_cmp(al, 255);
if (!flags.z())
goto canpick2;
blank();
return;
canpick2:
bx = data.word(kMousebutton);
_cmp(bx, 2);
if (!flags.z())
goto canpick2a;
reExFromInv();
return;
canpick2a:
_cmp(ax, data.word(kOldsubject));
if (!flags.z())
goto difsub3;
_cmp(data.byte(kCommandtype), 221);
if (flags.z())
goto alreadygrab;
data.byte(kCommandtype) = 221;
difsub3:
data.word(kOldsubject) = ax;
bx = ax;
al = 36;
commandWithOb();
alreadygrab:
ax = data.word(kMousebutton);
_cmp(ax, data.word(kOldbutton));
if (flags.z())
return /* (notletgo) */;
_and(ax, 1);
if (!flags.z())
goto dograb;
return;
dograb:
delPointer();
data.byte(kPickup) = 1;
findInvPos();
ax = es.word(bx);
data.byte(kItemframe) = al;
data.byte(kObjecttype) = ah;
getExAd();
es.byte(bx+2) = 20;
es.byte(bx+3) = 255;
fillRyan();
readMouse();
showPointer();
inToInv();
workToScreen();
delPointer();
}
void DreamGenContext::getFreeAd() {
STACK_CHECK;
ah = 0;

View File

@ -477,13 +477,11 @@ public:
void startTalk();
void getAnyAd();
void reminders();
void inToInv();
void getFreeAd();
void dirFile();
void pickupConts();
void fadeUpMon();
void reExFromInv();
void outOfInv();
void transferMap();
void purgeAnItem();
void purgeALocation();

View File

@ -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);
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;
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

View File

@ -375,5 +375,7 @@
}
void signOn();
void lookAtPlace();
void inToInv();
void outOfInv();
#endif