mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-29 14:42:26 +00:00
DREAMWEB: Convert removeObFromInv, deleteExObject, deleteExFrame, deleteExText
This commit is contained in:
parent
ebbc8ae3d2
commit
8449493eff
@ -336,6 +336,9 @@ generator = cpp(context, "DreamGen", blacklist = [
|
||||
'decide',
|
||||
'delchar',
|
||||
'delcurs',
|
||||
'deleteexframe',
|
||||
'deleteextext',
|
||||
'deleteexobject',
|
||||
'deletetaken',
|
||||
'deleverything',
|
||||
'delpointer',
|
||||
@ -700,6 +703,7 @@ generator = cpp(context, "DreamGen", blacklist = [
|
||||
'removeemm',
|
||||
'removefreeobject',
|
||||
'removesetobject',
|
||||
'removeobfrominv',
|
||||
'resetkeyboard',
|
||||
'restoreall',
|
||||
'restoreems',
|
||||
|
@ -137,6 +137,10 @@ public:
|
||||
void findAllRyan(uint8 *inv);
|
||||
void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y);
|
||||
void obPicture();
|
||||
void removeObFromInv();
|
||||
void deleteExObject(uint8 index);
|
||||
void deleteExFrame(uint8 frameNum);
|
||||
void deleteExText(uint8 textNum);
|
||||
|
||||
// from pathfind.cpp
|
||||
void turnPathOn(uint8 param);
|
||||
@ -417,6 +421,7 @@ public:
|
||||
void hangOnCurs(uint16 frameCount);
|
||||
const uint8 *findObName(uint8 type, uint8 index);
|
||||
void copyName(uint8 type, uint8 index, uint8 *dst);
|
||||
uint16 findExObject(const char *id);
|
||||
|
||||
// from use.cpp
|
||||
void placeFreeObject(uint8 index);
|
||||
|
@ -985,18 +985,6 @@ notinlift:
|
||||
es.byte(bx) = al;
|
||||
}
|
||||
|
||||
void DreamGenContext::removeObFromInv() {
|
||||
STACK_CHECK;
|
||||
_cmp(data.byte(kCommand), 100);
|
||||
if (flags.z())
|
||||
return /* (obnotexist) */;
|
||||
getAnyAd();
|
||||
di = bx;
|
||||
cl = data.byte(kCommand);
|
||||
ch = 0;
|
||||
deleteExObject();
|
||||
}
|
||||
|
||||
void DreamGenContext::selectOpenOb() {
|
||||
STACK_CHECK;
|
||||
al = data.byte(kCommand);
|
||||
@ -1466,137 +1454,6 @@ cantpurge2:
|
||||
goto lookforpurge2;
|
||||
}
|
||||
|
||||
void DreamGenContext::deleteExObject() {
|
||||
STACK_CHECK;
|
||||
push(cx);
|
||||
push(cx);
|
||||
push(cx);
|
||||
push(cx);
|
||||
al = 255;
|
||||
cx = 16;
|
||||
_stosb(cx, true);
|
||||
ax = pop();
|
||||
cl = al;
|
||||
_add(al, al);
|
||||
_add(al, cl);
|
||||
deleteExFrame();
|
||||
ax = pop();
|
||||
cl = al;
|
||||
_add(al, al);
|
||||
_add(al, cl);
|
||||
_inc(al);
|
||||
deleteExFrame();
|
||||
ax = pop();
|
||||
deleteExText();
|
||||
bx = pop();
|
||||
bh = bl;
|
||||
bl = 4;
|
||||
di = (0+2080+30000);
|
||||
cx = 0;
|
||||
deleteconts:
|
||||
_cmp(es.word(di+2), bx);
|
||||
if (!flags.z())
|
||||
goto notinsideex;
|
||||
push(bx);
|
||||
push(cx);
|
||||
push(di);
|
||||
deleteExObject();
|
||||
di = pop();
|
||||
cx = pop();
|
||||
bx = pop();
|
||||
notinsideex:
|
||||
_add(di, 16);
|
||||
_inc(cx);
|
||||
_cmp(cx, (114));
|
||||
if (!flags.z())
|
||||
goto deleteconts;
|
||||
}
|
||||
|
||||
void DreamGenContext::deleteExFrame() {
|
||||
STACK_CHECK;
|
||||
di = (0);
|
||||
ah = 0;
|
||||
_add(ax, ax);
|
||||
_add(di, ax);
|
||||
_add(ax, ax);
|
||||
_add(di, ax);
|
||||
al = es.byte(di);
|
||||
ah = 0;
|
||||
cl = es.byte(di+1);
|
||||
ch = 0;
|
||||
_mul(cx);
|
||||
si = es.word(di+2);
|
||||
push(si);
|
||||
_add(si, (0+2080));
|
||||
cx = (30000);
|
||||
_sub(cx, es.word(di+2));
|
||||
di = si;
|
||||
_add(si, ax);
|
||||
push(ax);
|
||||
ds = es;
|
||||
_movsb(cx, true);
|
||||
bx = pop();
|
||||
_sub(data.word(kExframepos), bx);
|
||||
si = pop();
|
||||
cx = (114)*3;
|
||||
di = (0);
|
||||
shuffleadsdown:
|
||||
ax = es.word(di+2);
|
||||
_cmp(ax, si);
|
||||
if (flags.c())
|
||||
goto beforethisone;
|
||||
_sub(ax, bx);
|
||||
beforethisone:
|
||||
es.word(di+2) = ax;
|
||||
_add(di, 6);
|
||||
if (--cx)
|
||||
goto shuffleadsdown;
|
||||
}
|
||||
|
||||
void DreamGenContext::deleteExText() {
|
||||
STACK_CHECK;
|
||||
di = (0+2080+30000+(16*114));
|
||||
ah = 0;
|
||||
_add(ax, ax);
|
||||
_add(di, ax);
|
||||
ax = es.word(di);
|
||||
si = ax;
|
||||
di = ax;
|
||||
_add(si, (0+2080+30000+(16*114)+((114+2)*2)));
|
||||
_add(di, (0+2080+30000+(16*114)+((114+2)*2)));
|
||||
ax = 0;
|
||||
findlenextext:
|
||||
cl = es.byte(si);
|
||||
_inc(ax);
|
||||
_inc(si);
|
||||
_cmp(cl, 0);
|
||||
if (!flags.z())
|
||||
goto findlenextext;
|
||||
cx = (18000);
|
||||
bx = si;
|
||||
_sub(bx, (0+2080+30000+(16*114)+((114+2)*2)));
|
||||
push(bx);
|
||||
push(ax);
|
||||
_sub(cx, bx);
|
||||
_movsb(cx, true);
|
||||
bx = pop();
|
||||
_sub(data.word(kExtextpos), bx);
|
||||
si = pop();
|
||||
cx = (114);
|
||||
di = (0+2080+30000+(16*114));
|
||||
shuffletextads:
|
||||
ax = es.word(di);
|
||||
_cmp(ax, si);
|
||||
if (flags.c())
|
||||
goto beforethistext;
|
||||
_sub(ax, bx);
|
||||
beforethistext:
|
||||
es.word(di) = ax;
|
||||
_add(di, 2);
|
||||
if (--cx)
|
||||
goto shuffletextads;
|
||||
}
|
||||
|
||||
void DreamGenContext::startTalk() {
|
||||
STACK_CHECK;
|
||||
data.byte(kTalkmode) = 0;
|
||||
|
@ -482,9 +482,7 @@ public:
|
||||
void getAnyAd();
|
||||
void reminders();
|
||||
void inToInv();
|
||||
void deleteExText();
|
||||
void getFreeAd();
|
||||
void removeObFromInv();
|
||||
void dirFile();
|
||||
void pickupConts();
|
||||
void fadeUpMon();
|
||||
@ -496,13 +494,11 @@ public:
|
||||
void getSetAd();
|
||||
void nextColon();
|
||||
void findOpenPos();
|
||||
void deleteExFrame();
|
||||
void searchForSame();
|
||||
void rollEm();
|
||||
void lookAtPlace();
|
||||
void findAllOpen();
|
||||
void fillOpen();
|
||||
void deleteExObject();
|
||||
void getEitherAd();
|
||||
void dropObject();
|
||||
void useOpened();
|
||||
|
@ -477,4 +477,90 @@ void DreamGenContext::setPickup() {
|
||||
workToScreenM();
|
||||
}
|
||||
|
||||
void DreamGenContext::deleteExFrame() {
|
||||
deleteExFrame(al);
|
||||
}
|
||||
|
||||
void DreamBase::deleteExFrame(uint8 frameNum) {
|
||||
Frame *frame = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata + sizeof(Frame)*frameNum, sizeof(Frame));
|
||||
|
||||
uint16 frameSize = frame->width * frame->height;
|
||||
// Note: the original asm didn't subtract frameSize from remainder
|
||||
uint16 remainder = kExframeslen - frame->ptr() - frameSize;
|
||||
uint16 startOff = kExframes + frame->ptr();
|
||||
uint16 endOff = startOff + frameSize;
|
||||
|
||||
// Shift frame data after this one down
|
||||
memmove(getSegment(data.word(kExtras)).ptr(startOff, remainder), getSegment(data.word(kExtras)).ptr(endOff, remainder), remainder);
|
||||
|
||||
// Combined frame data is now frameSize smaller
|
||||
data.word(kExframepos) -= frameSize;
|
||||
|
||||
// Adjust all frame pointers pointing into the shifted data
|
||||
for (unsigned int i = 0; i < 3*kNumexobjects; ++i) {
|
||||
frame = (Frame *)getSegment(data.word(kExtras)).ptr(kExframedata + sizeof(Frame)*i, sizeof(Frame));
|
||||
if (frame->ptr() >= startOff)
|
||||
frame->setPtr(frame->ptr() - frameSize);
|
||||
}
|
||||
}
|
||||
|
||||
void DreamGenContext::deleteExText() {
|
||||
deleteExText(al);
|
||||
}
|
||||
|
||||
void DreamBase::deleteExText(uint8 textNum) {
|
||||
uint16 offset = getSegment(data.word(kExtras)).word(kExtextdat + 2*textNum);
|
||||
|
||||
uint16 startOff = kExtext + offset;
|
||||
uint16 textSize = strlen((char *)getSegment(data.word(kExtras)).ptr(startOff, 0)) + 1;
|
||||
uint16 endOff = startOff + textSize;
|
||||
uint16 remainder = kExtextlen - offset - textSize;
|
||||
|
||||
// Shift text data after this one down
|
||||
memmove(getSegment(data.word(kExtras)).ptr(startOff, remainder), getSegment(data.word(kExtras)).ptr(endOff, remainder), remainder);
|
||||
|
||||
// Combined text data is now frameSize smaller
|
||||
data.word(kExtextpos) -= textSize;
|
||||
|
||||
// Adjust all text pointers pointing into the shifted data
|
||||
for (unsigned int i = 0; i < kNumexobjects; ++i) {
|
||||
uint16 t = getSegment(data.word(kExtras)).word(kExtextdat + 2*i);
|
||||
if (t >= offset + textSize)
|
||||
getSegment(data.word(kExtras)).word(kExtextdat + 2*i) = t - textSize;
|
||||
}
|
||||
}
|
||||
|
||||
// This takes es:di and cl as input, but es:di always points to getExAd(cl)
|
||||
void DreamGenContext::deleteExObject() {
|
||||
deleteExObject(cl);
|
||||
}
|
||||
|
||||
void DreamBase::deleteExObject(uint8 index) {
|
||||
DynObject *obj = getExAd(index);
|
||||
|
||||
memset(obj, 0xFF, sizeof(DynObject));
|
||||
|
||||
deleteExFrame(3*index);
|
||||
deleteExFrame(3*index + 1);
|
||||
|
||||
deleteExText(index);
|
||||
|
||||
for (uint8 i = 0; i < kNumexobjects; ++i) {
|
||||
DynObject *t = getExAd(index);
|
||||
// Is this object contained in the one we've just deleted?
|
||||
if (t->mapad[0] == 4 && t->mapad[1] == index)
|
||||
deleteExObject(i);
|
||||
}
|
||||
}
|
||||
|
||||
void DreamBase::removeObFromInv() {
|
||||
if (data.byte(kCommand) == 100)
|
||||
return; // object doesn't exit
|
||||
|
||||
assert(data.byte(kObjecttype) == kExObjectType);
|
||||
|
||||
deleteExObject(data.byte(kCommand));
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace DreamGen
|
||||
|
@ -48,7 +48,7 @@ static void (DreamGenContext::*reelCallbacks[57])(ReelRoutine &) = {
|
||||
&DreamBase::gates, &DreamBase::introMagic3,
|
||||
&DreamBase::introMonks1, &DreamBase::candles,
|
||||
&DreamBase::introMonks2, &DreamBase::handClap,
|
||||
&DreamBase::monkAndRyan, &DreamGenContext::endGameSeq,
|
||||
&DreamBase::monkAndRyan, &DreamBase::endGameSeq,
|
||||
&DreamBase::priest, &DreamBase::madman,
|
||||
&DreamBase::madmansTelly, &DreamBase::alleyBarkSound,
|
||||
&DreamBase::foghornSound, &DreamBase::carParkDrip,
|
||||
|
@ -1734,7 +1734,7 @@ void DreamGenContext::findExObject() {
|
||||
bx = kExdata + al * 16;
|
||||
}
|
||||
|
||||
uint16 DreamGenContext::findExObject(const char *id) {
|
||||
uint16 DreamBase::findExObject(const char *id) {
|
||||
for (uint16 index = 0; index < kNumexobjects; index++) {
|
||||
if (objectMatches(getExAd(index), id))
|
||||
return index;
|
||||
|
@ -349,7 +349,9 @@
|
||||
void lookAtCard();
|
||||
bool execCommand();
|
||||
void findExObject();
|
||||
uint16 findExObject(const char *id);
|
||||
uint16 findExObject(const char *id) {
|
||||
return DreamBase::findExObject(id);
|
||||
}
|
||||
void isRyanHolding();
|
||||
bool isRyanHolding(const char *id) {
|
||||
return DreamBase::isRyanHolding(id);
|
||||
@ -371,5 +373,17 @@
|
||||
void showDiaryKeys();
|
||||
void showKeys();
|
||||
void getKeyAndLogo();
|
||||
void deleteExObject();
|
||||
void deleteExObject(uint8 index) {
|
||||
DreamBase::deleteExObject(index);
|
||||
}
|
||||
void deleteExFrame();
|
||||
void deleteExFrame(uint8 frameNum) {
|
||||
DreamBase::deleteExFrame(frameNum);
|
||||
}
|
||||
void deleteExText();
|
||||
void deleteExText(uint8 textNum) {
|
||||
DreamBase::deleteExText(textNum);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user