jak1: Adjust sprite positioning or hide them where appropriate when using non-standard aspect ratios (#3596)

This attempts to do a best-effort quick fix for the sprite alignment in
the menus and first person views on higher aspect ratios. This:
- Hides the binocular borders completely when using a non-standard ratio
![Screenshot 2024-07-20
021430](https://github.com/user-attachments/assets/c56d3a6c-13b0-43e1-b99b-83292993728c)
- Hides the borders in jak's first person view when using a non-standard
ratio
![Screenshot 2024-07-20
021310](https://github.com/user-attachments/assets/fefca993-960b-4741-87b7-6d7c17efe89d)
- Uses a combination of manual alignment and approximation to get the
pause menu closer.
![Screenshot 2024-07-20
151725](https://github.com/user-attachments/assets/2c8aa759-b33a-4fbe-abc6-b5861fc33208)
> 32:9 screenshot.

I accomplished the last one by manually aligning all of the core sprites
and text for the most popular aspect ratios. This means that from a
practical standpoint, things should align "perfectly". However, I then
used all of those values to derive a polynomial for each adjustment
based on the aspect ratio. This allows the game to do a half-decent
approximation/interpolation for every aspect ratio in-between the common
ones. It won't be perfect, but it will be better than this:

![image](https://github.com/user-attachments/assets/420b1e38-6f88-436a-8e8c-21df6b49428e)
This commit is contained in:
Tyler Wilding 2024-07-26 23:15:51 -04:00 committed by GitHub
parent a7c9151c6c
commit 92c4390f0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 876 additions and 14 deletions

View File

@ -21102,7 +21102,7 @@
:size-assert #x94
:flag-assert #xf00300094
(:methods
(dumb-15 (_type_) none))
(spawn-particles! (_type_) none))
(:states
hud-normal
hud-coming-in

View File

@ -3,6 +3,10 @@
#include "fmt/core.h"
#include "third-party/imgui/imgui.h"
std::string BucketRenderer::name() const {
return m_name;
}
std::string BucketRenderer::name_and_id() const {
return fmt::format("[{:2d}] {}", (int)m_my_id, m_name);
}

View File

@ -98,6 +98,7 @@ class BucketRenderer {
virtual void render(DmaFollower& dma,
SharedRenderState* render_state,
ScopedProfilerNode& prof) = 0;
std::string name() const;
std::string name_and_id() const;
virtual ~BucketRenderer() = default;
bool& enabled() { return m_enabled; }
@ -158,4 +159,4 @@ class PrintRenderer : public BucketRenderer {
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
bool empty() const override { return true; }
void draw_debug_window() override {}
};
};

View File

@ -28,6 +28,7 @@
#include "game/graphics/pipelines/opengl.h"
#include "third-party/imgui/imgui.h"
#include "third-party/imgui/imgui_stdlib.h"
// for the vif callback
#include "game/kernel/common/kmachine.h"
@ -36,6 +37,7 @@
#ifdef _WIN32
#include <Windows.h>
#endif
#include "common/util/string_util.h"
namespace {
std::string g_current_renderer;
@ -1104,8 +1106,13 @@ void OpenGLRenderer::draw_renderer_selection_window() {
ImGui::TreePop();
}
ImGui::InputText("Renderer Filter", &m_renderer_filter);
for (size_t i = 0; i < m_bucket_renderers.size(); i++) {
auto renderer = m_bucket_renderers[i].get();
if (!m_renderer_filter.empty() && !str_util::contains(renderer->name(), m_renderer_filter)) {
continue;
}
if (renderer && !renderer->empty()) {
ImGui::PushID(i);
if (ImGui::TreeNode(renderer->name_and_id().c_str())) {

View File

@ -123,6 +123,7 @@ class OpenGLRenderer {
float m_last_pmode_alp = 1.;
bool m_enable_fast_blackout_loads = true;
std::string m_renderer_filter = "";
struct FboState {
struct {

View File

@ -1134,6 +1134,10 @@
`(> (fabs (- ,val 0.0))
0.000000000000000001))
(defmacro fequal-epsilon? (a b epsilon)
`(< (fabs (- ,a ,b))
,epsilon))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; user stuf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -109,7 +109,7 @@
(sides-y-scale float)
(x-offset int32))
(:methods
(dumb-15 (_type_) none))
(spawn-particles! (_type_) none))
(:states
hud-coming-in
hud-going-out
@ -172,7 +172,7 @@
(if (nonzero? (-> this particles v1-0 part)) (&+! (-> this particles v1-0 part) arg0))))
(the-as first-person-hud ((method-of-type process relocate) this arg0)))
(defmethod dumb-15 ((this first-person-hud))
(defmethod spawn-particles! ((this first-person-hud))
(dotimes (s5-0 (-> this nb-of-particles))
(set! (-> this particles s5-0 pos x) (+ -256.0 (-> this particles s5-0 init-pos x)))
(set! (-> this particles s5-0 pos y)
@ -185,7 +185,9 @@
(the float (+ (the int (-> this particles s5-0 pos y)) 2048))
(- (-> *math-camera* hvdf-off z) (* 1024.0 (-> this particles s5-0 pos z)))
(-> *math-camera* hvdf-off w)))
(spawn (-> this particles s5-0 part) *null-vector*))
;; og:preserve-this Positioning of first person hud sprites
(when (or (-> *pc-settings* use-vis?) (= s5-0 2))
(spawn (-> this particles s5-0 part) *null-vector*)))
0
(none))
@ -219,7 +221,7 @@
(suspend)))
:post
(behavior ()
(dumb-15 self)))
(spawn-particles! self)))
(defstate hud-normal (first-person-hud)
:event
@ -244,7 +246,7 @@
(suspend)))
:post
(behavior ()
(dumb-15 self)))
(spawn-particles! self)))
(defun part-first-person-hud-left-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((s5-0 (handle->process (-> *target* fp-hud))))

View File

@ -824,9 +824,9 @@
(progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
(progress-new-particle :part 98 :x -320.0 :y 224.0 :z 14.0)
(progress-new-particle :part 99 :x -320.0 :y 224.0 :z 14.0)
(progress-new-particle :part 97 :x -320.0 :y 112.0 :z 4.0)
(progress-new-particle :part 100 :x -320.0 :y 193.0 :z 4.0)
(progress-new-particle :part 101 :x -320.0 :y 40.0 :z 4.0)
(progress-new-particle :part 97 :x -320.0 :y 112.0 :z 4.0) ;; powercell
(progress-new-particle :part 100 :x -320.0 :y 193.0 :z 4.0) ;; scout fly
(progress-new-particle :part 101 :x -320.0 :y 40.0 :z 4.0) ;; orb glow
(progress-new-particle :part 92 :x -320.0 :y 90.0 :z 16.0)
(progress-new-particle :part 93 :x -320.0 :y 172.0 :z 16.0)
(progress-new-particle :part 94 :x -320.0 :y 254.0 :z 16.0)

View File

@ -500,7 +500,9 @@
(defmethod adjust-sprites ((this progress))
(let ((f0-1 (* (1/ METER_LENGTH) (the float (-> this in-out-position)))))
;; right position
(set! (-> this particles 2 init-pos x) (the float (+ (-> this right-x-offset) 409 (the int (* 301.5 f0-1)))))
;; left position
(set! (-> this particles 1 init-pos x) (the float (+ (-> this left-x-offset) 59)))
(set! (-> this left-side-x-scale)
(meters (+ (/ (if (= (-> *pc-settings* aspect-custom-x) 16) 5.0 3.5) (-> this sides-x-scale)) (* 10.0 f0-1))))

View File

@ -722,6 +722,16 @@
(set! (-> *part-id-table* 813 init-specs 11 initial-valuef) (- 32768.0 f0-13))
(set! (-> *part-id-table* 814 init-specs 3 initial-valuef) (- 49152.0 f0-13))
(set! (-> *part-id-table* 814 init-specs 11 initial-valuef) (- 49152.0 f0-13)))
;; og:preserve-this hide the binocular borders on non-standard aspect ratios (set alpha to zero)
(when (not (-> *pc-settings* use-vis?))
(set! (-> *part-id-table* 803 init-specs 9 initial-valuef) 0.0)
(set! (-> *part-id-table* 804 init-specs 9 initial-valuef) 0.0)
(set! (-> *part-id-table* 805 init-specs 10 initial-valuef) 0.0)
(set! (-> *part-id-table* 806 init-specs 10 initial-valuef) 0.0)
(set! (-> *part-id-table* 807 init-specs 10 initial-valuef) 0.0)
(set! (-> *part-id-table* 808 init-specs 10 initial-valuef) 0.0)
(set! (-> *part-id-table* 809 init-specs 10 initial-valuef) 0.0)
(set! (-> *part-id-table* 810 init-specs 10 initial-valuef) 0.0))
(spawn (-> self part) *zero-vector*)
(let ((s4-5 (new 'stack-no-clear 'vector))
(s3-2 (new 'stack-no-clear 'vector))

View File

@ -1396,6 +1396,558 @@
;;---------------------------
;; function overrides
;; NOTE - the following is generated from ./scripts/gsrc/jak1-sprite-adjust.py
;; They are polynomials fit with manually adjusted values for all common aspect ratios
;; so they can make a decent approximation interpolating between
(defun pc-sprite-adjust-left ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 20.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 4.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) -6.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) -10.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) -14.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) -16.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) -25.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) -26.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) -37.0)
(else
(+ 121.37227965381875
(* -145.13874571806738 aspect-ratio)
(* 48.695824268929236 aspect-ratio aspect-ratio)
(* -5.737940185600177 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-right ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) -33.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) -6.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 12.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 18.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 26.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 29.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 45.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 46.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 65.0)
(else
(+ -205.4294994422315
(* 245.07283711809043 aspect-ratio)
(* -81.04347133064093 aspect-ratio aspect-ratio)
(* 9.423126530695802 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-cross-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) -20.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) -5.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 5.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 8.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 15.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 17.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 30.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 30.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 45.0)
(else
(+ -98.75041386103345
(* 104.4004528706783 aspect-ratio)
(* -27.27525895954647 aspect-ratio aspect-ratio)
(* 2.6112419651912617 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-cross-y ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) -20.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 5.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 10.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 10.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 20.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 20.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 25.0)
(else
(+ -92.55990871923132
(* 104.71302956908977 aspect-ratio)
(* -32.46993312399963 aspect-ratio aspect-ratio)
(* 3.4672700107735115 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-square-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) -5.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 5.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 5.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 8.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 8.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 15.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 15.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 17.0)
(else
(+ -22.034620779370684
(* 15.66980500404166 aspect-ratio)
(* 2.6395010789749374 aspect-ratio aspect-ratio)
(* -1.1122480459486384 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-square-y ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) -10.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 10.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 10.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 15.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 15.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 15.0)
(else
(+ -35.887413062108386
(* 28.768844269882614 aspect-ratio)
(* -0.854904339304392 aspect-ratio aspect-ratio)
(* -0.9020647898186882 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-triangle-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 2.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 2.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 3.0)
(else
(+ 9.074933988821043
(* -16.012653345486786 aspect-ratio)
(* 8.413647131791468 aspect-ratio aspect-ratio)
(* -1.2341491172835792 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-triangle-y ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 5.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 5.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 5.0)
(else
(+ 24.319264777517994
(* -43.26989970602368 aspect-ratio)
(* 23.07604741978599 aspect-ratio aspect-ratio)
(* -3.494974989657488 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-circle-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 2.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 2.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 5.0)
(else
(+ 7.769390144448719
(* -13.422040271641388 aspect-ratio)
(* 6.780103459545601 aspect-ratio aspect-ratio)
(* -0.9064673601247457 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-circle-y ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) -7.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) -7.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) -10.0)
(else
(+ -32.088654921966715
(* 56.69193997766507 aspect-ratio)
(* -29.856150879331594 aspect-ratio aspect-ratio)
(* 4.401442349782235 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-percent-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 12.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 12.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 15.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 15.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 18.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 18.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 25.0)
(else
(+ -46.209527361482614
(* 59.19334582683605 aspect-ratio)
(* -17.978708435875035 aspect-ratio aspect-ratio)
(* 1.9546083242648873 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-autosave-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 10.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 10.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 10.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 10.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 15.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 15.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 18.0)
(else
(+ -25.454818080453748
(* 28.58764000115764 aspect-ratio)
(* -5.122397663089315 aspect-ratio aspect-ratio)
(* 0.1450488213340339 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-orb-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 0.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 5.0)
(else
(+ -3.26385961093079
(* 6.476532684613467 aspect-ratio)
(* -4.083859180614655 aspect-ratio aspect-ratio)
(* 0.819204392897082 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-orb-glow-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 0.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 4.0)
(else
(+ -2.6110876887446324
(* 5.181226147690773 aspect-ratio)
(* -3.267087344491723 aspect-ratio aspect-ratio)
(* 0.6553635143176653 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-orb-text-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 0.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 10.0)
(else
(+ -6.52771922186158
(* 12.953065369226934 aspect-ratio)
(* -8.16771836122931 aspect-ratio aspect-ratio)
(* 1.638408785794164 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-cell-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 0.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) -10.0)
(else
(+ 6.52771922186158
(* -12.953065369226934 aspect-ratio)
(* 8.16771836122931 aspect-ratio aspect-ratio)
(* -1.638408785794164 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-cell-text-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 0.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 2.0)
(else
(+ -1.3055438443723162
(* 2.5906130738453865 aspect-ratio)
(* -1.6335436722458616 aspect-ratio aspect-ratio)
(* 0.32768175715883263 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-buzzer-text-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 0.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) -5.0)
(else
(+ 3.26385961093079
(* -6.476532684613467 aspect-ratio)
(* 4.083859180614655 aspect-ratio aspect-ratio)
(* -0.819204392897082 aspect-ratio aspect-ratio aspect-ratio)))))
(defun pc-sprite-adjust-options-text-x ((aspect-ratio float))
(cond
((fequal-epsilon? aspect-ratio 1.0 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.25 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.5 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.6 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.78 0.01) 0.0)
((fequal-epsilon? aspect-ratio 1.85 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.33 0.01) 0.0)
((fequal-epsilon? aspect-ratio 2.35 0.01) 0.0)
((fequal-epsilon? aspect-ratio 3.56 0.01) 3.0)
(else
(+ -1.9583157665584714
(* 3.885919610768078 aspect-ratio)
(* -2.450315508368792 aspect-ratio aspect-ratio)
(* 0.491522635738249 aspect-ratio aspect-ratio aspect-ratio)))))
(define *PC-CROSS-X-ADJUST* 0.0)
(define *PC-CROSS-Y-ADJUST* 0.0)
(define *PC-SQUARE-X-ADJUST* 0.0)
(define *PC-SQUARE-Y-ADJUST* 0.0)
(define *PC-TRIANGLE-X-ADJUST* 0.0)
(define *PC-TRIANGLE-Y-ADJUST* 0.0)
(define *PC-CIRCLE-X-ADJUST* 0.0)
(define *PC-CIRCLE-Y-ADJUST* 0.0)
(define *PC-PERCENT-X-ADJUST* 0.0)
(define *PC-AUTOSAVE-X-ADJUST* 0.0)
(define *PC-ORB-X-ADJUST* 0.0)
(define *PC-ORB-GLOW-X-ADJUST* 0.0)
(define *PC-ORB-TEXT-X-ADJUST* 0.0)
(define *PC-CELL-X-ADJUST* 0.0)
(define *PC-CELL-TEXT-X-ADJUST* 0.0)
(define *PC-BUZZER-TEXT-X-ADJUST* 0.0)
(define *PC-OPTIONS-TEXT-X-ADJUST* 0.0)
(defmethod adjust-ratios ((this progress) (aspect symbol) (video-mode symbol))
(case aspect
(('aspect4x3)
(set! (-> this sides-x-scale) 1.0)
(set! (-> this sides-y-scale) 13.0)
(set! (-> this left-x-offset) 0)
(set! (-> this right-x-offset) 0)
(set! (-> this button-scale) 1.0)
(set! (-> this slot-scale) 8192.0)
(set! (-> this small-orb-y-offset) 58)
(set! (-> this icons 5 scale-x) 0.008)
(set! (-> this icons 5 scale-y) -0.009)
(set! (-> this big-orb-y-offset) 243)
(set! (-> this icons 4 scale-x) 0.013)
(set! (-> this icons 4 scale-y) -0.015))
(('aspect16x9)
(set! (-> this sides-x-scale) 1.2)
(set! (-> this sides-y-scale) 9.8)
(set! (-> this left-x-offset) -10)
(set! (-> this right-x-offset) 17)
(set! (-> this button-scale) 1.05)
(set! (-> this slot-scale) 6144.0)
(set! (-> this small-orb-y-offset) 59)
(set! (-> this icons 5 scale-x) 0.008)
(set! (-> this icons 5 scale-y) -0.0098)
(set! (-> this big-orb-y-offset) 255)
(set! (-> this icons 4 scale-x) 0.017)
(set! (-> this icons 4 scale-y) -0.0205)))
(when (not (-> *pc-settings* use-vis?))
(format 0 "[PC] Adjusting sprite positioning, aspect-ratio: ~f~%" (-> *pc-settings* aspect-ratio))
(set! (-> this left-x-offset) (the int (pc-sprite-adjust-left (-> *pc-settings* aspect-ratio))))
(set! (-> this right-x-offset) (the int (pc-sprite-adjust-right (-> *pc-settings* aspect-ratio))))
(set! *PC-CROSS-X-ADJUST* (pc-sprite-adjust-cross-x (-> *pc-settings* aspect-ratio)))
(set! *PC-CROSS-Y-ADJUST* (pc-sprite-adjust-cross-y (-> *pc-settings* aspect-ratio)))
(set! *PC-SQUARE-X-ADJUST* (pc-sprite-adjust-square-x (-> *pc-settings* aspect-ratio)))
(set! *PC-SQUARE-Y-ADJUST* (pc-sprite-adjust-square-y (-> *pc-settings* aspect-ratio)))
(set! *PC-TRIANGLE-X-ADJUST* (pc-sprite-adjust-triangle-x (-> *pc-settings* aspect-ratio)))
(set! *PC-TRIANGLE-Y-ADJUST* (pc-sprite-adjust-triangle-y (-> *pc-settings* aspect-ratio)))
(set! *PC-CIRCLE-X-ADJUST* (pc-sprite-adjust-circle-x (-> *pc-settings* aspect-ratio)))
(set! *PC-CIRCLE-Y-ADJUST* (pc-sprite-adjust-circle-y (-> *pc-settings* aspect-ratio)))
(set! *PC-PERCENT-X-ADJUST* (pc-sprite-adjust-percent-x (-> *pc-settings* aspect-ratio)))
(set! *PC-AUTOSAVE-X-ADJUST* (pc-sprite-adjust-autosave-x (-> *pc-settings* aspect-ratio)))
(set! *PC-ORB-X-ADJUST* (pc-sprite-adjust-orb-x (-> *pc-settings* aspect-ratio)))
(set! *PC-ORB-GLOW-X-ADJUST* (pc-sprite-adjust-orb-glow-x (-> *pc-settings* aspect-ratio)))
(set! *PC-ORB-TEXT-X-ADJUST* (pc-sprite-adjust-orb-text-x (-> *pc-settings* aspect-ratio)))
(set! *PC-CELL-X-ADJUST* (pc-sprite-adjust-cell-x (-> *pc-settings* aspect-ratio)))
(set! *PC-CELL-TEXT-X-ADJUST* (pc-sprite-adjust-cell-text-x (-> *pc-settings* aspect-ratio)))
(set! *PC-BUZZER-TEXT-X-ADJUST* (pc-sprite-adjust-buzzer-text-x (-> *pc-settings* aspect-ratio)))
(set! *PC-OPTIONS-TEXT-X-ADJUST* (pc-sprite-adjust-options-text-x (-> *pc-settings* aspect-ratio))))
(when (= video-mode 'pal)
(set! (-> this icons 5 scale-y) (* 1.15 (-> this icons 5 scale-y)))
(set! (-> this icons 4 scale-x) (* 1.05 (-> this icons 4 scale-x)))
(set! (-> this icons 4 scale-y) (* (-> this icons 4 scale-y) (the-as float (if (= aspect 'aspect16x9) 1.18 1.15))))
(+! (-> this big-orb-y-offset) (if (= aspect 'aspect16x9) 3 2)))
0
(none))
(defmethod draw-progress ((this progress))
(let ((f30-0 (+ -409.0 (-> this particles 2 init-pos x) (* 0.8 (the float (-> this left-x-offset)))))
(s5-0 (if (or (-> this stat-transition) (nonzero? (-> this level-transition))) 0 (-> this transition-offset))))
(let ((f28-0 (if (or (-> this stat-transition) (nonzero? (-> this level-transition))) 1.0 (-> this transition-percentage-invert))))
(let* ((s3-0 (-> *display* frames (-> *display* on-screen) frame global-buf))
(s4-0 (-> s3-0 base)))
(let ((s2-0 draw-string-xy))
(format (clear *temp-string*) "~D" (the int (+ 0.5 (-> *target* game money))))
(s2-0 *temp-string*
s3-0
(the int (+ *PC-ORB-TEXT-X-ADJUST* 428.0 (the float s5-0) f30-0))
(- 12 (the int (* 0.16666667 f30-0)))
(font-color default)
(font-flags shadow kerning large)))
(let ((s2-1 draw-string-xy))
(format (clear *temp-string*) "~D" (the int (+ 0.5 (-> *target* game fuel))))
(s2-1 *temp-string*
s3-0
(the int (+ *PC-CELL-TEXT-X-ADJUST* 456.0 (the float (adjust-pos s5-0 50)) f30-0))
(- 48 (the int (* 0.125 f30-0)))
(font-color default)
(font-flags shadow kerning large)))
(let ((s2-2 draw-string-xy))
(format (clear *temp-string*) "~D" (the int (+ 0.5 (-> *target* fact buzzer))))
(s2-2 *temp-string*
s3-0
(the int (+ *PC-BUZZER-TEXT-X-ADJUST* 469.0 (the float (adjust-pos s5-0 100)) f30-0))
89
(font-color default)
(font-flags shadow kerning large)))
(let ((a3-4 (-> s3-0 base)))
(let ((v1-20 (the-as object (-> s3-0 base))))
(set! (-> (the-as dma-packet v1-20) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-20) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-20) vif1) (new 'static 'vif-tag))
(set! (-> s3-0 base) (&+ (the-as pointer v1-20) 16)))
(dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug)
s4-0
(the-as (pointer dma-tag) a3-4))))
(let ((s4-2 (new 'stack
'font-context
*font-default-matrix*
(the int (+ *PC-OPTIONS-TEXT-X-ADJUST* (- 423.0 (the float (/ (-> this left-x-offset) 2))) f30-0 (the float (adjust-pos s5-0 150))))
131
0.0
(font-color default)
(font-flags shadow kerning))))
(let ((v1-29 s4-2)) (set! (-> v1-29 width) (the float 100)))
(let ((v1-30 s4-2)) (set! (-> v1-30 height) (the float 15)))
(let ((v1-31 s4-2)) (set! (-> v1-31 scale) 0.5))
(set! (-> s4-2 flags) (font-flags shadow kerning large))
(print-game-text (lookup-text! *common-text* (text-id options) #f) s4-2 #f 128 22)
(let ((v1-34 s4-2)) (set! (-> v1-34 width) (the float 160)))
(let ((v1-35 s4-2)) (set! (-> v1-35 height) (the float 22)))
(let ((v1-36 s4-2)) (set! (-> v1-36 scale) 1.3))
(let ((a0-31 s4-2)) (set! (-> a0-31 color) (font-color progress-percent)))
(set! (-> s4-2 origin x)
(+ *PC-PERCENT-X-ADJUST* (- 435.0 (the float (if (< (-> *progress-process* 0 completion-percentage) 10.0) 93 80))) f30-0))
(set! (-> s4-2 origin y) 180.0)
(set! (-> s4-2 flags) (font-flags shadow kerning middle middle-vert large))
(let ((s3-3 print-game-text))
(format (clear *temp-string*) "~2D%" (the int (-> *progress-process* 0 completion-percentage)))
(s3-3 *temp-string* s4-2 #f (the int (* 128.0 f28-0)) 22))))
0.0
(let ((f28-1 (+ -94.0 (-> this particles 2 init-pos x)))
(s3-4 90)
(s4-3 224)
(s2-5 (/ s5-0 5))
(f26-3 (-> this button-scale)))
;; CROSS
(let ((f24-0 (* 182.04445 (- (/ -36.0 f26-3) (the float s2-5)))))
(set! (-> this particles 27 init-pos x) (+ *PC-CROSS-X-ADJUST* (the float (+ s3-4 (the int (* f28-1 (cos f24-0)))))))
(set! (-> this particles 27 init-pos y) (+ *PC-CROSS-Y-ADJUST* (the float (+ s4-3 (the int (* f28-1 (sin f24-0))))))))
;; SQUARE
(let ((f24-2 (* 182.04445 (- (/ -21.0 f26-3) (the float (adjust-pos s2-5 10))))))
(set! (-> this particles 28 init-pos x) (+ *PC-SQUARE-X-ADJUST* (the float (+ s3-4 (the int (* f28-1 (cos f24-2)))))))
(set! (-> this particles 28 init-pos y) (+ *PC-SQUARE-Y-ADJUST* (the float (+ s4-3 (the int (* f28-1 (sin f24-2))))))))
;; TRIANGLE
(let ((f24-4 (* 182.04445 (- (/ -6.0 f26-3) (the float (adjust-pos s2-5 15))))))
(set! (-> this particles 29 init-pos x) (+ *PC-TRIANGLE-X-ADJUST* (the float (+ s3-4 (the int (* f28-1 (cos f24-4)))))))
(set! (-> this particles 29 init-pos y) (+ *PC-TRIANGLE-Y-ADJUST* (the float (+ s4-3 (the int (* f28-1 (sin f24-4))))))))
;; CIRCLE
(let ((f26-5 (* 182.04445 (- (/ 9.0 f26-3) (the float (adjust-pos s2-5 20))))))
(set! (-> this particles 30 init-pos x) (+ *PC-CIRCLE-X-ADJUST* (the float (+ s3-4 (the int (* f28-1 (cos f26-5)))))))
(set! (-> this particles 30 init-pos y) (+ *PC-CIRCLE-Y-ADJUST* (the float (+ s4-3 (the int (* f28-1 (sin f26-5)))))))))
(when *cheat-mode*
(let ((a0-46 "AUTO SAVE OFF"))
(if (-> *setting-control* current auto-save) (set! a0-46 "AUTO SAVE ON"))
(let* ((s3-5 (-> *display* frames (-> *display* on-screen) frame global-buf))
(s4-4 (-> s3-5 base)))
(draw-string-xy a0-46
s3-5
(the int (+ *PC-AUTOSAVE-X-ADJUST* 430.0 f30-0))
200
(font-color progress-memcard)
(font-flags shadow kerning middle))
(let ((a3-9 (-> s3-5 base)))
(let ((v1-81 (the-as object (-> s3-5 base))))
(set! (-> (the-as dma-packet v1-81) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-81) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-81) vif1) (new 'static 'vif-tag))
(set! (-> s3-5 base) (&+ (the-as pointer v1-81) 16)))
(dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug)
s4-4
(the-as (pointer dma-tag) a3-9))))))
(let ((a0-52 (-> this icons 5 icon 0 root)))
(set-yaw-angle-clear-roll-pitch! a0-52 (- (y-angle a0-52) (* 182.04445 (* 4.0 (-> *display* time-adjust-ratio))))))
(let* ((f28-2 (* 0.00024414062 (the float (-> *progress-process* 0 in-out-position))))
(f30-1 (* 300.0 f28-2)))
(set! (-> this particles 18 init-pos x)
(+ *PC-ORB-GLOW-X-ADJUST* (the float (+ (the int (the float (adjust-pos s5-0 50))) 394 (the int f30-1) (-> this right-x-offset)))))
(set! (-> this particles 18 init-pos y) (the float (- 40 (the int (* 80.0 f28-2)))))
(set! (-> this icons 5 icon-x)
(+ (the int *PC-ORB-X-ADJUST*) (the int (the float (adjust-pos s5-0 50))) 393 (the int f30-1) (-> this right-x-offset)))
(set! (-> this icons 5 icon-y) (- (-> this small-orb-y-offset) (the int (* 80.0 f28-2))))
(set! (-> this particles 16 init-pos x)
(+ *PC-CELL-X-ADJUST* (the float (+ (the int (the float (adjust-pos s5-0 100))) 425 (the int f30-1) (-> this right-x-offset)))))
(set! (-> this particles 16 init-pos y) (the float (- 112 (the int (* 60.0 f28-2)))))
(set! (-> this particles 17 init-pos x)
(the float
(+ (the int (the float (adjust-pos s5-0 150)))
442
(the int f30-1)
(the int (* 0.7 (the float (-> this right-x-offset)))))))))
(set! (-> this particles 17 init-pos y) 193.0)
0
(none))
(defun init-game-options ((obj progress))
"Set the options for all of the menus."
;; start off by making them all invalid

View File

@ -0,0 +1,279 @@
import numpy as np
import matplotlib.pyplot as plt
from numpy.polynomial.polynomial import Polynomial
# 1:1 - 1.00 - 500x500
# 5:4 - 1.25 - 640x512
# 4:3 - 1.33 - 640x480
# 3:2 - 1.50 - 480x320
# 16:10 - 1.60 - 640x400
# 16:9 - 1.78 - 640x360
# 1.85:1 - 1.85 - 640x346
# 21:9 - 2.33 - 640x274
# 2.35:1 - 2.35 - 640x272
# 2.39:1 - 2.39 - 640x267
# 32:9 - 3.56 - 1280x360
# (ml "progress-pc")
# (pc-set-window-size 500 500)
# (set! (-> *progress-process* 0 left-x-offset) 20)
# (set! (-> *progress-process* 0 right-x-offset) 20)
# (set! *PC-CROSS-X-ADJUST* -20.0)
# (set! *PC-CROSS-Y-ADJUST* -20.0)
# (set! *PC-SQUARE-X-ADJUST* -20.0)
# (set! *PC-SQUARE-Y-ADJUST* -20.0)
values = [
{
'aspect': 1.00,
'left': 20,
'right': -33,
'cross-x': -20.0,
'cross-y': -20.0,
'square-x': -5.0,
'square-y': -10.0,
'triangle-x': 0.0,
'triangle-y': 0.0,
'circle-x': 0.0,
'circle-y': 0.0,
'percent-x': 0.0,
'autosave-x': 0.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 1.25,
'left': 4,
'right': -6,
'cross-x': -5.0,
'cross-y': 0.0,
'square-x': 0.0,
'square-y': 0.0,
'triangle-x': 0.0,
'triangle-y': 0.0,
'circle-x': 0.0,
'circle-y': 0.0,
'percent-x': 0.0,
'autosave-x': 0.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 1.33,
'left': 0,
'right': 0,
'cross-x': 0.0,
'cross-y': 0.0,
'square-x': 0.0,
'square-y': 0.0,
'triangle-x': 0.0,
'triangle-y': 0.0,
'circle-x': 0.0,
'circle-y': 0.0,
'percent-x': 0.0,
'autosave-x': 0.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 1.5,
'left': -6,
'right': 12,
'cross-x': 5.0,
'cross-y': 0.0,
'square-x': 5.0,
'square-y': 0.0,
'triangle-x': 0.0,
'triangle-y': 0.0,
'circle-x': 0.0,
'circle-y': 0.0,
'percent-x': 12.0,
'autosave-x': 10.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 1.60,
'left': -10,
'right': 18,
'cross-x': 8.0,
'cross-y': 5.0,
'square-x': 5.0,
'square-y': 0.0,
'triangle-x': 0.0,
'triangle-y': 0.0,
'circle-x': 0.0,
'circle-y': 0.0,
'percent-x': 12.0,
'autosave-x': 10.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 1.78,
'left': -14,
'right': 26,
'cross-x': 15.0,
'cross-y': 10.0,
'square-x': 8.0,
'square-y': 10.0,
'triangle-x': 0.0,
'triangle-y': 0.0,
'circle-x': 0.0,
'circle-y': 0.0,
'percent-x': 15.0,
'autosave-x': 10.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 1.85,
'left': -16,
'right': 29,
'cross-x': 17.0,
'cross-y': 10.0,
'square-x': 8.0,
'square-y': 10.0,
'triangle-x': 0.0,
'triangle-y': 0.0,
'circle-x': 0.0,
'circle-y': 0.0,
'percent-x': 15.0,
'autosave-x': 10.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 2.33,
'left': -25,
'right': 45,
'cross-x': 30.0,
'cross-y': 20.0,
'square-x': 15.0,
'square-y': 15.0,
'triangle-x': 2.0,
'triangle-y': 5.0,
'circle-x': 2.0,
'circle-y': -7.0,
'percent-x': 18.0,
'autosave-x': 15.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 2.35,
'left': -26,
'right': 46,
'cross-x': 30.0,
'cross-y': 20.0,
'square-x': 15.0,
'square-y': 15.0,
'triangle-x': 2.0,
'triangle-y': 5.0,
'circle-x': 2.0,
'circle-y': -7.0,
'percent-x': 18.0,
'autosave-x': 15.0,
'orb-x': 0.0,
'orb-glow-x': 0.0,
'orb-text-x': 0.0,
'cell-x': 0.0,
'cell-text-x': 0.0,
'buzzer-text-x': 0.0,
'options-text-x': 0.0
},
{
'aspect': 3.56,
'left': -37,
'right': 65,
'cross-x': 45.0,
'cross-y': 25.0,
'square-x': 17.0,
'square-y': 15.0,
'triangle-x': 3.0,
'triangle-y': 5.0,
'circle-x': 5.0,
'circle-y': -10.0,
'percent-x': 25.0,
'autosave-x': 18.0,
'orb-x': 5.0,
'orb-glow-x': 4.0,
'orb-text-x': 10.0,
'cell-x': -10.0,
'cell-text-x': 2.0,
'buzzer-text-x': -5.0,
'options-text-x': 3.0
},
]
adjustments = [
'left', 'right', 'cross-x', 'cross-y', 'square-x', 'square-y', 'triangle-x', 'triangle-y', 'circle-x', 'circle-y', 'percent-x', 'autosave-x', 'orb-x', 'orb-glow-x', 'orb-text-x', 'cell-x', 'cell-text-x', 'buzzer-text-x', 'options-text-x'
]
aspect_ratio_values = []
for dataset in values:
aspect_ratio_values.append(dataset['aspect'])
aspect_ratios = np.array(aspect_ratio_values)
def check_return_value(aspect_ratio, coefs):
return coefs[0] + coefs[1] * aspect_ratio + coefs[2] * aspect_ratio**2
for adjust in adjustments:
# collect the values
data_values = []
for dataset in values:
data_values.append(dataset[adjust])
np_values = np.array(data_values)
# polynomial regression to interpolate between values
poly = Polynomial.fit(aspect_ratios, np_values, 3)
coefficients = poly.convert().coef
# produce a goal function to represent this polynomial
# if the aspect-ratio is close within a threshold we use that
function_string = ""
function_string += f"(defun pc-sprite-adjust-{adjust} ((aspect-ratio float))\n"
function_string += f" (cond\n"
for aspect_ratio, value in zip(aspect_ratios, data_values):
function_string += f" ((fequal-epsilon? aspect-ratio {aspect_ratio} 0.01) {value:.1f})\n"
function_string += f" (else\n (+ {coefficients[0]}\n (* {coefficients[1]} aspect-ratio)\n (* {coefficients[2]} aspect-ratio aspect-ratio)\n (* {coefficients[3]} aspect-ratio aspect-ratio aspect-ratio)))))\n"
print(function_string)

View File

@ -144,7 +144,7 @@
(x-offset int32)
)
(:methods
(dumb-15 (_type_) none)
(spawn-particles! (_type_) none)
)
(:states
hud-coming-in
@ -257,7 +257,7 @@
;; definition for method 14 of type first-person-hud
;; INFO: Return type mismatch int vs none.
(defmethod dumb-15 ((this first-person-hud))
(defmethod spawn-particles! ((this first-person-hud))
(dotimes (s5-0 (-> this nb-of-particles))
(set! (-> this particles s5-0 pos x) (+ -256.0 (-> this particles s5-0 init-pos x)))
(set! (-> this particles s5-0 pos y)
@ -322,7 +322,7 @@
)
)
:post (behavior ()
(dumb-15 self)
(spawn-particles! self)
)
)
@ -355,7 +355,7 @@
)
)
:post (behavior ()
(dumb-15 self)
(spawn-particles! self)
)
)