Files
jak-project/goal_src/jak1/engine/game/task/task-control-h.gc
Tyler Wilding c162c66118 g/j1: Cleanup all main issues in the formatter and format all of goal_src/jak1 (#3535)
This PR does two main things:
1. Work through the main low-hanging fruit issues in the formatter
keeping it from feeling mature and usable
2. Iterate and prove that point by formatting all of the Jak 1 code
base. **This has removed around 100K lines in total.**
- The decompiler will now format it's results for jak 1 to keep things
from drifting back to where they were. This is controlled by a new
config flag `format_code`.

How am I confident this hasn't broken anything?:
- I compiled the entire project and stored it's `out/jak1/obj` files
separately
- I then recompiled the project after formatting and wrote a script that
md5's each file and compares it (`compare-compilation-outputs.py`
- The results (eventually) were the same:

![Screenshot 2024-05-25
132900](https://github.com/open-goal/jak-project/assets/13153231/015e6f20-8d19-49b7-9951-97fa88ddc6c2)
> This proves that the only difference before and after is non-critical
whitespace for all code/macros that is actually in use.

I'm still aware of improvements that could be made to the formatter, as
well as general optimization of it's performance. But in general these
are for rare or non-critical situations in my opinion and I'll work
through them before doing Jak 2. The vast majority looks great and is
working properly at this point. Those known issues are the following if
you are curious:

![image](https://github.com/open-goal/jak-project/assets/13153231/0edfaba1-6d36-40f5-ab23-0642209867c4)
2024-06-05 22:17:31 -04:00

162 lines
5.0 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
(bundles "ENGINE.CGO" "GAME.CGO")
(require "engine/game/game-h.gc")
;; for process-taskable
(declare-type process-taskable process-drawable)
(define-extern othercam-init-by-other (function process-taskable symbol symbol symbol none :behavior othercam))
;; There are a fixed number of game tasks. Most are just getting a power cell,
;; but there are also ones for using the levitator etc.
;; The list of all tasks is the game-task enum in game-info-h.gc
;; the task control contains a list of all cstage.
;; Each task may have multiple cstages.
;; Each cstage corresponds to a game-task and a task-status.
;; There is a concept of a "current stage" being played, but it may sometimes be invalid (-1).
;; it is an index into the task-control list
;; names from task-status->string function
;; the status value will increase.
;; some tasks may do their own thing and not use these values.
(defenum task-status
:type uint64
(invalid 0)
(unknown 1)
(need-hint 2)
(need-introduction 3)
(need-reminder-a 4)
(need-reminder 5)
(need-reward-speech 6)
(need-resolution 7))
;; our names
(defenum task-flags
:type uint8
:bitfield #t
(closed 0)
(has-entity 1)
(closed-by-default 2))
(declare-type task-control basic)
;; DECOMP BEGINS
(deftype task-cstage (structure)
((game-task game-task)
(status task-status)
(flags task-flags)
(condition (function task-control symbol)))
(:methods
(get-task (_type_) game-task)
(get-status (_type_) task-status)
(task-available? (_type_ task-control) symbol)
(closed? (_type_) symbol)
(closed-by-default? (_type_) symbol)
(close-task! (_type_) int)
(open-task! (_type_) int)))
(deftype task-control (basic)
((current-stage int16)
(stage (array task-cstage)))
(:methods
(current-task (_type_) game-task)
(current-status (_type_) task-status)
(close-current! (_type_) game-task)
(close-status! (_type_ task-status) game-task)
(first-any (_type_ symbol) game-task)
(reset! (_type_ symbol symbol) int)
(closed? (_type_ game-task task-status) symbol)
(get-reminder (_type_ int) int)
(save-reminder (_type_ int int) int)
(exists? (_type_ game-task task-status) symbol)))
(deftype ambient-control (structure)
((last-ambient-time time-frame)
(last-ambient string)
(last-ambient-id sound-id))
:pack-me
(:methods
(ambient-control-method-9 (_type_) none)
(ambient-control-method-10 (_type_ vector time-frame float process-drawable) vector)
(play-ambient (_type_ string symbol vector) symbol)))
(deftype process-taskable (process-drawable)
((root collide-shape :override)
(tasks task-control)
(query gui-query :inline)
(old-target-pos transformq :inline)
(cell-for-task game-task)
(cell-x handle)
(cam-joint-index int32)
(skippable symbol)
(blend-on-exit art-joint-anim)
(camera handle)
(will-talk symbol)
(talk-message text-id)
(last-talk time-frame)
(bounce-away symbol)
(ambient ambient-control :inline)
(center-joint-index int32)
(draw-bounds-y-offset float)
(neck-joint-index int32)
(fuel-cell-anim spool-anim)
(sound-flava music-flava)
(have-flava symbol)
(music symbol)
(have-music symbol)
(been-kicked symbol)
(cur-trans-hook (function none))
(shadow-backup shadow-geo))
(:state-methods
release
give-cell
lose
enter-playing
play-accept
play-reject
query
play-anim
hidden
(be-clone handle)
idle)
(:methods
(get-art-elem (_type_) art-element)
(play-anim! (_type_ symbol) basic)
(process-taskable-method-33 (_type_) none)
(get-accept-anim (_type_ symbol) spool-anim)
(push-accept-anim (_type_) none)
(get-reject-anim (_type_ symbol) spool-anim)
(push-reject-anim (_type_) none)
(process-taskable-method-38 (_type_) none)
(should-display? (_type_) symbol)
(process-taskable-method-40 (_type_ object skeleton-group int int vector int) none)
(initialize-collision (_type_ int vector) none)
(process-taskable-method-42 (_type_) none)
(process-taskable-method-43 (_type_) symbol)
(play-reminder (_type_) symbol)
(process-taskable-method-45 (_type_) symbol)
(process-taskable-method-46 (_type_) none)
(target-above-threshold? (_type_) symbol)
(draw-npc-shadow (_type_) none)
(hidden-other () _type_ :state)
(process-taskable-method-50 (_type_) symbol)
(close-anim-file! (_type_) symbol)
(process-taskable-method-52 (_type_) none)))
(defun-extern task-known? game-task symbol)
(defun-extern task-control-reset symbol none)
(define-extern task-closed? (function game-task task-status symbol))
(define-extern get-task-status (function game-task task-status))
(define-extern get-task-control (function game-task task-control))
(define-extern close-specific-task! (function game-task task-status game-task))