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
  • 355 Pages +
  • ◄ First
  • 269
  • 270
  • 271
  • 272
  • 273
  • Last ►
    Locked
    Locked Forum

Basic Questions & Answers thread NEWBIES: Start here!

#4051 User is offline flamewing 

Posted 15 February 2012 - 04:30 PM

  • Emerald Hunter
  • Posts: 768
  • 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 PostHitaxas, on 14 February 2012 - 06:18 PM, said:

Edit: Ok, new issue. I can get subtype 0 and 1 to work just fine, but subtype 2 does not seem to be affected if I try to set it to do something different. =/

Without seeing the code at hand, it is hard to guess what may be going wrong.

#4052 User is offline Jimmy Hedgehog 

Posted 15 February 2012 - 09:48 PM

  • Posts: 1241
  • Joined: 13-December 07
  • Gender:Male
  • Location:England - Slough
  • Project:RAoSTH (Sprite Comic), Sawnik (Still need a better name)
  • Wiki edits:2

View PostJimmy Hedgehog, on 15 February 2012 - 04:14 PM, said:

I've read through the working with objects guide, and I've gotten quite confused. Where on earth would I start with creating a new object by scratch in Sonic 1 (2005 Hivebrain)? And are there are free VRAM locations for something about the size as one signpost sprite? Not sure how much VRAM the "points from enemies" takes and I used some of that to extend Sonic's anyway.

Thinking about this I feel I wasn't exactly very clear with what I said. All I need the object to do is simply show up, it doesn't need to do anything. Simply be placeable and be visible, nothing special. Why I can't even figure that out is beyond me.

#4053 User is offline MarkeyJester 

Posted 16 February 2012 - 10:17 AM

  • Driving The Last Spike
  • Posts: 1540
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
Open the file "_inc\Object pointers.asm"

; ---------------------------------------------------------------------------
; Object pointers
; ---------------------------------------------------------------------------
	dc.l Obj01, ObjectFall,	ObjectFall, ObjectFall
	dc.l ObjectFall, ObjectFall, ObjectFall, Obj08
	dc.l Obj09, Obj0A, Obj0B, Obj0C
	...

Change the "ObjectFall" that is on the left side of "Obj08" to "Obj07" like so:

; ---------------------------------------------------------------------------
; Object pointers
; ---------------------------------------------------------------------------
	dc.l Obj01, ObjectFall,	ObjectFall, ObjectFall
	dc.l ObjectFall, ObjectFall, Obj07, Obj08
	dc.l Obj09, Obj0A, Obj0B, Obj0C
	...

The "ObjectFall" slots are unused object slots, we have opened up slot 07 for usage, some code:

; ===========================================================================
; ---------------------------------------------------------------------------
; Object 07 - Simple Displaying/Animating Object
; ---------------------------------------------------------------------------

Obj07:
		moveq	#$00,d0					; clear d0
		move.b	$24(a0),d0				; load routine counter
		move.w	Obj07_List(pc,d0.w),d0			; load correct add address
		jmp	Obj07_List(pc,d0.w)			; add and jump to correct routine

; ===========================================================================
; ---------------------------------------------------------------------------
Obj07_List:	dc.w	Obj07_Setup-Obj07_List			; 00
		dc.w	Obj07_Display-Obj07_List		; 02
; ---------------------------------------------------------------------------
; ===========================================================================
; ---------------------------------------------------------------------------
; Routine to setup the object
; ---------------------------------------------------------------------------

Obj07_Setup:
		addq.b	#$02,$24(a0)				; increase routine counter (next routine will run next frame)
		move.b	#%00000100,$01(a0)			; set object as level-coordinated (not like a HUD)
		move.w	#$0000,$02(a0)				; set V-Ram read address (starting at tile 000)
		move.l	#MapObj07,$04(a0)			; set map list address
		move.b	#$02,$18(a0)				; set priority of display (00 Closest | 07 Furthest Away)
		move.b	#$10,$19(a0)				; set X draw out of screen distance (10 pixels from the centre of the object)
		move.b	$28(a0),$1C(a0)				; load object sub-type and set as animation to use

; ===========================================================================
; ---------------------------------------------------------------------------
; Routine to set the object to display
; ---------------------------------------------------------------------------

Obj07_Display:
		lea	AniObj07(pc),a1				; load animation script to run
		jsr	AnimateSprite				; run animation script
		moveq	#$FFFFFF80,d2				; prepare and/add/sub value
		move.w	$08(a0),d0				; load X position
		and.w	d2,d0					; keep in range of multiples of 80 pixels
		move.w	($FFFFF700).w,d1			; load screen X position
		add.w	d2,d1					; move back by 80 pixels (the deletion space is a distance outside the window area)
		and.w	d2,d1					; keep in range of multiples of 80 pixels
		sub.w	d1,d0					; subtract left void position from object position
		cmpi.w	#$0280,d0				; has the object gone outside the object loading space?
		bhi.s	Obj07_Delete				; if so, branch to delete the object
		jmp	DisplaySprite				; save object for display

Obj07_Delete:
		jmp	DeleteObject				; remove the object from the list and clean the ram space

; ===========================================================================
; ---------------------------------------------------------------------------
; Animation script list for Object 07
; ---------------------------------------------------------------------------
AniObj07:	dc.w	Ani07_Script00-AniObj07			; 00
		dc.w	Ani07_Script01-AniObj07			; 01
; ---------------------------------------------------------------------------
Ani07_Script00:	dc.b	$07,$00,$01,$02,$03,$FF
Ani07_Script01:	dc.b	$03,$03,$02,$01,$00,$FF
; ---------------------------------------------------------------------------
		even
; ---------------------------------------------------------------------------
; ===========================================================================
; ---------------------------------------------------------------------------
; Map list for Object 07
; ---------------------------------------------------------------------------
MapObj07:	dc.w	Map07_Frame00-MapObj07			; 00
		dc.w	Map07_Frame01-MapObj07			; 01
		dc.w	Map07_Frame02-MapObj07			; 02
		dc.w	Map07_Frame03-MapObj07			; 03
; ---------------------------------------------------------------------------
Map07_Frame00:	dc.b	$01
		dc.b	$F0,$0F,$00,$00,$F0
Map07_Frame01:	dc.b	$01
		dc.b	$F4,$0A,$20,$01,$F4
Map07_Frame02:	dc.b	$01
		dc.b	$F8,$05,$40,$02,$F8
Map07_Frame03:	dc.b	$02
		dc.b	$F8,$00,$60,$03,$F8
		dc.b	$D8,$0F,$40,$00,$F0
; ---------------------------------------------------------------------------
		even
; ---------------------------------------------------------------------------
; ===========================================================================

This object will display 4 frames in an animated pattern using different palette lines each animation frame, it will choose a different animation depending on the sub-type you choose when placing it in the level.

#4054 User is offline Jimmy Hedgehog 

Posted 16 February 2012 - 11:05 AM

  • Posts: 1241
  • Joined: 13-December 07
  • Gender:Male
  • Location:England - Slough
  • Project:RAoSTH (Sprite Comic), Sawnik (Still need a better name)
  • Wiki edits:2
Awesome thanks, got all that in and working alright. Though I'm not quite sure where I'd tell it to load it's art from a nemesis art file? I'm gonna keep looking of course, should probably look at other objects and see if I can figure it out.
This post has been edited by Jimmy Hedgehog: 16 February 2012 - 11:17 AM

#4055 User is offline TehKaker 

Posted 17 February 2012 - 05:05 PM

  • Posts: 12
  • Joined: 26-June 11
Hello I'm Tehkaker, with a very simple question for you. I am doing an custom script for detecting collision on my objects, by reading this from the maps files (Sonic 1 format.). For now, I did want to do a test for this, making the object to delete if gets touched by Sonic, horizontally. But nothing happens. Here is my code, if you want to see:

CustomColDetect:
		movem.l	d0-a6,-(sp)
		moveq	#0,d0
		move.b	$1A(a0),d0
		lea	(a0),a2
		movea.l	4(a0),a1
		movea.l	4(a0),a0
		mulu.w	#2,d0
		adda.w	d0,a0
		adda.w	(a0),a1
		moveq	#0,d0
		move.b	(a1)+,d0	;Read how many sprites in map
		tst.b	d0
		beq	@ret
		sub.b	#1,d0
		lea	(a1),a0
	@loop:	moveq	#0,d4
		moveq	#0,d5
		moveq	#0,d6
		moveq	#0,d2
		moveq	#0,d3
		moveq	#0,d1
		moveq	#0,d4
		moveq	#0,d7
		move.b	(a1),d4
		move.b	1(a1),d6
		lea	4(a1),a1
		move.b	(a1)+,d5
;D3, D2, D1, A3.
;d4, d5, starting pos.
;d2, d3, final pos.
;d1, d7, sonic pos.
		add.w	8(a2),d4
		add.w	$C(a2),d5
		lea	(@sprsizes).l,a3
		mulu.w	#2,d6
		adda.w	d6,a3
		move.b	(a3)+,d2
		move.b	(a3),d3
		add.w	d4,d2
		add.w	d5,d3
		move.w	($FFFFD008).w,d1
		move.w	($FFFFD00C).w,d7
		cmp.w	d1,d2
		bcs	@chkcol
	@cont:	dbf	d0,@loop
	@ret:	movem.l	(sp)+,d0-a6
		rts

@chkcol:
		cmp.w	d1,d4
		bcs	@cont
	;	cmp.w	d7,d5
	;	bcs	@cont
	;	cmp.w	d7,d3
	;	bcs	@cont2
	;	bra	@cont
	@cont2:	move.b	#0,(a2)
		bra	@ret

@sprsizes:	; Size to assign.
		; FORMAT: Horiz pixels, Vert pixels.
		dc.b	8, 8	;$00
		dc.b	8, 16	;$01
		dc.b	8, 24	;$02
		dc.b	8, 32	;$03

		dc.b	16, 8	;$04
		dc.b	16, 16	;$05
		dc.b	16, 24	;$06
		dc.b	16, 32	;$07

		dc.b	24, 8	;$08
		dc.b	24, 16	;$09
		dc.b	24, 24	;$0A
		dc.b	24, 32	;$0B

		dc.b	32, 8	;$0C
		dc.b	32, 16	;$0D
		dc.b	32, 24	;$0E
		dc.b	32, 32	;$0F
		even


#4056 User is offline MarkeyJester 

Posted 18 February 2012 - 04:50 AM

  • Driving The Last Spike
  • Posts: 1540
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
I see what you're trying to do here and I'm actually sort of impressed with your attempt, you have a pretty good deal of understanding of Sonic 1's mapping format, and seem to use it to your advantage. The problems with your code that I found are;

  • What is in a2 to begin with?

    I'm assuming that this is the Sonic object that is loaded into a2 before the routine is ran, have you made sure that the Sonic object is loaded to a2 before the routine? Why not load the Sonic object to a2 inside this routine itself?

  • When you loaded the X and Y position of the individual sprites in the mapping list, you didn't add the object's X and Y positions to them.

    Remember, this object might be in the level at X and Y of 221F and 0340, and Sonic might be around the X and Y of 21C0 and 0340, but your mapping's X and Y positions can only be from 00 to 7F (right/down) and 80 to FF (left/up), add the object's X position to the sprite's X position, and the object's Y position to the sprite's Y position, this will get you the exact X and Y position in the level.

  • Here is a fatal error you should be careful of:

    		move.b	(a3)+,d2
    		move.b	(a3),d3
    		add.w	d4,d2
    		add.w	d5,d3
    

    You have loaded a "byte" to d2 and d3, but then you add a word to d2 and d3, to explain the problem better, let's pretend that d2 contains 00009F31 to begin with:

    		move.b	(a3)+,d2
    

    We've loaded a byte, let's say it was "8" in this situation, d2 will now contain 00009F08. Next we add the word from d4 which we'll pretend is 0180:

    		add.w	d4,d2
    

    d2 will now contain A088, this is wrong, you only wanted the 08 to be added to it. the best way to fix this potential error, is by clearing d2 and d3 before loading the byte from a3:

    		moveq	#$00,d2
    		moveq	#$00,d3
    		move.b	(a3)+,d2
    		move.b	(a3),d3
    		add.w	d4,d2
    		add.w	d5,d3
    

    This will ensure that d2 and d3 contain 00000000 to begin with.

Of course, why don't you simply use the normal touch response that Sonic 1 already has (and uses)? To be very fair, I know it doesn't read the mapping's exact positions, but does it need to?

In general though, I think you're well on your way to creating some awesome code and making yourself a respectable presents in the scene, this stuff (although buggy) is rather decent.

#4057 User is offline FraGag 

Posted 18 February 2012 - 09:05 PM

  • Posts: 656
  • Joined: 09-January 08
  • Gender:Male
  • Location:Qu├ębec, Canada
  • Project:an assembler
  • Wiki edits:6

View PostKingofHarts, on 14 February 2012 - 01:48 AM, said:

So I am learning ASM and hacking, and I am, or course, a complete and total noob... So I am starting with the How-To's: Everything is going great and I've made plenty of progress easily... but I've run into a strange phenomenon in regards to Sonic 1's demo play:

I was fixing the code that causes the demo to mess up whenever you hold down buttons... and have successfully fixed it... but something else happened:

GHZ demo playthrough. I am mashing buttions around testing to make sure it doesn't interfere, and Demo Sonic hits the first Crabmeat and receives an EXTRA LIFE for it!!! Certainly weird. I have modded to give you an extra life for 50,000 pts, and last I checked, 100 is certainly not 50,000...

EDIT: It also happens when I'm not pressing buttons as well... but this doesn't happen during normal gameplay.

I am using the latest SVN disassembly (Or HG disassembly... whatever) and have been following the guide pretty well. I'm sure I haven't made any errors, I must have just missed changing something, OR this is another bug not yet reported...???

REV01 initialises v_scorelife to 5000 when a demo starts:
Demo_Level:
		move.b	#3,(v_lives).w	; set lives to 3
		moveq	#0,d0
		move.w	d0,(v_rings).w	; clear rings
		move.l	d0,(v_time).w	; clear time
		move.l	d0,(v_score).w	; clear score
		if Revision=0
		else
			move.l	#5000,(v_scorelife).w ; extra life is awarded at 50000 points
		endc
		rts	


Make sure you have that line too. And while you're at it, make sure it's also there in LevSel_Level_SS.

#4058 User is offline ManicRemix 

Posted 19 February 2012 - 02:31 AM

  • Fact: You're reading this
  • Posts: 17
  • Joined: 25-July 11
  • Gender:Male
Hello.

Just popping in with a quick question here, I have made a custom level in Sonic 1.

All I simply wanted to do was to put it in Sonic 2 with the level converter.

Although the Tiles are messed up badly, and the collision is greatly corrupted, while all objects are placec quite perfectly.

Yes I understand Hex/Binary and all (Hex = Numbers being represented with a base of 16, adding A, B, C, D, E, & F, and Binary Being 1s and 0s.), but I do not get why my collision & tiles are not loading properly, perhaps I am inserting something in the wrong place.

Either way, if somebody could give me a cheat sheet of which file is supposed to replace which file I'd appreciate it.

Just to quickly introduce myself, I wrote the Sonic 2 Extra Characters guide, created the Mario Kart Wii Custom Tracks Jungle Island and SM64DS Bob-Omb Battlefield, and I am a programmer (Wrote KCL/COL2OBJ.exe, and I know much about BDL & BMD, like what the MDL3 Section implies)

I am very interested in also helping out in this community, and using my knowledge of hex, binary, Java/C/Python here.

#4059 User is offline MimSayne 

Posted 22 February 2012 - 03:22 PM

  • Posts: 3
  • Joined: 01-June 09
  • Gender:Male
  • Location:Virginia
So recently I've become interested in making custom music for Sonic 3&K. What tools/programs would be best for doing this? I have FL Studio but I also play around with trackers(?) every now and then.

#4060 User is offline Aerosol 

Posted 26 February 2012 - 11:22 PM

  • FML and FU2
  • Posts: 7057
  • Joined: 27-April 08
  • Gender:Male
  • Location:Not where I want to be.
  • Project:Sonic (?): Coming summer of 2055...?
How possible is it to port Sonic 1 and 2 levels over to Sonic 3&K? I know SonLVL only has read support for Sonic 3&K right now but is there a way to get that done?

#4061 User is online MainMemory 

Posted 26 February 2012 - 11:49 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3211
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
LevelConverter can handle some of the format conversion, but you still have to port animated palettes, animated tiles, start positions, screen size, dynamic events, and change objects around so they fit with S3K's set (or port from S2).

#4062 User is offline Aerosol 

Posted 26 February 2012 - 11:57 PM

  • FML and FU2
  • Posts: 7057
  • Joined: 27-April 08
  • Gender:Male
  • Location:Not where I want to be.
  • Project:Sonic (?): Coming summer of 2055...?
When you say dynamic events, you're talking about things like Hill Top Zone's rising lava right? And changing objects around would include gimmicks and bosses? That's out my scope of asm abilities right now. Maybe if I have time later on I'll mull around with that. Thanks for the answer MM (both of them!)

#4063 User is offline redhotsonic 

Posted 05 March 2012 - 12:48 PM

  • Also known as RHS
  • Posts: 1098
  • Joined: 31-January 05
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic 2 Recreation
  • Wiki edits:24
As you may of known, in my hack for Great Gate, the background changes when you go underwater. Here is a short video demonstrating: http://www.youtube.c...h?v=YMPIBURXgyg

And here is a picture in SonED2 of my background:
Posted Image




SwScrl_ARZ is the one with the mountains, SwScrl_ARZ2 is the one with the blue "underwater" background.

In SwScrl_ARZ, I have:
move.w #$0000,($FFFFEE0C).w ; lock the background vertically in place (starting at the top)



In SwScrl_ARZ2, I have:
move.w #$0200,($FFFFEE0C).w ; lock the background vertically in place (starting 200 down)





Anyway, the background does not always load properly. The way I got it set, is that when you enter the area, it changes it layer deformation routine.

SwScrl_ARZ:
tst.b  (arzbg).w
bne.w SwScrl_Arz2
; blah blah blah


in the routine events:

cmpi.w #$960,(Camera_X_pos).w ; Has Sonic reached this far?
ble.s + ; If not, branch and see if Sonic went top way of GGZ1
cmpi.w #$2E0,(Camera_Y_pos).w ; Has Sonic reached this low?
ble.s + ; If not, branch and see if Sonic went top way of GGZ1
move.b #1,(arzbg).w ; Move 1 to arzbg so SwScrl_Arz2 can load





This wasn't enough. It did load SwScrl_Arz2, but it seems to not create the blue background until Sonic kept moving for a certain distance. So, I made it move a certain distance itself for a short time so it will load:

cmpi.w #$960,(Camera_X_pos).w ; Has Sonic reached this far?
ble.s + ; If not, branch and see if Sonic went top way of GGZ1
cmpi.w #$2E0,(Camera_Y_pos).w ; Has Sonic reached this low?
ble.s + ; If not, branch and see if Sonic went top way of GGZ1
move.b #1,(arzbg).w ; Move 1 to arzbg so SwScrl_Arz2 can load
move.b #$7E,(ARZBGtimer).w ; Move 7E to timer, so the underwater background has time to load


And in the layerdeformation:

SwScrl_Arz2:
move.w ($FFFFEEB0).w,d4
tst.b (ARZBGtimer).w ; is it 0?
beq.s + ; if so, branch, and skip next 2 instructions
subi.b #1,(ARZBGtimer).w
addi.l #$00098000,(RamSpace4).w
move.w (RamSpace4).w,d4
+
ext.l d4
asl.l #6,d4
moveq #2,d6
bsr.w sub_D904

;blah blah blah




That works, sometimes. Here is an example of it working: http://www.youtube.c...h?v=Gukg4hmcA9s



But sometimes, it doesn't load up the background completely and only loads up "columns" of it. It then loads the rest of the columns when Sonic starts moving again. Here is another video showing the example: http://www.youtube.c...h?v=XRlnPGEREso

No matter how long I make it scroll automatically, it won't always load.



So, I wondered, does anyone know a way to make it load immediately? I tried moving #1 to Dirty_flag, but alas, no difference.


If you need any more details or information, I will supply. I greatly appreciate any help.


EDIT: It seems that when it doesn't work, the auto-scroll scrolls faster than normal, maybe that's why it causes to do a few columns. Also, sorry for posting the question in the wrong sub-forum, I saw this post got moved =P
This post has been edited by redhotsonic: 05 March 2012 - 05:03 PM

#4064 User is offline Hitaxas 

Posted 06 March 2012 - 09:20 PM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1420
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
I have a fairly simple question.

I am working more on that giant motobug boss that I posted a little while back, but I want to do something more with it. I won't go much into details, but here is what I want to do for right now.

I want the boss to check for if it has reached a certain point on the screen, and branch if it has not.

I tried something like this

        cmpi.w	#$29C0,x_pos(a1)         ; Is the boss at this location on the map?
        bgt	+                        ; if not, branch


However, this does nothing at all. The enemy is loaded at a1, and set at a greater x position than the check at first. Any help would be appreciated.

#4065 User is offline KingofHarts 

Posted 07 March 2012 - 05:08 AM

  • Unlike Sonic, I don't chuckle...
  • Posts: 1410
  • Joined: 07-August 10
  • Gender:Male
  • Location:Chicago, IL
  • Project:Sonic Triad Studio, Sonic 1 REV C
  • Wiki edits:1
Anyone remember Sonic 3 & Knuckles: Master Edition? Of course you do. That one hack with frustrating as all hell layouts that did nothing but abuse the shit out of spikes and death drops and made you want to rip out your hair?

Well, they made a sequel... Search it on Youtube.
apparantly it was made by someone by the name of Mok45... or something like that...

Anyway, does anyone know where to get a copy of the ROM?
And is this person who made this hack a member of Retro?

  • 355 Pages +
  • ◄ First
  • 269
  • 270
  • 271
  • 272
  • 273
  • Last ►
    Locked
    Locked Forum

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