Actions

SCHG How-to

Use Dynamic Palettes in Sonic 1

From Sonic Retro

Revision as of 22:26, 2 February 2018 by Shadow05 (talk | contribs) (Created page with "Original guide by PsychoSk8r from SSRG. This will require the Old hivebrain ASM68K Disassembly. ==Pallet Pointers 2&3== To start make copies of Pallet Pointers and rename t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Original guide by PsychoSk8r from SSRG.

This will require the Old hivebrain ASM68K Disassembly.

Pallet Pointers 2&3

To start make copies of Pallet Pointers and rename them Pallet Pointers2&3

Then in Pallet Pointers2 replace the code with this.

	
; ---------------------------------------------------------------------------
; Pallet pointers 2
; ---------------------------------------------------------------------------
	dc.l Pal_SegaBG		; pallet address
	dc.w $FB00		; RAM address
	dc.w $1F		; (pallet length / 2) - 1
	dc.l Pal_Title
	dc.w $FB00
	dc.w $1F
	dc.l Pal_LevelSel
	dc.w $FB00
	dc.w $1F
	dc.l Pal_Sonic
	dc.w $FB00
	dc.w 7
	dc.l Pal_GHZ2
	dc.w $FB20
	dc.w $17
	dc.l Pal_LZ2
	dc.w $FB20
	dc.w $17
	dc.l Pal_MZ2
	dc.w $FB20
	dc.w $17
	dc.l Pal_SLZ2
	dc.w $FB20
	dc.w $17
	dc.l Pal_SYZ2
	dc.w $FB20
	dc.w $17
	dc.l Pal_SBZ1
	dc.w $FB20
	dc.w $17
	dc.l Pal_Special
	dc.w $FB00
	dc.w $1F
	dc.l Pal_LZWater2
	dc.w $FB00
	dc.w $1F
	dc.l Pal_SBZ3
	dc.w $FB20
	dc.w $17
	dc.l Pal_SBZ3Water
	dc.w $FB00
	dc.w $1F
	dc.l Pal_SBZ2
	dc.w $FB20
	dc.w $17
	dc.l Pal_LZSonWater2
	dc.w $FB00
	dc.w 7
	dc.l Pal_SBZ3SonWat
	dc.w $FB00
	dc.w 7
	dc.l Pal_SpeResult
	dc.w $FB00
	dc.w $1F
	dc.l Pal_SpeContinue
	dc.w $FB00
	dc.w $F
	dc.l Pal_Ending
	dc.w $FB00
	dc.w $1F

And in Pallet Pointers3 replace it with this.

	
; ---------------------------------------------------------------------------
; Pallet pointers 3
; ---------------------------------------------------------------------------
	dc.l Pal_SegaBG		; pallet address
	dc.w $FB00		; RAM address
	dc.w $1F		; (pallet length / 2) - 1
	dc.l Pal_Title
	dc.w $FB00
	dc.w $1F
	dc.l Pal_LevelSel
	dc.w $FB00
	dc.w $1F
	dc.l Pal_Sonic
	dc.w $FB00
	dc.w 7
	dc.l Pal_GHZ3
	dc.w $FB20
	dc.w $17
	dc.l Pal_LZ3
	dc.w $FB20
	dc.w $17
	dc.l Pal_MZ3
	dc.w $FB20
	dc.w $17
	dc.l Pal_SLZ3
	dc.w $FB20
	dc.w $17
	dc.l Pal_SYZ3
	dc.w $FB20
	dc.w $17
	dc.l Pal_SBZ1
	dc.w $FB20
	dc.w $17
	dc.l Pal_Special
	dc.w $FB00
	dc.w $1F
	dc.l Pal_LZWater3
	dc.w $FB00
	dc.w $1F
	dc.l Pal_SBZ3
	dc.w $FB20
	dc.w $17
	dc.l Pal_SBZ3Water
	dc.w $FB00
	dc.w $1F
	dc.l Pal_SBZ2
	dc.w $FB20
	dc.w $17
	dc.l Pal_LZSonWater3
	dc.w $FB00
	dc.w 7
	dc.l Pal_SBZ3SonWat
	dc.w $FB00
	dc.w 7
	dc.l Pal_SpeResult
	dc.w $FB00
	dc.w $1F
	dc.l Pal_SpeContinue
	dc.w $FB00
	dc.w $F
	dc.l Pal_Ending
	dc.w $FB00
	dc.w $1F

Then find PalPointers and right below it place this.

	
PalPointers2:
		include "_inc\Pallet pointers2.asm"
PalPointers3:
		include "_inc\Pallet pointers3.asm"

Then replace PalLoad1-4 with this.

	
; ---------------------------------------------------------------------------
; Subroutines to load pallets
; ---------------------------------------------------------------------------

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

PalLoad1:
		move.b ($FFFFFE11),d1
		lea (PalPointers).l,a1
		cmp.b #0,d1
		beq.w PalLoad1_Continue
		lea (PalPointers2).l,a1
		cmp.b #1,d1
		beq.w PalLoad1_Continue
		lea (PalPointers3).l,a1

PalLoad1_Continue:
		lsl.w #3,d0
		adda.w d0,a1
		movea.l (a1)+,a2
		movea.w (a1)+,a3
		adda.w #$80,a3
		move.w (a1)+,d7

loc_2110:
		move.l (a2)+,(a3)+
		dbf d7,loc_2110
		rts
 ; End of function PalLoad1


; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

PalLoad2:
		move.b ($FFFFFE11),d1
		lea (PalPointers).l,a1
		cmp.b #0,d1
		beq.w PalLoad2_Continue
		lea (PalPointers2).l,a1
		cmp.b #1,d1
		beq.w PalLoad2_Continue
		lea (PalPointers3).l,a1


PalLoad2_Continue:
		lsl.w #3,d0
		adda.w d0,a1
		movea.l (a1)+,a2
		movea.w (a1)+,a3
		move.w (a1)+,d7

loc_2128:
		move.l (a2)+,(a3)+
		dbf d7,loc_2128
		rts
; End of function PalLoad2


; ---------------------------------------------------------------------------
; Underwater pallet loading subroutine
; ---------------------------------------------------------------------------

; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||

PalLoad3_Water:
		move.b ($FFFFFE11),d1
		lea (PalPointers).l,a1
		cmp.b #0,d1
		beq.w PalLoad3_Continue
		lea (PalPointers2).l,a1
		cmp.b #1,d1
		beq.w PalLoad3_Continue
		lea (PalPointers3).l,a1

PalLoad3_Continue:
		lsl.w #3,d0
		adda.w d0,a1
		movea.l (a1)+,a2
		movea.w (a1)+,a3
		suba.w #$80,a3
		move.w (a1)+,d7

loc_2144:
		move.l (a2)+,(a3)+
		dbf d7,loc_2144
		rts
; End of function PalLoad3_Water


; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||


PalLoad4_Water:
		move.b ($FFFFFE11),d1
		lea (PalPointers).l,a1
		cmp.b #0,d1
		beq.w PalLoad4_Continue
		lea (PalPointers2).l,a1
		cmp.b #1,d1
		beq.w PalLoad4_Continue
		lea (PalPointers3).l,a1

PalLoad4_Continue:
		lsl.w #3,d0
		adda.w d0,a1
		movea.l (a1)+,a2
		movea.w (a1)+,a3
		suba.w #$100,a3
		move.w (a1)+,d7
loc_2160:
		move.l (a2)+,(a3)+
		dbf d7,loc_2160
		rts
 ; End of function PalLoad4_Water

Adding Much More Palletes

Now this will be the longest part you'll need to add ALOT of palettes.

Oh and you don't need to worry about LZ4.

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 | Fix a remember sprite related bug
Changing Design Choices
Change Spike Behavior | Collide with Water After Being Hurt | 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 | Port Sonic 2 Level Select
Adding Features
Add Spin Dash ( Part 1 / Part 2 / Part 3 / Part 4 ) | Add Eggman Monitor | Add Super Sonic | Add the Air Roll
Sound Features
Expand the Sound Index | Play Different Songs Per Act | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver | Port Flamewing's Sonic 3 & Knuckles Sound Driver | Change The SEGA Sound
Extending the Game
Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ Load Alternate Art | Make Ending 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 | Use Dynamic Palettes
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)