Basic Questions and Answers Thread

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

  1. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,153
    Location:
    Triton (Moon)
    So I got the Flamewing driver working, but I got a problem that I've heard a lot of other people worry about; the sound ids are scrambled, resulting in minor sound effects playing sounds they probably shouldn't be playing. Although I'm happy to go through the grunt work of fixing every single constant ID, I have no idea what value goes o which song. The hexadecimal values don't work, and converting them to decimal only works sometimes...
     
  2. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    My code right here seems pretty sloppy and I wanted to see if anyone can show me a good way to optimize it:

    Code:
    +
    	btst	#0,(Ctrl_1_Held_Logical).w	
    	beq.s	+			
     	neg.w 	d1                      
            move.w  d1,y_vel(a0)           
            bsr.s   SDPlaySound
    +
    	btst	#1,(Ctrl_1_Held_Logical).w	
    	beq.s	+             		
            move.w  d1,y_vel(a0)            
            bsr.s   SDPlaySound
    +
    	btst	#2,(Ctrl_1_Held_Logical).w   
    	beq.s	+                      
    	neg.w 	d2                      
    	move.w	d2,x_vel(a0)            
            bsr.s   SDPlaySound
    +
    	btst	#3,(Ctrl_1_Held_Logical).w  
    	beq.s	+                      
    	move.w	d2,x_vel(a0)            
    
    SDPlaySound:
    	move.w	#$BC,d0	               
    	jsr	(PlaySound).l
     
    Last edited by a moderator: Sep 11, 2014
  3. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,870
    I'd go with something like this:

    Code:
    Movement:
    		move.b	(Ctrl_1_Held_Logical).w,d0	; load control bits
    		lsl.b	#$04,d0				; send D-pad buttons to far left
    		beq.s	MM_NoMovement			; if none of the D-pad buttons are set, branch
    		bmi.s	MM_MoveX			; if right has been set, branch
    		add.b	d0,d0				; shift left button to MSB
    		bpl.s	MM_NoMoveX			; if left has not been set, branch
    		neg.w	d2				; reverse X speed
    		bra.s	MM_MoveXNeg			; continue
    
    MM_MoveX:
    		add.b	d0,d0				; shift left button to MSB
    
    MM_MoveXNeg:
    		move.w	d2,x_vel(a0)			; set X speed
    
    MM_NoMoveX:
    		add.b	d0,d0				; shift down button to MSB
    		bmi.s	MM_MoveY			; if down has been set, branch
    		add.b	d0,d0				; shift up button to MSB
    		bpl.s	MM_NoMoveY			; if up has not been set, branch
    		neg.w	d1				; reverse Y speed
    
    MM_MoveY:
    		move.w	d1,y_vel(a0)			; set Y speed
    
    MM_NoMoveY:
    		moveq	#$FFFFFFBC,d0			; prepare SFX ID
    		jsr	PlaySound			; play SFX
    
    MM_NoMovement:
    The problem however, is down to deciding how you wish to optimise it. Do you want it faster? Or do you want it smaller? What you see up there is the best I could come up with that is a compromise of both within reason. You could optimise it to be a very few cycles faster, that would however cost you more memory. You could on the other hand, optimise it to be smaller, but that may take longer to process.
     
  4. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    911
    Location:
    the united states. where else?
    (quoting code to enhance clarity)

    1.) These lines are unnecessary, seeing as the routine is called at the end of all those checks anyway.

    ...that's really it, as far as I can see.
     
  5. Clownacy

    Clownacy Mania bad Staff

    Joined:
    Aug 15, 2014
    Messages:
    901
    If you want to find out what sound ID is what, why not just use the sound test?


    It might be easier, instead of modifying the game, to modify the driver. Try to get the music IDs to start at $80, clean out the songs you don't need so that you can get the SFXes to start at $A0, that kind of thing.


    Actually, why not just follow the SCHG's 'S3 driver to S1' guide? It details where and what sound IDs to change in a Hivebrain disasm. The S3 and Flamewing driver should be close enough for you to work from there with few problems.
     
  6. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,870
    If you read the structure carefully, you'll come to the conclusion that they're not 100% unnecessary, they're just the wrong instruction (i.e. meant to be a bra instead of bsr).
     
    Last edited by a moderator: Sep 12, 2014
  7. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,153
    Location:
    Triton (Moon)
    If you want to find out what sound ID is what, why not just use the sound test?


    It might be easier, instead of modifying the game, to modify the driver. Try to get the music IDs to start at $80, clean out the songs you don't need so that you can get the SFXes to start at $A0, that kind of thing.


    Actually, why not just follow the SCHG's 'S3 driver to S1' guide? It details where and what sound IDs to change in a Hivebrain disasm. The S3 and Flamewing driver should be close enough for you to work from there with few problems.




    I have been using the sound test; they don't match up with the S2.constant ids at all! I'm also not very skilled at any ASM that doesn't involve changing single values or dealing with branches, so I don't think I'd be able to work it out as you described. Heck, if I was that skilled, I probably wouldn't be asking!
     
  8. Vicious

    Vicious Newcomer Trialist

    Joined:
    Sep 10, 2014
    Messages:
    4
    Location:
    Bs. As.
    Hello people, I am new to the forum. I need a hand. I commented, I am trying to create a hack of Sonic 3 but with the character Shadow using a disassembly of sonic 3 & knuckles:


    [​IMG]
    I followed the tutorial of sonicretro: 

    http://info.sonicretro.org/SCHG_How-to:Use_SonMapEd/Part_1 

     

    The problem is when I try to assemble the rom, errors occur. 

    [​IMG]

    I do not understand. 

     

    whats happen here?

    Can anyone help me?

     

    PD: i'm sorry, i don't know where post this problem.
     
    Last edited by a moderator: Sep 12, 2014
  9. ralakimus

    ralakimus pretty much a dead account Member

    Joined:
    Aug 26, 2013
    Messages:
    1,069
    It's saying that the labels Map_SuperSonic and PLC_SuperSonic don't exist. Did you change the label names or delete them?
     
  10. Shockwave

    Shockwave 3 Time Stones Member

    Joined:
    Dec 18, 2013
    Messages:
    121
    Location:
    LA, CA
    The S&K disassembley has the mappings for both Sonic and Super Sonic contained within the same ASM file, so editing Sonic's regular sprites in SonMapEd and saving the mappings and DPLC's over the originals is gonna delete Super Sonic's. Restore the original files and separate them the way they should be before editing them again, then they should work fine.

    Edit: Actually, I meant that the ROM would build fine, but the mappings for Super Sonic would still end up being tampered. Kind of overlooked that when I wrote this post. Thanks for pointing the problem out properly MainMemory.
     
    Last edited by a moderator: Sep 12, 2014
  11. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    889
    Even if Super Sonic's mappings were in a separate file, that would still render Super Sonic's sprites uneditable unless you manually modified it, because it shares frames with Sonic. Furthermore, if there are any labels inside the mapping file that are referenced by other code, editing them in SonMapEd will break it, as it discards all the existing labels in favor of randomized ones.
     
    Last edited by a moderator: Sep 12, 2014
  12. AsuharaMoon

    AsuharaMoon kakyoin did you lay this egg Member

    Joined:
    Aug 15, 2013
    Messages:
    65
    I exported the Sonic 2's spring to Sonic 1 (Object 41 in both games), and the 3 functions works perfectly.

    The problem is I can't find a way to get the mapping. I tried to create another asm file with the mapping's line of this object, but when I open it in SonMapED with spring's art, I just got empty spaces.


    So, there's another method to get it?

    EDIT: My mistake, I forget to change the game format. Trash this please. :U
     
    Last edited by a moderator: Sep 13, 2014
  13. Painto

    Painto Samodzierżca Najdłuższego Kija Member

    Joined:
    Mar 24, 2014
    Messages:
    315
    Location:
    Poland
    How does Sonic 2's Hill Top Zone boss load himself in one of two pits instead in only one? (I need to know how he does this for my BZ boss)
     
  14. Clownacy

    Clownacy Mania bad Staff

    Joined:
    Aug 15, 2014
    Messages:
    901
    What are you talking about? When the boss hides itself under the lava, it should just snap its x_pos to that of the other pit.
     
  15. Painto

    Painto Samodzierżca Najdłuższego Kija Member

    Joined:
    Mar 24, 2014
    Messages:
    315
    Location:
    Poland
    Sorry, but my english isn't perfect. Anyway, the second sentence is what I meant and I figured this by myself few hours ago.
     
  16. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,804
    Location:
    italy
    I think he meant something like "how can the HTZ boss show up in two different pits instead of always in the same one?"


    Glad to see this was answered anyway. By the way, is the side chosen randomly each time or is it simply alternating? I think it alternates in HTZ, but I always thought it was random in BZ. Still, not a big difference, once you adjust the X position and the sprite facing accordingly.


    Also glad to read you're really going ahead with BZ's boss :D
     
    Last edited by a moderator: Sep 13, 2014
  17. Painto

    Painto Samodzierżca Najdłuższego Kija Member

    Joined:
    Mar 24, 2014
    Messages:
    315
    Location:
    Poland
    No, HTZ boss bases his appereance on Sonic/Tails location on the arena. If Sonic is on right side - it exits from the right pit and if on the left - from the left side.

    And yes, I'm also glad to make it. In Screens thread I posted a screen of it.
     
  18. DumbLemon

    DumbLemon am back Member

    Joined:
    Aug 19, 2014
    Messages:
    115
    Does anyone know where the code for the lamp post is and in what ASM? I am trying to get rid of the code that you have to be off screen for the act to end after you hit a sign post.
     
  19. Clownacy

    Clownacy Mania bad Staff

    Joined:
    Aug 15, 2014
    Messages:
    901
    Last edited by a moderator: Sep 13, 2014
  20. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    I'm in the process of porting what little work I have done on my hack over to the GitHub Sonic 2 disassembly and I am having issues on the last step Fixing Tails' Tails.

    In my s2constants.asm I have the ram address in the same place as the guide(I think)


    Horiz_Scroll_Buf: ds.b $400
    Sonic_Stat_Record_Buf: ds.b $100
    Sonic_Pos_Record_Buf: ds.b $100
    Tails_Tails_ptr: ds.w 1 <---- This is the line needed for the fix
    Tails_Pos_Record_Buf: ds.b $100

    Now when I build I get these errors:


    > > >s2.asm(12574): error: short addressing not allowed
    > > > move.w #Tails_Tails_Cutscene,(Tails_Tails_ptr).w
    > > >s2.asm(12574): error: addressing mode not allowed here
    > > > move.w #Tails_Tails_Cutscene,(Tails_Tails_ptr).w
    > > >s2.asm(35289): error: short addressing not allowed
    > > > movea.w (Tails_Tails_ptr).w,a1
    > > >s2.asm(35289): error: addressing mode not allowed here
    > > > movea.w (Tails_Tails_ptr).w,a1
    > > >s2.asm(35352): error: short addressing not allowed
    > > > movea.w (Tails_Tails_ptr).w,a1
    > > >s2.asm(35352): error: addressing mode not allowed here
    > > > movea.w (Tails_Tails_ptr).w,a1
    I have searched to see what this error means and I have yet to find a clear answer I feel it has something to do with that ram address, but I have no idea how to fix this when using this disassembly.