Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. HiddenPalace

    HiddenPalace Active Member Member

    Joined:
    Feb 9, 2010
    Messages:
    33
    To make the boss fully work I think I need to make a new object id. How do I do that?


    I am having to use the wfz boss object id to make it work so it still loads the wfz music at the end.
     
    Last edited by a moderator: Dec 23, 2010
  2. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Loading the right music is a lesser issue, you can either store the level's music somewhere and reload its value when the boss is defeated, or make a conditional branching to load the music depending on the level's number.


    The object's id is an entry in the object pointer array, so you have to add one.
     
  3. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Today I'm trying to apply ring quotas per Special Stages, but it doesn't seem to work. Today I only applied a few.



    Code:
    Obj09_GetEmer:
    
    		cmpi.b	#6,($FFFFFE57).w&#59; do you have all the emeralds?
    
    		beq.s	Obj09_NoEmer&#59; if yes, branch
    
    		subi.b	#$3B,d4
    
    		moveq	#0,d0
    
    		move.b	($FFFFFE57).w,d0
    
    		lea	($FFFFFE58).w,a2
    
    		move.b	d4,(a2,d0.w)
    
    				cmpi.w	#$700,d0&#59; check	if level is 0700 (Special Stage)
    
    		bne.s	RQ2&#59; if not, branch
    
    				cmpi.w	#50,&#40;$FFFFFE20&#41;.w&#59; <- 1st. ring quota
    
    				blt.w   Obj09_NoEmer&#59; if Less Than, Branch &#40;blt&#41;
    
    				bra	 Cont_E
    
    RQ2&#58;
    
    				cmpi.w	#$701,d0&#59; check	if level is 0700 &#40;Special Stage&#41;
    
    				bne.s	RQ3&#59; if not, branch
    
    				cmpi.w	#60,&#40;$FFFFFE20&#41;.w&#59; <- 1st. ring quota
    
    				blt.s   Obj09_NoEmer&#59; if Less Than, Branch &#40;blt&#41;
    
    				bra	 Cont_E
    
    		addq.b	#1,&#40;$FFFFFE57&#41;.w&#59; add 1 to number of emeralds
    
    RQ3&#58;
    
    				cmpi.w	#$702,d0&#59; check	if level is 0700 &#40;Special Stage&#41;
    
    				bne.s	Obj09_NoEmer&#59; if not, branch
    
    				cmpi.w	#80,&#40;$FFFFFE20&#41;.w&#59; <- 1st. ring quota
    
    				blt.s   Obj09_NoEmer&#59; if Less Than, Branch &#40;blt&#41;
    
    				bra	 Cont_E
    
    Cont_E&#58;
    
    		addq.b	#1,&#40;$FFFFFE57&#41;.w&#59; add 1 to number of emeralds
    
    
    
    Obj09_NoEmer&#58;
    
    		move.w	#$93,d0
    
    		jsr	&#40;PlaySound_Special&#41;.l&#59;	play emerald music
    
    		moveq	#0,d4

    Can somebody explain me what did I do wrong? Thanks in advance. :)
     
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Special Stages don't use level IDs like normal zones. At first I'd check if you are in screen mode $10 (which is special stage) and then the current level you are in. Sadly, there's no flag for this being set, but you could take a look at SS_Load and set one yourself.
     
    Last edited by a moderator: Dec 25, 2010
  5. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    I don't think so. Maybe is this that RAM set?



    Code:
    move.b	&#40;$FFFFFE16&#41;.w,d0; load	number of last special stage
    EDIT: Tried the RAM I posted. Nothing happened.
     
    Last edited by a moderator: Dec 25, 2010
  6. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Read the comment, "number of last special stage". This is NOT the special stage you are currently in.
     
  7. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Ok, about the ring quotas, that's now fixed -- by the way, I'm just using one. Now, I've got another problem. I can't make a message to display.



    Code:
    ; ===========================================================================
    
    ; ---------------------------------------------------------------------------
    
    ; Object Unknown - Message that appears 
    
    ; ---------------------------------------------------------------------------
    
    
    
    ObjUnk&#58;				&#59; XREF&#58; Obj_Index
    
    		moveq	#0,d0
    
    		move.b	$24&#40;a0&#41;,d0
    
    		move.w	ObjUnk_Index&#40;pc,d0.w&#41;,d1
    
    		jmp	ObjUnk_Index&#40;pc,d1.w&#41;
    
    ; ===========================================================================
    
    ObjUnk_Index&#58;	dc.w ObjUnk_Main-ObjUnk_Index
    
    		dc.w ObjUnk_Flash-ObjUnk_Index
    
    ; ===========================================================================
    
    
    
    ObjUnk_Main&#58;			&#59; XREF&#58; Obj21_Main
    
    		addq.b	#2,$24&#40;a0&#41;
    
    		move.w	#$0,8&#40;a0&#41;
    
    		move.w	#$108,$A&#40;a0&#41;
    
    				move.l	#Map_objUnk,4&#40;a0&#41;&#59; ...
    
    		move.w	#$6CA,2&#40;a0&#41;
    
    		move.b	#0,1&#40;a0&#41;
    
    		move.b	#0,$18&#40;a0&#41;
    
    				jmp	 DisplaySprite
    
    
    
    ObjUnk_Flash&#58;			&#59; XREF&#58; Obj21_Main
    
    				
    
    				lea	&#40;Ani_objUnk&#41;.l,a1
    
    		jmp	AnimateSprite
    
    Ani_objUnk&#58;
    
    				dc.w	Flashez-Ani_objUnk
    
    				dc.w	Dissapear-Ani_objUnk
    
    Flashez&#58;		  dc.b	7, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, $FD, 1, 0
    
    Dissapear&#58;	  dc.b	0, 1, $FF
    
    
    
    Map_objUnk&#58;
    
    				include &#34;_maps\objUnk.asm&#34;

    But it doesn't load! What's wrong?
     
  8. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    :) Sounds a bit confusing for me. You want a message for display what?


    Describe this correctly, please.
     
  9. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Message to display "GET 100 RINGS" in the Special Stage.
     
  10. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Well, for me the simple fact "jmp DisplaySprite" is in the "main" (initialization) part of the object's code seems to be a good reason for it not to show.


    It should first be "animatesprite", then only "displaysprite", and not in the main, as this part will run only once.


    There may be something else though.
     
  11. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    The code must check if Sonic has less than 100 rings for show the message. If not, this must branch into some looped routine you can create. If yes, you must use a address for store a word value, like 100. So the routine must check if 100 is stored at this address. If yes, you can use the cmpi.w for check if 100 is there. So if 100 is stored there, display the sprite.
     
    Last edited by a moderator: Dec 28, 2010
  12. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    There are two things I can see wrong, the first thing is:



    move.b #0,1(a0)



    and



    move.w #$0,8(a0)
    move.w #$108,$A(a0)



    When $01(a0)'s 2nd bit is set, it is a level object and follows the co-ordinate positions of the screen's X and Y positions, if it is NOT set (as you have yours not set) it is what I would best describe as a HUD object, in other words it will NOT follow the co-ordinate positions of the screen's X and Y positions, insted it follows the "standard" rules of the VDP chip's sprites, if the X or Y positions are lower than 80 pixels (hex), it will present OUTSIDE the screen on the left or upper side so you wouldn't be able to see it even if it were set to show on screen anyways.


    (Set the X and Y positions to 80+, not too high or it'll go outside the screen on the right or below area).


    The second thing is the way the code is written, it doesn't flow correctly to work with the engine properly, it jumps to "DisplaySprite" where it saves the object space ready for writing the sprites, but ONLY for the first cycle, as the routine counter is increased and it's set to run routine "ObjUnk_Flash" for the remainder of it's existance, and there's no jump/branch to "DisplaySprite" in that routine. Following "SpirituInsanum's" advice would also be a good idea.


    Below I have provided a fix, but you'll have to correct it all yourself to make it work the way you want it:



    ; ===========================================================================
    ; ---------------------------------------------------------------------------


    ; Object Unknown - Message that appears


    ; ---------------------------------------------------------------------------


    ObjUnk:


    moveq #$00,d0 ; clear d0


    move.b $24(a0),d0 ; load routine counter


    move.w ObjUnk_Index(pc,d0.w),d1 ; load correct add address to jump to


    jmp ObjUnk_Index(pc,d1.w) ; add address and jump


    ; ===========================================================================


    ObjUnk_Index: dc.w ObjUnk_Main-ObjUnk_Index ; 00


    dc.w ObjUnk_Flash-ObjUnk_Index ; 02


    ; ===========================================================================


    ; ---------------------------------------------------------------------------


    ; Startup routine


    ; ---------------------------------------------------------------------------


    ObjUnk_Main:


    addq.b #$02,$24(a0) ; increase routine counter


    move.w #$0080,$08(a0) ; set X position


    move.w #$0080,$0A(a0) ; set Y position


    move.l #Map_objUnk,$04(a0) ; set map/sprite list address


    move.w #$06CA,$02(a0) ; set VDP (V-Ram address) settings


    move.b #$00,$01(a0) ; set render modes


    move.b #$00,$18(a0) ; set priority (hi-plane)


    move.b #$80,$19(a0) ; set display distances (how far out of screen to display)


    ; ---------------------------------------------------------------------------


    ; Display routine


    ; ---------------------------------------------------------------------------


    ObjUnk_Flash:


    lea (Ani_objUnk).l,a1 ; load animation script address


    jsr AnimateSprite ; load correct map ID based on the script


    jmp DisplaySprite ; save object ram space ready for display


    ; ===========================================================================


    ; ---------------------------------------------------------------------------


    ; Animation script


    ; ---------------------------------------------------------------------------


    Ani_objUnk: dc.w Flashez-Ani_objUnk ; 00


    dc.w Dissapear-Ani_objUnk ; 01


    ; ---------------------------------------------------------------------------


    Flashez: dc.b 7, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, $FD, 1, 0


    Dissapear: dc.b 0, 1, $FF


    even


    ; ---------------------------------------------------------------------------


    ; ===========================================================================


    ; ---------------------------------------------------------------------------


    ; Map/Sprite lists


    ; ---------------------------------------------------------------------------


    Map_objUnk: include "_maps\objUnk.asm"


    even


    ; ---------------------------------------------------------------------------


    ; ===========================================================================
     
  13. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Three words: I.LOVE.YOU. Thanks a lot! :D. Now I got it fixed. ^^


    EDIT: Thanks to EK, SpirituInsanum, and other people that helped there! :)
     
    Last edited by a moderator: Dec 28, 2010
  14. HiddenPalace

    HiddenPalace Active Member Member

    Joined:
    Feb 9, 2010
    Messages:
    33
    I am having trouble with some of the pattern load cues in hpz like the spikes, springs, water,and egg prison. What can I do to correct this?
     
  15. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Can you show us pics? They could turn our lifes easier.
     
  16. HiddenPalace

    HiddenPalace Active Member Member

    Joined:
    Feb 9, 2010
    Messages:
    33
    The first image is that there should be spikes where sonic is standing. The second image is the messed-up water. The third is the egg prison. The springs are in the level but they are out of sight.

    /monthly_12_2010/post-1057-1293733240_thumb.gif

    /monthly_12_2010/post-1057-1293733270_thumb.gif

    /monthly_12_2010/post-1057-1293733300_thumb.gif
     

    Attached Files:

  17. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    So i've wasted a couple hours for 4 days trying to figure this thing out. I really hate the fact I waste so much time trying to figure something out, well longer that I would want or expect, and then I end up giving up because I can't find a solution. So I'll show a simular example to my code and then explain what it is I'm trying to do.


    For starters it is object 0f (press start button), and I've set up a simple menu at the title where you press left/right and it will switch to options and then back etc. But what I've been trying to do is to get the menu to move off screen (say start menu) when pressing say left/right, and then re-appear from the right with the new frame (options menu instead of start menu). Like sonic CD if you don't understand. I've got the options, but it won't move the way I want it to. And its proberly something really easy, so i'm gonna keep trying with hope that I'll figure it soon. Here is the menu code example:


    Excluding the actual loading of the object, thats fine:



    Code:
    Obj0F_StartMenu&#58; 
    
    						   move.b #1,$1A&#40;a0&#41;&#59; start game frame 
    
    
    
    Obj0F_PressLeft&#58;
    
    						   move.b  &#40;FFFFFF605&#41;.w,d0  
    
    						   btst   #2,d0					&#59; Test if left is pressed
    
    						   beq.s  No_MenMovement &#59; No? then branch to no movement
    
    						   subq.w #6,8&#40;a0&#41;			 &#59; subtract with a speed of 6 from the x position
    
    						   cmpi.w #$10,8&#40;a0&#41;		 &#59; Check if it past this position
    
    						   bne.s   No_MenMovement  
    
    						   move.b #2,$1C&#40;a0&#41;	   &#59; options frame
    
    						   move.b #1,&#40;FFFFF635&#41;.w&#59; set to ram adress so no repeat
    
    						   
    
    Obj0F_LeftAgain&#58;
    
    						  etc
    
    						  rts
    
    
    
    No_MenMovement&#58;
    
    						  rts
    Basically if you press left, then its supposed to be subtracting the x position with a speed of 6, eventually it should move off the screen unless I check to stop or something. Instead, it moves a small fraction and thats it. You can keep pressing left and it will just move by a small fraction each time, when I want it to just keep moving when pressing left or right until I make it stop. If I remove the check of pressing left, it does move continuously with out stopping. So why is it that it doesn't do the same when I just put in a check so that it only moves continously when left is pressed, but instead move a fraction and then stops?. The only thing it seems is the check. But surely theres away, it can't just halt it, can it? I hate having to ask questions, I always want to figure things out myself. Sure over time I got a bit further, but still haven't got the desired results. Any help will be greatly appreciated, and then I'll bang my head against the wall, when I find out its a simple fix lol.
     
    Last edited by a moderator: Dec 31, 2010
  18. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    The very first thing I see wrong here is that you should be pressing left at every frame for it to move:


    Frame N: you press left, it continues the code: it subtracts 6 to x.


    Frame N+1: you don't press left anymore, it branches to No_MenMovement and it's over.


    I can't say for sure what would be the best way to do what you want though, but you could instead make a main (not init) routine that checks which button has been pressed, then change the routine counter accordingly. And of course in those routines you wouldn't put the button check.
     
    Last edited by a moderator: Dec 31, 2010
  19. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    move.b ($FFFFFF605).w,d0
    btst #2,d0 ; Test if left is pressed



    $FFFFFF605 is pressed buttons bitfield, but it holds button presses for only 1 frame.


    So, if you press left, the first frame bit 2 of this field will be set, but if you continue holding left, the next frame bit 2 of this bitfield will be cleared and bit 2 of $FFFFFF604 byte will be set. That's because you can't hold and press button at the same moment.


    So, you are to press Left button every frame.


    You can check out $FFFFFF604 byte instead, with it your moving code will be run every frame until you release the button. But this is a very very bad way for menus, because it's incredibly hard to release the button exactly on the X-position you want =P


    The better way is like SpirituInsanum suggested. It's really better to add one more routine in Obj0F_Index for this movement and activate it from another routine when Left button is pressed.
     
    Last edited by a moderator: Dec 31, 2010
  20. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    Playing with the new special stage editor, I opened for the very first time stages 5 and 6, and saw there are a few unknown objects in those two (showing "?" icons).


    Does anyone know what they are/were meant to be?