DREAMWEB: Port 'showkeys' to C++

This commit is contained in:
Filippos Karapetis 2011-12-18 15:43:03 +02:00
parent a5879196df
commit 362f21d30d
5 changed files with 37 additions and 35 deletions

View File

@ -764,6 +764,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'showgun',
'showicon',
'showkeypad',
'showkeys',
'showleftpage',
'showloadops',
'showmainops',

View File

@ -2129,33 +2129,6 @@ passpassed:
es.byte(bx) = 1;
}
void DreamGenContext::showKeys() {
STACK_CHECK;
cx = 10;
randomAccess();
scrollMonitor();
al = 18;
monMessage();
es = cs;
bx = offset_keys;
cx = 4;
keysloop:
push(cx);
push(bx);
_cmp(es.byte(bx), 0);
if (flags.z())
goto notheld;
_add(bx, 14);
monPrint();
notheld:
bx = pop();
cx = pop();
_add(bx, 26);
if (--cx)
goto keysloop;
scrollMonitor();
}
void DreamGenContext::read() {
STACK_CHECK;
cx = 40;

View File

@ -495,7 +495,6 @@ public:
void purgeAnItem();
void purgeALocation();
void getSetAd();
void showKeys();
void nextColon();
void findOpenPos();
void deleteExFrame();

View File

@ -25,21 +25,33 @@
namespace DreamGen {
struct MonitorKeyEntry {
uint8 b0;
uint8 b1;
char b2[24];
uint8 keyHeld;
uint8 b1; // unused, for alignment
char userpass[24];
//char password[12]; // for the new monitor key list below
//char username[12]; // for the new monitor key list below
};
#if 0
// New monitor key list
static MonitorKeyEntry monitorKeyEntries[4] = {
{ 1, "PUBLIC ", "PUBLIC " },
{ 0, "BLACKDRAGON", "RYAN " },
{ 0, "HENDRIX ", "LOUIS " },
{ 0, "SEPTIMUS ", "BECKETT " }
};
#endif
void DreamGenContext::useMon() {
data.byte(kLasttrigger) = 0;
memset(data.ptr(kCurrentfile+1, 0), ' ', 12);
memset(data.ptr(offset_operand1+1, 0), ' ', 12);
MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0);
monitorKeyEntries[0].b0 = 1;
monitorKeyEntries[1].b0 = 0;
monitorKeyEntries[2].b0 = 0;
monitorKeyEntries[3].b0 = 0;
monitorKeyEntries[0].keyHeld = 1;
monitorKeyEntries[1].keyHeld = 0;
monitorKeyEntries[2].keyHeld = 0;
monitorKeyEntries[3].keyHeld = 0;
createPanel();
showPanel();
@ -417,4 +429,20 @@ void DreamBase::loadCart() {
data.word(kTextfile3) = standardLoad("DREAMWEB.T24"); // monitor file 24
}
void DreamGenContext::showKeys() {
randomAccess(10);
scrollMonitor();
monMessage(18);
MonitorKeyEntry *monitorKeyEntries = (MonitorKeyEntry *)data.ptr(offset_keys, 0);
for (int i = 0; i < 4; i++) {
if (monitorKeyEntries[i].keyHeld)
monPrint(monitorKeyEntries[i].userpass + 12); // username
//monPrint(monitorKeyEntries[i].username);
}
scrollMonitor();
}
} // End of namespace DreamGen

View File

@ -369,5 +369,6 @@
uint16 findInvPosCPP();
void setPickup();
void showDiaryKeys();
void showKeys();
#endif