Basic Questions and Answers Thread

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

  1. SuperEgg

    SuperEgg I'm a guy that knows that you know that I know Member

    Joined:
    Oct 17, 2009
    Messages:
    Location:
    THE BEST GOD DAMN STATE OF TEXAS
    You need to add the art into the level PLC with its matching art location.


    It should be something like this.


    " dc.w CPZ_Booster


    dc.w $39C*$20


    "


    CPZ_Booster is the name of your Nemesis compressed art. So ensure you have that lying around in your main asm.


    Make sure your mappings are in the S1 format.
     
    Last edited by a moderator: Jan 30, 2015
  2. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    How can I find out it's location?
     
  3. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    "J_MarkObjGone_01" will automatically call "DisplaySprite" so you won't need to worry about that. As for "not where a piece of art I want is located", you'll have to elaborate. Do you mean; Sonic 2 ROM location of the compressed art? Sonic 1 ROM location of the compressed art? VRAM location of the art? VRAM location of a specific piece of art that was part of (and not all of) the compressed art you loaded into VRAM (Like a missile of a buzzbomber would be compressed with the buzzbombers art)?
     
  4. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    Compressed art from Sonic 1.

    For example:

     
  5. DanielHall

    DanielHall Well-Known Member Member

    Joined:
    Jan 18, 2010
    Messages:
    860
    Location:
    North Wales
    VRAM address divided by $20. That will basically display your art, but if we want to go into more depth:

    The value is split into 16 bits:

    PCCF HAAA AAAA AAAA

    Now, your A's is just the VRAM address divided by $20. The H will flip the tile horizontally, F will flip it vertically, the C's are your palette line (00-11) and the P is the priority flag.

    So $39C in bits =

    PCCF HAAA AAAA AAAA

    0000  0011  1001 1100 

    So it only uses the 'A' bits, meaning $39C x $20 = $7380 in VRAM  If you're not using any of the other bits, it really is as straight-forward as that.
     
    Last edited by a moderator: Feb 1, 2015
  6. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    How can I find my art's VRAM address?
     
  7. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Clearly, the principles of Sonic Team's compression scheme, PLC system and general VDP memory are being misunderstood. SO! Let's bring it back to basics...

    We'll pretend you have art in a file named "ArtFile.nem", this is a nemesis compressed art file, containing the art you wish to use:

    [​IMG]
    We must include it into the source:

    [​IMG]
    Now, we include it into whichever PLC list we want:

    [​IMG]
    Don't forget to change the number of entries in that PLC list (increase it by 1):

    [​IMG]
    I have chosen to dump the art into VRAM address $7800 (no particular reason, this is just an example). When this PLC list is ran, the art in "ArtFile.nem" will be decompressed, and dumped into VRAM at $7800+. Now, for an object to display using that art, can require one of several possibilities. I shall however, use the most common:

    [​IMG]
    Notice how $7800 (our VRAM address) is being pushed into the object's 2nd (and 3rd) byte. The object's sprite building shall now be linked to VRAM $7800+. I used a "/$20" in this example, the assembler will automatically divide it by $20, before assembling.

    If your object is not displaying the art, then there are a few possibilities of what could be wrong:

    • The object does not call the subroutine "DisplaySprite" (We have already discussed this, and your object does in fact call this subroutine as far as I'm aware).
    • There is art in the PLC list after your art (or in another list) that is being dumped to the same (or near the same) VRAM address as your art, and is therefore overwriting it. Thus, your art is no longer in VRAM, and hence, you have not found a nice clean and empty (unused) space.
    • Your mappings have the sprites setting their own (very specific) VRAM addresses (highly unlikely, but best not to rule out anything).
    To check whether or not your art is in fact inside VRAM, a few known methods include:
    • Regen's VRAM dump button inside the VDP debugger. Dump the VRAM to a file, and open that VRAM file with a tile editor (or perhaps SonMapEd).
    • Dump a savestate, for gsx savestates, the VRAM is located at 0x00012478. So erase the first 0x00012478 bytes of that savestate using a hex editor or something, and then open that savestate with a tile editor (or SonMapEd).
    SonMapEd from what I remember, has an "info" option in one of its menus, which can tell you the tile ID of the selected sprite/tile. Thus can help you to identify the VRAM address. At any rate and whatever tile editing/viewing software you use. You can see whether or not your art was loaded and/or possibly overwritten by some other art, by going to the VRAM your wrote in your PLC list.
    If the above instructions are not clear enough, then either, your talking about something completely different and your failing to express what it is. Or, your just not cut out for this sort of thing just yet, and maybe you should slow down a little and take a few steps back. That's pretty much my advice for the day.

    I by no means mean to show you up, or present myself as superior in anyway, I am simply finding it difficult (like many others) to help you suss out the issue you're having. (I mention this, because others in the past have been in the same situation, and because they didn't recieve the help they wanted due to their lack of explanation, they decide to turn on me (and others), and get rather nasty about it. Just think of this paragraph as some sort of disclaimer, that I shall not be responsible for any misunderstandings by anyone seeking help. Please leave a message after the beep.)
     
  8. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    Is there a base deformation code for Sonic 128 Hivebrain that I can use with Selbi's Parallax Code Generator so that the code will do exactly as it should? I want it to use the top two 128x128 chunks and have the y-axis locked in place. Also, I'm using the REV01 scrollblock code.

    Edit: Also, how do you change a piece of art's palette line? I want make my hud load the rings' yellow because I changed Sonic's palette so it doesn't contain any yellows. This seems like something that would be easy to do but I can't find anywhere that says how to do it. Switching palette lines with SonMapEd doesn't do anything.
     
    Last edited by a moderator: Feb 5, 2015
  9. Psi

    Psi Well-Known Member Member

    Joined:
    Dec 20, 2014
    Messages:
    102
    Does anyone know what controls where an object is positioned in layer order in Sonic 3+K? I've placed in an object and right now it seems to appear behind certain foregrounds and objects (ones that don't for Sonic).
     
  10. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I want to make an object do something after Player 1 crosses a certain point in S2, but I'm not sure how to use the players X position in the code. What address is this stored in?
     
  11. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    You're best to use level events. Same thing that locks the screen at certain points, loads the boss object, and so on.
     
  12. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I've been surfing the level events in both the Xenowhirl and Github disasms, and none of them clarify where Sonic's X values are checked...
     
  13. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    Look harder. x_pos(a1)
     
    Last edited by a moderator: Feb 5, 2015
  14. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I mean outside of the character object. More experimentation on it seems to suggest that the level event routines were using the screens x position, but I can't get that to work reliably at all.
     
    Last edited by a moderator: Feb 5, 2015
  15. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    (a1)


    Look for 'lea (MainCharacter). w,a1'.
     
    Last edited by a moderator: Feb 5, 2015
  16. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    You can do that or you could just use (MainCharacter+x_pos).w

    (Read MJ's response, not this) However, Clownacy's method helps to save ROM space.
     
    Last edited by a moderator: Feb 5, 2015
  17. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Actually, your method proves to be both smaller (and faster) provided of course, multiple contents of the memory region aren't required to be accessed more than once or twice.
     
  18. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Thanks! I got it to work great! I do have another question, though. How would I force the character to look up when Control_Locked is set (and without shifting the camera)?
     
  19. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    I'm not sure what game/disassembly you are using, but the process is pretty much the same:

    move.b #$01,($FFFFF602).w ; force button "up" to be pressed on "Sonic's" controls
    move.w #$0060,($FFFFF73E).w ; force screen position to defaultPlease note, that F602 is Sonic's controls, the Sonic object (Object 01) copied the main controls (i.e. F604) to Sonic's controls (i.e. F602) when the controls are not locked. Whilst pretty much everything else, including, game pause, menu selections, etc, read from the main controls, the Sonic object itself reads from Sonic's controls. So having the controls locked, and accessing Sonic's controls directly is probably the most effectively safe.
    F73E is the screen's Y position that's relative to Sonic, it is used for shifting the screen up or down when looking. 0060 is the central value. It is possible for Sonic's code to increase or decrease the value to 0062 or 005E after you've set it to 0060, but I suppose that depends on "when" you write 0060 to it, for example, having another object write it will be perfect, since it happens after the Sonic object is processed. If it is written before the Sonic object is processed, then you'll most likely require a flag of your own. Or, if you have Sonic 2's looking up/down timer, then perhaps you could keep that timer constantly reset instead.
     
    Last edited by a moderator: Feb 6, 2015
  20. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    Does anybody know how to switch the palette line that the hud uses in Sonic 1 Hivebrain? I want it to use the ring's yellow since I changed Sonic's palette to Sonic 2/3's Sonic palette which contains Tail's orange in place of yellow.