ASM to Sega Genesis Platform

Would you like to react to this message? Create an account in a few clicks or log in to continue.
ASM to Sega Genesis Platform

All about assembly programming in the Sega Genesis console.


3 posters

    Tutorial: How to animate the FG!

    avatar
    Trox


    Mensagens : 72
    Data de inscrição : 2011-07-20
    Current Project : Season Two

    Tutorial: How to animate the FG! Empty Tutorial: How to animate the FG!

    Post  Trox Sat Jul 23, 2011 10:39 am

    Copy/Paste from RetroHack

    Hi guys. I have seen many hacks trying to create entirely new levels, but these are...
    not too much detailed I think, because have not palcycles, deform, animation, and other things
    For that, and because Selbi is creating a tool for deform the BG, I'm creating this guide

    Note: It's just a basic guide, that explains how to animate the FG, by timming. For the rest,
    you must learn by yourself.


    Ok, I want add these mushroms, to my FG in my hack,

    Tutorial: How to animate the FG! 1_y_310

    (You can download these images [url="http://www.mediafire.com/?mj14ciy3xo7qxlp"]here[/url])
    (also, note that the image size must be a multiple of 8, like 8x16, 16x32, 16x16)

    Into this:

    Tutorial: How to animate the FG! Dibujo10


    So, how to add this? I'll explain here
    First, we'll try to add the first frame. So, go to SonMapEd; before anything, unload all other loaded things, go to Settings > Tile Rendering >
    and set the line that will be used.
    Now, go to File > Load Data File > Load Seccondary palette lines, and select the zone's palette. You will get this:

    Tutorial: How to animate the FG! Dibujo11

    We're going to add the first frame. Go to File > Load From Image > Import Sprite Sheet, and then select the first
    mushroom frame. Load, and save that uncompressed as Mush1.bin in ArtUnc.

    Now, we need create the image's maps, into the level. Maybe like this

    Tutorial: How to animate the FG! Dibujo12

    To do that, open the level with sonmaped, and insert 4 tiles in the start of the tileset (CTRL + I, in the first one), and write the numbers
    1234 in these 4 first tiles. Now, to the block. Go to the block selector and do other more (CTRL + I, in the first one), and map it, depending
    of the tiles position added in sonmaped (don't forget the pal line). In this case, may be this:

    Tutorial: How to animate the FG! Dibujo13

    Now, just add that block in some chunk.

    Save, build and test, you just will see numbers, instead of mushrooms. We need do the Animation script. So, open your
    main ASM file, and go to Aniart_Load. It's the subrutine that loads the FG animations. We'll create the animation script
    here. So, go to Aniart_GHZ.
    The uncompressed art is hard to load, so, before work with that, we can install this subroutine, somewhere (Thanks GF64)

    Code:

    ; ---------------------------------------------------------------------------
    ; Subroutine to load uncompressed art
    ; ---------------------------------------------------------------------------

    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||


    LoadUncArt:
            lea    ($C00000), a1        ;Mover VDP Control a "a1"

    LoadArt_Loop:
            move.l    (a2)+, (a1)        ;$xxxxxxxx    <- linea a procesar
            move.l    (a2)+, (a1)
            move.l    (a2)+, (a1)
            move.l    (a2)+, (a1)
            move.l    (a2)+, (a1)
            move.l    (a2)+, (a1)
            move.l    (a2)+, (a1)
            move.l    (a2)+, (a1)
            dbf    d0, LoadArt_Loop    ;Repetir los pasos del d0
            rts

    ;===============================================================================
    =====

    So, in aniart_ghz, we want that routine loads the mushrooms art.
    after the label, add this
    Code:
            jsr    AniArt_GHZ_Mushrooms

    Ok, now we need to calculate the VRAM position. Well, I think that a macro used
    for the public S1 Hacking Studio will help here.

    Install this macro too, somewhere
    Code:
    vram    macro
        if (narg=1)
            move.l    #($40000000+((\1&$3FFF)<<16)+((\1&$C000)>>14)),($C00004).l
        else
            move.l    #($40000000+((\1&$3FFF)<<16)+((\1&$C000)>>14)),\2
        endc
        endm

    Do you remember that we added the 4 tiles in the first possible locations? So, the VRAM
    location to be used is $20.
    So before the label Aniart_GHZ, put this
    Code:
    Aniart_GHZ_Mushrooms:
            vram    $20
    To make the art be loaded in the LoadUncArt subroutine, add this after that:

    Code:
            lea    (UncMush1),a2

    Now, the subroutine needs the file size (hex) / 2. On this animation, the total is $3

    Code:
            move.w    #3,d0

    This is now ok, so call the LoadUncArt subroutine, and return.
    Code:
            jsr    LoadUncArt
            rts

    And now, we just need to add the tiles's file
    Code:
    UncMush1:
            incbin    'artunc\mush1.bin'

    Save, build and test... You will se how the first frame is loaded correctly.

    Tutorial: How to animate the FG! Dibujo14

    Now, we need the other ones. Repeat the SonMapEd's steps to add the other images as Mush2.bin and Mush3.bin into Artunc (include them too), and go to Aniart_GHZ_Mushrooms
    Replace that with this, and your animation will be done.

    Code:
    Aniart_GHZ_Mushrooms:
            vram    $20            ;VRAM Location
            lea    (Uncflows1),a2        ;Tiles
            move.w    #3,d0            ;Size
            jsr    LoadUncArt        ;Process that
            cmpi.b    #$10,($FFFFFFB3).w    ;Timer 1 elapsed?
            bcs    AniArt_AHZ_Return    ;If not, branch
            vram    $20            ;VRAM Location
            lea    (Uncflows2),a2        ;Tiles
            move.w    #3,d0            ;Size
            jsr    LoadUncArt        ;Process that
            cmpi.b    #$10,($FFFFFFB4).w    ;Timer 2 elapsed?
            bcs    AniArt_AHZ_Return_2    ;If not, branch
            vram    $20            ;VRAM Location
            lea    (Uncflows1),a2        ;Tiles
            move.w    #3,d0            ;Size
            jsr    LoadUncArt        ;Process that
            cmpi.b    #$10,($FFFFFFB5).w    ;Timer 3 elapsed?
            bcs    AniArt_AHZ_Return_3    ;If not, branch
            vram    $20            ;VRAM Location
            lea    (Uncflows3),a2        ;Tiles
            move.w    #3,d0            ;Size
            jsr    LoadUncArt        ;Process that
            cmpi.b    #$10,($FFFFFFB6).w    ;Timer 4 elapsed?
            bcs    AniArt_AHZ_Return_4    ;If not, branch
            clr.b    ($FFFFFFB3).w        ;Clear Timer 1
            clr.w    ($FFFFFFB4).w        ;Clear Timer 2 and 3
            clr.b    ($FFFFFFB6).w        ;Clear Timer 4
            rts

    AniArt_AHZ_Return:   
            add.b    #1,($FFFFFFB3).w    ;Add to Timer 1
            rts                ;Return

    AniArt_AHZ_Return_2:   
            add.b    #1,($FFFFFFB4).w    ;Add to Timer 2
            rts                ;Return

    AniArt_AHZ_Return_3:   
            add.b    #1,($FFFFFFB5).w    ;Add to Timer 3
            rts                ;Return

    AniArt_AHZ_Return_4:   
            add.b    #1,($FFFFFFB6).w    ;Add to Timer 4
            rts                ;Return

    That's all. Enjoy!!

    EDIT: For who didn't understand the thing with VRAM correctly:
    You need take a slot. For example, $2. $2 * $20 = $40. Other Example, $3A0. $3A0 * $20 = $7400.
    Is *$20.
    And, for see possible slots, I recommend GensKMod
    SonicVaan
    SonicVaan


    Mensagens : 100511
    Data de inscrição : 2013-07-25
    Localização : ASMTSG
    Current Project : BEING THE KING OF THE FORUM

    Tutorial: How to animate the FG! Empty Re: Tutorial: How to animate the FG!

    Post  SonicVaan Thu Dec 26, 2013 5:40 am

    Probably the most useful tutorial here. Kudos, Trox!
    Jdpense
    Jdpense


    Mensagens : 100567
    Data de inscrição : 2014-08-21

    Tutorial: How to animate the FG! Empty Re: Tutorial: How to animate the FG!

    Post  Jdpense Thu Dec 27, 2018 4:21 pm

    Just an annual year bump! Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy bounce bounce bounce bounce bounce affraid Basketball cheers bom drunken Basketball cheers bom drunken cherry sunny Sleep

    Sponsored content


    Tutorial: How to animate the FG! Empty Re: Tutorial: How to animate the FG!

    Post  Sponsored content


      Current date/time is Sat Dec 07, 2024 7:13 pm