add hud in sonic 1 special stage

Discussion in 'Discussion and Q&A Archive' started by SEVAS, Sep 28, 2014.

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

    SEVAS Newcomer Trialist

    Joined:
    May 1, 2014
    Messages:
    7
    Well, this is my first topic and im new with ASM. So i decided to add hud in sonic 1 special stage so i put the LOAD HUD OBJECT in "SS_MainLoop" and this is the result of what i did:

    /monthly_09_2014/post-3042-0-85927900-1411875647_thumb.png

    So, the life counter looks fine, except that theres no counter and the words "SCORE", "TIME" AND "RINGS" and their counters doesnt show as it suppose to be.

    Here is the "SS_MainLoop" code:

    SS_MainLoop:

                              bsr.w           PauseGame

                              move.b       #$A,($FFFFF62A).w

                              bsr.w          DelayProgram

                              bsr.w          MoveSonicInDemo

                              move.w      ($FFFFF604).w,($FFFFF602).w

                              jsr              ObjectsLoad

                              jsr              BuildSprites

                              jsr              AniArt_Load

                              jsr              HudUpdate

                              bsr.w          sub_1642

                              move.b      #$21,($FFFFD040).w ; load HUD object

                              jsr              SS_ShowLayout

                              bsr.w          SS_BGAnimate

                              tst.w           ($FFFFFFF0).w ; is demo mode on?

                              beq.s         SS_ChkEnd ; if not, branch

                              tst.w           ($FFFFF614).w ; is there time left on the demo?

                              beq.w         SS_ToSegaScreen ; if not, branch
     

    Attached Files:

    • Sin t
      File size:
      26.8 KB
      Views:
      176
  2. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    Last edited by a moderator: Sep 28, 2014
  3. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    The Special Stage art overwrites that of the HUD. As nineko stated, art needs to be removed and/or shifted before the Hud art can be properly inserted.
     
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    There is PLENTY of free VRAM space available in the special stages of Sonic one. Unfortunately, it's all a little unorganized. Fortunately, this can be changed with a little revamp of the system, courtesy of this guide by Mercury. Once you did that you can freely move the location of the HUD art in the VRAM in the freed space.
     
  5. SEVAS

    SEVAS Newcomer Trialist

    Joined:
    May 1, 2014
    Messages:
    7
    Well, i tried to do Mercury´s guide that selbi send me, but i cant finished because im using hivebrain´s disassembly. Thanks to Nineko, i have the hud and there is no background anymore, but i cant fix the timer and theres something wrong in the background.

    /monthly_09_2014/post-3042-0-55866900-1411954395_thumb.png
     

    Attached Files:

    • bug.png
      bug.png
      File size:
      33.6 KB
      Views:
      279
  6. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    The background still seems to be trying to load its' old artwork. Because you removed said art, it displays the garbled gibrish you replaced it with.
     
  7. Guest

    Suppose I could Offer some assistance here. Seeing as you already have most the lines that checks for the HUD to be loaded, You have to bear in mind that you also need to add the lines that checks for the counters to be updated, as well as a line that checks for the mappings to be loaded of which in this case is within the LoadPLC2 Routine. I won't go into full details As I am only giving hints here but this is one of the basic ideas you would want to work with as I had to in the past.

    Edit: didn't notice that already got it to load. as for your timer problem, just my Opinion but Considering that the results for the special stage only searches for the score and ring bonus, I would try removing the time counter from there as it isnt really needed at all. not sure about your bg problem though as I had a custom bg in my hack at the time so can't really help there i"m afraid.
     
    Last edited: Sep 29, 2014
  8. SEVAS

    SEVAS Newcomer Trialist

    Joined:
    May 1, 2014
    Messages:
    7
    Thanks pacguy for telling that. Now the background bug its solved by removing "bsr.w    SS_BGAnimate" from "SS_Mainloop". Now, as Blazer said, the time counter is unnecessary in special stage and its true, but i dont now really how to remove the time hud and i have been looking all the asm to have an idea how it works.
     
  9. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    I would of thought the SCORE counter would be unnecessary in the special stages as it'll never change. The timer would actually be nice to leave in to see how long you're taking to get the emerald.

    Anyway, to remove part of the HUD, you could just make another mapping set. Duplicate the mappings data, and edit one of them to remove the Score/Time HUD. Now you have two mappings data; one for the main level (SCORE/TIME/RINGS) and one for the special stage (RINGS). Then in the HUD code when it goes to load the mappings, do something like this:

    Code:
    	move.l	#HUDmappingslevel,mappings(a0)		; Load Level's HUD's mappings
    	cmpi.b	#1,(SPECIALSTAGE).w			; Is it a Special Stage?
    	bne.s	+					; If not, branch
    	move.l	#HUDmappingsspecial,mappings(a0)	; Load Special Stage's HUD's mappings instead
    +
    ;	etc...
     
  10. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    Wouldn't it be better to check for if v_gamemode/$FFFFF600 was set to Special Stage ($10)?

    Also, has anyone ever told you it's "would have/would've", not "would of"? =P
     
  11. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England

    That's what I meant by this check.  I'm at work so I just made the RAM up.  But you see what I'm getting at.

    And me English grade terrible, so piss of! lolz :)
     
    Last edited by a moderator: Sep 30, 2014
  12. SEVAS

    SEVAS Newcomer Trialist

    Joined:
    May 1, 2014
    Messages:
    7
    i tried to do it RHS, but its giving me this error:

    /monthly_10_2014/post-3042-0-14228600-1412299572_thumb.png
     

    Attached Files:

    Last edited by a moderator: Oct 3, 2014
  13. Guest

    I think he set it as an example had it been for sonic 2. in your case since it's sonic 1 your working with, it would look more like this.



    cmpi.b #$10,($FFFFF600).w ; is game mode $10 (special stage)?
    bne.s xxxxxxx ; if not, branch (Where xxxxxxx is your custom routine title)



    Now mind you that if you try to implement it like this, you will just get the same error, or one similar to the one you already had. You would have to make your own routine to have it load your new HUD for the special stage and from there, what ever you named that routine (Ex. SS_LoadHud:) you would replace the xxxxxxx with that. I am only providing this as a basic example, the rest you will have to do yourself.
     
    Last edited: Oct 3, 2014
  14. SEVAS

    SEVAS Newcomer Trialist

    Joined:
    May 1, 2014
    Messages:
    7
    Ok, i will try to make the routine, i will show you the results later. Thanks for your help. :good:
     
  15. SEVAS

    SEVAS Newcomer Trialist

    Joined:
    May 1, 2014
    Messages:
    7
    (First, sorry for my bad english). Sorry for not posting but i have been busy during last days and i will still be busy, but i think about the hud and i decided to leave it like the original levels but i still need to fix the timer bug and i already tried the post that nineko posted.
     
Thread Status:
Not open for further replies.