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
  • 371 Pages +
  • ◄ First
  • 367
  • 368
  • 369
  • 370
  • 371
    Locked
    Locked Forum

Basic Questions & Answers thread NEWBIES: Start here!

#5521 User is offline Shoemanbundy 

Posted 21 January 2016 - 04:28 AM

  • Posts: 862
  • Joined: 01-April 07
  • Gender:Male
  • Location:Chicago, Illinois
  • Project:selling shoes
  • Wiki edits:1
So the first of possibly many questions to come...

I want to edit separate animations for Sonic to allow more frames. My walking sprite for example has at least 12 frames while the default one is 6. How can I add more frames for one animation?

#5522 User is offline Clownacy 

Posted 21 January 2016 - 07:24 AM

  • Layin' the Wax and Spinnin' the Sounds
  • Posts: 514
  • Joined: 06-July 13
  • Gender:Male
  • Location:Englandland
The obvious solution would be to edit Sonic animation script, _anim/Sonic.asm in the Git disasm. But, the walking/running animations have a hardcoded length, because of some code in Sonic_Animate. It handles making Sonic rotate as he goes through a loop or up/down a slope. It gets Sonic's angle, and turns it into 0, 2, 4, or 6. When Sonic's running, this is multiplied by 2, then added to Sonic's current frame, meaning, if the angle was 2, it would become 4, the length of Sonic's running animation in sprites, and then be added to the mapping_frame, skipping over the regular running sprites, and instead using the slightly rotated ones. When Sonic's walking, the angle of 2 instead becomes 6, again, to match the length of Sonic's walking animation.

#5523 User is offline Shoemanbundy 

Posted 23 January 2016 - 08:16 AM

  • Posts: 862
  • Joined: 01-April 07
  • Gender:Male
  • Location:Chicago, Illinois
  • Project:selling shoes
  • Wiki edits:1
OK, possibly beyond me since I'm just starting out. Though I think I get the logic for the math to decide which animations to switch to. I'll come back to that since I'm more now wanting to focus on engine modification for my new character.

How would I modify Sonic's speed? I am trying to get him to have one constant speed just like in most platformers, so I'm trying to figure out how to modify it so his initial start speed is a constant value and no acceleration occurs. I've been looking in Sonic Move.asm thinking this is where I should work, and have seen lines referencing inertia that I edited through trial and error to end up getting him to go at a snail's pace, but not figuring out what specifically to modify. I know this also needs to be modified for both ground and air.

#5524 User is offline DjHeXy 

Posted 26 January 2016 - 04:23 AM

  • Posts: 6
  • Joined: 17-September 08
  • Gender:Male
  • Location:at the bar
Hello :)

Just looking for some advice on 2 things concerning the boss stages of sonic 2:

I want to change the way eggman is animated, so that he is always laughing, apart from when he gets hit or destroyed (my boys love it when he laughs!) - whats the best way to go about this? Edit the dissasembly in some way, or edit his sprites (ie, replace his non-laughing sprites with copies of his laughing ones)? Any pointers on this would be fantastic :)

I'd also like to spawn some badniks during the boss battles every few seconds to spice things up a bit, especially in the EHZ boss. Can this be done?

I've been using the Xenowhirl asm.

Thank you for any help you can provide!

#5525 User is offline MarkeyJester 

Posted 26 January 2016 - 10:28 PM

  • There's cracks in the floor!
  • Posts: 1681
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
The simplest way I can think of, is to edit the animation script to the boss:

off_2FAC8:
	dc.w byte_2FAD2-off_2FAC8
	dc.w byte_2FAD5-off_2FAC8; 1
	dc.w byte_2FAD9-off_2FAC8; 2
	dc.w byte_2FAE2-off_2FAC8; 3
	dc.w byte_2FAEB-off_2FAC8; 4
	even

The above is EHZ's boss, each "dc.w" pointer will point to a specific animation, pointer 1 for example is his "idle" animation, pointer 2 is his "hurt" animation, pointer 3 is his "laughing" animation, etc. The most logical thing to do, is to copy the "laughing" pointer, and pasting it place of the "idle" pointer, like so:

off_2FAC8:
	dc.w byte_2FAD2-off_2FAC8
	dc.w byte_2FAE2-off_2FAC8; 3   ; < Now it points to animation 3: "laughing"
	dc.w byte_2FAD9-off_2FAC8; 2
	dc.w byte_2FAE2-off_2FAC8; 3
	dc.w byte_2FAEB-off_2FAC8; 4
	even

The next thing required, is to change the "laughing" animation script itself in one specific way:

byte_2FAE2:	dc.b   7,  3,  4,  3,  4,  3,  4,$FD,  1

  • The first "7" represents the speed of the animation, the lower it is, the faster the animation will run.
  • The numbers "3, 4, 3, 4, 3, 4" are the laughing frames to show in that order.
  • The "FD" followed by a "1" is a flag specifically designed to change the animation ID after the animation is finished.

This animation will display the laughing frames 3, then 4, then 3, then 4, then 3, and finally 4, at the speed of 7. And then will change the animation ID to 1 (changing it back to "idle" animation), it couldn't be simpler.

The problem here, is that since we've changed the pointer, the "laughing" animation now technically counts as animation ID 1, the animation routine determines an animation reset by the animation ID being changed, but since the "laughing" animation is animation ID 1, and it's changing the animation to ID 1 when its finished. As far as the animation routine is concerned, the animation hasn't changed, therefore, no reset is required. This will prevent the laughing animation from... well animating.

The solution to this, is to change that "FD" to an "FF", the "FF" signifies the animation should loop endlessly:

byte_2FAE2:	dc.b   7,  3,  4,  3,  4,  3,  4,$FF,  1


--------------------------------------------------------

The above is only for EHZ's boss, since each boss is quite unique in Sonic 2 artistically, it stands to reason it'll have different mappings, and different animation. So you will need to change the animations for each boss individually in a similar manner to the above EHZ. I am of course, not entirely familiar with Sonic 2 myself, nor do I have much time, but if you wish to find the animations, one way would be to search for "Obj_Index:", and go along the list of object pointers, next to each pointer is a description of what that object is. You will find instances of the bosses, for example:

...
	dc.l Obj50	; Aquis (seahorse badnik) from OOZ
	dc.l Obj51	; CNZ boss
	dc.l Obj52	; HTZ boss
	dc.l Obj53	; Shield orbs that surround MTZ boss
	dc.l Obj54	; MTZ boss
	dc.l Obj55	; OOZ boss
	dc.l Obj56	; EHZ boss
	dc.l Obj57	; MCZ boss
	dc.l Obj58	; Boss explosion
	dc.l Obj59	; Emerald from Special Stage
...

Find those routines, and search for a routine call named "AnimateSprite", for example, we'll search for MCZ's boss Obj57, this leads us to:

; ===========================================================================
; ----------------------------------------------------------------------------
; Object 57 - MCZ boss
; ----------------------------------------------------------------------------
; Sprite_30FA4:
Obj57:
	moveq	#0,d0
	move.b	objoff_A(a0),d0
	move.w	off_30FB2(pc,d0.w),d1
...

Searching for "AnimateSprite" below that point will lead us to:

...
	lea	(off_3209C).l,a1
	bsr.w	JmpTo20_AnimateSprite
...

Searching for "off_3209C" leads us to:

off_3209C:
	dc.w byte_320B0-off_3209C
	dc.w byte_320B3-off_3209C; 1
	dc.w byte_320B9-off_3209C; 2
	dc.w byte_320BF-off_3209C; 3
	dc.w byte_320C3-off_3209C; 4
	dc.w byte_320C8-off_3209C; 5
	dc.w byte_320D3-off_3209C; 6
	dc.w byte_320DD-off_3209C; 7
	dc.w byte_320E1-off_3209C; 8
	dc.w byte_320E4-off_3209C; 9
byte_320B0:	dc.b  $F,  1,$FF
byte_320B3:	dc.b  $F,  4,$FF,  5,$FC,  2
byte_320B9:	dc.b  $F,  2,$FF,  3,$FC,  2
byte_320BF:	dc.b   7,  6,  7,$FF
byte_320C3:	dc.b   1, $C, $D, $E,$FF
byte_320C8:	dc.b   7,  8,  9,  8,  9,  8,  9,  8,  9,$FD,  3
byte_320D3:	dc.b   7, $A, $A, $A, $A, $A, $A, $A,$FD,  3
byte_320DD:	dc.b   3,$13,$14,$FF
byte_320E1:	dc.b   1,  0,$FF
byte_320E4:	dc.b   1, $F,$10,$11,$FF,  0

It should look somewhat familiar:

byte_320C8:	dc.b   7,  8,  9,  8,  9,  8,  9,  8,  9,$FD,  3

Different frames, but the same animation, 7 speed, 2 frames displayed four times, ending in an FD followed by the idle animation ID. Change the FD to an FF, and since you know that the "laughing" animation ID is 5 and the "idle" animation ID is 3, you can now swap the "idle" animation pointer with the "laughing" animation pointer:

off_3209C:
	dc.w byte_320B0-off_3209C
	dc.w byte_320B3-off_3209C; 1
	dc.w byte_320B9-off_3209C; 2
	dc.w byte_320C8-off_3209C; 5	; < Now it points to animation 5: "laughing"
	dc.w byte_320C3-off_3209C; 4
	dc.w byte_320C8-off_3209C; 5
	dc.w byte_320D3-off_3209C; 6
	dc.w byte_320DD-off_3209C; 7
	dc.w byte_320E1-off_3209C; 8
	dc.w byte_320E4-off_3209C; 9
byte_320B0:	dc.b  $F,  1,$FF
byte_320B3:	dc.b  $F,  4,$FF,  5,$FC,  2
byte_320B9:	dc.b  $F,  2,$FF,  3,$FC,  2
byte_320BF:	dc.b   7,  6,  7,$FF
byte_320C3:	dc.b   1, $C, $D, $E,$FF
byte_320C8:	dc.b   7,  8,  9,  8,  9,  8,  9,  8,  9,$FF,  3	; < Changed to FF...
byte_320D3:	dc.b   7, $A, $A, $A, $A, $A, $A, $A,$FD,  3
byte_320DD:	dc.b   3,$13,$14,$FF
byte_320E1:	dc.b   1,  0,$FF
byte_320E4:	dc.b   1, $F,$10,$11,$FF,  0

Some of the bosses might have a different structure of animation, depending on how unique the boss is, but by searching through with this method, you'll at least be able to locate 90% of the intended animations, and can experiment from there.

--------------------------------------

As for loading badniks into the boss area at random intervals, while it is possible, one thing to keep in mind is that their art may not be loaded into VRAM (when the boss loaded, there is a possibility that the boss may have written its art over the badnik's art in VRAM, due to a lack of available VRAM space). While the badniks can load and run, they will not display the right art. This is hypothetical however, as I have not checked out VRAM to confirm it gets overwritten, so take it as a precaution as nothing more.

To load an object (be it an enemy, or some other item), you perform the following as an example:

		jsr	SingleObjLoad		; find a free object slot
		bne.s	CannotLoadObject	; if there is no more space in RAM, branch (cannot load the object)
		move.b	#$26,(a1)		; set to load a "monitor"
		move.b	#$04,subtype(a1)	; set mintor to "10 rings"
		move.w	#$0100,x_pos(a1)	; set X coordinates to 100 pixels from the left
		move.w	#$0200,y_pos(a1)	; set Y coordinates to 200 pixels from the top

CannotLoadObject:

Keep in mind, that most objects are designed to delete themselves if they are off screen by too far a distance. So you must ensure that the X and Y coordinates are set relative to the screen's position, I.e. there's no good loading an object near the beginning of the level, if you're at the boss that's at the end of the level.

#5526 User is offline DjHeXy 

Posted 27 January 2016 - 04:54 AM

  • Posts: 6
  • Joined: 17-September 08
  • Gender:Male
  • Location:at the bar
Thanks a million MarkeyJester :-D Can't wait to get stuck into this after work :)

#5527 User is offline nineko 

Posted 27 January 2016 - 05:26 AM

  • I am the Holy Cat
  • Posts: 5419
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251

View PostMarkeyJester, on 26 January 2016 - 10:28 PM, said:

The solution to this, is to change that "FD" to an "FF", the "FF" signifies the animation should loop endlessly:

byte_2FAE2:	dc.b   7,  3,  4,  3,  4,  3,  4,$FF,  1
Just out of curiosity, since it will loop endlessly anyway, can't the script be simplified to just 3, 4?
byte_2FAE2:	dc.b   7,  3,  4, $FF, 1


#5528 User is offline DjHeXy 

Posted 27 January 2016 - 03:17 PM

  • Posts: 6
  • Joined: 17-September 08
  • Gender:Male
  • Location:at the bar
Hello Nineko, you were correct, it could (and was) shortened :)

Thanks again, its great seeing it in action :D

#5529 User is offline rata 

Posted 27 January 2016 - 04:30 PM

  • Posts: 234
  • Joined: 11-January 15
  • Gender:Male
  • Location:Argentina
  • Project:Trying to be useful somehow.

View PostShoemanbundy, on 23 January 2016 - 08:16 AM, said:

OK, possibly beyond me since I'm just starting out. Though I think I get the logic for the math to decide which animations to switch to. I'll come back to that since I'm more now wanting to focus on engine modification for my new character.

How would I modify Sonic's speed? I am trying to get him to have one constant speed just like in most platformers, so I'm trying to figure out how to modify it so his initial start speed is a constant value and no acceleration occurs. I've been looking in Sonic Move.asm thinking this is where I should work, and have seen lines referencing inertia that I edited through trial and error to end up getting him to go at a snail's pace, but not figuring out what specifically to modify. I know this also needs to be modified for both ground and air.


You can do this in Sonic_Move by changing theese lines:


		move.w	(v_sonspeedmax).w,d6
		move.w	(v_sonspeedacc).w,d5
		move.w	(v_sonspeeddec).w,d4


So it moves max speed to d5 and d4 instead of acceleration and deceleration. Do the same in Sonic_JumpDirection. Although this doesn't apply for changing direction when you jump after Sonic was rolling, I still need to figure this out.

First time I can do something helpful, as small as it is!!! I'm happy anyway!!!
This post has been edited by rata: 27 January 2016 - 05:15 PM

#5530 User is offline MarkeyJester 

Posted 27 January 2016 - 10:47 PM

  • There's cracks in the floor!
  • Posts: 1681
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16

View Postnineko, on 27 January 2016 - 05:26 AM, said:

View PostMarkeyJester, on 26 January 2016 - 10:28 PM, said:

The solution to this, is to change that "FD" to an "FF", the "FF" signifies the animation should loop endlessly:

byte_2FAE2:	dc.b   7,  3,  4,  3,  4,  3,  4,$FF,  1
Just out of curiosity, since it will loop endlessly anyway, can't the script be simplified to just 3, 4?
byte_2FAE2:	dc.b   7,  3,  4, $FF, 1


Yes. Though I left that out to prevent further confusion as the process can be considered confusing to a newcomer.

#5531 User is offline E-122-Psi 

Posted 29 January 2016 - 04:44 PM

  • Posts: 1646
  • Joined: 29-December 09
  • Gender:Male
  • Wiki edits:41
I'm not sure if this counts more as a general question, but, what are the preferred running diagnostics for SADX (preferably with Mod Loader's best settings)? I played the game on both a Windows XP PC and a Windows 8 Toshiba Satellite, and the latter has a much rougher framerate and load time than the former. Does it need a certain compatibility mode or software to run smoothly (the disc wouldn't install Direct X 9, though I think my laptop already has some version)?

#5532 User is offline Morph 

Posted 29 January 2016 - 11:31 PM

  • AKA SonicFreak94.
  • Posts: 628
  • Joined: 01-August 08
  • Gender:Male
  • Location:Utah
  • Project:SA1/2 hax
  • Wiki edits:11
There isn't really a good way to go about that. Although I remember back on XP, I had to run Windows Media Player in the background to get it to run at 60FPS. Weird, I know, but it worked consistently. Sort of a long shot, but you could try that :specialed:. It could just be that your GPU doesn't do well with D3D8, or that the combination of D3D8 and drivers don't agree... the list just goes on and on.

In fact, trouble shooting anything in SADX is pretty much impossible. Any crash not caused by the mod loader code directly will make the game just exit without warning. It's great. :colbert:

Edit: On second thought, the fact that the load times are worse could also be due to a number of things. You could be using too much memory and your system is paging to disk, or maybe you have some aggressive antivirus software that scans all disk activity slowing things down.
This post has been edited by Morph: 29 January 2016 - 11:33 PM

#5533 User is offline E-122-Psi 

Posted 04 February 2016 - 01:16 PM

  • Posts: 1646
  • Joined: 29-December 09
  • Gender:Male
  • Wiki edits:41
Am I meant to use the DirectX End User Runtime program for anything?

I've also tried to work SADXLVL but can't figure out how to get it to run. I can't find a file for it to respond and load the level files (it doesn't recognise my sonic.exe file so I take it that's not it). I'm probably gonna look like an idiot, but how do you set it up?

#5534 User is offline MainMemory 

Posted 04 February 2016 - 02:34 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3520
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
SADXLVL is no longer supported. The recommended method is to use SA Tools: copy the contents of the SADXPC folder in SA Tools into your SADX folder, run splitall.bat, then run SADXLVL2 and open the sadxlvl.ini file in it.

#5535 User is offline E-122-Psi 

Posted 04 February 2016 - 03:08 PM

  • Posts: 1646
  • Joined: 29-December 09
  • Gender:Male
  • Wiki edits:41

View PostMainMemory, on 04 February 2016 - 02:34 PM, said:

SADXLVL is no longer supported. The recommended method is to use SA Tools: copy the contents of the SADXPC folder in SA Tools into your SADX folder, run splitall.bat, then run SADXLVL2 and open the sadxlvl.ini file in it.


Okay, I've tried that, and the command prompt from split all.bat states it's failed for nearly every object it creates. I take it this means it's fucked up the files because when I try to load a level in SADXLVL2 it fails.

  • 371 Pages +
  • ◄ First
  • 367
  • 368
  • 369
  • 370
  • 371
    Locked
    Locked Forum

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

  1. Google