Banner
Views: 777,804,992
Time:
7 users online:  Alice3173, Bugsbunny205,  KKevinM, OEOTeam,  randomdude999,  Samuel, StarWolf3000 - Guests: 32 - Bots: 166Users: 40,807 (1,716 active)
Latest: fedevera11
Tip: Unique level names aren't necessary, but they're a plus.Not logged in.
Posts by Von Fahrenheit
Von Fahrenheit's Profile - Posts by Von Fahrenheit
Pages: « 1 2 3 439 40 »
How would I get a koopa sprite to act as if it was jumped on without jumping on it? I can get it to become a shell and spawn a shelless koopa of the proper color, but I can't seem to get it to slide out of the shell like it normally does. I read through everything relevant I could find in all.log but I can't figure it our. Anyone who knows?

We’re looking for level designers to work on Extra Mario World!
I'm trying to make a sprite that interacts with other sprites, but I'm having trouble making the Chuck sprites cooperate. When it comes in contact with the Chuck I want the same result as if Mario had jumped on the Chuck. I've made a routine that checks for contact and it definitely works, it plays the sound and all. The problem is that when I store #$03 (smushed, stunned) or #$02 (killed) or even #$00 (nonexistent) to the Chuck's status (14C8,x) nothing happens. It just keeps running. I've never encountered a problem like this before. Are Chucks just programmed differently? Do I need to do something else?

In case want to see the code the only relevant part is the following:

Code
	LDA #$03
	STA $1DF9
	LDA #$02
	STA $14C8,x		; (X is Chuck's index)
	STZ $AA,x
	STZ $B6,x

We’re looking for level designers to work on Extra Mario World!
Ok, so apparently I'm retarded. Right before my TYX that was supposed to put the Chuck index in X, was an LDY #$00. So yeah.

Anyway I fixed that and the Chuck's status now changes. The only problem is that setting it to #$03 (like the game does) just causes it to disappear. I read through all.log and mimicked the routine the game runs when Mario jumps on a Chuck. To clearify my problem now is that the Chuck disappears when it should be "smushed".

I'll just paste the entire interaction routine here, I suppose:
Code
	INT_05_MAIN

		LDY $1695			; Load sprite b index in Y
		LDA $14C8,y
		CMP #$02
		BEQ RETURN_INT_05
		JSR COMPARE_Y			; Load Ya-Yb

		CLC				;\
		ADC #$0C			;/ Stomp threshold is 12 pixels

		BPL INT_05_SIDE

		LDA #$05
		STA $1564,y			; Set "don't interact"-flag to 5 frames

		LDA #$02			;\
		STA $1DF9			;/ Play "spin jump on spiky enemy"-sound

		LDA #$00			;\
		LDY #$01			;/ Set up contact star
		JSR CONTACTGFX			; Display contact star
		JSR BOUNCE

		PHX				; Preserve X
		LDX $1695			; Load sprite b index in X

		STZ $163E,x			; Reset unknown sprite table
		LDA $14C8,x			;\
		CMP #$03			; |
		BEQ RETURN_INT_05		;/> Return if sprite b is still recovering from a stomp
		INC $1528,x			; Increase sprite b stomp count
		LDA $1528,x
		CMP #$03
		BEQ INT_05_KILL
		LDA #$28			;\
		STA $1DFC			;/ Play enemy stunned sound
		LDA #$05
		STA $14C8,x			; Set sprite b status to smushed
		LDA #$03
		STA $1540,x			; Set sprite b smushed timer to 3 frames
		STZ $1570,x			; Reset follow player timer
		PLX				; X is now sprite a index
		JSR COMPARE_X
		BMI INT_05_BOUNCELEFT

		LDA #$20
		STA $B6,x			; Give sprite a some X speed (the same amount Mario gets)
		RTS

	INT_05_BOUNCELEFT

		LDA #$E0
		STA $B6,x			; Give sprite a some X speed (the same amount Mario gets)
		RTS

	INT_05_KILL

		STZ $AA,x			; Reset sprite b Y speed
		STZ $B6,x			; Reset sprite b X speed
		LDA #$02			;\
		STA $14C8,x			;/ Set sprite b status to killed
		LDA #$03			;\
		STA $1DF9			;/ Play "kicked shell"-sound
		PLX
		RTS

	INT_05_SIDE

		LDA $1528,x
		BNE RETURN_INT_05
		JSR HURT

	RETURN_INT_05

		RTS


We’re looking for level designers to work on Extra Mario World!
And here I go thinking RAM_SpriteState means $14C8. Oh well.

Also everything works properly now, so thanks a lot!

We’re looking for level designers to work on Extra Mario World!
I don't know if this is the right place to post this but whatever, here goes. Basically I want to know how to make sprites interact with objects. Is there an easy way to check what block/object a sprite is touching? How would I make a custom block react to a specific sprite? There are a lot of good tutorials around here for coding sprites, but I have yet to see anything beyond the most basic in terms of block tuts. I would very much appreciate if someone could point me in the right direction.

Thanks in advance!

We’re looking for level designers to work on Extra Mario World!
I think I've seen that exact code before, but wouldn't that just run the interaction code no matter what sprite touches the block? I mean you check all the sprites and whatnot, but how would I know that the bullet bill (in this case) is the sprite that touches the block and not just some random koopa or something?

Edit: Basically wouldn't it run if there exists a bullet bill on screen and ANY sprite touches the block?

Edit 2: Thanks for the routine btw.

We’re looking for level designers to work on Extra Mario World!
Ok, thanks guys, really appreciate it!

We’re looking for level designers to work on Extra Mario World!
This is kind of a follow-up to my previous post, where I asked for some help regarding sprite/object interaction. Someone linked a routine for checking the map16 number of the tile a sprite is touching. Now I realize I know like nothing about the map16. Here are a few questions:

1. The comments on the routine say "do LDA [$05]. I've never seen [$xx] before. What does it mean? I can't find anything about it with google either.

2. It seems [$05] is a position (in tiles) rather than a number? How do I check what type of tile the sprite is touching?

3. I don't know. Can someone point me in the direction of some map16 101?

We’re looking for level designers to work on Extra Mario World!
Originally posted by MarioFanGamer659
Originally posted by Von Fahrenheit
2. It seems [$05] is a position (in tiles) rather than a number? How do I check what type of tile the sprite is touching?

After calling the subroutine, [$05] contains the Map16 number (it's even mentioned at the code end of the code). Here is, how you check the Map16 number after calling the Routine (which I already gave you in the thread you linked):
Code
LDA [$05]
XBA
INC $07
LDA [$05]
XBA
REP #$20
CMP #$xxxx
BNE NotTheRightMap16Number
SEP #$20
; your code
NotTheRightMap16Number:
SEP #$20


The code crashes the game as soon as its run. It seems to be the CMP #$003F that causes it. I don't even know anymore.
I did CMP #$003F to see if something happened when the sprite walks through a dirt tile. It seemed easy enough to check.


And sorry for missing your reply to my previous thread.



Edit: Now I feel stupid. I forgot that you need to do CMP.w for 16-bit numbers.

We’re looking for level designers to work on Extra Mario World!
So I want to make this setting sun effect on my BG; where the further you go in the level, the further down the sun goes. For this to look any decent I need to dynamically update the BG palette.

I suppose this is the question: How in the world do I do that? Normally I would just read through all.log a bit, but I don't think I can really trust it since Lunar Magic makes a lot of changes to the palette related routines.

And I'm already using HDMA, so sadly that's not an option.

We’re looking for level designers to work on Extra Mario World!
Ok, thanks. It's late where I live so I'll try that in the morning. Now I can rest easy :)

We’re looking for level designers to work on Extra Mario World!
And so morning arrives in the land o' vikings and I try using manual exanimation. I decided to use the time remaining timer (there's gotta be a better term for this) to control what frame to use. The problem is something really weird happens. I use a generator to update the trigger every 0xFF frames but whenever the update happens the game just crashes. I have confirmed that this piece of code is the culprit:

Code
; A is the time remaining (in hex, 16 bit) when this code is run

.CalcPal	LDX #$00			; Start at X = 00
.LoopPal	SEC
		SBC #$0019			; Subtract 0x19 (25)
		BMI .WritePal
		INX				; Add 1 to animation frame for every 25 seconds remaining
		BRA .LoopPal

.WritePal	SEP #$20			; A 8 bit
		TXA				; Transfer animation frame from X
		STA $7FC070			; Store to exanimaiton manual trigger 0


A bit of extra info: If I update the trigger every frame the game gets stuck at the level intro mosaic, which it loops over and over. If I put the generator at a later screen It plays the Mario death sound, messes up some graphics in the BG, and crashes the game when it spawns.

...Yeah, it's really weird. I'm not even storing to anything! How does it crash!?

EDIT: In case it wasn't clear, the loop is what kills the game. If I skip it and just store a value to $7FC070 it works just fine, except that, you know, it's not affected by the timer.

We’re looking for level designers to work on Extra Mario World!
Originally posted by Torchkas
Do you even RTS/RTL from the branch?


Yeah, after a bit. I do my HDMA code after the trigger update.

We’re looking for level designers to work on Extra Mario World!
Originally posted by Ladida
would help to see the rest of the code. the one you posted looks fine.

make sure X is 8bit and A is 16bit i guess, since stuff like that easily trips up how the code is assembled vs how it's interpreted


Ok, slight wall of text commencing. This is the entire code:
Code
		LDA $14				;\ Only update palette every #$FF frames to save processing power
		BNE .JustHDMA			;/

		REP #$20			; A 16 bit
		LDX $0F31			; Load 100s of timer in X
		LDA #$0000			; Start at A = 00
.Loop100s	DEX				;\
		BMI .Calc10s			; |
		CLC				; | Convert to hex and add to A
		ADC #$64			; |
		BRA .Loop100s			;/
.Calc10s	LDX $0F32			; Load 10s of timer in X
.Loop10s	DEX				;\
		BMI .Calc1s			; |
		CLC				; | Convert to hex and add to A
		ADC #$0A			; |
		BRA .Loop10s			;/
.Calc1s		LDX $0F32			; Load 1s of timer in X
.Loop1s		DEX				;\
		BMI .BreakLoop			; | Convert to hex and add to A
		INC A				; |
		BRA .Loop1s			;/

; A = timer (in hex)
;
; When the level starts A = 0x190 (400)
;
; The Sun will completely set at A = 0xC8 (200)
; After that the visuals don't change.
; The BG needs to be updated every 0x19 (25) seconds
; The layer 3 Sun needs to be updated more often though.

.BreakLoop	SEC				;\ SUbtract 0xC8 (200)
		SBC #$00C8			;/
		BPL .CalcPal			;\
		LDX #$07			; | Use the last frame if less than 200 seconds are remaining
		BRA .WritePal			;/

.CalcPal	LDX #$00			; Start at X = 00
.LoopPal	SEC
		SBC #$0019			; Subtract 0x19 (25)
		BMI .WritePal
		INX				; Add 1 to animation frame for every 25 seconds remaining
		BRA .LoopPal

.WritePal	SEP #$20			; A 8 bit
		TXA				; Transfer animation frame from X
		STA $7FC070			; Store to exanimaiton manual trigger 0

.JustHDMA


After .JustHDMA comes my HDMA code, as you might have guessed. I can confirm that the HDMA works fine and does not cause crashes.

We’re looking for level designers to work on Extra Mario World!
Originally posted by Ladida
in .Loop100s and .Loop10s, you are doing 8bit ADC when it should be 16bit


That's.. actually correct. I fixed it and it works now. Thanks mate!

We’re looking for level designers to work on Extra Mario World!
I've seen the following question asked alot, but I've never seen it answered properly: How in the world do you change the size of dynamic sprite slots?
32x32 is the default so that's pretty easy, but how would I go about making a routine that writes 16x16 tiles to the SP pages?
I'm currently working on a 16x32 dynamic sprite; I could probably get it to work by editing the GFX to have every other tile be empty, but that's a disgustingly ineffiecient use of ROM space. From what little I've found about the subject you have to do more LSR's and less ASL's something something, but no one explained it in much more detail than that, so I really don't know anything. The DMA routine probably needs to be changed too, but in what way? I really am clueless when it comes to this.

TL;DR: Can someone with the knowledge please tell me how this stuff works?

Edit: Before anyone asks: yes, I did apply dsx.asm.

We’re looking for level designers to work on Extra Mario World!
I did something similar recently. What you want to do is what Kaijyu said and spawn the hammers with X-speed relative to the difference in X position. I take it you will want the starting Y-speed to be constant (which is probably the easiest way of doing it, too). I'm pretty sure the hammers update their Y-speed with some kind of gravity, so if you give them some upwards speed at spawn they will eventually fall down. Here's what you want to do:

- Load sprite's 16 bit X position
- Subtract Mario's 16 bit X position
- EOR.w #$FFFF
- Do LSR A a couple times depending on how fast you want the hammer to travel. You should probably just test a bunch of times.
- Preserve this value somewhere
- Do the first three steps but with Y positions.
- Add/subtract some constant since gravity will mess your arc up otherwise. I'm not sure how much. It depends on how high you want your arc to be.
- A couple LSR A's here too, not sure how many.
- Add this with the preserved value and store the lo byte to the hammer's X-speed.


The hammers should hit Mario, unless he's too far up (but then you don't want it to hit him, right?)
I'm not sure how helpful I've been. Hopefully you can figure something out.

We’re looking for level designers to work on Extra Mario World!
The coolest enemy in the game is Rex. I just can't get over its derpy-ass face.
The worst enemy in the game is Torpedo Ted and RIP van Fish.

We’re looking for level designers to work on Extra Mario World!
In that case I'm pretty sure I can help. The code itself is pretty simple as long as you understand the math (to some degree).
So if you want to change the way the Hammer Bro throws its hammers, you're going to have to change the .asm file. The first step is to find the .cfg and .asm files the Hammer Bro uses. If you have inserted them in your hack that shouldn't be a problem. Then copy them and rename them something else (assuming you still want to keep the original). For Example you could call them "HammerBroAim.cfg" and "HammerBroAim.asm" or something like that. Just make sure that the name inside the .cfg file matches that of the .asm file! That's how Sprite Tool figures out what file to use!

Next is the actual code.
Open the .asm file and look for the command: STA $1747,y
This is what sets the hammers X speed. The command before it is probably an LDA of some kind. Replace that line with this:

Code
	LDA $E4,x		;\
	XBA			; | Load sprite's 16 bit X position
	LDA $14E0,x		;/
	REP #$20		; A 16 bit
	SEC			;\ Subtract Mario's 16 bit X position
	SBC $94			;/
	EOR.w #$FFFF		; Invert the value (we need this since we can't subtract the sprite's X position from Mario's in an efficient way)
	LSR A			;\ Divide by 4, you could do more or less if you wanted
	LSR A			;/ Each LSR A divides the speed in 2
	SEP #$20		; A 8 bit << IMPORTANT



After that comes the STA $1747,y, which sets the X speed. Note that this only takes in consideration the distance between the sprite and Mario along the X-axis, but should be fairy accurate on flat levels. If you REALLY want it to hit dead on I can probably help you with that too, but it will be a lot more complex.

We’re looking for level designers to work on Extra Mario World!
Oh, whoops. That's a pretty silly mistake by me, actually. The first three lines are out of order, they should read:

Code
	LDA $14E0,x
	XBA
	LDA $E4,x




As for giving them "proper" aim, you'd have to do some physics calculations, involving different Y speeds. Basically determine a base velocity and then add a value depending on the difference in Y position, then add a value to offset gravity's influence during the time the hammer is traveling. I think the gravity increments the Y speed by 2 each frame, and that every 0x10 (16) points of speed converts to one pixel/frame. That's the way it works for regular sprites at least, extended sprites (like hammers) might handle it differently.

EDIT:
I take it you want code though. In hopes of not having to use the trigonometry table at $07F7DB (which I honestly haven't figured out myself yet) I'll handle the X/Y speeds independently, which should still work as long as Mario is within a screen or so of the Hammer Bro.

For this you want to edit the Y speed, so look for the opcode: STA $173D,y. Replace the LDA command in front of it with:

Code
	LDA $14D4,x
	XBA
	LDA $D8,x
	REP #$20
	SEC
	SBC $96
	EOR.w #$FFFF
	LSR A		;\ You might need more than 2 LSR's for this one, do some testing
	LSR A		;/
	SEP #$20

	CLC
	ADC #$XX



After that comes the STA $173D,y, which sets the Y speed. The XX in the last opcode is the hammer's base velocity. You need to set this or the hammer will be thrown straight ahead and fall through the ground if Mario and the Hammer Bro are at the same altitude. Something in the range #$F0-#$E0 is probably reasonable. You will have to test this a bit though.

NOTE:
This definitely works with regular sprites, but as I've stated before the hammers might be different. In that case I could get back to you in a bit after checking relevant areas in all.log.

We’re looking for level designers to work on Extra Mario World!
Pages: « 1 2 3 439 40 »
Von Fahrenheit's Profile - Posts by Von Fahrenheit

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

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


Total queries: 9

Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

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