Basic Questions and Answers Thread

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

  1. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    ok, you know what? how about i'll simply ask this. if you wanted to put some more sprites for the rings in sonic 1 , how would you go on doing it?
     
  2. GenesisDoes

    GenesisDoes What Nintendont Member

    Joined:
    Jan 2, 2016
    Messages:
    159
    Location:
    Pittsburgh, PA
    If you wanted to put more frames for the rings in Sonic 1 (or for any other existing object), you would do the following (Sonic 1 Github, steps will vary for older disasms):

    1. Open the appropriate tile art file with the appropriate decompression routine (usually Nemesis), palette file(s), and mappings file into an art editor of choice. SonMapED is pretty good. For rings, this would be "artnem/Rings.bin", "palette/Sonic.bin" (as main/primary palette), and "maps/Rings.asm" respectively.

    2. Import the new tiles and create new frames with the mappings. Save the tile art and mappings files. For Sonic 1 Github, unfortunately, the mappings file is referenced elsewhere in game code by the line label in the mappings file. So if the original file had "Map_Dog" as the main line label, make sure to rename the label as such in the saved file, since SonMapED generates random label names.

    3. Upload the tiles into a tile offset location in VRAM in the "_inc/Pattern Load Cues.asm" file. Each PLC entry consists of a line label to the art file (usually Nemesis compressed) and a hexadecimal VRAM address value. Divide address values by $20 to get the actual VRAM tile offset, and multiply VRAM tile offsets by $20 to get VRAM address values. To find suitable empty VRAM spaces for VRAM tile offsets, I suggest using Gens KMod's VRAM debugger to find empty space (Google it). For rings, modify the marked line:

      Code:
      ---------------------------------------------------------------------------
      ; Pattern load cues - standard block 1
      ; ---------------------------------------------------------------------------
      PLC_Main:    dc.w ((PLC_Mainend-PLC_Main-2)/6)-1
              plcm    Nem_Lamp, $F400        ; lamppost
              plcm    Nem_Hud, $D940        ; HUD
              plcm    Nem_Lives, $FA80    ; lives    counter
              plcm    Nem_Ring, $F640     ; rings. !@ Modify me. Multiply the VRAM tile offset by $20 to get this VRAM address value
              plcm    Nem_Points, $F2E0    ; points from enemy
          PLC_Mainend:
      ;
      Unfortunately, with having more frames/tiles, odds are the new ring art will overwrite art after it if kept in the standard location. You will need to relocate the ring art into a new VRAM location. Either move the art after the rings elsewhere, or remove/relocate other art elsewhere to put the rings at.

    4. Modify the game object code to point to the new VRAM location via a VRAM setting value, and point to the mappings file. The object code for rings is at "_incobj/25 & 37 Rings.asm" . The VRAM setting will be written into obGFX object RAM variable, while the mappings will be written into obMap object RAM variable. The mappings setting is simply a pointer to the main line label in the object's mappings file from Step #2. See byte $02 of the Object Status Table Format for the significance of the bitfields of that VRAM setting, and compute an appropriate value using a programmer's calculator.

      ObGFX bitfield:
      For the rings, modify the two marked values as appropriate throughout the code (there are two references to both variables, here is one reference):

      Code:
      loc_9BBA:               ; XREF: Ring_Main
             move.b   #id_Rings,0(a1)   ; load ring object
             addq.b   #2,obRoutine(a1)
             move.w   d2,obX(a1)   ; set x-axis position based on d2
             move.w   obX(a0),$32(a1)
             move.w   d3,obY(a1)   ; set y-axis position based on d3
             move.l   #Map_Ring,obMap(a1)   ;!@ Mappings
             move.w   #$27B2,obGfx(a1)         ;!@ VRAM Setting value
             move.b   #4,obRender(a1)
             move.b   #2,obPriority(a1)
             move.b   #$47,obColType(a1)
             move.b   #8,obActWid(a1)
             move.w   obRespawnNo(a0),obRespawnNo(a1)
             move.b   d1,$34(a1)
    5. I believe you will need to modify the animation code in the game object code and at "anim/Rings.asm" to make them animate correctly.
    6. Test and adjust as necessary until new rings work
     
    Baraksha likes this.
  3. Sheeracali

    Sheeracali Newcomer Trialist

    Joined:
    Sep 4, 2016
    Messages:
    9
    I'm in the process of replacing the title screen art in S3K. I understand SonMapEd doesn't support enigma. So, is there another way to replace the art mapping?
     
  4. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    It's not that SonMapEd doesn't support Enigma, it's that it doesn't support plane mappings. SonMapEd supports sprite mappings, huge difference. If you want a plane map editor, there's PlaneEd and Captain PlaneEd, and I hear Retro Graphics Toolkit supports it, too.
     
  5. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    well, this guide basically explains everything I have already done until this point, but I still got a problem. you see , my main issue is that because I moved the ring's location in the VRAM due to space, and while that made the rings work great in the normal stages, it still a problem with special stages because the special stages over writes the rings. I was asking here for the last few days with now response if it is possible to make the special stages load the rings into a different location when entering them. the best thing I was able to figure out so far is how to change where it load the tiles from

    p.s. i'm using Hivebrain 2005
     
  6. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    This is kind of right, in a way... But probably not how you meant it.

    The animation script will need to be adjusted for the new frames, but the animation script only handles the ring sparkle.

    There is a routine that, off of the top of my head, I cant think of the name of (I'm not home now, but if I was, I'd look it up). Basically, it handles a couple of different animations in game, and I know the ring is one of them. Maybe someone else here can point you to where I'm talking about.
     
  7. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    I think I know what you talking about and I already handled it. Basicly there is a routine named "changeringsframe" or some thing like that and in i there is a line for hoe many frames the ring animation will have and there is also a line for the speed of the animation. I changed the number of from 5 (I think) to 7.
    I am not sure if this is correct tho, like you I would have checked i if I were home right now
     
  8. Sheeracali

    Sheeracali Newcomer Trialist

    Joined:
    Sep 4, 2016
    Messages:
    9
    I've tried PlaneEd, but I don't see a way to import graphics. I just went into Retro Graphics Toolkit, but no matter how I try I can't get the art that I've imported to work.
     
  9. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    ok, so I decided to go and work on some level design with SonLVL, and after I made some new chunks while editing act 2 this happened
    [​IMG]
    edit:
    ok, I add to many chunks ,I deleted some and it's fixed now, but can I extand the chunk limitation?
     
    Last edited: Sep 16, 2016
  10. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Sonic 1 has a limit of $52 chunks normally, because that is how many will fit in the space reserved for chunks in RAM. There are two ways to get around this: have the game read uncompressed chunks from ROM, or switch to the 128x128 chunk system used by Sonic 2.
     
  11. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    I followed the toturial...

    [​IMG]
    ok, so from what I was able to understand is that I think this problem happens due to a disorder in the blocks. you see before I followed the toturial I had to make some new blocks and because I didn't placed those blocks at the end of the block list they seem to cause a disorder in the block numbers and so the game loads the wrong blocks, this problem never accured back when when I used the nemesis chunks, I think the way to fix this is to somehow port over the way the nemesis file loaded the tiles to the uncompressed one, but I don't know how to do that. I just hope the only solution is not to recreate all the chunks
     
    Last edited: Sep 16, 2016
  12. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    Just decompress the compressed chunk files with KensSharp or FW-KENSC and copy them over the uncompressed files.
     
  13. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    It worked, thanks. also I actually though about doing that but wasn't sure how.

    EDIT: I got another problem that I wanted to ask for a while now, for some reason whenever I try to edit certain art I seem to cause a disorder with a label called "mcsoniconptfm"
    this happened to me on 3 occasions, when I wanted to edit the monitor, sonic on the title screen and the spikes. the thing I noticed common to all of this is that they are all nemesis art and that in all of them I made some sord of mapping changes.
     
    Last edited: Sep 16, 2016
  14. Pokepunch

    Pokepunch That guy who posts on occasion Member

    Joined:
    Aug 7, 2009
    Messages:
    270
    Location:
    UK
    Because you are adding more content to the game that is taking up more space, old code that needs to branch to other code can no longer make it within the given size(In this case a word.) In order to fix this, you need to change the bsr.w to jsr.
     
  15. GenesisDoes

    GenesisDoes What Nintendont Member

    Joined:
    Jan 2, 2016
    Messages:
    159
    Location:
    Pittsburgh, PA
    You ninja'd me Pokepunch :p.

    One limitation to keep in mind about the ROM-Chunk mod is that you will only gain an additional $2D (or 45 in decimal) chunks, due to Sonic 1's chunk system limiting upto $7F chunks, which should be enough chunks for most hackers, considering the large size of 256x256 chunks. The LSB of the chunk ID is used to mark loop chunks. If you really need upto $FF max chunks, you could modify the chunk system to utilize the LSB, at the sacrifice of the Sonic 1 loop system; PM me if you need to know how. (I plan on making a guide to extend upto $FF ROM-Chunks after my current hack is completed).
     
  16. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    That sounds cool, altho I think 2D would be enough, but I may be worng, however I do need the loop chunks so I guess I won't use this techniche but good luck with your guide anyways.

    Now, I hope I won't somehow sould like an ass by saying this, but can we refer back to my problem about Rngs,VRAM and special stages which I had for like 2 pages?
     
  17. StephenUK

    StephenUK Working on a Quackshot disassembly Member

    Joined:
    Aug 5, 2007
    Messages:
    1,026
    I'm starting to wonder how much effort you're actually making to fix these errors yourself. I mean come on, changing bsr.w to jsr is one of the most basic things you can do, and anyone with any knowledge of asm should know how to fix basic branch errors and why they occur. It sounds like when you first hit an error, you come here rather than try to fix it yourself and you'll never learn anything that way.
     
    Clownacy and Soldaten like this.
  18. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    You know, this is not the first time i'm messing with branching errors, it's just usually the error says "could not reach" so I didn't suspected it. And, I know it looks like i'm asking to much and believe me i'm myself embarest to ask this questioms. But believe me, I am trying to learn from those mistakes and there are alot of errors that I was able to figure for myself because I learn, hack if you look at some of those questions I eventually figured it by myself so I edit them saying I fixed it (yeah, should have figure those out before actually posting, sorry). It's just that for me some things that may or may not count as basic could be confusing sometimes and I may need just a bit of guidence. But yeah, I agree, I have asked alot of questions lately, perhaps to many. Another bad habit that I need to get rid off is assume that "X is probably not the case because Y" because that's what caused the braching question to begin with.
     
    Pacca, breakthetargets and NiphFM like this.
  19. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    What you really need to do is fix the scope of things you try to do. Adding more frames to rings is not an easy task on so highly hardcoded game (then again it goes without saying for most games of the time). There is just no easy way to do it.
     
  20. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    I guess you're right, but I want to at the very least do this one, I already went this far.