mirror of
https://github.com/open-goal/jak-project
synced 2026-05-24 07:11:15 -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:
@@ -46,9 +46,9 @@
|
||||
// set to false to skip adding .STR files to the decompiler database
|
||||
"read_spools": false,
|
||||
// write out spool subtitle text, implies read_spools
|
||||
"process_subtitle_text": true,
|
||||
"process_subtitle_text": false,
|
||||
// write out spool subtitle images, implies read_spools
|
||||
"process_subtitle_images": true,
|
||||
"process_subtitle_images": false,
|
||||
|
||||
///////////////////////////
|
||||
// WEIRD OPTIONS
|
||||
|
||||
@@ -673,7 +673,7 @@
|
||||
["darkjak-highres-ag", "darkjak-highres", 4, ["ORACLE", "NEB", "VI1"], "characters/high-res/darkjak"],
|
||||
["oracle-roof-banner-b-ag", "oracle-roof-banner-b", 4, ["ORACLE"], "levels/city/oracle"],
|
||||
["oracle-roof-banner-ag", "oracle-roof-banner", 4, ["ORACLE"], "levels/city/oracle"],
|
||||
["door-ag", "oracle-door", 4, ["ORACLE", "CTC"], "levels/city/oracle"],
|
||||
["oracle-door-ag", "oracle-door", 4, ["ORACLE", "CTC"], "levels/city/oracle"],
|
||||
["oracle-wall-banner-ag", "oracle-wall-banner", 4, ["ORACLE"], "levels/city/oracle"],
|
||||
["oracle", "oracle", 4, ["ORACLE"], "levels/city/oracle"],
|
||||
["tess-lhiphog+0-ag", "tess-lhiphog+0", 4, ["LERLTESS", "LTESS"], "characters/tess"],
|
||||
@@ -733,7 +733,7 @@
|
||||
["tpage-3512", "tpage-3512", 4, ["LGARCSTA"], "levels/outro"],
|
||||
["tpage-3271", "tpage-3271", 4, ["LGARCSTA"], "levels/outro"],
|
||||
["samos-highres-ag", "samos-highres", 4, ["LGARCSTA", "LPRSNCST", "OUTROCST", "LERBRNGD", "STADBLMP", "LSAMERGD", "LINTCSTB", "LSMYSBRT", "LYSAMSAM"], "characters/high-res/samos"],
|
||||
["gold-key-ag", "sew-gold-key", 4, ["LGARCSTA", "SEW", "LHIPOUT"], "levels/outro"],
|
||||
["sew-gold-key-ag", "sew-gold-key", 4, ["LGARCSTA", "SEW", "LHIPOUT"], "levels/outro"],
|
||||
["lgarcsta", "lgarcsta", 4, ["LGARCSTA"], "levels/outro"],
|
||||
["rhino", "rhino", 3, ["MTN"], "levels/temple"],
|
||||
["rhino-wall", "rhino-wall", 3, ["MTN"], "levels/temple"],
|
||||
@@ -750,14 +750,14 @@
|
||||
["tpage-1257", "tpage-1257", 4, ["MTN"], "levels/temple"],
|
||||
["tpage-3470", "tpage-3470", 4, ["MTN"], "levels/temple"],
|
||||
["tpage-1275", "tpage-1275", 4, ["MTN"], "levels/temple"],
|
||||
["plat-buried-ag", "mtn-plat-buried", 4, ["MTX", "MTN"], "levels/temple"],
|
||||
["plat-return-ag", "mtn-plat-return", 4, ["MTX", "MTN"], "levels/temple"],
|
||||
["mtn-plat-buried-ag", "mtn-plat-buried", 4, ["MTX", "MTN"], "levels/temple"],
|
||||
["mtn-plat-return-ag", "mtn-plat-return", 4, ["MTX", "MTN"], "levels/temple"],
|
||||
["water-anim-mountain-ag", "water-anim-mountain", 4, ["MTN"], "levels/temple"],
|
||||
["shard-ag", "mtn-shard", 4, ["MTN", "MCN"], "levels/temple"],
|
||||
["mtn-shard-ag", "mtn-shard", 4, ["MTN", "MCN"], "levels/temple"],
|
||||
["mtn-gate-ag", "mtn-gate", 4, ["MTN"], "levels/temple"],
|
||||
["mtn-lens-base-ag", "mtn-lens-base", 4, ["MTN"], "levels/temple"],
|
||||
["mtn-plat-long-ag", "mtn-plat-long", 4, ["MTN"], "levels/temple"],
|
||||
["iris-door-ag", "mtn-iris-door", 4, ["MTX", "MTN"], "levels/temple"],
|
||||
["mtn-iris-door-ag", "mtn-iris-door", 4, ["MTX", "MTN"], "levels/temple"],
|
||||
["mtn-plat-elevator-ag", "mtn-plat-elevator", 4, ["MTN"], "levels/temple"],
|
||||
["mtn-plat-shoot-ag", "mtn-plat-shoot", 4, ["MTN"], "levels/temple"],
|
||||
["mtn-lens-floor-ag", "mtn-lens-floor", 4, ["MTN"], "levels/temple"],
|
||||
@@ -1120,7 +1120,7 @@
|
||||
["mantis-ag", "mantis", 4, ["NESTT", "NES"], "levels/nest"],
|
||||
["nest-break-rocks-ag", "nest-break-rocks", 4, ["NESTT", "NES"], "levels/nest"],
|
||||
["water-anim-nest-dark-eco-ag", "water-anim-nest-dark-eco", 4, ["NESTT", "NES"], "levels/nest"],
|
||||
["switch-ag", "cas-switch", 4, ["NES", "CAS", "NESTT"], "levels/nest"],
|
||||
["cas-switch-ag", "cas-switch", 4, ["NES", "CAS", "NESTT"], "levels/nest"],
|
||||
["air-train-ag", "air-train", 4, ["NES", "CAP", "NESTT", "CPO"], "levels/nest"],
|
||||
["nestt", "nestt", 4, ["NESTT"], "levels/nest"],
|
||||
["tpage-3039", "tpage-3039", 4, ["LWIDEC"], "levels/city/common"],
|
||||
@@ -1188,7 +1188,7 @@
|
||||
["tpage-3239", "tpage-3239", 4, ["COB"], "levels/consite"],
|
||||
["kor-transform-ag", "kor-transform", 4, ["COB"], "levels/consite"],
|
||||
["kor-break-ag", "kor-break", 4, ["COB"], "levels/consite"],
|
||||
["door-ctyinda-ag", "vin-door-ctyinda", 4, ["COB", "CIA"], "levels/consite"],
|
||||
["vin-door-ctyinda-ag", "vin-door-ctyinda", 4, ["COB", "CIA"], "levels/consite"],
|
||||
["kor-break-ray-ag", "kor-break-ray", 4, ["COB"], "levels/consite"],
|
||||
["consiteb-vis", "consiteb-vis", 4, ["COB"], "levels/consite"],
|
||||
["bombbot-h", "bombbot-h", 3, ["LBOMBBOT"], "levels/common/enemy/bombots"],
|
||||
@@ -1279,7 +1279,7 @@
|
||||
["mtn-dice-button-ag", "mtn-dice-button", 4, ["MTX"], "levels/temple"],
|
||||
["mtn-plat-eject-ag", "mtn-plat-eject", 4, ["MTX"], "levels/temple"],
|
||||
["mtn-button-ag", "mtn-button", 4, ["MTX"], "levels/temple"],
|
||||
["gear-device-gear-ag", "mtn-gear-device-gear", 4, ["MTX", "MCN"], "levels/temple"],
|
||||
["mtn-gear-device-gear-ag", "mtn-gear-device-gear", 4, ["MTX", "MCN"], "levels/temple"],
|
||||
["mtn-lens-ag", "mtn-lens", 4, ["MTX", "MCN"], "levels/temple"],
|
||||
["mtnext-vis", "mtnext-vis", 4, ["MTX"], "levels/temple"],
|
||||
["fordumpa-part", "fordumpa-part", 3, ["FDA"], "levels/fortress/ammo_dump"],
|
||||
@@ -1673,7 +1673,7 @@
|
||||
["tpage-2373", "tpage-2373", 4, ["LPORTRUN"], "levels/city/port/mines"],
|
||||
["ctyport-cargo-ag", "ctyport-cargo", 4, ["LPORTRUN"], "levels/city/port/mines"],
|
||||
["ctyport-spy-ag", "ctyport-spy", 4, ["LPORTRUN"], "levels/city/port/mines"],
|
||||
["mine-b-ag", "sew-mine-b", 4, ["SEW", "SWE", "LPORTRUN"], "levels/city/port/mines"],
|
||||
["sew-mine-b-ag", "sew-mine-b", 4, ["SEW", "SWE", "LPORTRUN"], "levels/city/port/mines"],
|
||||
["ctyport-mine-ag", "ctyport-mine", 4, ["LPORTRUN"], "levels/city/port/mines"],
|
||||
["lportrun", "lportrun", 4, ["LPORTRUN"], "levels/city/port/mines"],
|
||||
["tpage-2707", "tpage-2707", 4, ["LASHGRD"], "characters/ashelin_guard"],
|
||||
@@ -1733,13 +1733,13 @@
|
||||
["sew-wall-ag", "sew-wall", 4, ["SWE"], "levels/sewer/escort"],
|
||||
["sew-mar-statue-explode-ag", "sew-mar-statue-explode", 4, ["SWE"], "levels/sewer/escort"],
|
||||
["sew-multi-blade-ag", "sew-multi-blade", 4, ["SWE", "SEW"], "levels/sewer"],
|
||||
["mar-statue-ag", "sew-mar-statue", 4, ["SWE", "SEW"], "levels/sewer/escort"],
|
||||
["sew-mar-statue-ag", "sew-mar-statue", 4, ["SWE", "SEW"], "levels/sewer/escort"],
|
||||
["sew-twist-blade-ag", "sew-twist-blade", 4, ["SWE", "SEW"], "levels/sewer"],
|
||||
["mine-a-ag", "sew-mine-a", 4, ["SWE", "SEW"], "levels/sewer/escort"],
|
||||
["sew-mine-a-ag", "sew-mine-a", 4, ["SWE", "SEW"], "levels/sewer/escort"],
|
||||
["sew-arm-blade-ag", "sew-arm-blade", 4, ["SWE", "SEW"], "levels/sewer"],
|
||||
["light-switch-ag", "sew-light-switch", 4, ["SWE", "SEW"], "levels/sewer/escort"],
|
||||
["sew-light-switch-ag", "sew-light-switch", 4, ["SWE", "SEW"], "levels/sewer/escort"],
|
||||
["jinx-bomb-ag", "jinx-bomb", 4, ["SWE"], "levels/sewer/escort"],
|
||||
["grill-ag", "sew-grill", 4, ["SWE", "SEW"], "levels/sewer/escort"],
|
||||
["sew-grill-ag", "sew-grill", 4, ["SWE", "SEW"], "levels/sewer/escort"],
|
||||
["sewesc-vis", "sewesc-vis", 4, ["SWE"], "levels/sewer/escort"],
|
||||
["tpage-3432", "tpage-3432", 4, ["LRACECB"], "levels/common/races"],
|
||||
["lracecb", "lracecb", 4, ["LRACECB"], "levels/common/races"],
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"cas-rot-bridge-ag.go"
|
||||
"cas-electric-fence-ag.go"
|
||||
"cas-rot-blade-ag.go"
|
||||
"switch-ag.go"
|
||||
"cas-switch-ag.go"
|
||||
"cas-conveyor-switch-ag.go"
|
||||
"cas-robot-door-ag.go"
|
||||
"cas-trapdoor-ag.go"
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
"tpage-1562.go"
|
||||
"tpage-1361.go"
|
||||
"tpage-1640.go"
|
||||
"door-ctyinda-ag.go"
|
||||
"vin-door-ctyinda-ag.go"
|
||||
"ctyinda-vis.go"
|
||||
))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"kor-break-ag.go"
|
||||
"metalkor-highres-ag.go"
|
||||
"com-airlock-inner-ag.go"
|
||||
"door-ctyinda-ag.go"
|
||||
"vin-door-ctyinda-ag.go"
|
||||
"kor-break-ray-ag.go"
|
||||
"consiteb-vis.go"
|
||||
))
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
"tpage-1023.go"
|
||||
"tpage-1648.go"
|
||||
"com-airlock-outer-ag.go"
|
||||
"door-ag.go"
|
||||
"oracle-door-ag.go"
|
||||
"ctyslumc-vis.go"
|
||||
))
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
"samos-highres-ag.go"
|
||||
"tess-highres-ag.go"
|
||||
"ashelin-highres-ag.go"
|
||||
"gold-key-ag.go"
|
||||
"sew-gold-key-ag.go"
|
||||
"lgarcsta.go"
|
||||
))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"crocadog-highres-ag.go"
|
||||
"sig-highres-ag.go"
|
||||
"metalkor-chopped-ag.go"
|
||||
"gold-key-ag.go"
|
||||
"sew-gold-key-ag.go"
|
||||
"kid-medallion-ag.go"
|
||||
"hip-bottle-c-ag.go"
|
||||
"hip-mug-ag.go"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"tpage-2373.go"
|
||||
"ctyport-cargo-ag.go"
|
||||
"ctyport-spy-ag.go"
|
||||
"mine-b-ag.go"
|
||||
"sew-mine-b-ag.go"
|
||||
"ctyport-mine-ag.go"
|
||||
"lportrun.go"
|
||||
))
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"mincan-lighthouse-ag.go"
|
||||
"water-anim-mincan-ag.go"
|
||||
"mincan-lens-ag.go"
|
||||
"shard-ag.go"
|
||||
"gear-device-gear-ag.go"
|
||||
"mtn-shard-ag.go"
|
||||
"mtn-gear-device-gear-ag.go"
|
||||
"mtn-lens-ag.go"
|
||||
"particleman-ag.go"
|
||||
"mincan-vis.go"
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
"tpage-3470.go"
|
||||
"tpage-1275.go"
|
||||
"com-airlock-outer-ag.go"
|
||||
"plat-buried-ag.go"
|
||||
"plat-return-ag.go"
|
||||
"mtn-plat-buried-ag.go"
|
||||
"mtn-plat-return-ag.go"
|
||||
"water-anim-mountain-ag.go"
|
||||
"shard-ag.go"
|
||||
"mtn-shard-ag.go"
|
||||
"mtn-gate-ag.go"
|
||||
"mtn-lens-base-ag.go"
|
||||
"warp-gate-ag.go"
|
||||
"mtn-plat-long-ag.go"
|
||||
"iris-door-ag.go"
|
||||
"mtn-iris-door-ag.go"
|
||||
"mtn-plat-elevator-ag.go"
|
||||
"mtn-plat-shoot-ag.go"
|
||||
"mtn-lens-floor-ag.go"
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
"water-anim-mountain-dark-eco-ag.go"
|
||||
"mtn-aval-rocks-ag.go"
|
||||
"mtn-dice-ag.go"
|
||||
"plat-buried-ag.go"
|
||||
"plat-return-ag.go"
|
||||
"iris-door-ag.go"
|
||||
"mtn-plat-buried-ag.go"
|
||||
"mtn-plat-return-ag.go"
|
||||
"mtn-iris-door-ag.go"
|
||||
"seal-of-mar-ag.go"
|
||||
"mtn-dice-button-ag.go"
|
||||
"mtn-plat-eject-ag.go"
|
||||
"mtn-button-ag.go"
|
||||
"gear-device-gear-ag.go"
|
||||
"mtn-gear-device-gear-ag.go"
|
||||
"mtn-lens-ag.go"
|
||||
"particleman-ag.go"
|
||||
"mtnext-vis.go"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"water-anim-nest-dark-eco-ag.go"
|
||||
"gun-buoy-ag.go"
|
||||
"transport-ag.go"
|
||||
"switch-ag.go"
|
||||
"cas-switch-ag.go"
|
||||
"air-train-ag.go"
|
||||
"piston-ag.go"
|
||||
"nest-vis.go"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"water-anim-nest-dark-eco-ag.go"
|
||||
"gun-buoy-ag.go"
|
||||
"transport-ag.go"
|
||||
"switch-ag.go"
|
||||
"cas-switch-ag.go"
|
||||
"air-train-ag.go"
|
||||
"piston-ag.go"
|
||||
"nestt.go"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"darkjak-highres-ag.go"
|
||||
"oracle-roof-banner-b-ag.go"
|
||||
"oracle-roof-banner-ag.go"
|
||||
"door-ag.go"
|
||||
"oracle-door-ag.go"
|
||||
"oracle-wall-banner-ag.go"
|
||||
"particleman-ag.go"
|
||||
"oracle.go"
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
"sew-multi-blade-ag.go"
|
||||
"fodder-ag.go"
|
||||
"sew-gunturret-ag.go"
|
||||
"mar-statue-ag.go"
|
||||
"sew-mar-statue-ag.go"
|
||||
"sew-twist-blade-ag.go"
|
||||
"sew-tri-blade-ag.go"
|
||||
"sew-single-blade-ag.go"
|
||||
"mine-a-ag.go"
|
||||
"sew-mine-a-ag.go"
|
||||
"sew-valve-ag.go"
|
||||
"mine-b-ag.go"
|
||||
"sew-mine-b-ag.go"
|
||||
"sew-arm-blade-ag.go"
|
||||
"gold-key-ag.go"
|
||||
"light-switch-ag.go"
|
||||
"grill-ag.go"
|
||||
"sew-gold-key-ag.go"
|
||||
"sew-light-switch-ag.go"
|
||||
"sew-grill-ag.go"
|
||||
"sewer-vis.go"
|
||||
))
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
"sew-wall-ag.go"
|
||||
"sew-mar-statue-explode-ag.go"
|
||||
"sew-multi-blade-ag.go"
|
||||
"mar-statue-ag.go"
|
||||
"sew-mar-statue-ag.go"
|
||||
"sew-twist-blade-ag.go"
|
||||
"heart-of-mar-ag.go"
|
||||
"mine-a-ag.go"
|
||||
"mine-b-ag.go"
|
||||
"sew-mine-a-ag.go"
|
||||
"sew-mine-b-ag.go"
|
||||
"sew-arm-blade-ag.go"
|
||||
"light-switch-ag.go"
|
||||
"sew-light-switch-ag.go"
|
||||
"jinx-bomb-ag.go"
|
||||
"grill-ag.go"
|
||||
"sew-grill-ag.go"
|
||||
"particleman-ag.go"
|
||||
"sewesc-vis.go"
|
||||
))
|
||||
|
||||
+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))
|
||||
|
||||
@@ -1089,7 +1089,7 @@
|
||||
(define-extern boolean type) ;; not really... but they use it here as if it was one.
|
||||
(define-extern valid? (function object type symbol symbol object symbol))
|
||||
|
||||
(defun valid? ((arg0 object) (arg1 type) (arg2 symbol) (arg3 symbol) (arg4 object))
|
||||
(defun valid? ((obj object) (expected-type type) (name symbol) (allow-false symbol) (print-dest object))
|
||||
"Check if the given object is valid. This will work for structures, pairs, basics, bintegers, symbols, and types.
|
||||
If you set expected-type to #f, it just checks for a 4-byte aligned address that's in GOAL memory.
|
||||
If you're checking a structure, set expected-type to structure. This requires 16-byte alignment
|
||||
@@ -1103,21 +1103,21 @@
|
||||
Use a name of #f to suppress error prints.
|
||||
"
|
||||
(let ((v1-1
|
||||
(and (>= (the-as uint arg0) (start-of-symbol-table)) (< (the-as uint arg0) END_OF_MEMORY))
|
||||
(and (>= (the-as uint obj) (start-of-symbol-table)) (< (the-as uint obj) END_OF_MEMORY))
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((not arg1)
|
||||
((not expected-type)
|
||||
(cond
|
||||
((logtest? (the-as int arg0) 3)
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object (misaligned)~%" arg0 arg2)
|
||||
((logtest? (the-as int obj) 3)
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object (misaligned)~%" obj name)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((not v1-1)
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object (bad address)~%" arg0 arg2)
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object (bad address)~%" obj name)
|
||||
)
|
||||
#f
|
||||
)
|
||||
@@ -1126,20 +1126,20 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
((and arg3 (not arg0))
|
||||
((and allow-false (not obj))
|
||||
#t
|
||||
)
|
||||
((= arg1 structure)
|
||||
((= expected-type structure)
|
||||
(cond
|
||||
((logtest? (the-as int arg0) 15)
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" arg0 arg2 arg1)
|
||||
((logtest? (the-as int obj) 15)
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((or (not v1-1) (< (the-as uint arg0) (end-of-symbol-table)))
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%" arg0 arg2 arg1)
|
||||
((or (not v1-1) (< (the-as uint obj) (end-of-symbol-table)))
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
@@ -1148,17 +1148,17 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
((= arg1 pair)
|
||||
((= expected-type pair)
|
||||
(cond
|
||||
((not (pair? arg0))
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" arg0 arg2 arg1)
|
||||
((not (pair? obj))
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((not v1-1)
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%" arg0 arg2 arg1)
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
@@ -1167,30 +1167,30 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
((= arg1 binteger)
|
||||
((= expected-type binteger)
|
||||
(cond
|
||||
((zero? (logand (the-as int arg0) 7))
|
||||
((zero? (logand (the-as int obj) 7))
|
||||
#t
|
||||
)
|
||||
(else
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" arg0 arg2 arg1)
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
)
|
||||
)
|
||||
((or (= arg1 symbol) (= arg1 boolean))
|
||||
((or (= expected-type symbol) (= expected-type boolean))
|
||||
(cond
|
||||
((zero? (logand (the-as int arg0) 1))
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" arg0 arg2 arg1)
|
||||
((zero? (logand (the-as int obj) 1))
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((or (not v1-1) (< (the-as int arg0) (start-of-symbol-table))(>= (the-as int arg0) (end-of-symbol-table)))
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%" arg0 arg2 arg1)
|
||||
((or (not v1-1) (< (the-as int obj) (start-of-symbol-table))(>= (the-as int obj) (end-of-symbol-table)))
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
@@ -1199,67 +1199,67 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
((!= (logand (the-as int arg0) 7) 4)
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" arg0 arg2 arg1)
|
||||
((!= (logand (the-as int obj) 7) 4)
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (misaligned)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((not v1-1)
|
||||
(if arg2
|
||||
(format arg4 "ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%" arg0 arg2 arg1)
|
||||
(if name
|
||||
(format print-dest "ERROR: object #x~X ~S is not a valid object of type '~A' (bad address)~%" obj name expected-type)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((and (= arg1 type) (!= (rtype-of arg0) type))
|
||||
(if arg2
|
||||
((and (= expected-type type) (!= (rtype-of obj) type))
|
||||
(if name
|
||||
(format
|
||||
arg4
|
||||
print-dest
|
||||
"ERROR: object #x~X ~S is not a valid object of type '~A' (invalid type #x~X)~%"
|
||||
arg0
|
||||
arg2
|
||||
arg1
|
||||
(rtype-of arg0)
|
||||
obj
|
||||
name
|
||||
expected-type
|
||||
(rtype-of obj)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((and (!= arg1 type) (not (valid? (rtype-of arg0) type #f #t 0)))
|
||||
(if arg2
|
||||
((and (!= expected-type type) (not (valid? (rtype-of obj) type #f #t 0)))
|
||||
(if name
|
||||
(format
|
||||
arg4
|
||||
print-dest
|
||||
"ERROR: object #x~X ~S is not a valid object of type '~A' (invalid type #x~X)~%"
|
||||
arg0
|
||||
arg2
|
||||
arg1
|
||||
(rtype-of arg0)
|
||||
obj
|
||||
name
|
||||
expected-type
|
||||
(rtype-of obj)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((not (type? arg0 arg1))
|
||||
(if arg2
|
||||
((not (type? obj expected-type))
|
||||
(if name
|
||||
(format
|
||||
arg4
|
||||
print-dest
|
||||
"ERROR: object #x~X ~S is not a valid object of type '~A' (is type '~A' instead)~%"
|
||||
arg0
|
||||
arg2
|
||||
arg1
|
||||
(rtype-of arg0)
|
||||
obj
|
||||
name
|
||||
expected-type
|
||||
(rtype-of obj)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
((= arg1 symbol)
|
||||
((= expected-type symbol)
|
||||
(cond
|
||||
((>= (the-as uint arg0) (end-of-symbol-table))
|
||||
(if arg2
|
||||
((>= (the-as uint obj) (end-of-symbol-table))
|
||||
(if name
|
||||
(format
|
||||
arg4
|
||||
print-dest
|
||||
"ERROR: object #x~X ~S is not a valid object of type '~A' (not in symbol table)~%"
|
||||
arg0
|
||||
arg2
|
||||
arg1
|
||||
obj
|
||||
name
|
||||
expected-type
|
||||
)
|
||||
)
|
||||
#f
|
||||
@@ -1269,14 +1269,14 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
((< (the-as uint arg0) (end-of-symbol-table))
|
||||
(if arg2
|
||||
((< (the-as uint obj) (end-of-symbol-table))
|
||||
(if name
|
||||
(format
|
||||
arg4
|
||||
print-dest
|
||||
"ERROR: object #x~X ~S is not a valid object of type '~A' (inside symbol table)~%"
|
||||
arg0
|
||||
arg2
|
||||
arg1
|
||||
obj
|
||||
name
|
||||
expected-type
|
||||
)
|
||||
)
|
||||
#f
|
||||
|
||||
@@ -1421,6 +1421,12 @@
|
||||
(let ((v1-0 (-> obj allies))
|
||||
(gp-0 (-> obj allies length))
|
||||
)
|
||||
(#when PC_PORT
|
||||
;; added. a battle may have enemies from an unloaded level in its ally list (e.g. atoll battle has atollext enemies).
|
||||
(dotimes (i gp-0)
|
||||
(if (not (valid? (-> v1-0 data i entity) entity-actor 'battle-ally-check #f #t))
|
||||
(deactivate self)))
|
||||
)
|
||||
(when (> gp-0 0)
|
||||
(let* ((a1-4 (mod (the-as int (-> self clock integral-frame-counter)) gp-0))
|
||||
(a3-0 (-> v1-0 data a1-4))
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
e
|
||||
)
|
||||
|
||||
;; custom entity functions for pc port
|
||||
(defun-debug entity-inspect-draw ((inspect-info entity-debug-inspect))
|
||||
(defun entity-inspect-draw ((inspect-info entity-debug-inspect))
|
||||
"draw text about an entity on screen"
|
||||
|
||||
(update-pad inspect-info 0)
|
||||
@@ -29,8 +28,7 @@
|
||||
(set! *debug-actor* (the string (and (-> inspect-info show-actor-info) name)))
|
||||
;; draw trans
|
||||
(add-debug-x #t (bucket-id debug-no-zbuf1) (-> e trans) (static-rgba 255 255 0 128))
|
||||
(if (or (not (-> inspect-info show-actor-info)) (!= (-> e type) entity-actor) (and (= (-> e type) entity-actor) (not (-> (the entity-actor e) extra process))))
|
||||
(add-debug-text-3d #t (bucket-id debug-no-zbuf1) name (-> e trans) (font-color red) (new 'static 'vector2h :y 8)))
|
||||
(add-debug-text-3d #t (bucket-id debug-no-zbuf1) name (-> e trans) (font-color red) (new 'static 'vector2h :y 8))
|
||||
|
||||
;; start writing text
|
||||
(let* ((begin-y (- 16 (* (-> inspect-info scroll-y) 16))) (cur-y begin-y) (y-adv 16))
|
||||
@@ -40,7 +38,7 @@
|
||||
(draw-string-xy
|
||||
(string-format "~3L~A~0L ~A~%tags: ~D size: ~D aid: #x~x~%R1/L1 scroll L3 toggle display-actor-info~%--------------------" (-> e type) name (length e) (asize-of e) (-> e aid))
|
||||
debug-buf 352 cur-y (font-color default) (font-flags shadow kerning middle))
|
||||
(+! cur-y (* 10 6))
|
||||
(+! cur-y (* 14 4))
|
||||
(cond
|
||||
((type-type? (-> e type) entity-actor)
|
||||
(let ((actor (the entity-actor e)))
|
||||
@@ -48,7 +46,7 @@
|
||||
(draw-string-xy
|
||||
(string-format "etype: ~A~%vis: ~D task: ~S" (-> actor etype) (-> actor vis-id) (game-task->string (-> actor task)))
|
||||
debug-buf 352 cur-y (font-color default) (font-flags shadow kerning middle))
|
||||
(+! cur-y (* 10 3))
|
||||
(+! cur-y (* 14 2))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -74,7 +72,7 @@
|
||||
)
|
||||
;; some water-height info but with 5 elts
|
||||
((and (= (-> e tag i name) 'water-height) (= (-> e tag i elt-count) 4) (= (-> e tag i elt-type) float))
|
||||
(+! y-adv (* 10 3))
|
||||
(+! y-adv (* 14 3))
|
||||
(format *debug-temp-string* " ~mm ~mm ~mm~%(~S)~%~mm"
|
||||
(-> (the (pointer float) data) 0)
|
||||
(-> (the (pointer float) data) 1)
|
||||
@@ -125,7 +123,8 @@
|
||||
(case (-> e tag i name)
|
||||
;; meters are better here
|
||||
(('spring-height 'vis-dist 'height-info 'distance 'cam-notice-dist 'cam-vert 'cam-horz 'idle-distance
|
||||
'nearest-y-threshold 'center-point 'center-radius 'notice-dist 'trigger-height 'notice-top)
|
||||
'nearest-y-threshold 'center-point 'center-radius 'notice-dist 'trigger-height 'notice-top
|
||||
'elevator-move-rate 'elevator-y-threshold 'elevator-xz-threshold 'height)
|
||||
(format *debug-temp-string* "~mm" (-> (the (pointer float) data) ii))
|
||||
)
|
||||
;; degrees are better for these
|
||||
@@ -137,7 +136,16 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
((int8) (format *debug-temp-string* "~D" (-> (the (pointer int8) data) ii)))
|
||||
((int8)
|
||||
(case (-> e tag i name)
|
||||
(('task-actor)
|
||||
(format *debug-temp-string* "~S" (game-task-actor->string (the-as game-task-actor (-> (the (pointer uint8) data) ii))))
|
||||
)
|
||||
(else
|
||||
(format *debug-temp-string* "~D" (-> (the (pointer int8) data) ii))
|
||||
)
|
||||
)
|
||||
)
|
||||
((int16) (format *debug-temp-string* "~D" (-> (the (pointer int16) data) ii)))
|
||||
((int32)
|
||||
(case (-> e tag i name)
|
||||
@@ -158,6 +166,9 @@
|
||||
(('shadow-mask)
|
||||
(format *debug-temp-string* "#b~b" (-> (the (pointer uint8) data) ii))
|
||||
)
|
||||
(('light-index)
|
||||
(format *debug-temp-string* "~D" (-> (the (pointer uint8) data) ii))
|
||||
)
|
||||
(('task)
|
||||
(format *debug-temp-string* "~S" (game-task->string (the-as game-task (-> (the (pointer uint8) data) ii))))
|
||||
)
|
||||
@@ -183,6 +194,14 @@
|
||||
(format *debug-temp-string* "~%(~S)" (begin (bit-enum->string enemy-option (-> (the (pointer uint32) data) ii) (clear *temp-string*)) *temp-string*))
|
||||
(+! y-adv 14)
|
||||
)
|
||||
(('kill-mask)
|
||||
(format *debug-temp-string* "~%(~S)" (begin (bit-enum->string task-mask (-> (the (pointer uint32) data) ii) (clear *temp-string*)) *temp-string*))
|
||||
(+! y-adv 14)
|
||||
)
|
||||
;; (('elevator-flags)
|
||||
;; (format *debug-temp-string* "~%(~S)" (begin (bit-enum->string elevator-flags (-> (the (pointer uint32) data) ii) (clear *temp-string*)) *temp-string*))
|
||||
;; (+! y-adv 14)
|
||||
;; )
|
||||
(else
|
||||
(format *debug-temp-string* "#x~x" (-> (the (pointer uint32) data) ii))
|
||||
)
|
||||
@@ -235,10 +254,10 @@
|
||||
((actor-group)
|
||||
(let* ((group (-> (the (pointer actor-group) data) ii))
|
||||
(len (-> group length)))
|
||||
(format *debug-temp-string* "~%group ~D:" ii len)
|
||||
(format *debug-temp-string* "~%--- GROUP ~D: ---" ii len)
|
||||
(dotimes (iii len)
|
||||
(format *debug-temp-string* " ~S" (res-lump-struct (entity-by-aid (-> group data iii id)) 'name string))
|
||||
)
|
||||
(format *debug-temp-string* "~% #x~x (~S)" (-> group data iii id) (res-lump-struct (entity-by-aid (-> group data iii id)) 'name string))
|
||||
(+! y-adv 14))
|
||||
)
|
||||
(+! y-adv 14)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user