Banner
Views: 827,611,947
Time:
19 users online: Amine Retro, bsolt, DasFueller, ExONightZ, Gabriel3, HammerGuy, Infinity, JP 14, lion, LOLRyan2006 Mario Fan,  MarioFanGamer, Medic, Pink Gold Peach, Qwoll, RetroJunky.T, S.U,  Sinc-X,  Tahixham, Wariuzzo - Guests: 49 - Bots: 91 Users: 44,279 (2,530 active)
Latest: CarlosGD2000
Tip: If you give the player a cape, be sure they can't cheat and fly over the level with it!Not logged in.
Help! D: Custom block permanently disappears when hitting it. [SOLVED]
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Help! D: Custom block permanently disappears when hitting it. [SOLVED]
Pages: « 1 »
I'm making a custom block. Let's say it's meant to behave kind of like an empty translucent block, in the sense that it's meant to be hit from below, bump up, and return back to it's original state.

So following the "MarioBelow" event label, I insert the spawn_bounce_sprite macro with it's corresponding parameters.

Code
MarioBelow:
	PHX
	PHY

	LDA #$01		; Turn block bounce sprite
	LDX #$00		; Keep block at current tile
	LDY #$00
	%spawn_bounce_sprite()

	PLY
	PLX


But this just results in the block transforming into an invisible solid block after being hit. With my investigation on this site xdxd I have discovered that this is just a place holder so that the block doesn't trigger more than once. So that would be good, if it actually changed back afterwards, but it doesn't D:

How can I make the block reappear?

--------------------

(╯°□°)╯︵ ┻━┻
I suppose I'll add some of the things I've tried. Please let me know if you know why this hasn't worked.

There's a comment at the top of spawn_bounce_sprite.asm that says
Code
;Input: A = Bounce sprite number,  X = $9C value, Y = bounce sprite direction,
;       $02-$03 = Map16 number (only if $9C or X is $1C or larger)


So I interpret it as: If you set X to be greater or equal to $1C, you can set scratch RAM $02 and $03 to the high and low bytes of the Map 16 tile you want to appear after the bounce animation.

So, my chosen map 16 tile being 2F6, if I try this:

Code
	LDA #$02
	STA $02
	LDA #$F6
	STA $03
	
	LDA #$01
	LDX #$1C
	LDY #$00
	%spawn_bounce_sprite()


...the game crashes when I hit the block. But, thinking that if I just store the value directly into $03 it will know to put the high byte in the previous address, if instead I try this:

Code
	LDA #$02F6
	STA $03
	
	LDA #$01
	LDX #$1C
	LDY #$00
	%spawn_bounce_sprite()


Now there's no crash, but there's no bounce sprite either. So let's say I forget about the whole $02 and $03 thing, and why not just use the change_map16 macro after spawning the bounce sprite? So I try this:

Code
	LDA #$01
	LDX #$00 ; back to 0
	LDY #$00
	%spawn_bounce_sprite()

	REP #$10
	LDX #$02F6
	%change_map16()
	SEP #$10


Now it behaves just like it was in the beginning, after the bounce sprite does its thing, the block just becomes an invisible solid block. It's as if the whole change_map16 thing weren't even there.

¡dlǝɥ

--------------------

(╯°□°)╯︵ ┻━┻


First of all, make sure you're using the most recent version of GPS. The spawn_bounce_sprite routine in that version uses $03-$04 for the Map16 number, not $02-$03.

Second, make sure you have the Custom Bounce Block Sprites patch applied to your hack as well; that is required to use custom Map16 values.

Once you have both those issues fixed, this usage is the correct usage:

Code
	REP #$20
	LDA #$02F6
	STA $03
	SEP #$20
	
	LDA #$01
	LDX #$1C
	LDY #$00
	%spawn_bounce_sprite()


Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
I see. Thank you so much for the response. However, does that mean there's no way to get a custom block to bounce and reappear without such patch?

--------------------

(╯°□°)╯︵ ┻━┻
Originally posted by Landonb8x
I see. Thank you so much for the response. However, does that mean there's no way to get a custom block to bounce and reappear without such patch?

Exactly since SMW's limited change Map16 routine only allows you to change for certain blocks and doesn't allow you to pick every Map16 number. Custom Bounce Sprites mitigates that.

Furthermore, the SNES's CPU is a 65c816 processor and uses little endian i.e. the lower bytes are stored first and then the higher bytes. So if you want to store a 16-bit value in 8-bit mode, you'd do this:
Code
	LDA #$F6
	STA $03
	LDA #$02
	STA $04

What you did at first resulted that you store 0xF602 to $02.

--------------------
Okay, my layout looks ugly.
Oh, thank you! I didn't know about the little endian thing. I still can't help but wonder though, since you mention the SMW limited change Map16 routine. Why can't I use the GPS change Map16 routine after the program returns from the SMW change Map16?

--------------------

(╯°□°)╯︵ ┻━┻


Bit confused about what you mean there. GPS's included ChangeMap16 routine is just based on a slightly modified version of SMW's original one.

However, it spawns the tile immediately. The issue with the bounce blocks, though, is that the new Map16 tile isn't generated immediately with the bounce block; rather, the new tile is created by the bounce sprite (not the block) once it finishes animating. Since only the original ChangeMap16 routine is called by those (with the limited selection of spawnable tiles), a patch is required to spawn other ones.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
What I meant to differenciate is that GPS's ChangeMap16 allows to change into any Map16 tile, and that SMW's has a limited selection of blocks to change into like you mentioned. The reason I differenciate this is not because I want to call them both all redundantly, but rather because I want to bypass the limitations of SMW's ChangeMap16 once it has been inevitably executed.

What I don't understand is: after the whole GPS SpawnBounceSprite into SMW SpawnBounceSprite into SMW ChangeMap16 is done, why can't I use GPS's ChangeMap16 to get my desired Map16 tile back? (Kind of like what I tried to do at the end of my second post)

--------------------

(╯°□°)╯︵ ┻━┻
Because as Thomas explained, you need to modify bounce sprites so bounce sprites can change into every Map16 tile. That is, you need to modify the code when a bounce sprite terminates (so they use a modified ChangeMap16 which allows you to spawn every Map16 tile instead of selected tiles) and also get a way to store the Map16 number somewhere.
There also is the problem that you can't really use the tools' shared subroutines since the routines should be treated part of the tool which can't be used outside of it. More specifically, none of the tools (i.e. GPS, PIXI and UberASM) return the routines' location and the order in which they're processed is determined which routine is processed first. It's just impossible to use the tools' routines it properly.

This is why Custom Bounce Sprites implement a more liberal ChangeMap16 routine in its own way (not to mention it's older than most of our common tools so it was created when shared routines weren't a thing).

--------------------
Okay, my layout looks ugly.
I see. Thanks so much to both of you for your help and knowledge, I really appreciate it!

--------------------

(╯°□°)╯︵ ┻━┻
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Help! D: Custom block permanently disappears when hitting it. [SOLVED]

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2020 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 16

Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy