Banner
Views: 559,320,171
Time: 2017-08-19 01:15:55 PM
14 users online: Akaginite, Christian07, DarkCodr, Flyingcape, Impetus, LeoGamerxD, o Lexator, o Mirann, Ragey, Super Maks 64, WhiteYoshiEgg, Wii2, yoshiatom, YourAverageROMHacker - Guests: 20 - Bots: 164Users: 32,216 (1,486 active)
Latest: BluePopo
Tip: Even though good graphics may make people interested in your hack, what really counts is how fun it is to play.Not logged in.
Help with loop[!]30
Forum Index - SMW Hacking - SMW Hacking Help - Help with loop[!]30
Pages: « 1 »
Please, help me, I'm going crazy on this code since 2 weeks!!!

Code
;~@sa1 <-- DO NOT REMOVE THIS LINE!
;	Kill sprite
;	HuFlungDu
;	This block will kill cause every one of one specific NON CUSTOM sprite to disapear in a puff of smoke
;	when mario touches it. To choose which sprite, just change !spritenum to the sprites number. Currently
;	kills regular boos, but you can make it kill whatever you like.
;	It doesn't really matter how it acts, just make it act like whatever you place it as.
;	No credit necessary

db $42
JMP Mario : JMP Mario : JMP Mario : JMP Return : JMP Return : JMP Return : JMP Return
JMP Mario : JMP Mario : JMP Mario

!spritenum = $37		;The number of the sprite you want to disapear. You can find this on the wiki or in LM

print "This block will kill all of a certain sprite (0x",hex(!spritenum),") that is on screen when the player touch it."

Mario:
	PHX					;Push the X register
	LDX #$00			;innitiate the counter
	loop:
	LDA $3242,x
        CMP #$08
        BCC notkill
        LDA $3200,x			;Load the sprite numbers of all the sprites on screen (one at a time)
	CMP #!spritenum		;\If it's not the one you specified, don't kill it
	BNE notkill			;/
	LDA #$04			;\ Make the sprite dissapear in a puff of smoke
	STA $3242,x			;/
	LDA #$08
        STA $7DF9
	LDA #$1F
	STA $32C6,x

	notkill:
	INX					;Move on to the next slot
	CPX #$0C			;\If they haven't all been checked, go back to the beginning
	BCC loop			;/
	PLX					;Pull the X register from the stack
Return:
	RTL


I want to use a block that, when touched by Mario, ALL Boos on screen will killed; it works correctly on a normal rom, but when I convert the code to install the block on a SA-1 rom, it kills only one Boo!!! And worse still, when it kills the Boo, touching again the block, nothing happens! It's not an emulator problem, I've tested the block with different emulators with SA-1 support! So where's the error? Maybe, the looping method for SA-1 Mod has something different? Please, help!!!
With sa-1 there can be up to 20 sprites on screen at once however you still only loop through 12 sprites. So what you want to change is the 0C to 15 I think.
It was just that?!? I had not idea of meaning of that #$0C, I thought it was a constant value for looping; now it works correctly, finally! Thanks a lot!!! #tb{:)}

Another question: we assume that I want a block that will make disappear a key or a springboard when touched by one of them:

Code
db $42
JMP Return : JMP Return : JMP Return : JMP Sprite : JMP Sprite : JMP Return : JMP Return
JMP Return : JMP Return : JMP Return

Sprite:
	LDA $3200,x	;\ Check if the sprite is a key...
	CMP #$2F	;/
	BEQ Remove
	LDA $3200,x	;\ ... or a springboard
	CMP #$80	;/
	BEQ Remove
Return:
	RTL
	
Remove:
	STZ $3242,x	;\ Make disappearing the sprite
	%create_smoke() ;/ with a puff of smoke
	RTL


... is there a better code to list sprites (like an array or something similar) instead of using

LDA $3200,x
CMP #$XX
BEQ Label

for each sprite I need to interact with block? The more compact code, the better.
You could try a table.

Code
Sprite:
	LDA $3200,x
	PHY : LDY.b #check_end-check-1
-	CMP check,y
	BEQ .remove
	DEY : BPL -
	PLY : RTL
.remove
	PLY
	STZ $3242
	%create_smoke()
	RTL

check:
	db $2F,db $80
.end


e: Whoops forgot the labels lol
You probably want to use the table like this though :P
Code
check:
	db $2F,$80


--------------------
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
Okay was I even thinking when I made this? I forgot the labels and now this, oh well. But yeah db $2F,db $80 is complete nonsense lol
Sorry for the delay of this reply, I was busy for job and other codes for my rom... howerer, thanks a lot for your help, I'll test that code soon. ^^
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - Help with loop[!]30

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

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


Total queries: 23

Menu

Follow Us On

  • Facebook
  • Twitter
  • YouTube

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented