Basic Questions and Answers Thread

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

  1. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    This is likely a glitch caused by SonED2 not saving special stages correctly or corrupting files because you tried to assemble the ROM while it was still saving. It is possible that the entire special stage layout is corrupt (and using debug mode would confirm this to be false or true). Either way, SonED2 really is not a stable tool to use and you need to be careful if you choose to use it. I have no experience of special stage editing with it, so I cant help more.
     
  2. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    Is there a limit to how many zones Sonic 1 can hold? I think I want to rework a scrapped project of mine, "Sonic 2 in Sonic 1" as "Sonic The Hedgehog 100%" having all zones from 1 - 3K in it.
     
  3. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    It can hold up to 255 zones, or at least if you have enough ROM space. This applies for Sonic 1, 2, and 3K.
     
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    There's no "limit" to anything if you know how to modify it accordingly. However, that idea of yours already exists, so you wouldn't really do yourself any favor by making a second version all over again. Plus, porting everything from S3 to S1 is way more complicated than the other way around, from what I heard.
     
  5. ArcaniaCQ

    ArcaniaCQ Well-Known Member Member

    Joined:
    Jul 18, 2015
    Messages:
    789
    Location:
    Sweden
    Sonic 3 in 1 don't have Sonic 3K levels who probably was the point. Also I would love to play with Hyper Sonic in Sonic 1 and 2 Levels :p
     
  6. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    That's selecting what game, I mean all stages in one game. Using cut scenes to go from one zone to another, creating one to go from final to Emerald hill. Using a 2 beta as well as the 2 final ending to go from death egg to angel island, Including both 2 beta & 3k's hidden palace zones

    With this in mind I may use a sprite sheet I have (taken from scrapped project Sonic Nebula) to use different animations.
    GHZ - FZ use S1 animations,
    EHZ - DEZ use S2 animations,
    AIZ - rest use S3K animations,
    Yet different levels of super.
    Grab S2's emeralds for super sonic level 1
    Grab S3K's emeralds for Super sonic level 2. Super emeralds get hyper sonic.
    (Plans may be added, but just stating that it will be one game and not 3 games in one game)
     
  7. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    I believe Selbi meant is porting everything to Sonic 1. You will have HELL of a time porting S3K objects from Sonic 3K to Sonic 1, because often they are coded like shit, they use the longword pointer feature extensively, and there is a lot of code for the objects in general, with no disassembly properly documenting any of it.
     
    Pacca likes this.
  8. GenesisDoes

    GenesisDoes What Nintendont Member

    Joined:
    Jan 2, 2016
    Messages:
    159
    Location:
    Pittsburgh, PA
    After looking at the DrawBlocks code again, cross comparing that section of code with MarkeyJester's comments from Project 128, and experimentation last night, I was able to get ROM Chunks >$7F to properly display now in ROM-Chunk levels. As Clownacy mentioned, I had to change an andi.w $7F to a $FF and do a lsl/add combo. (Changing the add.w to add.l commands scrambled block graphics, so I kept it as word-sized). A new RAM variable named f_ROMChunks conditionally swaps between the $7F andi and the $FF andi blocks, depending if the level is a ROM-Chunk level or not, for proper level rendering. Code changes to the base ROM Chunk code shown below (marked with "!@").

    Code:
    ;!@ Commentary borrowed from PJ128 MJ Edition (01/19/15)
    ;https://github.com/sonicretro/s1disasm/blob/ProjectSonic1TwoEight/sonic.asm
    DrawBlocks:
            if Revision=0
            lea    (v_16x16).w,a1        ; MJ: load Block's location
            add.w    4(a3),d4        ; MJ: load Y position to d4
            add.w    (a3),d5            ; MJ: load X position to d5
            else
                add.w    (a3),d5        ; MJ: load X position to d5
        DrawBlocks_2:               
                add.w    4(a3),d4    ; MJ: load Y position to d4
                lea    (v_16x16).w,a1    ; MJ: load Block's location
            endc
            move.w    d4,d3            ; MJ: copy Y position to d3
            lsr.w    #1,d3            ; Mult by 2?
            andi.w    #$380,d3        ; MJ: get within 380 ($700 pixles) in multiples of 80(?)
            lsr.w    #3,d5            ; MJ: divide X position by 8
            move.w    d5,d0            ; MJ: copy to d0
            lsr.w    #5,d0            ; MJ: divide by 20
            andi.w    #$7F,d0        ;!@    ; MJ: get within 7F
            add.w    d3,d0            ; MJ: add calc'd Y pos
           
            ;!@ Old compressed art code (ROM_chunk)
            ;moveq    #-1,d3
            ;move.b    (a4,d0.w),d3
            ;beq.s    locret_6C1E
            ;subq.b    #1,d3
            ;andi.w    #$7F,d3
            ;ror.w    #7,d3
            ;add.w    d4,d4
            ;andi.w    #$1E0,d4
            ;andi.w    #$1E,d5
            ;add.w    d4,d3
            ;add.w    d5,d3
            ;movea.l    d3,a0
            ;move.w    (a0),d3
            ;andi.w    #$3FF,d3
            ;lsl.w    #3,d3
            ;adda.w    d3,a1
    
    ;locret_6C1E:
            ;rts   
           
           
            ;!@New ROM_Chunk code
            cmpi.b    #id_MZ,($FFFFFE10).w     ; are we in MZ?
            beq.s    @mz                        ; if yes, branch
            moveq    #-1,d3                    ; load chunks from RAM. MJ: prepare FFFF in d3
            bsr.s    LocateBlock
            bra.s    @continue
    
    @mz:
            move.b    #1, (f_ROMChunk).w        ;!@ BIG_Rom_Chunk. Set ROM_Chunk flag
            moveq    #0,d3
            bsr.s    LocateBlock
            add.l    #Blk256_MZ,d3
    
    @continue:
            movea.l    d3,a0                    ; MJ: set address (Chunk to read)
            move.w    (a0),d3
            andi.w    #$3FF,d3
            lsl.w    #3,d3
            adda.w    d3,a1
            rts
    ; ---------------------------------------------------------------------------
    
    LocateBlock:
            ;moveq    #0,d3
            move.b    (a4,d0.w),d3    ; load chunk ID in d3. MJ: collect correct chunk ID from layout
            beq.s    LocateBlock_EmptyChunk
            subq.b    #1,d3
    
            ;!@ BIG_ROM_Chunks
            tst.b    (f_ROMChunk).w    ;!@ Is this a ROM Chunk level?
            bne.s    @BIG_Chunks        ; if so, branch
           
            andi.w    #$7F,d3                    ; MJ: keep within 7F
            ror.w    #7,d3           
            bra.s    @LocateBlock_Continue    ;!@ BIG_Rom_Chunks
       
        ;!@ BIG_ROM_Chunks
        @BIG_Chunks:
            andi.w    #$FF,d3            ; Keep within FF instead
            lsl.l    #8,d3
            add.l    d3,d3
    
        @LocateBlock_Continue:
            add.w    d4,d4
            andi.w    #$1E0,d4        ; MJ: keep Y pos within 480 pixels (?)
            andi.w    #$1E,d5            ; MJ: keep X pos within 30(?)
           
            add.w    d4,d3            ; MJ: add calc'd Y pos to ror'd d3
            add.w    d5,d3            ; MJ: add calc'd X pos to ror'd d3
           
        @LocateBlock_locret:
            rts
    ; ---------------------------------------------------------------------------
    
    LocateBlock_EmptyChunk:
            addq.w    #4,sp    ; pop a stack frame to leave a1 pointing at the first tile
            rts
           
    ; End of function DrawBlocks

    Very close
    to getting this important feature working for the hack! Only problem now is that the game is still using the wrong collision for the blocks on chunks >$7F (it's using the block collision for andi.w$7F, (current chunk ID)). What am I doing wrong?

    [​IMG]
     
  9. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    FindFloor and FindWall are responsible for collision, and use FindNearestTile. In the Git disasm, the three subroutines are split into separate files in the _incObj folder. FindNearestTile (Floor_ChkTile in Hivebrain) is probably to blame. You already modified LocateBlock, which came from the Chunks in ROM guide, but that only handles displaying blocks, it's the code after that part of the guide, Floor_ChkTile_LocateBlock, that does collision.
     
  10. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Why is it so hard to just check the time on the hud?
    Hello people it has been awhile since I had a question for you all. All I want to do is to check if said time on the hud is "X:XX" whatever is. Now I've tried a couple of things, I did a similar check like when it checks 9:59 for the time over, however when I did this the timer stopped working. I then added my own counter to a free ram address and added it to "hudupdate" so it would go around like the timer, did a check if it had hit the time, it still does not do what I want. I also did a check for the ram address $FFFFFFE22, which is the time but to no avail.

    Now you have to realize that this may be simple, but it is not "simple" to me. I have a hard time understanding things, even things that may seem obvious. I'll try and think of other things but I did not expect to have such a hard time with this. But if anybody can give me some guidance of maybe explain that I'm doing this all the wrong way I would greatly appreciate it. Also this is for Sonic 1.
     
  11. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    It's all to do with complex converstion.

    The rings and score are hexadecimal value, these need to be converted to a decimal representation of hex. For example, the number $2A would become 42, but in hex $42, this process can be done with ALL digits of the rings and score, because all of the digits reach 9, so it can be done in one sweep.

    The time is not that simple, because the number of seconds do NOT reach 99. Instead it reaches 59, one of the digits does not reach 9, so having the time stored as one value (say a long-word) and converting from hex to decimal to get minutes, seconds and centiseconds in one go, will not work without that 5 being taken into account.

    To get around this, Sonic Team decided to seperate the individual elements (the minutes, the seconds, etc) into individual bytes, this allows each element to be converted from hex to decimal individually and easily. So:

    Code:
            lea    ($FFFFFE22).w,a1
            cmpi.l    #$93B3B,(a1)+    ; is the time 9.59?
            beq.s    TimeOver    ; if yes, branch
    The 93B3B is not a WHOLE hexadecimal representation of the time, converting that number altogether to decimal gives you "604987" which is clearly not right.

    But if you seperated the bytes: "9" "3B" "3B" and converted them individually, you get; 9 = 9, 3B = 59, 3B = 59. The format is HH MM SS CC (Hours, Minutes, Seconds, Centiseconds).

    So let's have an example, say we want to do something on the condition that the time reaches 1:30. You must break it up into individual elements, so Hours are 0, Minutes are 1, Seconds are 30 and Centiseconds are 0. This gives you 00 01 30 00, convert them to hex individually... 00 = 00, 01 = 01, 30 = 1E, 00 = 00. You now have 00011E00.

    Code:
            cmpi.l    #$00011E00,($FFFFFE22).w
            bgt.s    DoSomething
     
  12. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,229
    Location:
    UK
    Ah! I see! I was wondering if the 3B ment 59 when I was converting it but wondered why it would have two 59s. I did not know it accounted for centiseconds even though they are not visible on the hud. Thank you very much MarkeyJester I have a much better understanding of this, and yes I was doing this all worng haha you live and learn. I'm going to put this knowledge to use when I get the chance.
     
  13. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Wait a minute, hours are actually a thing? I always thought it just goes on and on beyond minutes (after 59 minutes comes 60 instead of 1 hour 00 minutes).
     
  14. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    The game only reads the minute counter as a single byte, so if you extended it to go beyond 9 minutes, you'd get 255 minutes at most, without rewriting a bunch of timer code. Furthermore, the least significant byte is the frames, not centiseconds. Centiseconds go from 0 to 99, frames go from 0 to 59.
     
  15. NewSonicHacker55

    NewSonicHacker55 Newcomer Trialist

    Joined:
    Nov 24, 2015
    Messages:
    2
    First off hi I'm new here and I have a question I'm sure this has happened to others too but I was trying to add the spindash into Sonic 1 and everything was going okay until this:
    [​IMG]
    I was sure I had done the DPLC,Mappings,and Animation correctly I was using a guide and added the tiles for the spindash in I checked every file I had multiple times and didn't see where I went wrong so I refered to the guide to double-check myself and sure enough everything was done the way the guide told me to do it I wasted hours trying to fix the spindash graphics but to no avail and I eventually stopped when I got frustrated I am using this guide and the GitHub disassembly If anyone knows how I can fix the issue then please reply here's a link to the files I have if necessary
     
  16. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    Try viewing everything in SonMapEd & see what shows up on it.
    I've ported the spindash with errors several times, so it could be something got screwed up in either mappings or DPLC.
     
  17. ThomasThePencil

    ThomasThePencil resident psycho Member

    Joined:
    Jan 29, 2013
    Messages:
    910
    Location:
    the united states. where else?
    ok, so i actually started working on a new hack today and am currently trying to get a boss to at least display properly (yup, i'm trying to code an ai on my own; wish me luck). i have this so far...and here is an example of the hellhole that follows when i attempt to test after the title screen (a.k.a. after the level loads up):
    [​IMG]
    i did something terribly, terribly wrong, and i can't figure out what. hm.
    (yes, i've tried to fix this, for all of five minutes across three different possible problems. nothing has worked so far.)

    edit: if i take specter knight (the boss) out, this still occurs, apparently.
     
    Last edited: Feb 5, 2016
  18. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    How can I make an object appear behind the foreground like how Eggman does in Angel Island Zone right before his boss fight? Behind the background would work well too.
     
  19. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    What did you change in the code, art, mappings, etc? I don't think even the best of sonic hackers could help you with nothing more then a garbled screenshot and the details (or lack there of) you provided. I don't mean to put you down, but it's kind of important to share these things.
     
  20. D.A. Garden

    D.A. Garden Sonic CD's Sound Test Member

    Joined:
    Aug 6, 2009
    Messages:
    582
    Location:
    England
    I hate to break it to you, but Eggman isn't actually behind the background. Through some 'somewhat' clever use of priority and high/low plane use, this effect is created. Let me explain:

    Plane A, which Sonic is running on, also contains the art for the trees that are the 'background' (This is used in a lot of other zones to hide the background switching, such as the fire bombing in Angel Island Zone 1. Anyway, all of this art is high priority, so that any objects on the low plane will always appear behind it. Eggman and some 'tree trunk' objects are placed on the low plane, behind this Plane A 'background', and move at different speeds.These 'tree trunk' objects have a higher priority than Eggman, however and so will always load in front of him, even though they are both on the low plane. This creates the illusion of Eggman flying through the trees in the background.

    Just to clarify, Plane B still has the same background through all of Angel Island Zone 2, although it changes palette/layout slightly at one point. That's it.
     
    Last edited: Feb 5, 2016