DREAMWEB: Convert rollEndCredits/rollEndCredits2 to C++

This commit is contained in:
Max Horn 2011-12-12 13:15:04 +01:00
parent 5d80fda3a4
commit af85b85a84
9 changed files with 59 additions and 107 deletions

View file

@ -625,6 +625,8 @@ generator = cpp(context, "DreamGen", blacklist = [
'restoreems', 'restoreems',
'restorereels', 'restorereels',
'rockstar', 'rockstar',
'rollendcredits',
'rollendcredits2',
'roomname', 'roomname',
'runintroseq', 'runintroseq',
'saveems', 'saveems',

View file

@ -114,6 +114,7 @@ public:
void showReelFrame(Reel *reel); void showReelFrame(Reel *reel);
const Frame *getReelFrameAX(uint16 frame); const Frame *getReelFrameAX(uint16 frame);
void soundOnReels(uint16 reelPointer); void soundOnReels(uint16 reelPointer);
void rollEndCredits();
// from stubs.cpp // from stubs.cpp
void crosshair(); void crosshair();
@ -148,6 +149,7 @@ public:
void panelIcons1(); void panelIcons1();
SetObject *getSetAd(uint8 index); SetObject *getSetAd(uint8 index);
void *getAnyAd(uint8 *value1, uint8 *value2); void *getAnyAd(uint8 *value1, uint8 *value2);
const uint8 *getTextInFile1(uint16 index);
// from use.cpp // from use.cpp
void placeFreeObject(uint8 index); void placeFreeObject(uint8 index);

View file

@ -546,99 +546,6 @@ notendseq:
rollEndCredits(); rollEndCredits();
} }
void DreamGenContext::rollEndCredits() {
STACK_CHECK;
al = 16;
ah = 255;
playChannel0();
data.byte(kVolume) = 7;
data.byte(kVolumeto) = 0;
data.byte(kVolumedirection) = -1;
cl = 160;
ch = 160;
di = 75;
bx = 20;
ds = data.word(kMapstore);
si = 0;
multiGet();
es = data.word(kTextfile1);
si = 3*2;
ax = es.word(si);
si = ax;
_add(si, (66*2));
cx = 254;
endcredits1:
push(cx);
bx = 10;
cx = data.word(kLinespacing);
endcredits2:
push(cx);
push(si);
push(di);
push(es);
push(bx);
vSync();
cl = 160;
ch = 160;
di = 75;
bx = 20;
ds = data.word(kMapstore);
si = 0;
multiPut();
vSync();
bx = pop();
es = pop();
di = pop();
si = pop();
push(si);
push(di);
push(es);
push(bx);
cx = 18;
onelot:
push(cx);
di = 75;
dx = 161;
ax = 0;
printDirect();
_add(bx, data.word(kLinespacing));
cx = pop();
if (--cx)
goto onelot;
vSync();
cl = 160;
ch = 160;
di = 75;
bx = 20;
multiDump();
bx = pop();
es = pop();
di = pop();
si = pop();
cx = pop();
_dec(bx);
if (--cx)
goto endcredits2;
cx = pop();
looknext:
al = es.byte(si);
_inc(si);
_cmp(al, ':');
if (flags.z())
goto gotnext;
_cmp(al, 0);
if (flags.z())
goto gotnext;
goto looknext;
gotnext:
if (--cx)
goto endcredits1;
cx = 100;
hangOn();
panelToMap();
fadeScreenUpHalf();
}
void DreamGenContext::checkForExit() { void DreamGenContext::checkForExit() {
STACK_CHECK; STACK_CHECK;
cl = data.byte(kRyanx); cl = data.byte(kRyanx);
@ -928,11 +835,6 @@ halfend:
data.byte(kNumtofade) = 32; data.byte(kNumtofade) = 32;
} }
void DreamGenContext::rollEndCredits2() {
STACK_CHECK;
rollEm();
}
void DreamGenContext::rollEm() { void DreamGenContext::rollEm() {
STACK_CHECK; STACK_CHECK;
cl = 160; cl = 160;

View file

@ -546,14 +546,12 @@ public:
void pickupConts(); void pickupConts();
void nextColon(); void nextColon();
void findInvPos(); void findInvPos();
void rollEndCredits();
void getKeyAndLogo(); void getKeyAndLogo();
void selectOb(); void selectOb();
void receptionist(); void receptionist();
void selectSlot(); void selectSlot();
void fadeUpMon(); void fadeUpMon();
void showDiaryPage(); void showDiaryPage();
void transferToEx();
void reExFromInv(); void reExFromInv();
void businessMan(); void businessMan();
void outOfInv(); void outOfInv();
@ -587,7 +585,6 @@ public:
void drawItAll(); void drawItAll();
void useStereo(); void useStereo();
void showDiaryKeys(); void showDiaryKeys();
void rollEndCredits2();
void useOpened(); void useOpened();
void signOn(); void signOn();
void locationPic(); void locationPic();
@ -620,6 +617,7 @@ public:
void swapWithInv(); void swapWithInv();
void useControl(); void useControl();
void adjustRight(); void adjustRight();
void transferToEx();
void updateSymbolTop(); void updateSymbolTop();
void getPersonText(); void getPersonText();
void parser(); void parser();

View file

@ -122,11 +122,10 @@ uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWid
void DreamGenContext::printDirect() { void DreamGenContext::printDirect() {
uint16 y = bx; uint16 y = bx;
uint16 initialSi = si;
const uint8 *initialString = es.ptr(si, 0); const uint8 *initialString = es.ptr(si, 0);
const uint8 *string = initialString; const uint8 *string = initialString;
al = DreamBase::printDirect(&string, di, &y, dl, (bool)(dl & 1)); al = DreamBase::printDirect(&string, di, &y, dl, (bool)(dl & 1));
si = initialSi + (string - initialString); si += (string - initialString);
bx = y; bx = y;
} }

View file

@ -759,6 +759,50 @@ void DreamGenContext::intro3Text() {
setupTimedTemp(46, 82, 36, 56, 100, 1); setupTimedTemp(46, 82, 36, 56, 100, 1);
} }
void DreamBase::rollEndCredits() {
playChannel0(16, 255);
data.byte(kVolume) = 7;
data.byte(kVolumeto) = 0;
data.byte(kVolumedirection) = -1;
multiGet(mapStore(), 75, 20, 160, 160);
const uint8 *string = getTextInFile1(3);
const int linespacing = data.word(kLinespacing);
for (int i = 0; i < 254; ++i) {
// Output the text, initially with an offset of 10 pixels,
// then move it up one pixel until we shifted it by a complete
// line of text.
for (int j = 0; j < linespacing; ++j) {
vSync();
multiPut(mapStore(), 75, 20, 160, 160);
vSync();
// Output up to 18 lines of text
uint16 y = 10 - j;
const uint8 *tmp_str = string;
for (int k = 0; k < 18; ++j) {
DreamBase::printDirect(&tmp_str, 75, &y, 160 + 1, true);
y += linespacing;
}
vSync();
multiDump(75, 20, 160, 160);
}
// Skip to the next text line
byte c;
do {
c = *string++;
} while (c != ':' && c != 0);
}
hangOn(100);
panelToMap();
fadeScreenUpHalf();
}
void DreamGenContext::monks2text() { void DreamGenContext::monks2text() {
bool isGermanCD = isCD() && engine->getLanguage() == Common::DE_DEU; bool isGermanCD = isCD() && engine->getLanguage() == Common::DE_DEU;

View file

@ -2482,9 +2482,10 @@ void DreamGenContext::setLocation() {
setLocation(al); setLocation(al);
} }
const uint8 *DreamGenContext::getTextInFile1(uint16 index) { const uint8 *DreamBase::getTextInFile1(uint16 index) {
uint16 offset = getSegment(data.word(kTextfile1)).word(index * 2) + kTextstart; SegmentRef text = getSegment(data.word(kTextfile1));
const uint8 *string = getSegment(data.word(kTextfile1)).ptr(offset, 0); uint16 offset = text.word(index * 2) + kTextstart;
const uint8 *string = text.ptr(offset, 0);
return string; return string;
} }

View file

@ -369,7 +369,6 @@
void getLocation(); void getLocation();
void setLocation(uint8 index); void setLocation(uint8 index);
void setLocation(); void setLocation();
const uint8 *getTextInFile1(uint16 index);
void loadTempText(); void loadTempText();
void loadTempText(const char *fileName); void loadTempText(const char *fileName);
void loadTravelText(); void loadTravelText();
@ -568,5 +567,6 @@
void showPuzText(uint16 command, uint16 count); void showPuzText(uint16 command, uint16 count);
void showPuzText(); void showPuzText();
void monkSpeaking(); void monkSpeaking();
void rollEndCredits2();
#endif #endif

View file

@ -248,4 +248,8 @@ void DreamGenContext::showGroup() {
cx = 0; cx = 0;
} }
void DreamGenContext::rollEndCredits2() {
rollEm();
}
} // End of namespace DreamGen } // End of namespace DreamGen