News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: How to make fireballs in smb1 could ruin the bricks?  (Read 3652 times)

lancuster

  • Jr. Member
  • **
  • Posts: 45
    • View Profile
How to make fireballs in smb1 could ruin the bricks?
« on: December 23, 2017, 05:34:08 am »
Tell me, please, what and where to change to fireballs could break bricks. Thanks. :)

FAST6191

  • Hero Member
  • *****
  • Posts: 2374
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #1 on: December 23, 2017, 05:47:31 am »
So bricks already have a break feature, fireballs have a collision one. Should not be too taxing to unite the two. It is usually the sort of thing you would want to figure out yourself as it is not entirely trivial.
Bonus for you is Mario is very well documented.

http://datacrystal.romhacking.net/wiki/Super_Mario_Bros.:ROM_map#Fireballs covers some of the behaviour of fireballs. The bounces off blocks thing has me interested but I don't know if that is jump mapping it to the behaviour of shells.

http://datacrystal.romhacking.net/wiki/Super_Mario_Bros.:ROM_map#Palettes covers some of the palettes, now that is just palettes but anything that uses it will hopefully reference it. That means you can use it as a start of a debugging session -- the thing that tells it to use that being hit/breaking palette (which is different to the static brick palette) will likely also be handling the breaking actions or be right around there. Find the breaking brick check/action and make the fireball explosion effect also trigger that. You may have to have some fun with the return jumps but cross that bridge as and when.

lancuster

  • Jr. Member
  • **
  • Posts: 45
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #2 on: December 23, 2017, 08:04:21 am »
I read but did not understand. The behavior of the balls is changed, but the units do not explode. I do not understand how to implement it. :(

nesrocks

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • nesrocks.com
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #3 on: December 23, 2017, 08:37:36 am »
I read but did not understand. The behavior of the balls is changed, but the units do not explode. I do not understand how to implement it. :(
Learn assembly, analyze the code, read the documentation and figure it out. I think you also need to expand the rom for extra rom space so you can insert your new code, as I recall this game has no free space.
edit: oh you know assembly, okay, what he means is you need to understand the game's code. When mario hits a block the block breaks, the game already has code for breaking blocks. So you tell the game to use that same code when a fireball hits a block.

lancuster

  • Jr. Member
  • **
  • Posts: 45
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #4 on: December 23, 2017, 08:52:42 am »
Learn assembly, analyze the code, read the documentation and figure it out. I think you also need to expand the rom for extra rom space so you can insert your new code, as I recall this game has no free space.
edit: oh you know assembly, okay, what he means is you need to understand the game's code. When mario hits a block the block breaks, the game already has code for breaking blocks. So you tell the game to use that same code when a fireball hits a block.
I only made fireballs that makes solid blocks invisible:

nesrocks

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • nesrocks.com
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #5 on: December 23, 2017, 04:42:49 pm »
I wanted to find a complete cdl file for use with fceux that had every byte usage covered but I was surprised there isn't one for this game. I thought there should be, this being one of the most well documented games ever.

nesrocks

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • nesrocks.com
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #6 on: December 23, 2017, 05:54:16 pm »
Well, cool but that cdl file seems to be largely incomplete.

phalanX

  • Jr. Member
  • **
  • Posts: 24
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #7 on: December 23, 2017, 07:27:13 pm »
What the hell is a cdl file, guys?

nesrocks

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • nesrocks.com
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #8 on: December 23, 2017, 07:32:15 pm »
What the hell is a cdl file, guys?
It is the file generated by the code data logger. When you have the code data logger running it generates a file that contains information for what bytes in the rom were read/executed, etc. So when you open the hex editor you can see which bytes are unused (probably, considering you didn't miss executing/reading any while playing, which is why it is good to make backups and notes so if a bug appears you can fix it with ease).

http://www.fceux.com/web/help/fceux.html?HexEditor.html

edit: I have painstakingly generated a cdl file as complete as I can make for the original game, just for the sake of curiosity. It has $195 (1,24%) free bytes on PRG and $36 (0,66%) on CHR. I have no idea if it can be improved but I did go through every level, sub area, warp zone 2 player mode etc that I could think of. As expected, going to minus world doesn't do anything. Of the bg CHR, the tiles letter J, F are unused, and tile $9A. Tile $FF was partially used, meaning it was read from instead of used as a tile. All of the sprite tiles were used.
« Last Edit: December 23, 2017, 10:29:36 pm by nesrocks »

Psyklax

  • Hero Member
  • *****
  • Posts: 743
    • View Profile
    • Psyklax Translations
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #9 on: December 24, 2017, 01:52:33 am »
code data logger

Now that's a handy little tool, think I might use that in future. I'd still be wary of touching anything though, but I can see how it'd be tempting in a game with so little free space. Then again, in my experience it's not the point whether it has free space in the ROM but whether there's free space in the part that's loaded into RAM at the moment you need it.

lancuster

  • Jr. Member
  • **
  • Posts: 45
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #10 on: December 24, 2017, 04:00:22 am »
nesrocks, so it does not fix it? I'm not good at code, so I asked to help out. I can not understand how to implement it correctly.

nesrocks

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • nesrocks.com
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #11 on: December 24, 2017, 07:45:23 am »
So you always expand your roms or hack only games with clearly unused bytes like sequences of 00 or $FF? The code data logger is really useful to get the most of the rom, specially without expanding it. Sometimes you can check the unused code itself to see that there's no way it can be called and is just leftover code. Some other times there are branches that never go to it, and you can analyze that to know if there's a chance it will be used or not. But this is why I always take notes of which bytes I changed, so if a bug happens I can move my code to a new place.

About the topic, add 20EDBC60 to 0x6204 and the block will be destroyed, but there are a few more things going on. You will need to create an exclusive routine that is like the one at BCED that doesn't do the extra stuff and then call it instead.
« Last Edit: December 24, 2017, 08:12:13 am by nesrocks »

Teeporage777

  • Jr. Member
  • **
  • Posts: 74
  • rom hacker of mario games
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #12 on: December 24, 2017, 10:38:15 am »
I believe MasaYuu made a patch for it. i have it.  http://www.romhacking.net/scratchpad/10707/
"..But it doesn't matter. Nothing matters anymore.."

lancuster

  • Jr. Member
  • **
  • Posts: 45
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #13 on: December 24, 2017, 12:57:37 pm »
So you always expand your roms or hack only games with clearly unused bytes like sequences of 00 or $FF? The code data logger is really useful to get the most of the rom, specially without expanding it. Sometimes you can check the unused code itself to see that there's no way it can be called and is just leftover code. Some other times there are branches that never go to it, and you can analyze that to know if there's a chance it will be used or not. But this is why I always take notes of which bytes I changed, so if a bug happens I can move my code to a new place.

About the topic, add 20EDBC60 to 0x6204 and the block will be destroyed, but there are a few more things going on. You will need to create an exclusive routine that is like the one at BCED that doesn't do the extra stuff and then call it instead.
Unfortunately, the bounce up after the destruction of the bricks by fireball is not the worst. If you go ahead and try to destroy the pipes - the screen will turn grey, the hero will disappear and sprites of Bowser will be jumping. How to deal with this problem?





December 25, 2017, 09:34:04 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Teeporage777, in this hack Mario can shoot blocks or didn't?
« Last Edit: December 25, 2017, 09:34:04 am by lancuster »

Teeporage777

  • Jr. Member
  • **
  • Posts: 74
  • rom hacker of mario games
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #14 on: December 25, 2017, 08:07:05 pm »
with the patch i provided, fireballs destroy bricks.
"..But it doesn't matter. Nothing matters anymore.."

lancuster

  • Jr. Member
  • **
  • Posts: 45
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #15 on: December 26, 2017, 06:27:21 am »
with the patch i provided, fireballs destroy bricks.
Okay, but where is it? Page is forbidden.
And yet. How to erase a sprite reverse? I plan to do a hack with Chuck Norris. :)

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6579
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #16 on: December 26, 2017, 02:25:17 pm »
I believe MasaYuu made a patch for it. i have it.  http://www.romhacking.net/scratchpad/10707/
Do not upload anything to the Scratchpad unless it is for a RHDN sumbission. Nobody but the Staff will be able to see it.
Find one of the file hosting sites on the Internet and upload it there.
"My watch says 30 chickens" Google, 2018

Teeporage777

  • Jr. Member
  • **
  • Posts: 74
  • rom hacker of mario games
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #17 on: December 26, 2017, 06:47:12 pm »
Do not upload anything to the Scratchpad unless it is for a RHDN sumbission. Nobody but the Staff will be able to see it.
Find one of the file hosting sites on the Internet and upload it there.
Thank you for informing me.
"..But it doesn't matter. Nothing matters anymore.."

lancuster

  • Jr. Member
  • **
  • Posts: 45
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #18 on: December 28, 2017, 10:17:17 am »
I appeal to all who made Mario hack. Anyone know how to remove reverse of the sprites in some frames, Mario and some enemies? How to find these values?

edale

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Re: How to make fireballs in smb1 could ruin the bricks?
« Reply #19 on: December 31, 2017, 01:45:30 am »
https://gist.github.com/1wErt3r/4048722

Looks like that is a 100% complete disassembly of SMB1, not sure how it compares to the one on datacrystal.

I don't know ASM, so I can't really help with this too much, but shouldn't this be as simple as locating the code that runs when a collision between a brick and a fireball happens, and changing the routine to jump to where the block destruction code is. That's what, a single 3-4 byte change?

*edit- Looks like the brick shatter code is at line 7379 in the link I gave you. Though I can't find the section for fireball collisions with bricks.
« Last Edit: December 31, 2017, 01:56:34 am by edale »