don't click here

Basic Questions & Answers thread

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

  1. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    Removing that seemed to make the results not come up at all even when off-screen...simply removing this part gave the desired effect though:

    move.w ($FFFFF72A).w,d1
    addi.w #$128,d1

    Still, thanks for the point in the right direction! Much appreciated. I do have another question but this is probably either not possible or more complex. Is there a way to make Sonic use his normal animations/play style into the already existing Special Stages, rather than be in constant jump/spin mode? As in like, not having standard zones replacing them but having Sonic move normally in them as they are, sans the spinning of the stage of course.
     
  2. TheInvisibleSun

    TheInvisibleSun

    OVER THE TOP TECHNO-BLAST Member
    1,626
    193
    43
    Buffalo, NY, USA
    The Water
    A much cleaner alternative, would be to erase the whole bit and replace it with this:


    HTML:
    Sign_SonicRun:	; Routine 6
    		jsr	GotThroughAct	;
    This way you're telling it to simply jump to the 'GotThroughAct' Subroutine.
     
  3. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    Now that's a great idea, thank you! Also, I'm assuming if I want to say change sprite instead of making Sonic go right, I'd simply replace the "make sonic go right" part with something like this?

    move.b #$21,$1C(a0) ; use victory animation

    Or would something need to be added first to make it work?
     
  4. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    That probably will not work. Because the code is only ran once. Once it will set Sonic's anim, any button you touch or movement can cause the animation to change, then it will never get set to the victory one again because you've passed this part of the code. Makes sense?



    What you'll need to do, is keep the check to see if Sonic touches the ground, and when he does, freeze his x_vel and his controls, then move the animation to Sonic. That way, you cannot move so his animation will not change again. Just make sure no other code isn't interrupting Sonic's anim anywhere (like his standing routine, it will continue to run and probably move Sonic's stand anim to him repeatedly).
     
  5. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    Well I kept the lock control part in but yeah as you said it just keeps his standing animation, so I'll have to see where that kicks in.

    EDIT: Well, I'm very confused. No matter where I add the animation bit or what I look at I can't seem to figure out how to make it work. This is what I have in the SonicRun and GotThroughAct parts before trying to place the animation line in:

    Code (ASM):
    1. Obj0D_SonicRun:             ; XREF: Obj0D_Index
    2.         tst.w   ($FFFFFE08).w   ; is debug mode on?
    3.         bne.w   locret_ECEE ; if yes, branch
    4.         btst    #1,($FFFFD022).w
    5.         bne.s   Sign_SonicRun
    6.         move.b  #1,($FFFFF7CC).w ; lock controls
    7.  
    8. Sign_SonicRun:  ; Routine 6
    9.         jsr     GotThroughAct   ;
    10.  
    11. loc_EC86:
    12.         addq.b  #2,$24(a0)
    13.  
    14. ; ---------------------------------------------------------------------------
    15. ; Subroutine to set up bonuses at the end of an act
    16. ; ---------------------------------------------------------------------------
    17.  
    18. ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    19.  
    20.  
    21. GotThroughAct:              ; XREF: Obj3E_EndAct
    22.         tst.b   ($FFFFD5C0).w
    23.         bne.s   locret_ECEE
    24.         move.w  ($FFFFF72A).w,($FFFFF728).w
    25.         clr.b   ($FFFFFE2D).w   ; disable invincibility
    26.         clr.b   ($FFFFFE1E).w   ; stop time counter
    27.         move.b  #$3A,($FFFFD5C0).w
    28.         moveq   #$10,d0
    29.         jsr (LoadPLC2).l    ; load title card patterns
    30.         move.b  #1,($FFFFF7D6).w
    31.         moveq   #0,d0
    32.         move.b  ($FFFFFE23).w,d0
    33.         mulu.w  #60,d0      ; convert minutes to seconds
    34.         moveq   #0,d1
    35.         move.b  ($FFFFFE24).w,d1
    36.         add.w   d1,d0       ; add up your time
    37.         divu.w  #15,d0      ; divide by 15
    38.         moveq   #$14,d1
    39.         cmp.w   d1,d0       ; is time 5 minutes or higher?
    40.         bcs.s   loc_ECD0    ; if not, branch
    41.         move.w  d1,d0       ; use minimum time bonus (0)
    42.  
    43. loc_ECD0:
    44.         add.w   d0,d0
    45.         move.w  TimeBonuses(pc,d0.w),($FFFFF7D2).w ; set time bonus
    46.         move.w  ($FFFFFE20).w,d0 ; load number of rings
    47.         mulu.w  #10,d0      ; multiply by 10
    48.         move.w  d0,($FFFFF7D4).w ; set ring bonus
    49.         move.w  #$8E,d0
    50.         jsr (PlaySound_Special).l ; play "Sonic got through" music
    51.  
    52. locret_ECEE:
    53.         rts
    54. ; End of function GotThroughAct
     
  6. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    You're looking in the wrong place if he's in his standing position. As for the ASM bit you've posted, I'm not sure what you're trying to do. I'm not familiar with Sonic 1 (sonic 2 hacker here). If the problem is that Sonic always uses his standing animation, you will want to stop it when he's in his victory animation.

    In Sonic 2, it's

    Code (ASM):
    1.     move.b  #5,anim(a0) ; use "standing" animation

    Sonic 1 is probably the same, but not garenteed. Look in the RAM with a good emulator and see what his anim is set to when he is standing, then search for it in your ASM.
     
  7. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    It's normally near enough the same, fairly sure it's $5 too...according to this from the Obj01_Move code anyway:
    Code (ASM):
    1.         move.b  #5,$1C(a0)  ; use "standing" animation
     
  8. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    That's probably the issue. For now, change that bit to something else, like, a balancing animation. So when Sonic stands still, he does a balancing animation. Then, go to the end. If the balancing animation is now interfering with the victory animation, then you have pin-pointed your problem, and the next step is to get around it.
     
  9. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    It does seem to be interfering yes, and for the record I added the victory animation line under the lock controls command.

    EDIT: In fact it not only doesn't show the desired animation, it garbled the sign sprite when Sonic's animation should change. Do I need to add a line before this to make sure it relates to Sonic?

    Code (ASM):
    1.         move.b  #21,$1C(a0)      ; use "victory" animation
     
  10. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    So it's interfering. That means you need to make it stop moving his standing animation when he does the victory animation. A very simple and quick way around it is to make a new RAM address that's unused, and when you move Sonic's animation to victory, make the unused RAM address 1.


    Then for his standing animation, just before it, test the new RAM. If it's 1, skip moving Sonic animation to stand. Just make sure when the level restarts, to clear the RAM, otherwise Sonic will never stand again.





    Assuming you're putting this command in the sign object itself, the problem is you're changing the animation to address register 0 (a0). That generally means the object in question.

    From the top of my head (I'm not at home at the moment), you'll want to try something like this:

    Code (ASM):
    1.     lea (MainCharacter).w,a1    ; Load Sonic's object RAM into a1
    2.     move.b  #21,$1C(a1)     ; use "victory" animation into a1

    That way, Sonic should change, and the sign unaffected.
     
  11. Jimmy Hedgehog

    Jimmy Hedgehog

    Member
    1,728
    8
    18
    England - Slough
    Getting the motivation to continue old projects
    After a little help from Psy in how I should go about the required check, it now works! So thanks a bunch ^_^ I ended up having it set the address to 1 after locking controls, and in the Obj01 code having it test the address when neither right or left are pressed and either using the victory animation or standing animation accordingly. Thanks again for the help, should make some thing in future much more understandable :v: Results in the screenshot thread.
     
  12. Chaoder

    Chaoder

    Member
    2
    0
    0
    USA

    This thread is great. I've been reading a lot of the posts and now, I have a question of my own.
    In Sonic 1, (the hg disassembly) I was tweaking enemies a bit (basically removing a pause before firing projectiles etc.) to make them
    a bit harder. Then, the thought struck me. How would one go about making enemies have a hit count like Robotnik?
     
  13. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber

    The best way to answer your question, is to explain how Robotnik/Eggman works. He "kind of" works like a badnik. You hit him, and it subtracts 1 from a RAM address (let's call it, EGGHIT). Also, a RAM timer starts, and during that RAM timer, you cannot hit him again. The timer only lasts a second or two. Once the RAM timer has worn off (reaches 0), you can hit him again. During the RAM timer, Eggman flashes white.

    After 8 hits, when the EGGHIT reaches 0, Eggman then goes to a new routine to make him explode and etc.


    So for badniks, you can do something similar; after a hit, make the badnik invulnerable with a timer for a second or two, and subtract 1 from a unused RAM address (let's call it, BADNIKHIT), then repeat until BADNIKHIT reaches 0. Once it has, kill the badnik as usual.
     
  14. TheInvisibleSun

    TheInvisibleSun

    OVER THE TOP TECHNO-BLAST Member
    1,626
    193
    43
    Buffalo, NY, USA
    The Water
    Does anyone know if there is a way to trigger events according to the current bgm in Sonic 1 (I.e. finish a level with X bgm currently playing, and progress to X level)?
    This seemed impossible, but I figured I might as well ask here.
     
  15. BleuStar

    BleuStar

    20
    0
    0
    New Castle, Delaware
    Sonic The Hedgehog (RevBS) [!]
    I have another problem, when I exit a special stage in my Sonic 2 rom hack, I notice that garbled graphics sometimes appear on the screen (When it says Sonic Got a Chaos Emerald). Yet, I'm not sure what I did. Is there anyway to fix this without restarting the entire project over?
     
  16. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,202
    432
    63
    Japan
    Working blindly here, I believe that is caused in the original game too, and I believe it is due to the V-blank routine that the results screen runs. The V-blank routine selected calls a routine for drawing map tiles of the level on screen, but since the results screen is not a level, you end up with tiles drawn that you do not want drawing. Again, working blindly without actually seeing this in-game, try this:

    At routine named "loc_748" (I don't know the name of it on the SVN/Hg version), you will see this further down:

    Code (Text):
    1.     movem.l ($FFFFEE50).w,d0-d3
    2.     movem.l d0-d3,($FFFFEEA0).w
    3.     move.l  ($FFFFF61E).w,($FFFFEEEC).w
    4.     cmpi.b  #$5C,($FFFFF625).w
    5.     bcc.s   DemoTime
    6.     move.b  #1,($FFFFF64F).w
    7.     rts
    Change to:

    Code (Text):
    1.     movem.l ($FFFFEE50).w,d0-d3
    2.     movem.l d0-d3,($FFFFEEA0).w
    3.     move.l  ($FFFFF61E).w,($FFFFEEEC).w
    4.         cmpi.b  #$10,(Game_Mode).w
    5.         beq SSResults_NoDraw
    6.     cmpi.b  #$5C,($FFFFF625).w
    7.     bcc.s   DemoTime
    8.     move.b  #1,($FFFFF64F).w
    9.  
    10. SSResults_NoDraw:
    11.     rts
    The routine named "DemoTime" contains calls to the draw code, art animation and even demo information, what we've done here is told it to skip these routines if the game mode is still in special stage mode. I'll clarify a third time though, this is working blindly here, I haven't had the time to test it to ensure it is the case.
     
  17. BleuStar

    BleuStar

    20
    0
    0
    New Castle, Delaware
    Sonic The Hedgehog (RevBS) [!]
    Actually, what that does is disable the entirety of the text and causes it the rom to stay at that screen, forcing you to reset. If it is in the original game then I suppose I shouldn't be too worried about it. Thank you for the help anyway!

    I honestly think it has something to do with adding the LZ ripple effect in CPZ and ARZ, especially since they're the only two stages I've noticed this in.
     
  18. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,202
    432
    63
    Japan
    Ah, I see why, in DemoTime the DPLC process routine is called, that is a necessary, hence it should have been "DemoTime" change to:

    Code (Text):
    1. DemoTime:
    2.     cmpi.b  #$10,(Game_Mode).w
    3.     beq SSResults_NoDraw
    4.     bsr.w   JmpTo_LoadTilesAsYouMove
    5.  
    6. SSResults_NoDraw:
    7.     jsr (HudUpdate).l
    8.     bsr.w   ProcessDPLC2
    But you say that it occurs only for water levels with special scrolling? This might be a fix for the wrong bug then.

    Is there a chance you could show us a screenshot of your bug? Perhaps seeing what the bug is may help.
     
  19. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    I'm going to PM this to flamewing. This might be the solution to a bug in Classic Heroes
     
  20. Chaoder

    Chaoder

    Member
    2
    0
    0
    USA
    Alright, I decided to try and apply this to Moto Bug for fun. I managed to get it to where Sonic could not kill him in one hit (by changing the ColType of Moto to the one GHZ Robotnik uses. I'm not sure that was the right way to go about it.) Though, after a hit, Sonic can longer interact with him. I tried looking at GHZ Robotnik to give Moto Bug similar hit-by-Sonic routines, but it seems like the branch stuff Robotnik uses (loc_1783C and similar stuff) can't be used by another object. However, Moto Bug would have to use new "loc"s for his branches, wouldn't he?