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',
# use.asm
'uselist',
'money1poke',
'money2poke',
# vars.asm
'currentset',
'icons1',
@ -566,6 +568,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'middlepanel',
'mode640x480',
'modifychar',
'moneypoke',
'monitorlogo',
'monkandryan',
'monks2text',
@ -828,6 +831,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'usecardreader2',
'usecardreader3',
'usecart',
'usecashcard',
'usecharset1',
'usechurchgate',
'usechurchhole',

View file

@ -2170,14 +2170,14 @@ void DreamGenContext::getDestInfo() {
push(ax);
dx = data;
es = dx;
si = 1131;
si = 1123;
_add(si, ax);
cl = es.byte(si);
ax = pop();
push(cx);
dx = data;
es = dx;
si = 1147;
si = 1139;
_add(si, ax);
ax = pop();
}
@ -2229,7 +2229,7 @@ clearedlocations:
bx = ax;
dx = data;
es = dx;
_add(bx, 1131);
_add(bx, 1123);
es.byte(bx) = 0;
}
@ -2370,7 +2370,7 @@ notyetassigned:
push(bx);
_add(bx, 2);
ds = cs;
si = 1165;
si = 1157;
checkpass:
_lodsw();
ah = es.byte(bx);
@ -2698,7 +2698,7 @@ void DreamGenContext::parser() {
al = '=';
_stosb();
ds = cs;
si = 1165;
si = 1157;
notspace1:
_lodsw();
_cmp(al, 32);
@ -2736,106 +2736,6 @@ 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() {
STACK_CHECK;
_cmp(data.byte(kLocation), 0);
@ -3059,7 +2959,7 @@ void DreamGenContext::clearChanges() {
di = 0;
_stosw(cx, true);
es = cs;
di = 1131;
di = 1123;
al = 1;
_stosb(2);
al = 0;
@ -3292,19 +3192,19 @@ void DreamGenContext::__start() {
//0x0400: ."R OOT
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x22, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
//0x0410: . "
0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x0d, 0x0a,
//0x0420: .00 00.0 0...
0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10, 0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
//0x0430: ..$. .... .... ....
0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00,
//0x0440: .... .... ...D :...
0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x0d, 0x0a, 0x0d, 0x0a, 0x24, 0x10, 0x12, 0x12, 0x11, 0x10,
//0x0420: ... ..$. ....
0x10, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02,
//0x0430: .... .... .... ....
0x02, 0x02, 0x02, 0x44, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0440: ...D :... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//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: .... .... .... ....
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: .... .... .... ....
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: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x0490: .... .... .... ....
@ -3320,9 +3220,7 @@ void DreamGenContext::__start() {
//0x04e0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
//0x04f0: .... .... .... ....
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
//0x0500: .... .... .... ....
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, };
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, };
ds.assign(src, src + sizeof(src));
dreamweb();
}

View file

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

View file

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

View file

@ -1613,4 +1613,33 @@ void DreamGenContext::notHeldError() {
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