Skip to content

Commit

Permalink
DREAMWEB: 'watchcount' ported to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
tramboi committed Nov 16, 2011
1 parent 1fefbc6 commit 606bde9
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 47 deletions.
1 change: 1 addition & 0 deletions devtools/tasmrecover/tasm-recover
Expand Up @@ -219,6 +219,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'startpaltoend',
'paltoendpal',
'fadecalculation',
'watchcount',
], skip_output = [
# These functions are processed but not output
'dreamweb',
Expand Down
44 changes: 0 additions & 44 deletions engines/dreamweb/dreamgen.cpp
Expand Up @@ -13521,49 +13521,6 @@ void DreamGenContext::checkforshake() {
data.byte(kShakecounter) = -1;
}

void DreamGenContext::watchcount() {
STACK_CHECK;
_cmp(data.byte(kWatchon), 0);
if (flags.z())
return /* (nowatchworn) */;
_inc(data.byte(kTimercount));
_cmp(data.byte(kTimercount), 9);
if (flags.z())
goto flashdots;
_cmp(data.byte(kTimercount), 18);
if (flags.z())
goto uptime;
return;
flashdots:
ax = 91*3+21;
di = 268+4;
bx = 21;
ds = data.word(kCharset1);
showframe();
goto finishwatch;
uptime:
data.byte(kTimercount) = 0;
_add(data.byte(kSecondcount), 1);
_cmp(data.byte(kSecondcount), 60);
if (!flags.z())
goto finishtime;
data.byte(kSecondcount) = 0;
_inc(data.byte(kMinutecount));
_cmp(data.byte(kMinutecount), 60);
if (!flags.z())
goto finishtime;
data.byte(kMinutecount) = 0;
_inc(data.byte(kHourcount));
_cmp(data.byte(kHourcount), 24);
if (!flags.z())
goto finishtime;
data.byte(kHourcount) = 0;
finishtime:
showtime();
finishwatch:
data.byte(kWatchdump) = 1;
}

void DreamGenContext::showtime() {
STACK_CHECK;
_cmp(data.byte(kWatchon), 0);
Expand Down Expand Up @@ -16526,7 +16483,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_screenupdate: screenupdate(); break;
case addr_watchreel: watchreel(); break;
case addr_checkforshake: checkforshake(); break;
case addr_watchcount: watchcount(); break;
case addr_showtime: showtime(); break;
case addr_dumpwatch: dumpwatch(); break;
case addr_showbyte: showbyte(); break;
Expand Down
5 changes: 2 additions & 3 deletions engines/dreamweb/dreamgen.h
Expand Up @@ -114,7 +114,6 @@ class DreamGenContext : public Context {
static const uint16 addr_showbyte = 0xc9b4;
static const uint16 addr_dumpwatch = 0xc9b0;
static const uint16 addr_showtime = 0xc9ac;
static const uint16 addr_watchcount = 0xc9a8;
static const uint16 addr_checkforshake = 0xc9a4;
static const uint16 addr_watchreel = 0xc9a0;
static const uint16 addr_screenupdate = 0xc99c;
Expand Down Expand Up @@ -1346,7 +1345,7 @@ class DreamGenContext : public Context {
//void showblink();
void mousecall();
void train();
void watchcount();
//void checkiffree();
void fadedownmon();
void loadcart();
//void splitintolines();
Expand Down Expand Up @@ -1973,7 +1972,7 @@ class DreamGenContext : public Context {
void usehole();
void useobject();
void volumeadjust();
//void checkiffree();
//void watchcount();
};
}

Expand Down
25 changes: 25 additions & 0 deletions engines/dreamweb/stubs.cpp
Expand Up @@ -1951,6 +1951,31 @@ void DreamGenContext::showwatch() {
}
}

void DreamGenContext::watchcount() {
if (data.byte(kWatchon) == 0)
return;
++data.byte(kTimercount);
if (data.byte(kTimercount) == 9) {
showframe((Frame *)segRef(data.word(kCharset1)).ptr(0, 0), 268+4, 21, 91*3+21, 0);
data.byte(kWatchdump) = 1;
} else if (data.byte(kTimercount) == 18) {
data.byte(kTimercount) = 0;
++data.byte(kSecondcount);
if (data.byte(kSecondcount) == 60) {
data.byte(kSecondcount) = 0;
++data.byte(kMinutecount);
if (data.byte(kMinutecount) == 60) {
data.byte(kMinutecount) = 0;
++data.byte(kHourcount);
if (data.byte(kHourcount) == 24)
data.byte(kHourcount) = 0;
}
}
showtime();
data.byte(kWatchdump) = 1;
}
}

void DreamGenContext::roomname() {
printmessage(88, 18, 53, 240, false);
uint16 textIndex = data.byte(kRoomnum);
Expand Down
2 changes: 2 additions & 0 deletions engines/dreamweb/stubs.h
Expand Up @@ -265,4 +265,6 @@
void startpaltoend();
void paltoendpal();
void fadecalculation();
void watchcount();


0 comments on commit 606bde9

Please sign in to comment.