;;-*-Lisp-*-
(in-package goal)
(bundles "ENGINE.CGO" "GAME.CGO")
(require "engine/game/game-h.gc")
(declare-type snowball-info basic)

(declare-type tube-info basic)

(declare-type racer-info basic)

(declare-type flut-info basic)

(declare-type sidekick process-drawable)

;; DECOMP BEGINS

(deftype target (process-drawable)
  ((fact                fact-info-target :override)
   (self-override       target :overlay-at self)
   (control             control-info :overlay-at root)
   (skel2               basic)
   (racer               racer-info)
   (game                game-info)
   (neck                joint-mod)
   (state-hook-time     time-frame)
   (state-hook          (function none :behavior target))
   (cam-user-mode       symbol)
   (sidekick            (pointer sidekick))
   (manipy              (pointer manipy))
   (attack-info         attack-info :inline)
   (attack-info-rec     attack-info :inline)
   (anim-seed           uint64)
   (alt-cam-pos         vector :inline)
   (snowball            snowball-info)
   (tube                tube-info)
   (flut                flut-info)
   (current-level       level)
   (saved-pos           transformq :inline)
   (saved-owner         uint64)
   (alt-neck-pos        vector :inline)
   (fp-hud              handle)
   (no-load-wait        time-frame)
   (no-look-around-wait time-frame)
   (burn-proc           handle))
  (:methods
   (find-edge-grabs! (_type_ collide-cache) object))
  (:states
   target-attack
   (target-attack-air symbol)
   (target-attack-uppercut float float)
   (target-attack-uppercut-jump float float)
   target-billy-game
   (target-clone-anim handle)
   (target-continue continue-point)
   (target-death symbol)
   target-demo
   (target-double-jump float float)
   (target-duck-high-jump float float symbol)
   (target-duck-high-jump-jump float float symbol)
   target-duck-stance
   target-duck-walk
   (target-eco-powerup object float)
   target-edge-grab
   (target-edge-grab-jump float float)
   target-edge-grab-off
   (target-falling symbol)
   (target-final-door basic handle)
   (target-fishing handle)
   (target-flop float float float)
   (target-flop-hit-ground symbol)
   (target-flut-air-attack float)
   target-flut-air-attack-hit-ground
   (target-flut-clone-anim handle)
   (target-flut-death symbol)
   (target-flut-double-jump float float)
   (target-flut-falling symbol)
   (target-flut-get-off handle)
   (target-flut-get-off-hit-ground symbol)
   (target-flut-get-off-jump handle)
   (target-flut-get-on handle)
   target-flut-grab
   (target-flut-hit symbol attack-info)
   target-flut-hit-ground
   (target-flut-jump float float)
   target-flut-running-attack
   target-flut-stance
   (target-flut-start handle)
   target-flut-walk
   target-grab
   (target-high-jump float float basic)
   (target-hit symbol attack-info)
   (target-hit-ground symbol)
   (target-hit-ground-hard float)
   target-ice-stance
   target-ice-walk
   (target-jump float float surface)
   (target-jump-forward float float)
   (target-launch float symbol vector int)
   target-load-wait
   target-look-around
   (target-periscope handle)
   (target-play-anim string handle)
   (target-pole-cycle handle)
   (target-pole-flip-forward float float float)
   (target-pole-flip-forward-jump float float)
   (target-pole-flip-up object object float)
   (target-pole-flip-up-jump float float)
   target-racing
   (target-racing-bounce float float symbol)
   (target-racing-clone-anim handle)
   (target-racing-death symbol)
   target-racing-falling
   (target-racing-get-off handle)
   (target-racing-get-off-hit-ground symbol)
   (target-racing-get-off-jump handle)
   (target-racing-get-on handle)
   target-racing-grab
   (target-racing-hit handle attack-info)
   (target-racing-jump float float symbol)
   (target-racing-smack float symbol)
   (target-racing-start handle)
   target-running-attack
   target-slide-down
   target-snowball
   (target-snowball-start handle)
   target-stance
   target-stance-ambient
   target-stance-look-around
   target-startup
   target-swim-down
   (target-swim-jump float float)
   (target-swim-jump-jump float float surface)
   target-swim-stance
   target-swim-up
   target-swim-walk
   target-title
   target-title-play
   target-title-wait
   target-tube
   (target-tube-death symbol)
   (target-tube-hit symbol attack-info)
   (target-tube-jump float float)
   (target-tube-start handle)
   target-turn-around
   target-wade-stance
   target-wade-walk
   target-walk
   (target-warp-in vector vector)
   (target-warp-out vector vector)
   target-wheel
   (target-wheel-flip float float)
   target-yellow-blast
   target-yellow-jump-blast))

(define-perm *target* target #f)

(deftype sidekick (process-drawable)
  ((parent-override  (pointer target) :overlay-at parent)
   (control          control-info :overlay-at root)
   (anim-seed        uint64 :offset 192)
   (shadow-in-movie? symbol))
  (:states
   sidekick-clone))

(define-perm *sidekick* sidekick #f)

(defun-extern start symbol continue-point target)

(defun-extern stop symbol int)

(define-extern do-target-shadow (function none :behavior target))

(define-extern target-joint-pos (function vector))

(define-extern target-cam-pos (function vector))

(define-extern target-powerup-process (function none :behavior target))

(define-extern target-exit (function none :behavior target))

(define-extern target-generic-event-handler (function process int symbol event-message-block object :behavior target))

(define-extern init-sidekick (function none :behavior sidekick))

(define-extern racer-collision-reaction
  (function control-info collide-shape-intersect vector vector cshape-moving-flags))

(define-extern start-sequence-a (function none))
