From f8d448936153f6e8aa9141af0b13cbd5805220f5 Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Tue, 27 Jun 2023 22:02:21 +0100 Subject: [PATCH] fix more orb softlocks (#2767) Fixes orb softlocks during races and other side missions. The side mission tasks will now not count as completed until the precursor orb has been picked up. Races will not let you advance (or even pause the game) until the precursor orb has been picked up. --- .../underground_fighters/shuttle.gc | 1 + goal_src/jak2/engine/ambient/ambient-h.gc | 20 +++++++------- goal_src/jak2/engine/game/task/game-task.gc | 18 ++++++------- .../jak2/levels/city/common/ctywide-tasks.gc | 1 + .../city/side_missions/ctywide-bbush.gc | 8 ++++++ .../jak2/levels/common/races/race-manager.gc | 27 ++++++++++++------- goalc/compiler/Compiler.cpp | 12 +++++++-- 7 files changed, 56 insertions(+), 31 deletions(-) diff --git a/goal_src/jak2/characters/underground_fighters/shuttle.gc b/goal_src/jak2/characters/underground_fighters/shuttle.gc index 6066d81b81..43cff2651a 100644 --- a/goal_src/jak2/characters/underground_fighters/shuttle.gc +++ b/goal_src/jak2/characters/underground_fighters/shuttle.gc @@ -1790,6 +1790,7 @@ ) #f (label cfg-20) + ;; unnecessary - the task manager can take care of this (task-node-close! (game-task-node city-burning-bush-shuttle-1-resolution)) (none) ) diff --git a/goal_src/jak2/engine/ambient/ambient-h.gc b/goal_src/jak2/engine/ambient/ambient-h.gc index 500d0c7827..bdb2a92b18 100644 --- a/goal_src/jak2/engine/ambient/ambient-h.gc +++ b/goal_src/jak2/engine/ambient/ambient-h.gc @@ -1681,7 +1681,7 @@ :flags #xa :speech #xbc :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "ds163" @@ -2513,7 +2513,7 @@ :flags #xa :speech #x14c :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "bb03int" @@ -2537,7 +2537,7 @@ :flags #xa :speech #x14f :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "bb05int" @@ -2561,7 +2561,7 @@ :flags #xa :speech #x152 :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "bb07int" @@ -2585,7 +2585,7 @@ :flags #xa :speech #x155 :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "bb08int" @@ -2609,7 +2609,7 @@ :flags #xa :speech #x158 :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "bb10int" @@ -2657,7 +2657,7 @@ :flags #xa :speech #x15e :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "bb20int" @@ -2681,7 +2681,7 @@ :flags #xa :speech #x161 :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "bb21fail" @@ -2801,7 +2801,7 @@ :flags #xa :speech #x170 :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "cityv153" @@ -3512,7 +3512,7 @@ :flags #xa :speech #x1cd :neg #x1 - :on-close '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) + :on-close #f ;; '(birth-pickup #f skill FACT_SUPER_SKILL_INC flags (suck-in)) ;; patched elsewhere ) (new 'static 'talker-speech-class :name "krew004" diff --git a/goal_src/jak2/engine/game/task/game-task.gc b/goal_src/jak2/engine/game/task/game-task.gc index 5aac3cc653..389dfca154 100644 --- a/goal_src/jak2/engine/game/task/game-task.gc +++ b/goal_src/jak2/engine/game/task/game-task.gc @@ -9917,7 +9917,7 @@ :event-hook #f :final-node (game-task-node city-burning-bush-ring-1-resolution) :index 1 - :on-complete '(talker-spawn "bb01win") + :on-complete '(begin (talker-spawn "bb01win") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '((ctywide 0 lbbush display)) @@ -10287,7 +10287,7 @@ :event-hook #f :final-node (game-task-node city-burning-bush-collection-1-resolution) :index 1 - :on-complete '(talker-spawn "bb19win") + :on-complete '(begin (talker-spawn "bb19win") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '((ctywide 0 lbbush display)) @@ -10363,7 +10363,7 @@ :fail-hook #f :event-hook #f :final-node (game-task-node city-burning-bush-racepoint-1-resolution) - :on-complete '(talker-spawn "bb14win") + :on-complete '(begin (talker-spawn "bb14win") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '() @@ -10437,7 +10437,7 @@ :event-hook #f :final-node (game-task-node city-burning-bush-ring-2-resolution) :index 2 - :on-complete '(talker-spawn "bb02win") + :on-complete '(begin (talker-spawn "bb02win") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '((ctywide 0 lbbush display)) @@ -10664,7 +10664,7 @@ :fail-hook #f :event-hook #f :final-node (game-task-node city-burning-bush-shuttle-1-resolution) - :on-complete '(talker-spawn "bb07win") + :on-complete '(begin (talker-spawn "bb07win") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '((ctywide 0 lshuttle display)) @@ -10959,7 +10959,7 @@ :fail-hook #f :event-hook #f :final-node (game-task-node city-burning-bush-collection-2-resolution) - :on-complete '(talker-spawn "bb20win") + :on-complete '(begin (talker-spawn "bb20win") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '((ctywide 0 lbbush display)) @@ -11180,7 +11180,7 @@ :fail-hook #f :event-hook #f :final-node (game-task-node city-burning-bush-ring-3-resolution) - :on-complete '(talker-spawn "bb03win") + :on-complete '(begin (talker-spawn "bb03win") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '((ctywide 0 lbbush display)) @@ -11326,7 +11326,7 @@ :fail-hook #f :event-hook #f :final-node (game-task-node city-burning-bush-bombbot-1-resolution) - :on-complete '(talker-spawn "bb05win") + :on-complete '(begin (talker-spawn "bb05win") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '((ctywide 0 lbombbot display)) @@ -11622,7 +11622,7 @@ :event-hook #f :final-node (game-task-node city-burning-bush-collection-3-resolution) :index 2 - :on-complete '(talker-spawn "cityv154") + :on-complete '(begin (talker-spawn "cityv154") (apply ,(lambda () (send-event *target* 'get-pickup (pickup-type skill) (-> *FACT-bank* super-skill-inc))))) ;; patched :on-fail #f ) :borrow '((ctywide 0 lbbush display)) diff --git a/goal_src/jak2/levels/city/common/ctywide-tasks.gc b/goal_src/jak2/levels/city/common/ctywide-tasks.gc index 05b41189eb..1a38b992c8 100644 --- a/goal_src/jak2/levels/city/common/ctywide-tasks.gc +++ b/goal_src/jak2/levels/city/common/ctywide-tasks.gc @@ -820,6 +820,7 @@ (while (< (- (current-time) (-> self state-time)) (seconds 2)) (suspend) ) + ;; unnecessary - the task manager can take care of this (close! (-> self node-info) 'event) (none) ) diff --git a/goal_src/jak2/levels/city/side_missions/ctywide-bbush.gc b/goal_src/jak2/levels/city/side_missions/ctywide-bbush.gc index ce2b52a5b5..82d65c2cec 100644 --- a/goal_src/jak2/levels/city/side_missions/ctywide-bbush.gc +++ b/goal_src/jak2/levels/city/side_missions/ctywide-bbush.gc @@ -1519,6 +1519,7 @@ ) ) +;; this is unnecessary. the task manager can close the task. (set-subtask-hook! *game-info* (game-task-node city-burning-bush-ring-1-resolution) @@ -2684,6 +2685,13 @@ This commonly includes things such as: (lambda :behavior task-manager () (set! (-> self state-time) (current-time)) (none)) ) +;; PC PORT NOTE : added complete hook for collection bbush tasks where we wait for the hud to die first +(set-subtask-hook! *game-info* (game-task-node city-burning-bush-collection-1-resolution) + TASK_MANAGER_COMPLETE_HOOK + (lambda :behavior task-manager () + (while (handle->process (-> self hud-counter)) + (suspend)))) + (copy-hooks! (-> *game-info* sub-task-list (game-task-node city-burning-bush-collection-2-resolution)) (-> *game-info* sub-task-list (game-task-node city-burning-bush-collection-1-resolution)) diff --git a/goal_src/jak2/levels/common/races/race-manager.gc b/goal_src/jak2/levels/common/races/race-manager.gc index df533dc5a1..d54c5f9f34 100644 --- a/goal_src/jak2/levels/common/races/race-manager.gc +++ b/goal_src/jak2/levels/common/races/race-manager.gc @@ -1204,16 +1204,23 @@ ) ) (game-info-method-28 *game-info* (the-as game-score s5-0) arg0) - (let ((gp-1 (new 'static 'fact-info))) - (set! (-> gp-1 options) (actor-option)) - (logior! (-> gp-1 options) (actor-option suck-in)) - (birth-pickup-at-point - (camera-pos) - (pickup-type skill) - (* (the float s2-2) (-> *FACT-bank* super-skill-inc)) - #t - *entity-pool* - gp-1 + ;; pc port note : just give the skill directly + (#cond + (PC_PORT + (send-event *target* 'get-pickup (pickup-type skill) (* (the float s2-2) (-> *FACT-bank* super-skill-inc)))) + (#t + (let ((gp-1 (new 'static 'fact-info))) + (set! (-> gp-1 options) (actor-option)) + (logior! (-> gp-1 options) (actor-option suck-in)) + (birth-pickup-at-point + (camera-pos) + (pickup-type skill) + (* (the float s2-2) (-> *FACT-bank* super-skill-inc)) + #t + *entity-pool* + gp-1 + ) + ) ) ) ) diff --git a/goalc/compiler/Compiler.cpp b/goalc/compiler/Compiler.cpp index c7d1b6b4cc..7c500c70be 100644 --- a/goalc/compiler/Compiler.cpp +++ b/goalc/compiler/Compiler.cpp @@ -201,7 +201,11 @@ Val* Compiler::compile_error_guard(const goos::Object& code, Env* env) { } lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Code:\n"); - lg::print("{}\n", pretty_print::to_string(code, 120)); + auto code_str = pretty_print::to_string(code, 120); + if (code_str.size() > 120 * 35) { + code_str = code_str.substr(0, 120 * 35) + "..."; + } + lg::print("{}\n", code_str); if (term) { ce.print_err_stack = false; @@ -224,7 +228,11 @@ Val* Compiler::compile_error_guard(const goos::Object& code, Env* env) { } lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Code:\n"); - lg::print("{}\n", pretty_print::to_string(code, 120)); + auto code_str = pretty_print::to_string(code, 120); + if (code_str.size() > 120 * 35) { + code_str = code_str.substr(0, 120 * 35) + "..."; + } + lg::print("{}\n", code_str); CompilerException ce("Compiler Exception"); if (term) {