jak-project/goal_src/jak1/engine/ui/progress/progress-h.gc
ManDude cd68cb671e
deftype and defmethod syntax major changes (#3094)
Major change to how `deftype` shows up in our code:
- the decompiler will no longer emit the `offset-assert`,
`method-count-assert`, `size-assert` and `flag-assert` parameters. There
are extremely few cases where having this in the decompiled code is
helpful, as the types there come from `all-types` which already has
those parameters. This also doesn't break type consistency because:
  - the asserts aren't compared.
- the first step of the test uses `all-types`, which has the asserts,
which will throw an error if they're bad.
- the decompiler won't emit the `heap-base` parameter unless necessary
now.
- the decompiler will try its hardest to turn a fixed-offset field into
an `overlay-at` field. It falls back to the old offset if all else
fails.
- `overlay-at` now supports field "dereferencing" to specify the offset
that's within a field that's a structure, e.g.:
```lisp
(deftype foobar (structure)
  ((vec    vector  :inline)
   (flags  int32   :overlay-at (-> vec w))
   )
  )
```
in this structure, the offset of `flags` will be 12 because that is the
final offset of `vec`'s `w` field within this structure.
- **removed ID from all method declarations.** IDs are only ever
automatically assigned now. Fixes #3068.
- added an `:overlay` parameter to method declarations, in order to
declare a new method that goes on top of a previously-defined method.
Syntax is `:overlay <method-name>`. Please do not ever use this.
- added `state-methods` list parameter. This lets you quickly specify a
list of states to be put in the method table. Same syntax as the
`states` list parameter. The decompiler will try to put as many states
in this as it can without messing with the method ID order.

Also changes `defmethod` to make the first type definition (before the
arguments) optional. The type can now be inferred from the first
argument. Fixes #3093.

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
2023-10-30 03:20:02 +00:00

378 lines
9.5 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: progress-h.gc
;; name in dgo: progress-h
;; dgos: GAME, ENGINE
;; 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)