mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
Lose the packed attribute on / rearrange some game struct types.
actors.h: remove 'packed' from projectile_t, tiledata_t. In tiledata_t, make .cacherange member an int32_t so that the following member "projectile_t defproj" is aligned on a 4-byte boundary. player.h: remove 'packed' from playerspawn_t, DukeStatus_t, input_t. In Lunatic, correct packing attribute of the base type of the unrestricted actor_t and DukePlayer_t pointer types (the declaration was used without Bump BYTEVERSION. git-svn-id: https://svn.eduke32.com/eduke32@3458 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b5aa49953e
commit
728ae2bb76
4 changed files with 29 additions and 32 deletions
|
@ -71,7 +71,6 @@ enum uactortypes_t {
|
|||
enemystayput
|
||||
};
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
#ifdef LUNATIC
|
||||
struct action {
|
||||
|
@ -83,8 +82,10 @@ struct move {
|
|||
int16_t hvel, vvel;
|
||||
};
|
||||
|
||||
#pragma pack(push,1)
|
||||
typedef struct { int32_t id; struct move mv; } con_move_t;
|
||||
typedef struct { int32_t id; struct action ac; } con_action_t;
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
|
@ -102,6 +103,7 @@ typedef struct {
|
|||
int8_t filler[6]; // 6b
|
||||
} projectile_t;
|
||||
|
||||
#pragma pack(push,1)
|
||||
// (+ 40 16 16 4 8 6 8 6 4 20)
|
||||
typedef struct {
|
||||
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
|
||||
|
@ -175,6 +177,7 @@ typedef struct {
|
|||
int16_t netIndex;
|
||||
|
||||
} netactor_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct {
|
||||
#if !defined LUNATIC
|
||||
|
@ -183,13 +186,12 @@ typedef struct {
|
|||
#endif
|
||||
uint32_t flags; // formerly SpriteFlags, ActorType
|
||||
|
||||
int16_t cacherange; // formerly SpriteCache
|
||||
int32_t cacherange; // formerly SpriteCache
|
||||
|
||||
// todo: make this a pointer and allocate at runtime
|
||||
projectile_t defproj;
|
||||
} tiledata_t;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
// KEEPINSYNC lunatic/con_lang.lua
|
||||
enum sflags_t {
|
||||
|
|
|
@ -57,7 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define VOLUMEONE (g_Shareware == 1)
|
||||
|
||||
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
|
||||
#define BYTEVERSION_JF 270
|
||||
#define BYTEVERSION_JF 273
|
||||
|
||||
#define BYTEVERSION_13 27
|
||||
#define BYTEVERSION_14 116
|
||||
|
|
|
@ -128,7 +128,7 @@ typedef struct {
|
|||
-- to make more 'const'), but still has array members exposed, so is unsuited
|
||||
-- for external exposure.
|
||||
local ACTOR_STRUCT = [[
|
||||
{
|
||||
__attribute__((packed)) struct {
|
||||
const int32_t t_data[10]; // 56b sometimes used to hold offsets to con code
|
||||
const struct move mv;
|
||||
const struct action ac;
|
||||
|
@ -165,7 +165,7 @@ bcarray.new("int16_t", ffiC.MAX_WEAPONS, "weapon", "int16_x_MAX_WEAPONS")
|
|||
bcarray.new("int16_t", ffiC.GET_MAX, "inventory", "int16_x_GET_MAX")
|
||||
|
||||
local DUKEPLAYER_STRUCT = [[
|
||||
{
|
||||
__attribute__((packed)) struct {
|
||||
vec3_t pos, opos, vel, npos;
|
||||
int32_t bobposx, bobposy;
|
||||
int32_t truefz, truecz, player_par;
|
||||
|
@ -291,17 +291,8 @@ end
|
|||
local con_lang = require("con_lang")
|
||||
|
||||
ffi.cdef([[
|
||||
#pragma pack(push, 1)
|
||||
typedef struct
|
||||
]].. mangle_arrays(ACTOR_STRUCT) ..[[
|
||||
actor_t;
|
||||
|
||||
typedef struct { int32_t _p; } weaponaccess_t;
|
||||
|
||||
typedef struct
|
||||
]].. mangle_arrays(DUKEPLAYER_STRUCT) ..[[
|
||||
DukePlayer_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t bits; // 4b
|
||||
int16_t fvel, svel; // 4b
|
||||
|
@ -309,6 +300,15 @@ typedef struct {
|
|||
int8_t extbits, filler; // 2b
|
||||
} input_t;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
typedef
|
||||
]].. mangle_arrays(ACTOR_STRUCT) ..[[
|
||||
actor_t;
|
||||
|
||||
typedef
|
||||
]].. mangle_arrays(DUKEPLAYER_STRUCT) ..[[
|
||||
DukePlayer_t;
|
||||
|
||||
typedef struct {
|
||||
DukePlayer_t *ps;
|
||||
input_t *sync;
|
||||
|
@ -322,6 +322,7 @@ typedef struct {
|
|||
char user_name[32];
|
||||
uint32_t revision;
|
||||
} playerdata_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct {
|
||||
int32_t cur, count;
|
||||
|
@ -347,12 +348,9 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
uint32_t flags;
|
||||
|
||||
int16_t cacherange;
|
||||
|
||||
int32_t cacherange;
|
||||
projectile_t defproj;
|
||||
} tiledata_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct {
|
||||
vec3_t pos;
|
||||
|
@ -361,7 +359,6 @@ typedef struct {
|
|||
int16_t sect;
|
||||
} camera_t;
|
||||
|
||||
// NOTE: not packed!
|
||||
typedef struct {
|
||||
]] .. table.concat(con_lang.wdata_members, ';')..';' .. [[
|
||||
} weapondata_t;
|
||||
|
@ -617,8 +614,8 @@ local function check_literal_am(am, typename)
|
|||
end
|
||||
|
||||
-- An unrestricted actor_t pointer, for internal use:
|
||||
local actor_ptr_ct = ffi.typeof("$ *", ffi.typeof("struct"..strip_const(ACTOR_STRUCT)))
|
||||
local player_ptr_ct = ffi.typeof("$ *", ffi.typeof("struct"..strip_const(DUKEPLAYER_STRUCT)))
|
||||
local actor_ptr_ct = ffi.typeof("$ *", ffi.typeof(strip_const(ACTOR_STRUCT)))
|
||||
local player_ptr_ct = ffi.typeof("$ *", ffi.typeof(strip_const(DUKEPLAYER_STRUCT)))
|
||||
local con_action_ct = ffi.typeof("con_action_t")
|
||||
local con_move_ct = ffi.typeof("con_move_t")
|
||||
local con_ai_ct = ffi.typeof("con_ai_t")
|
||||
|
|
|
@ -135,7 +135,6 @@ enum playeraction_t {
|
|||
pfacing = 0x00010000
|
||||
};
|
||||
|
||||
#pragma pack(push,1)
|
||||
typedef struct {
|
||||
int32_t ox,oy,oz;
|
||||
int16_t oa,os;
|
||||
|
@ -149,6 +148,14 @@ typedef struct {
|
|||
char inven_icon, jetpack_on, heat_on;
|
||||
} DukeStatus_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t bits; // 4b
|
||||
int16_t fvel, svel; // 4b
|
||||
int8_t avel, horz; // 2b
|
||||
int8_t extbits, filler; // 2b
|
||||
} input_t;
|
||||
|
||||
#pragma pack(push,1)
|
||||
// XXX: r1625 changed a lot types here, among others
|
||||
// * int32_t --> int16_t
|
||||
// * int16_t --> int8_t
|
||||
|
@ -231,13 +238,6 @@ typedef struct {
|
|||
int8_t padding_;
|
||||
} DukePlayer_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t bits; // 4b
|
||||
int16_t fvel, svel; // 4b
|
||||
int8_t avel, horz; // 2b
|
||||
int8_t extbits, filler; // 2b
|
||||
} input_t;
|
||||
|
||||
// KEEPINSYNC lunatic/defs.ilua
|
||||
typedef struct {
|
||||
DukePlayer_t *ps;
|
||||
|
@ -316,11 +316,9 @@ typedef struct {
|
|||
int32_t shade;
|
||||
} hudweapon_t;
|
||||
|
||||
#pragma pack(push,1)
|
||||
extern input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
|
||||
extern playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
|
||||
extern playerdata_t g_player[MAXPLAYERS];
|
||||
#pragma pack(pop)
|
||||
//extern char dashow2dsector[(MAXSECTORS+7)>>3];
|
||||
//extern int16_t searchsect[MAXSECTORS],searchparent[MAXSECTORS];
|
||||
extern int16_t WeaponPickupSprites[MAX_WEAPONS];
|
||||
|
|
Loading…
Reference in a new issue