Skip to content

Commit

Permalink
DREAMWEB: 'updatepeople' ported to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
tramboi committed Aug 15, 2011
1 parent 73d7ff3 commit 9d8e5c0
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 41 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -111,6 +111,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'copyname',
'commandwithob',
'showpanel',
'updatepeople',
], skip_output = [
# These functions are processed but not output
'dreamweb',
Expand Down
38 changes: 0 additions & 38 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -2651,43 +2651,6 @@ void DreamGenContext::widedoor() {
dodoor();
}

void DreamGenContext::updatepeople() {
STACK_CHECK;
es = data.word(kBuffers);
di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5));
data.word(kListpos) = di;
cx = 12*5;
al = 255;
_stosb(cx, true);
_inc(data.word(kMaintimer));
es = cs;
bx = 534;
di = 991;
updateloop:
al = es.byte(bx);
_cmp(al, 255);
if (flags.z())
return /* (endupdate) */;
_cmp(al, data.byte(kReallocation));
if (!flags.z())
goto notinthisroom;
cx = es.word(bx+1);
_cmp(cl, data.byte(kMapx));
if (!flags.z())
goto notinthisroom;
_cmp(ch, data.byte(kMapy));
if (!flags.z())
goto notinthisroom;
push(di);
ax = cs.word(di);
__dispatch_call(ax);
di = pop();
notinthisroom:
_add(bx, 8);
_add(di, 2);
goto updateloop;
}

void DreamGenContext::reelsonscreen() {
STACK_CHECK;
reconstruct();
Expand Down Expand Up @@ -19234,7 +19197,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_constant: constant(); break;
case addr_doorway: doorway(); break;
case addr_widedoor: widedoor(); break;
case addr_updatepeople: updatepeople(); break;
case addr_reelsonscreen: reelsonscreen(); break;
case addr_soundonreels: soundonreels(); break;
case addr_reconstruct: reconstruct(); break;
Expand Down
3 changes: 1 addition & 2 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -625,7 +625,6 @@ class DreamGenContext : public Context {
static const uint16 addr_reconstruct = 0xc1ac;
static const uint16 addr_soundonreels = 0xc1a8;
static const uint16 addr_reelsonscreen = 0xc1a0;
static const uint16 addr_updatepeople = 0xc198;
static const uint16 addr_widedoor = 0xc18c;
static const uint16 addr_doorway = 0xc188;
static const uint16 addr_constant = 0xc184;
Expand Down Expand Up @@ -1416,7 +1415,7 @@ class DreamGenContext : public Context {
void eden();
void showdiary();
void purgealocation();
void updatepeople();
//void updatepeople();
void slabdoorf();
void addtopeoplelist();
void hangoncurs();
Expand Down
145 changes: 145 additions & 0 deletions engines/dreamweb/sprite.cpp
Expand Up @@ -619,5 +619,150 @@ void DreamGenContext::showrain() {
}
}

void DreamGenContext::updatepeople() {
data.word(kListpos) = kPeoplelist;
memset(segRef(data.word(kBuffers)).ptr(kPeoplelist, 12 * sizeof(People)), 0xff, 12 * sizeof(People));
++data.word(kMaintimer);
es = cs;
bx = kReelroutines;
const ReelRoutine *reelRoutine = (const ReelRoutine *)cs.ptr(bx, 0);
const uint16 *callbacks = (const uint16 *)cs.ptr(kReelcalls, 0);
while (true) {
uint8 realLocation = reelRoutine->reallocation;
if (realLocation == 255)
return;
if ((realLocation == data.byte(kReallocation)) &&
(reelRoutine->mapX == data.byte(kMapx)) &&
(reelRoutine->mapY == data.byte(kMapy))) {
uint16 callback = READ_LE_UINT16(callbacks);
//dw gamer,sparkydrip,eden,edeninbath,sparky,smokebloke
if (callback == addr_gamer)
gamer();
else if (callback == addr_sparkydrip)
sparkydrip();
else if (callback == addr_eden)
eden();
else if (callback == addr_edeninbath)
edeninbath();
else if (callback == addr_sparky)
sparky();
else if (callback == addr_smokebloke)
smokebloke();
//dw manasleep,drunk,receptionist,malefan,femalefan
else if (callback == addr_manasleep)
manasleep();
else if (callback == addr_drunk)
drunk();
else if (callback == addr_receptionist)
receptionist();
else if (callback == addr_malefan)
malefan();
else if (callback == addr_femalefan)
femalefan();
//dw louis,louischair,soldier1,bossman,interviewer
else if (callback == addr_louis)
louis();
else if (callback == addr_louischair)
louischair();
else if (callback == addr_soldier1)
soldier1();
else if (callback == addr_bossman)
bossman();
else if (callback == addr_interviewer)
interviewer();
//dw heavy,manasleep2,mansatstill,drinker,bartender
else if (callback == addr_heavy)
heavy();
else if (callback == addr_manasleep2)
manasleep2();
else if (callback == addr_mansatstill)
mansatstill();
else if (callback == addr_drinker)
drinker();
else if (callback == addr_bartender)
bartender();
//dw othersmoker,tattooman,attendant,keeper,candles1
else if (callback == addr_othersmoker)
othersmoker();
else if (callback == addr_tattooman)
tattooman();
else if (callback == addr_attendant)
attendant();
else if (callback == addr_keeper)
keeper();
else if (callback == addr_candles1)
candles1();
//dw smallcandle,security,copper,poolguard,rockstar
else if (callback == addr_smallcandle)
smallcandle();
else if (callback == addr_security)
security();
else if (callback == addr_copper)
copper();
else if (callback == addr_poolguard)
poolguard();
else if (callback == addr_rockstar)
rockstar();
//dw businessman,train,aide,mugger,helicopter
else if (callback == addr_businessman)
businessman();
else if (callback == addr_train)
train();
else if (callback == addr_aide)
aide();
else if (callback == addr_mugger)
mugger();
else if (callback == addr_helicopter)
helicopter();
//dw intromagic1,intromusic,intromagic2,candles2,gates
else if (callback == addr_intromagic1)
intromagic1();
else if (callback == addr_intromusic)
intromusic();
else if (callback == addr_intromagic2)
intromagic2();
else if (callback == addr_candles2)
candles2();
else if (callback == addr_gates)
gates();
//dw intromagic3,intromonks1,candles,intromonks2
else if (callback == addr_intromagic3)
intromagic3();
else if (callback == addr_intromonks1)
intromonks1();
else if (callback == addr_candles)
candles();
else if (callback == addr_intromonks2)
intromonks2();
//dw handclap,monkandryan,endgameseq,priest,madman
else if (callback == addr_handclap)
handclap();
else if (callback == addr_monkandryan)
monkandryan();
else if (callback == addr_endgameseq)
endgameseq();
else if (callback == addr_priest)
priest();
else if (callback == addr_madman)
madman();
//dw madmanstelly,alleybarksound,foghornsound
else if (callback == addr_madmanstelly)
madmanstelly();
else if (callback == addr_alleybarksound)
alleybarksound();
else if (callback == addr_foghornsound)
foghornsound();
//dw carparkdrip,carparkdrip,carparkdrip,carparkdrip
else if (callback == addr_carparkdrip)
carparkdrip();
else
assert(false); // Oops I forgot something in the dispatch table
}
bx += 8;
++reelRoutine;
++callbacks;
}
}

} /*namespace dreamgen */

11 changes: 11 additions & 0 deletions engines/dreamweb/structs.h
Expand Up @@ -96,6 +96,17 @@ struct Reel {
uint8 b4;
};

struct ReelRoutine {
uint8 reallocation;
uint8 mapX;
uint8 mapY;
uint8 b3;
uint8 b4;
uint8 b5;
uint8 b6;
uint8 b7;
};

struct People {
uint8 b0;
uint8 b1;
Expand Down
2 changes: 1 addition & 1 deletion engines/dreamweb/stubs.h
Expand Up @@ -127,5 +127,5 @@
void commandwithob();
void commandwithob(uint8 command, uint8 type, uint8 index);
void showpanel();

void updatepeople();

0 comments on commit 9d8e5c0

Please sign in to comment.