GSCats/player.s
2017-08-15 19:04:22 -07:00

93 lines
1.4 KiB
ArmAsm

;
; players
; Code and data structures related to the players
;
; Created by Quinn Dunki on 8/13/17
;
playerData:
; gameobject data
.word 40 ; X pos in pixels (from left terrain edge)
.word 38 ; Y pos in pixels (from bottom terrain edge)
.word 45 ; Angle in degrees from +X
.word 50 ; Power
PD_ANGLE = 4 ; Byte offsets into player data structure
PD_POS = 6
.macro PLAYERPTR_Y
tya ; Pointer to player structure from index
asl
asl
asl
tay
.endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; playerDeltaAngle
;
; Y = Player index
; X = Delta
;
playerDeltaAngle:
SAVE_AXY
PLAYERPTR_Y
txa
clc
adc playerData+PD_ANGLE,y
bmi playerDeltaAngleClampLow
cmp #180
bpl playerDeltaAngleClampHigh
playerDeltaAngleStore:
sta playerData+PD_ANGLE,y
RESTORE_AXY
rts
playerDeltaAngleClampLow:
lda #0
bra playerDeltaAngleStore
playerDeltaAngleClampHigh:
lda #180
bra playerDeltaAngleStore
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; renderPlayers
;
;
renderPlayers:
lda #playerData
sta PARAML0
jsr renderGameobject
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; renderPlayerHeader
;
; Y = Player index to render
;
renderPlayerHeader:
SAVE_AXY
PLAYERPTR_Y
ldx #0
lda #angleStr
jsr DrawString
lda playerData+PD_ANGLE,y
ldx #24
jsr drawNumber
RESTORE_AXY
rts
angleStr:
pstring "ANGLE: "