DREAMWEB: 'drinker' ported to C++

This commit is contained in:
Bertrand Augereau 2011-12-01 14:55:38 +01:00
parent ed30ee8e38
commit 270eb8773c
5 changed files with 17 additions and 26 deletions

View file

@ -338,6 +338,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'sparkydrip', 'sparkydrip',
'othersmoker', 'othersmoker',
'barwoman', 'barwoman',
'gamer',
], skip_output = [ ], skip_output = [
# These functions are processed but not output # These functions are processed but not output
'dreamweb', 'dreamweb',

View file

@ -908,28 +908,6 @@ notboss:
data.byte(kTalkedtoboss) = 1; data.byte(kTalkedtoboss) = 1;
} }
void DreamGenContext::gamer() {
STACK_CHECK;
checkspeed();
if (!flags.z())
goto gamerfin;
gameragain:
randomnum1();
_and(al, 7);
_cmp(al, 5);
if (!flags.c())
goto gameragain;
_add(al, 20);
_cmp(al, es.byte(bx+3));
if (flags.z())
goto gameragain;
ah = 0;
es.word(bx+3) = ax;
gamerfin:
showgamereel();
addtopeoplelist();
}
void DreamGenContext::carparkdrip() { void DreamGenContext::carparkdrip() {
STACK_CHECK; STACK_CHECK;
checkspeed(); checkspeed();

View file

@ -457,7 +457,6 @@ public:
static const uint16 addr_candles1 = 0xc08c; static const uint16 addr_candles1 = 0xc08c;
static const uint16 addr_keeper = 0xc088; static const uint16 addr_keeper = 0xc088;
static const uint16 addr_carparkdrip = 0xc084; static const uint16 addr_carparkdrip = 0xc084;
static const uint16 addr_gamer = 0xc07c;
static const uint16 addr_bossman = 0xc078; static const uint16 addr_bossman = 0xc078;
static const uint16 addr_heavy = 0xc074; static const uint16 addr_heavy = 0xc074;
static const uint16 addr_security = 0xc070; static const uint16 addr_security = 0xc070;
@ -1363,7 +1362,6 @@ public:
void afterintroroom(); void afterintroroom();
void buttonnine(); void buttonnine();
void findallopen(); void findallopen();
void gamer();
void readfromfile(); void readfromfile();
void initialinv(); void initialinv();
void quitsymbol(); void quitsymbol();

View file

@ -568,7 +568,7 @@ void DreamGenContext::showrain() {
} }
static void (DreamGenContext::*reelCallbacks[57])() = { static void (DreamGenContext::*reelCallbacks[57])() = {
&DreamGenContext::gamer, NULL, NULL, NULL,
&DreamGenContext::eden, &DreamGenContext::edeninbath, &DreamGenContext::eden, &DreamGenContext::edeninbath,
&DreamGenContext::sparky, &DreamGenContext::smokebloke, &DreamGenContext::sparky, &DreamGenContext::smokebloke,
&DreamGenContext::manasleep, &DreamGenContext::drunk, &DreamGenContext::manasleep, &DreamGenContext::drunk,
@ -600,7 +600,7 @@ static void (DreamGenContext::*reelCallbacks[57])() = {
}; };
static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = {
/*&DreamGenContext::gamer*/NULL, &DreamGenContext::sparkydrip, &DreamGenContext::gamer, &DreamGenContext::sparkydrip,
/*&DreamGenContext::eden*/NULL, /*&DreamGenContext::edeninbath*/NULL, /*&DreamGenContext::eden*/NULL, /*&DreamGenContext::edeninbath*/NULL,
/*&DreamGenContext::sparky*/NULL, /*&DreamGenContext::smokebloke*/NULL, /*&DreamGenContext::sparky*/NULL, /*&DreamGenContext::smokebloke*/NULL,
/*&DreamGenContext::manasleep*/NULL, /*&DreamGenContext::drunk*/NULL, /*&DreamGenContext::manasleep*/NULL, /*&DreamGenContext::drunk*/NULL,
@ -1087,5 +1087,18 @@ void DreamGenContext::othersmoker(ReelRoutine &routine) {
addtopeoplelist(&routine); addtopeoplelist(&routine);
} }
void DreamGenContext::gamer(ReelRoutine &routine) {
if (checkspeed(&routine)) {
uint8 v;
do {
v = 20 + engine->randomNumber() % 5;
} while (v == routine.reelPointer());
routine.setReelPointer(v);
}
showgamereel(&routine);
addtopeoplelist(&routine);
}
} /*namespace dreamgen */ } /*namespace dreamgen */

View file

@ -379,4 +379,5 @@
void checkspeed(); void checkspeed();
void sparkydrip(ReelRoutine &routine); void sparkydrip(ReelRoutine &routine);
void othersmoker(ReelRoutine &routine); void othersmoker(ReelRoutine &routine);
void gamer(ReelRoutine &routine);