From a278ff1e852bccaca5f652afdc4a9a1f564ada77 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Tue, 20 Jan 2009 18:50:30 +0000 Subject: [PATCH] Do "proper" ansic() translation, and reset the colour after each \n since this is how prompt()/print() behave. Colours should be "right" now. --- xtrn/mc/mc.js | 7 ++++--- xtrn/mc/shared.js | 47 +++++++++++++++++++++++++++++++++++++++++++++-- xtrn/mc/slots.js | 1 + 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/xtrn/mc/mc.js b/xtrn/mc/mc.js index f4557ebac4..a0a5694ff8 100644 --- a/xtrn/mc/mc.js +++ b/xtrn/mc/mc.js @@ -173,7 +173,7 @@ function find_player() var found=false; var i; - if(messagefile.length==0) { + if((!messagefile.exists) || messagefile.length==0) { messagefile.open('a'); messagefile.writeln('Current file begins on '+system.datestr()+'.'); messagefile.writeln(''); @@ -306,7 +306,7 @@ function check_played(i) function logon(a) { var j=' '; - ansic(5); + ansic(4); console.print(j); console.print('赏屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯屯突\r\n'); ansic(4); @@ -404,6 +404,7 @@ function logon(a) ansic(2); console.print('!\r\n'); } + ansic(0); } function general_instructions() @@ -490,6 +491,7 @@ function mc_main() setcol(1); console.print("Do you wish to see what's\r\n"); console.print("happened to the others in the game? "); + setcol(0); if(yn()) { console.printfile(messagefile.name); console.pause(); @@ -497,7 +499,6 @@ function mc_main() done=false; slot=roul=twenty=bacc=false; do { - ansic(7); tleft(); checkhangup(); if(hangup) diff --git a/xtrn/mc/shared.js b/xtrn/mc/shared.js index 43b99cf336..3889da4b49 100644 --- a/xtrn/mc/shared.js +++ b/xtrn/mc/shared.js @@ -161,8 +161,50 @@ function tleft() {} function sysoplog() {} function ansic(x) { - // TODO: This needs a proper mapping... - console.attributes=x; + if(x==1 || x==0) + x=0; + else { + if(x==2) + x=7; + else + x-=2; + } + + switch(x) { + case 0: + console.attributes=7; + break; + case 1: + console.attributes=LIGHTCYAN; + break; + case 2: + console.attributes=YELLOW; + break; + case 3: + console.attributes=MAGENTA; + break; + case 4: + console.attributes=WHITE|BG_BLUE; + break; + case 5: + console.attributes=GREEN; + break; + case 6: + console.attributes=LIGHTRED|BLINK; + break; + case 7: + console.attributes=LIGHTBLUE; + break; + case 8: + console.attributes=BLUE; + break; + case 9: + console.attributes=CYAN; + break; + default: + console.attributes=7; + break; + } } function checkhangup() @@ -1079,6 +1121,7 @@ function date_kathy() console.crlf(); ansic(8); console.print("FOOLED YOU DIDN'T I!"+'\r\n'); + ansic(0); console.crlf(); console.print("This is a family program, so leaving out the details, let's just say"+'\r\n'); console.print('that you leave the suite 12 hours later, with a smile on your face and'+'\r\n'); diff --git a/xtrn/mc/slots.js b/xtrn/mc/slots.js index 390f581ff4..5cb1623dbe 100644 --- a/xtrn/mc/slots.js +++ b/xtrn/mc/slots.js @@ -69,6 +69,7 @@ function slots_process_bets() ansic(4); console.print('*** '); ansic(8); console.print('JACKPOT'); ansic(4); console.print(' ***\r\n'); + ansic(0); sysoplog(player.name+'WON THE JACKPOT!!!'); console.crlf(); break; -- GitLab