Basic Questions and Answers Thread

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

  1. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Thanks because when i'm doing a check for palload1, when sonic break the switch monitor, the game get me an illegal instruction on: ObjectsLoad! :)
    So thank you, it's clearer!

    EDIT:
    Fine, and for the anim file, it's like the mappings? I have to update them too?
     
  2. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    For the animation, you go to Sonic_Animate. The very first line should be:
    Code:
    lea    (SonicAniData).l,a1
    Just add a check around here to load the correct animation data depending on the character.

    Oh, and in loc_13A9C, loc_13ADE, and loc_13B26, they load specific data from Sonic's animation data. Also apply checks for them.
     
    Ashuro likes this.
  3. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Oh, if this is only this, it's already done! thanks anyway!

    And for the palette, i have doing this:


    Code:
    Obj2E_Blank:    ; XREF: Obj2E_Move
            addq.b    #2,$24(a0)
            move.w    #29,$1E(a0)
            move.b    $1C(a0),d0
            tst.b        d0; does monitor contain Eggman?
            bne.w    Obj2E_ChkEggman ; if not, go and check for the next monitor type (1-up icon)
            tst.b     ($FFFFFFF6).w
            bne.s     SwitchPlayer
            bchg.b     #0,($FFFFFFF6).w
            move.l    d7,-(sp)         ; Push
            moveq     #$18,d0
            jsr     PalLoad1
            move.l    (sp)+,d7        ; Pull
            move.l    #Map_Ashuro,($FFFFD004).w ; load Ashuro's mappings
            bra.s     Obj2E_Blank_end
    But the palette doesn't work, i think i have doing wrong somewhere :D
    Is that correct?
     
  4. Devon

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

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    PalLoad1 loads the palette into a separate palette buffer for fading. Use PalLoad2, which will overwrite the main palette.
     
    Baraksha and Ashuro like this.
  5. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Thank you Ralakimus, you saving me time before SHC's deadlines! :D
    Thank you! All perfectly work!
     
  6. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    thanks for clearing thing up, ok, I think I got everything ready accapt one thing, ProjectFM said "you need to choose a moment when the boss is loaded and make the palette load by moving the palette's entry number to d0" , I tried doing that but for some reason it still uses sonic's pallet
    here is the routine with my changes:

    Code:
    loc_6ED0:
            move.w    #$8C,d0
            bsr.w    PlaySound    ; play boss music
            move.b    #1,($FFFFF7AA).w ; lock    screen
            addq.b    #2,($FFFFF742).w
            moveq    #$11,d0
            bra.w    LoadPLC        ; load boss patterns
            move.b    #$15,d0  <------
            bra.w    PalLoad2 <------
    
     
  7. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    The boss itself would still use line 0 for palette, of course! You need to edit the tile for the boss in it's code (move.w #$pxxx,2(a0), p usually is line only. 0 for line 0, 2 for line 1, etc)
     
  8. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    well, I was able to change the pallet line the boss was using to the second line, but the second line seem to still use the normal ghz line
     
  9. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Last question:

    For the switch monitor again.
    I am now able to load the life icon for each characters. It loads the life icon but not the "X" and the live's numbers.
    So i have trying this:
    Code:
    ...
    moveq    #$00,d0    ;load life icon
            jsr     (LoadPLC).l    ; load game over patterns
    Switch_LiveHud:
            move.b    #$C,($FFFFF62A).w    ; set VBlank routines to run
            jsr     DelayProgram    ; run VBlank
            jsr     RunPLC_RAM    ; decompress and dump Art
            tst.l    ($FFFFF680).w    ; are there any items in the pattern load cues?
            bne.w    Switch_LiveHud    ; if so, branch to loop
            jsr        Hud_Base    ; load the uncompressed patterns over the hud art in VRam
    ....
    But i got an illegal instruction :(
     
  10. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    I recommend using uncompressed art for that. That way, you don't have to add extra entries into Pattern Load Cues.asm and, if you want it to switch in-game, the new art will load instantly. Also, because the art your a switching uses so few tiles, using nemesis compression does save that much space.

    If you want to load uncompressed art, you do this:
    Code:
                    move.l  #Art_LifeCounter,d1                          ; Call for Life Counter Art
                    move.w  #????,d2 ; Load art from this location (VRAM location*20)
                    move.w  #$60,d3 ; Load number of tiles to be loaded (Number of tiles*20)
                    jsr     (QueueDMATransfer).l
    And this stuff:
    is only used for loading levels and screens and stuff like that. It's not needed here.
     
    Ashuro likes this.
  11. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    EDIT: Thank you ProjectFM, it's solved!
    And now i want to load uncompressed art from everywhere with this method! :D
     
    Last edited: Oct 3, 2016
  12. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    no no no no. Instantly is completely wrong! It in fact it takes at LEAST the time for next v-int to load this data; and in rare cases even longer! This is very little in comparison to nemesis queue though. Also you should never load large amounts of tile this way; other requests (especially player) will already take long time to process, and if you are still loading tiles after vertical blanking period, it may cause a lot of graphical glitches and other issues. Moreover you need to be very careful that the data you load is aligned; if data is split between 2 128KB 'banks', all the overflowing data will be corrupt instead. Indeed, using this method is best for small parts of data that are reloaded often. Sonic 3 and Sonic & Knuckles actually use both uncompressed art and KosM art for background effects in order to try to leverage this load for multiple frames, which will cause less glitches, and will also make it way much slower to load KosM art (If you are very careful, you can make a lot of levels glitch up this way). Overall, you need to know when its good idea to use uncompressed art and when not! The case with life icons could easily be shifted to nemesis, as it is so little tiles, however uncompressed works too, for the same reason!
     
    ProjectFM and Ashuro like this.
  13. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Natsumi, however, this method work for me and i have no problems.
    I have just redesigned the life icon art in SonMapEd and save them to "uncompressed tile graphics".
    The art is perfectly loaded, nothing is corrupted (yes before i make some changes).
    But what you say makes sense, so I'll be careful with it.
     
  14. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    alright, i'm getting close, I was able to make the boss load the right pallet I need , however I was able to do it by placing the part that loads the pallet above the part that loads the boss's pattern
    Code:
            move.b    #$14,d0
            bra.w    PalLoad2
            moveq    #$11,d0
            bra.w    LoadPLC        ; load boss patterns
    and that causes the game to load the wrong tiles , I though you usually fix this kind of stuff by placing a "move.b 0,d0" in the middle but that didn't do anything.

    EDIT:
    well i'm silly, I used a bra instead of a bsr on PalLoad2. it works now, but I still got one more problem. how do I make the sprite use the correct colors out of the pallet line?, it seems to use whatever color is in place of the old one, basically I think what i'm trying to ask here is how do I map the colors?
     
    Last edited: Oct 3, 2016
  15. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    Uhh... BRA doesn't run the code after it. That's what BSR is for.
     
  16. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    never mind, I just had to save the mappings, everything seem to work the way I want it to, I think it's finally over (I hope) thank you
     
  17. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    EDIT: Solved, the problem was into "MainLoadBlock".
     
    Last edited: Oct 4, 2016
  18. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Sorry for double post, but if i don't know if you will see my question by editing my last post.

    Then, My 8th zone is now fully imported, but when i finish the first act, it points me to the Green Hill Zone act 2 instead of the Wood Zone act 2.

    But a s you can the level pointer is correct:
    Code:
    lvlord_sega        = $0000
    green_hill_act_1    = $0000
    green_hill_act_2    = $0001
    green_hill_act_3    = $0002
    
    marble_act_1    = $0200
    marble_act_2    = $0201
    marble_act_3    = $0202
    
    spring_yard_act_1    = $0400
    spring_yard_act_2    = $0401
    spring_yard_act_3    = $0402
    
    wood_zone_act_1        = $800
    wood_zone_act_2     = $801
    wood_zone_act_3        = $802
    
    frozen_island_act_1    = $700
    frozen_island_act_2    = $701
    frozen_island_act_3    = $702
    
    labyrinth_act_1        = $0100
    labyrinth_act_2        = $0101
    labyrinth_act_3        = $0102
    scrap_brain_act_3    = $0103
    
    star_light_act_1    = $0300
    star_light_act_2    = $0301
    star_light_act_3    = $0302
    
    scrap_brain_act_1    = $0500
    scrap_brain_act_2    = $0501
    final_zone        = $0502
    And here the level order:

    Code:
    LevelOrder:
            dc.w    green_hill_act_2    ; GHZ1
            dc.w    green_hill_act_3    ; GHZ2
            dc.w    marble_act_1        ; GHZ3
            dc.w    lvlord_sega        ; GHZ4
    
            dc.w    labyrinth_act_2        ; LZ1
            dc.w    labyrinth_act_3        ; LZ2
            dc.w    star_light_act_1    ; LZ3
            dc.w    final_zone        ; LZ4 (SBZ3)
    
            dc.w    marble_act_2        ; MZ1
            dc.w    marble_act_3        ; MZ2
            dc.w    spring_yard_act_1    ; MZ3
            dc.w    lvlord_sega        ; MZ4
    
            dc.w    star_light_act_2    ; SLZ1
            dc.w    star_light_act_3    ; SLZ2
            dc.w    scrap_brain_act_1    ; SLZ3
            dc.w    lvlord_sega        ; SLZ4
    
            dc.w    spring_yard_act_2    ; SYZ1
            dc.w    spring_yard_act_3    ; SYZ2
            dc.w    wood_zone_act_1        ; FIZ1
            dc.w    lvlord_sega        ; SYZ4
    
            dc.w    scrap_brain_act_3    ; SBZ1
            dc.w    lvlord_sega        ; SBZ3 (FZ)
            dc.w    lvlord_sega        ; SBZ3 (FZ)
            dc.w    lvlord_sega        ; SBZ4
    
            dc.w    lvlord_sega    ; $600
            dc.w    lvlord_sega    ; $601
            dc.w    lvlord_sega     ; $602
            dc.w    lvlord_sega        ; FIZ4
    
            dc.w    frozen_island_act_2    ; FIZ2
            dc.w    frozen_island_act_3    ; FIZ3
            dc.w    labyrinth_act_1     ; SBZ3
            dc.w    lvlord_sega        ; FIZ4
            
            dc.w    wood_zone_act_2    ; WZ2
            dc.w    wood_zone_act_3    ; WZ3
            dc.w    frozen_island_act_1     ; SBZ3
            dc.w    lvlord_sega        ; FIZ4
            even
    Please, someone can help? :eek: :eek:
     
  19. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    hint hint, second line of Obj3A_NextLevel
     
    Niko and Ashuro like this.
  20. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Natsumi thank you, I'm really a big jerk :(
    EDIT: ...or not?


    Code:
    Obj3A_NextLevel:            ; XREF: Obj3A_Index
            move.b    ($FFFFFE10).w,d0
            andi.w    #8,d0
            lsl.w    #3,d0
            move.b    ($FFFFFE11).w,d1
            andi.w    #3,d1
            add.w    d1,d1
            add.w    d1,d0
            move.w    LevelOrder(pc,d0.w),d0 ; load level from level order array
            move.w    d0,($FFFFFE10).w ; set level number
            tst.w    d0
            bne.s    Obj3A_ChkSS
            move.b    #0,($FFFFF600).w ; set game mode to level (00)
            bra.s    Obj3A_Display2
    I have trying to change #7,d0 to #8,d0 but still not change anything.
     
    Last edited: Oct 5, 2016