Actions

SCHG How-to

Add Extra Characters

From Sonic Retro

(Original guide by Sonic 65)

Multiple characters is a fad in hacks nowadays, but not everyone knows how to add multiple characters to their hacks. That's what this tutorial is here for. This tutorial assumes you have basic knowledge of how to use a split disassembly, and is assuming you are using Hivebrain's 2005 and the SVN and GitHub disassembly. It is also assuming that your art fits with Sonic's mappings.

First of all, extract the art that you want from the ROM. You could do this by splitting it, or going into a hex editor and extracting the portion you want into a seperate file. Either way, once you have your file, put it into the 'artunc' folder of your split disassembly. My file is named 'msonic.bin', but yours could be named anything; just replace all instances of 'msonic.bin' that I say with your file's name.

The first step is to search for 'Art_Sonic:' in your disassembly. The result of the search should look something like this:

; ---------------------------------------------------------------------------
; Uncompressed graphics    - Sonic
; ---------------------------------------------------------------------------
Art_Sonic:	incbin	artunc\sonic.bin; Sonic
		even

Now, copy that data and paste it below. Then change Art_Sonic to another label, and replace the sonic.bin with your filename. My result was this:

; ---------------------------------------------------------------------------
; Uncompressed graphics    - Metal Sonic
; ---------------------------------------------------------------------------
Art_MetalSonic:	incbin	artunc\msonic.bin; Metal Sonic
		even

Next, you have to decide how you want to have your character be chosen. I chose to make the character Metal Sonic if B was pressed at the title screen. For the purposes of this tutorial, I will assume you want to do it that way too. So search for 'loc_3230:'. You should find something like this:

loc_3230:
		tst.w	($FFFFF614).w
		beq.w	Demo
		andi.b	#$80,($FFFFF605).w; check if Start is pressed
		beq.w	loc_317C; if not, branch

After the beq.w Demo, put this in:

Title_CheckForB:
		cmpi.b	#$10, ($FFFFF605).w	; has B been pressed?
		bne.s	StartCheck		; if not, branch

Title_SecondCharacter:
		move.b	#$01, ($FFFFFFF9).w	; set the multiple character flag to $01 (indicating Metal Sonic)
		move.b	#$B5,d0			; put value of ring sound into d0
		bsr.w	PlaySound_Special	; jump to the subroutine that plays the sound currently in d0 ($B5, at the moment)

StartCheck:

This checks if B is pressed, and sets a flag at $FFFFFFF9 if it is. It also plays the ring sound (which is $B5 in the sound test). You can change the sound it plays by changing $B5 to the sound test value of whatever sound you want to play.

Now, go to the LoadSonicDynPLC subroutine in the Hivebrain disassembly or open up SonicLoad GFX under _incobj in the GitHub/SVN disassembly and find this instruction:

		lea    (Art_Sonic).l,a1

Replace it With:

		cmpi.b	#$01, ($FFFFFFF9).w	; is the multiple character flag set to $01 (Metal Sonic)?
		bne.s	SonicArtLoad		; if not, load Sonic's art
		lea	(Art_MetalSonic).l,a1	; load Metal Sonic's art
		bra.s	ContLoadPLC		; branch to rest of code

SonicArtLoad:
		lea	(Art_Sonic).l, a1	; load Sonic's art

ContLoadPLC:

For the Hivebrain disassembly and

		cmpi.b	#$01, ($FFFFFFF9).w	; is the multiple character flag set to $01 (Metal Sonic)?
		bne.s	@SonicArtLoad		; if not, load Sonic's art
		lea	(Art_MetalSonic).l,a1	; load Metal Sonic's art
		bra.s	@loadtile		; branch to rest of code

@SonicArtLoad:
		lea	(Art_Sonic).l, a1	; load Sonic's art

@loadtile:

for the GitHub/SVN disassemblies

This code tests if the multiple character flag (which we set to $01 if you pressed B at the title screen) is set to $01. If it isn't, it just loads Sonic's art like normal and continues to the ContLoadPLC subroutine. If it is, it loads Metal Sonic's art and jumps directly to the ContLoadPLC subroutine (so that we don't load Sonic's art at all).

And...that's all. Compile the code, and if you run into any errors you either chose a subroutine name that was already taken or did something else wrong. Have fun putting new characters in your hacks!

SCHG How-To Guide: Sonic the Hedgehog (16-bit)
Fixing Bugs
Fix Demo Playback | Fix a Race Condition with Pattern Load Cues | Fix the SEGA Sound | Display the Press Start Button Text | Fix the Level Select Menu | Fix the Hidden Points Bug | Fix Accidental Deletion of Scattered Rings | Fix Ring Timers | Fix the Walk-Jump Bug | Correct Drowning Bugs | Fix the Death Boundary Bug | Fix the Camera Follow Bug | Fix Song Restoration Bugs | Fix the HUD Blinking | Fix the Level Select Graphics Bug
Changing Design Choices
Change Spike Behavior | Fix Special Stage Jumping Physics | Improve the Fade In\Fade Out Progression Routines | Fix Scattered Rings' Underwater Physics | Remove the Speed Cap | Port the REV01 Background Effects | Port Sonic 2's Level Art Loader | Retain Rings Between Acts | Add Sonic 2 (Simon Wai Prototype) Level Select | Improve ObjectMove Subroutines
Adding Features
Add Spin Dash ( Part 1 / Part 2 / Part 3 / Part 4 ) | Add Eggman Monitor
Sound Features
Expand Music Index From $94 to $9F | Extend Music Slots | Play Different Songs Per Act | Expand Music Index to Start at $00 | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver
Extending the Game
Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ Load Alternate Art | Add a New Zone | Set Up the Goggle Monitor | Add New Moves | Add a Dynamic Collision System | Dynamic Special Stage Walls System | Extend Sprite Mappings and Art Limit | Enigma Credits
Miscellaneous
Convert the Hivebrain 2005 Disassembly to ASM68K
Split Disassembly Guides
Set Up a Split Disassembly | Basic Level Editing | Basic Art Editing | Basic ASM Editing (Spin Dash)