Field batch 1 readability follow-ups (bridge decision tree, bridge-shaped API, accessor names) #46

Open
opened 2026-11-03 02:56:37 +00:00 by Gatchan · 0 comments
Owner

From the independent readability review of PR #35 (2026-11-03), items left for later (not blocking the merge):

  1. UpdateObjFrame bridge repeats the game's decision tree (core/port/field_bridge.c ~264-290): use a bridge-local path enum + one switch; factor the repeated entry checks (8-bit A with B=0, 16-bit indexes, field pages) into one prv_field_entry_ok(). Watch the bridge:game ratio (#38 should cut it).
  2. Public API shaped by the bridge: field_objects.h exports 8 functions, the game needs 2; field_scroll_speed likewise. Group them under a "helpers also used by the bridge" comment or accept as convention; field_object_walk_step int + out-parameter could be one return value.
  3. Accessor names from the disassembly vocabulary (re/ram_map.toml): field_bg_scroll_carry -> scroll overflow, field_objects_map_ptr -> map cell, scratch accessors (field_obj_frame_facing_base, field_obj_frame_anim_offset, field_scroll_step) get a scratch_ prefix so game code does not use them as state.
From the independent readability review of PR #35 (2026-11-03), items left for later (not blocking the merge): 1. `UpdateObjFrame` bridge repeats the game's decision tree (`core/port/field_bridge.c` ~264-290): use a bridge-local path enum + one `switch`; factor the repeated entry checks (8-bit A with B=0, 16-bit indexes, field pages) into one `prv_field_entry_ok()`. Watch the bridge:game ratio (#38 should cut it). 2. Public API shaped by the bridge: `field_objects.h` exports 8 functions, the game needs 2; `field_scroll_speed` likewise. Group them under a "helpers also used by the bridge" comment or accept as convention; `field_object_walk_step` int + out-parameter could be one return value. 3. Accessor names from the disassembly vocabulary (`re/ram_map.toml`): `field_bg_scroll_carry` -> scroll overflow, `field_objects_map_ptr` -> map cell, scratch accessors (`field_obj_frame_facing_base`, `field_obj_frame_anim_offset`, `field_scroll_step`) get a `scratch_` prefix so game code does not use them as state.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Gatchan/FF6Portage#46
No description provided.