DREAMWEB: Rewrote useCashCard() in C++ and got rid of moneyPoke() and its associated offsets in the data blob

This commit is contained in:
Filippos Karapetis 2011-12-17 00:01:45 +02:00
parent 2887686d56
commit 654a60a90c
5 changed files with 59 additions and 131 deletions

View file

@ -108,6 +108,8 @@ p = parser(skip_binary_data = [
'title6graphics', 'title6graphics',
# use.asm # use.asm
'uselist', 'uselist',
'money1poke',
'money2poke',
# vars.asm # vars.asm
'currentset', 'currentset',
'icons1', 'icons1',
@ -566,6 +568,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'middlepanel', 'middlepanel',
'mode640x480', 'mode640x480',
'modifychar', 'modifychar',
'moneypoke',
'monitorlogo', 'monitorlogo',
'monkandryan', 'monkandryan',
'monks2text', 'monks2text',
@ -828,6 +831,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'usecardreader2', 'usecardreader2',
'usecardreader3', 'usecardreader3',
'usecart', 'usecart',
'usecashcard',
'usecharset1', 'usecharset1',
'usechurchgate', 'usechurchgate',
'usechurchhole', 'usechurchhole',

View file

@ -2170,14 +2170,14 @@ void DreamGenContext::getDestInfo() {
push(ax); push(ax);
dx = data; dx = data;
es = dx; es = dx;
si = 1131; si = 1123;
_add(si, ax); _add(si, ax);
cl = es.byte(si); cl = es.byte(si);
ax = pop(); ax = pop();
push(cx); push(cx);
dx = data; dx = data;
es = dx; es = dx;
si = 1147; si = 1139;
_add(si, ax); _add(si, ax);
ax = pop(); ax = pop();
} }
@ -2229,7 +2229,7 @@ clearedlocations:
bx = ax; bx = ax;
dx = data; dx = data;
es = dx; es = dx;
_add(bx, 1131); _add(bx, 1123);
es.byte(bx) = 0; es.byte(bx) = 0;
} }
@ -2370,7 +2370,7 @@ notyetassigned:
push(bx); push(bx);
_add(bx, 2); _add(bx, 2);
ds = cs; ds = cs;
si = 1165; si = 1157;
checkpass: checkpass:
_lodsw(); _lodsw();
ah = es.byte(bx); ah = es.byte(bx);
@ -2698,7 +2698,7 @@ void DreamGenContext::parser() {
al = '='; al = '=';
_stosb(); _stosb();
ds = cs; ds = cs;
si = 1165; si = 1157;
notspace1: notspace1:
_lodsw(); _lodsw();
_cmp(al, 32); _cmp(al, 32);
@ -2736,106 +2736,6 @@ lookcolon:
goto lookcolon; goto lookcolon;
} }
void DreamGenContext::useCashCard() {
STACK_CHECK;
getRidOfReels();
loadKeypad();
createPanel();
showPanel();
showExit();
showMan();
di = 114;
bx = 120;
_cmp(data.byte(kForeignrelease), 0);
if (flags.z())
goto _tmp1;
bx = 120-3;
_tmp1:
ds = data.word(kTempgraphics);
al = 39;
ah = 0;
showFrame();
ax = data.word(kCard1money);
moneyPoke();
getObTextStart();
nextColon();
nextColon();
di = 36;
bx = 98;
dl = 241;
al = 0;
ah = 0;
printDirect();
di = 160;
bx = 155;
es = cs;
si = offset_money1poke;
data.word(kCharshift) = 91*2+75;
al = 0;
ah = 0;
dl = 240;
printDirect();
di = 187;
bx = 155;
es = cs;
si = offset_money2poke;
data.word(kCharshift) = 91*2+85;
al = 0;
ah = 0;
dl = 240;
printDirect();
data.word(kCharshift) = 0;
workToScreenM();
cx = 400;
hangOnP();
getRidOfTemp();
restoreReels();
putBackObStuff();
}
void DreamGenContext::moneyPoke() {
STACK_CHECK;
bx = offset_money1poke;
cl = 48-1;
numberpoke0:
_inc(cl);
_sub(ax, 10000);
if (!flags.c())
goto numberpoke0;
_add(ax, 10000);
cs.byte(bx) = cl;
_inc(bx);
cl = 48-1;
numberpoke1:
_inc(cl);
_sub(ax, 1000);
if (!flags.c())
goto numberpoke1;
_add(ax, 1000);
cs.byte(bx) = cl;
_inc(bx);
cl = 48-1;
numberpoke2:
_inc(cl);
_sub(ax, 100);
if (!flags.c())
goto numberpoke2;
_add(ax, 100);
cs.byte(bx) = cl;
_inc(bx);
cl = 48-1;
numberpoke3:
_inc(cl);
_sub(ax, 10);
if (!flags.c())
goto numberpoke3;
_add(ax, 10);
cs.byte(bx) = cl;
bx = offset_money2poke;
_add(al, 48);
cs.byte(bx) = al;
}
void DreamGenContext::useStereo() { void DreamGenContext::useStereo() {
STACK_CHECK; STACK_CHECK;
_cmp(data.byte(kLocation), 0); _cmp(data.byte(kLocation), 0);
@ -3059,7 +2959,7 @@ void DreamGenContext::clearChanges() {
di = 0; di = 0;
_stosw(cx, true); _stosw(cx, true);
es = cs; es = cs;
di = 1131; di = 1123;
al = 1; al = 1;
_stosb(2); _stosb(2);
al = 0; al = 0;
@ -3292,19 +3192,19 @@ void DreamGenContext::__start() {
//0x0400: ."R OOT //0x0400: ."R OOT
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x0410: . " //0x0410: . "
0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10,
//0x0420: .00 00.0 0... //0x0420: ... ..$. ....
0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02,
//0x0430: ..$. .... .... .... //0x0430: .... .... .... ....
0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0440: .... .... ...D :... //0x0440: ...D :... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0450: .... .... .... .... //0x0450: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0460: .... .... .... .... //0x0460: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x03, 0x02, 0x04, 0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07,
//0x0470: .... .... .... .... //0x0470: .... .... .... ....
0x01, 0x0a, 0x09, 0x08, 0x06, 0x0b, 0x04, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0480: .... .... .... .... //0x0480: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0490: .... .... .... .... //0x0490: .... .... .... ....
@ -3320,9 +3220,7 @@ void DreamGenContext::__start() {
//0x04e0: .... .... .... .... //0x04e0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x04f0: .... .... .... .... //0x04f0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, };
//0x0500: .... .... .... ....
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src)); ds.assign(src, src + sizeof(src));
dreamweb(); dreamweb();
} }

View file

@ -32,11 +32,9 @@
namespace DreamGen { namespace DreamGen {
static const uint16 offset_money1poke = 0x0426;
static const uint16 offset_operand1 = 0x03fc; static const uint16 offset_operand1 = 0x03fc;
static const uint16 offset_rootdir = 0x040a;
static const uint16 offset_keys = 0x0392; static const uint16 offset_keys = 0x0392;
static const uint16 offset_money2poke = 0x042b; static const uint16 offset_rootdir = 0x040a;
static const uint16 kStartvars = 0; static const uint16 kStartvars = 0;
static const uint16 kProgresspoints = 1; static const uint16 kProgresspoints = 1;
static const uint16 kWatchon = 2; static const uint16 kWatchon = 2;
@ -365,14 +363,14 @@ static const uint16 kRoomssample = 443;
static const uint16 kReelroutines = 444; static const uint16 kReelroutines = 444;
static const uint16 kBasicsample = 901; static const uint16 kBasicsample = 901;
static const uint16 kCurrentfile = 1048; static const uint16 kCurrentfile = 1048;
static const uint16 kRoomscango = 1131; static const uint16 kRoomscango = 1123;
static const uint16 kRoompics = 1147; static const uint16 kRoompics = 1139;
static const uint16 kOplist = 1162; static const uint16 kOplist = 1154;
static const uint16 kInputline = 1165; static const uint16 kInputline = 1157;
static const uint16 kPresslist = 1293; static const uint16 kPresslist = 1285;
static const uint16 kQuitrequested = 1299; static const uint16 kQuitrequested = 1291;
static const uint16 kSubtitles = 1300; static const uint16 kSubtitles = 1292;
static const uint16 kForeignrelease = 1301; static const uint16 kForeignrelease = 1293;
static const uint16 kBlocktextdat = (0); static const uint16 kBlocktextdat = (0);
static const uint16 kPersonframes = (0); static const uint16 kPersonframes = (0);
static const uint16 kDebuglevel1 = (0); static const uint16 kDebuglevel1 = (0);
@ -480,8 +478,6 @@ public:
void getObTextStart(); void getObTextStart();
void checkObjectSize(); void checkObjectSize();
void fillOpen(); void fillOpen();
void useCashCard();
void moneyPoke();
void doSomeTalk(); void doSomeTalk();
void resetLocation(); void resetLocation();
void adjustUp(); void adjustUp();

View file

@ -394,5 +394,6 @@
void useGun(); void useGun();
void identifyOb(); void identifyOb();
void showSlots(); void showSlots();
void useCashCard();
#endif #endif

View file

@ -1613,4 +1613,33 @@ void DreamGenContext::notHeldError() {
putBackObStuff(); putBackObStuff();
} }
void DreamGenContext::useCashCard() {
getRidOfReels();
loadKeypad();
createPanel();
showPanel();
showExit();
showMan();
uint16 y = (!data.byte(kForeignrelease)) ? 120 : 120 - 3;
showFrame(tempGraphics(), 114, y, 39, 0);
const uint8 *obText = getObTextStartCPP();
findNextColon(&obText);
findNextColon(&obText);
y = 98;
printDirect(&obText, 36, &y, 36, 36 & 1);
char amountStr[10];
sprintf(amountStr, "%04d", data.word(kCard1money) / 10);
data.word(kCharshift) = 91 * 2 + 75;
printDirect((const uint8 *)amountStr, 160, 155, 240, 240 & 1);
sprintf(amountStr, "%02d", (data.word(kCard1money) % 10) * 10);
data.word(kCharshift) = 91 * 2 + 85;
printDirect((const uint8 *)amountStr, 187, 155, 240, 240 & 1);
data.word(kCharshift) = 0;
workToScreenM();
hangOnP(400);
getRidOfTemp();
restoreReels();
putBackObStuff();
}
} // End of namespace DreamGen } // End of namespace DreamGen