Skip to content

Commit

Permalink
Merge pull request #153 from fingolfin/dreamweb-cleanup
Browse files Browse the repository at this point in the history
Dreamweb: Port rollEm() to C++, remove dead code
  • Loading branch information
bluegr committed Dec 26, 2011
2 parents 7945a0f + a4643a0 commit 9a89f88
Show file tree
Hide file tree
Showing 19 changed files with 120 additions and 236 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -749,6 +749,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'restoreems',
'restorereels',
'rockstar',
'rollem',
'rollendcredits',
'rollendcredits2',
'roomname',
Expand Down
19 changes: 18 additions & 1 deletion engines/dreamweb/dreambase.h
Expand Up @@ -564,6 +564,19 @@ class DreamBase : public SegmentManager {
bool hangOnPQ();
void redes();

// from titles.cpp
void endGame();
void monkSpeaking();
void gettingShot();
void bibleQuote();
void hangOne(uint16 delay);
void intro();
void runIntroSeq();
void runEndSeq();
void loadIntroRoom();
void set16ColPalette();
void realCredits();

// from use.cpp
void placeFreeObject(uint8 index);
void removeFreeObject(uint8 index);
Expand Down Expand Up @@ -653,6 +666,8 @@ class DreamBase : public SegmentManager {
void useTrainer();
void useStereo();
void chewy();
void delEverything();
void afterIntroRoom();

// from vgafades.cpp
void clearStartPal();
Expand Down Expand Up @@ -693,7 +708,7 @@ class DreamBase : public SegmentManager {
void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height);
void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height);
void multiDump(uint16 x, uint16 y, uint8 width, uint8 height);
void workToScreenCPP();
void workToScreen();
void printUnderMon();
void cls();
void frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y);
Expand All @@ -711,6 +726,8 @@ class DreamBase : public SegmentManager {
void createPanel();
void createPanel2();
void showPanel();
void rollEndCredits2();
void rollEm();
};


Expand Down
94 changes: 0 additions & 94 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -73,100 +73,6 @@ void DreamGenContext::transferMap() {
_add(data.word(kExframepos), cx);
}

void DreamGenContext::rollEm() {
STACK_CHECK;
cl = 160;
ch = 160;
di = 25;
bx = 20;
ds = data.word(kMapstore);
si = 0;
multiGet();
es = data.word(kTextfile1);
si = 49*2;
ax = es.word(si);
si = ax;
_add(si, (66*2));
cx = 80;
endcredits21:
push(cx);
bx = 10;
cx = data.word(kLinespacing);
endcredits22:
push(cx);
push(si);
push(di);
push(es);
push(bx);
vSync();
cl = 160;
ch = 160;
di = 25;
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;
onelot2:
push(cx);
di = 25;
dx = 161;
ax = 0;
printDirect();
_add(bx, data.word(kLinespacing));
cx = pop();
if (--cx)
goto onelot2;
vSync();
cl = 160;
ch = 160;
di = 25;
bx = 20;
multiDump();
bx = pop();
es = pop();
di = pop();
si = pop();
cx = pop();
_cmp(data.byte(kLasthardkey), 1);
if (flags.z())
goto endearly2;
_dec(bx);
if (--cx)
goto endcredits22;
cx = pop();
looknext2:
al = es.byte(si);
_inc(si);
_cmp(al, ':');
if (flags.z())
goto gotnext2;
_cmp(al, 0);
if (flags.z())
goto gotnext2;
goto looknext2;
gotnext2:
_cmp(data.byte(kLasthardkey), 1);
if (flags.z())
return /* (endearly) */;
if (--cx)
goto endcredits21;
cx = 120;
hangOne();
return;
endearly2:
cx = pop();
}

void DreamGenContext::fillOpen() {
STACK_CHECK;
delTextLine();
Expand Down
1 change: 0 additions & 1 deletion engines/dreamweb/dreamgen.h
Expand Up @@ -460,7 +460,6 @@ class DreamGenContext : public DreamBase, public Context {
void pickupConts();
void transferMap();
void getSetAd();
void rollEm();
void findAllOpen();
void fillOpen();
void dreamweb();
Expand Down
2 changes: 1 addition & 1 deletion engines/dreamweb/keypad.cpp
Expand Up @@ -118,7 +118,7 @@ void DreamBase::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3
showKeypad();
readMouse();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
data.word(kPresspointer) = 0;
data.byte(kGetback) = 0;
Expand Down
6 changes: 3 additions & 3 deletions engines/dreamweb/monitor.cpp
Expand Up @@ -61,7 +61,7 @@ void DreamGenContext::useMon() {
printOuterMon();
initialMonCols();
printLogo();
workToScreenCPP();
workToScreen();
turnOnPower();
fadeUpYellows();
fadeUpMonFirst();
Expand Down Expand Up @@ -174,7 +174,7 @@ void DreamBase::monitorLogo() {
//fadeDownMon(); // FIXME: Commented out in ASM
printLogo();
printUnderMon();
workToScreenCPP();
workToScreen();
printLogo();
//fadeUpMon(); // FIXME: Commented out in ASM
printLogo();
Expand Down Expand Up @@ -291,7 +291,7 @@ void DreamBase::delCurs() {
void DreamBase::scrollMonitor() {
printLogo();
printUnderMon();
workToScreenCPP();
workToScreen();
playChannel1(25);
}

Expand Down
6 changes: 3 additions & 3 deletions engines/dreamweb/newplace.cpp
Expand Up @@ -54,7 +54,7 @@ void DreamBase::selectLocation() {
readMouse();
data.byte(kPointerframe) = 0;
showPointer();
workToScreenCPP();
workToScreen();
playChannel0(9, 255);
data.byte(kNewlocation) = 255;

Expand Down Expand Up @@ -189,7 +189,7 @@ void DreamBase::nextDest() {
underTextLine();
readMouse();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
}

Expand Down Expand Up @@ -218,7 +218,7 @@ void DreamBase::lastDest() {
underTextLine();
readMouse();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
}

Expand Down
22 changes: 7 additions & 15 deletions engines/dreamweb/object.cpp
Expand Up @@ -58,10 +58,6 @@ void DreamBase::fillRyan() {
showRyanPage();
}

void DreamGenContext::isItWorn() {
flags._z = isItWorn((const DynObject *)es.ptr(bx, sizeof(DynObject)));
}

bool DreamBase::isItWorn(const DynObject *object) {
return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A');
}
Expand Down Expand Up @@ -151,7 +147,7 @@ void DreamGenContext::examineOb(bool examineAgain) {
data.byte(kCommandtype) = 255;
readMouse();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
examineAgain = false;
}
Expand Down Expand Up @@ -255,7 +251,7 @@ void DreamGenContext::inventory() {
openInv();
readMouse();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
data.byte(kOpenedob) = 255;
examineOb(false);
Expand Down Expand Up @@ -754,10 +750,6 @@ void DreamBase::dropObject() {
object->currentLocation = data.byte(kReallocation);
}

void DreamGenContext::checkObjectSize() {
al = checkObjectSizeCPP() ? 0 : 1;
}

bool DreamGenContext::checkObjectSizeCPP() {
byte containerSize = getOpenedSlotSize();
DynObject *object = getEitherAdCPP();
Expand Down Expand Up @@ -816,7 +808,7 @@ void DreamGenContext::selectOpenOb() {
underTextLine();
readMouse();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
}

Expand Down Expand Up @@ -867,7 +859,7 @@ void DreamGenContext::swapWithInv() {
fillRyan();
readMouse();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
}

Expand Down Expand Up @@ -934,7 +926,7 @@ void DreamGenContext::useOpened() {
readMouse();
useOpened();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
}

Expand Down Expand Up @@ -992,7 +984,7 @@ void DreamGenContext::outOfOpen() {
readMouse();
useOpened();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
}

Expand Down Expand Up @@ -1062,7 +1054,7 @@ void DreamGenContext::swapWithOpen() {
readMouse();
useOpened();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
}

Expand Down
2 changes: 1 addition & 1 deletion engines/dreamweb/people.cpp
Expand Up @@ -921,7 +921,7 @@ void DreamBase::mugger(ReelRoutine &routine) {
const uint8 *string = getSegment(data.word(kPuzzletext)).ptr(offset, 0);
uint16 y = 104;
printDirect(&string, 33 + 20, &y, 241, 241 & 1);
workToScreenCPP();
workToScreen();
hangOn(300);
routine.setReelPointer(140);
data.byte(kManspath) = 2;
Expand Down
8 changes: 4 additions & 4 deletions engines/dreamweb/saveload.cpp
Expand Up @@ -133,7 +133,7 @@ void DreamBase::doLoad(int savegameId) {
data.word(kTextaddressy) = 182;
data.byte(kTextlen) = 240;
startup();
workToScreenCPP();
workToScreen();
data.byte(kGetback) = 4;
}

Expand Down Expand Up @@ -220,7 +220,7 @@ void DreamBase::saveGame() {
data.word(kTextaddressy) = 182;
data.byte(kTextlen) = 240;
redrawMainScrn();
workToScreenCPP(); // show the main screen without the mouse pointer
workToScreen(); // show the main screen without the mouse pointer

// We need to save after the scene has been redrawn, to capture the
// correct screen thumbnail
Expand Down Expand Up @@ -265,7 +265,7 @@ void DreamBase::doSaveLoad() {
loadSaveBox();
showOpBox();
showMainOps();
workToScreenCPP();
workToScreen();

RectWithCallback<DreamGenContext> opsList[] = {
{ kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamBase::getBackFromOps },
Expand Down Expand Up @@ -745,7 +745,7 @@ void DreamBase::selectSlot() {
showSaveOps();
readMouse();
showPointer();
workToScreenCPP();
workToScreen();
delPointer();
}

Expand Down
8 changes: 0 additions & 8 deletions engines/dreamweb/sound.cpp
Expand Up @@ -30,10 +30,6 @@

namespace DreamGen {

void DreamGenContext::loadSpeech() {
loadSpeech((uint8)dl, (uint8)dh, (uint8)cl, (uint16)ax);
}

bool DreamBase::loadSpeech(byte type1, int idx1, byte type2, int idx2) {
cancelCh1();

Expand Down Expand Up @@ -87,10 +83,6 @@ void DreamBase::playChannel1(uint8 index) {
data.word(kCh1blockstocopy) = soundBank[index].blockCount();
}

void DreamGenContext::playChannel1() {
playChannel1(al);
}

void DreamBase::cancelCh0() {
data.byte(kCh0repeat) = 0;
data.word(kCh0blockstocopy) = 0;
Expand Down
2 changes: 2 additions & 0 deletions engines/dreamweb/sprite.cpp
Expand Up @@ -706,6 +706,8 @@ void DreamBase::intro3Text(uint16 nextReelPointer) {
}

void DreamBase::rollEndCredits() {
// Note: This function is very similar to rollEm() in vgafades.cpp

playChannel0(16, 255);
data.byte(kVolume) = 7;
data.byte(kVolumeto) = 0;
Expand Down

0 comments on commit 9a89f88

Please sign in to comment.