[Pokémon Feurrote Edition] Eingebaute OAM-Funktionen (GBA-Sprites)

  • That is a good point though. The problem is, that - once an animation is setup - the enigne must create an enviroment for the animation. The built-in animation engine only creates this animation start, when a certain flag is enabled. I will do some reserach and tell you what to do.

  • Wouldn't you just have to change the flag also in the template, if the game resets it it has to take the initial value somewhere...


    ~Sturmvogel


    I don't quite know what you mean :huh:

    That is a good point though. The problem is, that - once an animation is setup - the enigne must create an enviroment for the animation. The built-in animation engine only creates this animation start, when a certain flag is enabled. I will do some reserach and tell you what to do.


    Thx for your help, I will wait for your information. I'm currently decreasing its priority to BG so that it will be invisible (what an ugly way:()
    Another thing is:
    If I create several OBJs at the same coordinate, will the one created at last have the highest priority?

  • Err... i did not find a very convenient method to enable an OAM and then apply a rotscale to it. I think the engine was not desinged for that concept. What you could do is (however that way is also really ugly), once you spawned the oam, manually disable rotscale (the animation will not be proceded then) and enable the disable_flag (by directly acessing the 8-byte structure representing the final_oam in the oam_structure).


    Regarding your ohter question - i guess the last created oam will be displayed last, but i am not sure. However in fact there are two spawn_oam functions - one for forward search (seraching the buffers for a free one starting from buffer_id 0x0 and one for backward serach (searching the buffers for a free one starting from buffer_id 0x3F). They both take the same parameters. The offset for forward_serach is the one i posted in the original post. The offset for backward_search (again it is for a german ROM) is: 0x6F60. Just test what oam is displayed last and use the other method if you are not happy with the layers.

  • Err... i did not find a very convenient method to enable an OAM and then apply a rotscale to it. I think the engine was not desinged for that concept. What you could do is (however that way is also really ugly), once you spawned the oam, manually disable rotscale (the animation will not be proceded then) and enable the disable_flag (by directly acessing the 8-byte structure representing the final_oam in the oam_structure).


    OK, I see.

    Regarding your other question - i guess the last created oam will be displayed last, but i am not sure. However in fact there are two spawn_oam functions - one for forward search (seraching the buffers for a free one starting from buffer_id 0x0 and one for backward serach (searching the buffers for a free one starting from buffer_id 0x3F). They both take the same parameters. The offset for forward_serach is the one i posted in the original post. The offset for backward_search (again it is for a german ROM) is: 0x6F60. Just test what oam is displayed last and use the other method if you are not happy with the layers.


    I believe that the English offset for this function is 0x8006FE0, thank you for your help!

  • OAM


    I've sent a private message to you but you don't reply, so I decide to ask here.
    I now know how to allocate VRAM spaces for a specific tiles tag and PalRAM space for a specific pal tag. However, I still have 2 questions about the OBJs:


    1)How to launch an animation using GFX table? As we don't use tags for it, should we manually copy the bitmap of the into VRAM? Or the game engine will do it automatically based on the GFX table and animation table? (I know you may have explained it in your documentation, but I really can't read some parts of it as it's in German and the google translate is always not working well)


    2)Suppose I don't use a GFX table(set it to NULL: 00 00 00 00), and I use a tiles tag and a pal tag in my obj template and I've call the function inside the "cmdx05_oam_vram_load" and " cmdx0F_load_obj_pal". (which means I've successfully allocated the VRAM and PalRAM for the tiles and palette, and the tiles and pal are copied to VRAM and pal buffer by those functions as well)
    Then I want to use the animation table. However, the location of the allocated VRAM offset of the tiles is returned by the function to allocate the tiles, so I can't get it into a predefined obj template, which means that I don't know the "char_names" used in the animation table. So how should I handle the animation table in the template?


    Thank you if you can spare your time answering the 2 questions!

  • An GFX animation is launched imideatly after oam spawning just as rotscale animation.


    The displacements of the animation are relative to the base offset of the oam, so you do not have to worry about defining the absolute offset. Just define how much frame xxx is displaced from the entire offset of the graphic.

  • An GFX animation is launched imideatly after oam spawning just as rotscale animation.


    OK!

    Zitat

    The displacements of the animation are relative to the base offset of the oam, so you do not have to worry about defining the absolute offset. Just define how much frame xxx is displaced from the entire offset of the graphic.


    Hmmm... Are you speaking of the base char name in OAM Attribute 2?
    Well, let's take an example:
    I define the tiles tag in the obj template, and then I make the game allocate some OBJ VRAM space for it. To make things simpler, assume that the allocated offset is 0x6000800 and the function has decompressed the graphic there. Then what should my animation script be if I want to use the picture as the animation script is predefined in the template? Or is it just the frame 00 00?
    Solved

  • Ist es möglich, dass man zwei Sprite haben kann, deren Grafikpointer (VRAM) die gleichen sind?
    Ich habe zwei Sprites, deren Grafik bei 0x06010000 liegt. Der erste Sprite nutzt 0x06010000, der zweite Sprite nutzt aber 0x6010800, die Engine hat hier einfach 0x800 dazuaddiert. Beide Sprites haben die Maße 64x64 px.


    Sprite 1


    Template

    Code
    1. FF FF FF FF 20 1E FF 08 FF FF FF FF 28 1E FF 08 A8 C6 2E 08 29 74 00 08


    GFX-Struktur

    Code
    1. 00 01 00 C0 00 00 00 00 00 00 01 06 00 08 01 00


    Sprite 2


    Template

    Code
    1. FF FF FF FF 50 1E FF 08 FF FF FF FF 58 1E FF 08 A8 C6 2E 08 29 74 00 08


    GFX-Strukur

    Code
    1. 00 01 00 C0 00 00 00 00 00 00 01 06 00 08 02 00
  • Das ist möglich, man kann es so coden, aber was soll das bringen? Wenn du eine GFX Animation des Typs nutzt, die alle Frames im voraus im VRAM haben will, dann macht es keinen Sinn, über die Grenzen dieser Teilgrafiken hinauszuiterieren. Wenn du eine GFX Animation des Typs nutzt, welche die Frames per CPUSet ins VRAM kopiert, kannst du jedoch nicht aus deinem reservierten Platz raus. Die Engine alloziert auch niemals schon besetzten VRAM.

  • Wie wäre es, wenn beide Sprites den gleichen GFX-Tag nutzen? Dann musst du, bevor die OAMs initialisierst, die GFX-Resource ins VRAM laden (über die entsprechende Routine). Die spawn-OAM Routine sucht sich dann das passende VRAM Offset für die beiden OAMs und passt das an.

  • Die Grafik wird bereits in den VRAM geladen. Die Frage ist jetzt, wie dann das Template aussehen muss. Bei der Grafik-Struktur soll ich doch einen Pointer zu Grafik angeben, jetzt schreibst du aber, dass die Engine sich den Platz sucht. Was kommt also beim Grafik-Pointer in der GFX Struktur hin?


    Bisher habe ich das so verstanden: Im Template gibt es den Pointer der GFX-Tabelle. In dieser Tabelle gibt es Pointer, die zu den GFX-Strukturen führen. Habe ich ein statisches Bild, habe ich nur einen Eintrag in der GFX-Tabelle.
    Pointer GFX Table -> GFX Table: [Pointer GFX Struktur 1] [Pointer GFX Struktur 2] etc. -> GFX Struktur 1: [GFX Pointer] [Größe] [Tag]


    Beim GFX Pointer darf / soll man keinen VRAM-Pointer angeben? Welche Funktion hat der GFX-Tag? Wie nutzt man den Pal-Tag, was sind dabei die Vor- und Nachteile? Bisher habe ich die Palette in der OBJ Struktur festgelegt. Über den Pal-Tag konnte ich nichts herausfinden.


    Ich würde den Part mit der GFX Tabelle un den GFX Strukturen noch ausarbeiten, ein farbiges Schema würde bestimmt auch helfen, ich kann zumindestens nicht zu 100% nachvollziehen, wie es nun gemeint ist. Auch hilft es, sich auf einen Begriff zu einigen, also GFX Struktur vs. GFX Element.
    Ein paar Template-Beispiel würde sicher auch helfen.

  • Name Länge (in Bytes) Beschreibung
    y 2 y-Koordinate des OAMs (in Pixel)
    xm 2 Verschiebung des OAMs in X-Richtung (in Pixel)
    ym 2 Verschiebung des OAMs in Y-Richtung (in Pixel)


    Hi, I've occasionally found that this struct is wrong. The size of the obj is 0x44 bytes, but yours should be 0x42.
    There're 2 bytes after xm & ym, which is called pos_neg_center in knizz's idb. (1 byte for x and 1 byte for y)