Files
jak-project/goal_src/jak3/engine/util/script-h.gc
T
Hat Kid 93afb02cf4 decomp3: spawn target, add merc and particle buckets and some temporary hacks (#3445)
This includes all the collision stuff needed to spawn `target`,
decompiles the sparticle code and adds some of the PC hacks needed for
merc to run (it doesn't work quite right and looks bad, likely due to a
combination of code copied from Jak 2 and the time of day hacks).

There are a bunch of temporary hacks (see commits) in place to prevent
the game from crashing quite as much, but it is still extremely prone to
doing so due to lots of missing functions/potentially bad decomp.

---------

Co-authored-by: water <awaterford111445@gmail.com>
2024-04-05 00:07:39 -04:00

76 lines
2.2 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: script-h.gc
;; name in dgo: script-h
;; dgos: GAME
(declare-type script-context structure)
(define-extern *syntax-context* script-context)
(define-extern *script-context* script-context)
(declare-type script-context structure)
(declare-type load-state structure)
(define-extern *load-state* load-state)
(defmacro script-eval (script &key (key (process->ppointer PP)) &key (proc PP) &key (vector (the-as vector #f)))
`(eval! (new 'stack 'script-context ,key ,proc ,vector) ,script))
(define-extern command-get-int (function object int int))
(define-extern command-get-float (function object float float))
(define-extern command-get-param (function object object object))
(define-extern command-get-process (function object process process))
;; DECOMP BEGINS
(deftype script-form (structure)
((name symbol)
(spec pair)
(func (function script-context object))
)
:pack-me
(:methods
(script-form-method-9 () none)
)
)
(deftype script-context (structure)
((load-state load-state)
(key object)
(process process)
(trans vector)
(side-effect? symbol)
(got-error? symbol)
(expr pair)
(param-count int32)
(param object 16)
(param-type object 16)
)
(:methods
(new (symbol type object process vector) _type_)
(eval! (_type_ pair) object)
(script-context-method-10 (_type_ object pair) object)
(script-context-method-11 (_type_ pair pair symbol) symbol)
)
)
;; WARN: Return type mismatch structure vs script-context.
(defmethod new script-context ((allocation symbol) (type-to-make type) (arg0 object) (arg1 process) (arg2 vector))
(let ((t9-0 (method-of-type structure new))
(v1-1 type-to-make)
)
(-> type-to-make size)
(let ((v0-0 (t9-0 allocation v1-1)))
(set! (-> (the-as script-context v0-0) key) arg0)
(set! (-> (the-as script-context v0-0) process) arg1)
(set! (-> (the-as script-context v0-0) load-state) *load-state*)
(set! (-> (the-as script-context v0-0) side-effect?) #t)
(set! (-> (the-as script-context v0-0) got-error?) #f)
(set! (-> (the-as script-context v0-0) trans) arg2)
(the-as script-context v0-0)
)
)
)