Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    910
    Location:
    the united states. where else?
    Change this:


    GotThroughAct: ; XREF: Obj3E_EndAct
    tst.b ($FFFFD5C0).w
    bne.s locret_ECEE
    move.w ($FFFFF72A).w,($FFFFF728).w
    clr.b ($FFFFFE2D).w ; disable invincibility
    clr.b ($FFFFFE1E).w ; stop time counter


    To this:


    GotThroughAct: ; XREF: Obj3E_EndAct
    tst.b ($FFFFD5C0).w
    bne.s locret_ECEE
    move.w ($FFFFF72A).w,($FFFFF728).w
    clr.b ($FFFFFE2D).w ; disable invincibility
    clr.b (super_sonic_flag_here).w ; Force Sonic to revert to normal.
    clr.b ($FFFFFE1E).w ; stop time counter

    This should (large emphasis on "should") force Sonic to revert to normal. Again, replace super_sonic_flag_here with your Super Sonic flag's address (or name if equated).
     
    Last edited by a moderator: Aug 9, 2014
  2. AsuharaMoon

    AsuharaMoon kakyoin did you lay this egg Member

    Joined:
    Aug 15, 2013
    Messages:
    67
    A question.

    Happens that I have other sprites (eg, Sonic and Tails from Sonic 2) in Sonic 1, and as you know, the walking's animation form them is a little higher than the original (ie, more than 6 frames). When it's in 90º (normal position) the order is correctly listed, but in 45º's animation, after the 6th frame, no.
    Does anyone know I have to do?, or better, What line should I edit?
     
  3. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    910
    Location:
    the united states. where else?
    Find this bit of code:


    loc_13A9C:
    lea (SonAni_Run).l,a1 ; use running animation
    cmpi.w #$600,d2 ; is Sonic at running speed?
    bcc.s loc_13AB4 ; if yes, branch
    lea (SonAni_Walk).l,a1 ; use walking animation
    move.b d0,d1
    lsr.b #1,d1
    add.b d1,d0

    loc_13AB4:
    add.b d0,d0
    move.b d0,d3
    neg.w d2
    addi.w #$800,d2
    bpl.s loc_13AC2
    moveq #0,d2

    And change it to this (this is assuming you want 8 frames):


    loc_13A9C:
    lea (SonAni_Run).l,a1 ; use running animation
    cmpi.w #$600,d2 ; is Sonic at running speed?
    bcc.s loc_13AB4 ; if yes, branch
    lea (SonAni_Walk).l,a1 ; use walking animation
    add.b d0,d0

    loc_13AB4:
    add.b d0,d0
    move.b d0,d3
    neg.w d2
    addi.w #$800,d2
    bpl.s loc_13AC2
    moveq #0,d2

    This accounts for the change in walking animation length between Sonic 1 and Sonic 2/3&K.
     
  4. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    Thomas, it won't keep him that way. Maybe i'll look back to the Sonic 2 Disassembly for answers.

    This MIGHT help for my "Richter in the Loops". AshuraMoon I've had the same trouble, but with my character Richter Belmont. I had the trouble with Super Sonic but it's fixed now. For porting Sonic 2 things to Sonic 1, look to a sonic 2 Disassembly (taken my own advice)
     
  5. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    910
    Location:
    the united states. where else?
    Trust me, it will help if your character has 8 walking sprites.

    I would go into more detail about it, but at the moment it doesn't seem necessary.

    (Also, I know that Super Sonic fix will work. It's the closest thing to S2. Trust me. I work with S2 all the time and that's more or less what S2 does (except in S2 there is a status_secondary SST which makes it quicker, but just follow the fix I gave for now.)
     
    Last edited by a moderator: Aug 10, 2014
  6. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    Maybe it's because of my own built from scratch Super Sonic Code, which is why i asked for "Is Sonic at the signpost?" so i can branch it to an rts and he won't go Super at all.

    The Built From Scratch Super Sonic Code

    Code:
    ; ---------------------------------------------------------------------------
    ; Subroutine to	Turn Sonic Super
    ; ---------------------------------------------------------------------------
    Sonic_Super:	cmpi.b	#1, (Character).w	;Is this Richter?
    		beq	Super_Richter
    
    
    		cmpi.b	#2,$1C(a0)
    		bne	SonSuper_rts
    		move.b	($FFFFF603).w,d0
    		andi.b	#BtnA,d0		; is A,	B or C pressed?
    		Beq	SonSuper_Rts
    		cmpi.b	#1,(Super_Sonic_Flag).w
    		beq	SonNormal
    		move.b	#$1F,$1C(a0)		; set Spin Dash anim (9 in s2)
    
    		move.b	#1,(Super_Sonic_Flag).w
    		move.b	#1,(Invincibility).w
    		move.w	#0,$32(a0)
    		clr.b	($FFFFD200).w ; load stars	object ($3801)
    		clr.b	($FFFFD21C).w
    		clr.b	($FFFFD240).w ; load stars	object ($3802)
    		clr.b	($FFFFD25C).w
    		clr.b	($FFFFD280).w ; load stars	object ($3803)
    		clr.b	($FFFFD29C).w
    		clr.b	($FFFFD2C0).w ; load stars	object ($3804)
    		clr.b	($FFFFD2DC).w
    
    SonALL:
    		move.w	#$EE,(Color1).w
    		move.w	#$EE,(Color3).w
    		move.w	#$EE,(Color5).w
    		move.w	#$EE,(Color7).w
    
    		move.w	#$A00,(Sonic_top_speed).w
    		move.w	#$30,(Sonic_acceleration).w
    		move.w	#$100,(Sonic_deceleration).w
    		move.l	#SoundD2,d0			; spin sound ($E0 in s2)
    		jsr	playSound	; play spin sound
    		move.l	#Plague2,d0			; spin sound ($E0 in s2)
    		jsr	playMusic	; play spin sound
    		rts
    SonBlue:
    		NormalColorScheme
    
    		move.w	#$600,(Sonic_top_speed).w
    		move.w	#$C,(Sonic_acceleration).w
    		move.w	#$80,(Sonic_deceleration).w
    		move.l	#SoundD2,d0			; spin sound ($E0 in s2)
    		jsr	playSound	; play spin sound
    		move.l	#Music87,d0			; spin sound ($E0 in s2)
    		jsr	playMusic	; play spin sound
    		rts
    
    SonSuper_rts:		rts
    
    
    SonNormal:	move.b	($FFFFF603).w,d0
    		andi.b	#BtnA,d0		; is A,	B or C pressed?
    		beq	SonNormal_rts
    		move.b	#$1F,$1C(a0)		; set Spin Dash anim (9 in s2)
    		clr.b	(Super_Sonic_Flag).w
    		clr.b	(Invincibility).w
    		move.w	#$0822,(Color1).w
    		move.w	#$0a44,(Color3).w
    		move.w	#$0c66,(Color5).w
    		move.w	#$0e88,(Color7).w
    
    	move.w	#$600,(Sonic_top_speed).w
    	move.w	#$C,(Sonic_acceleration).w
    	move.w	#$80,(Sonic_deceleration).w
    
    		move.l	#SoundD2,d0			; spin sound ($E0 in s2)
    		jsr	playSound	; play spin sound
    		jsr	StageMusicRevert
    		rts
    StageMusicRevert:	tst.b	(Stage)
    		beq	PlayGHZ
    		cmpi.b	#1,(Stage).w
    		beq	PlayLz
    		cmpi.b	#2,(Stage).w
    		beq	PlayMz
    		cmpi.b	#3,(Stage).w
    		beq	PlaySLZ
    		cmpi.b	#4,(Stage).w
    		beq	PlaySYZ
    PlayGHZ:	cmpi.b	#1,(Act)
    		beq	PlayEHZ
    		cmpi.b	#2,(Act)
    		beq	PlaySML2
    
    		move.l	#Music81,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    PlayEHZ:	move.l	#EHZ,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    PlaySML2:	move.l	#SML2Stage1,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    PlayLZ:		move.l	#Music82,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    PlayMZ:		cmpi.b	#1,(Act)
    		beq	PlayHTZ
    		cmpi.b	#2,(Act)
    		beq	PlayMGZ1
    		move.l	#Music83,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    PlayHTZ:	move.l	#HTZ,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    PlayMGZ1:	move.l	#MGZ1,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    PlaySLZ:	cmpi.b	#1,(Act)
    		beq	PlaySMB3
    		;cmpi.b	#2,(Act)
    		;beq	PlaySML2	
    		move.l	#Music84,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    PlaySMB3:	move.l	#SMB3,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    
    PlaySYZ:		move.l	#Music85,d0			; spin sound ($E0 in s2)
    		jsr	playMusic
    		bra	SonNormal_rts
    		NOP
    
    SonNormal_rts:	rts
    Super_Richter:	move.b	($FFFFF603).w,d0
    		andi.b	#BtnA,d0		; is A,	B or C pressed?
    		beq	Super_Richter_Rts
    		cmpi.b	#$23,$1C(a0)
    		bne	Super_Richter_rts
    		cmpi.b	#1,(Super_Sonic_Flag).w
    		beq	Normal_Richter
    		move.b	#$1F,$1C(a0)		; set Spin Dash anim (9 in s2)
    
    		move.b	#1,(Super_Sonic_Flag).w
    
    		move.b	#1,(Invincibility).w
    		move.l	#SoundD2,d0			; spin sound ($E0 in s2)
    		jsr	playSound	; play spin sound
    		move.l	#SuperRichter,d0			; spin sound ($E0 in s2)
    		jsr	playMusic	; play spin sound
    
    Super_Richter_Rts:		rts
    Normal_Richter:	NOP
    
     
  7. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    910
    Location:
    the united states. where else?
    ...dear merciful god that shit is long.

    Just going to say this right here, right now: Super Sonic's code can be ported directly from S2 with a few compatibility changes.

    I'm not going to explain all the changes at the moment, however.
     
  8. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Something you could do to optimize this is use the routine that plays the level BGM in place of the giant list you have in StageMusicRevert. It would make it a lot easier to look at, and hopefully a lot faster. I don't know enough to fix you're actual issue, though :(

    Edit: Ninja'd :D
     
    Last edited by a moderator: Aug 10, 2014
  9. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    I know. I did say Built From Scratch. Using this because...

    I've tried porting S2's Super Sonic Code over (I have some coding in seperate .asm files in case a screw-up) and either I did something wrong, or It won't work. I tried once before, and still have it in a seperate .asm file in case something is figured out.
     
  10. Painto

    Painto Arthurus Paintus Erinaceus Member

    Joined:
    Mar 24, 2014
    Messages:
    321
    Location:
    Lublin, Poland
    Porting SS from Sonic 2, putting some branches and change labals & RAM to Sonic 1 format took me 3 hours (with breaks!), so it really isn't that hard. The hardest from all the SS is mappings.
     
  11. EasterBanana

    EasterBanana Newcomer Trialist

    Joined:
    Jul 22, 2014
    Messages:
    9
    Location:
    In the R of SSRG.
    I have a problem with my rom. When I try to change the special stages with ESE 2, they tell me: Read beyond end of file. 

    Same with the level editor ESE 2. 

    Help me please. Thank you.
     
  12. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Since you seem to want to be doing a full-fledged hack, I HIGHLY recommend that you switch to a disassembly instead of using ESEII. If you're looking to edit the levels in a disassembly, you just need to use SonED2. You'll need another program to edit special stages, but still, I would really switch to a disassembly if I were you.
     
    Last edited by a moderator: Aug 11, 2014
  13. N30member

    N30member non-pro user btw Member

    Joined:
    Feb 15, 2014
    Messages:
    216
    Location:
    Kazakhstan
    Last edited by a moderator: Aug 11, 2014
  14. EasterBanana

    EasterBanana Newcomer Trialist

    Joined:
    Jul 22, 2014
    Messages:
    9
    Location:
    In the R of SSRG.
    Thanks for the tip.
     
    Last edited by a moderator: Aug 11, 2014
  15. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    This program depends on what Sonic game you're modifying.


    If it's Sonic 1, you would use the Sonic 1 Special Stage Editor.


    If it's Sonic 2, you would obviously use the Sonic 2 Special Stage Editor respectively.
     
  16. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
  17. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    Dude. I haven't used ESE2 in a while. Like everyone said, disassemblies are best. Use SonEd or SonLVL for level editing, s1sse for special stages - sonic 1
     
  18. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    Old hacking utilities should have massive text on respective download pages because people really don't get it :S

    Also the reason for the error is that ESE loves moving data around the ROM so it can edit it easier. Except it moves it and then doesn't remember where what is, and then it goes crazy.

    tl;dr, don't use ESE and listen to everyone above me.
     
  19. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    The reason is because the data is compressed, so when editing, ESE 2 decompresses the data for editing, and after you have made your edits, it recompresses the data once again. But if the data is bigger than the original when compressed, it will not fit into the same place as it did before.

    Now if I remember correctly, if the data is larger than before it attempts to rearrange the location of the data for Sonic 2, but I don't think the support is for Sonic 1 (Hence the message), so I assume your hack is a Sonic 1 hack. I could be wrong though, it's been such a long time since I've look at it.

    It would appear though that ESE 2 is incomplete as it cannot rearrange the data and relocate it once again correctly. Either you can go track Esrael down and ask him to update his tool, or go with the alternatives that other members have graciously recommended you (without actually answering your question properly mind).
     
  20. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    How would you get the genesis to generate "random" numbers? I want a routine to randomly choose a function when executed, but I'm not sure how to. I'm hacking sonic 1, if that helps.
     
    Last edited by a moderator: Aug 12, 2014