Thread: Research: Let's research the OAM-System
View Single Post
  #1    
Old December 17th, 2010 (11:27 AM). Edited August 5th, 2014 by knizz.
knizz's Avatar
knizz knizz is offline
 
Join Date: Aug 2007
Posts: 192
Structures
Code:
00000000 coords              struc @ (sizeof=0x4)
00000000 x:                  .short
00000002 y:                  .short
00000004 coords              ends

00000000 oam                 struc @ (sizeof=0x8)
00000000 y:                  .byte
00000001 flags1:             .byte
00000002 x:                  .byte
00000003 msb_of_x_and_flags2:.byte
00000004 tile_prio_pal:      .short
00000006 irrelevant:         .short
00000008 oam                 ends

00000000 animation           struc @ (sizeof=0x4)
00000000 frame:              .half @ Internally: 0xFFFD=>animcmd1 0xFFFE=>animcmd2
00000000                           @ 0xFFFF=>animcmd3 any other number (=framenr) =>animcmd4
00000002 duration:           .half
00000004 animation           ends
(read http://www.pokecommunity.com/showthread.php?t=236456 for details)

00000000 object_template     struc @ (sizeof=0x18)
00000000 tiles_tag:          .short
00000002 pal_tag:            .short
00000004 oam:                .long
00000008 image_table:        .long
0000000C gfx_table:          .long
00000010 rotscale_table:     .long
00000014 callback:           .long
00000018 object_template     ends

00000000 object         struc @ (sizeof=0x44)
00000000 final_oam:          oam
00000008 animation_table:    .long
0000000C gfx_table:          .long
00000010 rotscale_table:     .long
00000014 template: .long
00000018 field_18:           .long
0000001C callback:           .long
00000020 pos_1:              coords
00000024 pos_2:              coords
00000028 pos_3_x:            .byte  @ These coordinates are subtracted from actual position!
00000029 pos_3_y:            .byte  @ It is used to center the sprites. So most of the times pos_3_x=width/2 and pos_3_y=height/2
0000002A anim_nr:            .byte
0000002B anim_frame:         .byte
0000002C anim_delay_countdown:      .byte @ six bits acting as countdown. two upper bits can pause image and rotscale-animations
0000002D field_2D:           .byte
0000002E ipos:               coords ?
00000032 ivel:               coords ?            @ It seems like this is the private area
00000032                                         @ for functions managing a single oam.
00000032                                         @ Moving objects use ipos and ivel to save
00000032                                         @ the position and velocity. But they have
00000032                                         @ to be transferred to pos_1 manually. And
00000032                                         @ NPCs use the first byte of ivel to store
00000032                                         @ their current state.
...
00000042 field_42:           .byte
00000043 field_43:           .byte
00000044 object         ends
__________________
Firered IDA 6.5 DB: https://www.dropbox.com/s/hvvmxxoo1dkmdzc/firered.idb
VBA-M with lua scripting support
Reply With Quote