Language…
6 users online: DanMario24YT, defline, Heitor Porfirio, marvisjj, TheOrangeToad, unaffiliated - Guests: 164 - Bots: 285
Users: 64,667 (2,403 active)
Latest user: DarthHylian

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 418
  • 419
  • 420
So, I've been trying to figure out how to make the SMB2 POW Block sprite that comes with ICB's SMB2 Block Pack activate when it hits other sprites (besides just activating when it is dropped/thrown and hits a wall/floor. I'm not sure if there is a simple solution or if it will require some custom sprite-sprite interaction code. Any guidance/assistance is much appreciated. The relevant sprite code is below.

Code
DYING	
                    STZ $B6,x
                    STZ $AA,x
		RTS

SPRITE_ROUTINE	JSR SUB_GFX
		LDA $14C8,x		; \  return if
		CMP #$02		;  | sprite status
		BEQ DYING		;  | is < 8, or
		CMP #$08		;  | branch to death
		BCC RETURN		; /  handler if dying
		LDA $9D			; \ return if
		BNE RETURN		; / sprites locked
		JSR SUB_OFF_SCREEN_X0	; only process sprite while on screen

		LDA $1588,x		; \  if not hitting
		AND #%00000111		;  | wall, then skip
		BEQ NOHITWALL		; /  this next code

KILL
	lda #$28			;shake ground
	STA $1887

        jsl $00FA80		;kill sprites, turn to coins
        LDA #$16                ; \ Play sound effect
        STA $1DFC               ; / 
		LDA #$02		; \ make sprite
		STA $14C8,x		; / start dying

NOHITWALL



RETURN		RTS


[?] Miscellaneous Helpful Hints
If I moderated your hack, there was apparently a 90 percent chance it was rejected.
Try sticking a JSL $018032 at the beginning of the main routine - that should be enough to make it interact with other sprites, and if you're lucky, hitting another sprite will be treated like hitting a wall and thus trigger the POW effect.


 
Originally posted by WhiteYoshiEgg
Try sticking a JSL $018032 at the beginning of the main routine - that should be enough to make it interact with other sprites, and if you're lucky, hitting another sprite will be treated like hitting a wall and thus trigger the POW effect.

Well, adding the JSL doesn't hurt anything, but it also doesn't change anything. The POW Block sprite already interacted with sprites by default; it dies in a puff of smoke when it hits them and kills them too. That's why I think something more might be necessary, but what that would be is beyond me.

[?] Miscellaneous Helpful Hints
If I moderated your hack, there was apparently a 90 percent chance it was rejected.
I've just given the POW a try, and it does what you want it to do by default - kill all on-screen sprites when it hits one of them.

...checking again, though, when it hits a sprite while still being carried, it does end up only killing that one. I take it that's what you want to get rid of?
In that case, changing the BEQ DYING to BEQ KILL should do the trick.


 
Which sprites did you test it with?

After looking into it a bit more, it seems to vary in its behaviors based on which sprite it is interacting with and how the sprite is being touched. This may be why I thought it wasn't working before. For instance:
- By default, when I throw it at sprites from below, it collides and both disappear. When it is thrown from the side, it sometimes kills the sprite and goes through and hits the ground.
- When edited in the way you suggested here, it will not activate whether it is carried into or thrown at Koopa Troopas. It will activate when thrown at Goombas. Piranha Plants sometimes activated the POW kill when hit by the sprite, but other times would just disappear along with the unactivated POW.

So, something funky is going on with it. Have any other thoughts?

Originally posted by WhiteYoshiEgg
I've just given the POW a try, and it does what you want it to do by default - kill all on-screen sprites when it hits one of them.

...checking again, though, when it hits a sprite while still being carried, it does end up only killing that one. I take it that's what you want to get rid of?
In that case, changing the BEQ DYING to BEQ KILL should do the trick.


[?] Miscellaneous Helpful Hints
If I moderated your hack, there was apparently a 90 percent chance it was rejected.
Alright, so p4plus2 put the following together for me, it's supposed to disable Yoshi's normal stomping interaction.

Code
org $01A924
NOP #4
org $01A935
LDA #$13
STA $1DF9
JMP $A9CC


And it works, but acts really bizarre with Parakoopa's. It spawns garbage sprites that kill me whenever I stomp on one, and I managed to make the game crash in a very specific way I can't quite replicate. On that note, I still kill Rex in one hit like normal, though I'm not sure if that's related.
Try this patch:
Code
org $01A91F
		NOP #3
	
org $01AA45
		NOP #3
	
org $0395AE
		NOP #3
Thanks, that works perfectly.
This is probably a stupid question, but is it possible to load up other sprite/tileset GFX mid-level? I've noticed that there are two values in the RAM map (3 if you count the unused duplicate) that mention the tileset/sprite GFX. Would changing these change the GFX file being used, or are things more complex than that?
Eh, sure. Why not? Kaizo hacking doesn't seem too ha-aaaaaaand I broke the ROM.
those ram addresses are only used on level load

you have to change the gfx manually if you want to do it mid-level (by manually, i mean decompress the gfx file, then dma the result to vram. cant be done instantaneously; would have to be done over the course of a few frames (and even then, decompression might lag it a bit). you can try and decompress all your files ahead of time (like during levelinit) so you only have to upload them later on)

decompression is easy:
Code
!decompaddr = $gfx_will_go_here
REP #$20
LDX.b #!decompaddr>>16 : STX $02
LDA.w #!decompaddr&$FFFF : STA $00
LDA.w #$gfxfilenumber
SEP #$20
JSL $0FF900


uploading the gfx is harder. you'd have to make space in nmi (can prolly use uberasm's nmi hijack), and then upload from the ram address(es) above, in separate chunks per frame. use the WriteToVRAM macro here
I modified the giant blocks to make them spawn giant pieces of brick blocks (to make them act like more from SMB3) [edit]so I made an own patch which hijacks a routine for minor extended sprites sprites to add more of them[/edit]. However, one of both codes (or evev both codes) will crash the game.
I can't seem to get imamelia's Timer v. 1.3 to work #ab{x_x}
I'm basically trying to make a reverse timer which starts at 00:00:00 and goes up. I set the bytes like this:
Code
Settings $18 (%00011000, where the third bit makes the timer go up and the fourth one activates it)
TblMinutes: $00
TblSeconds: $00
ICVM: $00
ICVS: $00

The patch itself works, but starts at 85:85:00 for some unknown reason. Here's the whole code if I'm not clear enough.
You need to make sure that the timer gets initialized at the start of that level. Check out the description for the "Settings" table again. You want to set either bit 5 or 6 in addition to 3 and 4.

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

I'm working on a hack! Check it out here. Progress: 64/95 levels.
Originally posted by imamelia
You need to make sure that the timer gets initialized at the start of that level. Check out the description for the "Settings" table again. You want to set either bit 5 or 6 in addition to 3 and 4.

Uh, I totally didn't think of that! Thanks, it works perfectly now.
I'm trying to figure out how to write asm code that will spawn a yoshi. There are so many similar-looking subroutines in the RAM/ROM maps for spawning yoshi and setting his color, and I'm confused. Take a look at this document to see what I mean. What is it going to take to spawn a fricken yoshi?!
just use a generic sprite spawn code to spawn sprite 35

like this
I couldn't find JSL $02A9DE in the ROM or RAM maps. Is "$02A9DE" related to a subroutine that makes yoshi hatch?
Originally posted by MarioFanGamer659
I modified the giant blocks to make them spawn giant pieces of brick blocks (to make them act like more from SMB3) [edit]so I made an own patch which hijacks a routine for minor extended sprites to add more of them[/edit]. However, one of both codes (or evev both codes) will crash the game.
Originally posted by MonkeyMan
I couldn't find JSL $02A9DE in the ROM or RAM maps. Is "$02A9DE" related to a subroutine that makes yoshi hatch?

no

it just finds a free sprite slot


Originally posted by MarioFanGamer659
I modified the giant blocks to make them spawn giant pieces of brick blocks (to make them act like more from SMB3) [edit]so I made an own patch which hijacks a routine for minor extended sprites to add more of them[/edit]. However, one of both codes (or evev both codes) will crash the game.


in the first one:
Code
CMP #$0D
BCS ++    ; branch if sprite is #$0D or above.

Code
SEC
SBC #$0C
JSL $0086DF
dw GiantBrickPiece


you probably want either CMP #$0C or SBC #$0D. GiantBrickPiece will never be jumped to because the lowest value you can get before the JSL is 0D-0C=01, which means it'll jump to the entry after GiantBrickPiece (aka garbage, aka cr4sh)
Ok, first problem solved. Now there is a second problem or should I better say, there are two new problems: First one, the minor extended sprite will crash the game when it goes offscreen and the second one is, that there will spawn only one minor extended sprite.

Edit: Even the routine is (just modified) the same from $028663.

Edit: Edit: Here the code:
Code
ShatterBlock:		PHX
			LDY.B #$03
			LDX.B #$0B	; Initalize Loop counter
.FindFreeSlot		LDA.W $17F0,X
			BEQ .Free
			DEX
			BPL .FindFreeSlot
.Spawnnextsprite	DEC.W $185D
			BPL .Lable1
			LDA.B #$0B
			STA.W $185D
.Lable1			LDX.W $185D
.Free			LDA.B #$07	; \ 
			STA.W $1DFC	; / Play sound effect 
			LDA.B #$0D
			STA.W $17F0,X
			LDA $9A
			CLC
			ADC.W XPos,Y
			STA.W $1808,X
			LDA $9B
			ADC.B #$00
			STA.W $18EA,X
			CLC
			ADC.W YPos,Y
			STA.W $17FC,X
			LDA $99
			ADC.B #$00
			STA.W $1814,X
			LDA.W XSpeed,Y
			STA.W $1820,X
			LDA.W YSpeed,Y
			STA.W $182C,X
			DEY
			BPL .Spawnnextsprite
			PLX
ShatterReturn:		RTS		; Return

XPos:
db $00,$10,$00,$10

YPos:
db $00,$00,$10,$10

XSpeed:
db $FB,$FB,$FD,$FD

YSpeed:
db $FF,$01,$FF,$01
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 418
  • 419
  • 420