daily pastebin goal
63%
SHARE
TWEET

slender00

Zeda Sep 29th, 2015 (edited) 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. moveForward:
  2.     call vectAdjust
  3.     ld bc,(playerX)
  4.     add hl,bc
  5.     ld (playerX),hl
  6.     ld hl,(playerY)
  7.     add hl,de
  8.     ld (playerY),hl
  9.     ret
  10. vectAdjust:
  11. ;;Outputs:
  12. ;;  DE is the adjusted, signed fixed-point Y value to add to playerY
  13. ;;  HL is the adjusted, signed fixed-point X value to add to playerX
  14. ;;Adjustments are:
  15. ;;  Multiply vector by 0.5 if out of stamina
  16. ;;  Multiply vector by 1.25 if running
  17. ;;  Multiply vector by 1.5 if panicked
  18.  
  19.  
  20.     ld hl,(playerVector)
  21.     ld e,h
  22.     ld a,l
  23.     rla
  24.     sbc a,a
  25.     ld h,a
  26.     ld a,e
  27.     rla
  28.     sbc a,a
  29.     ld d,a  ;HL=X, DE=Y, signed
  30.     ld a,(timerSprint)
  31.     or a
  32.     jr z,halfspeed
  33.     ld c,a
  34.     ld a,(keyReturn)
  35.     and 1<<sprintActive
  36.     ret z
  37.     ld a,c
  38.     dec a
  39.     ld (timerSprint),a
  40.     ld c,l
  41.     ld b,h
  42.     sra b
  43.     rr c
  44.     ld a,(gameFlags)
  45.     and 1<<panicMode
  46.     jr nz,panicspeed
  47.     sra b
  48.     rr c
  49.     add hl,bc
  50.     ex de,hl
  51.     ld c,l
  52.     ld b,h
  53.     sra b
  54.     rr c
  55.     sra b
  56.     rr c
  57.     add hl,bc
  58.     ex de,hl
  59.     ret
  60. ;sprintspeed
  61. panicspeed:
  62.     add hl,bc
  63.     ex de,hl
  64.     ld c,l
  65.     ld b,h
  66.     sra b
  67.     rr c
  68.     add hl,bc
  69.     ex de,hl
  70.     ret
  71. halfspeed:
  72.     sra h
  73.     rr l
  74.     sra d
  75.     rr e
  76.     ret
RAW Paste Data
Top