Actions

SCHG How-to

Difference between revisions of "Fix Blue Knuckles"

From Sonic Retro

m (Text replacement - "</asm>" to "</syntaxhighlight>")
m (Text replacement - "<asm>" to "<syntaxhighlight lang="asm">")
Line 11: Line 11:
 
The problem with making Blue Knuckles a playable character, however, is that he is not blue in the Special Stages, and most of his level events fail to work. In the Special Stages, he transforms into Sonic (lol). These errors happen, because Sega, in the asm code of S3&K (sonic3k.asm), mostly used comparison statements such as this:
 
The problem with making Blue Knuckles a playable character, however, is that he is not blue in the Special Stages, and most of his level events fail to work. In the Special Stages, he transforms into Sonic (lol). These errors happen, because Sega, in the asm code of S3&K (sonic3k.asm), mostly used comparison statements such as this:
  
<asm>
+
<syntaxhighlight lang="asm">
 
cmpi.w #3,(Player_mode).w
 
cmpi.w #3,(Player_mode).w
 
bne.s [label]
 
bne.s [label]
Line 20: Line 20:
 
The other comparison statement that is causing problems is in this format:
 
The other comparison statement that is causing problems is in this format:
  
<asm>
+
<syntaxhighlight lang="asm">
 
cmpi.w #3,(Player_mode).w
 
cmpi.w #3,(Player_mode).w
 
beq.s [label]
 
beq.s [label]
Line 33: Line 33:
 
It should look something like this:
 
It should look something like this:
  
<asm>
+
<syntaxhighlight lang="asm">
 
; loc_C802
 
; loc_C802
 
SaveScreen_MainLoop:
 
SaveScreen_MainLoop:
Line 54: Line 54:
  
 
Change this:
 
Change this:
<asm>
+
<syntaxhighlight lang="asm">
 
addq.w #1,d1
 
addq.w #1,d1
 
cmpi.w #3,d1
 
cmpi.w #3,d1
Line 60: Line 60:
  
 
To this:
 
To this:
<asm>
+
<syntaxhighlight lang="asm">
 
addq.w #1,d1
 
addq.w #1,d1
 
cmpi.w #4,d1
 
cmpi.w #4,d1
Line 68: Line 68:
 
It should look something like this:
 
It should look something like this:
  
<asm>
+
<syntaxhighlight lang="asm">
 
Obj_SaveScreen_NoSave_Slot:
 
Obj_SaveScreen_NoSave_Slot:
 
move.b #$F,$1D(a0)
 
move.b #$F,$1D(a0)
Line 79: Line 79:
  
 
Change this:
 
Change this:
<asm>
+
<syntaxhighlight lang="asm">
 
addq.w #3,d0
 
addq.w #3,d0
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
To this:
 
To this:
<asm>
+
<syntaxhighlight lang="asm">
 
addq.w #4,d0
 
addq.w #4,d0
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 90: Line 90:
 
Afterwards, goto subprgm sub_D6D0; it should look like this:
 
Afterwards, goto subprgm sub_D6D0; it should look like this:
  
<asm>
+
<syntaxhighlight lang="asm">
 
sub_D6D0:
 
sub_D6D0:
  
Line 109: Line 109:
  
 
Change this:
 
Change this:
<asm>
+
<syntaxhighlight lang="asm">
 
cmpi.w #3,d0
 
cmpi.w #3,d0
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
To this:
 
To this:
<asm>
+
<syntaxhighlight lang="asm">
 
cmpi.w #4,d0
 
cmpi.w #4,d0
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 121: Line 121:
 
It should look like this:
 
It should look like this:
  
<asm>
+
<syntaxhighlight lang="asm">
 
loc_D6EE:
 
loc_D6EE:
 
lsr.w #1,d1
 
lsr.w #1,d1
Line 132: Line 132:
  
 
Change this:
 
Change this:
<asm>
+
<syntaxhighlight lang="asm">
 
moveq #3,d0
 
moveq #3,d0
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
To this:
 
To this:
<asm>
+
<syntaxhighlight lang="asm">
 
moveq #4,d0
 
moveq #4,d0
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 148: Line 148:
 
It should look like this:
 
It should look like this:
  
<asm>
+
<syntaxhighlight lang="asm">
 
loc_7F46:
 
loc_7F46:
 
btst #5,(Ctrl_1_pressed).w
 
btst #5,(Ctrl_1_pressed).w
Line 159: Line 159:
  
 
Change this:
 
Change this:
<asm>
+
<syntaxhighlight lang="asm">
 
cmpi.w #4,(Player_option).w
 
cmpi.w #4,(Player_option).w
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
To this:
 
To this:
<asm>
+
<syntaxhighlight lang="asm">
 
cmpi.w #5,(Player_option).w
 
cmpi.w #5,(Player_option).w
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 21:45, 20 December 2015

Most people do not know, but in S3&K, there is a “hidden character” that is “unlockable” via Game Genie/Action Replay codes. This hidden character is Blue Knuckles. He is more than a palette change of the normal Red Knuckles; actually, he is identified internally as the character used for values greater than 3 for the variable player_mode. This variable, as the name states, determines what character(s) are in the game. The values are as follows:

  • 0. Sonic & Tails
  • 1. Sonic alone
  • 2. Tails alone
  • 3. Red Knuckles
  • 4+.Blue Knuckles

The problem with making Blue Knuckles a playable character, however, is that he is not blue in the Special Stages, and most of his level events fail to work. In the Special Stages, he transforms into Sonic (lol). These errors happen, because Sega, in the asm code of S3&K (sonic3k.asm), mostly used comparison statements such as this:

	cmpi.w		#3,(Player_mode).w
	bne.s		[label]

The label jumped to in statements like that would do something specific for when the player_mode is NOT 3 (Red Knuckles). Blue Knuckles is player_mode ID #4, so, with that statement, the game would goto the label meant for Sonic &/or Tails player modes, which is not what we want. We want Blue Knuckles to do the code after the bne.s, which is meant for Red Knuckles. This guide will fix statements of this format

The other comparison statement that is causing problems is in this format:

	cmpi.w		#3,(Player_mode).w	
	beq.s		[label]

If player_mode is #3 (Red Knuckles), the game will jump to a label for special processing for Knuckles events &c. If player_mode is NOT #3 (Red Knuckles), then the game will execute code for Sonic &/or Tails. Since Blue Knuckles (ID #4) is NOT ID #3, the game will execute Sonic &/or Tails code for Blue Knuckles, which is not what we want. We want Blue Knuckles to execute code for Red Knuckles. This guide will also fix statements of this format.


However, before we fix level events and other similar things for Blue Knuckles, let us make him a character that can be selected through ordinary means, without GG/AR codes. First, let us make him a selectable character in the Save Screen.

In the sonic3k.asm file in your S3&K .svn disasm, goto label SaveScreen_MainLoop / loc_C802 It should look something like this:

; loc_C802
SaveScreen_MainLoop:
		move.b	#$1E,(V_int_routine).w
		jsr	(Wait_VSync).l
		addq.w	#1,(Level_frame_counter).w
		jsr	(Process_Sprites).l
		move.w	(Camera_X_pos_copy).w,d0
		neg.w	d0
		move.w	d0,(H_scroll_buffer+2).w
		jsr	(Render_Sprites).l
		lea	(Normal_palette_line_3+$2).w,a0
		moveq	#$E,d0
		move.w	($FFFFE666).w,d1
		addq.w	#1,d1
		cmpi.w	#3,d1
		bcs.s	+
		moveq	#0,d1

Change this:

		addq.w	#1,d1
		cmpi.w	#3,d1

To this:

		addq.w	#1,d1
		cmpi.w	#4,d1

Then, goto label Obj_SaveScreen_NoSave_Slot / Obj_SaveScreen_D30C It should look something like this:

Obj_SaveScreen_NoSave_Slot:
		move.b	#$F,$1D(a0)
		move.w	($FFFFEF4C).w,d0
		addq.w	#3,d0
		move.b	d0,$22(a0)
		tst.b	($FFFFEF4B).w
		bne.s	loc_D396

Change this:

	addq.w	#3,d0

To this:

	addq.w	#4,d0

Afterwards, goto subprgm sub_D6D0; it should look like this:

sub_D6D0:

		moveq	#0,d2
		tst.w	($FFFFB07A).w
		bne.s	loc_D6FA
		move.b	(Ctrl_1_pressed).w,d1
		lsr.w	#1,d1
		bcc.s	loc_D6EE
		moveq	#$5B,d2
		addq.w	#1,d0
		cmpi.w	#3,d0
		bls.s	loc_D6FA
		moveq	#0,d0
		bra.s	loc_D6FA
; ---------------------------------------------------------------------------

Change this:

	cmpi.w	#3,d0

To this:

	cmpi.w	#4,d0

Furthermore, goto label loc_D6EE. It should look like this:

loc_D6EE:
		lsr.w	#1,d1
		bcc.s	loc_D6FA
		moveq	#$5B,d2
		subq.w	#1,d0
		bpl.s	loc_D6FA
		moveq	#3,d0

Change this:

	moveq	#3,d0

To this:

	moveq	#4,d0

Those modifications changed the max player_mode for the Save Screen, from #3 (Red Knuckles) to #4 (Blue Knuckles). Note that Blue Knuckles’ picture in the Save screen shows part of the “Del” sign seen when deleting a save, instead of a picture of a blue Knuckles. You will have to repoint manually the art to a suitable picture for blue knuckles. Use SonMapED and modify General\Save Menu\Map - Save Screen General.asm

Next, we will fix the character select for the Level Select screen. This character selection is done by pressing C on the level select screen. Pressing C will increment the player_mode. As before, we will change the max character from #3 (Red Knuckles) to #4 (Blue Knuckles).

There is only on step to fix it here. Goto loc_7F46 . It should look like this:

loc_7F46:
		btst	#5,(Ctrl_1_pressed).w
		beq.s	locret_7F60
		addq.w	#1,(Player_option).w
		cmpi.w	#4,(Player_option).w
		bcs.s	locret_7F60
		move.w	#0,(Player_option).w

Change this:

	cmpi.w	#4,(Player_option).w

To this:

	cmpi.w	#5,(Player_option).w

Now that Blue Knuckles is now available for selection by normal means, we still have to fix all of his level events and other bugs. To do so, we will have to fix the player_mode comparison statements that were shown before. Search for every instance of “cmpi.w #3, (player_mode).w"

If the statement afterwards is “beq.s [label]”, change it to “bcc.s [label]”. If the statement afterwards is “bne.s [label]”, change it to “bcs.s [label]”.

If you did all of the replacements correctly, all of the level events and most other things for Blue Knuckles will work. But wait! In replacing ALL of those conditional statements, you inadvertently made player #4 (Blue Knuckles) red and fixed the bugs that made him blue! The following steps will restore the bugs that made player #4 blue.

Goto the following labels and revert what you changed back to the original code; i.e. change “bcc.s [label]” to “beq.s [label]”. i.e. change “bcs.s [label]” to “bne.s [label]”.


The labels, and what reverting the code back does:

  • loc_61BE-Makes player #4 blue above water.
  • loc_7A18-Makes player #4 blue underwater.
  • loc_8284-Makes player #4 blue in Special Stages.

If you did that step and all of the other steps right, you should now be able to select Blue Knuckles from the Save and Level Select Screens. Most of the bugs involving Blue Knuckles should be fixed now too.

There are some bugs that I am still trying to fix with Blue Knuckles

  • He is messed up in the Slot Bonus Stage.
  • Blue Super/Hyper Knuckles turns Red.
  • There is no end-of-level sign for Blue Knuckles (the top half disappears when the results appear).

Anyways, enjoy your new “Character”!