DREAMWEB: Convert watchreel and remove global kReelpointer
This commit is contained in:
parent
7e4a261609
commit
e8ccbe3558
8 changed files with 91 additions and 122 deletions
|
@ -202,6 +202,7 @@ generator = cpp(context, "DreamGen", blacklist = [
|
|||
'checkcoords',
|
||||
'checkdest',
|
||||
'checkforemm',
|
||||
'checkforshake',
|
||||
'checkifex',
|
||||
'checkiffree',
|
||||
'checkifpathison',
|
||||
|
@ -710,6 +711,7 @@ generator = cpp(context, "DreamGen", blacklist = [
|
|||
'walkintoroom',
|
||||
'walktotext',
|
||||
'watchcount',
|
||||
'watchreel',
|
||||
'wearwatch',
|
||||
'wearshades',
|
||||
'wheelsound',
|
||||
|
|
|
@ -74,10 +74,16 @@ public:
|
|||
void cancelCh0();
|
||||
void cancelCh1();
|
||||
void loadRoomsSample();
|
||||
void playChannel0(uint8 index, uint8 repeat);
|
||||
void playChannel1(uint8 index);
|
||||
|
||||
// from sprite.cpp
|
||||
Sprite *spriteTable();
|
||||
Reel *getReelStart();
|
||||
Reel *getReelStart(uint16 reelPointer);
|
||||
const Frame *findSource(uint16 &frame);
|
||||
void showReelFrame(Reel *reel);
|
||||
const Frame *getReelFrameAX(uint16 frame);
|
||||
void soundOnReels(uint16 reelPointer);
|
||||
|
||||
// from stubs.cpp
|
||||
void crosshair();
|
||||
|
|
|
@ -6758,99 +6758,6 @@ void DreamGenContext::clearChanges() {
|
|||
_stosw(cx, true);
|
||||
}
|
||||
|
||||
void DreamGenContext::watchReel() {
|
||||
STACK_CHECK;
|
||||
_cmp(data.word(kReeltowatch), -1);
|
||||
if (flags.z())
|
||||
goto notplayingreel;
|
||||
al = data.byte(kManspath);
|
||||
_cmp(al, data.byte(kFinaldest));
|
||||
if (!flags.z())
|
||||
return /* (waitstopwalk) */;
|
||||
al = data.byte(kTurntoface);
|
||||
_cmp(al, data.byte(kFacing));
|
||||
if (flags.z())
|
||||
goto notwatchpath;
|
||||
return;
|
||||
notwatchpath:
|
||||
_dec(data.byte(kSpeedcount));
|
||||
_cmp(data.byte(kSpeedcount), -1);
|
||||
if (!flags.z())
|
||||
goto showwatchreel;
|
||||
al = data.byte(kWatchspeed);
|
||||
data.byte(kSpeedcount) = al;
|
||||
ax = data.word(kReeltowatch);
|
||||
_cmp(ax, data.word(kEndwatchreel));
|
||||
if (!flags.z())
|
||||
goto ismorereel;
|
||||
_cmp(data.word(kWatchingtime), 0);
|
||||
if (!flags.z())
|
||||
goto showwatchreel;
|
||||
data.word(kReeltowatch) = -1;
|
||||
data.byte(kWatchmode) = -1;
|
||||
_cmp(data.word(kReeltohold), -1);
|
||||
if (flags.z())
|
||||
return /* (nomorereel) */;
|
||||
data.byte(kWatchmode) = 1;
|
||||
goto notplayingreel;
|
||||
ismorereel:
|
||||
_inc(data.word(kReeltowatch));
|
||||
showwatchreel:
|
||||
ax = data.word(kReeltowatch);
|
||||
data.word(kReelpointer) = ax;
|
||||
plotReel();
|
||||
ax = data.word(kReelpointer);
|
||||
data.word(kReeltowatch) = ax;
|
||||
checkForShake();
|
||||
return;
|
||||
notplayingreel:
|
||||
_cmp(data.byte(kWatchmode), 1);
|
||||
if (!flags.z())
|
||||
goto notholdingreel;
|
||||
ax = data.word(kReeltohold);
|
||||
data.word(kReelpointer) = ax;
|
||||
plotReel();
|
||||
return;
|
||||
notholdingreel:
|
||||
_cmp(data.byte(kWatchmode), 2);
|
||||
if (!flags.z())
|
||||
return /* (notreleasehold) */;
|
||||
_dec(data.byte(kSpeedcount));
|
||||
_cmp(data.byte(kSpeedcount), -1);
|
||||
if (!flags.z())
|
||||
goto notlastspeed2;
|
||||
al = data.byte(kWatchspeed);
|
||||
data.byte(kSpeedcount) = al;
|
||||
_inc(data.word(kReeltohold));
|
||||
notlastspeed2:
|
||||
ax = data.word(kReeltohold);
|
||||
_cmp(ax, data.word(kEndofholdreel));
|
||||
if (!flags.z())
|
||||
goto ismorereel2;
|
||||
data.word(kReeltohold) = -1;
|
||||
data.byte(kWatchmode) = -1;
|
||||
al = data.byte(kDestafterhold);
|
||||
data.byte(kDestination) = al;
|
||||
data.byte(kFinaldest) = al;
|
||||
autoSetWalk();
|
||||
return;
|
||||
ismorereel2:
|
||||
ax = data.word(kReeltohold);
|
||||
data.word(kReelpointer) = ax;
|
||||
plotReel();
|
||||
}
|
||||
|
||||
void DreamGenContext::checkForShake() {
|
||||
STACK_CHECK;
|
||||
_cmp(data.byte(kReallocation), 26);
|
||||
if (!flags.z())
|
||||
return /* (notstartshake) */;
|
||||
_cmp(ax, 104);
|
||||
if (!flags.z())
|
||||
return /* (notstartshake) */;
|
||||
data.byte(kShakecounter) = -1;
|
||||
}
|
||||
|
||||
void DreamGenContext::madmanRun() {
|
||||
STACK_CHECK;
|
||||
_cmp(data.byte(kLocation), 14);
|
||||
|
|
|
@ -554,10 +554,9 @@ public:
|
|||
void checkInput();
|
||||
void putUnderCentre();
|
||||
void checkObjectSize();
|
||||
void watchReel();
|
||||
void findText1();
|
||||
void isRyanHolding();
|
||||
void showSlots();
|
||||
void quitSymbol();
|
||||
void useCashCard();
|
||||
void moneyPoke();
|
||||
void doSomeTalk();
|
||||
|
@ -643,7 +642,7 @@ public:
|
|||
void lookAtPlace();
|
||||
void useAxe();
|
||||
void findAllOpen();
|
||||
void quitSymbol();
|
||||
void showSlots();
|
||||
void findSetObject();
|
||||
void useDiary();
|
||||
void deleteExObject();
|
||||
|
@ -693,7 +692,6 @@ public:
|
|||
void afterNewRoom();
|
||||
void getExAd();
|
||||
void initialMonCols();
|
||||
void checkForShake();
|
||||
void useButtonA();
|
||||
void execCommand();
|
||||
void updateSymbolBot();
|
||||
|
|
|
@ -53,7 +53,7 @@ void DreamBase::volumeAdjust() {
|
|||
}
|
||||
}
|
||||
|
||||
void DreamGenContext::playChannel0(uint8 index, uint8 repeat) {
|
||||
void DreamBase::playChannel0(uint8 index, uint8 repeat) {
|
||||
if (data.byte(kSoundint) == 255)
|
||||
return;
|
||||
|
||||
|
@ -80,7 +80,7 @@ void DreamGenContext::playChannel0() {
|
|||
playChannel0(al, ah);
|
||||
}
|
||||
|
||||
void DreamGenContext::playChannel1(uint8 index) {
|
||||
void DreamBase::playChannel1(uint8 index) {
|
||||
if (data.byte(kSoundint) == 255)
|
||||
return;
|
||||
if (data.byte(kCh1playing) == 7)
|
||||
|
|
|
@ -482,8 +482,8 @@ Frame *DreamGenContext::findSource() {
|
|||
}
|
||||
}
|
||||
|
||||
Reel *DreamBase::getReelStart() {
|
||||
Reel *reel = (Reel *)getSegment(data.word(kReels)).ptr(kReellist + data.word(kReelpointer) * sizeof(Reel) * 8, sizeof(Reel));
|
||||
Reel *DreamBase::getReelStart(uint16 reelPointer) {
|
||||
Reel *reel = (Reel *)getSegment(data.word(kReels)).ptr(kReellist + reelPointer * sizeof(Reel) * 8, sizeof(Reel));
|
||||
return reel;
|
||||
}
|
||||
|
||||
|
@ -504,9 +504,8 @@ void DreamGenContext::showGameReel(ReelRoutine *routine) {
|
|||
uint16 reelPointer = routine->reelPointer();
|
||||
if (reelPointer >= 512)
|
||||
return;
|
||||
data.word(kReelpointer) = reelPointer;
|
||||
plotReel();
|
||||
routine->setReelPointer(data.word(kReelpointer));
|
||||
plotReel(reelPointer);
|
||||
routine->setReelPointer(reelPointer);
|
||||
}
|
||||
|
||||
const Frame *DreamGenContext::getReelFrameAX(uint16 frame) {
|
||||
|
@ -1133,14 +1132,14 @@ static const ReelSound *g_roomByRoom[] = {
|
|||
};
|
||||
|
||||
|
||||
void DreamGenContext::soundOnReels() {
|
||||
void DreamBase::soundOnReels(uint16 reelPointer) {
|
||||
const ReelSound *r = g_roomByRoom[data.byte(kReallocation)];
|
||||
|
||||
if (engine->getLanguage() == Common::DE_DEU && r == g_roomSound29)
|
||||
r = g_roomSound29_German;
|
||||
|
||||
for (; r->_sample != 255; ++r) {
|
||||
if (r->_reelPointer != data.word(kReelpointer))
|
||||
if (r->_reelPointer != reelPointer)
|
||||
continue;
|
||||
if (r->_reelPointer == data.word(kLastsoundreel))
|
||||
continue;
|
||||
|
@ -1156,7 +1155,7 @@ void DreamGenContext::soundOnReels() {
|
|||
playChannel0(r->_sample & 63, 255);
|
||||
}
|
||||
|
||||
if (data.word(kReelpointer) != data.word(kLastsoundreel))
|
||||
if (data.word(kLastsoundreel) != reelPointer)
|
||||
data.word(kLastsoundreel) = (uint16)-1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1196,11 +1196,11 @@ void DreamGenContext::dealWithSpecial(uint8 firstParam, uint8 secondParam) {
|
|||
}
|
||||
}
|
||||
|
||||
void DreamGenContext::plotReel() {
|
||||
Reel *reel = getReelStart();
|
||||
void DreamGenContext::plotReel(uint16 &reelPointer) {
|
||||
Reel *reel = getReelStart(reelPointer);
|
||||
while (reel->x >= 220 && reel->x != 255) {
|
||||
dealWithSpecial(reel->x, reel->y);
|
||||
++data.word(kReelpointer);
|
||||
++reelPointer;
|
||||
reel += 8;
|
||||
}
|
||||
|
||||
|
@ -1209,11 +1209,7 @@ void DreamGenContext::plotReel() {
|
|||
showReelFrame(reel);
|
||||
++reel;
|
||||
}
|
||||
push(es);
|
||||
push(bx);
|
||||
soundOnReels();
|
||||
bx = pop();
|
||||
es = pop();
|
||||
soundOnReels(reelPointer);
|
||||
}
|
||||
|
||||
void DreamBase::crosshair() {
|
||||
|
@ -1258,8 +1254,7 @@ bool DreamGenContext::checkIfPerson(uint8 x, uint8 y) {
|
|||
for (size_t i = 0; i < 12; ++i, ++people) {
|
||||
if (people->b4 == 255)
|
||||
continue;
|
||||
data.word(kReelpointer) = people->reelPointer();
|
||||
Reel *reel = getReelStart();
|
||||
Reel *reel = getReelStart(people->reelPointer());
|
||||
if (reel->frame() == 0xffff)
|
||||
++reel;
|
||||
const Frame *frame = getReelFrameAX(reel->frame());
|
||||
|
@ -3815,4 +3810,61 @@ void DreamBase::showDiary() {
|
|||
showFrame(tempGraphics(), kDiaryx + 176, kDiaryy + 108, 2, 0);
|
||||
}
|
||||
|
||||
void DreamGenContext::showWatchReel() {
|
||||
uint16 reelPointer = data.word(kReeltowatch);
|
||||
plotReel(reelPointer);
|
||||
data.word(kReeltowatch) = reelPointer;
|
||||
|
||||
// check for shake
|
||||
if (data.byte(kReallocation) == 26 && reelPointer == 104)
|
||||
data.byte(kShakecounter) = 0xFF;
|
||||
}
|
||||
|
||||
void DreamGenContext::watchReel() {
|
||||
if (data.word(kReeltowatch) != 0xFFFF) {
|
||||
if (data.byte(kManspath) != data.byte(kFinaldest))
|
||||
return; // Wait until stopped walking
|
||||
if (data.byte(kTurntoface) != data.byte(kFacing))
|
||||
return;
|
||||
|
||||
if (--data.byte(kSpeedcount) != 0xFF) {
|
||||
showWatchReel();
|
||||
return;
|
||||
}
|
||||
data.byte(kSpeedcount) = data.byte(kWatchspeed);
|
||||
if (data.word(kReeltowatch) != data.word(kEndwatchreel)) {
|
||||
++data.word(kReeltowatch);
|
||||
showWatchReel();
|
||||
return;
|
||||
}
|
||||
if (data.word(kWatchingtime)) {
|
||||
showWatchReel();
|
||||
return;
|
||||
}
|
||||
data.word(kReeltowatch) = 0xFFFF;
|
||||
data.byte(kWatchmode) = 0xFF;
|
||||
if (data.word(kReeltohold) == 0xFFFF)
|
||||
return; // No more reel
|
||||
data.byte(kWatchmode) = 1;
|
||||
} else if (data.byte(kWatchmode) != 1) {
|
||||
if (data.byte(kWatchmode) != 2)
|
||||
return; // "notreleasehold"
|
||||
if (--data.byte(kSpeedcount) == 0xFF) {
|
||||
data.byte(kSpeedcount) = data.byte(kWatchspeed);
|
||||
++data.word(kReeltohold);
|
||||
}
|
||||
if (data.word(kReeltohold) == data.word(kEndofholdreel)) {
|
||||
data.word(kReeltohold) = -1;
|
||||
data.byte(kWatchmode) = -1;
|
||||
data.byte(kDestination) = data.byte(kDestafterhold);
|
||||
data.byte(kFinaldest) = data.byte(kDestafterhold);
|
||||
autoSetWalk();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 reelPointer = data.word(kReeltohold);
|
||||
plotReel(reelPointer);
|
||||
}
|
||||
|
||||
} // End of namespace DreamGen
|
||||
|
|
|
@ -130,7 +130,6 @@
|
|||
void turnAnyPathOff();
|
||||
void makeBackOb(SetObject *objData);
|
||||
void lockMon();
|
||||
void plotReel();
|
||||
void dealWithSpecial(uint8 firstParam, uint8 secondParam);
|
||||
void zoom();
|
||||
void showRain();
|
||||
|
@ -297,9 +296,13 @@
|
|||
void powerLightOn();
|
||||
void powerLightOff();
|
||||
void playChannel0();
|
||||
void playChannel0(uint8 index, uint8 repeat);
|
||||
void playChannel0(uint8 index, uint8 repeat) {
|
||||
DreamBase::playChannel0(index, repeat);
|
||||
}
|
||||
void playChannel1();
|
||||
void playChannel1(uint8 index);
|
||||
void playChannel1(uint8 index) {
|
||||
DreamBase::playChannel1(index);
|
||||
}
|
||||
void showMainOps();
|
||||
void showDiscOps();
|
||||
void findRoomInLoc();
|
||||
|
@ -471,7 +474,6 @@
|
|||
void loadPersonal();
|
||||
void loadNews();
|
||||
void loadCart();
|
||||
void soundOnReels();
|
||||
void readKey();
|
||||
void hangOne(uint16 delay);
|
||||
void hangOne();
|
||||
|
@ -556,5 +558,8 @@
|
|||
void examineInventory();
|
||||
void showSaveOps();
|
||||
void showLoadOps();
|
||||
void watchReel();
|
||||
void showWatchReel();
|
||||
void plotReel(uint16 &reelPointer);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue