mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: sprite: migrate header to stdint.h, remove usage of enums in data structs for portability, add static sizeof checks
This commit is contained in:
parent
858597832d
commit
0bff62e696
@ -16,6 +16,10 @@
|
|||||||
#ifndef SPRITE_H
|
#ifndef SPRITE_H
|
||||||
#define SPRITE_H
|
#define SPRITE_H
|
||||||
|
|
||||||
|
#include "build.h"
|
||||||
|
#include STDINT_H
|
||||||
|
#include "synctype.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
@ -31,16 +35,6 @@ SPRITE MODELS
|
|||||||
#define SPRITE_VERSION_HL 2 // Half-Life sprites
|
#define SPRITE_VERSION_HL 2 // Half-Life sprites
|
||||||
#define SPRITE_VERSION_32 32 // Captain Obvious mode on
|
#define SPRITE_VERSION_32 32 // Captain Obvious mode on
|
||||||
|
|
||||||
// must match definition in alias.h
|
|
||||||
#ifndef SYNCTYPE_T
|
|
||||||
#define SYNCTYPE_T
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
ST_SYNC = 0,
|
|
||||||
ST_RAND
|
|
||||||
} synctype_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
FRAME_SINGLE = 0,
|
FRAME_SINGLE = 0,
|
||||||
@ -74,55 +68,69 @@ typedef enum
|
|||||||
// generic helper
|
// generic helper
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int ident; // LittleLong 'ISPR'
|
int32_t ident; // LittleLong 'ISPR'
|
||||||
int version; // current version 2
|
int32_t version; // current version 2
|
||||||
} dsprite_t;
|
} dsprite_t;
|
||||||
|
|
||||||
|
STATIC_ASSERT( sizeof( dsprite_t ) == 8, "invalid dsprite_t size" );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int ident; // LittleLong 'ISPR'
|
int32_t ident; // LittleLong 'ISPR'
|
||||||
int version; // current version 2
|
int32_t version; // current version 2
|
||||||
int type; // camera align
|
int32_t type; // camera align
|
||||||
float boundingradius; // quick face culling
|
float boundingradius; // quick face culling
|
||||||
int bounds[2]; // mins\maxs
|
int32_t bounds[2]; // mins\maxs
|
||||||
int numframes; // including groups
|
int32_t numframes; // including groups
|
||||||
float beamlength; // ???
|
float beamlength; // ???
|
||||||
synctype_t synctype; // animation synctype
|
uint32_t synctype; // animation synctype, was synctype_t
|
||||||
} dsprite_q1_t;
|
} dsprite_q1_t;
|
||||||
|
|
||||||
|
STATIC_ASSERT( sizeof( dsprite_q1_t ) == 36, "invalid dsprite_q1_t size" );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int ident; // LittleLong 'ISPR'
|
int32_t ident; // LittleLong 'ISPR'
|
||||||
int version; // current version 2
|
int32_t version; // current version 2
|
||||||
angletype_t type; // camera align
|
uint32_t type; // camera align, was angletype_t
|
||||||
drawtype_t texFormat; // rendering mode
|
uint32_t texFormat; // rendering mode, was drawtype_t
|
||||||
int boundingradius; // quick face culling
|
int32_t boundingradius; // quick face culling
|
||||||
int bounds[2]; // mins\maxs
|
int32_t bounds[2]; // mins\maxs
|
||||||
int numframes; // including groups
|
int32_t numframes; // including groups
|
||||||
facetype_t facetype; // cullface (Xash3D ext)
|
uint32_t facetype; // cullface (Xash3D ext), was facetype_t
|
||||||
synctype_t synctype; // animation synctype
|
uint32_t synctype; // animation synctype, was synctype_t
|
||||||
} dsprite_hl_t;
|
} dsprite_hl_t;
|
||||||
|
|
||||||
typedef struct
|
STATIC_ASSERT( sizeof( dsprite_hl_t ) == 40, "invalid dsprite_hl_t size" );
|
||||||
{
|
|
||||||
int origin[2];
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
} dspriteframe_t;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int numframes;
|
int32_t origin[2];
|
||||||
|
int32_t width;
|
||||||
|
int32_t height;
|
||||||
|
} dspriteframe_t;
|
||||||
|
|
||||||
|
STATIC_ASSERT( sizeof( dspriteframe_t ) == 16, "invalid dspriteframe_t size" );
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int32_t numframes;
|
||||||
} dspritegroup_t;
|
} dspritegroup_t;
|
||||||
|
|
||||||
|
STATIC_ASSERT( sizeof( dspritegroup_t ) == 4, "invalid dspritegroup_t size" );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
float interval;
|
float interval;
|
||||||
} dspriteinterval_t;
|
} dspriteinterval_t;
|
||||||
|
|
||||||
|
STATIC_ASSERT( sizeof( dspriteinterval_t ) == 4, "invalid dspriteinterval_t size" );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
frametype_t type;
|
uint32_t type; // was frametype_t
|
||||||
} dframetype_t;
|
} dframetype_t;
|
||||||
|
|
||||||
|
STATIC_ASSERT( sizeof( dframetype_t ) == 4, "invalid dframetype_t size" );
|
||||||
|
|
||||||
#endif//SPRITE_H
|
#endif//SPRITE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user