DREAMWEB: 'showblink' ported to C++

This commit is contained in:
Bertrand Augereau 2011-08-24 13:20:18 +02:00
parent 92baa570d1
commit 7f7775e574
5 changed files with 26 additions and 42 deletions

View File

@ -149,6 +149,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'walkandexamine',
'obname',
'delpointer',
'showblink',
], skip_output = [
# These functions are processed but not output
'dreamweb',

View File

@ -16238,42 +16238,6 @@ void DreamGenContext::zoomicon() {
showframe();
}
void DreamGenContext::showblink() {
STACK_CHECK;
_cmp(data.byte(kManisoffscreen), 1);
if (flags.z())
return /* (finblink1) */;
_inc(data.byte(kBlinkcount));
_cmp(data.byte(kShadeson), 0);
if (!flags.z())
return /* (finblink1) */;
_cmp(data.byte(kReallocation), 50);
if (!flags.c())
return /* (eyesshut) */;
al = data.byte(kBlinkcount);
_cmp(al, 3);
if (!flags.z())
return /* (finblink1) */;
data.byte(kBlinkcount) = 0;
al = data.byte(kBlinkframe);
_inc(al);
data.byte(kBlinkframe) = al;
_cmp(al, 6);
if (flags.c())
goto nomorethan6;
al = 6;
nomorethan6:
ah = 0;
bx = offset_blinktab;
_add(bx, ax);
al = cs.byte(bx);
ds = data.word(kIcons1);
di = 44;
bx = 32;
ah = 0;
showframe();
}
void DreamGenContext::dumpblink() {
STACK_CHECK;
_cmp(data.byte(kShadeson), 0);
@ -18347,7 +18311,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_showwatch: showwatch(); break;
case addr_gettime: gettime(); break;
case addr_zoomicon: zoomicon(); break;
case addr_showblink: showblink(); break;
case addr_dumpblink: dumpblink(); break;
case addr_worktoscreenm: worktoscreenm(); break;
case addr_blank: blank(); break;

View File

@ -99,7 +99,6 @@ public:
static const uint16 addr_blank = 0xcaa0;
static const uint16 addr_worktoscreenm = 0xca9c;
static const uint16 addr_dumpblink = 0xca98;
static const uint16 addr_showblink = 0xca94;
static const uint16 addr_zoomicon = 0xca90;
static const uint16 addr_gettime = 0xca8c;
static const uint16 addr_showwatch = 0xca88;
@ -679,7 +678,7 @@ public:
static const uint16 offset_savelist = 0x0f44;
static const uint16 offset_mainlist = 0x1402;
static const uint16 offset_gameerror8 = 0x113f;
static const uint16 offset_blinktab = 0x1700;
static const uint16 offset_gameerror5 = 0x1074;
static const uint16 offset_error2patch = 0x0ff6;
static const uint16 offset_openchangesize = 0x0a1c;
static const uint16 offset_keys = 0x0b14;
@ -711,14 +710,13 @@ public:
static const uint16 offset_error6patch = 0x10fe;
static const uint16 offset_keybuffer = 0x1718;
static const uint16 offset_speechfilename = 0x13eb;
static const uint16 offset_folderlist = 0x0e34;
static const uint16 offset_rootdir = 0x0b8c;
static const uint16 offset_gameerror3 = 0x1003;
static const uint16 offset_rainlocations = 0x0459;
static const uint16 offset_diarylist = 0x0e9c;
static const uint16 offset_opslist = 0x0ec6;
static const uint16 offset_symbollist = 0x0e5e;
static const uint16 offset_gameerror5 = 0x1074;
static const uint16 offset_folderlist = 0x0e34;
static const uint16 offset_facelist = 0x0451;
static const uint16 offset_operand1 = 0x0b7e;
static const uint16 offset_keypadlist = 0x0d9a;
@ -1417,7 +1415,7 @@ public:
void loadintotemp();
void loadintroroom();
void saveseg();
void showblink();
//void showblink();
void mousecall();
void train();
void watchcount();

View File

@ -1277,6 +1277,27 @@ void DreamGenContext::delpointer() {
multiput(segRef(data.word(kBuffers)).ptr(kPointerback, 0), data.word(kDelherex), data.word(kDelherey), data.byte(kPointerxs), data.byte(kPointerys));
}
void DreamGenContext::showblink() {
if (data.byte(kManisoffscreen) == 1)
return;
++data.byte(kBlinkcount);
if (data.byte(kShadeson) != 0)
return;
if (data.byte(kReallocation) >= 50) // eyesshut
return;
if (data.byte(kBlinkcount) != 3)
return;
data.byte(kBlinkcount) = 0;
uint8 blinkFrame = data.byte(kBlinkframe);
++blinkFrame; // Implicit %256
data.byte(kBlinkframe) = blinkFrame;
if (blinkFrame > 6)
blinkFrame = 6;
static const uint8 blinkTab[] = { 16,18,18,17,16,16,16 };
uint8 width, height;
showframe((Frame *)segRef(data.word(kIcons1)).ptr(0, 0), 44, 32, blinkTab[blinkFrame], 0, &width, &height);
}
bool DreamGenContext::isCD() {
// The original sources has two codepaths depending if the game is 'if cd' or not
// This is a hack to guess which version to use with the assumption that if we have a cd version

View File

@ -179,4 +179,5 @@
void obname();
void obname(uint8 command, uint8 commandType);
void delpointer();
void showblink();