Basic Questions and Answers Thread

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

  1. Hanoch

    Hanoch Well-Known Member Member

    Joined:
    Aug 3, 2008
    Messages:
    312
    Location:
    Israel
    Hey I am editing the resize code to have cool scenes in it, and I am trying to delete an object using the resize code.


    I am kinda lost, I know its related to RAM addresses somehow but Im not sure how to do it.
     
  2. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    What you could try is, setting the deletaed object as a free ram adress for example: $FFFFF34A.


    So it would be something like this ;


    Resize_ghz:


    move.b #1,($FFFFF34A).w


    bsr.s CheckObjectdelete


    rts


    CheckObjectdelete:


    cmpi.b #1,($FFFFF34A).w ; object been set?


    bne.s Return_ResizeGH ; if not don't delete


    jsr DeleteObject ; Delete object


    Return_ResizeGH:


    rts


    This is only a rough idea of how you could do it, but I will go into it further after christmas.
     
    Last edited by a moderator: Dec 24, 2009
  3. Hanoch

    Hanoch Well-Known Member Member

    Joined:
    Aug 3, 2008
    Messages:
    312
    Location:
    Israel
    Yea but, Im placing it using Soned2.


    I had simillar doing with removing a Layout piece, just modifying the RAM address the layout is at


    however, it is different with this, because this is an object.
     
  4. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    So I got a question about bosses in sonic 1. I am editing the ghz boss, and at certain times would like to change the current animation that he is using. I tried using $1C, like for example: move.b #1,$1C(a0) but the animation does not change. And so I searched object 3D(ghz boss) and look for any $1C and here's what I found.



    Code:
    Obj3D_LoadBoss:; XREF: Obj3D_Main
    
    		move.b	(a2)+,$24(a1)
    
    		move.b	#$3D,0(a1)
    
    		move.w	8(a0),8(a1)
    
    		move.w	$C(a0),$C(a1) 
    
    		move.l	#Map_MSonic,4(a1)
    
    		move.w	#$400,2(a1)
    
    		move.b	#4,1(a1)
    
    		move.b	#$20,$19(a1)
    
    		move.b	#3,$18(a1)
    
    		move.b	(a2)+,$1C(a1)
    
    		move.l	a0,$34(a1)
    
    		dbf	d1,Obj3D_Loop; repeat sequence 2 more times


    Now this bit move.b (a2)+,$1C(a1), is the first I found but to be honest I don't know what its doing.



    Code:
    loc_17A5A:
    
    		move.b	d1,$1C(a0); move d1 to 1C
    
    		subq.b	#2,d0
    
    		bne.s	Obj3D_FaceDisp
    
    		move.b	#1,$1C(a0); move 1 to 1C	
    
    		tst.b	1(a0)
    
    		bpl.s	Obj3D_FaceDel


    The next two were near the end, and are to do with the defeated eggman sprite/anim and when he flies away. Now this doesn't help at all because I want the animation to change to ceratin animations while fighting the boss.



    I noticed that d1 gets moved to $1C and not the other way round. Which kinda confuses me aswell, so I wen't back and looked at d1, and found these.



    Code:
    Obj3D_FaceMain:; XREF: Obj3D_Index
    
    		moveq	#0,d0
    
    		moveq	#6,d1; main animation,(eggman's face)
    
    		movea.l	$34(a0),a1
    
    		move.b	$25(a1),d0
    
    		subq.b	#4,d0
    
    		cmpi.w	#$2A70,$30(a1)										   
    
    		bne.s	loc_17A46
    
    		moveq	   #1,d1; use 1st animation				
    
    
    
    loc_17A3E:
    
    		subq.b	#6,d0
    
    		bmi.s	loc_17A46
    
    		moveq	#$A,d1
    
    		bra.s	loc_17A5A
    
    ; ===========================================================================
    
    
    
    loc_17A46:
    
    		tst.b	$20(a1)
    
    		bne.s	loc_17A50
    
    		&#59;moveq	#1,d1
    
    		bra.s	loc_17A5A

    Now here using d1 actually does the same as $1C would normally do, it changes the animation, which again got me confused as I'm pretty sure $1C doesn't get moved to d1 at all in the object.


    I need to know how the animtion works here, and how I can make it so that the boss uses a certain animatioon until a certain point then changes, and then changes again to when he's at a certain point. I done a small video of my metal sonic boss before,(some of you may know this) and thats what I'm trying to continue and make better, but I need guidnece, boss editing I enjoy but its hard.
     
  5. RandomAvatarFan

    RandomAvatarFan Well-Known Member Member

    Joined:
    Apr 10, 2009
    Messages:
    100
    I have some basic questions about the Sonic 1 ObjPos_Index. I was fooling around with it, and I wanted to know why there was a ObjPos_Null after every entry:



    dc.b ObjPos_GHZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index



    I see the entry for ObjPos_Null, and I know it's obvious that it is a null entry, but I wanted to know the reason a null entry is needed.


    Also what is pf ?


    I see it listed for Labyrinth, 2 per act



    ObjPos_LZ1pf1- ObjPos_Index, ObjPos_LZpf2-ObjPos_Index



    I thought it was for water but then it's listed for Scrap Brain 1, and only for act 1. And there's 6 of them.



    dc.w ObjPos_SBZ1pf1-ObjPos_Index, ObjPos_SBZ1pf2-ObjPos_Index
    dc.w ObjPos_SBZ1pf3-ObjPos_Index, ObjPos_SBZ1pf4-ObjPos_Index


    dc.w ObjPos_SBZ1pf5-ObjPos_Index, ObjPos_SBZ1pf6-ObjPos_Index



    I looked around and I couldn't find anything about it.
     
  6. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    For your first question--It's because the game follows a table. If that entry weren't there the game wouldn't know what to do. That's just telling the game 'hey, there's just rts here'.


    For your second question, go to ObjPos_LZ1pf1: Water would be somewhere else. I haven't worked with S1 so I wouldn't know.
     
  7. hfdshdgfhgn

    hfdshdgfhgn fdsgfdgfhgfds Member

    Joined:
    Dec 28, 2009
    Messages:
    89
    Never mind, got it.
     
    Last edited by a moderator: Feb 15, 2010
  8. Zulkaroth

    Zulkaroth Newcomer Member

    Joined:
    Feb 9, 2010
    Messages:
    15
    Location:
    A Road with No End
    I know I am doing something incredibly stupid here.


    When I say



    INCLUDE "sonic.asm"
    INCLUDE "knuckles.asm"



    it says:


    > > >s2.asm(32805): error: undefined attribute


    > > > INCLUDE "sonic.asm"


    > > >s2.asm(32806): error: symbol double defined


    > > > INCLUDE


    > > > INCLUDE "knuckles.asm"


    > > >s2.asm(32806): error: undefined attribute


    > > > INCLUDE "knuckles.asm"


    What am I doing?
     
  9. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    390
    Location:
    Russia
    I think you forgot to add tabs before "INCLUDE". Because if there are no tabs before a command, compiler thinks its a label.
     
  10. Zulkaroth

    Zulkaroth Newcomer Member

    Joined:
    Feb 9, 2010
    Messages:
    15
    Location:
    A Road with No End
    I did that, and then it gave me about 200 jump distance too big errors. What are those?
     
  11. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    390
    Location:
    Russia
    I don't know much about Sonic 2 compiler but I guess it says that some branch offsets are overflowed. That means


    after you had added contents from "sonic.asm" and "knukles.asm" some labels got too far for some branch commands.


    I wonder where you have placed your new code and what's in those ASM-files?
     
  12. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    You can't just add your .asm files anywhere, that shifts the data over and a lot of previously reaching commands such as bra are no longer going to reach. add your stuff at the end of the asm file to prevent this.
     
  13. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    971
    Location:
    United Kingdom
    If there's things like macros, such as the s1smps2asm ones, it is very unwise to do this. I suggest the top (and I mean that) of the ASM file instead, for things like that. That means nothing will get overwritten, and easily found. :huh:
     
    Last edited by a moderator: Feb 18, 2010
  14. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    390
    Location:
    Russia
    In the top of the file there are vectors and initialization routines. Of course, it's possible to put your data there but that would be a little unwise. It's better to place your data in the middle or in the end of ROM.


    ADDED: BTW if you add the data to the end, nothing will be overwritten as well :huh:
     
    Last edited by a moderator: Feb 18, 2010
  15. Zero

    Zero Active Member Member

    Joined:
    Jan 26, 2009
    Messages:
    37
    I have a question for sonic 1:


    when you have multiple characters, how do you get the hud to load instantly instead of after a demo or special stage attempt?


    I can't seem to make it load unless the above conditions are met....


    EDIT: Found a temperary solution.
     
    Last edited by a moderator: Feb 23, 2010
  16. SamplingMastersNix

    SamplingMastersNix 64-bit Sonic Hacking Novice Member

    Joined:
    Feb 13, 2010
    Messages:
    54
    Location:
    Madison, MS
    Quick question using SonED2:


    Is it possible to import a tileset made in GIMP? If so, how do I make a tileset? As in, what needs to be kept in mind when making Sonic 1 hacks with original tilesets?
     
  17. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    If you really mean tiles (8x8), yes, it's possible, but it may be a huge lot of work since tiles are hard to recognize. If you really want to edit the tiles themselves, you should first export the tiles from an existing level (misc > export to image > tiles), then open them in GIMP and edit them. Don't forget you can only use one row of colors per tile (the rows top-left when you're in soned2's tile editor), so editing tiles in GIMP may not be really user-friendly.


    I think you should try with blocks instead, the palette problems are a little more complex (1 row of colors per tile, 4 tiles per block), but it's much easier to see what you're doing with those.


    Palettes are probably the only problem actually.


    Then import with file > import from image > tiles (or blocks). It may take a few seconds (chunks do, don't know about tiles and blocks).
     
  18. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    The things you have to note, is it has to be in pcx format, there is a guide on retro that can help you import art. Though if your just editing a few tiles, I recomend editing with in soned2.
     
  19. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    I have a question.


    What would be the most effective way to clear several bits in the same word at the same time? For example, say I want to clear bits 3, 4 and 6 in FFFFFF90, I'd like to know what's the fastest operation for the hardware (or emulator) to do that.


    If I remember correctly, what I want is technically an AND, with a %10100111 ($A7) mask, but the AND doesn't look to be used to do this, and there may be an other solution. ;)


    I needed several flags for something. So far I've been using bclr to clear each bit separately, that was easier to correct errors, but there's probably a better way to do it.
     
  20. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,863
    and.b #$A7,($FFFFFF90).w


    is the best option as far as I know.