How to make LZ4 use seperate tile art? (s1)

Discussion in 'Discussion and Q&A Archive' started by Pacca, Jul 17, 2014.

Thread Status:
Not open for further replies.
  1. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I removed SBZ3 from normal gameplay, but I want to reuse it for something else. I plan to turn it into a 1 act new zone, but i need to figure out how to make it load new tile art, and, if possible, make it load new block, chunk, and background layouts as well (without messing with LZ acts 1-3, of course).
     
  2. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    The fact that LZ4 already loads something different from the rest of LZ makes it even easier for you, just saying :)


    Ask yourself, what does a zone need to exist? 8×8 tiles, 16×16 blocks, 256×256 chunks, object placements, ... and so on. Look at how all those things are included and incbin'd for the other zones (hint: it involves labels), and work your way from there, make sure not to forget anything. The CMPI checks are already in place, just remove the references to SBZ and turn them into references to your new zone.


    As I said in your other topic, try, with no fear to screw everything up (make a backup first of course). Nobody told me how to turn SLZ4 into Good Morning Zone, or how to turn SYZ1 to Sky High Zone, but I did it. I will be more than glad to paste you some functional ASM code later today if you'll still want, but figuring out how to do new things is half of the hacking fun, in my opinion :)
     
    Last edited by a moderator: Jul 17, 2014
  3. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    Ok, I'll be be more experimental this time around. I'll come back if i can't do it myself, though.

    Update: I tried searching through the asm for the incbin titles, with no luck. When searching for the titles of the act, I saw some useful stuff, but otherwise got nothing (I was able to change the music it played, though)
     
    Last edited by a moderator: Jul 17, 2014
  4. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    Note, I never did this before, but I'm looking at a disasm as I write this post.


    Look at all the stuff which looks like this: cmpi.w #$103,($FFFFFE10).w


    For example, the first one you find, loads a different palette. Look at how palettes are stored, create a new one, find out its palette ID (hint: put it after the existing palettes so you don't have to renumber all of them), and load it accordingly.


    Then, it's done into the Object 34 routine, to load an appropriate title card. Look up how to do mappings and whatnot.


    Make sure to fix the move.w #$103,($FFFFFE10).w in Boundary_Bottom. That's what causes the level transition when you fall down after Robotnik destroys the bridge. Please note that that's not the only line you should alter.


    Look at the stuff after these labels: Level_Index, ObjPos_Index, ...


    There's also "something" in Level_LoadPal you should look at. It's trickier because it's done on two lines and not only on one.


    This, and a few other things.
     
  5. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    How do I fix the small branches floating around the title card mappings? My new mappings don't fit because of branch errors, and I can't find them.


    P.S. a general guide on how to find dead branches would be so highly appreciated right now :D


    Update: It appears to be loading my new level name, but the title card acts erratically, moving both the name and the act number offscreen, and refusing to load the level.


    Update 2


    Forgot to mention that I tracked down the branch errors (a guide would still be appreciated, though)
     
    Last edited by a moderator: Jul 17, 2014
  6. Stardust Gear

    Stardust Gear A Programmer Member

    Joined:
    Apr 27, 2014
    Messages:
    134
    Go to _inc/LevelHeaders.asm

    Delete all

    Replace with this

    ; ---------------------------------------------------------------------------

    ; Level Headers

    ; ---------------------------------------------------------------------------

     

    LevelHeaders:

     

    lhead: macro plc1,lvlgfx,plc2,sixteen,twofivesix,music,pal

    dc.l (plc1<<24)+lvlgfx

    dc.l (plc2<<24)+sixteen

    dc.l twofivesix

    dc.b 0, music, pal, pal

    endm

     

    ; 1st PLC, level gfx, 2nd PLC, 16x16 data, 256x256 data,

    ; music (unused), palette (unused), palette

     

    ; 1st PLC 2nd PLC 256x256 data palette

    ; level gfx 16x16 data music*

     

    lhead plcid_GHZ, Nem_GHZ_2nd, plcid_GHZ2, Blk16_GHZ, Blk256_GHZ, bgm_GHZ, palid_GHZ ; Green Hill

    cmpi.b #3, (v_act).w

    beq.s @lz4

    lhead plcid_LZ, Nem_LZ, plcid_LZ2, Blk16_LZ, Blk256_LZ, bgm_LZ, palid_LZ ; Labyrinth

    bra.s @mz

    @lz4:

    lhead plcid_LZ, Nem_LZ4, plcid_LZ2, Blk16_LZ, Blk256_LZ, bgm_LZ, palid_LZ ; Labyrinth

    @mz:

    lhead plcid_MZ, Nem_MZ, plcid_MZ2, Blk16_MZ, Blk256_MZ, bgm_MZ, palid_MZ ; Marble

    lhead plcid_SLZ, Nem_SLZ, plcid_SLZ2, Blk16_SLZ, Blk256_SLZ, bgm_SLZ, palid_SLZ ; Star Light

    lhead plcid_SYZ, Nem_SYZ, plcid_SYZ2, Blk16_SYZ, Blk256_SYZ, bgm_SYZ, palid_SYZ ; Spring Yard

    lhead plcid_SBZ, Nem_SBZ, plcid_SBZ2, Blk16_SBZ, Blk256_SBZ, bgm_SBZ, palid_SBZ1 ; Scrap Brain

    lhead 0, Nem_GHZ_2nd, 0, Blk16_GHZ, Blk256_GHZ, bgm_SBZ, palid_Ending ; Ending

    zonewarning LevelHeaders,$10

    even

    ; * music is actually set elsewhere, so these values are useless

    And if you doesn't use Hg, replace (v_act).w with ($FFFFFE11).w

    Copy&paste the file artnem/8x8lz.bin

    and in sonic[1].asm write this:

    Nem_LZ4: incbin "artnem/8x8lz4.bin"

    I hope it will help :)
     
    Last edited by a moderator: Jul 17, 2014
  7. Devon

    Devon A̸ ̴S̴ ̵C̵ ̷E̶ ̸N̸ ̴D̶ ̵E̶ ̸D̶ Member

    Joined:
    Aug 26, 2013
    Messages:
    1,377
    Location:
    your mom
    Stardust Gear: You forgot about this:

     
  8. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    And if you doesn't use Hg, replace (v_act).w with ($FFFFFE11).w

    Copy&paste the file artnem/8x8lz.bin

    and in sonic[1].asm write this:

    Nem_LZ4: incbin "artnem/8x8lz4.bin"

    I hope it will help :)
    My disassembly doesn't have a file named levelheaders. I searched through the ASM, but I couldn't find it there, either. I use Hivebrain.

    Update:

    I don't think it matters much if I can't get the title card to work properly :/
     
    Last edited by a moderator: Jul 17, 2014
  9. Painto

    Painto Arthurus Paintus Erinaceus Member

    Joined:
    Mar 24, 2014
    Messages:
    321
    Location:
    Lublin, Poland
    Maybe you should show us the code, so we will see what can be wrong?
     
  10. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I'm attaching a copy of the mappings file for my title card headers. the only other things i added was another line below Obj34_condata, copy pasted from green hill zone, and an alteration to the SBZ3 specific code telling it to use the new zone card instead of SBZ's.

    Update: I managed to fix the title cards on my own :3 I still need help with adding new tiles to SBZ3, however.
     
    Last edited by a moderator: Jul 18, 2014
Thread Status:
Not open for further replies.