mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-06-28 14:30:04 +00:00
Centralized all shared function vectors for efficiency; made mem debug printout fit on screen; use better notation for pointer-to-pointer; fixed bug causing combat to fail on 3D map.
This commit is contained in:
parent
12a1427af6
commit
c4e46238cd
|
@ -1637,20 +1637,20 @@ class PackPartitions
|
|||
|
||||
def locationsWithTriggers = [] as Set
|
||||
|
||||
def vec_setScriptInfo = 0x300
|
||||
def vec_pushAuxStr = 0x303
|
||||
def vec_displayStr = 0x306
|
||||
def vec_displayStrNL = 0x309
|
||||
def vec_getYN = 0x30C
|
||||
def vec_setMap = 0x30F
|
||||
def vec_setSky = 0x312
|
||||
def vec_setGround = 0x315
|
||||
def vec_teleport = 0x318
|
||||
def vec_setPortrait = 0x31B
|
||||
def vec_clrPortrait = 0x31E
|
||||
def vec_moveBackward = 0x321
|
||||
def vec_getCharacter = 0x324
|
||||
def vec_clrTextWindow = 0x327
|
||||
def vec_setScriptInfo = 0x1F00
|
||||
def vec_pushAuxStr = 0x1F03
|
||||
def vec_displayStr = 0x1F06
|
||||
def vec_displayStrNL = 0x1F09
|
||||
def vec_getYN = 0x1F0C
|
||||
def vec_setMap = 0x1F0F
|
||||
def vec_setSky = 0x1F12
|
||||
def vec_setGround = 0x1F15
|
||||
def vec_teleport = 0x1F18
|
||||
def vec_setPortrait = 0x1F1B
|
||||
def vec_clrPortrait = 0x1F1E
|
||||
def vec_moveBackward = 0x1F21
|
||||
def vec_getCharacter = 0x1F24
|
||||
def vec_clrTextWindow = 0x1F27
|
||||
|
||||
def emitAuxString(inStr)
|
||||
{
|
||||
|
|
|
@ -1525,46 +1525,76 @@ saneEnd: !zone {
|
|||
;------------------------------------------------------------------------------
|
||||
!if DEBUG {
|
||||
printMem: !zone
|
||||
jsr main_debug
|
||||
jmp aux_debug
|
||||
main_debug:
|
||||
lda $24 ; check if we're already at start of screen line
|
||||
beq + ; no, no need for CR
|
||||
jsr crout ; carriage return to get to start of screen line
|
||||
+ lda isAuxCmd
|
||||
bne aux_printMem
|
||||
main_printMem:
|
||||
+prStr : !text "MainMem:",0
|
||||
ldy #0
|
||||
jmp .printSegs
|
||||
aux_debug:
|
||||
beq +
|
||||
aux_printMem:
|
||||
+prStr : !text "AuxMem: ",0
|
||||
ldy #1
|
||||
+ ldx #14
|
||||
.printSegs:
|
||||
tya
|
||||
tax
|
||||
lda #'s'
|
||||
jsr .prChrEq
|
||||
lda #'t'
|
||||
ldx tSegType,y
|
||||
jsr .prChrEq
|
||||
lda #'n'
|
||||
ldx tSegRes,y
|
||||
jsr .prChrEq
|
||||
lda #'a'
|
||||
ldx tSegAdrHi,y
|
||||
jsr .prChrEq
|
||||
- +prSpace
|
||||
dex
|
||||
bne -
|
||||
lda #'$'
|
||||
jsr cout
|
||||
lda tSegAdrHi,y
|
||||
jsr prbyte
|
||||
lda tSegAdrLo,y
|
||||
jsr prbyte
|
||||
jsr crout
|
||||
.next: lda tSegLink,y
|
||||
tay
|
||||
bne .printSegs
|
||||
rts
|
||||
.prChrEq:
|
||||
lda #','
|
||||
jsr cout
|
||||
lda #'L'
|
||||
jsr cout
|
||||
lda tSegLink,y
|
||||
tax
|
||||
lda tSegAdrLo,x
|
||||
sec
|
||||
sbc tSegAdrLo,y
|
||||
pha
|
||||
lda #$A0
|
||||
jsr cout
|
||||
lda tSegAdrHi,x
|
||||
sbc tSegAdrHi,y
|
||||
jsr prbyte
|
||||
pla
|
||||
jsr cout
|
||||
lda #'='
|
||||
jsr cout
|
||||
jsr prbyte
|
||||
lda tSegType,y
|
||||
tax
|
||||
and #$40
|
||||
beq +
|
||||
lda #'*'
|
||||
bne ++
|
||||
+ lda #'+'
|
||||
cpx #0
|
||||
bmi ++
|
||||
lda #'-'
|
||||
++ jsr cout
|
||||
txa
|
||||
jmp prbyte
|
||||
and #$F
|
||||
tax
|
||||
jsr prhex
|
||||
txa
|
||||
beq +
|
||||
lda #':'
|
||||
jsr cout
|
||||
lda tSegRes,y
|
||||
+prA
|
||||
jmp .next
|
||||
+ ldx #4
|
||||
- +prSpace
|
||||
dex
|
||||
bne -
|
||||
.next: ldx #3 ; 2 spaces before next entry
|
||||
lda tSegLink,y
|
||||
tay
|
||||
beq +
|
||||
jmp .printSegs
|
||||
+ jmp crout
|
||||
}
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -1594,14 +1624,7 @@ reset: !zone
|
|||
|
||||
;------------------------------------------------------------------------------
|
||||
outOfMemErr: !zone
|
||||
!if DEBUG {
|
||||
lda isAuxCmd
|
||||
bne +
|
||||
jsr main_debug
|
||||
jmp ++
|
||||
+ jsr aux_debug
|
||||
++
|
||||
}
|
||||
!if DEBUG { jsr printMem }
|
||||
jsr inlineFatal : !text "OutOfMem", 0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
@ -1776,6 +1799,7 @@ shared_scan: !zone
|
|||
+ rts
|
||||
|
||||
invalParam: !zone
|
||||
!if DEBUG { jsr printMem }
|
||||
jsr inlineFatal : !text "InvalParam", 0
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
|
|
|
@ -190,7 +190,7 @@ def playerCombatChoose(pl)
|
|||
loop
|
||||
|
||||
// NPCs always melee for now
|
||||
if pl=>b_playerFlags & PLAYER_FLAG_NPC
|
||||
if pl->b_playerFlags & PLAYER_FLAG_NPC
|
||||
pl->b_combatChoice = 'M'
|
||||
return
|
||||
fin
|
||||
|
@ -301,7 +301,7 @@ def enemyCombatTurn(pe)
|
|||
|
||||
// Choose a target
|
||||
pl = randomFromListFiltered(global=>p_players, p_nextObj, @canFight)
|
||||
if !pl; return; fin
|
||||
if !pl; return FALSE; fin
|
||||
|
||||
buildString(@addToString)
|
||||
printf3("\n%s %s %s ", pe=>s_name, pe=>s_attackText, pl=>s_name)
|
||||
|
@ -322,6 +322,7 @@ def enemyCombatTurn(pe)
|
|||
puts("\n")
|
||||
|
||||
displayStr(finishString(0))
|
||||
return TRUE
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -329,7 +330,7 @@ def combatInsert(toAdd)
|
|||
word p, pPrev
|
||||
|
||||
// Find the proper position based on combat order number (keep largest first in the list)
|
||||
pPrev = global + p_combatFirst
|
||||
pPrev = @global=>p_combatFirst
|
||||
while TRUE
|
||||
p = *pPrev
|
||||
if !p or p->b_combatOrder < toAdd->b_combatOrder
|
||||
|
@ -458,7 +459,7 @@ def doCombat()
|
|||
while TRUE
|
||||
p = global=>p_players
|
||||
while p
|
||||
if canFight(p)
|
||||
if canFight(p) and nEnemiesFighting
|
||||
playerCombatChoose(p)
|
||||
fin
|
||||
p = p=>p_nextObj
|
||||
|
@ -502,13 +503,15 @@ def doCombat()
|
|||
if canFight(p)
|
||||
when p->t_type
|
||||
is TYPE_PLAYER
|
||||
playerCombatTurn(p); break
|
||||
playerCombatTurn(p)
|
||||
combatPause()
|
||||
break
|
||||
is TYPE_ENEMY
|
||||
enemyCombatTurn(p); break
|
||||
if enemyCombatTurn(p); combatPause(); fin
|
||||
break
|
||||
otherwise
|
||||
brk()
|
||||
wend
|
||||
combatPause()
|
||||
fin
|
||||
p = p=>p_combatNext
|
||||
loop
|
||||
|
|
|
@ -55,53 +55,67 @@ const HEAP_COLLECT = $24
|
|||
// Shared library routines
|
||||
const gameLibVecs = $1F00
|
||||
|
||||
const getGlobals = gameLibVecs + 3*0
|
||||
const rand16 = gameLibVecs + 3*1
|
||||
const printf1 = gameLibVecs + 3*2
|
||||
const printf2 = gameLibVecs + 3*3
|
||||
const printf3 = gameLibVecs + 3*4
|
||||
const printf4 = gameLibVecs + 3*5
|
||||
const displayf1 = gameLibVecs + 3*6
|
||||
const displayf2 = gameLibVecs + 3*7
|
||||
const displayf3 = gameLibVecs + 3*8
|
||||
const displayf4 = gameLibVecs + 3*9
|
||||
const buildString = gameLibVecs + 3*10
|
||||
const addToString = gameLibVecs + 3*11
|
||||
const finishString = gameLibVecs + 3*12
|
||||
const rawDisplayStr = gameLibVecs + 3*13
|
||||
const displayStr = gameLibVecs + 3*14
|
||||
const puts = gameLibVecs + 3*15
|
||||
const min = gameLibVecs + 3*16
|
||||
const max = gameLibVecs + 3*17
|
||||
const countList = gameLibVecs + 3*18
|
||||
const countListFiltered = gameLibVecs + 3*19
|
||||
const randomFromListFiltered = gameLibVecs + 3*20
|
||||
const addToList = gameLibVecs + 3*21
|
||||
const getUpperKey = gameLibVecs + 3*22
|
||||
const beep = gameLibVecs + 3*23
|
||||
const showParty = gameLibVecs + 3*24
|
||||
const mmgr = gameLibVecs + 3*25
|
||||
const setPortrait = gameLibVecs + 3*26
|
||||
const setWindow1 = gameLibVecs + 3*27
|
||||
const setWindow2 = gameLibVecs + 3*28
|
||||
const setWindow3 = gameLibVecs + 3*29
|
||||
const clearWindow = gameLibVecs + 3*30
|
||||
const getYN = gameLibVecs + 3*31
|
||||
const reboot = gameLibVecs + 3*32
|
||||
const brk = gameLibVecs + 3*33
|
||||
const encodeDice = gameLibVecs + 3*34
|
||||
const rollDice = gameLibVecs + 3*35
|
||||
const setPlural = gameLibVecs + 3*36
|
||||
const FUNCN37 = gameLibVecs + 3*37
|
||||
const FUNCN38 = gameLibVecs + 3*38
|
||||
const FUNCN39 = gameLibVecs + 3*39
|
||||
const FUNCN40 = gameLibVecs + 3*40
|
||||
const FUNCN41 = gameLibVecs + 3*41
|
||||
const FUNCN42 = gameLibVecs + 3*42
|
||||
const FUNCN43 = gameLibVecs + 3*43
|
||||
const FUNCN44 = gameLibVecs + 3*44
|
||||
const FUNCN45 = gameLibVecs + 3*45
|
||||
const FUNCN46 = gameLibVecs + 3*46
|
||||
const FUNCN47 = gameLibVecs + 3*47
|
||||
const FUNCN48 = gameLibVecs + 3*48
|
||||
const FUNCN49 = gameLibVecs + 3*49
|
||||
// The first set of functions are used by scripts generated by the packer
|
||||
const setScriptInfo = gameLibVecs + 3*0
|
||||
const pushAuxStr = gameLibVecs + 3*1
|
||||
const scriptDisplayStr = gameLibVecs + 3*2
|
||||
const scriptDisplayStrNL = gameLibVecs + 3*3
|
||||
const getYN = gameLibVecs + 3*4
|
||||
const queue_setMap = gameLibVecs + 3*5
|
||||
const setSky = gameLibVecs + 3*6
|
||||
const setGround = gameLibVecs + 3*7
|
||||
const queue_teleport = gameLibVecs + 3*8
|
||||
const setPortrait = gameLibVecs + 3*9
|
||||
const clearPortrait = gameLibVecs + 3*10
|
||||
const moveBackward = gameLibVecs + 3*11
|
||||
const getUpperKey = gameLibVecs + 3*12
|
||||
const clearWindow = gameLibVecs + 3*13
|
||||
|
||||
const FUNCN14 = gameLibVecs + 3*14
|
||||
const FUNCN15 = gameLibVecs + 3*15
|
||||
const FUNCN16 = gameLibVecs + 3*16
|
||||
const FUNCN17 = gameLibVecs + 3*17
|
||||
const FUNCN18 = gameLibVecs + 3*18
|
||||
const FUNCN19 = gameLibVecs + 3*19
|
||||
|
||||
// The second set of functions are used by PLASMA code modules
|
||||
const getGlobals = gameLibVecs + 3*20
|
||||
const rand16 = gameLibVecs + 3*21
|
||||
const printf1 = gameLibVecs + 3*22
|
||||
const printf2 = gameLibVecs + 3*23
|
||||
const printf3 = gameLibVecs + 3*24
|
||||
const displayf1 = gameLibVecs + 3*25
|
||||
const displayf2 = gameLibVecs + 3*26
|
||||
const displayf3 = gameLibVecs + 3*27
|
||||
const buildString = gameLibVecs + 3*28
|
||||
const addToString = gameLibVecs + 3*29
|
||||
const finishString = gameLibVecs + 3*30
|
||||
const rawDisplayStr = gameLibVecs + 3*31
|
||||
const displayStr = gameLibVecs + 3*32
|
||||
const puts = gameLibVecs + 3*33
|
||||
const min = gameLibVecs + 3*34
|
||||
const max = gameLibVecs + 3*35
|
||||
const countList = gameLibVecs + 3*36
|
||||
const countListFiltered = gameLibVecs + 3*37
|
||||
const randomFromListFiltered = gameLibVecs + 3*38
|
||||
const addToList = gameLibVecs + 3*39
|
||||
const beep = gameLibVecs + 3*40
|
||||
const showParty = gameLibVecs + 3*41
|
||||
const mmgr = gameLibVecs + 3*42
|
||||
const setWindow1 = gameLibVecs + 3*43
|
||||
const setWindow2 = gameLibVecs + 3*44
|
||||
const setWindow3 = gameLibVecs + 3*45
|
||||
const reboot = gameLibVecs + 3*46
|
||||
const brk = gameLibVecs + 3*47
|
||||
const encodeDice = gameLibVecs + 3*48
|
||||
const rollDice = gameLibVecs + 3*49
|
||||
const setPlural = gameLibVecs + 3*50
|
||||
const FUNCN51 = gameLibVecs + 3*51
|
||||
const FUNCN52 = gameLibVecs + 3*52
|
||||
const FUNCN53 = gameLibVecs + 3*53
|
||||
const FUNCN54 = gameLibVecs + 3*54
|
||||
const FUNCN55 = gameLibVecs + 3*55
|
||||
const FUNCN56 = gameLibVecs + 3*56
|
||||
const FUNCN57 = gameLibVecs + 3*57
|
||||
const FUNCN58 = gameLibVecs + 3*58
|
||||
const FUNCN59 = gameLibVecs + 3*59
|
||||
|
|
|
@ -22,8 +22,6 @@ const heapSize = $800
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Other constants
|
||||
const callbacks = $300
|
||||
|
||||
const kbd = $C000
|
||||
const kbdStrobe = $C010
|
||||
|
||||
|
@ -55,6 +53,7 @@ word totalMapWidth
|
|||
word totalMapHeight
|
||||
|
||||
byte needRender = FALSE
|
||||
byte renderLoaded = FALSE
|
||||
byte textDrawn = FALSE
|
||||
byte isPlural = FALSE
|
||||
|
||||
|
@ -89,24 +88,33 @@ byte animFrame
|
|||
word animPauseCt
|
||||
|
||||
// Game library functions
|
||||
predef _setScriptInfo, _pushAuxStr, _scriptDisplayStr, _scriptDisplayStrNL, _getYN
|
||||
predef _queue_setMap, _setSky, _setGround, _queue_teleport, _setPortrait, _clearPortrait
|
||||
predef _moveBackward, _getUpperKey, _clearWindow, _setPortrait
|
||||
|
||||
predef _getGlobals, _rand16
|
||||
predef _printf1, _printf2, _printf3, _printf4
|
||||
predef _displayf1, _displayf2, _displayf3, _displayf4
|
||||
predef _printf1, _printf2, _printf3
|
||||
predef _displayf1, _displayf2, _displayf3
|
||||
predef _buildString, _addToString, _finishString, _rawDisplayStr, _displayStr
|
||||
predef _puts, _min, _max
|
||||
predef _countList, _countListFiltered, _randomFromListFiltered, _addToList, _getUpperKey, _beep
|
||||
predef _showParty, _mmgr, _setPortrait, _setWindow1, _setWindow2, _setWindow3, _clearWindow
|
||||
predef _getYN, _reboot, _brk, _encodeDice, _rollDice
|
||||
predef _countList, _countListFiltered, _randomFromListFiltered, _addToList, _beep
|
||||
predef _showParty, _mmgr, _setWindow1, _setWindow2, _setWindow3
|
||||
predef _reboot, _brk, _encodeDice, _rollDice
|
||||
predef _setPlural
|
||||
|
||||
word gameLib_addrs = @_getGlobals, @_rand16
|
||||
word = @_printf1, @_printf2, @_printf3, @_printf4
|
||||
word = @_displayf1, @_displayf2, @_displayf3, @_displayf4
|
||||
word gameLib_addrs = @_setScriptInfo, @_pushAuxStr, @_scriptDisplayStr, @_scriptDisplayStrNL, @_getYN
|
||||
word = @_queue_setMap, @_setSky, @_setGround, @_queue_teleport, @_setPortrait, @_clearPortrait
|
||||
word = @_moveBackward, @_getUpperKey, @_clearWindow
|
||||
word = 14,15,16,17,18,19
|
||||
|
||||
word = @_getGlobals, @_rand16
|
||||
word = @_printf1, @_printf2, @_printf3
|
||||
word = @_displayf1, @_displayf2, @_displayf3
|
||||
word = @_buildString, @_addToString, @_finishString, @_rawDisplayStr, @_displayStr
|
||||
word = @_puts, @_min, @_max
|
||||
word = @_countList, @_countListFiltered, @_randomFromListFiltered, @_addToList, @_getUpperKey, @_beep
|
||||
word = @_showParty, @_mmgr, @_setPortrait, @_setWindow1, @_setWindow2, @_setWindow3, @_clearWindow
|
||||
word = @_getYN, @_reboot, @_brk, @_encodeDice, @_rollDice
|
||||
word = @_countList, @_countListFiltered, @_randomFromListFiltered, @_addToList, @_beep
|
||||
word = @_showParty, @_mmgr, @_setWindow1, @_setWindow2, @_setWindow3
|
||||
word = @_reboot, @_brk, @_encodeDice, @_rollDice
|
||||
word = @_setPlural
|
||||
|
||||
word = 0 // end of library functions
|
||||
|
@ -137,9 +145,9 @@ ysav1 = $35
|
|||
seed = $4E
|
||||
magic = $2227 ; there are 2048 magic values that work; this one caught my eye. - MH
|
||||
|
||||
; NOTE ABOUT ABSOLUTE ADDRESSES
|
||||
; You cannot use them: this code, including variable space, can be loaded *anywhere*.
|
||||
; So don't declare any variables as !byte or !word here.
|
||||
; NOTE ABOUT ABSOLUTE CODE ADDRESSING (e.g. STA .var, JMP .label, etc.)
|
||||
; We cannot use it: this code, including variable space, can be loaded *anywhere*.
|
||||
; So don't JMP to labels, declare any variables as !byte or !word here, etc.
|
||||
|
||||
end
|
||||
|
||||
|
@ -224,7 +232,7 @@ asm readAuxByte // params: ptr; ret: char
|
|||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
asm pushAuxStr // params: none; ret: $200 (inbuf)
|
||||
asm _pushAuxStr // params: none; ret: $200 (inbuf)
|
||||
stx tmp ; save PLASMA's X reg eval stack index
|
||||
tsx
|
||||
lda $103,x ; get PLASMA's Y-reg value from its place in the stack
|
||||
|
@ -910,8 +918,8 @@ def convertDec(n)
|
|||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Print a formatted string a'la C printf, with up to four parameters.
|
||||
def _printf4(str, arg1, arg2, arg3, arg4)
|
||||
// Print a formatted string a'la C printf, with up to three parameters.
|
||||
def _printf3(str, arg1, arg2, arg3)
|
||||
word pos
|
||||
word curArg
|
||||
word p
|
||||
|
@ -942,20 +950,18 @@ def _printf4(str, arg1, arg2, arg3, arg4)
|
|||
loop
|
||||
end
|
||||
|
||||
def _printf1(str, arg1); printf4(str, arg1, 0, 0, 0); end
|
||||
def _printf2(str, arg1, arg2); printf4(str, arg1, arg2, 0, 0); end
|
||||
def _printf3(str, arg1, arg2, arg3); printf4(str, arg1, arg2, arg3, 0); end
|
||||
def _printf1(str, arg1); printf3(str, arg1, 0, 0); end
|
||||
def _printf2(str, arg1, arg2); printf3(str, arg1, arg2, 0); end
|
||||
|
||||
// Like printf, but displays text using font engine
|
||||
def _displayf4(str, arg1, arg2, arg3, arg4)
|
||||
def _displayf3(str, arg1, arg2, arg3)
|
||||
buildString(@addToString)
|
||||
printf4(str, arg1, arg2, arg3, arg4)
|
||||
printf3(str, arg1, arg2, arg3)
|
||||
displayStr(finishString(isPlural))
|
||||
end
|
||||
|
||||
def _displayf1(str, arg1); displayf4(str, arg1, 0, 0, 0); end
|
||||
def _displayf2(str, arg1, arg2); displayf4(str, arg1, arg2, 0, 0); end
|
||||
def _displayf3(str, arg1, arg2, arg3); displayf4(str, arg1, arg2, arg3, 0); end
|
||||
def _displayf1(str, arg1); displayf3(str, arg1, 0, 0); end
|
||||
def _displayf2(str, arg1, arg2); displayf3(str, arg1, arg2, 0); end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def parseDec(str)
|
||||
|
@ -1034,7 +1040,7 @@ end
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Set the sky color (relevant to 3D display only)
|
||||
def setSky(num)
|
||||
def _setSky(num)
|
||||
skyNum = num
|
||||
setColor(0, skyNum)
|
||||
needRender = TRUE
|
||||
|
@ -1048,7 +1054,7 @@ end
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Set the ground color (relevant to 3D display only)
|
||||
def setGround(num)
|
||||
def _setGround(num)
|
||||
groundNum = num
|
||||
setColor(1, groundNum)
|
||||
needRender = TRUE
|
||||
|
@ -1204,6 +1210,7 @@ def initMap(x, y, dir)
|
|||
mmgr(QUEUE_LOAD, CODE_TILE_ENGINE<<8 | RES_TYPE_CODE)
|
||||
pMap = mmgr(QUEUE_LOAD, mapNum<<8 | RES_TYPE_2D_MAP)
|
||||
fin
|
||||
renderLoaded = TRUE
|
||||
|
||||
// Load everything that we just queued
|
||||
mmgr(FINISH_LOAD, 1) // 1 = keep open
|
||||
|
@ -1259,11 +1266,13 @@ end
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Display a portrait drawing (typically called from scripts)
|
||||
def clearPortrait()
|
||||
def _clearPortrait()
|
||||
if curPortrait
|
||||
auxMmgr(FREE_MEMORY, curPortrait)
|
||||
curPortrait = 0
|
||||
if renderLoaded
|
||||
texControl(1) // 1=load
|
||||
fin
|
||||
needRender = TRUE
|
||||
fin
|
||||
end
|
||||
|
@ -1313,7 +1322,7 @@ end
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Move backward one step (3D mode)
|
||||
def moveBackward()
|
||||
def _moveBackward()
|
||||
adjustDir(8)
|
||||
moveForward()
|
||||
adjustDir(8)
|
||||
|
@ -1466,7 +1475,7 @@ def showPos()
|
|||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def queue_setMap(is3D, num, x, y, dir)
|
||||
def _queue_setMap(is3D, num, x, y, dir)
|
||||
q_mapIs3D = is3D
|
||||
q_mapNum = num
|
||||
q_x = x
|
||||
|
@ -1475,7 +1484,7 @@ def queue_setMap(is3D, num, x, y, dir)
|
|||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
def queue_teleport(x, y, dir)
|
||||
def _queue_teleport(x, y, dir)
|
||||
queue_setMap(mapIs3D, mapNum, x, y, dir)
|
||||
end
|
||||
|
||||
|
@ -1528,7 +1537,7 @@ end
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Set initial info for the scripts on this map: the name of the map, its trigger table, and the
|
||||
// maximum extent (width, height). This is called by the init function for the scripts.
|
||||
def setScriptInfo(mapName, trigTbl, wdt, hgt)
|
||||
def _setScriptInfo(mapName, trigTbl, wdt, hgt)
|
||||
|
||||
// Grab the trigger table origins (used so the table can be more compact)
|
||||
triggerOriginX = trigTbl=>0
|
||||
|
@ -1551,13 +1560,13 @@ 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.
|
||||
def scriptDisplayStr(str)
|
||||
def _scriptDisplayStr(str)
|
||||
textDrawn = TRUE
|
||||
flipToPage1()
|
||||
displayStr(str)
|
||||
end
|
||||
|
||||
def scriptDisplayStrNL(str)
|
||||
def _scriptDisplayStrNL(str)
|
||||
scriptDisplayStr(str)
|
||||
displayStr("\n")
|
||||
end
|
||||
|
@ -1663,8 +1672,10 @@ def _setPortrait(portraitNum)
|
|||
// We're going to switch windows. Save the cursor pos in the text window.
|
||||
saveCursor()
|
||||
|
||||
// Make room by unloading the textures
|
||||
// Make room by unloading the textures (only if renderer is loaded)
|
||||
if renderLoaded
|
||||
texControl(0)
|
||||
fin
|
||||
|
||||
// Now clear out the map area
|
||||
setMapWindow()
|
||||
|
@ -1746,7 +1757,7 @@ def _randomFromListFiltered(p, offset, filterFunc)
|
|||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Call like this: addToList(player + items, itemToAdd)
|
||||
// Call like this: addToList(@player=>p_items, itemToAdd)
|
||||
def _addToList(addTo, p)
|
||||
// Get to the end of the list
|
||||
while *addTo
|
||||
|
@ -1826,7 +1837,7 @@ end
|
|||
def saveMapPos()
|
||||
global->b_mapIs3D = mapIs3D
|
||||
global->b_mapNum = mapNum
|
||||
getPos(global + w_mapX, global + w_mapY)
|
||||
getPos(@global=>w_mapX, @global=>w_mapY)
|
||||
global->b_mapDir = getDir()
|
||||
end
|
||||
|
||||
|
@ -1848,6 +1859,7 @@ def testCombat()
|
|||
// Load the combat engine
|
||||
flipToPage1()
|
||||
mmgr(RESET_MEMORY, 0)
|
||||
renderLoaded = FALSE
|
||||
combatEngine = mmgr(QUEUE_LOAD, MODULE_COMBAT<<8 | RES_TYPE_MODULE)
|
||||
mmgr(FINISH_LOAD, 1) // 0 = close
|
||||
|
||||
|
@ -1855,10 +1867,10 @@ def testCombat()
|
|||
global=>p_enemyGroups = NULL
|
||||
when rand16() % 2
|
||||
is 0
|
||||
addToList(global + p_enemyGroups, new_EnemyGroup_Dirt_Bags())
|
||||
addToList(@global=>p_enemyGroups, new_EnemyGroup_Dirt_Bags())
|
||||
break
|
||||
otherwise
|
||||
addToList(global + p_enemyGroups, new_EnemyGroup_Flesh_Feeders())
|
||||
addToList(@global=>p_enemyGroups, new_EnemyGroup_Flesh_Feeders())
|
||||
break
|
||||
wend
|
||||
|
||||
|
@ -1972,67 +1984,6 @@ def loadTitle()
|
|||
getUpperKey()
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Set vectors so that scripts in PLASMA can call back to do things with this engine.
|
||||
def setCallbacks()
|
||||
|
||||
// $300
|
||||
callbacks.0 = $4c
|
||||
callbacks:1 = @setScriptInfo
|
||||
|
||||
// $303
|
||||
callbacks.3 = $4c
|
||||
callbacks:4 = @pushAuxStr
|
||||
|
||||
// $306
|
||||
callbacks.6 = $4c
|
||||
callbacks:7 = @scriptDisplayStr
|
||||
|
||||
// $309
|
||||
callbacks.9 = $4c
|
||||
callbacks:10 = @scriptDisplayStrNL
|
||||
|
||||
// $30C
|
||||
callbacks.12 = $4c
|
||||
callbacks:13 = @getYN
|
||||
|
||||
// $30F
|
||||
callbacks.15 = $4c
|
||||
callbacks:16 = @queue_setMap
|
||||
|
||||
// $312
|
||||
callbacks.18 = $4c
|
||||
callbacks:19 = @setSky
|
||||
|
||||
// $315
|
||||
callbacks.21 = $4c
|
||||
callbacks:22 = @setGround
|
||||
|
||||
// $318
|
||||
callbacks.24 = $4c
|
||||
callbacks:25 = @queue_teleport
|
||||
|
||||
// $31B
|
||||
callbacks.27 = $4c
|
||||
callbacks:28 = @setPortrait
|
||||
|
||||
// $31E
|
||||
callbacks.30 = $4c
|
||||
callbacks:31 = @clearPortrait
|
||||
|
||||
// $321
|
||||
callbacks.33 = $4c
|
||||
callbacks:34 = @moveBackward
|
||||
|
||||
// $324
|
||||
callbacks.36 = $4c
|
||||
callbacks:37 = @getUpperKey
|
||||
|
||||
// $327
|
||||
callbacks.39 = $4c
|
||||
callbacks:40 = @clearWindow
|
||||
end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Set up the small-object heap
|
||||
def initHeap()
|
||||
|
@ -2073,14 +2024,11 @@ end
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Main code.
|
||||
//
|
||||
textDrawn = FALSE
|
||||
needRender = TRUE
|
||||
setLibVecs()
|
||||
initHeap()
|
||||
addToList(global + p_players, new_Player_Hue_Hauser())
|
||||
addToList(global + p_players, new_Player_Mokahnu())
|
||||
addToList(@global=>p_players, new_Player_Hue_Hauser())
|
||||
addToList(@global=>p_players, new_Player_Mokahnu())
|
||||
loadTitle()
|
||||
setCallbacks()
|
||||
// Start map/loc per Seth. Need to have this in a script in the futurecheckScripts()
|
||||
mapIs3D = 0
|
||||
mapNum = 1
|
||||
|
|
|
@ -1652,12 +1652,6 @@ pl_texControl: !zone {
|
|||
pha
|
||||
ldy texAddrHi,x
|
||||
lda texAddrLo,x
|
||||
|
||||
+prStr : !text "tex ",0
|
||||
+prX
|
||||
+prYA
|
||||
+crout
|
||||
|
||||
tax
|
||||
lda #FREE_MEMORY
|
||||
jsr auxLoader
|
||||
|
|
Loading…
Reference in New Issue
Block a user