Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- moveForward:
- call vectAdjust
- ld bc,(playerX)
- add hl,bc
- ld (playerX),hl
- ld hl,(playerY)
- add hl,de
- ld (playerY),hl
- ret
- vectAdjust:
- ;;Outputs:
- ;; DE is the adjusted, signed fixed-point Y value to add to playerY
- ;; HL is the adjusted, signed fixed-point X value to add to playerX
- ;;Adjustments are:
- ;; Multiply vector by 0.5 if out of stamina
- ;; Multiply vector by 1.25 if running
- ;; Multiply vector by 1.5 if panicked
- ld hl,(playerVector)
- ld e,h
- ld a,l
- rla
- sbc a,a
- ld h,a
- ld a,e
- rla
- sbc a,a
- ld d,a ;HL=X, DE=Y, signed
- ld a,(timerSprint)
- or a
- jr z,halfspeed
- ld c,a
- ld a,(keyReturn)
- and 1<<sprintActive
- ret z
- ld a,c
- dec a
- ld (timerSprint),a
- ld c,l
- ld b,h
- sra b
- rr c
- ld a,(gameFlags)
- and 1<<panicMode
- jr nz,panicspeed
- sra b
- rr c
- add hl,bc
- ex de,hl
- ld c,l
- ld b,h
- sra b
- rr c
- sra b
- rr c
- add hl,bc
- ex de,hl
- ret
- ;sprintspeed
- panicspeed:
- add hl,bc
- ex de,hl
- ld c,l
- ld b,h
- sra b
- rr c
- add hl,bc
- ex de,hl
- ret
- halfspeed:
- sra h
- rr l
- sra d
- rr e
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement