mirror of
https://github.com/open-goal/jak-project
synced 2026-08-17 13:40:39 -04:00
[jak2] simplify fps disclaimer (#3108)
This commit is contained in:
@@ -451,6 +451,25 @@ Type* TypeSystem::lookup_type(const TypeSpec& ts) const {
|
||||
return lookup_type(ts.base_type());
|
||||
}
|
||||
|
||||
/*!
|
||||
* Same as lookup_type, but returns null instead of throwing.
|
||||
*/
|
||||
Type* TypeSystem::lookup_type_no_throw(const std::string& name) const {
|
||||
auto kv = m_types.find(name);
|
||||
if (kv != m_types.end()) {
|
||||
return kv->second.get();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Same as lookup_type, but returns null instead of throwing.
|
||||
*/
|
||||
Type* TypeSystem::lookup_type_no_throw(const TypeSpec& ts) const {
|
||||
return lookup_type_no_throw(ts.base_type());
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get type info. If the type is not fully defined (ie, we are parsing its deftype now) and its
|
||||
* forward defined as a basic or structure, just get basic/structure.
|
||||
|
||||
@@ -155,6 +155,9 @@ class TypeSystem {
|
||||
Type* lookup_type(const TypeSpec& ts) const;
|
||||
Type* lookup_type(const std::string& name) const;
|
||||
|
||||
Type* lookup_type_no_throw(const TypeSpec& ts) const;
|
||||
Type* lookup_type_no_throw(const std::string& name) const;
|
||||
|
||||
Type* lookup_type_allow_partial_def(const TypeSpec& ts) const;
|
||||
Type* lookup_type_allow_partial_def(const std::string& name) const;
|
||||
|
||||
|
||||
@@ -187,7 +187,8 @@ void add_field(
|
||||
throw std::runtime_error(
|
||||
fmt::format("Field {} not found to overlay for {}", field_name, name));
|
||||
}
|
||||
type_to_use = dynamic_cast<StructureType*>(ts->lookup_type(overlay_field.type()));
|
||||
type_to_use =
|
||||
dynamic_cast<StructureType*>(ts->lookup_type_no_throw(overlay_field.type()));
|
||||
offset_override += overlay_field.offset();
|
||||
}
|
||||
name_it = cdr(name_it);
|
||||
|
||||
@@ -7426,8 +7426,6 @@
|
||||
(progress-highscores-local-time #x1313)
|
||||
(progress-fps-disclaimer-warning #x1314)
|
||||
(progress-fps-disclaimer #x1315)
|
||||
(progress-fps-disclaimer-1 #x1316)
|
||||
(progress-fps-disclaimer-confirm #x1317)
|
||||
)
|
||||
;; ---text-id-h:text-id
|
||||
|
||||
|
||||
@@ -160,7 +160,5 @@
|
||||
"1312": "Any% - Hero Mode",
|
||||
"1313": "Local Time",
|
||||
"1314": "Warning!",
|
||||
"1315": "This setting is highly experimental. While the game can be completed with it, going past 60 FPS is known to cause (mostly minor) issues that may impact your experience.",
|
||||
"1316": "The game may also start to lag and slow down as a result if you can't keep the selected frame rate up, so ensure your PC can handle it.",
|
||||
"1317": "Confirm"
|
||||
"1315": "This setting is highly experimental. When not played at 60 frames per second, visual and gameplay issues may arise as a result."
|
||||
}
|
||||
|
||||
@@ -749,8 +749,6 @@
|
||||
(progress-highscores-local-time #x1313)
|
||||
(progress-fps-disclaimer-warning #x1314)
|
||||
(progress-fps-disclaimer #x1315)
|
||||
(progress-fps-disclaimer-1 #x1316)
|
||||
(progress-fps-disclaimer-confirm #x1317)
|
||||
)
|
||||
;; ---text-id
|
||||
|
||||
|
||||
@@ -2411,10 +2411,11 @@
|
||||
(defmethod draw-option menu-frame-rate-disclaimer-option ((obj menu-frame-rate-disclaimer-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol))
|
||||
(set! (-> arg1 alpha) (- 1.0 (-> arg0 menu-transition)))
|
||||
(set-color! arg1 (font-color red))
|
||||
(set-scale! arg1 0.4)
|
||||
(set-scale! arg1 0.8)
|
||||
(set-flags! arg1 (font-flags kerning middle middle-vert large))
|
||||
|
||||
(set! (-> arg1 origin x) 90.0)
|
||||
(set! (-> arg1 origin y) 55.0)
|
||||
(set! (-> arg1 origin y) 72.0)
|
||||
(set-width! arg1 330)
|
||||
(set-height! arg1 85)
|
||||
(when (not (-> *pc-settings* use-vis?))
|
||||
@@ -2422,40 +2423,25 @@
|
||||
(*! (-> arg1 width) (-> *pc-settings* aspect-ratio-reciprocal))
|
||||
)
|
||||
(when (< (mod (-> *display* real-clock frame-counter) (seconds 1.2)) (seconds 1.0))
|
||||
(print-game-text (lookup-text! *common-text* (text-id progress-fps-disclaimer-warning) #f) arg1 #f 44 (bucket-id progress))
|
||||
)
|
||||
(+! (-> arg1 origin y) 60.0)
|
||||
(set-color! arg1 (font-color progress))
|
||||
(print-game-text
|
||||
(lookup-text! *common-text* (text-id progress-fps-disclaimer) #f)
|
||||
arg1
|
||||
#f
|
||||
44
|
||||
(bucket-id progress)
|
||||
)
|
||||
(print-game-text (lookup-text! *common-text* (text-id progress-fps-disclaimer-warning) #f) arg1 #f 44 (bucket-id progress)))
|
||||
|
||||
(+! (-> arg1 origin y) 80.0)
|
||||
(set-scale! arg1 0.45)
|
||||
(set-color! arg1 (font-color progress))
|
||||
(print-game-text (lookup-text! *common-text* (text-id progress-fps-disclaimer) #f) arg1 #f 44 (bucket-id progress))
|
||||
|
||||
(+! (-> arg1 origin y) 65.0)
|
||||
(set-scale! arg1 0.55)
|
||||
(set-height! arg1 95)
|
||||
(print-game-text
|
||||
(lookup-text! *common-text* (text-id progress-fps-disclaimer-1) #f)
|
||||
arg1
|
||||
#f
|
||||
44
|
||||
(bucket-id progress)
|
||||
)
|
||||
(+! (-> arg1 origin y) 95.0)
|
||||
(print-game-text (lookup-text! *common-text* (text-id progress-memcard-continue?) #f) arg1 #f 44 (bucket-id progress))
|
||||
|
||||
(+! (-> arg1 origin y) 58.0)
|
||||
(set-scale! arg1 0.5)
|
||||
(set-height! arg1 50)
|
||||
(set-color! arg1 (progress-selected 0))
|
||||
(draw-highlight (the int (+ 13.0 (-> arg1 origin y))) 18 (-> arg1 alpha))
|
||||
(print-game-text
|
||||
(if (time-elapsed? (-> *progress-state-pc* frame-rate-disclaimer-time) (seconds 5))
|
||||
(lookup-text! *common-text* (text-id progress-fps-disclaimer-confirm) #f)
|
||||
(string-format "~Ds" (inc (/ (- (seconds 5) (- (current-time) (-> *progress-state-pc* frame-rate-disclaimer-time))) TICKS_PER_SECOND)))
|
||||
)
|
||||
arg1
|
||||
#f
|
||||
44
|
||||
(bucket-id progress)
|
||||
)
|
||||
(when (time-elapsed? (-> *progress-state-pc* frame-rate-disclaimer-time) (seconds 3))
|
||||
(draw-highlight (the int (+ 13.0 (-> arg1 origin y))) 18 (-> arg1 alpha))
|
||||
(draw-yes-no arg0 arg1))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
@@ -566,12 +566,15 @@
|
||||
(set-progress-frame-rate-index))
|
||||
((cpad-pressed? 0 confirm)
|
||||
(sound-play "generic-beep")
|
||||
(set-frame-rate! *pc-settings* (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index)) #t)
|
||||
(commit-to-file *pc-settings*)
|
||||
(when (and (not (-> *progress-state-pc* frame-rate-disclaimer-seen?)) (> (-> *pc-settings* target-fps) 60))
|
||||
(set-time! (-> *progress-state-pc* frame-rate-disclaimer-time))
|
||||
(push-and-set-state arg0 'fps-disclaimer)
|
||||
)
|
||||
(cond
|
||||
((not (-> *progress-state-pc* frame-rate-disclaimer-seen?))
|
||||
(set-time! (-> *progress-state-pc* frame-rate-disclaimer-time))
|
||||
(push-and-set-state arg0 'fps-disclaimer)
|
||||
)
|
||||
(else
|
||||
(set-frame-rate! *pc-settings* (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index)) #t)
|
||||
(commit-to-file *pc-settings*)
|
||||
))
|
||||
)
|
||||
(else
|
||||
(let ((sound-beep? #f))
|
||||
@@ -595,11 +598,40 @@
|
||||
|
||||
(defmethod respond-progress menu-frame-rate-disclaimer-option ((this menu-frame-rate-disclaimer-option) (arg0 progress) (arg1 symbol))
|
||||
"Handle progress menu navigation logic."
|
||||
(when (and (time-elapsed? (-> *progress-state-pc* frame-rate-disclaimer-time) (seconds 5)) (cpad-pressed? 0 confirm))
|
||||
(cpad-clear! 0 confirm)
|
||||
(sound-play "generic-beep")
|
||||
(true! (-> *progress-state-pc* frame-rate-disclaimer-seen?))
|
||||
(pop-state arg0)
|
||||
(when (time-elapsed? (-> *progress-state-pc* frame-rate-disclaimer-time) (seconds 3))
|
||||
(let ((choice (&-> *progress-state* yes-no-choice))
|
||||
(sound? #f)
|
||||
)
|
||||
(cond
|
||||
((cpad-pressed? 0 left l-analog-left)
|
||||
(set! sound? (not (-> choice 0)))
|
||||
(set! (-> choice 0) #t)
|
||||
)
|
||||
((cpad-pressed? 0 right l-analog-right)
|
||||
(set! sound? (-> choice 0))
|
||||
(set! (-> choice 0) #f)
|
||||
)
|
||||
((cpad-pressed? 0 confirm)
|
||||
(cpad-clear! 0 confirm)
|
||||
(cond
|
||||
((-> *progress-state* yes-no-choice)
|
||||
(true! (-> *progress-state-pc* frame-rate-disclaimer-seen?))
|
||||
(sound-play "generic-beep")
|
||||
(set-frame-rate! *pc-settings* (-> *frame-rate-options* (-> *progress-state-pc* frame-rate-choice-index)) #t)
|
||||
(commit-to-file *pc-settings*)
|
||||
(pop-state arg0)
|
||||
)
|
||||
(else
|
||||
(sound-play "generic-beep")
|
||||
(pop-state arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if sound?
|
||||
(sound-play "generic-beep")
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
@@ -342,7 +342,7 @@ This gives us more freedom to write code how we want.
|
||||
)
|
||||
)
|
||||
|
||||
(define *frame-rate-options* (new 'static 'boxed-array :type int16 30 50 60 75 120 144 165 240))
|
||||
(define *frame-rate-options* (new 'static 'boxed-array :type int16 60 75 120 144 165 240))
|
||||
|
||||
(define *frame-rate-disclaimer-options*
|
||||
(new 'static 'menu-option-list
|
||||
|
||||
Reference in New Issue
Block a user