News:

11 March 2016 - Forum Rules

Main Menu

Death blocks/munchers in SMB?

Started by Alpdrucken, July 05, 2019, 01:25:45 PM

Previous topic - Next topic

Alpdrucken

Is there a way to create death blocks/munchers in SMB? I've seen a patch for it but it only works with mushroom platforms, I'd like to use a custom block that can be used in any level. Could the data for the poison mushroom be used? There is a patch for it as well.
Thanks a lot in advance.

#

Of course there is. But if you want to add something to the SMB ROM you'll need to remove another object from the game first so the custom object can take its place. This is also what the poison mushroom patch does, it replaces the 1 Up mushrooms. So you'll have to decide what to remove first.

Alpdrucken

Let's say i would want to replace the brick with 10 coins inside, how would i proceed? I'd also need to change the sprite

Cyneprepou4uk

Quote from: Alpdrucken on July 05, 2019, 01:25:45 PM
create death blocks/munchers
You mean mario should die when he hits it or steps on in?

Alpdrucken

Damage you, so if you are Big Mario or Fire Mario you become small.

Cyneprepou4uk

Damage him, right.

First I would find a routine with that coin block, and a routine with damaging a player, and tried to jump from one to another (roughly speaking).

Speaking of changing tile of that block, I think this information should be somewhere in level drawing code.

Alpdrucken

I'm gonna try that but since I don't know much ASM I don't think I'll make it work. I checked the disassembly as well but couldn't find anything useful.

Cyneprepou4uk

Yep, without knowledge of assembly you are pretty much screwed. And for your future questions - most of changes in any game require code reading and editing skill

Alpdrucken

Do you know where I could find a Hex to opcode converter and viceversa? The ones I've found online always give me errors.

Cyneprepou4uk

Debugger in fceux emulator will show you opcodes. But if you really need a converter, use something like 6502d program. Not sure about vice versa though

Alpdrucken

If I post opcodes here will you help me identify the dmg routines?

Cyneprepou4uk

No, I don't think so. First of all, there will be tons of code lines from a game. Second, a romhacker needs to know purpose of particular ram addresses when he reads a code. For example, if you know where an address with mario's power (small, big, fire) is located in ram, you can find routines with this address by setting breakpoints to it, you don't need to look thought ALL existing game's code

Alpdrucken

Yea but I don't know what breakpoint to set to see the dmg routine.

Cyneprepou4uk


Alpdrucken

I set a breakpoint for $0722 which is Sprite0HitDetectFlag and got this when hit by a goomba:


$91D2:8D 22 07  STA $0722 = #$01
$91D5:A9 80     LDA #$80
$91D7:85 FC     STA $FC = #$00
$91D9:AD 5A 07  LDA $075A = #$00
$91DC:10 0B     BPL $91E9
$91DE:A9 00     LDA #$00
$91E0:8D 72 07  STA $0772 = #$03
$91E3:A9 03     LDA #$03
$91E5:8D 70 07  STA $0770 = #$01
$91E8:60        RTS
$91E9:AD 5F 07  LDA $075F = #$00
$91EC:0A        ASL
$91ED:AA        TAX
$91EE:AD 5C 07  LDA $075C = #$00
$91F1:29 02     AND #$02
$91F3:F0 01     BEQ $91F6
$91F5:E8        INX
$91F6:BC BD 91  LDY $91BD,X @ $91BD = #$56
$91F9:AD 5C 07  LDA $075C = #$00
$91FC:4A        LSR
$91FD:98        TYA
$91FE:B0 04     BCS $9204



What could the dmg part be?

Cyneprepou4uk

No, sprite 0 hit doesn't have anything to do with damage, it's a graphics stuff

Alpdrucken

There's this in the disassembly when player is hit by a firebar or a hammer:
jmp InjurePlayer

but I don't know how to find the hex routine starting from the disassembled text.

Cyneprepou4uk

I don't have experience working with disassembly files. If it doesn't show you code location address, try manually convert several opcodes to bytes and search them in fceux hex editor, then go to that address in debugger and set some execute breakpoints there