Language…
6 users online: Cristian Cardoso, KoJi, Papangu, playagmes169, stormitive, Zavok - Guests: 253 - Bots: 311
Users: 64,795 (2,377 active)
Latest user: mathew

Rock climbing blocks by GreenHammerBro

File Name: Rock climbing blocks
Submitted: 30-May-2016 07:38:17 pm by GreenHammerBro
Authors: GreenHammerBro
Act As: 25
Includes GFX: Yes
Description: These are mini ledges that allow the player jump off. To use, make sure you are doing the following:

-Not crouching
-Holding in the direction of the wall (towards)
-Must be touching the wall, a pixel or more from the player's hitbox does not count.

While they work fine, they lack of some optimization.

In your code you have this:

Code
<check position>
<check button>
<check ducking>


Which works fine, but checking the position takes more cycles than checking if Mario's ducking or pressing the desired button, it also it's a low priority check because you already know that the block's code run when the offset is triggered.
You could restructure your code in some way that it does the checks that takes less cycles first and/or those checks that should be done first, in your blocks case, you should check the most important check first.

Code
<check ducking>
<check button>
<check position>


Checking if mario is ducking seems more important than checking if the button is pressed or checking Mario's position in the block, since the block runs its code only when the offset is triggered, so better check the position at last and take care of the rest first.

Another thing is that the math when checking Mario's position could be done in 8-bit and it would still work on screen boundaries (already tested).

There is another optimization that could be done, the CLC : ADC #$0002 on LeftWallEdge.asm could be changed to ORA #$0002, it does the same effect because you already cleared the lower 4 bits of A with the AND #$FFF0.

And at last...

Code
LDA #$00
STA $1693


Why? STZ exists too, bro.
EDIT: Below is not a removal log but just a question...
Dunno how accurate that position math is, but can't you get the block to work simply by doing this:
Also, personally, I don't see why you can't crouch.

Code
;Act like rope (105) or cloud (106)
Abover:
	LDA $73		;ducking #$00 = no
	BEQ .fall	;
	LDA $77		;player blocked status SxxMUDLR
	AND $15		;controller byetUDLR
	AND #$03	;mask out LR (can't be both at the same time)
	BNE .solid
.fall
	LDY #$00	;
	LDA #$25	; act like air
	STA $1693	;
.solid
	RTL


Again, didn't test the original block, so I don't know if this replicates the effect or if the block did more or something different.
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?