DREAMWEB: Convert notHeldError to C++, move stuff to DreamBase

This commit is contained in:
Max Horn 2011-12-15 14:09:53 +01:00
parent 9ebcaa33e7
commit d1ed87bece
9 changed files with 47 additions and 79 deletions

View file

@ -157,11 +157,6 @@ p = parser(skip_binary_data = [
'increment2',
'keypadax',
'keypadcx',
'soundbuffer',
'cursloc',
'liftsoundcount',
'playblock',
'gotfrom',
# vgagrafx.asm
'cityname',
'extragraphics1',
@ -473,7 +468,6 @@ generator = cpp(context, "DreamGen", blacklist = [
'hangonpq',
'hangonw',
'heavy',
'helicopter',
'hotelbell',
'hotelcontrol',
'initialinv',
@ -579,6 +573,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'nextdest',
'nextfolder',
'nextsymbol',
'nothelderror',
'obicons',
'obname',
'obpicture',
@ -1298,7 +1293,6 @@ generator = cpp(context, "DreamGen", blacklist = [
'nextdest' : 'nextDest',
'nextfolder' : 'nextFolder',
'nextsymbol' : 'nextSymbol',
'nothelderror' : 'notHeldError',
'obicons' : 'obIcons',
'obname' : 'obName',
'obpicture' : 'obPicture',

View file

@ -116,6 +116,7 @@ public:
void fillRyan();
void findAllRyan(uint8 *inv);
void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y);
void obPicture();
// from pathfind.cpp
void checkDest(const RoomPaths *roomsPaths);
@ -163,10 +164,14 @@ public:
const Frame *findSource(uint16 &frame);
void showReelFrame(Reel *reel);
const Frame *getReelFrameAX(uint16 frame);
void soundOnReels(uint16 reelPointer);
void rollEndCredits();
void priestText(ReelRoutine &routine);
void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY);
void soundOnReels(uint16 reelPointer);
void clearBeforeLoad();
void clearReels();
void getRidOfReels();
void liftNoise(uint8 index);
// from stubs.cpp
void crosshair();
@ -240,6 +245,7 @@ public:
void getFlagUnderP(uint8 *flag, uint8 *flagEx);
void workToScreenM();
void quitKey();
void restoreReels();
void loadFolder();
void folderHints();
void folderExit();
@ -258,6 +264,15 @@ public:
void getBackToOps();
void DOSReturn();
bool isItWorn(const DynObject *object);
bool compare(uint8 index, uint8 flag, const char id[4]);
void hangOnW(uint16 frameCount);
void getRidOfTemp();
void getRidOfTempText();
void getRidOfTemp2();
void getRidOfTemp3();
void getRidOfTempCharset();
void getRidOfTempsP();
void getRidOfAll();
// from use.cpp
void placeFreeObject(uint8 index);

View file

@ -3088,25 +3088,6 @@ finishpars:
di = offset_operand1;
}
void DreamGenContext::notHeldError() {
STACK_CHECK;
createPanel();
showPanel();
showMan();
showExit();
obIcons();
di = 64;
bx = 100;
al = 63;
ah = 1;
dl = 201;
printMessage2();
workToScreenM();
cx = 50;
hangOnP();
putBackObStuff();
}
void DreamGenContext::nextColon() {
STACK_CHECK;
lookcolon:

View file

@ -514,7 +514,6 @@ public:
void transferMap();
void purgeAnItem();
void purgeALocation();
void notHeldError();
void getSetAd();
void showKeys();
void nextColon();

View file

@ -107,7 +107,7 @@ void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) {
showFrame(engine->icons1(), x - 3, y - 2, 7, 0);
}
void DreamGenContext::obPicture() {
void DreamBase::obPicture() {
if (data.byte(kObjecttype) == 1)
return;
Frame *frames;

View file

@ -1191,7 +1191,7 @@ void DreamBase::soundOnReels(uint16 reelPointer) {
data.word(kLastsoundreel) = (uint16)-1;
}
void DreamGenContext::clearBeforeLoad() {
void DreamBase::clearBeforeLoad() {
if (data.byte(kRoomloaded) != 1)
return /* (noclear) */;
@ -1213,13 +1213,13 @@ void DreamGenContext::clearBeforeLoad() {
data.byte(kRoomloaded) = 0;
}
void DreamGenContext::clearReels() {
void DreamBase::clearReels() {
deallocateMem(data.word(kReel1));
deallocateMem(data.word(kReel2));
deallocateMem(data.word(kReel3));
}
void DreamGenContext::getRidOfReels() {
void DreamBase::getRidOfReels() {
if (data.byte(kRoomloaded) == 0)
return /* (dontgetrid) */;
@ -1228,7 +1228,7 @@ void DreamGenContext::getRidOfReels() {
deallocateMem(data.word(kReel3));
}
void DreamGenContext::liftNoise(uint8 index) {
void DreamBase::liftNoise(uint8 index) {
if (data.byte(kReallocation) == 5 || data.byte(kReallocation) == 21)
playChannel1(13); // hiss noise
else

View file

@ -1739,20 +1739,12 @@ void DreamBase::animPointer() {
data.byte(kPointerframe) = 8;
}
void DreamGenContext::printMessage() {
printMessage(di, bx, al, dl, (bool)(dl & 1));
}
void DreamBase::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) {
uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2);
const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
printDirect(string, x, y, maxWidth, centered);
}
void DreamGenContext::printMessage2() {
printMessage2(di, bx, al, dl, (bool)(dl & 1), ah);
}
void DreamBase::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) {
uint16 offset = kTextstart + getSegment(data.word(kCommandtext)).word(index * 2);
const uint8 *string = getSegment(data.word(kCommandtext)).ptr(offset, 0);
@ -1776,7 +1768,7 @@ void DreamGenContext::compare() {
flags._z = compare(al, ah, id);
}
bool DreamGenContext::compare(uint8 index, uint8 flag, const char id[4]) {
bool DreamBase::compare(uint8 index, uint8 flag, const char id[4]) {
return objectMatches(getAnyAdDir(index, flag), id);
}
@ -1886,11 +1878,7 @@ void DreamBase::hangOn(uint16 frameCount) {
}
}
void DreamGenContext::hangOnW() {
hangOnW(cx);
}
void DreamGenContext::hangOnW(uint16 frameCount) {
void DreamBase::hangOnW(uint16 frameCount) {
while (frameCount) {
delPointer();
readMouse();
@ -2295,31 +2283,31 @@ void DreamBase::useTempCharset() {
engine->setCurrentCharset(engine->tempCharset());
}
void DreamGenContext::getRidOfTemp() {
void DreamBase::getRidOfTemp() {
deallocateMem(data.word(kTempgraphics));
}
void DreamGenContext::getRidOfTempText() {
void DreamBase::getRidOfTempText() {
deallocateMem(data.word(kTextfile1));
}
void DreamGenContext::getRidOfTemp2() {
void DreamBase::getRidOfTemp2() {
deallocateMem(data.word(kTempgraphics2));
}
void DreamGenContext::getRidOfTemp3() {
void DreamBase::getRidOfTemp3() {
deallocateMem(data.word(kTempgraphics3));
}
void DreamGenContext::getRidOfTempCharset() {
void DreamBase::getRidOfTempCharset() {
engine->freeTempCharset();
}
void DreamGenContext::getRidOfTempsP() {
void DreamBase::getRidOfTempsP() {
deallocateMem(data.word(kTempsprites));
}
void DreamGenContext::getRidOfAll() {
void DreamBase::getRidOfAll() {
deallocateMem(data.word(kBackdrop));
deallocateMem(data.word(kSetframes));
deallocateMem(data.word(kReel1));
@ -2381,7 +2369,7 @@ void DreamGenContext::restoreAll() {
setAllChanges();
}
void DreamGenContext::restoreReels() {
void DreamBase::restoreReels() {
if (data.byte(kRoomloaded) == 0)
return;

View file

@ -58,14 +58,6 @@
uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
return DreamBase::printDirect(string, x, y, maxWidth, centered);
}
void printMessage();
void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) {
DreamBase::printMessage(x, y, index, maxWidth, centered);
}
void printMessage2();
void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) {
DreamBase::printMessage2(x, y, index, maxWidth, centered, count);
}
void useTimedText();
void dumpTimedText();
void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount);
@ -187,9 +179,10 @@
void addToPeopleList();
void addToPeopleList(ReelRoutine *routine);
void getExPos();
void obPicture();
void compare();
bool compare(uint8 index, uint8 flag, const char id[4]);
bool compare(uint8 index, uint8 flag, const char id[4]) {
return DreamBase::compare(index, flag, id);
}
bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y);
void checkIfSet();
bool checkIfSet(uint8 x, uint8 y);
@ -211,8 +204,6 @@
void hangOn(uint16 frameCount) {
DreamBase::hangOn(frameCount);
}
void hangOnW();
void hangOnW(uint16 frameCount);
void hangOnP();
void hangOnP(uint16 count) {
DreamBase::hangOnP(count);
@ -278,13 +269,6 @@
void look();
void autoLook();
void doLook();
void getRidOfAll();
void getRidOfTemp();
void getRidOfTempText();
void getRidOfTemp2();
void getRidOfTemp3();
void getRidOfTempCharset();
void getRidOfTempsP();
void showFirstUse();
void showSecondUse();
void actualSave();
@ -292,7 +276,6 @@
void loadPosition(unsigned int slot);
void savePosition(unsigned int slot, const char *descbuf);
void restoreAll();
void restoreReels();
void enterSymbol();
void viewFolder();
void edensCDPlayer();
@ -422,10 +405,6 @@
void realCredits();
void runIntroSeq();
void intro();
void clearBeforeLoad();
void clearReels();
void getRidOfReels();
void liftNoise(uint8 index);
void newGame();
void pickupOb(uint8 command, uint8 pos);
void initialInv();
@ -537,5 +516,6 @@
byte getOpenedSizeCPP();
void openOb();
void withWhat();
void notHeldError();
#endif

View file

@ -1495,5 +1495,16 @@ void DreamGenContext::withWhat() {
data.byte(kInvopen) = 2;
}
void DreamGenContext::notHeldError() {
createPanel();
showPanel();
showMan();
showExit();
obIcons();
printMessage2(64, 100, 63, 200 + 1, true, 1);
workToScreenM();
hangOnP(50);
putBackObStuff();
}
} // End of namespace DreamGen