First recording made.

This commit is contained in:
Martin Haye 2019-04-30 06:35:41 -07:00
parent 49ade7b345
commit 7a38fa534d
4 changed files with 71 additions and 13 deletions

View File

@ -1074,9 +1074,8 @@ def cursorWait(targetX, targetY)#1
// Erase target if it's still showing
if targetX <> 9999 and targetOn; showTarget(targetX, targetY); fin
i = ^kbd
^kbdStrobe
return charToUpper(i & $7F)
i = recordKey
return charToUpper(i)
end
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -120,10 +120,10 @@ def combatPause()#0
// Check for speed-up / slow-down
key = ^kbd
if key == (11 + 128) or key == ('-'+128) // up-arrow or minus
^kbdStrobe
if !recordMode; ^kbdStrobe; fin
global=>w_combatPauseCt = max(100, global=>w_combatPauseCt - addPercent(global=>w_combatPauseCt, 20))
elsif key == (10 + 128) or key == ('+'+128) // down-arrow or plus
^kbdStrobe
if !recordMode; ^kbdStrobe; fin
global=>w_combatPauseCt = min(9999, global=>w_combatPauseCt + addPercent(global=>w_combatPauseCt, 20))
fin
end
@ -1052,7 +1052,7 @@ def startCombat(mapCode)#1
// Clear keyboard stobe, because while wandering the map, the player may have
// queued up movement keys, which are made obsolete by the surprise of combat.
^kbdStrobe
if !recordMode; ^kbdStrobe; fin
// Say who we're fighting
p = global=>p_enemyGroups

View File

@ -102,6 +102,7 @@ import gamelib
predef rawDisplayStr(str)#0
predef rdkey()#1
predef readAuxByte(ptr)#1
predef recordKey()#1
predef removeFromList(pList, toRemove)#0
predef removeNamed(name, pList)#1
predef removePlayerFromParty(playerName)#0
@ -164,6 +165,7 @@ import gamelib
word pResourceIndex
word pGlobalTileset
byte isFloppyVer
byte recordMode
/////////// Shared string constants //////////////

View File

@ -198,7 +198,7 @@ export byte[] S_THEIR = "their"
//word startTick = 0
word lastTick = 0
export byte recordMode = FALSE
export byte recordMode = 0
word recordSeed
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -1071,6 +1071,21 @@ asm internal_rand16()#1
}
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Turn the printer on or off (assumes slot 1)
asm setPrinter(enable)#0
+asmPlasmNoRet 1
ldx #<ROM_cout
ldy #>ROM_cout
asl
beq +
ldx #0
ldy #$C1
+ stx cswl
sty cswh
rts
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Clear the text-mode screen, and put the text cursor at the top of it.
export asm textHome()#0
@ -1391,6 +1406,9 @@ export def getStringResponse()#1
word p
rawGetStr()
rawDisplayStr("\n") // so Outlaw user doesn't have to remember to make a newline
if recordMode
puts("STRING:"); puts($200); crout
fin
return mmgr(HEAP_INTERN, $200)
end
@ -1520,6 +1538,35 @@ export def parseDec(str)#1
return n
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def recordChar(ch)#0
if ch < $20
printChar('^')
ch = ch + $40
fin
printChar(ch)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Used in record mode to print out a keystroke. Also handles caret -> ctrl translation during
// playback of recordings.
export def recordKey()#1
byte key
key = ^kbd & $7F
^kbdStrobe
if recordMode
if key == '^'
while ^kbd < 128; loop
key = (^kbd & $7F) - $40
^kbdStrobe
fin
puts("KEY:")
recordChar(key)
crout
fin
return key
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Get a keystroke and convert it to upper case
export def getUpperKey()#1
@ -1551,9 +1598,8 @@ export def getUpperKey()#1
// pause() will terminate on keypress, returning the count it did
*seed = *seed + pause(30000)
loop
key = ^kbd
^kbdStrobe
return charToUpper(key & $7F)
key = recordKey
return charToUpper(key)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -2409,6 +2455,16 @@ def advTime(hours, mins, secs)#0
fin
end
///////////////////////////////////////////////////////////////////////////////////////////////////
def recordDisplay(str)#0
word i
puts("DISP:")
for i = 1 to ^str
recordChar(^(str + i))
next
crout
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Called by scripts to display a string. We set the flag noting that something has been
// displayed, then use an assembly routine to do the work.
@ -2422,7 +2478,7 @@ export def _scriptDisplayStr(str)#0
needRender = FALSE
fin
if textClearCountdown; clearTextWindow(); fin
if recordMode; printf1("DISP: %s\n", str); fin
if recordMode; recordDisplay(str); fin
displayStr(str)
textDrawn = TRUE
fin
@ -3199,9 +3255,10 @@ def toggleGodMode()#1
displayf1("gm:%d\n", global->b_godmode & 1)
initCmds() // rebuild the command table with new commands
else
recordMode = !recordMode
recordMode = 1 - recordMode
if recordMode; recordSeed = 1; fin
displayf1("rm:%d\n", recordMode & 1)
setPrinter(recordMode)
displayf1("rm:%d\n", recordMode)
fin
textDrawn = TRUE
beep; beep