Sonic and Sega Retro Message Board: Basic Questions & Answers thread - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 361 Pages +
  • ◄ First
  • 357
  • 358
  • 359
  • 360
  • 361
    Locked
    Locked Forum

Basic Questions & Answers thread NEWBIES: Start here!

#5371 User is offline Selbi 

Posted 11 March 2015 - 05:41 PM

  • Tief.Tiefer
  • Posts: 1431
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
@FeliciaVal (stupid Italians ninja'ing me :v:):

The thing is, it doesn't actually ever reach your code. In the beginning, you check if the necessary buttons are pushed and then check if the flag is set. Said flag gets set immediately when the buttons are pushed, during which the animation counter is far away from your desired frames. Since the comments mention "jumpdash", I assume the flag gets reset when touching the ground.

Therefore, you should add a branch after the check for the flag to continue to your hearts:
...
		tst.b	($FFFFFFCC).w			; was jumpdash flag set?
		beq.s	HammerSpin_Cont			; if yes, branch
		bra.s	HammerSpin_Hearts1		; if not, we're in a HammerSpin - continue hearts sprite check
HS_End1:
		rts
...


@nineko:
Flamewing has pointed out the correct instruction, which was "CharFromStr(input,size)". Of course it was mentioned in the manual, but without knowing the name you have no chance of finding it. Plus, it was for the updated AS assembler, not the 2007 one, so I was helpless anyway.

"asc()" isn't known, btw.
This post has been edited by Selbi: 11 March 2015 - 05:49 PM

#5372 User is offline E-122-Psi 

Posted 11 March 2015 - 06:12 PM

  • Posts: 1579
  • Joined: 29-December 09
  • Gender:Male
  • Wiki edits:41
Felicia Val? I'm E-122-Psi. And I'm British. :P

Anyway, tried that code, but still has no effect. There is no order or delay in how they appear, they either all just appear at the start of the animation or not at all.
This post has been edited by E-122-Psi: 11 March 2015 - 06:12 PM

#5373 User is offline Selbi 

Posted 11 March 2015 - 06:30 PM

  • Tief.Tiefer
  • Posts: 1431
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
Oh my god, please excuse my brainfart there... :specialed:/>

To make up for it (and also I don't really know where the problem is from here), I'm willing to give some private help on the matter. You can find in the #ssrg IRC.
This post has been edited by Selbi: 11 March 2015 - 06:31 PM

#5374 User is offline Shockwave 

Posted 11 March 2015 - 06:36 PM

  • Posts: 26
  • Joined: 08-July 11
  • Gender:Male
  • Location:LA, CA
  • Project:Sonic: South Island Warped
I would actually load all three at the same time and have them wait for a timer that gets set right as their loaded, like this for example:
TrailFrameDuration: = ; whatever the frame duration of your animation is

Sonic_HammerSpin:
                tst.b	($FFFFFFCC).w			; was jumpdash flag set?
		beq	HS_End3			        ; if yes, branch
                move.b	($FFFFF603).w,d0		; move the current button press to d0
		btst	#1,($FFFFF602).w		; is Down button pressed?
		beq.s	HS_End3				; if not, return
		and.b	#$40,d0				; get only button A
		beq.s	HS_End3				; if A wasn't pressed, branch

HammerSpin_Cont:
		move.b	#1,($FFFFFFCC).w		; set jumpdash flag
		move.b	#$20,$1C(a0)			; show hammer animation
		move.w	#$BC,d0				; set jumpdash sound
		jsr	(PlaySound).l			; play jumpdash sound

                bsr     SingleObjLoad
                bne     HS_End2
                move.b  #$10,(a1)
                move.w  8(a0),d0
                move.w  $C(a0),$C(a1)
                subi.w  #$20,d0
                btst    #0,$22(a0)
                beq     @Set1stXPos
                neg     $10(a1)
                addi.w  #$40,d0
                
                @Set1stXPos:
                move.w  d0,8(a1)
                move.b  #1*TrailFrameDuration,$2A(a1)
                
                bsr     SingleObjLoad
                bne     HS_End2
                move.b  #$10,(a1)
                move.w  8(a0),8(a1)
                move.w  $C(a0),$C(a1)
                btst    #0,$22(a0)
                beq     @Set2ndFrameDuration
                neg     $10(a1)

                @Set2ndFrameDuration:
                move.b  #3*TrailFrameDuration,$2A(a1)
                
                bsr     SingleObjLoad
                bne     HS_End2
                move.b  #$10,(a1)
                move.w  8(a0),d0
                move.w  $C(a0),$C(a1)
                addi.w  #$20,d0
                btst    #0,$22(a0)
                beq     
                neg     $10(a1)
                subi.w  #$40,d0

                @Set3rdXPos:
                move.w  d0,8(a1)
                move.b  #5*TrailFrameDuration,$2A(a1)

HS_End2:
		clr.w	$10(a0)					; clear X-velocity to move sonic directly down
		tst.w	$12(a0)					; is Sonic moving upwards?
		bpl.s	HS_End3					; if not, branch
		clr.w	$12(a0)					; clear X-velocity to move sonic directly down

HS_End3:
		rts


Then you could just make the beginning of the object look like this:
Obj10:
                subq.b  #1,$2A(a0)
                bmi     @Start
                rts
                
                @Start:
                ; object init stuff


Oh, whoops, Selbi's already helping. Eh, whatever, someone may get something out of this.
This post has been edited by Shockwave677: 11 March 2015 - 06:38 PM

#5375 User is offline E-122-Psi 

Posted 11 March 2015 - 07:32 PM

  • Posts: 1579
  • Joined: 29-December 09
  • Gender:Male
  • Wiki edits:41
The problem with that method is that while it delays the animation, they still are all loaded at the same time and place, rather than following the player in a trail.

View PostSelbi, on 11 March 2015 - 06:30 PM, said:

Oh my god, please excuse my brainfart there... :specialed:/>/>

To make up for it (and also I don't really know where the problem is from here), I'm willing to give some private help on the matter. You can find in the #ssrg IRC.


I appreciate it very much, but I'll need to wait, on early morning shift so need to go bed right now.

#5376 User is offline flamewing 

Posted 11 March 2015 - 09:35 PM

  • Emerald Hunter
  • Posts: 831
  • Joined: 11-October 10
  • Gender:Male
  • Location:Brasil
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View PostSelbi, on 11 March 2015 - 05:41 PM, said:

"asc()" isn't known, btw.

Add this somewhere:
asc function chr,charfromstr(chr,0)

Then go wild :v:

(I told you user defined functions are great)

View PostE-122-Psi, on 11 March 2015 - 07:32 PM, said:

The problem with that method is that while it delays the animation, they still are all loaded at the same time and place, rather than following the player in a trail.

In Shockwave677's code, add code to reposition the heart to the desired spot right after this label:
@Start:

If you set the correct X position in HammerSpin_Cont, you probably just need to set the Y position based on Amy's position.

#5377 User is offline E-122-Psi 

Posted 12 March 2015 - 01:08 PM

  • Posts: 1579
  • Joined: 29-December 09
  • Gender:Male
  • Wiki edits:41
Ah, this seems to be having results, thanx.

One thing, is there a way to keep this going on a loop for as long as the attack runs, like running this delay every two seconds until the animation stops? I take this is running on a timer rather than animation frame specifics now, so may be harder to program for such a routine.

EDIT: Wait there seems to be an issue with this method. Putting a Y pos check in the object coding itself makes the player pos recognition static. It means I can't edit the Y position for one particular trail. Similarly the X position sticks and doesn't move with the player, if I add a check on the object data it means none of the objects can be positioned separately.
This post has been edited by E-122-Psi: 12 March 2015 - 06:51 PM

#5378 User is offline rata 

Posted 13 March 2015 - 03:28 PM

  • Posts: 74
  • Joined: 11-January 15
  • Gender:Male
  • Location:Argentina
  • Project:Trying to be useful somehow.
Well, hello again. I would like to say that I had succeed in my mission of adding frames, but that wouldn't be totaly true.
Im having some serious problems with this thing, and its starting to really pissing me off. I sort of managed to make it work by making 16 frames instead of 14 (frames 6 & C had a duplicate each, making a 16 total). It work wonderfull, but part of me wasn't happy with such a lazy path, so now I stroke again. My logic was simple:
If d0 is the angle of Sonic (0, 2, 4 or 6), and to load 6th frame the game does



		move.b	d0,d1
		lsr.b	#1,d1
		add.b	d1,d0



so basicaly what I think it does is d0 + (d0-1) if d0=/0, and d0+d0 if d0=0. (lsr is Logic Shift Right, does this sub 1 to d0 if it is not equal to 0?)
then an extra command somewhere makes the final multiplication by 2, resulting in the desired frames.
As I want 14 frames, this is my new nomodspeed label:

	@nomodspeed:
		lea	(SonAni_raaan).l,a1 ; use fastah animation!
		cmpi.w #$F00,d2 ; is Sonic running fastah!?
		bcc.s @gofastah ; if yes, branch
		lea	(SonAni_Run).l,a1 ; use running animation
		cmpi.w	#$600,d2	; is Sonic at running speed?
		bcc.s	@running	; if yes, branch

		lea	(SonAni_Walk).l,a1 ; use walking animation
		add.b	d0,d0		; x2			/0=0	2=4	4=8	6=C
		add.b	d0,d0 	; x2 (x4)		/0=0	2=8	4=10	6=18
		lsr.b #1, d0 	; minus 1 if not 0 (x4-1)	/0=0	2=7	4=1F	6=17



What I want with this well... it is in the comments, then the aftermentioned extra command located somewhere makes the final multiplication, turning 0 into 0, 2 into 14 ($E), 4 into 28 ($1C) and 6 into 42 ($2A). But either the game is trolling me, or I don't understand LSR operation properly, or I have to retire from hacking. The game just loads bullshit when Sonic is walking in angles, most of them are sprites of Sonic running at random angles. Running animation works perfect, as it has 8 frames so that's easy to make.

My other problem is within the 3rd animation. I want to introduce a new animation for when Sonic is running 'fastaah than evah!', wich it would be above his normal maximium speed. What's the problem then? When it loads, game frozes. The animation is defined at the end of the index to avoid changing other animation's indexes; same care was taken with its frames to avoid even more interference (I have enough interference already and hurt animation never loads, just frezees current frame 'till Sonic reachs the ground).

Also, in the walking-running transition, rolling animation is shown for a short period, and I don't know why. What is that thing that I am not seeing now? I don't want to go back to the lazy solution...

Edit: corrected some grammar that could make you eyes bleed.
This post has been edited by rata: 13 March 2015 - 03:32 PM

#5379 User is offline Selbi 

Posted 13 March 2015 - 03:57 PM

  • Tief.Tiefer
  • Posts: 1431
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320
I'm not sure if I fully understood what you're trying to achieve here, but one thing to be told right away, bit shifting has nothing to with subtraction. At all.

Let's take a look at an example: Say we have $75 in d0. In bits that equals to (if we only look at that one byte):
0111 0101
Now, if we do a bit shift, in particular your mentioned "lsr", what happens internally is pretty much what it says on the tin: The bits get shifted. All bits that leave the range are getting thrown out (marked by the dark blue) and the freed up bits are filled up with 0's (marked by the green):
0011 1010 1
This equals to $3A, half of $75-1 (because the first bit was thrown out and the least significant bit is now a zero).

"lsr" moves to the right (thus the result being roughly halved) and "lsl" moves to the left (thus the result being roughly doubled).

If you want to a "subtract 1 if the current value is anything but zero", you should probably do something like this:
		tst.b	d1	; is value zero?
		beq.s	@Zero	; if yes, branch
		subq.b	#1,d1	; subtract 1 from d1
	@Zero:
		...

This post has been edited by Selbi: 13 March 2015 - 04:04 PM

#5380 User is offline E-122-Psi 

Posted 16 March 2015 - 10:41 PM

  • Posts: 1579
  • Joined: 29-December 09
  • Gender:Male
  • Wiki edits:41
Okay I've got that previous move working, but I want to edit it. Thus far it makes a trail of the same object appear four times in a row with a specific animation:

; ---------------------------------------------------------------------------
; Subroutine for Sonic's hammer spin animation
; ---------------------------------------------------------------------------
 
; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
 
Sonic_HammerSpin:

move.b ($FFFFF603).w,d0 ; move the current button press to d0
btst #1,($FFFFF602).w ; is Down button pressed?
beq.s HS_End1 ; if not, return
and.b #$40,d0 ; get only button A
beq.s HS_End1 ; if A was pressed, branch
tst.b ($FFFFFFCC).w ; was jumpdash flag set?
beq.s HammerSpin_Cont ; if yes, branch
;bra.s HammerSpin_Hearts
HS_End1:
rts
 
HammerSpin_Cont:

move.b  #1,($FFFFFFCC).w                ; set jumpdash flag
move.b  #$20,$1C(a0)                    ; show hammer animation
move.w  #$BC,d0                         ; set jumpdash sound
jsr    (PlaySound).l                   ; play jumpdash sound
 
HammerSpin_Hearts:

cmpi.b #$20,$1C(a0) ; is Sonic in the jumping animation? 
bne.w HS_End2 ; if not, return 
bsr     SingleObjLoad
bne     HS_End2
move.b  #$10,(a1)
move.l  8(a0),d0
move.l  $C(a0),$C(a1)
move.b  #0,$1C(a1) 
btst    #0,$22(a0)
beq     @Set1stXPos
neg     $10(a1)
move.b  #2,$1C(a1)

@Set1stXPos:

move.b  #0*2,$2A(a1)
cmpi.b #$20,$1C(a0) ; is Sonic in the jumping animation? 
bne.w HS_End2 ; if not, return 
bsr     SingleObjLoad
bne     HS_End2 
move.b  #$10,(a1)
move.l  8(a0),8(a1)
move.l  $C(a0),$C(a1)
move.b  #1,$1C(a1)

@Set2ndFrameDuration:

move.b  #2*2,$2A(a1)
cmpi.b #$20,$1C(a0) ; is Sonic in the jumping animation? 
bne.w HS_End2 ; if not, return
bsr     SingleObjLoad
bne     HS_End2
move.b  #$10,(a1)
move.l  8(a0),d0
move.l  $C(a0),$C(a1)
move.b  #2,$1C(a1)
btst    #0,$22(a0)
beq     @Set3rdXPos
neg     $10(a1)
move.b  #0,$1C(a1)

@Set3rdXPos:

move.b  #4*2,$2A(a1)
cmpi.b #$20,$1C(a0) ; is Sonic in the jumping animation? 
bne.w HS_End2 ; if not, return
bsr     SingleObjLoad
bne     HS_End2 
move.b  #$10,(a1)
move.l  8(a0),8(a1)
move.l  $C(a0),$C(a1)
move.b  #3,$1C(a1)
 
@Set4thFrameDuration:

move.b  #6*2,$2A(a1)

HS_End2:

clr.w   $10(a0) ; clear X-velocity to move sonic directly down
tst.w   $12(a0)                                 ; is Sonic moving upwards?
bpl.s   HS_End3                                 ; if not, branch
clr.w   $12(a0)                                 ; clear X-velocity to move sonic directly down
 
HS_End3:

rts


What I want it to do is make a trail of these four objects in a never-ending loop until the player's animation changes. Any idea how to keep it going?
This post has been edited by E-122-Psi: 16 March 2015 - 10:41 PM

#5381 User is offline KingofHarts 

Posted 23 March 2015 - 12:39 AM

  • Call me back when people stop shitting in the punch bowl...
  • Posts: 1480
  • Joined: 07-August 10
  • Gender:Male
  • Wiki edits:1
Random quickie... I'm curious... do you guys know WHY the engine opts not to draw skidding or spindash dust when Sonic is in the process of drowning? in S2 and S3K this is the case... though I don't quite understand why.If you are already in the process of spindashing when the timer starts, it stays on screen and doesn't seem to interfere with the number sprites... Why is it coded this way?
This post has been edited by KingofHarts: 23 March 2015 - 12:41 AM

#5382 User is offline Selbi 

Posted 23 March 2015 - 07:16 AM

  • Tief.Tiefer
  • Posts: 1431
  • Joined: 12-May 08
  • Gender:Male
  • Location:Northern Germany
  • Project:Sonic ERaZor
  • Wiki edits:320

View PostKingofHarts, on 23 March 2015 - 12:39 AM, said:

If you are already in the process of spindashing when the timer starts, it stays on screen and doesn't seem to interfere with the number sprites...

Except it does:

Posted Image

Did a quick hack to remove the air check in Obj08, and as expected it glitches out. The numbers get partially overwritten by the spindash dust tiles. So there's your answer.
This post has been edited by Selbi: 23 March 2015 - 08:21 AM

#5383 User is offline flamewing 

Posted 23 March 2015 - 07:22 AM

  • Emerald Hunter
  • Posts: 831
  • Joined: 11-October 10
  • Gender:Male
  • Location:Brasil
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
Check again, the spindash dust does disappear when the countdown is about to show; you are probably seeing Tails' spindash dust instead. The reason the spindash dust disappears when you are starting to drown, and why no braking dust is even created when underwater, is the same: the countdown numbers use the same VRAM as those two. So you would either have a garbled countdown or garbled dust.

#5384 User is offline KingofHarts 

Posted 23 March 2015 - 01:40 PM

  • Call me back when people stop shitting in the punch bowl...
  • Posts: 1480
  • Joined: 07-August 10
  • Gender:Male
  • Wiki edits:1
Ah. K I see where I got mixed up then. Thank you guys for clarifying that. Well then, I suppose as long as I keep them from overwriting in my Sonic 1 hack (I backported them in) I can remove these checks.

#5385 User is offline Hitaxas 

Posted 24 March 2015 - 12:36 PM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1432
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
Trying to build Sonic 2 using the linux build tools on android. I get an error telling me that the files in the linux folder do not exist. How can I fix this?

Edit: after talking with Flamewing over irc and doing some research... it seems it is just not possible to split and build on android. The build files will not execute on ARM unless somebody compiles them for it. That would solve the build issue. As for split, perl does not exist on android. I have seen something about perl on android but only using an emulator. Is there anybody other than me interested in Getting something like this to work? I think it could be useful.
This post has been edited by Hitaxas: 24 March 2015 - 11:38 PM

  • 361 Pages +
  • ◄ First
  • 357
  • 358
  • 359
  • 360
  • 361
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users