Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport jak 3 logic for orbs in crates to jak 2 #91

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions goal_src/jak2/engine/common_objs/crates.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,22 @@
)
)

;;mod-base-change
(defbehavior collectable-count crate ((arg0 process-tree))
(set! *global-search-count* 0)
(iterate-process-tree
arg0
(lambda ((arg0 process))
(if (type? arg0 collectable)
(set! *global-search-count* (+ *global-search-count* 1))
)
#t
)
*null-kernel-context*
)
*global-search-count*
)

(defstate special-contents-die (crate)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
Expand All @@ -1029,6 +1045,7 @@
)
(process-entity-status! self (entity-perm-status dead) #t)
(process-entity-status! self (entity-perm-status subtask-complete) #t)
(process-entity-status! self (entity-perm-status bit-15) #f) ;;mod-base-change
(set! (-> gp-0 user-int8 0) 2)
(let ((v0-0 (logclear (-> self mask) (process-mask sleep))))
(set! (-> self mask) v0-0)
Expand Down Expand Up @@ -1069,8 +1086,9 @@
0
(logior! (-> self draw status) (draw-control-status no-draw))
(drop-pickup (-> self fact) #t self (the-as fact-info #f) 0)
(set! (-> self child-count) (+ (process-count self) -1))
(set! (-> self child-count) (collectable-count self)) ;;mod-base-change
(process-entity-status! self (entity-perm-status bit-4) #t)
(process-entity-status! self (entity-perm-status bit-15) #t) ;;mod-base-change
(when (-> self entity)
(let ((v1-32 (-> self entity extra perm)))
(logior! (-> v1-32 status) (entity-perm-status bit-5))
Expand Down Expand Up @@ -1279,7 +1297,9 @@ This commonly includes things such as:

(defmethod crate-method-38 ((this crate))
(when (-> this entity)
(if (>= (-> this entity extra perm user-int8 0) 1)
(if (and (>= (-> this entity extra perm user-int8 0) 1)
(logtest? (-> this entity extra perm status) (entity-perm-status bit-15)) ;;mod-base-change
)
(go (method-of-object this die) #t 0)
)
)
Expand Down
4 changes: 4 additions & 0 deletions goal_src/jak2/engine/entity/entity-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
(bit-10 10)
(save 11)
(bit-12 12)
;;mod-base-change
(bit-13 13)
(bit-14 14)
(bit-15 15)
)

(defenum vehicle-type
Expand Down
22 changes: 18 additions & 4 deletions goal_src/jak2/engine/entity/entity.gc
Original file line number Diff line number Diff line change
Expand Up @@ -1984,16 +1984,30 @@
(let* ((v1-0 arg0)
(s5-0 (cond
((or (= v1-0 'life) (= v1-0 'debug))
4719
(entity-perm-status bit-0 error dead no-kill bit-5 subtask-complete bit-9 bit-12 bit-15) ;;mod-base-change
)
((= v1-0 'try)
4719
(entity-perm-status bit-0 error dead no-kill bit-5 subtask-complete bit-9 bit-12 bit-15) ;;mod-base-change
)
((= v1-0 'game)
8063
(entity-perm-status bit-0
error
dead
no-kill
bit-4
bit-5
subtask-complete
complete
bit-9
bit-10
save
bit-12
bit-13
bit-15 ;;mod-base-change
)
)
(else
5759
(entity-perm-status bit-0 error dead no-kill bit-4 bit-5 subtask-complete bit-9 bit-10 bit-12 bit-15) ;;mod-base-change
)
)
)
Expand Down