jak-project/goal_src/goos-lib.gs

507 lines
9.9 KiB
Scheme
Raw Normal View History

2020-08-22 22:30:12 -04:00
;-*-Scheme-*-
;; THE GOOS COMMON LIBRARY
;; goos macro to define a new goos macro
(define defsmacro (macro (name args &rest body)
`(define ,name (macro ,args ,@body))
)
)
;; macro to define a new goos function
(defsmacro desfun (name args &rest body)
`(define ,name (lambda ,args ,@body))
)
;; goos macro to let us define goal macros from goos:
(defsmacro defgmacro (name args &rest body)
`(define :env *goal-env* ,name (macro ,args ,@body))
)
(defsmacro if (clause true false)
`(cond (,clause ,true) (#t ,false))
)
(defsmacro when (clause &rest body)
`(if ,clause (begin ,@body) #f)
)
2020-08-22 22:30:12 -04:00
(defsmacro not (x)
`(if ,x #f #t)
)
(defsmacro unless (clause &rest body)
`(if (not ,clause) (begin ,@body) #f)
)
(defsmacro aif (condition true false)
"Anaphoric if, similar to Common Lisp"
`(let ((it ,condition))
(if it
,true
,false
)
)
)
2020-08-22 22:30:12 -04:00
(desfun factorial (x)
(if (= x 1)
1
(* x (factorial (- x 1)))
)
)
(defsmacro max (a b)
`(if (> a b) a b)
)
(defsmacro min (a b)
`(if (< a b) a b)
)
2020-08-22 22:30:12 -04:00
(defsmacro caar (x)
`(car (car ,x)))
(defsmacro cadr (x)
`(car (cdr ,x)))
(defsmacro cdar (x)
`(cdr (car ,x)))
(defsmacro cddr (x)
`(cdr (cdr ,x)))
(defsmacro caddr (x)
`(car (cdr (cdr ,x))))
(defsmacro cdddr (x)
`(cdr (cdr (cdr ,x))))
(defsmacro cadddr (x)
`(car (cdr (cdr (cdr ,x)))))
2021-08-17 01:23:08 -04:00
(defsmacro caadr (x)
`(car (car (cdr ,x))))
(defsmacro cadar (x)
`(car (cdr (car ,x))))
2020-08-22 22:30:12 -04:00
(desfun first (x)
(car x))
(desfun rest (x)
(cdr x))
(desfun second (x)
(car (cdr x))
)
(desfun third (x)
(car (cddr x)))
(defsmacro push! (lst x)
`(set! ,lst (cons ,x ,lst))
)
(defsmacro pop! (lst)
`(set! ,lst (cdr ,lst))
)
(desfun count (lst)
(if (null? lst)
0
(+ 1 (count (cdr lst))))
)
2020-08-22 22:30:12 -04:00
(desfun apply (fun x)
(if (null? x)
'()
(cons (fun (car x))
(apply fun (cdr x))
)
)
)
;; same as apply but interleaves with two functions and lists
(desfun apply2 (fun1 fun2 lst1 lst2)
(if (or (null? lst1) (null? lst2) (not (= (length lst1) (length lst2))))
'()
(cons (fun1 (car lst1))
(cons (fun2 (car lst2))
(apply2 fun1 fun2 (cdr lst1) (cdr lst2))
)
)
)
)
2020-08-22 22:30:12 -04:00
(desfun filter (pred lst)
(cond ((null? lst) '())
((pred (first lst))
(cons (first lst) (filter pred (cdr lst))))
(#t (filter pred (cdr lst)))))
(desfun member (x a)
(if (null? a)
#f
(if (eq? (car a) x)
a
(member x (cdr a))
)
)
)
2020-08-22 22:30:12 -04:00
(desfun assoc (x a)
(if (null? a)
#f
(if (eq? (caar a) x)
(car a)
(assoc x (cdr a))
)
)
2020-08-22 22:30:12 -04:00
)
(desfun assocn (x a)
(let ((i -1)
(ret -1)
(iter a))
(while (and (< ret 0) (not (null? iter)))
(inc! i)
(when (eq? (car iter) x)
(set! ret i))
(set! iter (cdr iter)))
ret)
)
(desfun nth (n a)
(let ((i -1)
(ret #f)
(stop? #f)
(iter a))
(while (and (not stop?) (not (null? iter)))
(inc! i)
(when (eq? i n)
(set! ret (car iter))
(set! stop? #t))
(set! iter (cdr iter)))
ret)
)
(desfun list (&rest items)
(apply (lambda (x) x) items)
)
(desfun reverse (lst)
(if (null? lst)
'()
(let ((old-lst lst)
(new-lst '()))
(while (not (null? old-lst))
(set! new-lst (cons (car old-lst) new-lst))
(set! old-lst (cdr old-lst))
)
new-lst
)
)
)
(desfun reverse-recursive (lst)
(if (null? lst)
'()
(let ((old-lst lst)
(new-lst '()))
(while (not (null? old-lst))
(let ((cur-obj (car old-lst)))
(set! new-lst (cons (if (pair? cur-obj)
(reverse-recursive cur-obj)
cur-obj
)
new-lst))
(set! old-lst (cdr old-lst))
)
)
new-lst
)
)
)
2020-08-22 22:30:12 -04:00
(defsmacro let (bindings &rest body)
`((lambda ,(apply first bindings) ,@body)
,@(apply second bindings)))
(defsmacro let* (bindings &rest body)
(if (null? bindings)
`(begin ,@body)
`((lambda (,(caar bindings))
(let* ,(cdr bindings) ,@body))
;;(begin ,@(cdar bindings))
,(car (cdar bindings))
)
)
)
(defsmacro dotimes (var &rest body)
`(let (( ,(first var) 0))
(while (< ,(first var) ,(second var))
,@body
(set! ,(first var) (+ ,(first var) 1))
)
,@(cddr var)
)
)
(desfun repeated-list (obj count)
(if (= 0 count)
'()
(cons obj (repeated-list obj (- count 1)))
)
)
2020-08-22 22:30:12 -04:00
(defsmacro with-gensyms (names &rest body)
`(let
,(apply (lambda (x) `(,x (gensym))) names)
,@body
)
)
(desfun length (lst)
(if (null? lst)
0
(+ 1 (length (cdr lst)))
)
)
(defsmacro dolist (bindings &rest body)
`(let ((,(car bindings) ,(cadr bindings)))
(while (not (null? ,(car bindings)))
,@body
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
(set! ,(car bindings) (cdr ,(car bindings)))
)
)
)
(defsmacro cons! (lst obj) `(set! ,lst (cons ,obj ,lst)))
(desfun append! (lst obj)
"adds obj to the end of lst. only edits inplace if lst is not null."
(let ((pended #f))
(if (null? lst)
(set! lst (cons obj '()))
(dolist (it lst)
(when (and (not pended) (null? (cdr it)))
(set-cdr! it (cons obj '()))
(set! pended #t)
)
)
)
)
lst
)
(desfun delete-last! (lst)
"removes last item in lst. only edits inplace if lst is not null."
(let ((prev '()))
(dolist (it lst)
(when (null? (cdr it))
(if (null? prev)
(set! lst '())
(set-cdr! prev '())
)
)
(set! prev it)
)
)
lst
)
(defsmacro append!! (lst obj) `(set! ,lst (append! ,lst ,obj)))
(defsmacro delete-last!! (lst) `(set! ,lst (delete-last! ,lst)))
(defsmacro 1+ (x) `(+ ,x 1))
(defsmacro 1- (x) `(- ,x 1))
(defsmacro inc! (x) `(set! ,x (1+ ,x)))
(defsmacro dec! (x) `(set! ,x (1- ,x)))
2020-08-22 22:30:12 -04:00
(defsmacro +! (place arg) `(set! ,place (+ ,place ,arg)))
(defsmacro -! (place arg) `(set! ,place (- ,place ,arg)))
(defsmacro string? (x)
`(type? 'string ,x))
(defsmacro float? (x)
`(type? 'float ,x)
)
(defsmacro integer? (x)
`(type? 'integer ,x)
)
2020-08-22 22:30:12 -04:00
(defsmacro number? (x)
`(or (float? ,x) (integer? ,x))
)
(defsmacro neq? (a b) `(not (eq? ,a ,b)))
(defsmacro != (a b) `(not (= ,a ,b)))
(defsmacro zero? (x) `(= ,x 0))
(defsmacro nonzero? (x) `(!= ,x 0))
(defsmacro pair? (x)
`(type? 'pair ,x)
)
(defsmacro symbol? (x)
`(type? 'symbol ,x)
)
(defsmacro ferror (&rest args)
`(error (fmt #f ,@args))
)
2020-08-22 22:30:12 -04:00
(desfun apply-i-fun (fun x i)
(if (null? x)
'()
(cons (fun (car x) i)
(apply-i-fun fun (cdr x) (inc! i))
)
)
)
(defsmacro apply-i (fun x)
`(apply-i-fun ,fun ,x 0)
)
(defsmacro string->symbol-format (str &rest args)
`(string->symbol (fmt #f ,str ,@args))
)
2020-08-22 22:30:12 -04:00
;; Bootstrap GOAL macro system
;; goal macro to define a goal macro
(defgmacro defmacro (name args &rest body)
`(begin
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
,(if (and (> (length body) 1) (string? (first body)))
;; then it's a docstring and we ignore it.
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
`(begin
(update-macro-metadata ,name ,(first body) ,args)
(seval (defgmacro ,name ,args ,@(cdr body))))
;; otherwise don't ignore it.
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
`(begin
(update-macro-metadata ,name "" ,args)
(seval (defgmacro ,name ,args ,@body)))
)
)
2020-08-22 22:30:12 -04:00
)
;; goal macro to define a goos macro
(defgmacro defsmacro (name args &rest body)
`(seval (defsmacro ,name ,args ,@body))
)
;; goal macro to define a goos function
(defgmacro desfun (name args &rest body)
`(seval (desfun ,name ,args ,@body))
)
;;;;;;;;;;;;;;;;;;;
;; enum stuff
;;;;;;;;;;;;;;;;;;;
(desfun enum-length (enum)
(length (get-enum-vals enum))
)
(defsmacro doenum (bindings &rest body)
;; (doenum (name-var val-var 'enum &rest result) &rest body)
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
(with-gensyms (enum-vals)
`(let ((,enum-vals (get-enum-vals ,(third bindings))))
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
(while (not (null? ,enum-vals))
(let ((,(first bindings) (caar ,enum-vals)) ;; name
(,(second bindings) (cdar ,enum-vals)) ;; value
)
,@body
)
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
(set! ,enum-vals (cdr ,enum-vals))
)
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
,@(cdddr bindings)
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
)
)
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
)
(desfun enum-max (enum)
"get the highest value in an enum"
docs: Automatically generate documentation from goal_src code (#2214) This automatically generates documentation from goal_src docstrings, think doxygen/java-docs/rust docs/etc. It mostly supports everything already, but here are the following things that aren't yet complete: - file descriptions - high-level documentation to go along with this (think pure markdown docs describing overall systems that would be co-located in goal_src for organizational purposes) - enums - states - std-lib functions (all have empty strings right now for docs anyway) The job of the new `gen-docs` function is solely to generate a bunch of JSON data which should give you everything you need to generate some decent documentation (outputting markdown/html/pdf/etc). It is not it's responsibility to do that nice formatting -- this is by design to intentionally delegate that responsibility elsewhere. Side-note, this is about 12-15MB of minified json for jak 2 so far :) In our normal "goal_src has changed" action -- we will generate this data, and the website can download it -- use the information to generate the documentation at build time -- and it will be included in the site. Likewise, if we wanted to include docs along with releases for offline viewing, we could do so in a similar fashion (just write a formatting script to generate said documentation). Lastly this work somewhat paves the way for doing more interesting things in the LSP like: - whats the docstring for this symbol? - autocompleting function arguments - type checking function arguments - where is this symbol defined? - etc Fixes #2215
2023-02-20 19:49:37 -05:00
[game] pc port progress menu (#1281) * fix typo * more typo * shorten discord rpc text * allow expanding enums after the fact (untested) * make `game_text` work similar to subtitles * update progress decomp * update some types + `do-not-decompile` in bitfield * fixes and fall back to original progress code * update `progress` decomp with new enums * update config files * fix enums and debug menu * always allocate (but not use) a lot of particles * small rework to display mode options * revert resolution/aspect-ratio symbol mess * begin the override stuff * make `progress-draw` more readable * more fixes * codacy good boy points * first step overriding code * finish progress overrides, game options menu fully functional! * minor fixes * Update game.gp * Update sparticle-launcher.gc * clang * change camera controls text * oops * some cleanup * derp * nice job * implement menu scrolling lol * make scrollable menus less cramped, fix arrows * make some carousell things i guess * add msaa carousell to test * oops * Update progress-pc.gc * make `pc-get-screen-size` (untested) * resolution menu * input fixes * return when selecting resolution * scroll fixes * Update progress-pc.gc * add "fit to screen" button * bug * complete resolutions menu * aspect ratio menu * subtitles language * subtitle speaker * final adjustments * ref test * fix tests * fix ref! * reduce redundancy a bit * fix mem leaks? * save settings on progress exit * fix init reorder * remove unused code * rename goal project-like files to the project extension * sha display toggle * aspect ratio settings fixes * dont store text db's in compiler * properly save+load native aspect stuff
2022-04-11 18:38:54 -04:00
(let ((max-val -999999999999))
(doenum (name val enum)
(when (> val max-val)
(set! max-val val))
)
max-val)
)
(defgmacro enum-max (enum)
(enum-max enum))
(defgmacro enum-length (enum)
(enum-length enum))
;; shortcut to quit GOOS
(defsmacro e ()
`(exit)
)
2020-08-22 22:30:12 -04:00
;; this is checked in a test to see if this file is loaded.
(define __goos-lib-loaded__ #t)
;;;;;;;;;;;;;;;;;;;;;;;;
;; USER PROFILES ;;
;;;;;;;;;;;;;;;;;;;;;;;;
;; *user* is defined when goos starts!
(when *user*
(fmt #t "Loading user scripts for user: {}...\n" *user*)
;; i'm not sure what naming scheme to use here. user/<name>/user.gs?
;; the GOAL one is loaded in Compiler.cpp
(try-load-file (fmt #f "goal_src/user/{}/user.gs" *user*))
)
(defsmacro user? (&rest users)
(cond
((null? users) #f)
((eq? *user* (car users)) #t)
(#t `(user? ,@(cdr users)))
)
)
;;;;;;;;;;;;;;;;;;;;;;;;
;; GAME STUFF!!! ;;
;;;;;;;;;;;;;;;;;;;;;;;;
;; a map for art definitions used by art loading code.
(define *art-info* (make-string-hash-table))
;;;;;;;;;;;;;;;;;;;;;;;;
;; build system ;;
;;;;;;;;;;;;;;;;;;;;;;;;
(define GAME_TERRITORY_SCEA 0)
(define GAME_TERRITORY_SCEE 1)
(define GAME_TERRITORY_SCEI 2)
(define *jak1-full-game* (if (user? dass) #t #f))
(define *jak1-territory* GAME_TERRITORY_SCEA)
;; whether to enable ps3 test levels for jak 2
(define USE_PS3_LEVELS #f)