Banner
Views: 853,833,071
Time:
27 users online: aaa, Aerithos, buggy789, deadworld2009, DJLocks,  E-man38, FerpyMcFrosting, G3rminho, GbreezeSunset, HamOfJustice, ideka13,  KevinM, KiloMinimo,  Koopster, LadiesMan217, lx5,  MarioFanGamer, NerDose, NewPointless, nickofzo,  Ninja Boy, qantuum, Runic_Rain, SteamyPanini,  Tob, Vallenatero2020, Zidan3 - Guests: 115 - Bots: 62 Users: 47,113 (2,476 active)
Latest: ConstantLime830
Tip: If you're using the original SMW ending, remember that level 104 (Yoshi's House) will appear during it.Not logged in.
Ask anything about SMW Hacking - 2019 Edition
Forum Index - SMW Hacking - SMW Hacking Help - Ask anything about SMW Hacking - 2019 Edition
Pages: « 1 2273 274 275 276 277 278 279 280 »
Originally posted by BrownBuddy
I.E: Can I write a block that makes a sound effect and then after say 2 in game seconds it makes another sound effect?

A block's code only runs while either Mario or a sprite touch it, so if you want an action to run a certain time after the interaction, you're better off creating level UberASM code (which runs every frame), otherwise it is impossible to make anything happen once there is no longer contact with the block. Make the block set some flag (i.e. a RAM address) and have a check in the UberASM code that will start a counter when that flag is set, and another check to perform an action once that counter is finished.

Quote
If so, could write a block that does different actions in order?
I.E: A block that plays SFX then does an action.

Code has to be written in a certain order, so yes, but by default all of the code you write will run within a frame. For a sequence of actions separated apart by some amount frames, see my previous answer.

--------------------
Twitter
Is it possible to have an UberASM (or something) that makes Mario shoot fireballs with the R-Button, and only with the R-Button, in a specific level? X and Y keep their other functions.

--------------------
Mario Quits - My Kaizo hack in progress


This isn't something that can really be handled in UberASM, but you can write a patch to the same effect. Generally, this is done by checking either $010B or $13BF for a specific level number, and then running either your modified code or the original code based on that.

In this case, I believe something like this will work (note: untested):

Code
!level	=	$0105

org $00D08C	; hijack on the point where the game checks X/Y pressed for spawning a fireball
	autoclean JML HijackFireball

freecode
HijackFireball:
	REP #$20
	LDA $010B
	CMP #!level
	SEP #$20
	BNE .originalCode
	LDA $18
	AND #%00010000		; check for R
	BNE .spawnFireball
	JML $00D0AD		; don't spawn any fireball (change to $00D090 if spinjump fireballs are still fine)

  .originalCode:
	BIT $16
	BVS .noFireball
  .spawnFireball:
	JML $00D0AA
  .noFireball:
	JML $00D090


Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Hi,

thanks so much for your efforts.
Unfortunately I received some errors:

(E5135): autoclean used in freespace. [autoclean JML HijackFireball]
(E5117): Unknown command. [$00D08C]
(W1011): This freespace appears to be leaked. [freecode]

Any chance someone can fix this?

Thanks again!

--------------------
Mario Quits - My Kaizo hack in progress
Add an
Code
org
before the
Code
$00D08C
OK. That was quite simple.
Now it seems to work like a charm.

Thank you, guys!

--------------------
Mario Quits - My Kaizo hack in progress
Does anyone know where in the game's code does it decide what palette to use for Luigi's overworld sprite? I was wanting to experiment with it a bit but I can't seem to find any documentation of where it is.

--------------------
Don't eat the sandwich


The game handles it in a very awkward way. These lines are where you want to look:

Code
	LDA.w DATA_0487CB,Y	;$0489AE	|
	CLC			;$0489B1	|
	ADC $04			;$0489B2	|
	STA.w $029E,X		;$0489B4	|

The DATA_0487CB table contains 16-bit values with the sprite tile number in the low byte and YXPPCCCT in the high byte, and the $04 here is a 16-bit value responsible for modifying Luigi's palette. It will either be 0000 when the routine is run for Mario, or 0200 when run for Luigi. I don't recommend messing with the value directly as its used for some other stuff as well, but you can hijack right on this part of the routine to add your own values to the YXPPCCCT in place of $04 (just use $04 to check which player the routine is running for).

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
So if I wanted Luigi's overworld sprite to use a different palette, what would I have to insert? I made this patch but now I don't really know what I'm supposed to do next.
Code
if read1($00FFD5) == $23
    sa1rom
    !sa1  = 1
    !addr = $6000
    !bank = $000000
else
    lorom
    !sa1  = 0
    !addr = $0000
    !bank = $800000
endif
org $0489AE : autoclean JML Test

freecode

Test:
	LDA.w $0487CB,Y
	CLC
	ADC $04
	STA.w $029E,X


--------------------
Don't eat the sandwich
Two things: when hijacking, you need to count the bytes. A JML Test takes up four bytes, so your hijack will only replace the LDA.w DATA_04807B,y and the CLC and leave the other lines intact. Opcodes themselves are one byte and their argument can be 0 (no argument opcodes), 1 (can be suffixed by .b if it's not obvious), 2 (.w) or 3 (.l) bytes long. To overwrite more bytes, you can fill it with NOPs.

However, it may be best to hijack at $0489B1 instead as to leave the LDA.w DATA_04807B,y intact, since you can't really load from a local table easily within a hijack (actually you can, but don't bother as there's another solution anyway). Note that your JML in this case will hijack from CLC up to the STA.w and only one of its argument bytes, so add an extra NOP to clean up the argument as well, and write it in to your hijack. Then you can write a logic like this:

Code
Test:
	PHA		;preserve accumulator
	LDA $04
	PLA		;restore accumulator
	BEQ +		;branch if the player is Mario
	
	AND #$xxxx	;add your palette bits here for Luigi's case

+	STA $029E,x
	JML $0489B7

I'm preserving the property data loaded by the accumulator, then checking whether $04 is set or not. If it is (that is, if the player is Luigi), the zero flag will be clear and the branch will not be taken. Before so, I restore the accumulator, and only in the Luigi case, you AND in palette bytes (since Mario's palette is 0, take that as just loading the palette value there in YXPPCCCT format, only caring about the CCC bits).

Note that you need to JML back to the main routine after your hijack is finished!

e: fixed the code probably. I'm multitasking so you really should not trust me :p

--------------------
Twitter


I'd recommend doing it more like this:

Code
org $0489AE	; hijack here to avoid losing too many bytes
	autoclean JSL Hijack
	NOP #2		; overwrites the "ADC $04"

freecode
Hijack:
	PHX
	LDA.w $0487CB,y
	LDX $04
	BEQ .mario
  .luigi:
	CLC : ADC #$0200	; 02 = YXPPCCCT offset to apply for palette (02 = 1 palette after Mario's, 04 = 2 palettes, etc.)
  .mario:
	PLX
	RTL


edit: beaten to the punch, but will post this version anyway, as the other code has a few issues (PHA/PLA should be swapped, also A is 16-bit so ADC #$xx will probably crash the game).

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
It seems to have worked, thanks for the help.

--------------------
Don't eat the sandwich
Greetings, apologies for having to ask this but if possible, would someone be able to PM me? I'm looking for someone who has a fair knowledge of Lunar Magic and the other resources on here as I'm not the best at navigating this site :/ Any help I can get would be appreciated.
Just the put the conflicting information I stumbled upon to rest. How exactly does one get Layer 2 work?

Is it setting Layer 2 Horizontal and Vertical to None, changing the Register to 02, and apply the sprite you want to the top of the screen?

I'm trying to get a "Layer 2 sink" working by doing just that but I can't get it to work. My level is also a single screen, does that matter?
Originally posted by BrownBuddy
Just the put the conflicting information I stumbled upon to rest. How exactly does one get Layer 2 work?

Is it setting Layer 2 Horizontal and Vertical to None, changing the Register to 02, and apply the sprite you want to the top of the screen?

I'm trying to get a "Layer 2 sink" working by doing just that but I can't get it to work. My level is also a single screen, does that matter?

Originally posted by yoshicookiezeus
Layer 2 Sink/Rise (all of them): Will not do anything on Screen 0. There is also a limit to how far everything sinks/rises. The range for Layer 2 Sink Short is about two screens, then a one-screen break, then another four screens, and then they stay sunk. Needless to say, don't expect many Layer 2 Sink levels in my hack. The range for Layer 2 Sink Long is the whole entire length of the level! When you use Layer 2 Rise Up, the place you put objects in with Lunar Magic represents the highest point that they'll rise. They'll be set about 12 rows lower than that when you encounter them in the game. The range for Layer 2 Rise Up is the same as Layer 2 Sink Short. And finally, Layer 2 Give Some is completely useless. It just causes Layer 2 to hesitate a little when you step on it, then reset when you step off


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


Paper World!
My YouTube Channel

Coming soon!

Hello everyone,

I use the code that Thomas posted above and it works perfectly for my "shooter level". But it is a little stressful to press R again and again. Would it be possible to add an "autofire" to the code so you can hold R for repeated shooting? I cannot say how big the frame intervall should be. It would be nice if it was adjustable.

Thanks in advance. I appreciate all your help.

--------------------
Mario Quits - My Kaizo hack in progress
Just take the
Code
	LDA $18
and make it
Code
	LDA $17
So if a UberASM or ASM patch uses 1 byte of multi-byte free ram address, does that mean that same address can be used by another 1 byte code?

For example $60 is 4 bytes, can I use it 4 times for 4 different codes?
Not quite. $60 being 4 bytes means 4 bytes from that address on are free. In that case, $60, $61, $62 and $63 are all free addresses.

Sometimes it's requested that you provide a 2 byte address as free RAM, which means whatever you input there will get read as well as its adjacent address. So if you input $60, the code will claim both $60 and $61. You need to look for addresses that have 2 or more adjacent free bytes in that case.

Do not use the same address for more than one thing at once. It's very likely that conflicts will happen. If your code is i.e. level-specific, you're free to use the same free RAM in another level though.

--------------------
Twitter
Originally posted by MarioriaM
Just take the
Code
	LDA $18
and make it
Code
	LDA $17


I've set up the fireballs so, that I can have 8 on screen at once.
When I make the change you proposed, Mario shoots 8 fireballs in (I guess) 8 frames.

But I want Mario to shoot one fireball every half second or something like this. That's why I want the fire rate to be adjustable, if possible.

Sorry, for the late feedback. Returned from vacation today.

--------------------
Mario Quits - My Kaizo hack in progress
Pages: « 1 2273 274 275 276 277 278 279 280 »
Forum Index - SMW Hacking - SMW Hacking Help - Ask anything about SMW Hacking - 2019 Edition

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


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

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