Language…
5 users online: airythefemboylover, Amomario123w, KaizoSirius, RevaDurchi, Ultramegagigantor - Guests: 217 - Bots: 62
Users: 70,569 (2,468 active)
Latest user: aidennnnnfox

SMB3 P-Meter

UberASM Repository → SMB3 P-Meter

Submission Details

Name: SMB3 P-Meter
Authors: AmperSam, Ersanio
Added:
Type: Level, Game Mode
Includes GFX: Yes
Includes Hijack: Yes
Featured: No
Description: This is an UberASM conversion and enhancement of Ersanio's "SMB3 P-Meter" patch to display the p-meter in the status bar.

This resource applies a small hijack which you need to be wary of when removing. Instructions to remove the hijack included.
Tags: lorom p-meter sa-1 status bar
Comments: 4 (jump to comments)
Rating:
0.0 (0 ratings)
No rating
Download 3.38 KiB | 69 downloads

Screenshots

Comments (4)

HammerBrother Link
I checked the code of the P-meter and:
Code
main:
    LDY #$00			;>Y is the total number of tiles to write, also as an index on where to write.
    LDA $13E4|!addr		;>Mario's P-meter/dash timer.
    LSR #4			;>Divide P-meter value by 16 (rounded down to integer)
    TAX				;>X is the number of full triangles to write
    BEQ .NoFullLoop		;>If none left to write, break (don't draw a full arrow)
    LDA #!TriangleFull
.FullLoop
    STA !Position,y		;>Write full triangle
    INY				;>Increment to next tile
    DEX				;>Decrement number of full triangles
    BNE .FullLoop		;>If there are at least 1 full triangle to write, continue, otherwise break (checks the X, not Y because X is what last sets zero flag in the process register)
.NoFullLoop
    LDA #!TriangleEmpty
    BRA .TestEmptyLoop		;>First check if we reached the last tile
.EmptyLoop
    STA !Position,y		;>Write empty triangle
    INY				;>Increment to next tile
.TestEmptyLoop
    CPY #!Length		;\If Y (total triangles) have reached its maximum, stop drawing any more tiles
    BCC .EmptyLoop		;/


The code for drawing empty triangles does check if it wrote the last tile before terminating, but not the full triangles loop and the meter here have, by default, 6 units to fill up (there are 5 triangles (each spanning 1 tile) and 1 rectangular "P" (spanning 2 tiles), totaling 6 units to fill up, unlike the original SMB3 which is 6 arrows + 1 "P" ).

The maximum P-meter value is #$70, which after dividing by 16, is 7. This means that a full P-meter results in drawing 7 out of the 5 triangles filled, an excess of 2 full triangles. These excess tiles, however are both overwritten by the rectangular "P". Care must be taken that if you set the P-meter to have 4 arrows of !Length or less, you end up drawing full arrows beyond the rectangular "P" when maxing out.

The same thing can theoretically happen if you modify $13E4 so its maximum is greater than $80 (and modify Mario's physics to handle larger values of this increased range), which means more full tiles can be filled up to, drawing 8 or more units.

My version utilizes a repeated symbol routine that always check for writing the last tile for both full and empties, and only have one loop handling both:

It works like this: Very first thing in the loop is check both how many total tiles and the full tiles remaining to draw. If total depletes to zero, stop drawing (either full or empty) and finish. If there are any remaining full tiles, write that and subtract that remaining by 1, otherwise draw empty tiles. In the end of both cases, subtract total tiles left to write by 1, and repeat back to where it checks if there are remaining fulls and totals. So if I have Total set to 5 and Filled set to 6, it will loop 5 times, and ends the subroutine (total=0, then branches to ".Done") before drawing the 6th full tile.
Green Link
An easy alternative to this one, as it does not require a status bar patch like the one linked does.
simon.caio Link
oh nice! the uberasm version, perfect for my "vanilla" statusbar!
 binavik Link
Tested with Lunar Magic 3.51, UberasmTool 2.0, SA-1 1.42 and Mesen 2.0.0. Works as intended.