Language…
24 users online: akawo, Alex No,  AmperSam, autisticsceptile1993,  BeeKaay, deadworld2009,  DeppySlide, edgar, Green, Hammerer, JezJitzu,  MarioFanGamer, Metal-Yoshi94, MistaX88, MorrieTheMagpie, Nayfal,  NopeContest, Pink Gold Peach, Rykon-V73, SolveForX,  Telinc1, timeisart, Tulip Time Scholarship Games, wye - Guests: 291 - Bots: 461
Users: 64,795 (2,370 active)
Latest user: mathew

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 418
  • 419
  • 420
Originally posted by NamelessProtagonist
I'm having an issue with a a mini-boss I'm trying to set up. The mini-boss is a Homing Thwomp (the version that doesn't drop bombs) in a room full of blocks that shatter when hit by the Thwomp from above. The player is supposed to lure the Thwomp into smashing through the bricks and falling into the lava below.

After that, a door is supposed to spawn so the player can proceed. However, it never does when the Thwomp falls in the lava, leaving the player stranded in the room.

Now, I know the door spawner works, as I've used it in other rooms with other enemies and I haven't had any issue (that said, these other rooms did not involve lava or thwomps). Here's the part of the spawner code that's supposed to check to see if the Thwomp has been killed...

Code
        dcb "MAIN"
        LDA $1493
        BNE RETURN
        LDA $13C6
        BNE RETURN

CHECK_SPRITES
        LDY #$0B
LOOP_START:
        LDA $14C8,y
	CMP #$08
	BCS TestTweakerBits
DONT_CHECK:
	DEY
        BPL LOOP_START
	JSR SPAWN_DOOR
TestTweakerBits:
	LDA $1686,y
	AND #$20
	BNE DONT_CHECK
RETURN:
	RTL


... And then that runs a subroutine that actually creates the door. Any ideas why it won't work for the Homing Thwomp and how to fix it?

And as a second question, how would I check to see if a specific level has been beaten?


Still having this issue from two pages back if anyone has any advice.
I have a hack thread - Link (Now with a demo!)
Also a music thread - Link

C3 Projects
2013: Modern Spiny Pack
2012: MGSS v0.1
Spring 2010: SMB2 Autobomb Sprite
The homing thwomp probably isn't registering as "dead" when it falls into the lava. Not sure why as I dunno how it's coded to interact with lava.




For your second question, check the table at $1EA2. Look it up in the RAM map as it has a lot of information about the levels (including if the midway's been hit and such).
I'm currently coding a sprite, which I want to follow Mario vertically.

In other words, I want to compare the y position of Mario with the y position of the sprite and change it's speed depending on the outcome.

Problem is, I can't seem to figure out where to get the sprites y position from. Anybody knows the address? I tried every RAM addresse I could find.
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
@NamelessProtagonist: For your second question, I'd just check if the event of that particular level has been cleared or not. Something like this should work:

Code
LDY #$01 ; event #
LDX #$00
LDA #$80
.Loop
CPY #$00
BEQ Check
CLC
ROR
BCC +
ROR
INX
+
DEY
BRA .Loop
Check:
BIT $1F02,x
BEQ Fail

;level beaten

Fail:

;level not beaten


@PikBube3: The low byte of the sprite's Y position is $D8,x and the high byte is $14D4,x.

Anyway, I have a question of my own. How would I teleport Mario to a specific position in a level, sort of like a secondary entrance? I tried to store the screen number to some address, and then store that address to the screen number when I need to. That doesn't seem to work, though.
Originally posted by Iceguy
Anyway, I have a question of my own. How would I teleport Mario to a specific position in a level, sort of like a secondary entrance? I tried to store the screen number to some address, and then store that address to the screen number when I need to. That doesn't seem to work, though.

You use an actual secondary entrance and an actual level transition. If you want an "instant" teleport, that's ridiculously difficult to do without visual glitches due to how the level scrolling works.
@Iceguy,
I never tried it, but can't you just set Marios x and y position to whereever you want him to be?

Also,
I know that $D8,x is the low byte and $14D4,x is the high byte.
I just don't know what to do with those values. Do I put them together in using a command or what?
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
Originally posted by Kaijyuu
Originally posted by Iceguy
Anyway, I have a question of my own. How would I teleport Mario to a specific position in a level, sort of like a secondary entrance? I tried to store the screen number to some address, and then store that address to the screen number when I need to. That doesn't seem to work, though.

You use an actual secondary entrance and an actual level transition. If you want an "instant" teleport, that's ridiculously difficult to do without visual glitches due to how the level scrolling works.

I'm actual trying to code a save block that saves the current position of the player, along with the level number. When the player dies, he should respawn at that particular position in that particular level (sorry for being a bit vague before). An instant teleport isn't necessary and I can teleport the player to the level just fine, but I have trouble teleporting him to the right position.

Quote
I never tried it, but can't you just set Marios x and y position to whereever you want him to be?

In a level? You can but you'd get glitches due to the level not updating properly.

What exactly do you want to do? If you, for example, want to check if the player is below the sprite you could use something like:

Code
LDA $14D4,x
XBA
LDA $D8,x
REP #$20	; get the sprite's y position in the level

CMP $96		
BCS BelowMario

;above Mario
Originally posted by Iceguy

LDA $14D4,x
XBA
LDA $D8,x
REP #$20 ; get the sprite's y position in the level

CMP $96
BCS BelowMario

;above Mario


Using that code, the game crashes as soon as the sprite "appeares" on screen.

Here is what I tried to do.
---------------------------------------------
LDA $14D4,x
XBA
LDA $D8,x
REP #$20 ; get the sprite's y position in the level
CMP $96
BCS BelowMario

LDA #$08
STA $AA,x
BRA SpeedDone

BelowMario:
LDA #$F8
STA $AA,x

SpeedDone:
JSL $01802A ;Apply speed.
RTS
---------------------------------------------------
Basicly, the sprite should follow Mario vertically.

Originally posted by Iceguy
I'm actual trying to code a save block that saves the current position of the player, along with the level number. When the player dies, he should respawn at that particular position in that particular level (sorry for being a bit vague before). An instant teleport isn't necessary and I can teleport the player to the level just fine, but I have trouble teleporting him to the right position.


If I remember correctly, there is a "level loading flag" type of thing, isnt' there?
Can't you just use that to load the x/y position and the screen number.

Also, I've never used it but wouldn't the "Multiple Medpoint patch" do exactly that?
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
Ah okay. I'm pretty sure you'll have to hijack the level loading routine in that case, though I don't recall exactly where. It sets mario's position after loading all the layers and sprites, iirc.


fakeedit:

Imamelia's multiple midway points patch does allow placing mario in arbitrary locations when loading the level, so you could look at that.
Ah, thanks both of you for mentioning the multiple midway points patch. It probably does have the code I'm looking for, so I'll check it out.

@PikBube3:
I forgot a SEP #$20 in the code. Add it right after the CMP $96. Also if you want the sprite to follow Mario vertically you may want to call SUB_VERT_POS first.
Hey guys,
Can you help me to disable the scrolling on the main map Completetely so it can be used like one of the small maps...
(i need 7 small maps)
In the OW editor, go to Overworld -> Extra Options and uncheck the 2nd box.
No that options only disables the scroll araws but if mario goes to the side of the screen the overworld scrolls...
Originally posted by mzuenni
No that options only disables the scroll araws but if mario goes to the side of the screen the overworld scrolls...


look trough the RAM/ROM Map, maybe you can find something there.

Originally posted by Iceguy
@PikBube3:
I forgot a SEP #$20 in the code. Add it right after the CMP $96. Also if you want the sprite to follow Mario vertically you may want to call SUB_VERT_POS first.


I suspect that SUB_VERT_POS si simmilar to SUB_HORZ_POS and stores the value to Y ?
If so, do you know where I can get the code from?

Also, the cide you wrote workes too, except for 2 "problems"
1. The sprite starts shaking when it's at the same hight as mario. Well, this isn't really unexpected, but I can't seem to fix it, since a normal BEQ doesn't seem to work.

2. The sprite seems to be to high. It's like on block higher than Mario. Anyway to fix this?
Anime statistic on MyAnimeList:
400 animes completed ✓
6000 episodes completed ✓
100 Days completed ✓
... what even am I doing with my life?
I already looked in the rom map but i cant find anything...
Originally posted by Kaijyuu
The homing thwomp probably isn't registering as "dead" when it falls into the lava. Not sure why as I dunno how it's coded to interact with lava.


Took a look into it and found a few lines related to offscreen processing commented out. Un-commenting them seemed to fix it. Thanks a lot, up until you said that, I thought the problem was somewhere in the sprite checking code.

Anyways... I started coding a new sprite today and it's proving surprisingly annoying... It's supposed to be a fairly simple sprite. It's invisible unless you hit it with a fireball. Then it appears for a time. Then it disappears again. Code run through LevelASM is supposed to lighten and darken the screen based on how many are active. (Also, if the extra bit is set, it's just always active, though I'm not noticing any issues with that) Here's the main code

Code
FlameTimer = $1528	; RAM Table for how long the flame stays lit.

SpriteCode:
	JSR SUB_OFF_SCREEN_X0

	LDA FlameTimer,x
	BEQ TimerZero
	DEC FlameTimer,x

TimerZero:
	LDA $7FAB10,x
	AND #$04
	BEQ BitClear
	JSR Graphics
	RTS

BitClear:
	LDA FlameTimer,x
	BEQ TorchOut
	JSR Graphics

TorchOut:
	JSR FIRECONT	; Routine to check for contact with fireballs.
	BEQ RETURN

	LDA #$F0	; 4 seconds
	STA FlameTimer,x

RETURN:
	RTS


For the most part it works, but there are a few issues.

First off, and probably the biggest is that sometimes it simply won't disappear. Usually it does, but sometimes one of the sprites will continue to display its graphics even as I hammer the fast-forward button on the emulator long after the rest have disappeared. Hitting it with another fireball or hitting one of the other ones with a fireball will sometimes fix this. No idea what's causing it since the timer should always either be decreasing or zero at all times...

Another issue I've run into is that if I trigger a few of these sprites and run off the screen, they continue to be active (the screen doesn't darken to its default). I believe this one could be fixed by zeroing the timer when the sprite is offscreen, but I'm not sure where to put that bit of code. Any ideas? (Though it might also fix the issue, I do not want this sprite to process while offscreen as I may be using several of them in a single level)

Also, I'd like Mario's fireball to be destroyed when it hits one of these sprites. As things are now, they just pass straight through and a single fireball can trigger more than one. How would I do that?

Not related to the sprite itself, but as part of the effect I'm trying to achieve, how would I check to see if one of Mario's fireballs is on the screen? I'd like to have those lighten the screen as well.
I have a hack thread - Link (Now with a demo!)
Also a music thread - Link

C3 Projects
2013: Modern Spiny Pack
2012: MGSS v0.1
Spring 2010: SMB2 Autobomb Sprite
Originally posted by mzuenni
I already looked in the rom map but i cant find anything...

From ROM map...
20580 | $04:8380 | 1 byte | Misc. | Change to 00 to disable looking around the overworld map

Use a hex editor to accomplish this.
I DON'T WANT TO DISABLE LOOKING AROUND!

i just want to disable scrolling when mario goes to the side of the screen ...
You would have to search for the OW scrolling code in all.log and disable that. Use a debugger to help you find it, I guess. I found a lot of stuff related to OW scrolling in the RAM Map but pretty much all of them are related to the free scrolling mode function so I'm not really sure.

How would I teleport Mario to a level when he continues a saved game, rather than teleporting him to the OW? Would it be possible to teleport the player to the same level (C5) as if a new game was used? I have tried a lot of things, including setting $0109 to #$E9 in level C7 using levelASM but nothing has worked for me so far. Any help would be appreciated.
It's me again. I've been reading through a few other tutorials and such. I found a "make an Xkas patch" one on the tutorial board.

I read through, because I want to make my little ASM work into it's own patch so I can play with Level asm for other purposes.
(Code's in my files if anyone wants to look. In short it lets mario charge bigger fireballs)

I've gotten this far

header
lorom

org $1081D8

With that address being freespace.

But I'm not quiiite sure what to hijack, or where to even begin looking in the Rom map or All.log.
So, if anyone would indulge me yet again. I would appreciate it.
Uh. I always forget what to put here.
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 418
  • 419
  • 420