Basic Questions & Answers thread

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, May 29, 2008.

  1. RetroactionGlitchBiology

    RetroactionGlitchBiology

    SONIC GOT THROUGH ACT 2 Member
    Is there a way to "save to ROM" in SonMapED?
     
  2. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,425
    72
    28
    SonLVL
    No. Use a disassembly.
     
  3. AppleSauce

    AppleSauce

    It's now illegal to use your meme! Member
    28
    2
    3
    Hi guys, sorry to bother you again so soon, but I'm working on a Rocket colour power for my hack and it's not really working like it's supposed to;

    Sonic_Rocket:
    tst.b $29(a0)
    bne.w Rocket_Move
    move.b ($FFFFF603).w,d0
    andi.b #$70,d0
    beq.w Rocket_End
    tst.b $2F(a0)
    bne.s Rocket_End
    move.b #1,$2F(a0)
    move.b #$C,$29(a0)
    move.b #$BC,d0
    jsr (PlaySound_Special).l
    move.w $10(a0),d0
    move.w d0,($FFFFF63C).w
    btst #0,$22(a0)
    beq.s Rocket_NoFlip
    sub.w #$600,d0
    bra.s Rocket_Cont

    Rocket_NoFlip:
    move.w #-$EEE,$12(a0)

    Rocket_Cont:
    move.w #-$EEE,$12(a0)

    Rocket_Move:
    sub.b #1,$29(a0)
    tst.b $29(a0)
    beq.s Rocket_Reset
    clr.w $10(a0)

    Rocket_End:
    rts

    Rocket_Reset:
    tst.w $12(a0)
    beq.s Rocket_End
    blt.s Rocket_Reset2
    tst.b ($FFFFF63C).w
    bgt.s Rocket_Reset3
    bra.s Rocket_Reset4

    Rocket_Reset2:
    tst.b ($FFFFF63C).w
    blt.s Rocket_Reset3

    Rocket_Reset4:
    neg.w ($FFFFF63C).w

    Rocket_Reset3:
    move.w ($FFFFF63C).w,$10(a0)
    rts

    The idea here is to take Selbi's jump dash code and alter it so that Sonic shoots upwards at a high speed. I can't work out how to make it more rocket-like, for example pausing before shooting off into the sky. Could someone help me out in doing this stuff?
     
  4. E-122-Psi

    E-122-Psi

    Member
    1,989
    117
    43
    Is anyone here good with editing subobjects, I'm having two problems:

    Code (Text):
    1. Obj92_SubObjData:
    2.     dc.l Obj92_Obj93_MapUnc_37092
    3.     dc.w 0
    4.     dc.w $404
    5.     dc.w $1012
    1. I wanna edit the object's VRAM location, and I'm having problems figuring this out. Nothing I edit seems to alter it's art location effectively. (I want it in $EC00 by the way).

    2. Is there any way to add subobjdata routines here, and have the object branch to a different one according to a certain circumstance?
     
  5. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,425
    72
    28
    SonLVL
    Honestly, you should probably just not use the sub-object system. Just code everything into the object manually. If you really want, you can set up a table of values just for that object, and have it read from there based on subtype or whatever.
     
  6. Billy

    Billy

    RIP Oderus Urungus Member
    1,915
    36
    28
    Colorado, USA
    Indie games
    So let me preface this by saying I admit to being a total beginner at this. I'm trying to make it so the checkpoint poles in Sonic 2 warp you to a specific level, instead of the special stage. Right now I'm doing it like this:
    Code (Text):
    1. ; loc_1F536:
    2. Obj79_Star:
    3.     move.b    collision_property(a0),d0
    4.     beq.w    loc_1F554
    5.     andi.b    #1,d0
    6.     beq.s    +
    7.     ; Warp to pinball stage
    8.     move.w    #pinball_stage_act_1,(Current_ZoneAndAct).w
    9.     move.b    #GameModeID_Level,(Game_Mode).w ; => Level (Zone play mode)
    10.     jmp     Level
    11. +
    12.     clr.b    collision_property(a0)

    However, this brings along with some data from the stage you were previously in, most notably the level boundaries. This isn't related to the custom stage I've made (called "pinball stage" above), since using any other level, e.g. #casino_night_zone_act_1, results in the same issue. What is the proper way to to do this?
     
  7. SyntaxTsu

    SyntaxTsu

    Member
    94
    25
    18
    So, I recently overwrote CPZ's data with that of EHZ for 2P preservation purposes in my hack, but when I open up the 2P stage select from the title screen & title screen only, it results in this:
    strange_issue.png
    It also has the same issue occur to the stages, with the HUD and Rings also having stripes appear - but accessing the 2P Menu from beating a 2P Stage has it load normally - and the 2P demo on the title screen works perfectly. Any ideas as to how to fix this?

    EDIT: Changing the call to $0D on the 2P Level Select entry code to $00 worked and fixed it.
     
    Last edited: Jul 22, 2020
  8. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,425
    72
    28
    SonLVL
    @Billy instead of setting Game_Mode and jumping to Level, do this:
    Code (Text):
    1.    move.w   #1,(Level_Inactive_flag).w
    2.    rts
    Copied from the end-of-act score tally (Obj3A).
     
  9. Billy

    Billy

    RIP Oderus Urungus Member
    1,915
    36
    28
    Colorado, USA
    Indie games
    @MainMemory That code still transports the player to the new level, but with the same issue. I suspect the new level thinks you're loading from a checkpoint, because it'll put you in the new level where the checkpoint was in the old one. Right after the level size array is this code (around line 41400):
    Code (Text):
    1.     tst.b  (Last_star_pole_hit).w      ; was a star pole hit yet?
    2.     beq.s   +               ; if not, branch
    3.     jsr (Obj79_LoadData).l      ; load the previously saved data
    4.     move.w  (MainCharacter+x_pos).w,d1
    5.     move.w  (MainCharacter+y_pos).w,d0
    6.     bra.s   ++
    Commenting out the first three lines does indeed load the level boundaries for the new stage... but it breaks a number of other things, including the player's start position in every level. I'll play around with it, but let me know if you have any insight.
     
  10. MainMemory

    MainMemory

    Have no fear...Amy Rose is here! Tech Member
    4,425
    72
    28
    SonLVL
    You could add a check for the special stage's level ID and branch to the + label to skip checkpoints for that level.
     
  11. RetroactionGlitchBiology

    RetroactionGlitchBiology

    SONIC GOT THROUGH ACT 2 Member
    How would one go about porting music from other genesis games into Sonic 2?
    I would love to have some Ristar/Sonic3DBlast music in a romhack i'm working on
     
    Last edited: Jul 26, 2020
  12. Inferno

    Inferno

    Member
    11
    3
    3
    Sonic 1 Definitive
    So, I've brought this question here to Sonic Retro from SSRG in order to hopefully get a bit more help, so sorry if this seems like I'm an impatient brat. I'm not asking for the code to be handed to me, but I'd rather have pointers to the issue in the code.

    So, I've been trying to port the S3 level layout format to my hack, and whilst I have put in plenty of effort into getting this fully functional, I've hit a roadblock:
    Whilst collision is fully functional and displays the behavior you'd expect from the S3 level layout (aka, loopbacks), the visuals have gone out the window.
    Here's a picture to show what I mean:
    [​IMG]
    Wherever Sonic spawns, this is in the FG, and shortly after this screenshot, the FG becomes empty. The BG is just random palmtree chunks.

    I'm confused as to what the issue is. I've even referenced S3&K for some hope that I could get this working to no avail.

    I have some ideas as to what MIGHT be an issue, but I doubt it. Notably, S3 moves the level layout into a3 and then moves it into a4 later in a sense.

    I'll show the code now, in spoilers for viewing convenience. Contained is GetBlockData as it is with all that is currently set to be complied, and an example of what is being sent into a4.
    Code (Text):
    1. GetBlockData:    
    2.       add.w (a3),d5
    3. GetBlockData_2:
    4.       add.w 4(a3),d4
    5.       lea (v16x16).w,a1
    6.       move.w d4,d3
    7.       lsr.w #5,d0
    8.       and.w (Layout_row_index_mask).w,d3
    9.       move.w (a4,d3.w),d3
    10.       lsr.w #3,d5
    11.       move.w d5,d0
    12.       lsr.w #4,d0
    13.       add.w d0,d3
    14.       moveq #-1,d3
    15.       clr.w d3
    16.       move.b (a4),d3
    17.       lsl.w #7,d3
    18.       andi.w #$70,d4
    19.       andi.w #$E,d5
    20.       add.w d4,d3
    21.       add.w d5,d3
    22.       movea.l d3,a0
    23.       move.w (a0),d3
    24.       andi.w #$3FF,d3
    25.       adda.w d3,a1
    26.  
    27. locret_6CIE:
    28.       rts      
    Code (Text):
    1.       lea (Level_layout_main).w,a4
    2.       move.w #$4000,d2
    3.       bsr.s DrawChunks
    4.       lea (v_bgscreenposx).w,a3
    5.       addq.w #2,a4
    6.       move.w #$6000,d2

    I've tried referencing a lot of materials to get this working. Hopefully I got at least something right.

    I really don't want to scrap my plans for level layouts, and for those to work, I probably will need this.

    My apologies if this sounds stupid.

    EDIT: Solved. Ignore.
     
    Last edited: Aug 8, 2020 at 4:55 AM
  13. Trance

    Trance

    The man with the plan Member
    21
    0
    1
    So, I've actually got the Peelout into S1 successfully. I just don't know how to add any sound for it. Any help?
     
  14. JustMe

    JustMe

    Member
    41
    25
    8
    Planet Earth
    Being lazy
    You need to place "move.b #(sound id),d0", "jsr PlaySound" at the right place (duh)

    I hope you know where to place it
    : )
     
  15. Trance

    Trance

    The man with the plan Member
    21
    0
    1
    No, I don't. Sorry. I don't really know much asm. :)
     
  16. JustMe

    JustMe

    Member
    41
    25
    8
    Planet Earth
    Being lazy
    You should find something like "is Up released?" and if there's "if yes, branch" next to it, find that label and paste the code there.
    If there's "if not, branch", paste the code after that line