From 5683beec3df9b3835d3adab9c777871264563d71 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 18 Apr 2015 21:59:21 +0000 Subject: [PATCH] Do "typedef projectile_t defaultprojectile_t;" instead of having an indetical-member type. Move projectile_t to player.h. git-svn-id: https://svn.eduke32.com/eduke32@5159 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.h | 16 ---------------- polymer/eduke32/source/gamedef.c | 22 +++++++++++++++++----- polymer/eduke32/source/gamedef.h | 18 ++---------------- polymer/eduke32/source/global.h | 1 + polymer/eduke32/source/player.c | 2 +- polymer/eduke32/source/player.h | 16 ++++++++++++++++ 6 files changed, 37 insertions(+), 38 deletions(-) diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index eac0b093f..974e26289 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -111,22 +111,6 @@ typedef struct { int32_t id; struct action ac; } con_action_t; #pragma pack(pop) #endif -typedef struct { - int32_t workslike, cstat; // 8b - int32_t hitradius, range, flashcolor; // 12b - int16_t spawns, sound, isound, vel; // 8b - int16_t decal, trail, tnum, drop; // 8b - int16_t offset, bounces, bsound; // 6b - int16_t toffset; // 2b - int16_t extra, extra_rand; // 4b - int8_t sxrepeat, syrepeat, txrepeat, tyrepeat; // 4b - int8_t shade, xrepeat, yrepeat, pal; // 4b - int8_t movecnt; // 1b - uint8_t clipdist; // 1b - int8_t filler[2]; // 2b - int32_t userdata; // 4b -} projectile_t; - // Select an actor's actiontics and movflags locations depending on // whether we compile the Lunatic build. // : sprite pointer diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index a70589fef..1c3bdc97a 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -6454,9 +6454,21 @@ void C_InitProjectiles(void) { defaultprojectile_t const Projectile = { - 1, -1, 2048, 0, 0, (int16_t) SMALLSMOKE, -1, -1, 600, (int16_t) BULLETHOLE, -1, 0, 0, 448, - (int16_t) g_numFreezeBounces, (int16_t) PIPEBOMB_BOUNCE, 1, 100, -1, -1, -1, -1, -1, -96, 18, 18, - 0, 1, 32, { 0, 0 }, 0, + // workslike, cstat, hitradius, range, flashcolor; + // spawns, sound, isound, vel, decal, trail, tnum, drop; + // offset, bounces, bsound, toffset, extra, extra_rand; + // sxrepeat, syrepeat, txrepeat, tyrepeat; + // shade, xrepeat, yrepeat, pal; + // movecnt, clipdist, filler[2], userdata; + + // XXX: The default projectie seems to mimic a union of hard-coded ones. + + 1, -1, 2048, 0, 0, + (int16_t)SMALLSMOKE, -1, -1, 600, (int16_t)BULLETHOLE, -1, 0, 0, + 448, (int16_t)g_numFreezeBounces, (int16_t)PIPEBOMB_BOUNCE, 1, 100, -1, + -1, -1, -1, -1, + -96, 18, 18, 0, + 1, 32, { 0, 0 }, 0, }; DefaultProjectile = Projectile; @@ -6464,10 +6476,10 @@ void C_InitProjectiles(void) for (int i=MAXTILES-1; i>=0; i--) { if (g_tile[i].proj) - *g_tile[i].proj = *(projectile_t *)&DefaultProjectile; + *g_tile[i].proj = DefaultProjectile; if (g_tile[i].defproj) - *g_tile[i].defproj = *(projectile_t *)&DefaultProjectile; + *g_tile[i].defproj = DefaultProjectile; } } diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 5b921141b..22d536ce6 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "build.h" // hashtable_t #include "common.h" // tokenlist +#include "player.h" // projectile_t #ifdef __cplusplus extern "C" { @@ -114,22 +115,7 @@ extern const memberlabel_t TileDataLabels[]; extern const memberlabel_t PalDataLabels[]; #endif -typedef struct -{ - int32_t workslike, cstat; // 8b - int32_t hitradius, range, flashcolor; // 12b - int16_t spawns, sound, isound, vel; // 8b - int16_t decal, trail, tnum, drop; // 8b - int16_t offset, bounces, bsound; // 6b - int16_t toffset; // 2b - int16_t extra, extra_rand; // 4b - int8_t sxrepeat, syrepeat, txrepeat, tyrepeat; // 4b - int8_t shade, xrepeat, yrepeat, pal; // 4b - int8_t movecnt; // 1b - uint8_t clipdist; // 1b - int8_t filler[2]; // 2b - int32_t userdata; // 4b -} defaultprojectile_t; +typedef projectile_t defaultprojectile_t; extern defaultprojectile_t DefaultProjectile; int32_t C_AllocQuote(int32_t qnum); diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index 07f27d45c..92096ce6b 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // duke3d global soup :( +// XXX: we don't #include everything we need. #include "compat.h" #include "build.h" diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 1271a8680..71731505b 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -140,7 +140,7 @@ static void A_DoWaterTracers(int32_t x1,int32_t y1,int32_t z1,int32_t x2,int32_t static inline projectile_t * Proj_GetProjectile(int tile) { - return ((unsigned)tile < MAXTILES && g_tile[tile].proj) ? g_tile[tile].proj : (projectile_t *) &DefaultProjectile; + return ((unsigned)tile < MAXTILES && g_tile[tile].proj) ? g_tile[tile].proj : &DefaultProjectile; } static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang, int32_t atwith) diff --git a/polymer/eduke32/source/player.h b/polymer/eduke32/source/player.h index 4c7fdad94..067fc5b28 100644 --- a/polymer/eduke32/source/player.h +++ b/polymer/eduke32/source/player.h @@ -318,6 +318,22 @@ extern intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound for wea extern intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Color for polymer muzzle flash #endif +typedef struct { + int32_t workslike, cstat; // 8b + int32_t hitradius, range, flashcolor; // 12b + int16_t spawns, sound, isound, vel; // 8b + int16_t decal, trail, tnum, drop; // 8b + int16_t offset, bounces, bsound; // 6b + int16_t toffset; // 2b + int16_t extra, extra_rand; // 4b + int8_t sxrepeat, syrepeat, txrepeat, tyrepeat; // 4b + int8_t shade, xrepeat, yrepeat, pal; // 4b + int8_t movecnt; // 1b + uint8_t clipdist; // 1b + int8_t filler[2]; // 2b + int32_t userdata; // 4b +} projectile_t; + // KEEPINSYNC lunatic/defs.ilua typedef struct { int32_t cur, count; // "cur" is the only member that is *used*