;;-*-Lisp-*-
(in-package goal)
(bundles "FIC.DGO" "LAV.DGO" "MIS.DGO" "OGR.DGO" "ROL.DGO")
(require "engine/math/vector-h.gc")
(require "engine/collide/surface-h.gc")
(require "engine/data/art-h.gc")
(define-extern target-racing-center-anim (function none :behavior target))

(define-extern racer-buzz (function float none :behavior target))

(define-extern target-racing-post (function none :behavior target))

(define-extern target-racing-land-anim (function symbol none :behavior target))

(define-extern target-racing-turn-anim (function none :behavior target))

(define-extern racer-calc-gravity (function vector :behavior target))

(define-extern target-racing-jump-anim (function basic time-frame none :behavior target))

(define-extern racer-sounds (function object :behavior target))

(define-extern *racer-air-mods* surface)

;; DECOMP BEGINS

(deftype racer-info (basic)
  ((entity              entity-actor)
   (bike-trans          vector :inline)
   (bike-quat           vector :inline)
   (bike-scale          vector :inline)
   (mod-x               float)
   (rot                 vector :inline)
   (rot-old             vector :inline)
   (rotv                vector :inline)
   (lean-rotx           degrees)
   (change-roty         degrees)
   (change-roty-old     degrees)
   (quat                vector :inline)
   (surface-y           meters)
   (surface-vy          meters)
   (surface-quat        vector :inline)
   (surface-quat-smooth vector :inline)
   (cushion-base        meters)
   (cushion-offset      meters)
   (cushion-bob         meters)
   (cushion-bob-old     meters)
   (cushion-smush       smush-control :inline)
   (shock-offset        meters)
   (shock-offsetv       meters)
   (shock-rotx          meters)
   (hill-value          float)
   (hill-ground-value   float)
   (hill-offset         meters)
   (hill-rotx           degrees)
   (hill-boost          meters)
   (bob-timer           float)
   (bob-meta-timer      float)
   (bob-meta-meta-timer float)
   (bob-mult-rot        float)
   (bob-mult-trans      float)
   (bob-period          float)
   (bob-meta-time       time-frame)
   (bob-hit-ground-time time-frame)
   (cur-rotx            degrees)
   (targ-rotx           degrees)
   (speed-rotx          float)
   (mult-rotx           degrees)
   (front-blade         joint-mod)
   (front-rot           degrees)
   (front-rotv          degrees)
   (bottom-blade        joint-mod)
   (bottom-rot          degrees)
   (front               joint-mod)
   (front-turn          degrees)
   (tail                joint-mod)
   (tail-tilt           degrees)
   (transv-max          meters)
   (slide-down-time     time-frame 2)
   (slide-enter-time    time-frame)
   (slide-mode          int32)
   (slide-amp           float)
   (slide-grip-mult     float)
   (slide-shift-x       float)
   (slide-interp        float)
   (heat                float)
   (boost-time          time-frame)
   (boost-duration      time-frame)
   (boost-curve         float)
   (boost-level         float)
   (boost-target        float)
   (boost-output        float)
   (hop?                symbol)
   (hop-start-y         float)
   (bounce              int32)
   (bounce-hit          float)
   (engine-sound-id     sound-id)
   (boost-sound-id      sound-id)
   (engine-sound-pitch  float)
   (turn-anim-targ      float)
   (turn-anim-frame     float)
   (turn-anim-vel       float)
   (tail-anim-vel       float)
   (tail-anim-frame     float)
   (rudd-anim-vel       float)
   (rudd-anim-frame     float)
   (racing-time         time-frame)
   (stick-lock          symbol)
   (stick-off           symbol)
   (heavy               symbol)
   (unstuck-time        time-frame)
   (stuck-count         int32)
   (scrape-sound-id     sound-id)
   (heat-sound-time     time-frame)))

(deftype racer-bank (basic)
  ((slide-hold-time            seconds)
   (heat-max                   float)
   (hotcoals-heat-inc          float)
   (lava-heat-inc              float)
   (lava-air-heat-inc          float)
   (surface-heat-inc           float)
   (jump-heat-inc              float)
   (lavatube-hotcoals-heat-inc float)
   (lavatube-lava-heat-inc     float)
   (lavatube-lava-air-heat-inc float)
   (lavatube-surface-heat-inc  float)
   (lavatube-jump-heat-inc     float)
   (boost-curve-max            meters)
   (boost-level-max            meters)
   (boost-level-inc            meters)
   (boost-duration             seconds)
   (default-front-blade        degrees)
   (yellow-projectile-speed    meters)))

(define *RACER-bank*
  (new 'static
       'racer-bank
       :slide-hold-time (seconds 0.2)
       :heat-max 100.0
       :hotcoals-heat-inc 3.0
       :lava-heat-inc 20.0
       :lava-air-heat-inc 4.0
       :surface-heat-inc 1.0
       :jump-heat-inc 2.0
       :lavatube-hotcoals-heat-inc 2.0
       :lavatube-lava-heat-inc 4.5
       :lavatube-lava-air-heat-inc 4.0
       :lavatube-surface-heat-inc 1.0
       :lavatube-jump-heat-inc 10.0
       :boost-curve-max (meters 5)
       :boost-level-max (meters 12.5)
       :boost-level-inc (meters 2)
       :boost-duration (seconds 2.5)
       :yellow-projectile-speed (meters 80)))

;; og:preserve-this PAL patch here
(defskelgroup *balloon-sg*
  balloon
  balloon-lod0-jg
  balloon-idle-ja
  ((balloon-lod0-mg (meters 20)) (balloon-lod1-mg (meters 999999)))
  :bounds (static-spherem 0 0.3 0 6.3))

;; added for convenience
(#when PC_PORT
  (defun zoomer-get-heat ()
    (-> *target* racer heat))
  (defun zoomer-get-heat-max ()
    (-> *RACER-bank* heat-max)))
