Repository navigation
110 worked example the last leftover sprite tables
Question (the user, 2026-09-28, confirming the engine/authenticity split still holds): checking whether game/*.gd has any code left that only makes sense for Return Fire specifically, rather than reading everything from pack data, turned up three genuine leftovers from PORTING_PLAN.md 2.7.5's list (issue #55) and one from the HUD panel (issue #58). None of them needed new tracing -- the sprite ids involved were already correct, just living in the wrong place.
String-built ids (game/death_skull_view.gd):
var s := mc.pack.get_sprite(mc.pack.team_variant(["ui.death_skull.tan.f%d" % f, "ui.death_skull.green.f%d" % f], colour))A hardcoded const array (game/mine_view_3d.gd):
const CELS := ["effect.ember_small.01", "effect.ember_small.02", "effect.ember_small.03"]String-built ids again (game/projectile_billboard_3d.gd):
var sid := _pack.team_variant(["projectile.jeep_missile.tan.%02d" % (f + 1), "projectile.jeep_missile.green.%02d" % (f + 1)], projectile.art_colour())All three work correctly today -- the ids are right, traced back in documents 88, 60 and 61 respectively. The
problem is narrower than "wrong": a mod can replace a sprite id (sprites.json's per-id overlay already handles
that), but it can't replace which ids exist for which frame, because that mapping is baked into the .gd file
itself, not data a pack ships.
Document 104 moved the equivalent problem
for vehicle parts (the Jeep's wheel frames, the MSV's canisters, the Heli's rotor) into each vehicle's render
block, read by game/vehicle_render_3d.gd's generic binding vocabulary. None of these three are vehicle parts,
though -- a death animation overlay, a standalone mine object, a lobbed projectile -- so there's no vehicle
definition for them to live in. They needed their own small tables instead.
tools/build_pack.py already has exactly this shape of code for the capture flag (document 65):
part["sprite_ids"] = [registry[str(part["cel"] + i)]["id"] for i in range(n)]
...
with open(os.path.join(args.out_dir, "markers", "flag.json"), "w") as f:
json.dump(fl, f)Look up each frame's cel number in the registry (already known -- these ids exist and are correct, this is not new
tracing), build a small JSON table, write it under the pack. Three new tables, one line of Pack plumbing each
(the same per-top-level-key overlay every small pack table already uses):
# The death sequence's laughing skull (document 88): cel 2125 + frame, tan; +7 more for green.
DEATH_SKULL_BASE = 2125
skull_frames = []
for f in range(1, 8):
tan_cel, green_cel = DEATH_SKULL_BASE + f, DEATH_SKULL_BASE + f + 7
skull_frames.append([registry[str(tan_cel)]["id"], registry[str(green_cel)]["id"]])
team_pairs.add((tan_cel, green_cel))
with open(os.path.join(args.out_dir, "ui", "death_skull.json"), "w") as f:
json.dump({"frames": skull_frames}, f)(The mine's ember and the Jeep missile's spin frames follow the identical shape -- effects/mine.json's sprites
list, not team-coloured; projectiles/jeep_missile.json's frames list, 12 pairs, the same as the skull's 7.)
# game/pack.gd
var death_skull_data: Dictionary = {}
...
_overlay(death_skull_data, _layer_doc(dir, "ui/death_skull.json"))And the three consuming files shrink to an index lookup:
# game/death_skull_view.gd
var frames: Array = mc.pack.death_skull_data.get("frames", [])
if f > frames.size():
return
var s := mc.pack.get_sprite(mc.pack.team_variant(frames[f - 1], colour))One thing worth doing at the same time, since the code was already there: the death skull and Jeep missile pairs
were never registered in team_pairs, which is what makes a mod's own extra team colours (2.7.7) generate a
matching variant automatically. They are now (team_pairs.add((tan_cel, green_cel))), so a mod colour applies to
these the same way it already applies to every vehicle part.
Found the same class of problem one level up while checking: game/hud_panel.gd's uses_ammo_colours() still read
static func uses_ammo_colours(vehicle_type: int, slot: int, selected_slot: int) -> bool:
return vehicle_type == 3 and slot != selected_slot-- a bare vehicle_type == 3 left over from before the step 3-5 data-driving, never revisited because the HUD
panel work happened in parallel with it. The rule is really about having a two-weapon-select module
(heli_guns), not about being vehicle type 3 specifically, so it uses the same capability query the rest of
vehicle.gd already established for exactly this purpose:
static func uses_ammo_colours(v: Vehicle, slot: int, selected_slot: int) -> bool:
return v.has_module("heli_guns") and slot != selected_slotA mod's own vehicle with a heli_guns-style two-weapon select now gets the same panel rule automatically, whatever
its vehicle_type index happens to be.
tools/tests/leftover_sprite_tables_check.gd: each table has the right shape and resolves to real sprites, and a
mod replacing effects/mine.json wholesale (per the usual per-top-level-key overlay) changes the running pack's
table without touching the original's. The laughing skull's own on-screen rendering was checked directly with
RF_DEBUG_KILL (kills the player, then waits for the loss sequence's phase 2 via RF_DEBUG_SCREENSHOT_WAIT_DEATH)
-- it draws exactly as before, now sourced from ui/death_skull.json instead of a format string. The existing
suite (hud_bar_colour_check.gd, already covering uses_ammo_colours()) needed only its call sites updated to pass
a real Vehicle instead of a bare type number.
One item from the same pass is tracked separately, not fixed here: the vehicle-select hangar screen is still a fixed four-bay layout regardless of a map's actual roster size (issue #15).
Return Fire, rebuilt
Elsewhere