Multiple Questions

Discussion in 'Discussion and Q&A Archive' started by warr1or2, Jul 31, 2012.

Thread Status:
Not open for further replies.
  1. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    I'm trying to add another character to sonic 1. I used the How-To on the retro and it loaded sonic's. So I added Mappings, Tiles, & Load Cues to my ASM file & Switched from Sonic to "Char2" to keep adding to it.


    1. How can I make it so C+Start loads "Char2" on title screen? It would be easier to work with the new character this way.


    2. "Char2" so far has NO rotation. I looked in sonic's Animations and knowing SONMAPED, found that Sonic's rotated sprites are located at frames $0C - $1D for walk, $22 - $2D for run. do I have to use ROTSPRITE to rotate each frame?


    3. I want "Char2" to have his own coding... somewhat.


    example - Sonic Jumps destroy badniks, "Char2" 's Jumps wouldn't & will get hurt instead (Hence amy Rose).


    and would want certain animations kill badniks when he uses a weapon (Amy's hammer, Tails' tails in the megamix for example)


    And also trying to have Sonic 2's options screen in sonic 1, but i'm failing miserably.


    4. The start button to get to the options screen instead of straight to the game. I know it can be done, how? I Include "s2_Option.asm" but i think i need to change something in it's ASM file.


    5. looking back at my older posts, I asked if anyone would like to join in helping GreenSnakeHacking with a mod. Seen that got me in trouble. is it not permitted to ask? I was asked by GreenSnakeHacking from a conversation on youtube to... Recruit I guess you could say.. Help. If it was not allowed, then i guess i fell right into a trap cause I had no idea if it was allowed or not.
     
  2. SuperEgg

    SuperEgg I'm a guy that knows that you know that I know Member

    Joined:
    Oct 17, 2009
    Messages:
    Location:
    THE BEST GOD DAMN STATE OF TEXAS
    warr1or2, I have to say, this is a very interesting issue. I'm gonna start with the character abilities question.


    One solution could be this. At the beginning of the "Sonic_Jump" routine, you could add this....



    Code:
    
    cmpi.b #$01, ($FFFFFFFE).w ;check to see if character is whatever his name is...
    
    bne.s SJump_Main ;jump to the main jump routine
    
    


    Then, right after you add those two lines, add this in to start the next routine...



    Code:
    
    SJump_Main:
    
    



    So, it look something like this....



    Code:
    
    Sonic_Jump: ; loc_10476:
    
    cmpi.b #$01, ($FFFFFFFE).w ;check to see if character is ????
    
    bne.s SJump_Main ;jump to the main jump routine
    
    whatever the new jump code for your new character is....
    
    
    
    SJump_Main: ; Main Jump code for Sonic
    
    move.b (Ctrl_1_Press_Logical).w, d0
    
    andi.b #$70, d0
    
    beq	 loc_1051A
    
    moveq #0, d0
    
    move.b angle(A0), d0
    
    addi.b #$80, d0
    
    bsr	 loc_136F2
    
    cmpi.w #$6, d1
    
    blt	 loc_1051A
    
    move.w #$680, d2
    
    btst #6, status(A0)
    
    beq.s loc_104A8
    
    move.w #$380, d2
    
    loc_104A8:
    
    moveq #0, d0
    
    move.b angle(A0), d0
    
    
    (Bear in mind, this code is from Sonic 2 Beta, It is basically the same as Sonic 1, you'll have to change the RAM addresses and convention flags if you want to use it.)



    If that doesn't work, you could always just clone the Sonic object, change all the subs within it, and hardcode it as such. Just make sure you don't have the same named subs as obj Sonic, otherwise it won't build. In order to make this work though, you'll have to change this little number around the only difference in your code for the character load would be this....



    Go to "loc_3946:"



    and find this piece of code...



    Code:
    
    move.b #1,($FFFFD000).w ; load Sonic object
    
    
    Replace this line with this....

    Code:
    
      cmpi.b #$01, ($FFFFFFFE) ;check to see if character is whatever
    
      bne.s CharacterInit	 ;if not, then go on
    
      move.b #?,($FFFFD000).w ; load other character (? is the object number)
    
      tst.w ($FFFFFFF0).w
    
      bmi.s Level_ChkDebug
    
      move.b #$21,($FFFFD040).w ; load HUD object
    
    CharacterInit:
    
      move.b #1,($FFFFD000).w ; load Sonic object
    
      tst.w ($FFFFFFF0).w
    
      bmi.s Level_ChkDebug
    
      move.b #$21,($FFFFD040).w ; load HUD object
    
    
    (this IS Sonic 1, so have a blast)


    That should do it if you decide to take that route instead, adding in your own character.


    Now, the options menu is a different issue all together. Since...(insert below reasons), it is a hard call to make.


    1. I have no idea what disam you are using.


    2. Have no idea what you've done all together.


    As far GreenSnake goes....well he's kinda a joke, so.....


    Best of luck to you

    [/CODE]
     
    Last edited by a moderator: Jul 31, 2012
  3. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    As you said it was the guide on Retro that you followed, I'll answer these based on the assumption that you are performing this onto Sonic 1 of the "olde disasme".

    In the section of the tutorial where it says:

    Do not follow that, follow this; after this piece of code:



    Code:
            andi.b    #$80,($FFFFF605).w; check if Start is pressed
    
            beq.w    loc_317C; if not, branch


    Put in:





    Code:
            sf.b    ($FFFFFFFE).w                ; reset character to Sonic
    
            btst    #$05,($FFFFF604).w            ; is the B button being held?
    
            beq    Title_ChkLevSel                ; if not, branch
    
            addq.b    #$01,($FFFFFFFE).w            ; increase ID to new character


    This will ensure that if C is held, your new character will be chosen, if it is not held, it will resume with your first character (i.e. assuming Sonic).



    You do not have to use "RotSprite" to rotate each frame, it can be done by hand or even through a hexadecimal/binary editor if you so dearly wished to, but I believe you're confusing the issue with what you "really" want, "RotSprite" is used to rotate bitmap images without anti-aliasing (i.e. bluring or using additional colours that aren't on the sheet), it does not deal with the raw binary sprite art which you are looking to edit, it has not interactions with your ROM, disassembly or your projects in any direct manner, you'll have to look into other methods or tools for editing the actual art content, or importing the sprite sheets that "RotSprite" spits out.



    There are a few ways, the best way would be to have an entire brand new object code for your new character, however, in that tutorial you've read, it's clear that it's using the same object for both characters, so, you'll need exceptions everywhere, if you want your new character to run a different set of instructions, then the following code is an example of many ways:





    Code:
            tst.b    ($FFFFFFFE).w                ; is the character Sonic?
    
            beq    ObjectIsSonic                ; if so, branch
    
    
    
        ; New character's routine
    
    
    
            rts                        ; return
    
    
    
    ObjectIsSonic:
    
    
    
        ; Sonic's routine
    
    
    
            rts                        ; return


    It's quite a simple and logical rule to follow.



    And you'll need to understand more of what you are doing before being able to successfully port large portions of code from one game to another (by that I mean, the options screen), publically speaking though, the old Sonic 2 options screen is a little old now, you'll get better reception making your own screen (if you do it with a good sense of style and direction).



    The routine "Title_ChkLevSel:" contains the instructions that branch to starting a new level, it is there where you'll want to make your changes.



    Who you help is not our business, I bid them good luck.



    You know, you'll want a branch after that first "load HUD object" instruction, otherwise it will continue down to "load Sonic object", and it makes your code quite useless, there's also a much easier way to do that:





    Code:
            move.b    #$01,($FFFFD000).w            ; set Sonic object to load
    
            tst.b    ($FFFFFFFE).w                ; is the character Sonic?
    
            beq    CharacterYesSonic            ; if so, branch
    
            move.b    #$??,($FFFFD000).w            ; set new character object to load
    
    
    
    CharacterYesSonic:
    
    
     
  4. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    The RTS worked, the character, Richter, Can't Jump now till I add the code. Now needing to load Richter's Tiles & Mappings instead of sonic's.


    with the jump, i copy all of sonic's code, changing some things like for the jump to be with A only and... "error: illegal value (-32894) BSR.W singleobjload." just great
     
    Last edited by a moderator: Aug 2, 2012
  5. Kensou

    Kensou Well-Known Member Member

    Joined:
    Aug 19, 2010
    Messages:
    59
    If you still don't know how to fix that kind of issue you should start again and learn about what you are doing...


    It's a branch error, the instruction bsr.w can't go to an instruction that is too far.... you have to change that bsr.w instruction to another that can jump far in the code.
     
  6. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    I can always change something in the code, or try to make Richter_jump code. main concern is trying to load Richter's Tiles instead of sonic's. I think mappings, cues, & animation is ok
     
    Last edited by a moderator: Aug 2, 2012
  7. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    I'm afraid Kensou is right, you should check out a few assembly tutorials available, it seems that what you're stuck on is very basic stuff, and while we don't mind helping normally, what you're after as an end result is (as seen by most) as a large technical step forward, lots of small helps slowly working their way into one large contribution, and I feel that you'll keep coming back asking question after question, until eventually, we've done all the work for you.


    Work out the simple stuff first, check the forums to see if the question has already been asked (there's a thread already explaining the issues with branch ranges I believe), afterwards, when you hit more advanced pitstops, come for help.
     
    Last edited by a moderator: Aug 2, 2012
  8. SuperEgg

    SuperEgg I'm a guy that knows that you know that I know Member

    Joined:
    Oct 17, 2009
    Messages:
    Location:
    THE BEST GOD DAMN STATE OF TEXAS
    Hint:


    bsr.s->bsr.w->jsr


    bra.s->bra.w->jmp


    Also, nice to see you got the jump code to go. Personally, I would've just added my own separate character, and since you have that Sonic 2 options menu, you could just set that character's value in place of Tails....but I digress. Have fun
     
    Last edited by a moderator: Aug 2, 2012
  9. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    that's one thing i sorta got just now. a "Level" to say on subroutine operation. that part's fixed. had the same problem with movesoniconptfm so all i did was replace every BSR.S on singleobjload movesoniconptfm. fixed.


    and since I'm having trouble with adding sonic 2's option,won't be needing it.


    Besides, one reason I was wanting it on there was the whole Multiple Character ordeal. and that's sorta out of the way.


    Richter's Tiles , animation, & Cues are loaded, but it keeps loading sonic's mappings


    with each #Map_Sonic found i created Richter's own code making sure to...



    Code:
    
    				tst.b ($FFFFFFFE).w						 ; is the character Sonic?
    
    				beq	 StateName						 ; if so, branch
    
    				richter's code below
    
    				#Map_Richter
    
    				 more code
    
    StateName:
    
    				 sonic's normal code
    
    
    ... on each subroutine, even had a branch problem but fixed it by using jmp in some situations

    on another note, before adding 2nd character code i used Richter's animation (load as sonani|sonanidata), tiles, cues, & maps & they worked, video proof




    may have something to do with animRichter.asm. all i did was have his art, cues, & mappings in place of sonic's for teasting, animrichter.asm is basically a copy & mod animsonic.asm. i changed sonani|sonicanidata to ricani|richteranidata and it goes corrupt.

    Here's what I did with loadsonicdynplc



    Code:
    
    LoadSonicDynPLC:
    
    tst.b ($FFFFFFFE).w						 ; is the character Sonic?
    
    			 bne LoadRichter						 ; if so, branch
    
    
    
    moveq #0,d0
    
    move.b $1A(a0),d0 ; load frame number
    
    cmp.b ($FFFFF766).w,d0 ; has Sonic frame changed?
    
    beq.s locret_13C96 ; if not, branch
    
    move.b d0,($FFFFF766).w ; update frame number
    
    cmpi.b #$01, ($FFFFFFFE).w ; is the multiple character flag set to $01 (Richter)?
    
    bne.s SonicArtLoad ; if not, load Sonic's art
    
    
    
    bra.s ContLoadPLC ; branch to rest of code
    
    loadRichter:
    
    jmp LoadRichterDynPLC
    
    
    
    SonicArtLoad:
    
    
    
    lea (SonicDynPLC).l,a2 ; load Sonic's art
    
    ContLoadPLC:
    
    add.w d0,d0
    
    adda.w (a2,d0.w),a2
    
    moveq #0,d5
    
    move.b (a2)+,d5
    
    subq.w #1,d5
    
    bmi.s locret_13C96
    
    move.w #$F000,d4
    
    move.l #Art_Sonic,d6
    
    
    
    SPLC_ReadEntry:
    
    moveq #0,d1
    
    move.b (a2)+,d1
    
    lsl.w #8,d1
    
    move.b (a2)+,d1
    
    move.w d1,d3
    
    lsr.w #8,d3
    
    andi.w #$F0,d3
    
    addi.w #$10,d3
    
    andi.w #$FFF,d1
    
    lsl.l #5,d1
    
    add.l d6,d1
    
    move.w d4,d2
    
    add.w d3,d4
    
    add.w d3,d4
    
    jsr (QueueDMATransfer).l
    
    dbf d5,SPLC_ReadEntry ; repeat for number of entries
    
    
    
    locret_13C96:
    
    rts
    
    LoadRichterDynPLC:
    
    
    
    moveq #0,d0
    
    move.b $1A(a0),d0 ; load frame number
    
    cmp.b ($FFFFF766).w,d0 ; has Sonic frame changed?
    
    beq.s locationret_13C96 ; if not, branch
    
    move.b d0,($FFFFF766).w ; update frame number
    
    cmpi.b #$01, ($FFFFFFFE).w ; is the multiple character flag set to $01 (Richter)?
    
    beq.s RichterArtLoad ; if not, load Sonic's art
    
    
    
    bra.s ContinueLoadPLC ; branch to rest of code
    
    
    
    RichterArtLoad:
    
    
    
    lea (SonicDynPLC).l,a2 ; load Sonic's art
    
    ContinueLoadPLC:
    
    add.w d0,d0
    
    adda.w (a2,d0.w),a2
    
    moveq #0,d5
    
    move.b (a2)+,d5
    
    subq.w #1,d5
    
    bmi.s locationret_13C96
    
    move.w #$F000,d4
    
    move.l #Art_Richter,d6
    
    
    
    SPLC_ReadTheEntry:
    
    moveq #0,d1
    
    move.b (a2)+,d1
    
    lsl.w #8,d1
    
    move.b (a2)+,d1
    
    move.w d1,d3
    
    lsr.w #8,d3
    
    andi.w #$F0,d3
    
    addi.w #$10,d3
    
    andi.w #$FFF,d1
    
    lsl.l #5,d1
    
    add.l d6,d1
    
    move.w d4,d2
    
    add.w d3,d4
    
    add.w d3,d4
    
    jsr (QueueDMATransfer).l
    
    dbf d5,SPLC_ReadTheEntry ; repeat for number of entries
    
    
    
    locationret_13C96:
    
    rts
    
    ; End of function LoadSonicDynPLC
    
    
    and i get


    branch is 32810 bytes out of range

    [/CODE]
     
    Last edited by a moderator: Aug 5, 2012
Thread Status:
Not open for further replies.