Skip to content

New item count - #374

Merged
blkerby merged 12 commits into
blkerby:mainfrom
nn357:new_item_count
Aug 30, 2026
Merged

New item count#374
blkerby merged 12 commits into
blkerby:mainfrom
nn357:new_item_count

Conversation

@nn357

@nn357 nn357 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor
  • Now uses the collected items bitmask
  • Accounts for any bits that may have been set by new_game.asm
  • Tested on multiple types of seeds
  • Removes the need to shadow the collected item bits to $1F5D

nn357 added 8 commits August 26, 2026 05:24
todo: sum the nothings / not placed and write them to rom

should be complete: item count addition on item collection, newgame with starting items increases number, credits displayed as a fraction is not 100 items placed.
otherwise it displays as 0/00 due to nothings being placed everywhere.
fix count for desolate seeds.
@nn357
nn357 marked this pull request as ready for review August 28, 2026 08:48
Comment thread patches/src/item_count.asm Outdated
offsettable:
db $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$10,$11,$12,$13

masktable: ; collected item bits

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Do we actually need this mask table? I would assume the unused bits should just stay cleared?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was mainly just to ensure that any bits marked as unused are never counted rather than assume they are always 0 (even though they should be!)

It also allows them to be repurposed for something else if ever needed but It could be removed yeah.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Taking a closer look, confirmed that vanilla clears the entire 64-byte block during new game, and then in the randomizer we install the full block based on the "initial_item_bits", which we initialize with zeros on the Rust side. So assuming they are clear seems safe. If the unused bits are later used, the expected purpose would be to support items in new locations, in which case including them in the count is the correct behavior. So I would prefer that the mask and offset tables be removed. I would probably sum the count over the full 64-byte block (using the bitcount lookup table it should be plenty fast) but stopping at the end of the vanilla-used range is also ok.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok cool! I removed the offset table / bitmask table.

I stopped at the end of the vanilla range for now. If custom item locations / more than 100 items are added then maybe some rework will be needed to decide on percent or modify the code for xxx / yyy.

Comment thread patches/src/item_count.asm Outdated
db $00, $00, $00, $00, $00, $00, $00, $00

offsettable:
db $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$10,$11,$12,$13

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Likewise, I don't see a reason to use this extra layer of indirection just to skip over 5 bytes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As above, it's not really large and guards against the unused bytes not being 0 / allowing them to be repurposed if ever needed. Simple enough to remove them, I just don't like assuming stuff is / will always be 0...

Comment thread patches/src/escape.asm Outdated
; Include walljump boots and split-speed in item collection count post-credits
org $8BE65B
LDX #$001A
;org $8BE65B

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please delete the no-longer-needed code rather than commenting it out. Very nice to see it going away; I forgot how messy this got with the custom items.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will do. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@blkerby
blkerby merged commit 993a707 into blkerby:main Aug 30, 2026
5 checks passed
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.

2 participants