mirror of
https://github.com/open-goal/jak-project
synced 2026-06-01 17:58:14 -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: 
345 lines
9.7 KiB
Common Lisp
345 lines
9.7 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
(bundles "ENGINE.CGO" "GAME.CGO")
|
|
(require "kernel-defs.gc")
|
|
|
|
;; PC port adds new menus and option types
|
|
(#cond
|
|
((not PC_PORT)
|
|
(defenum progress-screen
|
|
:type int64
|
|
(invalid -1)
|
|
(fuel-cell 0)
|
|
(money 1)
|
|
(buzzer 2)
|
|
(settings 3)
|
|
(game-settings 4)
|
|
(graphic-settings 5)
|
|
(sound-settings 6)
|
|
(memcard-no-space 7)
|
|
(memcard-not-inserted 8)
|
|
(memcard-not-formatted 9)
|
|
(memcard-format 10)
|
|
(memcard-data-exists 11)
|
|
(memcard-loading 12)
|
|
(memcard-saving 13)
|
|
(memcard-formatting 14)
|
|
(memcard-creating 15)
|
|
(load-game 16)
|
|
(save-game 17)
|
|
(save-game-title 18)
|
|
(memcard-insert 19)
|
|
(memcard-error-loading 20)
|
|
(memcard-error-saving 21)
|
|
(memcard-removed 22)
|
|
(memcard-no-data 23)
|
|
(memcard-error-formatting 24)
|
|
(memcard-error-creating 25)
|
|
(memcard-auto-save-error 26)
|
|
(title 27)
|
|
(settings-title 28)
|
|
(auto-save 29)
|
|
(pal-change-to-60hz 30)
|
|
(pal-now-60hz 31)
|
|
(no-disc 32)
|
|
(bad-disc 33)
|
|
(quit 34)
|
|
(max 35))
|
|
(defenum game-option-type
|
|
:type uint64
|
|
(slider 0)
|
|
(language 1)
|
|
(on-off 2)
|
|
(center-screen 3)
|
|
(aspect-ratio 4)
|
|
(video-mode 5)
|
|
(menu 6)
|
|
(yes-no 7)
|
|
(button 8)))
|
|
(#t
|
|
(defenum progress-screen
|
|
:type int64
|
|
(invalid -1)
|
|
(fuel-cell 0)
|
|
(money 1)
|
|
(buzzer 2)
|
|
(settings 3)
|
|
(game-settings 4)
|
|
(graphic-settings 5)
|
|
(sound-settings 6)
|
|
(memcard-no-space 7)
|
|
(memcard-not-inserted 8)
|
|
(memcard-not-formatted 9)
|
|
(memcard-format 10)
|
|
(memcard-data-exists 11)
|
|
(memcard-loading 12)
|
|
(memcard-saving 13)
|
|
(memcard-formatting 14)
|
|
(memcard-creating 15)
|
|
(load-game 16)
|
|
(save-game 17)
|
|
(save-game-title 18)
|
|
(memcard-insert 19)
|
|
(memcard-error-loading 20)
|
|
(memcard-error-saving 21)
|
|
(memcard-removed 22)
|
|
(memcard-no-data 23)
|
|
(memcard-error-formatting 24)
|
|
(memcard-error-creating 25)
|
|
(memcard-auto-save-error 26)
|
|
(title 27)
|
|
(settings-title 28)
|
|
(auto-save 29)
|
|
(pal-change-to-60hz 30)
|
|
(pal-now-60hz 31)
|
|
(no-disc 32)
|
|
(bad-disc 33)
|
|
(quit 34)
|
|
;; extra screens for pc port
|
|
;; input options
|
|
(input-options)
|
|
(select-controller)
|
|
(controller-binds) ;; 0x25
|
|
(keyboard-binds)
|
|
(mouse-binds)
|
|
(controller-options)
|
|
(mouse-options)
|
|
(reassign-binds-options)
|
|
(camera-options)
|
|
(accessibility-options)
|
|
(game-ps2-options)
|
|
(misc-options)
|
|
(resolution)
|
|
(aspect-msg)
|
|
(aspect-ratio)
|
|
(gfx-ps2-options)
|
|
(secrets)
|
|
(hint-log)
|
|
(cheats)
|
|
(scrapbook)
|
|
(music-player)
|
|
(scene-player)
|
|
(credits)
|
|
(quit-title)
|
|
(flava-player)
|
|
(memcard-disable-auto-save)
|
|
(memcard-auto-save-disabled)
|
|
(monitor)
|
|
(checkpoint-select)
|
|
(speedrun-options)
|
|
(speedrun-il-options)
|
|
(speedrun-cat-ext-options)
|
|
;; the last one!
|
|
(max))
|
|
(defenum game-option-type
|
|
:type uint64
|
|
(slider 0)
|
|
(language 1)
|
|
(on-off 2)
|
|
(center-screen 3)
|
|
(aspect-ratio 4)
|
|
(video-mode 5)
|
|
(menu 6)
|
|
(yes-no 7)
|
|
(button 8)
|
|
;; extra types for pc port
|
|
(normal-inverted)
|
|
(display-mode)
|
|
(msaa)
|
|
(frame-rate)
|
|
(lod-bg)
|
|
(lod-fg)
|
|
(resolution)
|
|
(aspect-new)
|
|
(language-subtitles)
|
|
(language-text)
|
|
(speaker)
|
|
(aspect-native)
|
|
(button-music)
|
|
(button-flava)
|
|
(cheat-toggle)
|
|
(monitor)
|
|
(controller)
|
|
(binding-assignment)
|
|
(confirmation))) ;; end of PC_PORT = #t branch for enum initialization
|
|
) ;; end of PC_PORT cond
|
|
|
|
(defenum game-option-menu
|
|
:type int32
|
|
:copy-entries progress-screen)
|
|
|
|
(defun-extern activate-progress process progress-screen none)
|
|
|
|
(defun-extern hide-progress-screen none)
|
|
|
|
(defun-extern hide-progress-icons none)
|
|
|
|
(defun-extern progress-allowed? symbol)
|
|
|
|
(defun-extern pause-allowed? symbol)
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype count-info (structure)
|
|
((money-count int32)
|
|
(buzzer-count int32))
|
|
:pack-me)
|
|
|
|
(deftype game-count-info (basic)
|
|
((length int32)
|
|
(data count-info :inline :dynamic)))
|
|
|
|
(deftype task-info-data (basic)
|
|
((task-id game-task)
|
|
(task-name text-id 4)
|
|
(text-index-when-resolved int32)))
|
|
|
|
(deftype level-tasks-info (basic)
|
|
((level-name-id text-id)
|
|
(text-group-index int32)
|
|
(nb-of-tasks int32)
|
|
(buzzer-task-index int32)
|
|
(task-info task-info-data 8)))
|
|
|
|
(deftype game-option (basic)
|
|
((option-type game-option-type)
|
|
(name text-id)
|
|
(scale symbol)
|
|
(param1 float)
|
|
(param2 float)
|
|
(param3 game-option-menu)
|
|
(value-to-modify pointer)
|
|
;; fields below added in pc port
|
|
(option-disabled-func (function symbol))
|
|
(name-override string)
|
|
(on-change (function object none))
|
|
(on-confirm (function none))
|
|
(slider-step-size float)
|
|
(slider-show-decimal? symbol)
|
|
(bind-info bind-assignment-info :inline)))
|
|
|
|
(deftype progress (process)
|
|
((current-debug-string int32)
|
|
(current-debug-language int32)
|
|
(current-debug-group int32)
|
|
(in-out-position int32)
|
|
(display-state progress-screen)
|
|
(next-display-state progress-screen)
|
|
(option-index int32)
|
|
(selected-option basic)
|
|
(completion-percentage float)
|
|
(ready-to-run basic)
|
|
(display-level-index int32)
|
|
(next-level-index int32)
|
|
(task-index int32)
|
|
(in-transition basic)
|
|
(last-in-transition basic)
|
|
(force-transition basic)
|
|
(stat-transition basic)
|
|
(level-transition int32)
|
|
(language-selection language-enum)
|
|
(language-direction symbol)
|
|
(language-transition basic)
|
|
(language-x-offset int32)
|
|
(sides-x-scale float)
|
|
(sides-y-scale float)
|
|
(left-x-offset int32)
|
|
(right-x-offset int32)
|
|
(button-scale float)
|
|
(slot-scale float)
|
|
(left-side-x-scale float)
|
|
(left-side-y-scale float)
|
|
(right-side-x-scale float)
|
|
(right-side-y-scale float)
|
|
(small-orb-y-offset int32)
|
|
(big-orb-y-offset int32)
|
|
(transition-offset int32)
|
|
(transition-offset-invert int32)
|
|
(transition-percentage float)
|
|
(transition-percentage-invert float)
|
|
(transition-speed float)
|
|
(total-nb-of-power-cells int32)
|
|
(total-nb-of-orbs int32)
|
|
(total-nb-of-buzzers int32)
|
|
(card-info mc-slot-info)
|
|
(last-option-index-change time-frame)
|
|
(video-mode-timeout time-frame)
|
|
(display-state-stack progress-screen 5)
|
|
(option-index-stack int32 5)
|
|
(display-state-pos int32)
|
|
(nb-of-icons int32)
|
|
(icons hud-icon 6)
|
|
(max-nb-of-particles int32)
|
|
(nb-of-particles int32)
|
|
(particles hud-particle 40)
|
|
(particle-state int32 40))
|
|
(:methods
|
|
(progress-method-14 (_type_) none)
|
|
(progress-method-15 (_type_) none)
|
|
(progress-method-16 (_type_) none)
|
|
(draw-progress (_type_) none)
|
|
(progress-method-18 () none)
|
|
(visible? (_type_) symbol)
|
|
(hidden? (_type_) symbol)
|
|
(adjust-sprites (_type_) none)
|
|
(adjust-icons (_type_) none)
|
|
(adjust-ratios (_type_ symbol symbol) none)
|
|
(draw-fuel-cell-screen (_type_ int) none)
|
|
(draw-money-screen (_type_ int) none)
|
|
(draw-buzzer-screen (_type_ int) none)
|
|
(draw-notice-screen (_type_) none)
|
|
(draw-options (_type_ int int float) none)
|
|
(respond-common (_type_) none)
|
|
(respond-progress (_type_) none)
|
|
(respond-memcard (_type_) none)
|
|
(can-go-back? (_type_) symbol)
|
|
(initialize-icons (_type_) none)
|
|
(initialize-particles (_type_) none)
|
|
(draw-memcard-storage-error (_type_ font-context) none)
|
|
(draw-memcard-data-exists (_type_ font-context) none)
|
|
(draw-memcard-no-data (_type_ font-context) none)
|
|
(draw-memcard-accessing (_type_ font-context) none)
|
|
(draw-memcard-insert (_type_ font-context) none)
|
|
(draw-memcard-file-select (_type_ font-context) none)
|
|
(draw-memcard-auto-save-error (_type_ font-context) none)
|
|
(draw-memcard-removed (_type_ font-context) none)
|
|
(draw-memcard-error (_type_ font-context) none)
|
|
(progress-method-44 (_type_) none)
|
|
(push! (_type_) none)
|
|
(pop! (_type_) none)
|
|
(progress-method-47 (_type_) none)
|
|
(enter! (_type_ progress-screen int) none)
|
|
(draw-memcard-format (_type_ font-context) none)
|
|
(draw-auto-save (_type_ font-context) none)
|
|
(set-transition-progress! (_type_ int) none)
|
|
(set-transition-speed! (_type_) none)
|
|
(set-memcard-screen (_type_ progress-screen) progress-screen)
|
|
(draw-pal-change-to-60hz (_type_ font-context) none)
|
|
(draw-pal-now-60hz (_type_ font-context) none)
|
|
(draw-no-disc (_type_ font-context) none)
|
|
(draw-bad-disc (_type_ font-context) none)
|
|
(draw-quit (_type_ font-context) none))
|
|
(:states
|
|
progress-coming-in
|
|
progress-debug
|
|
progress-going-out
|
|
progress-gone
|
|
progress-normal
|
|
progress-waiting))
|
|
|
|
(define *progress-process* (the-as (pointer progress) #f))
|
|
|
|
(define *progress-last-task-index* 0)
|
|
|
|
(defun-extern get-game-count int count-info)
|
|
|
|
(define-extern *level-task-data* (array level-tasks-info))
|
|
|
|
(define-extern *level-task-data-remap* (array int32))
|
|
|
|
(defun-extern deactivate-progress none)
|
|
|
|
(defun-extern calculate-completion progress float)
|
|
|
|
(defun-extern make-current-level-available-to-progress none)
|