lang migration: rename signed integer types sN -> iN
Mechanical sweep of all .sx sources, plan docs, and tests/expected snapshots for the sx language rename (s8/s16/s32/s64 -> i8/i16/i32/i64). Verified: tools/run_tests.sh 23/23. Note: the ios-sim build has 2 pre-existing 'restart' dot-call errors from the sx opt-in UFCS change (sx a47ea14) — independent of this rename (present pre-sweep); migrated in the follow-up commit.
This commit is contained in:
40
board_fx.sx
40
board_fx.sx
@@ -48,7 +48,7 @@ FX_COMBO_LABEL_GAP :f32: 0.12; // gap (cell units) between the label and +poin
|
||||
// order (red, orange, yellow, green, blue, purple). Saturated a touch past the
|
||||
// pastel — the low channel is trimmed while the dominant/mid channel is lifted —
|
||||
// so every burst pops as a punchier colour without losing luminance.
|
||||
fx_tint :: (i: s64) -> Color {
|
||||
fx_tint :: (i: i64) -> Color {
|
||||
if i == 0 { return Color.{ r = 255, g = 92, b = 62, a = 255 }; }
|
||||
if i == 1 { return Color.{ r = 255, g = 164, b = 44, a = 255 }; }
|
||||
if i == 2 { return Color.{ r = 255, g = 240, b = 72, a = 255 }; }
|
||||
@@ -67,7 +67,7 @@ FX_POPUP_COMBO_HOT :: Color.{ r = 255, g = 248, b = 214, a = 255 }; // hot n
|
||||
// lockstep with the cascade SFX cue. Pure arithmetic, OS-agnostic, and the
|
||||
// equivalence to `cascade_cue_index` is locked headlessly (tests/fx_combo.sx).
|
||||
FX_COMBO_MAX_LEVEL :: 4; // == audio.sx COMBO_CLIPS - 1
|
||||
fx_combo_level :: (depth: s64) -> s64 {
|
||||
fx_combo_level :: (depth: i64) -> i64 {
|
||||
if depth <= 1 { return 0; }
|
||||
if depth >= FX_COMBO_MAX_LEVEL + 1 { return FX_COMBO_MAX_LEVEL; }
|
||||
depth - 1
|
||||
@@ -76,14 +76,14 @@ fx_combo_level :: (depth: s64) -> s64 {
|
||||
// Popup font size for a cascade `depth` rounds deep: a single clear (depth <= 1)
|
||||
// uses the plain size; a combo starts at the base combo size and grows one step
|
||||
// per combo level past the first, clamped at the deepest level.
|
||||
fx_popup_font :: (depth: s64) -> f32 {
|
||||
fx_popup_font :: (depth: i64) -> f32 {
|
||||
if depth <= 1 { return FX_POPUP_FONT; }
|
||||
FX_POPUP_COMBO_FONT + FX_POPUP_COMBO_STEP * cast(f32) (fx_combo_level(depth) - 1)
|
||||
}
|
||||
|
||||
// Popup colour for a cascade `depth` rounds deep: white for a single clear, else
|
||||
// the gold lerped toward a hot near-white as the cascade deepens.
|
||||
fx_popup_color :: (depth: s64) -> Color {
|
||||
fx_popup_color :: (depth: i64) -> Color {
|
||||
if depth <= 1 { return FX_POPUP_COLOR; }
|
||||
t := cast(f32) (fx_combo_level(depth) - 1) / cast(f32) (FX_COMBO_MAX_LEVEL - 1);
|
||||
Color.{
|
||||
@@ -101,7 +101,7 @@ fx_lerp_u8 :: (lo: u8, hi: u8, t: f32) -> u8 {
|
||||
// Upload an RGBA buffer as a texture, returning its handle. Mirrors
|
||||
// board_view.load_texture's upload half but takes an in-memory buffer (the
|
||||
// per-colour tinted particle) instead of a file path.
|
||||
upload_rgba :: (pixels: [*]u8, w: s32, h: s32, gpu: ?GPU) -> u32 {
|
||||
upload_rgba :: (pixels: [*]u8, w: i32, h: i32, gpu: ?GPU) -> u32 {
|
||||
if gpu != null {
|
||||
return xx gpu.create_texture(w, h, .rgba8, xx pixels);
|
||||
}
|
||||
@@ -128,22 +128,22 @@ BoardFxAssets :: struct {
|
||||
}
|
||||
|
||||
load :: (self: *BoardFxAssets, gpu: ?GPU) {
|
||||
w : s32 = 0;
|
||||
h : s32 = 0;
|
||||
ch : s32 = 0;
|
||||
w : i32 = 0;
|
||||
h : i32 = 0;
|
||||
ch : i32 = 0;
|
||||
src : [*]u8 = xx stbi_load("assets/fx/particle.png", @w, @h, @ch, 4);
|
||||
if xx src == 0 {
|
||||
out("WARNING: could not load assets/fx/particle.png\n");
|
||||
self.loaded = false;
|
||||
return;
|
||||
}
|
||||
n := cast(s64) w * cast(s64) h;
|
||||
n := cast(i64) w * cast(i64) h;
|
||||
buf : [*]u8 = xx context.allocator.alloc_bytes(n * 4);
|
||||
// Loop locals are hoisted: a block-scoped local declared inside a body
|
||||
// that runs hundreds of thousands of times grows the stack per iteration
|
||||
// (sx codegen), so the per-pixel tint loop only ASSIGNS pre-declared vars.
|
||||
i : s64 = 0;
|
||||
o : s64 = 0;
|
||||
i : i64 = 0;
|
||||
o : i64 = 0;
|
||||
for 0..GEM_COUNT (t) {
|
||||
col := fx_tint(t);
|
||||
i = 0;
|
||||
@@ -168,7 +168,7 @@ BoardFxAssets :: struct {
|
||||
FxParticle :: struct {
|
||||
col: f32;
|
||||
row: f32;
|
||||
tint: s64;
|
||||
tint: i64;
|
||||
delay: f32;
|
||||
age: f32;
|
||||
life: f32;
|
||||
@@ -184,8 +184,8 @@ FxParticle :: struct {
|
||||
FxPopup :: struct {
|
||||
col: f32;
|
||||
row: f32;
|
||||
points: s64;
|
||||
depth: s64;
|
||||
points: i64;
|
||||
depth: i64;
|
||||
delay: f32;
|
||||
age: f32;
|
||||
life: f32;
|
||||
@@ -237,7 +237,7 @@ BoardFx :: struct {
|
||||
self.particles.append(FxParticle.{
|
||||
col = cast(f32) col + 0.5,
|
||||
row = cast(f32) row + 0.5,
|
||||
tint = cast(s64) g,
|
||||
tint = cast(i64) g,
|
||||
delay = t0 + rdelay,
|
||||
age = 0.0,
|
||||
life = FX_BURST_LIFE,
|
||||
@@ -250,9 +250,9 @@ BoardFx :: struct {
|
||||
|
||||
// One popup for the whole move at the first clear's centroid.
|
||||
rd0 := @mv.rounds.items[0];
|
||||
sc : s64 = 0;
|
||||
sr : s64 = 0;
|
||||
cnt : s64 = 0;
|
||||
sc : i64 = 0;
|
||||
sr : i64 = 0;
|
||||
cnt : i64 = 0;
|
||||
for 0..BOARD_CELLS (idx) {
|
||||
if rd0.matched.cells[idx] {
|
||||
sc += idx % BOARD_COLS;
|
||||
@@ -275,8 +275,8 @@ BoardFx :: struct {
|
||||
// Advance every live FX by `dt` and drop those past their lifetime. Kept
|
||||
// simple: compact each list in place by overwriting dead entries.
|
||||
tick :: (self: *BoardFx, dt: f32) {
|
||||
w : s64 = 0;
|
||||
i : s64 = 0;
|
||||
w : i64 = 0;
|
||||
i : i64 = 0;
|
||||
while i < self.particles.len {
|
||||
p := self.particles.items[i];
|
||||
p.age += dt;
|
||||
|
||||
Reference in New Issue
Block a user