From f9419db947a8d1cb42ee389b377c7ec6030ad9dd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 13 Dec 2011 22:39:34 +0200 Subject: DREAMWEB: Port 'bartender' and 'receptionist' to C++ --- engines/dreamweb/dreamgen.cpp | 81 ------------------------------------------- engines/dreamweb/dreamgen.h | 2 -- engines/dreamweb/people.cpp | 66 ++++++++++++++++++++++++++++++++--- engines/dreamweb/stubs.h | 2 ++ 4 files changed, 64 insertions(+), 87 deletions(-) (limited to 'engines/dreamweb') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 63942575bf..83b86f9d51 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -26,87 +26,6 @@ namespace DreamGen { -void DreamGenContext::receptionist() { - STACK_CHECK; - checkSpeed(); - if (!flags.z()) - goto gotrecep; - _cmp(data.byte(kCardpassflag), 1); - if (!flags.z()) - goto notsetcard; - _inc(data.byte(kCardpassflag)); - es.byte(bx+7) = 1; - es.word(bx+3) = 64; -notsetcard: - _cmp(es.word(bx+3), 58); - if (!flags.z()) - goto notdes1; - randomNumber(); - _cmp(al, 30); - if (flags.c()) - goto notdes2; - es.word(bx+3) = 55; - goto gotrecep; -notdes1: - _cmp(es.word(bx+3), 60); - if (!flags.z()) - goto notdes2; - randomNumber(); - _cmp(al, 240); - if (flags.c()) - goto gotrecep; - es.word(bx+3) = 53; - goto gotrecep; -notdes2: - _cmp(es.word(bx+3), 88); - if (!flags.z()) - goto notendcard; - es.word(bx+3) = 53; - goto gotrecep; -notendcard: - _inc(es.word(bx+3)); -gotrecep: - showGameReel(); - addToPeopleList(); - al = es.byte(bx+7); - _and(al, 128); - if (flags.z()) - return /* (nottalkedrecep) */; - data.byte(kTalkedtorecep) = 1; -} - -void DreamGenContext::bartender() { - STACK_CHECK; - checkSpeed(); - if (!flags.z()) - goto gotsmoket; - _cmp(es.word(bx+3), 86); - if (!flags.z()) - goto notsmoket1; - randomNumber(); - _cmp(al, 18); - if (flags.c()) - goto notsmoket2; - es.word(bx+3) = 81; - goto gotsmoket; -notsmoket1: - _cmp(es.word(bx+3), 103); - if (!flags.z()) - goto notsmoket2; - es.word(bx+3) = 81; - goto gotsmoket; -notsmoket2: - _inc(es.word(bx+3)); -gotsmoket: - showGameReel(); - _cmp(data.byte(kGunpassflag), 1); - if (!flags.z()) - goto notgotgun; - es.byte(bx+7) = 9; -notgotgun: - addToPeopleList(); -} - void DreamGenContext::helicopter() { STACK_CHECK; ax = es.word(bx+3); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index b7fb2495c5..a8e8a610fd 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -499,7 +499,6 @@ public: void adjustUp(); void fadeScreenDownHalf(); void fadeDownMon(); - void bartender(); void outOfOpen(); void dirCom(); void endGameSeq(); @@ -523,7 +522,6 @@ public: void findInvPos(); void getKeyAndLogo(); void selectOb(); - void receptionist(); void fadeUpMon(); void showDiaryPage(); void reExFromInv(); diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index 84f6543a19..caaea26d0d 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -29,13 +29,13 @@ static void (DreamGenContext::*reelCallbacks[57])() = { NULL, NULL, NULL, NULL, NULL, NULL, - &DreamGenContext::receptionist, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &DreamGenContext::heavy, NULL, NULL, NULL, - &DreamGenContext::bartender, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -61,13 +61,13 @@ static void (DreamGenContext::*reelCallbacksCPP[57])(ReelRoutine &) = { &DreamGenContext::eden, &DreamGenContext::edenInBath, &DreamGenContext::sparky, &DreamGenContext::smokeBloke, &DreamGenContext::manAsleep, &DreamGenContext::drunk, - /*&DreamGenContext::receptionist*/NULL, &DreamGenContext::genericPerson /*maleFan*/, + &DreamGenContext::receptionist, &DreamGenContext::genericPerson /*maleFan*/, &DreamGenContext::genericPerson /*femaleFan*/, &DreamGenContext::louis, &DreamGenContext::louisChair, &DreamGenContext::soldier1, &DreamGenContext::bossMan, &DreamGenContext::interviewer, /*&DreamGenContext::heavy*/NULL, &DreamGenContext::manAsleep /*manAsleep2*/, &DreamGenContext::genericPerson /*manSatStill*/, &DreamGenContext::drinker, - /*&DreamGenContext::bartender*/NULL, &DreamGenContext::genericPerson /*otherSmoker*/, + &DreamGenContext::bartender, &DreamGenContext::genericPerson /*otherSmoker*/, &DreamGenContext::genericPerson /*tattooMan*/, &DreamGenContext::attendant, &DreamGenContext::keeper, &DreamGenContext::candles1, &DreamGenContext::smallCandle, &DreamGenContext::security, @@ -777,4 +777,62 @@ void DreamGenContext::soldier1(ReelRoutine &routine) { addToPeopleList(&routine); } +void DreamGenContext::receptionist(ReelRoutine &routine) { + if (checkSpeed(routine)) { + if (data.byte(kCardpassflag) == 1) { + // Set card + data.byte(kCardpassflag)++; + routine.b7 = 1; + routine.b3 = 64; + } + + if (routine.b3 != 58) { + // notdes1 + if (routine.b3 != 60) { + // notdes2 + if (routine.b3 != 88) + routine.b3++; // not end card + else + routine.b3 = 53; + } else if (engine->randomNumber() >= 240) { + routine.b3 = 53; + } + } else if (engine->randomNumber() >= 30) { + routine.b3 = 55; + } else { + // notdes2 + if (routine.b3 != 88) + routine.b3++; // not end card + else + routine.b3 = 53; + } + } + + showGameReel(&routine); + addToPeopleList(&routine); + if (routine.b7 & 128) + data.byte(kTalkedtorecep) = 1; +} + +void DreamGenContext::bartender(ReelRoutine &routine) { + if (checkSpeed(routine)) { + if (routine.b3 == 86) { + if (engine->randomNumber() >= 18) + routine.b3 = 81; + else + routine.b3++; // notsmoket2 + } else if (routine.b3 == 103) { + routine.b3 = 81; // notsmoket1 + } else { + routine.b3++; // notsmoket2 + } + } + + showGameReel(&routine); + if (data.byte(kGunpassflag) == 1) + routine.b7 = 9; // got gun + + addToPeopleList(&routine); +} + } // End of namespace DreamGen diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 6a8445b991..5256111cc1 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -417,6 +417,8 @@ void introMonks1(ReelRoutine &routine); void introMonks2(ReelRoutine &routine); void soldier1(ReelRoutine &routine); + void receptionist(ReelRoutine &routine); + void bartender(ReelRoutine &routine); void singleKey(uint8 key, uint16 x, uint16 y); void loadSaveBox(); void loadKeypad(); -- cgit v1.2.3