#ifndef IMGREFS_H #define IMGREFS_H #include typedef struct _imgref_struct imgref_struct; #define IMGREF(p) ((imgref_struct *)(p)) typedef struct _imgref_light_struct imgref_light_struct; #define IMGREF_LIGHT(p) ((imgref_light_struct *)(p)) /* * Maximum ImgRefs: */ #define IMGREF_MAX_IMGREFS 100000 /* * Maximum frames per ImgRef: */ #define IMGREF_MAX_FRAMES 16 /* * Options: */ #define IMGREF_HAS_TRANSPARENCY (1 << 2) #define IMGREF_NO_IMAGE (1 << 3) #define IMGREF_STAY_LOADED (1 << 4) /* * Standard ImgRefs: */ #define IMGREF_DEFAULT_IMGREF 0 #define IMGREF_FIRE_30 5 #define IMGREF_FIRE_60 6 #define IMGREF_FIRE_90 7 #define IMGREF_STREAMWEAPON_YELLOW 10 #define IMGREF_STREAMWEAPON_GREEN 11 #define IMGREF_STREAMWEAPON_PURPLE 12 #define IMGREF_STREAMWEAPON_ORANGE 13 #define IMGREF_EXPLOSION_SMALL 20 #define IMGREF_EXPLOSION_MEDIUM 21 #define IMGREF_EXPLOSION_LARGE 22 #define IMGREF_SMOKE_30 25 #define IMGREF_SMOKE_60 26 #define IMGREF_SMOKE_90 27 /* * Image Formats: */ #define IMGREF_IMGFMT_UNKNOWN 0 #define IMGREF_IMGFMT_TGA 1 /* * Load Progresses: */ #define IMGREF_LOAD_PROGRESS_DONE 0 #define IMGREF_LOAD_PROGRESS_LOADING 1 /* * Merge modes: * * Determines the mathimatical operation applied to the * imgref being blitted on to the buffer. */ #define IMGREF_MERGE_NORMAL 0 #define IMGREF_MERGE_ADDITIVE 1 #define IMGREF_MERGE_SUBTRACTIVE 2 #define IMGREF_MERGE_MIRAGE 3 #define IMGREF_MERGE_MULTIPLY 4 /* * Frame Determinat: * * Determines how to determine which frame of an ImgRef to & display. */ #define IMGREF_FRAME_DETERMINE_BY_HEADING 0 #define IMGREF_FRAME_DETERMINE_BY_ANIMATION 1 /* * Layer Placement: * * These are codes for determining the value for the member * layer_placement of the imgref_struct. * * When an imgref's layer_placement is set to any of the * background codes then it will be visible as long as * the 'viewport' is within it's size. */ #define IMGREF_LAYER_FG 0 /* Normal object in foreground */ #define IMGREF_LAYER_BG_TILED 1 #define IMGREF_LAYER_BG_STATIC 2 /* * Special Effects: */ #define IMGREF_EFFECTS_STARGLOW (1 << 1) #define IMGREF_EFFECTS_FADEINGLOW (1 << 2) #define IMGREF_EFFECTS_FADEOUTGLOW (1 << 3) /* * Point Light: * * Used for drawing vector, hazard, and strobe lights. * * Point lights should be drawn after the image is blitted. * * The angle theta is relative to the object's north, not * the galactic core north. */ struct _imgref_light_struct { /* Relative position */ float theta; /* Bearing relative to object */ float radius; /* In pixels */ /* Color 0x00 to 0xff */ u_int8_t a, r, g, b; /* Strobe intervals, set all to 0 for no strobing */ char strobe_state; /* True = on, False = off */ time_t strobe_off_int, /* In milliseconds */ strobe_on_int, /* In milliseconds */ strobe_next; /* In milliseconds */ }; /* * ImgRef: */ struct _imgref_struct { unsigned int options; char *path; /* Path to the image file */ int load_progress; /* One of IMGREF_LOAD_PROGRESS_* */ int merge_mode; /* One of IMGREF_MERGE_* */ int frame_determinant; /* One of IMGREF_FDETERMINE_* */ int layer_placement; /* One of IMGREF_LAYER_* */ unsigned int effects; /* Special effects */ float magnification; /* Magnification, must be 1 or greater */ /* Size and frame attributes */ int total_frames; unsigned int width, /* Total width and height */ height; unsigned int fwidth, /* Frame width and height */ fheight; int img_fmt; /* One of IMGREF_IMGFMT_* */ /* Allocated structure containing image library data * * The pointer type is determined by img_fmt. * This must be freed after calling library structure destroy * routine (as only it's substructures are deallocated by * library routine). */ void *lib_data; /* Pointer to image data in lib_data, do not delete this, the * call to the image library function will delete this */ u_int8_t *image_data; char *name, *description; /* Lights */ imgref_light_struct **light; int nlights; }; #endif /* IMGREFS_H */