Basic Questions and Answers Thread

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

  1. KingofHarts

    KingofHarts Active Member Member

    Joined:
    Sep 30, 2012
    Messages:
    47
    Location:
    Chi-Town
    I'd have posted here but it's locked: http://sonicresearch.org/forums/index.php?showtopic=4183&p=52420

    EDIT-FIXED: http://forums.sonicretro.org/index.php?showtopic=10880&st=5310&p=807956&#entry807956

    I'm actually trying to do this in Sonic 1.... but what's happening, is that while it works properly for ALL other characters, when I play as Knuckles, the wall breaks whenever Knuckles' x-position is close enough to the wall, seemingly regardless of Y position. Mind you, close enough being about 5-6 feet away from the damn thing. I'm sure I'm missing something VERY BASIC and EASY to fix... I've tried adapting the S1 code t suit the S3K code... but something is not right... I think it has to do with how far I'm skipping ahead with Knuckles... but IDK because I don't feel like I'm doing this any differently from S3K... Here is my code:

    Code:
    Smash_Solid:	; Routine 2
    		move.w	(v_player+x_vel).w,speed(a0) ; load character's horizontal speed
    		move.w	#$1B,d1
    		move.w	#$20,d2
    		move.w	#$20,d3
    		move.w	x_pos(a0),d4
    		bsr.w	SolidObject
    		cmpi.b	#id_KnuxPlayer,id(a1) 	; is the current character Knuckles
    		beq.s	@continue		; if yes, continue
                    btst	#5,status(a0)		; is character pushing against the wall?
    		beq.s	@donothing		; if yes, branch
    
    	@chkroll:
    		cmpi.b	#id_Roll,anim(a1) 	; is character rolling?
    		bne.s	@donothing		; if not, branch
    		move.w	speed(a0),d0
    		bpl.s	@chkspeed
    		neg.w	d0
    
    	@chkspeed:
    		cmpi.w	#$480,d0		; is character's speed $480 or higher?
    		bcs.s	@donothing		; if not, branch
    		bclr	#5,status(a0)
    
    	@continue:
    		move.w	speed(a0),x_vel(a1)
    		addq.w	#4,x_pos(a1)
    		lea	(Smash_FragSpd1).l,a4 ;	use fragments that move	right
    		move.w	x_pos(a0),d0
    		cmp.w	x_pos(a1),d0	; is player to the right of the block?
    		bcs.s	@smash		; if yes, branch
    		subq.w	#8,x_pos(a1)
    		lea	(Smash_FragSpd2).l,a4 ;	use fragments that move	left
    		
    	@smash:
    		move.w	x_vel(a1),g_vel(a1)
    		bclr	#5,status(a1)
    		moveq	#7,d1		; load 8 fragments
    		move.w	#$70,d2
    		bsr.s	SmashObject
    
    	@donothing:
    		rts
    
    Smash_FragMove:	; Routine 4
    		bsr.w	SpeedToPos
    		addi.w	#$70,y_vel(a0)	; make fragment	fall faster
    		bsr.w	DisplaySprite
    		tst.b	render_flags(a0)
    		bpl.w	DeleteObject
    		rts
    
     
    Last edited by a moderator: Nov 22, 2014
  2. Kaz

    Kaz Well-Known Member Member

    Joined:
    Nov 2, 2013
    Messages:
    66
    SwScrl_EHZ:tst.w (Two_player_mode).w

    bne.w loc_C6C4

    move.w ($FFFFEE0C).w,($FFFFF618).w

    lea ($FFFFE000).w,a1 ; load beginning address of horizontal scroll buffer to a1

    move.w ($FFFFEE00).w,d0 ; load FG screen's X position

    neg.w d0 ; negate (positive to negative)

    swap d0 ; send to the left side of d0

    move.w ($FFFFEE08).w,d0 ; load BG screen's X position

    neg.w d0 ; negate (positive to negative)

    asl.w #1,d0 ; multiply by 2 (Speed up the scroll position)

    move.w #49-1,d1 ; set number of scan lines to dump (minus 1 for dbf)

    SwScrl_EHZ_1:

    move.l d0,(a1)+ ; dump both the FG and BG scanline position to buffer

    dbf d1,SwScrl_EHZ_1 ; repeat d1 number of scanlines

    move.w ($FFFFEE00).w,d0 ; load FG screen's X position

    neg.w d0 ; negate (positive to negative)

    swap d0 ; send to the left side of d0

    move.w ($FFFFEE08).w,d0 ; load BG screen's X position

    neg.w d0 ; negate (positive to negative)

    asr.w #1,d0 ; divide by 2 (Slow down the scroll position)

    move.w #20-1,d1 ; set number of scan lines to dump (minus 1 for dbf)

    SwScrl_EHZ_2:

    move.l d0,(a1)+ ; dump both the FG and BG scanline position to buffer

    dbf d1,SwScrl_EHZ_2 ; repeat d1 number of scanlines

    move.w ($FFFFEE00).w,d0 ; load FG screen's X position

    neg.w d0 ; negate (positive to negative)

    swap d0 ; send to the left side of d0

    move.w ($FFFFEE08).w,d0 ; load BG screen's X position

    neg.w d0 ; negate (positive to negative)

    asr.w #2,d0 ; divide by 4 (Slow down the scroll position)

    move.w #157-1,d1 ; set number of scan lines to dump (minus 1 for dbf)

    SwScrl_EHZ_3:

    move.l d0,(a1)+ ; dump both the FG and BG scanline position to buffer

    dbf d1,SwScrl_EHZ_3 ; repeat d1 number of scanlines

    rts



    This EHZ scroll routine made with Selbi's Parallax Editor doesn't work, somewhat. Just a static image. I followed every step carefully in Xeno disasm, so mind if anybody can give a hand?
     
    Last edited by a moderator: Nov 22, 2014
  3. Guest

    A bit of some help that I need. So after editing the art for ghz, the art for the title screen emblem became all glitchy looking, specifically this:

    [​IMG]

    My other problem is that after I edited the deform code for ghz, the emblem seems to scroll off the screen:

    [​IMG]

    So to the main question, are there any particullar fixes for these?
     
  4. Painto

    Painto Samodzierżca Najdłuższego Kija Member

    Joined:
    Mar 24, 2014
    Messages:
    315
    Location:
    Poland
    Maybe I'm wrong, but still, I'm writing this - I hope it somehow helps.

    From what I've seen in the code, in the original Sonic 1, GHZ art is split to two parts. They both combined create the full GHZ art. One part of it is used at title screen. Also noticed, that when combining art and load combined art mskes title emblem have GHZ tiles instead. I don't really know how you can fix it, but maybe you should try do like S1 did with some modifications - separate your art to two files then at title load only one of them. In Sonic 1, the first GHZ part contains all the BG tiles and it's 1CD tiles long (if it somehow helps).

    As for moving emblem - I remember, that in original S1, in Deform_GHZ: there was a check for title screen before label loc_633C: or Deform_GHZ_2: (REV00 and REV01 effects respectively). Maybe this is the problem.

    But as stated at the beginning, not sure about these, but I think that is worth checking.
     
  5. Pacca

    Pacca Why succeed when you can profit off of failure? Member

    Joined:
    Jul 5, 2014
    Messages:
    1,149
    Location:
    Triton (Moon)
    trash
     
    Last edited by a moderator: Nov 24, 2014
  6. Pacca

    Pacca Why succeed when you can profit off of failure? Member

    Joined:
    Jul 5, 2014
    Messages:
    1,149
    Location:
    Triton (Moon)
    trash
     
    Last edited by a moderator: Nov 24, 2014
  7. Pacca

    Pacca Why succeed when you can profit off of failure? Member

    Joined:
    Jul 5, 2014
    Messages:
    1,149
    Location:
    Triton (Moon)
    First, use this tutorial with default GHZ data to fix the artwork and mappings. Then, find "Title_LoadText:" and below it find this line:

    move.w   #0,($FFFFFE10).w; set level to GHZ (00)

    Change it to a level ID with appropriate pallete cycle and scroll data (preferably, you could add a new zone which only has defined pallete cycle and scroll data)

    With those fixes, it should look similar or identical to the original S1 title screen, and should be editable seperately from GHZ.
     
    Last edited by a moderator: Nov 24, 2014
  8. CollinAB

    CollinAB Active Member Exiled

    Joined:
    Nov 24, 2014
    Messages:
    30
    Location:
    76 6th ave
    I'm creating an improved S1 sound driver & I got an error during it.

    Here:
    >>> MegaPCM.asm: error: expression must be evaluatable in first pass
    >>> if SegaPCM_68K = 0

    HOW DO I GET RID OF IT?
     
  9. Clownacy

    Clownacy Well-Known Member Staff

    Joined:
    Aug 15, 2014
    Messages:
    876
    STOP USING PARTS OF MY DRIVER


    IT'S NOT DESIGNED TO BE FRANKENSTEINED


    In other news, you need to either define the variable 'SegaPCM_68K', or remove the check.


    Because of the way PlaySega is in the current disasms, the sound will be broken with Mega PCM installed (unless you did some creative placement). Fixing that would require the reworking of that code. SegaPCM_68K was supposed to help with that, but...
     
    Last edited by a moderator: Nov 27, 2014
  10. CollinAB

    CollinAB Active Member Exiled

    Joined:
    Nov 24, 2014
    Messages:
    30
    Location:
    76 6th ave
    Speaking of your S2 clone driver, Ring placement Is shit & There's game crashes & music stops, So I need help on that as well.
     
  11. redhotsonic

    redhotsonic Also known as RHS Retired Staff

    Joined:
    Aug 10, 2007
    Messages:
    2,967
    Location:
    England
    Probably an error on your end, not with Clownacy's driver.
     
  12. CollinAB

    CollinAB Active Member Exiled

    Joined:
    Nov 24, 2014
    Messages:
    30
    Location:
    76 6th ave
    I'm porting knuckles to sonic 2 & I need to get rid of this error:

    > > >s2.asm(78286): error: jump distance too big

    > > > bne.s ++ ; rts

     
     
  13. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    911
    Location:
    the united states. where else?
    Let me give you a short but informative lesson on branches.

    .s = short

    .w = word-sized (basically, long)

    jmp/jsr = infinite, if used right

    A short branch can only travel $FF bytes (128), so the cause of your error is that there is too much code/data between that line and the second + down starting from that line. Simply change the bne.s to a bne.w (which if I recall can travel $FFFF bytes, which is 65535 bytes) and you'll be fine.

    If that doesn't work, I can help you set up a conditional jump, which essentially gives infinite branch length (as far as I know), thus eliminating the possibility of the error occurring in the first place, but that's for later.
     
    Last edited by a moderator: Nov 28, 2014
  14. JoenickROS

    JoenickROS ROS is on hiatus. (...again) Member

    Joined:
    Feb 5, 2012
    Messages:
    920
    Or, don't use .s or .w at the end, it will chose the most appropriate one depending on how far it has to branch. Its not recommended, but a couple people I know here do it.

    Edit: People who are more experienced than me =p
     
    Last edited by a moderator: Nov 28, 2014
  15. Clownacy

    Clownacy Well-Known Member Staff

    Joined:
    Aug 15, 2014
    Messages:
    876
    Not in all cases. asm68k just chooses the largest and least efficient branch/jump size. It actually kept S1's disasm bit-perfect, but using AS broke it, because it used the more efficient ones. At least, it did until MainMemory fixed it.

    For example...

    bra    loc_10 = bra.w  loc_10

    jmp    loc_10 = jmp    (loc_10).l
     
  16. PixelVoxel

    PixelVoxel Newcomer Trialist

    Joined:
    Nov 26, 2014
    Messages:
    3
    Location:
    Lost Hex
    I'm having a minor (or at least, I hope it's minor) issue with my hack. I've just started a hack of Sonic 2 for the first time, and I placed a sign post in the level. The issue is that it does that glitch where it pushes you through chunks. Before, when I still had the end of Emerald Hill Zone there, it would push me to where that act would end. I removed all of that, and now it just kills me.

    I can't seem to find anything for fixing this, so I'd appreciate help here (I get the feeling someone asked this before in this very same thread).
     
  17. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    The sign post is just an object. You need to tell the game <this is where the level actually ends> by screen coordinates. I think these are in the level events. The screen locks, and then the sign post ends the level. You need to have both to have the level end.
     
  18. Painto

    Painto Samodzierżca Najdłuższego Kija Member

    Joined:
    Mar 24, 2014
    Messages:
    315
    Location:
    Poland
    I have 2 questions related with Sonic 2:

    • What's the limit of rings I can place in single act in Sonic 2? I heard that going above it can mess up things, so I want to know how many rings I can add.
    • As I need a boss for HPZ (and MCZ boss is too mainstream in hacks with HPZ), I decided to port from Sonic 1 my Bridge Zone boss I made for Painto Edition 2. The things is that I don't know if the objoff_XX's are the same in both games. Luckily enough, my boss is just a cheap edit of GHZ boss so all the Object Status Table (is it that named?) are the same. Should I change any and if yes, which ones?
    Thanks in advice for answers.
     
    Last edited by a moderator: Nov 29, 2014
  19. CollinAB

    CollinAB Active Member Exiled

    Joined:
    Nov 24, 2014
    Messages:
    30
    Location:
    76 6th ave
    RHS, how do I fix the error on my end?
     
  20. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    As far as rings go, you can place a pretty good amount. You'll be able to tell when things start to get wonky. Generally, if you don't overuse rings in a level, they should be fine. Alternatively you could have the game load objects as you go instead of loading them all at once.

    As far as your boss, objoff_xxs are similar but not the same. At the top of Sonic2.asm (assuming you're using 2007, I haven't played with the git shit), they're probably defined as something else. Look to see what matches S1 and what doesn't.