mirror of
https://github.com/open-goal/jak-project
synced 2026-08-16 05:09:45 -04:00
[jak2] fix bad actors using unloaded types (#2402)
Actors that use types from a level that got unloaded should now get killed immediately instead of continuing to exist and eventually crash the game. NOTE: Will spam the console whenever a bad actor tries to spawn. I would like to document all instances of where this happens!
This commit is contained in:
+4546
-4546
File diff suppressed because it is too large
Load Diff
@@ -2241,6 +2241,14 @@
|
||||
(not (logtest? (-> sv-48 perm status) (entity-perm-status bit-9 bit-10)))
|
||||
(not (logtest? (-> sv-48 kill-mask) sv-32))
|
||||
(or (-> s4-1 vis-info 0) (< (vector-vector-distance (-> sv-48 trans) sv-16) (-> sv-48 vis-dist)))
|
||||
;; PC port note : added this extra check to fix level types being used after deloaded because of bad entity placement
|
||||
(#if PC_PORT
|
||||
(or (not (type-type? (-> sv-48 entity type) entity-actor)) (and (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype) type 'entity-type-check1 #f 0)
|
||||
(valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol) symbol 'entity-type-check2 #f 0)
|
||||
(valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value) type 'entity-type-check3 #f 0)
|
||||
(= (-> (the-as entity-actor (-> sv-48 entity)) etype) (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value))
|
||||
))
|
||||
#f)
|
||||
)
|
||||
(when (not (or (-> sv-48 process) (logtest? (-> sv-48 perm status) (entity-perm-status bit-0 dead)) s0-0))
|
||||
(birth! (-> sv-48 entity))
|
||||
|
||||
@@ -1598,7 +1598,7 @@ into 7 sections, which might explain the weird sizes in the center.
|
||||
(set! (-> obj borrow-level s5-0) #f)
|
||||
)
|
||||
)
|
||||
;; if we borrow from soembody, remove ourselves from them
|
||||
;; if we borrow from somebody, remove ourselves from them
|
||||
(when (-> obj borrow-from-level)
|
||||
(dotimes (v1-19 2)
|
||||
(if (= obj (-> obj borrow-from-level borrow-level v1-19))
|
||||
@@ -1713,13 +1713,15 @@ into 7 sections, which might explain the weird sizes in the center.
|
||||
)
|
||||
(let ((v1-103 0)
|
||||
(a0-60 0)
|
||||
(a1-23 (the-as basic (-> obj level-type)))
|
||||
(a1-23 (-> obj level-type))
|
||||
)
|
||||
(while a1-23
|
||||
(+! a0-60 1)
|
||||
(+! v1-103 (-> (the-as type a1-23) psize))
|
||||
(set! (-> (the-as type a1-23) symbol value) (the-as object 0))
|
||||
(set! a1-23 (-> (the-as type a1-23) method-table 8))
|
||||
(+! v1-103 (-> a1-23 psize))
|
||||
;; PC port note : added this call to kill entities using level types that are being unloaded because of bad entity placement
|
||||
(kill-by-type a1-23 *active-pool*)
|
||||
(set! (-> a1-23 symbol value) (the-as object 0))
|
||||
(set! a1-23 (the-as type (-> a1-23 method-table 8)))
|
||||
)
|
||||
)
|
||||
(let* ((s5-6 (-> obj info packages))
|
||||
|
||||
Reference in New Issue
Block a user