mirror of
https://github.com/open-goal/jak-project
synced 2026-07-02 20:47:07 -04:00
c162c66118
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:  > 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: 
153 lines
4.5 KiB
Common Lisp
153 lines
4.5 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
(bundles "ENGINE.CGO" "GAME.CGO")
|
|
(require "kernel-defs.gc")
|
|
|
|
;; TODO - for misty-obs
|
|
(define-extern *camera-old-level* string) ;; unknown type
|
|
|
|
(define-extern *camera-old-cpu* int) ;; unknown type
|
|
|
|
(define-extern *camera-old-vu* int) ;; unknown type
|
|
|
|
(define-extern *camera-old-tfrag-bytes* int) ;; unknown type
|
|
|
|
(define-extern *camera-old-stat-string-tfrag* string) ;; unknown type
|
|
|
|
(define-extern *camera-old-stat-string-tfrag-near* string) ;; unknown type
|
|
|
|
(define-extern *camera-old-stat-string-total* string) ;; unknown type
|
|
|
|
;; TODO - for cam-layout
|
|
(define-extern camera-line-setup (function vector4w none))
|
|
|
|
(define-extern camera-line-draw (function vector vector symbol))
|
|
|
|
(define-extern camera-line (function vector vector vector4w none))
|
|
|
|
(define-extern camera-cross (function vector vector vector vector4w meters basic))
|
|
|
|
(define-extern camera-fov-frame (function matrix vector float float float vector4w none))
|
|
|
|
(define-extern cam-slave-options->string (function cam-slave-options object string))
|
|
|
|
(define-extern cam-index-options->string (function cam-index-options object string))
|
|
|
|
(define-extern debug-set-camera-pos-rot! (function vector matrix vector))
|
|
|
|
(define-extern camera-slave-debug (function camera-slave none))
|
|
|
|
;; TODO - for cam-states
|
|
(define-extern cam-debug-add-los-tri (function (inline-array collide-cache-tri) vector vector none))
|
|
|
|
(define-extern cam-collision-record-save (function vector vector int symbol camera-slave none))
|
|
|
|
(define-extern slave-los-state->string (function slave-los-state string))
|
|
|
|
(define-extern cam-debug-reset-coll-tri (function none)) ;; not confirmed
|
|
|
|
;; TODO - for rolling-lightning-mole
|
|
(define-extern camera-line-rel (function vector vector vector4w none))
|
|
|
|
(declare-type clm basic)
|
|
|
|
(define-extern *clm* clm) ;; unknown type
|
|
|
|
(define-extern *clm-edit* clm)
|
|
|
|
(define-extern *clm-focalpull-attr* clm) ;; unknown type
|
|
|
|
(define-extern *clm-index-attr* clm) ;; unknown type
|
|
|
|
(define-extern *clm-intro-attr* clm) ;; unknown type
|
|
|
|
(define-extern *clm-spline-attr* clm) ;; unknown type
|
|
|
|
(define-extern *clm-vol-attr* clm) ;; unknown type
|
|
|
|
(define-extern *clm-select* clm) ;; unknown type
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
;; this file is debug only
|
|
(declare-file (debug))
|
|
|
|
(define *redline-table* (the-as (pointer float) (malloc 'debug 1600)))
|
|
|
|
(define *redline-index* 0)
|
|
|
|
(defun float-save-redline ((arg0 float))
|
|
(set! (-> *redline-table* *redline-index*) arg0)
|
|
(set! *redline-index* (+ *redline-index* 1))
|
|
(when (>= *redline-index* 400)
|
|
(set! *redline-index* 0)
|
|
0)
|
|
(none))
|
|
|
|
(defun float-lookup-redline ((arg0 float))
|
|
(let ((a0-3 (mod (+ (the int arg0) -1 *redline-index*) 400))) (-> *redline-table* a0-3)))
|
|
|
|
(define *blueline-table* (the-as (pointer float) (malloc 'debug 1600)))
|
|
|
|
(define *blueline-index* 0)
|
|
|
|
(defun float-save-blueline ((arg0 float))
|
|
(set! (-> *blueline-table* *blueline-index*) arg0)
|
|
(set! *blueline-index* (+ *blueline-index* 1))
|
|
(when (>= *blueline-index* 400)
|
|
(set! *blueline-index* 0)
|
|
0)
|
|
(none))
|
|
|
|
(defun float-lookup-blueline ((arg0 float))
|
|
(let ((a0-3 (mod (+ (the int arg0) -1 *blueline-index*) 400))) (-> *blueline-table* a0-3)))
|
|
|
|
(define *greenline-table* (the-as (pointer float) (malloc 'debug 1600)))
|
|
|
|
(define *greenline-index* 0)
|
|
|
|
(defun float-save-greenline ((arg0 float))
|
|
(set! (-> *greenline-table* *greenline-index*) arg0)
|
|
(set! *greenline-index* (+ *greenline-index* 1))
|
|
(when (>= *greenline-index* 400)
|
|
(set! *greenline-index* 0)
|
|
0)
|
|
(none))
|
|
|
|
(defun float-lookup-greenline ((arg0 float))
|
|
(let ((a0-3 (mod (+ (the int arg0) -1 *greenline-index*) 400))) (-> *greenline-table* a0-3)))
|
|
|
|
(define *yellowline-table* (the-as (pointer float) (malloc 'debug 1600)))
|
|
|
|
(define *yellowline-index* 0)
|
|
|
|
(defun float-save-yellowline ((arg0 float))
|
|
(set! (-> *yellowline-table* *yellowline-index*) arg0)
|
|
(set! *yellowline-index* (+ *yellowline-index* 1))
|
|
(when (>= *yellowline-index* 400)
|
|
(set! *yellowline-index* 0)
|
|
0)
|
|
(none))
|
|
|
|
(defun float-lookup-yellowline ((arg0 float))
|
|
(let ((a0-3 (mod (+ (the int arg0) -1 *yellowline-index*) 400))) (-> *yellowline-table* a0-3)))
|
|
|
|
(define *timeplot-table* (the-as (pointer float) (malloc 'debug 1600)))
|
|
|
|
(define *timeplot-index* 0)
|
|
|
|
(defun float-save-timeplot ((arg0 float))
|
|
(set! (-> *timeplot-table* *timeplot-index*) arg0)
|
|
(set! *timeplot-index* (+ *timeplot-index* 1))
|
|
(when (>= *timeplot-index* 400)
|
|
(set! *timeplot-index* 0)
|
|
0)
|
|
(none))
|
|
|
|
(defun float-lookup-timeplot ((arg0 float))
|
|
(let ((a0-3 (mod (+ (the int arg0) -1 *timeplot-index*) 400))) (-> *timeplot-table* a0-3)))
|
|
|
|
(define-perm *cam-layout* symbol #f)
|
|
|
|
0
|