mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-09-29 11:55:21 +00:00
Adding global stat names to save space. Adjusted indenting of asm code in gameloop so Sublime Text correctly figures out the default tab size.
This commit is contained in:
parent
f37f3db60d
commit
2eff48233f
@ -8,10 +8,9 @@
|
|||||||
// governing permissions and limitations under the License.
|
// governing permissions and limitations under the License.
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Shared library routines
|
|
||||||
|
|
||||||
import gamelib
|
import gamelib
|
||||||
|
|
||||||
|
// Shared library routines
|
||||||
predef setScriptInfo, scriptDisplayStr, scriptDisplayStrNL, getYN, queue_setMap
|
predef setScriptInfo, scriptDisplayStr, scriptDisplayStrNL, getYN, queue_setMap
|
||||||
predef setSky, setGround, queue_teleport, setPortrait, clearPortrait, moveWayBackward
|
predef setSky, setGround, queue_teleport, setPortrait, clearPortrait, moveWayBackward
|
||||||
predef getUpperKey, clearWindow, getGlobals, rand16, printf1, printf2, printf3
|
predef getUpperKey, clearWindow, getGlobals, rand16, printf1, printf2, printf3
|
||||||
@ -25,4 +24,9 @@ import gamelib
|
|||||||
predef addGold, countGold, payGold
|
predef addGold, countGold, payGold
|
||||||
predef calcPlayerArmor, diskActivity, rdkey, initHeap, scriptCombat
|
predef calcPlayerArmor, diskActivity, rdkey, initHeap, scriptCombat
|
||||||
predef giveItemToPlayer, takeItemFromPlayer, playerHasItem, changePlayerStat
|
predef giveItemToPlayer, takeItemFromPlayer, playerHasItem, changePlayerStat
|
||||||
|
|
||||||
|
// Shared string constants
|
||||||
|
byte[] S_INTELLIGENCE, S_STRENGTH, S_AGILITY, S_STAMINA, S_CHARISMA, S_SPIRIT, S_LUCK
|
||||||
|
byte[] S_HEALTH, S_AIMING, S_HAND_TO_HAND, S_DODGING, S_GOLD
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -98,6 +98,20 @@ byte animNumFrames
|
|||||||
byte animFrame
|
byte animFrame
|
||||||
word animPauseCt
|
word animPauseCt
|
||||||
|
|
||||||
|
// Shared string constants
|
||||||
|
export byte[] S_INTELLIGENCE = "intelligence"
|
||||||
|
export byte[] S_STRENGTH = "strength"
|
||||||
|
export byte[] S_AGILITY = "agility"
|
||||||
|
export byte[] S_STAMINA = "stamina"
|
||||||
|
export byte[] S_CHARISMA = "charisma"
|
||||||
|
export byte[] S_SPIRIT = "spirit"
|
||||||
|
export byte[] S_LUCK = "luck"
|
||||||
|
export byte[] S_HEALTH = "health"
|
||||||
|
export byte[] S_AIMING = "aiming"
|
||||||
|
export byte[] S_HAND_TO_HAND = "hand-to-hand"
|
||||||
|
export byte[] S_DODGING = "dodging"
|
||||||
|
export byte[] S_GOLD = "gold"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Definitions used by assembly code
|
// Definitions used by assembly code
|
||||||
asm _defs
|
asm _defs
|
||||||
@ -189,11 +203,6 @@ asm getMapScript // params: none
|
|||||||
jmp $601E
|
jmp $601E
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
asm setAuxCopy
|
|
||||||
rts
|
|
||||||
end
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
asm readAuxByte // params: ptr; ret: char
|
asm readAuxByte // params: ptr; ret: char
|
||||||
+asmPlasm 1
|
+asmPlasm 1
|
||||||
@ -259,7 +268,8 @@ export asm finishString
|
|||||||
beq + ; only process if string has at least 1 char
|
beq + ; only process if string has at least 1 char
|
||||||
bcs .done
|
bcs .done
|
||||||
+ sty tmp+1 ; offset of last punctuation
|
+ sty tmp+1 ; offset of last punctuation
|
||||||
.fetch lda inbuf,x
|
.fetch
|
||||||
|
lda inbuf,x
|
||||||
cmp #"("
|
cmp #"("
|
||||||
bne .notpar
|
bne .notpar
|
||||||
bvs .notpar ; skip paren processing right punctuation
|
bvs .notpar ; skip paren processing right punctuation
|
||||||
@ -272,7 +282,8 @@ export asm finishString
|
|||||||
cpx inbuf
|
cpx inbuf
|
||||||
bne -
|
bne -
|
||||||
beq .done ; handle missing trailing paren
|
beq .done ; handle missing trailing paren
|
||||||
.plurpr inx ; it's plural, so copy everything within the parens
|
.plurpr
|
||||||
|
inx ; it's plural, so copy everything within the parens
|
||||||
lda inbuf,x ; copy characters
|
lda inbuf,x ; copy characters
|
||||||
cpx inbuf ; handle missing trailing paren
|
cpx inbuf ; handle missing trailing paren
|
||||||
beq .store
|
beq .store
|
||||||
@ -282,7 +293,8 @@ export asm finishString
|
|||||||
iny
|
iny
|
||||||
bne .plurpr ; always taken
|
bne .plurpr ; always taken
|
||||||
|
|
||||||
.notpar cmp #"/"
|
.notpar
|
||||||
|
cmp #"/"
|
||||||
bne .notsl
|
bne .notsl
|
||||||
bvs .notsl ; skip slash processing right after punctuation
|
bvs .notsl ; skip slash processing right after punctuation
|
||||||
lda tmp ; check isPlural flag
|
lda tmp ; check isPlural flag
|
||||||
@ -295,26 +307,31 @@ export asm finishString
|
|||||||
cmp #"A" ; eat letters (and stop when we hit punctuation)
|
cmp #"A" ; eat letters (and stop when we hit punctuation)
|
||||||
bcs -
|
bcs -
|
||||||
bcc .store ; copy the ending punctuation and continue normal processing
|
bcc .store ; copy the ending punctuation and continue normal processing
|
||||||
.plursl ldy tmp+1 ; erase singular form by backing up to prev punc
|
.plursl
|
||||||
|
ldy tmp+1 ; erase singular form by backing up to prev punc
|
||||||
iny ; plus 1 to retain prev punc
|
iny ; plus 1 to retain prev punc
|
||||||
bne .next ; resume regular copying of the plural form
|
bne .next ; resume regular copying of the plural form
|
||||||
|
|
||||||
.notsl cmp #"A" ; if <= ASCII "A", consider it punctuation
|
.notsl
|
||||||
|
cmp #"A" ; if <= ASCII "A", consider it punctuation
|
||||||
bcc +
|
bcc +
|
||||||
clv ; clear last-is-punc flag
|
clv ; clear last-is-punc flag
|
||||||
bvc .store ; always taken
|
bvc .store ; always taken
|
||||||
+ bit monrts ; set prev-is-punc flag
|
+ bit monrts ; set prev-is-punc flag
|
||||||
sty tmp+1 ; save dest offset of last punctuation
|
sty tmp+1 ; save dest offset of last punctuation
|
||||||
|
|
||||||
.store sta inbuf,y ; save to dest
|
.store
|
||||||
|
sta inbuf,y ; save to dest
|
||||||
iny
|
iny
|
||||||
|
|
||||||
.next inx
|
.next
|
||||||
|
inx
|
||||||
cpx inbuf ; compare src offset to length
|
cpx inbuf ; compare src offset to length
|
||||||
bcc .fetch ; loop while less than
|
bcc .fetch ; loop while less than
|
||||||
beq .fetch ; or equal
|
beq .fetch ; or equal
|
||||||
|
|
||||||
.done dey
|
.done
|
||||||
|
dey
|
||||||
sty inbuf ; save new length
|
sty inbuf ; save new length
|
||||||
lda #<inbuf
|
lda #<inbuf
|
||||||
ldy #>inbuf
|
ldy #>inbuf
|
||||||
@ -372,7 +389,8 @@ asm blitPortrait // params: srcData, dstScreenPtr
|
|||||||
|
|
||||||
; Outer copy loop
|
; Outer copy loop
|
||||||
ldx #128 ; line count
|
ldx #128 ; line count
|
||||||
.loop ldy #17 ; byte count minus 1. There are 18 bytes per line
|
.loop
|
||||||
|
ldy #17 ; byte count minus 1. There are 18 bytes per line
|
||||||
jsr $10 ; copy pixel bytes
|
jsr $10 ; copy pixel bytes
|
||||||
|
|
||||||
; Advance to next row of data
|
; Advance to next row of data
|
||||||
@ -382,8 +400,7 @@ asm blitPortrait // params: srcData, dstScreenPtr
|
|||||||
sta tmp
|
sta tmp
|
||||||
bcc +
|
bcc +
|
||||||
inc tmp+1
|
inc tmp+1
|
||||||
+
|
+ ; Fun code to advance to the next hi-res line
|
||||||
; Fun code to advance to the next hi-res line
|
|
||||||
ldy pTmp+1
|
ldy pTmp+1
|
||||||
iny
|
iny
|
||||||
iny
|
iny
|
||||||
@ -402,13 +419,13 @@ asm blitPortrait // params: srcData, dstScreenPtr
|
|||||||
bcc .ok
|
bcc .ok
|
||||||
ldy #$20
|
ldy #$20
|
||||||
adc #$27 ; carry was set, so actually adding $28
|
adc #$27 ; carry was set, so actually adding $28
|
||||||
.ok sta pTmp
|
.ok
|
||||||
.ok2 sty pTmp+1
|
sta pTmp
|
||||||
|
.ok2
|
||||||
|
sty pTmp+1
|
||||||
; Loop until we've done all rows.
|
; Loop until we've done all rows.
|
||||||
dex
|
dex
|
||||||
bne .loop
|
bne .loop
|
||||||
|
|
||||||
rts
|
rts
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -509,7 +526,8 @@ asm partialPrintf
|
|||||||
iny
|
iny
|
||||||
dec tmp ; otherwise go until end of string
|
dec tmp ; otherwise go until end of string
|
||||||
bne -
|
bne -
|
||||||
.eos ldy #$FF ; if we hit end of string, return -1
|
.eos
|
||||||
|
ldy #$FF ; if we hit end of string, return -1
|
||||||
tya
|
tya
|
||||||
rts
|
rts
|
||||||
+ dey ; adjust back for length byte
|
+ dey ; adjust back for length byte
|
||||||
@ -622,7 +640,8 @@ export asm diskActivity
|
|||||||
lda #0 ; last line
|
lda #0 ; last line
|
||||||
beq ++ ; always taken
|
beq ++ ; always taken
|
||||||
+ lda (pTmp),y ; hide mode
|
+ lda (pTmp),y ; hide mode
|
||||||
++ sta (pTmp,x)
|
++
|
||||||
|
sta (pTmp,x)
|
||||||
lda pTmp+1
|
lda pTmp+1
|
||||||
clc
|
clc
|
||||||
adc #4
|
adc #4
|
||||||
@ -2256,6 +2275,12 @@ export def playerHasItem(itemName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
export def changePlayerStat(statName, add)
|
export def changePlayerStat(statName, add)
|
||||||
|
when statName
|
||||||
|
is @S_STRENGTH
|
||||||
|
global=>p_players->b_strength = max(0, min(255, global=>p_players->b_strength + add))
|
||||||
|
otherwise
|
||||||
|
puts(statName); fatal("Unknown attr to incr/decr")
|
||||||
|
wend
|
||||||
end
|
end
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user