Basic Questions and Answers Thread

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

  1. A-S-H

    A-S-H Moderator and Host of the SMPS Competition Member

    Joined:
    Jun 5, 2015
    Messages:
    427
    Location:
    Music Plant Zone
    Oh, I don't mean it like that. When I save the mappings (I assume this is where the palette line info is) and build the ROM, it still shows up on the first palette line.

    EDIT: I'm editing the seesaw object from SLZ (Object 5E)
     
  2. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,820
    There are two main places where the "palette line" can be edited. The first is within the mappings themselves, of which if you're using SonMapED, you already have a method of doing so explained by the second previous post. The second is within the object itself.

    Bytes 2 and 3 (together as a word) forms up a default "base" pattern index address. It is nothing more than the format of the VDP's "pattern index address", and is as followed:

    PCCV HAAA AAAA AAAA
    • A = Tile ID (or VRAM address divided by 20)
    • H = Horizontal flip flag (0 normal | 1 mirror)
    • V = Vertical flip flag (0 normal | 1 flip)
    • CC = Palette line (00 palette line 1 | 01 palette line 2 | 10 palette line 3 | 11 palette line 4)
    • P = Priority flag (0 low | 1 high)
    (Please note, this is the same word (two bytes) present in the mappings also, iirc the mapping's "pattern index address" gets added to the object's "base").

    For the main seesaw base, at "Obj5E_Main:" you'll find:
    Code:
    		move.w	#$374,2(a0)
    For the spikeball that's on the seesaw, at "Obj5E_Spikeball:" you'll find:
    Code:
    		move.w	#$4F0,2(a0)
    Now, these are the "base" settings, to change the palette line, the simplest way would be to add 2000 to the values being moved:
    • If you want palette line 1, leave it as it is.
    • If you want palette line 2, add 2000.
    • If you want palette line 3, add 4000.
    • If you want palette line 4, add 6000.
    For example, the base:
    Code:
    		move.w	#$4374,2(a0)
    4000 has been added to the value, it'll now be tile ID 374 with palette 10 (palette line 3).
     
    Pokepunch likes this.
  3. GenesisDoes

    GenesisDoes Wizard of the Sonic Member

    Joined:
    Jan 2, 2016
    Messages:
    134
    Location:
    Pittsburgh, PA
    MarkeyJester explained most of it. Specifically, just toggle bits 13 & 14 of byte #2 ("2(a0)") using a programmer's calculator from the "base" settings. For a quick reference, the VDP's "pattern index address" format and other object-related info for Sonic 1 is also conveniently stored at this SonicRetro page under "Object Status Table Format" heading
     
  4. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    530
    Location:
    France
  5. Painto

    Painto Samodzierżca Najdłuższego Kija Member

    Joined:
    Mar 24, 2014
    Messages:
    315
    Location:
    Poland
    You need to add your loop to misc\loopnums.bin
    Each zone uses 4 bytes - 2 for loops and 2 for tunnels.
    GHZ array is like this:
    B5 7F 1F 20
    To add your loop, you need to change that 7F to number of chunk with your loop + $80.
     
  6. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    530
    Location:
    France
    Thank you, it's working!
     
  7. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    813
    Location:
    Portland, Maine
    How is the background made solid during the shaking sequences in Hill Top Zone and where can I find the code that makes that happen so I can use it in Sonic 1?
     
  8. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    715
    Location:
    Where I should've been a long time ago
    You should look at Sonic 3 & Knuckles, its way of doing this is very good. The routines you are looking for are many of the floor and wall collision routines (the interesting bit starts at around loc_EFB6 in S&K), and the flag controlling this is $FFFFF664. You may have to modify the floor/wall collision codes quite a bit to get full support though.
     
    ProjectFM likes this.
  9. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    813
    Location:
    Portland, Maine
    Thanks, Natsumi. However, I want to see how Sonic 2 does it since it uses the same code for collision as Sonic 1 (Project 128) and so it would be easier to add.
     
  10. presto

    presto Raised from the dead... Member

    Joined:
    Oct 12, 2014
    Messages:
    40
    Location:
    Cluj-Napoca
    (stupid question ahead)

    So, I've been trying to add the Peelout sprites to Sonic 1 through SonMapEd, and it would work, if it weren't for one little problem.

    [​IMG]

    Every single sprite (of the four) has that small red block in the front tiles. I tried resizing the sprites, using different ones, but the problem still appears. Does anyone have an idea why?

    (Actual image)
     
  11. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    390
    Location:
    Town Creek, AL
    Have you tried adding individual sprites in SonMapEd? It worked for me before I got Sprite Plotter.
    Edit: I mean one sprite at a time instead of multiple at a time.
     
  12. tilk

    tilk Active Member Member

    Joined:
    Feb 2, 2012
    Messages:
    28
    Hi! I was wondering, for what is "System_Stack" used? it's on all sonic games and only read once... (At least, such is the case in s3k where it gets loaded to the sp and never used)
     
  13. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    715
    Location:
    Where I should've been a long time ago
    This is the stack, where processor stashes information about the last routine it visits, or some extra information with interrupts (including crashes). Its basically a temporary place to hold items. sp is actually quite often referenced by the game code. SP is actually just A7 but its treated specially by the processor.
     
  14. tilk

    tilk Active Member Member

    Joined:
    Feb 2, 2012
    Messages:
    28
    Thank you, Natsumi! That means that I'd better not touch $FFFFFFD00... This is helpful as I'm shifting around the RAM to make use of the Clone Driver v2
     
  15. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    715
    Location:
    Where I should've been a long time ago
    the stack is actually $100 bytes up from the System_Stack ($FFFFFE00 in Sonic games by default), so $FFFFFD00-$FFFFFEFF. $FFFFFE00 and $FFFFFE01 are usually unused but they can actually be used without any issue
     
  16. tilk

    tilk Active Member Member

    Joined:
    Feb 2, 2012
    Messages:
    28
    Thanks. also for what is used the Plane_Buffer in Sonic 3 & knuckles, and what it does? I mean, it's not used by Sonic 1 nor sonic 2...
     
  17. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    715
    Location:
    Where I should've been a long time ago
    I think its simply just the mappings of the plane. They optimized bunch of stuff in S3K, including the level rendering code, thats where I assume Plane_Buffer comes from
     
  18. tilk

    tilk Active Member Member

    Joined:
    Feb 2, 2012
    Messages:
    28
    Might be! though by doing a search, it seems used mainly on Special stages (Blue spheres too) need to check out... Also name some labels! the space after sprite table buffer is occupied -.-
     
  19. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    715
    Location:
    Where I should've been a long time ago
  20. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    530
    Location:
    France