SMB1 help: SMB2J Luigi Physics and Enemy Palette Assignments

Started by segwayspeedracer, May 26, 2016, 09:44:37 PM

Previous topic - Next topic

segwayspeedracer

Hello all,

I have a few questions about SMB for a project in development:

SMB1 questions: Is there a way using Translhextion to do the following:

1) Edit the Mario jumping and sliding physics to match Luigi's from SMB2J. I used the YY Luigi patch to add in the "bouncing off koopas" physics, but when I used the Reverse Red Piranha Plant and Pipes patches, I lost the Luigi option in the game. Not sure what exactly I need to do, or if I need to use the Disassembly and compile a game from scratch.

2) Determine which GFX in the game will be read as "horizontally flipped". I'm running tight on graphics space, and if I had a way for the SMB game to flip certain GFX before being applied to a sprite, I would save a lot of space. What I mean is, is there a way I can tell the top-right quarter of a goomba sprite to horizontally flip the sprite, so I can double dip the GFX I use for a goomba head.



3) Determine which palette an enemy is assigned to. I believe that it may be a simple fix since the patch to replace Green Piranha Plants with Red ones only had a 4 byte change. I believe one of these bytes controlled the palette assignment. I've been reading through the Disassembly and I haven't seen anything obvious. For example, can I make the Hammer Bros pull from the same palette as the Red Koopa, without changing the original Green Palette that the HB is pulling from?

Thank you for your help!

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

Postscript:

I went ahead and attached pictures of the two sibling hacks pretty much done, aside from these few things. One stars Mario, one Luigi. I've been working on this since 2009 for fun as a relaxing break from college. I'm posting pictures to generate interest in the inquiry, since people are more visual than textual.





Disclaimer, since its been 7 years and hadn't any intention of releasing it until I launched a beta in 2011-ish, I need to sit down and research the origin of the graphics I used, gain permission from the authors, and credit them in an instruction manual type document. I do not claim credit for graphics I have not created. If you recognize something as yours within these images, please let me know so I can credit you!


May 28, 2016, 10:38:06 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

For record keeping purposes:

This video https://www.youtube.com/watch?v=vIcF8txRe1M by {mD}ζϊ®☆ on YouTube pretty much answers all of my questions, with the exception of sprite mirroring. Apparently it's a pretty obscure process. Credit to this user for all of his great research/work.

Keep in the mind the following for sprite palettes:

0 = Player Palette (Sprite will actually change immediately depending on if Mario, Luigi, or Fire Mario/Luigi is playing).
1 = Green Palette (Green Koopas, Lakitu, 1up Shroom)
2 = Red Palette (Red Koopas, Fireballs)
3 = White/Yellow Palette (Goombas, Bullet Bills)

I linked his documents here:

An example of what these numbers (usually) mean:

02 - 0=No mirroring, 2=Use palette 2
21 - 2=Goes behind background/objects, no mirroring, 1=Use palette 1
41 - 4=Mirror tile(s) horizontally, 1=Use palette 1
83 - 8=Mirror tile(s) vertically, 3=Use palette 3
C0 - C=Mirror tile(s) horizontally + vertically, 0=Use palette 0


SPRITE ATTRIBUTES (HOW TILES ARE MIRRORED, WHETHER THEY GO BEHIND BACKGROUND + OBJECTS, WHICH PALETTE SET THEY USE)


OFFSET----------DESCRIPTION
55C, 667E-------Used by Points/1-UP
523C, 5244-----Used by Bowser's Fire
538E-------------Used by Flags (Castle)
6472-------------Used by Tree of Beans
64E8 - 64EB----[pre][/pre]Used by Hammers
6582 ------------Used by Flags/Points from Flags (02 and 03 mirrors points from flags)
6614-------------Used by Lifts, Lifts (Clouds)
66C2, 66C7-----Used by Bounced Coins
66DE-------------Used by Mushrooms
66DF-------------Used by Fire Flowers (Stems)
66E1-------------Used by 1UP Mushrooms
686B, 6879-----Used by Green Koopa Troopas, Paratroopas

686C, 686E, 687A-------------Used by Red Koopa Troopas, Paratroopas

686D ------------Used by Buzzy Beetles
6870-------------Used by Hammer Bros.
6871-------------Used by Goombas
6872-------------Used by Bloobers
6875-------------Used by Slow Cheep-cheeps
6876, 687F-----Used by Cheep-cheeps
6877-------------Used by Podoboos
6878-------------Used by Pirana Plants

687C, 6B31, 6B39,
6B48, 6B52, 6B5A-------------Used by Lakitu

687D-------------Used by Spinys, Spiny's Eggs
6880, 6ADF-----Used by Mushroom Retainers/Princess Toadstool
6881, 6882------Used by Bowser

6883 - 6885, 6B65-------------Used by Jump Stands

68D5-------------Used by Bullet Bills
6BEC-------------Used by Bounced Bricks
6C70-------------Used by Brick Pieces
6D0D-------------Used by Fireballs

6D5D, 6D62,
6D67, 6D6C-------------Used by Fireworks

6E12-------------Used by Bubbles


-------------------------------------------------------------------------------------------------------
EDIT2, for record keeping purposes.

To get Luigi's physics into the main player of SMB, use a hex editor to go to the following address:

Starting from x3434 to x345A (this is 38 bytes).

You'll see this code:


20 20 1E 28 28 0D 04
70 70 60 90 90 0A 09
FC FC FC FB FB FE FF
00 00 00 00 00 80 00
D8 E8 F0
28 18 10
0C
E4 98 D0


The code above is Mario's physics. Take from smb2j's disassembly, modify the code to the following below:


18 18 18 22 22 0D 04
42 42 3E 5D 5D 0A 09
FC FC FC FB FB FE FF
00 00 00 00 00 80 00
D8 E8 F0
28 18 10
0C
B4 68 50


You'll notice only the 1st, 2nd and last lines were modified. These lines of code represent the following:

JumpForceData (gravity resistance moving upward)
FallMForceData (gravity resistance moving downward)
FrictionData (How much the player slides when running, jogging, and walking).

The very last byte from smb2j actually is the value A0 (Luigi's slide when having walked). This value didn't seem to translate well into smb1 as Luigi would still skid like Mario, so I used the Luigi patch from YY and took YY's value of 50, to give it a bit more slipperiness.

SOURCE BELOW: smbdis. This expands upon what the Mario physics numbers mean:

HOW TO CHANGE MARIO'S PHYSICS:



JumpMForceData:
.byte $20, $20, $1e, $28, $28, $0d, $04

FallMForceData:
.byte $70, $70, $60, $90, $90, $0a, $09

PlayerYSpdData:
.byte $fc, $fc, $fc, $fb, $fb, $fe, $ff

InitMForceData:
.byte $00, $00, $00, $00, $00, $80, $00

MaxLeftXSpdData:
.byte $d8, $e8, $f0

MaxRightXSpdData:
.byte $28, $18, $10
.byte $0c ;used for pipe intros

FrictionData:
.byte $e4, $98, $d0


JumpMForceData determines how Mario's jumping arc decays when he's moving upward. Larger values make for shorter jump heights.

FallMForceData determines how fast Mario falls. Larger values make for faster fall speeds.

PlayerYSpdData seems to be a negative signed value determining Mario's initial jump force, depending on his current running speed. Values below $fa result in pretty ridiculous jump heights.

MaxLeftXSpdData (negative) and MaxRightXSpdData (positive) determine how fast Mario runs, walks, and water-walks, respecively.

FrictionData determines how much friction applies to Mario given his current speed, from fastest to slowest.

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

EDIT3: Add in skid sound to SMB1

Using the advice from this post, I was able to figure out how to add in the skid noise to smb1. Read the last one from ShaneM:

http://acmlm.kafuka.org/board/thread.php?id=3628

His basic point is that you must remove enough lines of residual code from the SMB Disassembly (found on this website) to make space for the skid code. Keep in mind that he recommends you remove the residual flag balls, which is actually the vertical balls in SMB Utility where the player can climb up vines (NoFPObj) (static ones, not the ones that come from bricks). Don't delete them unless you don't want Mario climbing up vines.

How much do you need to delete for the code to work correctly?

**currently researching. Will return.