Special Stage HUD counter. Timer doesn't work.

Discussion in 'Discussion and Q&A Archive' started by DeoxysKyogre, Dec 6, 2010.

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

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Okay, so I've been trying to make the HUD appear in the Special Stage mode. The ring counter worked just fine, but the timer didn't. Here's how I edited the SS_MainLoop code:



    Code:
    SS_MainLoop:
    
    		bsr.w	PauseGame
    
    		move.b	#$A,($FFFFF62A).w
    
    		bsr.w	DelayProgram
    
    		bsr.w	MoveSonicInDemo
    
    		move.w	($FFFFF604).w,($FFFFF602).w
    
    		   	move.b  #$21,($FFFFD040).w&#59; load HUD object
    
    		move.b	#1,($FFFFFE1F).w&#59; update score	counter
    
    		move.b	#1,($FFFFFE1D).w&#59; update rings	counter
    
    		move.b	#1,($FFFFFE1E).w&#59; update time counter
    
    				jsr	 Hud_Base
    
    		jsr	 HudUpdate
    
    		jsr	ObjectsLoad
    
    		jsr	BuildSprites
    
    		jsr	SS_ShowLayout
    
    		bsr.w	SS_BGAnimate
    
    		tst.w	($FFFFFFF0).w&#59; is demo mode on?
    
    		beq.s	SS_ChkEnd&#59; if not, branch
    
    		tst.w	($FFFFF614).w&#59; is there time	left on	the demo?
    
    		beq.w	SS_ToSegaScreen&#59; if not, branch

    But, the funniest thing is that it tries to work like this:


    It's 0:00, and it tries to pass to 0:01, but then, soon it comes back to 0:00. Does somebody know the problem? Thanks in advance.
     
  2. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    This problem is probably because HUD_Base is run every frame. This subroutine loads some uncompressed art and fills time counter with the tiles of zero digits. And due to time counter tiles are updated just every 60 frames (i.e. 1 second), they just get overwritten almost every frame.


    Try to place it somewhere in Special Stage initialization code, it's the best place for it.
     
  3. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    It didn't work. I placed HUD_Base somewhere else, and now it stays always like, 0:00. And the ring counter didn't work either.
     
  4. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    It looks like Special Stage screen mode uses 64x64 cells for mapping planes, so it takes huge part of VRAM, $4000 bytes. Addresses, where the HUD tiles are meant to be, are used for the plane mappings. Fortunately, they loaded once and are not updated anymore. But writing HUD tiles to VRAM will spoil BG anyways.


    I've tested your code and found that HudUpdate has some troubles accessing VDP, because it doesn't load VDP control port into a6 excepting its already loaded.


    So, you can just place "lea ($C00000).l,a6" in the very beginning of HudUpdate, it will work, I checked =P


    Although, due to this subroutine access VRAM every frame, I'd highly recommend to place it in VBlank routine for Special Stage, in loc_DA6, in the end, after "bsr.w PalCycle_SS", for example. Though, I haven't checked this out.
     
Thread Status:
Not open for further replies.