DREAMWEB: Port 'getkeyandlogo' to C++

This commit is contained in:
Filippos Karapetis 2011-12-18 16:43:05 +02:00
parent 362f21d30d
commit 62dc71a73a
5 changed files with 21 additions and 46 deletions

View File

@ -453,6 +453,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'getdimension',
'getexpos',
'getflagunderp',
'getkeyandlogo',
'getlocation',
'getmapad',
'getnamepos',
@ -520,6 +521,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'keeper',
'kernchars',
'keyboardread',
'keynum',
'lastdest',
'lastfolder',
'liftnoise',

View File

@ -2298,51 +2298,6 @@ endofdir2:
scrollMonitor();
}
void DreamGenContext::getKeyAndLogo() {
STACK_CHECK;
_inc(bx);
al = es.byte(bx);
_sub(al, 48);
data.byte(kNewlogonum) = al;
_add(bx, 2);
al = es.byte(bx);
_sub(al, 48);
data.byte(kKeynum) = al;
_inc(bx);
push(es);
push(bx);
al = data.byte(kKeynum);
ah = 0;
cx = 26;
_mul(cx);
es = cs;
bx = offset_keys;
_add(bx, ax);
al = es.byte(bx);
_cmp(al, 1);
if (flags.z())
goto keyok;
push(bx);
push(es);
al = 12;
monMessage();
es = pop();
bx = pop();
_add(bx, 14);
monPrint();
scrollMonitor();
bx = pop();
es = pop();
al = 1;
return;
keyok:
bx = pop();
es = pop();
al = data.byte(kNewlogonum);
data.byte(kLogonum) = al;
al = 0;
}
void DreamGenContext::searchForString() {
STACK_CHECK;
dl = es.byte(di);

View File

@ -487,7 +487,6 @@ public:
void removeObFromInv();
void dirFile();
void pickupConts();
void getKeyAndLogo();
void fadeUpMon();
void reExFromInv();
void outOfInv();

View File

@ -445,4 +445,22 @@ void DreamGenContext::showKeys() {
scrollMonitor();
}
void DreamGenContext::getKeyAndLogo() {
byte newLogo = es.byte(bx + 1) - 48;
MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0);
byte keyNum = es.byte(bx + 1 + 2) - 48;
bx += 1 + 2 + 1;
if (monitorKeyEntries[keyNum].keyHeld == 1) {
// Key OK
data.byte(kLogonum) = newLogo;
al = 0;
} else {
monMessage(12); // "Access denied, key required -"
monPrint(monitorKeyEntries[keyNum].userpass + 12); // username
scrollMonitor();
al = 1;
}
}
} // End of namespace DreamGen

View File

@ -370,5 +370,6 @@
void setPickup();
void showDiaryKeys();
void showKeys();
void getKeyAndLogo();
#endif