Sonic and Sega Retro Message Board: Dr. Kylstein - Viewing Profile - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help

Group:
Member: Members
Active Posts:
85 (0.03 per day)
Most Active In:
Engineering & Reverse Engineering (58 posts)
Joined:
05-June 08
Profile Views:
4394
Last Active:
User is offline Mar 20 2017 06:47 PM
Currently:
Offline

My Information

Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Not Telling Not Telling

Contact Information

E-mail:
Private

Previous Fields

National Flag:
us

Topics I've Started

  1. Re-creating the Super Peel Out in Sonic 2

    02 December 2008 - 08:54 PM

    I've hastily put this together with code from two different hacks and changed some things at the last minute to simplify it, so I hope it works okay.

    Here's the basic outline:
    1. Set aside two SST variables for the peel out.
    2. Duplicate all the spindash code, changing the labels and variables used.
    3. Modify the check routine to use the looking up animation rather than the ducking animation as the trigger and add a call to it in the normal movement mode.
    4. remove the line(s) that trigger rolling after a peel out.
    5. If I'm not mistaken, you should now have a functioning but strange-looking peel out.
    6. At this point, port the graphics from Sonic CD. You can extract them from one of the level MMD files on the disc with a tile editor, and add them according to the existing tutorials for importing new sonic sprites. Add them to the animation tables for Sonic. Also add another run entry to the end of the Super Sonic animation index so it doesn't glitch out when you peel out as Super Sonic.
    7. Actually getting the animations to be used is rather tricky. At this point, a good understanding of how the existing walk/run animation's code is irreplaceable. (Or, you could just copy.) You must add a third option to the walk or run decision for really high speeds and force it if the peel out flag is set.
    10. I think you should now have something close to Sonic CD's peel out.

    Add this to s2.constants.asm:
    peelout_flag =		$1F	
    peelout_counter =	$20;word
    



    Now the good part, add this after the main spindash routines:
    ; ---------------------------------------------------------------------------
    ; Subroutine to check for starting to charge a peelout
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    
    ; loc_1AC3E:
    Sonic_CheckPeelout:
    	tst.b	peelout_flag(a0)
    	bne.s	Sonic_UpdatePeelout
    	cmpi.b	#7,anim(a0)
    	bne.s	++
    	move.b	(Ctrl_1_Press_Logical).w,d0
    	andi.b	#$70,d0
    	beq.w	++
    	move.b	#$22,anim(a0)
    	move.w	#$E0,d0
    	jsr	(PlaySound).l
    	addq.l	#4,sp
    	move.b	#1,peelout_flag(a0)
    	move.w	#0,peelout_counter(a0)
    	cmpi.b	#$C,air_left(a0); if he's drowning, branch to not make dust
    	bcs.s	+
    	move.b	#2,(Sonic_Dust+anim).w
    +
    	bsr.w	Sonic_LevelBound
    	bsr.w	AnglePos
    +
    	rts
    ; End of subroutine Sonic_CheckSpindash
    
    
    ; ---------------------------------------------------------------------------
    ; Subrouting to update an already-charging spindash
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    
    ; loc_1AC8E:
    Sonic_UpdatePeelout:
    	move.b	(Ctrl_1_Held_Logical).w,d0
    	btst	#0,d0
    	bne.w	Sonic_ChargingPeelout
    
    ; unleash the charged spindash and start rolling quickly:
    ;move.b	#$E,y_radius(a0)
    ;move.b	#7,x_radius(a0)
    	move.b	#1,anim(a0)
    ;addq.w	#5,y_pos(a0); add the difference between Sonic's rolling and standing heights
    	move.b	#0,peelout_flag(a0)
    	moveq	#0,d0
    	move.b	peelout_counter(a0),d0
    	add.w	d0,d0
    	move.w	PeeloutSpeeds(pc,d0.w),inertia(a0)
    	tst.b	(Super_Sonic_flag).w
    	beq.s	+
    	move.w	PeeloutSpeedsSuper(pc,d0.w),inertia(a0)
    +
    	move.w	inertia(a0),d0
    	subi.w	#$800,d0
    	add.w	d0,d0
    	andi.w	#$1F00,d0
    	neg.w	d0
    	addi.w	#$2000,d0
    	move.w	d0,($FFFFEED0).w
    	btst	#0,status(a0)
    	beq.s	+
    	neg.w	inertia(a0)
    +
    ;bset	#2,status(a0)
    	move.b	#0,(Sonic_Dust+anim).w
    	move.w	#$3C+$80,d0; spindash zoom sound
    	jsr	(PlaySound).l
    	bra.s	Obj01_Peelout_ResetScr
    ; ===========================================================================
    PeeloutSpeeds:
    	dc.w  $800; 0
    	dc.w  $880; 1
    	dc.w  $900; 2
    	dc.w  $980; 3
    	dc.w  $A00; 4
    	dc.w  $A80; 5
    	dc.w  $B00; 6
    	dc.w  $B80; 7
    	dc.w  $C00; 8
    PeeloutSpeedsSuper:
    	dc.w  $B00; 0
    	dc.w  $B80; 1
    	dc.w  $C00; 2
    	dc.w  $C80; 3
    	dc.w  $D00; 4
    	dc.w  $D80; 5
    	dc.w  $E00; 6
    	dc.w  $E80; 7
    	dc.w  $F00; 8
    ; ===========================================================================
    
    Sonic_ChargingPeelout:		; If still charging the dash...
    	tst.w	peelout_counter(a0)
    	beq.s	+
    	move.w	peelout_counter(a0),d0
    	lsr.w	#5,d0
    	sub.w	d0,peelout_counter(a0)
    	bcc.s	+
    	move.w	#0,peelout_counter(a0)
    +
    	move.b	(Ctrl_1_Press_Logical).w,d0
    	andi.b	#$70,d0
    	beq.w	Obj01_Peelout_ResetScr
    ;move.w	#$900,anim(a0)
    	move.w	#$E0,d0
    	jsr	(PlaySound).l
    	addi.w	#$200,peelout_counter(a0)
    	cmpi.w	#$800,peelout_counter(a0)
    	bcs.s	Obj01_Peelout_ResetScr
    	move.w	#$800,peelout_counter(a0)
    	
    Obj01_Peelout_ResetScr:
    	addq.l	#4,sp
    	cmpi.w	#$60,(Camera_Y_pos_bias).w
    	beq.s	++
    	bcc.s	+
    	addq.w	#4,(Camera_Y_pos_bias).w
    +	subq.w	#2,(Camera_Y_pos_bias).w
    
    +
    	bsr.w	Sonic_LevelBound
    	bsr.w	AnglePos
    	rts
    ; End of subroutine Sonic_UpdatePeelout
    


    Make Obj01_MdNormal look like this:
    	bsr.w	Sonic_CheckSpindash
    	bsr.w	Sonic_CheckPeelout
    	bsr.w	Sonic_Jump
    	bsr.w	Sonic_SlopeResist
    	bsr.w	Sonic_Move
    	bsr.w	Sonic_Roll
    	bsr.w	Sonic_LevelBound
    	jsr	(ObjectMove).l
    	bsr.w	AnglePos
    	bsr.w	Sonic_SlopeRepel
    


    In Sonic's animation index, after this:
    	dc.w SonAni_LieDown - SonicAniData; 33; $21
    

    add this:
    	dc.w SonAni_HaulAss - SonicAniData; 34; $22
    


    In Super Sonic's animation index, after this:
    	dc.w SonAni_LieDown - SuperSonicAniData	; 33; $21
    

    add this:
    	dc.w SupSonAni_Run - SuperSonicAniData	; 34; $22
    


    In Sonic's animation data, after this:
    SonAni_LieDown:	dc.b   3,  7,$FD,  0
    

    add (your frames might vary, check SonMapEd):
    SonAni_HaulAss:	dc.b $FF,$D6,$D7,$D8,$D9,$FF,$FF,$FF,$FF,$FF
    


    Make this part of SAnim_WalkRun:
    	tst.b	(Super_Sonic_flag).w
    	bne.s	SAnim_Super
    	lea	(SonAni_Run).l,a1; use running animation
    	cmpi.w	#$600,d2	; is Sonic at running speed?
    	bcc.s	+		; use running animation
    	lea	(SonAni_Walk).l,a1; if yes, branch
    	add.b	d0,d0
    

    look like this:
    	tst.b	(Super_Sonic_flag).w
    	bne.s	SAnim_Super
    	lea	(SonAni_HaulAss).l,a1
    	tst.b	peelout_flag(a0)
    	bne.s	+
    	cmpi.w	#$700,d2
    	bcc.s	+
    	lea	(SonAni_Run).l,a1
    	cmpi.w	#$600,d2
    	bcc.s	+
    	lea	(SonAni_Walk).l,a1
    	add.b	d0,d0
    
  2. Comprehensive Genesis programming guide?

    07 November 2008 - 09:39 PM

    I already understand assembly and C. I have read all the Hacking Cult articles and some of things at Eidolon's and Zophar's, but it all seems rather terse and opaque, and I can't seem to put it together. I want to know what I need to do (in words, not under-commented code and obtuse charts) to start everything up and to do video and audio. An explanation of all the different video options would be helpful after that.
    One thing that really bugs me about Nemesis's code template is the pre-assembled z80 code with no explanation of what it really does. I intend to use the Macro Assembler to assemble the code for both processors. (Is there a trick to that I should know, or is the CPU XXXX directive enough?)