Skip to content

Dedup stages - #31

Merged
dpt merged 3 commits into
developfrom
dedup-stages
Aug 22, 2026
Merged

Dedup stages#31
dpt merged 3 commits into
developfrom
dedup-stages

Conversation

@dpt

@dpt dpt commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Deduplicate shared Chase HQ stage assets to reduce repeated data across the stage implementations.

Enhancements:

  • Consolidate identical stage data and graphics into shared common resources while preserving each stage’s references.

Chores:

  • Add the demo facts reference to the Spectrum build inputs and update the TODO list.

dpt and others added 3 commits August 22, 2026 11:57
123 sprite/mask/descriptor tables were byte-for-byte duplicated across
stage files (the original binary's per-bank layout copied several assets
verbatim). Move each into CommonData.c/h, following the existing
helicopter-sprite precedent, and leave a Conv comment at each deletion
site recording the original address and which stages share the table.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Documents the demo's scope (stage 1 graphics + a loop-only excerpt of
stage 4's map, no retry, no tunnel/fork/ helicopter), its perp name,
and the tight time limit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @dpt, your pull request is larger than the review limit of 150000 diff characters

@sourcery-ai

sourcery-ai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Reviewer's Guide

Deduplicates many byte-identical sprite/bitmap assets and the shared perp description across Chase HQ stages into CommonData, and rewires all stage data to reference the shared definitions, plus minor TODO cleanup and an added docs ref file entry.

File-Level Changes

Change Details Files
Introduce shared bitmap/perp data in CommonData and expose them via the header for reuse across all stages.
  • Add many deduplicated pixel_t bitmap arrays and the perp_description array into CommonData.c, annotated with original addresses and sharing notes.
  • Declare externs for all new shared bitmaps and perp_description in CommonData.h with precise dimensions for each array.
C/libraries/ChaseHQ/Data/CommonData.c
C/libraries/ChaseHQ/Data/CommonData.h
Refactor Stage1 data to use shared graphics data instead of stage-local copies for vehicles, stones, dust, barriers, signposts, and street furniture.
  • Remove numerous static stage1_bitmap_* arrays and associated forward declarations from Stage1Data.c.
  • Update stage1 bitmap_t tables (lambo, truck, car, stones, dust, barriers, turn signs, streetlamptops, telegraphpoletops, tumbleweeds) to reference the shared bitmap_* symbols instead of stage-local arrays.
  • Replace stage1_perp_description with the shared perp_description and add comments noting deduplication origins.
  • Leave only the special stage1_bitmap_turnsign_5s mask as a local bitmap where needed.
C/libraries/ChaseHQ/Data/Stage1Data.c
Refactor Stage2 data to use shared pilot mugshot, common LOD graphics and barrier/dust/tiny bitmap assets from CommonData.
  • Replace stage2_pilot_mugshot with shared pilot_mugshot and point the stage struct at the shared array.
  • Swap stage2_bitmap_E97D/EA2B/EA77, EC17/EC37 and the large F2F0-F4FD/F8A2/F97B-F9E5 bitmap sets to the shared versions from CommonData, removing local static definitions.
  • Alter bitmap tables (stage2_lods_E8FF/E929/E953/F1D8/F264/F673/F958/FA0F) to use the shared bitmap_* arrays while preserving flags, sizes, and indices.
  • Use shared perp_description in the stage2 struct instead of a local copy.
C/libraries/ChaseHQ/Data/Stage2Data.c
Refactor Stage3 data to reuse shared vehicle, stones/dust, barriers, bridge/overhead and telegraph pole top graphics via CommonData.
  • Update Stage3 LOD tables to point at shared car, barrier, stones, dust, bridge (D3AF/D3EF/D44F/D467/D4A7/D507/D52B/D564/D576/D59A/D5D0/D5E0/D5F8/D604/D614/D62C/D630/D636/D63D/D641), tumbleweed, and telegraphpoletop bitmaps.
  • Remove redundant static bitmap_* definitions that are now supplied by CommonData and replace them with comments indicating deduplication (including cross-stage sharing notes).
  • Switch stage3_perp_description to use the shared perp_description.
  • Ensure all bitmap_t entries keep correct width/height/flags and mask pairings when changing underlying data pointers.
C/libraries/ChaseHQ/Data/Stage3Data.c
Refactor Stage4 data to reuse shared perp/mugshot and common sprite/bitmap assets, including barriers, streetlamp tops, LOD vehicles, and turn signs.
  • Use shared perp_description and pilot_mugshot in the stage4 struct.
  • Retarget stage4 LOD tables to shared EC17/EC37, E97D, EA2B, EA77, and F2F0-F4FD/F8A2 plus barrier bitmaps, removing the local definitions and leaving comments indicating deduplication.
  • Wire streetlamp-top and turn-sign LODs to shared bitmap_streetlamptop_* and bitmap_turnsign_* arrays, keeping the special local mask bitmap for stage-specific data where applicable.
C/libraries/ChaseHQ/Data/Stage4Data.c
Refactor Stage5 data to reuse shared lambo/truck/car, bridge/overhead, barriers, telegraph poles, and other common graphics via CommonData.
  • Point Stage5 LOD tables at shared lambo/truck/car bitmaps (bitmap_lambo_, bitmap_truck_, bitmap_C95E/CA12/CA62/CA89/CAA9) and shared LOD helper bitmaps (F2F0-F4FD/F8A2/F97B-F9E5, D3AF-D641, barrier_, etc.).
  • Delete many stage5_bitmap_ static definitions now provided by CommonData and replace them with comments describing which shared asset each original address maps to.
  • Use shared perp_description in the stage5 stage struct and ensure all bitmap_t entries preserve original sizes, flags, and masking relationships.
C/libraries/ChaseHQ/Data/Stage5Data.c
Minor documentation and build integration updates for deduplicated assets and demo facts.
  • Add a new reference file ChaseHQDemoFacts.ref and include it in the REF variable of the Speccy Makefile so it gets built with the other docs.
  • Tidy TODO.md entries: remove obsolete logtime audit entry, reflow the timing calibration bullet to a single line, and add a new bug note about the success tune being cut short.
Speccy/ChaseHQDemoFacts.ref
Speccy/Makefile
C/TODO.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@dpt
dpt merged commit b08cbb6 into develop Aug 22, 2026
10 checks passed
@dpt
dpt deleted the dedup-stages branch August 22, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant