DREAMWEB: Port 'locationpic', 'reexfrominv' to C++

This commit is contained in:
Filippos Karapetis 2011-12-25 16:33:30 +02:00
parent 3802b21183
commit e322d6257d
8 changed files with 29 additions and 62 deletions

View file

@ -577,6 +577,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'loadtempcharset',
'loadtemptext',
'loadtraveltext',
'locationpic',
'lockeddoorway',
'locklightoff',
'locklighton',
@ -727,6 +728,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'redes',
'redrawmainscrn',
'reelsonscreen',
'reexfrominv',
'reexfromopen',
'reminders',
'removeemm',

View file

@ -284,16 +284,6 @@ findopen2a:
goto findopen1a;
}
void DreamGenContext::reExFromInv() {
STACK_CHECK;
findInvPos();
ax = es.word(bx);
data.byte(kCommandtype) = ah;
data.byte(kCommand) = al;
data.byte(kExamagain) = 1;
data.byte(kPointermode) = 0;
}
void DreamGenContext::swapWithInv() {
STACK_CHECK;
al = data.byte(kItemframe);
@ -881,54 +871,6 @@ cantpurge2:
goto lookforpurge2;
}
void DreamGenContext::locationPic() {
STACK_CHECK;
getDestInfo();
al = es.byte(si);
push(es);
push(si);
di = 0;
_cmp(al, 6);
if (!flags.c())
goto secondlot;
ds = data.word(kTempgraphics);
_add(al, 4);
goto gotgraphic;
secondlot:
_sub(al, 6);
ds = data.word(kTempgraphics2);
gotgraphic:
_add(di, 104);
bx = 138+14;
ah = 0;
showFrame();
si = pop();
es = pop();
al = data.byte(kDestpos);
_cmp(al, data.byte(kReallocation));
if (!flags.z())
goto notinthisone;
al = 3;
di = 104;
bx = 140+14;
ds = data.word(kTempgraphics);
ah = 0;
showFrame();
notinthisone:
bl = data.byte(kDestpos);
bh = 0;
_add(bx, bx);
es = data.word(kTraveltext);
si = es.word(bx);
_add(si, (66*2));
di = 50;
bx = 20;
dl = 241;
al = 0;
ah = 0;
printDirect();
}
void DreamGenContext::getDestInfo() {
STACK_CHECK;
al = data.byte(kDestpos);

View file

@ -461,7 +461,6 @@ public:
void getFreeAd();
void dirFile();
void pickupConts();
void reExFromInv();
void transferMap();
void purgeAnItem();
void getSetAd();
@ -471,7 +470,6 @@ public:
void fillOpen();
void getEitherAd();
void useOpened();
void locationPic();
void swapWithOpen();
void dreamweb();
void findPathOfPoint();

View file

@ -34,7 +34,7 @@ void DreamGenContext::newPlace() {
}
}
// TODO: Move to DreamBase once locationPic is moved
// TODO: Move to DreamBase once getDestInfo is moved
void DreamGenContext::selectLocation() {
data.byte(kInmaparea) = 0;
clearBeforeLoad();
@ -270,6 +270,20 @@ void DreamBase::readCityPic() {
loadIntoTemp("DREAMWEB.G04");
}
void DreamGenContext::locationPic() {
getDestInfo();
byte destFlag = es.byte(si);
if (destFlag >= 6)
showFrame(tempGraphics2(), 104, 138 + 14, destFlag - 6, 0); // Second slot
else
showFrame(tempGraphics(), 104, 138 + 14, destFlag + 4, 0);
if (data.byte(kDestpos) == data.byte(kReallocation))
showFrame(tempGraphics(), 104, 140 + 14, 3, 0); // Currently in this location
uint16 offset = kTextstart + getSegment(data.word(kTraveltext)).word(data.byte(kDestpos) * 2);
const uint8 *string = getSegment(data.word(kTraveltext)).ptr(offset, 0);
DreamBase::printDirect(string, 50, 20, 241, 241 & 1);
}
} // End of namespace DreamGen

View file

@ -826,4 +826,12 @@ void DreamGenContext::selectOpenOb() {
delPointer();
}
void DreamGenContext::reExFromInv() {
uint16 objectId = getSegment(data.word(kBuffers)).word(findInvPosCPP());
data.byte(kCommandtype) = objectId >> 8;
data.byte(kCommand) = objectId & 0x00FF;
data.byte(kExamagain) = 1;
data.byte(kPointermode) = 0;
}
} // End of namespace DreamGen

View file

@ -3700,4 +3700,5 @@ void DreamBase::incRyanPage() {
delPointer();
}
} // End of namespace DreamGen

View file

@ -193,5 +193,7 @@
void outOfInv();
void selectOpenOb();
void selectLocation();
void reExFromInv();
void locationPic();
#endif

View file

@ -242,7 +242,7 @@ void DreamBase::playGuitar() {
putBackObStuff();
}
// TODO: Move to DreamBase once selectLocation (in reality, locationPic) is moved
// TODO: Move to DreamBase once selectLocation (in reality, getDestInfo) is moved
void DreamGenContext::useElevator1() {
showFirstUse();
selectLocation();