49#ifndef OPENSNES_OBJECT_H
50#define OPENSNES_OBJECT_H
119_Static_assert(
sizeof(
t_objs) == 64,
"t_objs must be 64 bytes");
120_Static_assert(__builtin_offsetof(
t_objs,
xpos) == 16,
"xpos offset mismatch");
121_Static_assert(__builtin_offsetof(
t_objs, ypos) == 19,
"ypos offset mismatch");
122_Static_assert(__builtin_offsetof(
t_objs, xvel) == 34,
"xvel offset mismatch");
123_Static_assert(__builtin_offsetof(
t_objs, yvel) == 36,
"yvel offset mismatch");
124_Static_assert(__builtin_offsetof(
t_objs, action) == 46,
"action offset mismatch");
125_Static_assert(__builtin_offsetof(
t_objs, type) == 4,
"type offset mismatch");
126_Static_assert(__builtin_offsetof(
t_objs, width) == 26,
"width offset mismatch");
127_Static_assert(__builtin_offsetof(
t_objs, height) == 28,
"height offset mismatch");
128_Static_assert(__builtin_offsetof(
t_objs, status) == 48,
"status offset mismatch");
129_Static_assert(__builtin_offsetof(
t_objs, onscreen) == 56,
"onscreen offset mismatch");
signed short s16
16-bit signed integer (-32768 to 32767)
Definition types.h:50
unsigned short u16
16-bit unsigned integer (0 to 65535)
Definition types.h:53
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition types.h:47
#define FAR
Place a global in bank $7E WRAM, outside the 8 KB bank-0 band.
Definition types.h:130
void objKillAll(void)
Kill all active objects.
void objInitFunctions(u8 objtype, ObjInitFn initfct, ObjUpdateFn updfct, ObjUpdateFn reffct)
Register callback functions for an object type.
void(* ObjInitFn)(u16 xp, u16 yp, u16 type, u16 minx, u16 maxx)
Init callback of an object type, called by objLoadObjects() per table entry.
Definition object.h:207
void objKill(u16 objhandle)
Kill an object.
void objCollidMap1D(u16 objindex)
Check object collision with map (no gravity).
void objCollidMap(u16 objindex)
Check object collision with map tiles.
u16 objNew(u8 objtype, u16 x, u16 y)
Create a new object.
void objInitEngine(void)
Initialize the object engine.
u16 objGetCurrentId(void)
Handle of the last object objNew() created.
void objKillCurrent(void)
Kill the object being updated.
u16 objGetPointer(u16 objhandle)
Get pointer to an object from its handle.
void objCollidMapWithSlopes(u16 objindex)
Check object collision with map tiles including slopes.
void objInitFriction1D(u16 friction)
Opt into friction for objCollidMap1D().
void(* ObjUpdateFn)(u16 idx)
Update / refresh callback of an object type; idx is the slot index.
Definition object.h:210
void objLoadObjects(const u8 *sourceO)
Load objects from a data table.
FAR t_objs objWorkspace
Object workspace.
void objInitGravity(u16 objgravity, u16 objfriction)
Set gravity and friction values.
void objUpdateAll(void)
Update all active objects.
void objRefreshAll(void)
Refresh sprites for all on-screen objects.
u16 objCollidObj(u16 idx1, u16 idx2)
Test collision between two objects.
void objUpdateXY(u16 objindex)
Update object position from velocity.
static const s16 xpos[4]
ROM source for the 16x16 sprite sheet tile data.
Definition main.c:53
Game object data structure.
Definition object.h:77
u8 type
Definition object.h:80
u16 parentID
Definition object.h:107
u16 sprframe
Definition object.h:87
u8 sprflip
Definition object.h:85
u8 onscreen
Definition object.h:110
u8 tempo
Definition object.h:104
u8 sprrefresh
Definition object.h:109
s16 xvel
Definition object.h:96
u16 height
Definition object.h:93
s16 yvel
Definition object.h:97
u16 width
Definition object.h:92
u16 sprblk3216
Definition object.h:84
u16 tilebprop
Definition object.h:101
u16 yofs
Definition object.h:91
u8 hitpoints
Definition object.h:108
u16 tilesprop
Definition object.h:100
u8 nID
Definition object.h:81
u8 count
Definition object.h:105
u16 prev
Definition object.h:78
u8 status
Definition object.h:103
u8 xpos[3]
Definition object.h:88
u8 sprpal
Definition object.h:86
u16 sprid3216
Definition object.h:83
u16 xmax
Definition object.h:95
u16 xofs
Definition object.h:90
u8 dir
Definition object.h:106
u16 tileabove
Definition object.h:99
u16 sprnum
Definition object.h:82
u8 objnotused[7]
Definition object.h:111
u16 tilestand
Definition object.h:98
u8 ypos[3]
Definition object.h:89
u16 action
Definition object.h:102
u16 next
Definition object.h:79
u16 xmin
Definition object.h:94