You're just going to have to trust me that this is 10000 lines worth of formatting and variable name cleanup, and not 10000 lines of functional changes.

git-svn-id: https://svn.eduke32.com/eduke32@5821 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-08-27 01:40:06 +00:00
parent d7595edc41
commit ae5f941ad0
13 changed files with 2820 additions and 2808 deletions

View file

@ -186,7 +186,7 @@ void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3,
SKIPWALLCHECK: SKIPWALLCHECK:
q = -(16<<8) + (krand()&((32<<8)-1)); q = -ZOFFSET2 + (krand()&((32<<8)-1));
for (stati=0; stati < ARRAY_SSIZE(statlist); stati++) for (stati=0; stati < ARRAY_SSIZE(statlist); stati++)
{ {
@ -203,12 +203,12 @@ SKIPWALLCHECK:
if (s->picnum != SHRINKSPARK || (sj->cstat&257)) if (s->picnum != SHRINKSPARK || (sj->cstat&257))
if (dist(s, sj) < r) if (dist(s, sj) < r)
{ {
if (A_CheckEnemySprite((uspritetype *)sj) && !cansee(sj->x, sj->y,sj->z+q, sj->sectnum, s->x, s->y, s->z+q, s->sectnum)) if (A_CheckEnemySprite(sj) && !cansee(sj->x, sj->y,sj->z+q, sj->sectnum, s->x, s->y, s->z+q, s->sectnum))
goto BOLT; goto BOLT;
A_DamageObject(j, i); A_DamageObject(j, i);
} }
} }
else if (sj->extra >= 0 && (uspritetype *)sj != s && (sj->picnum == TRIPBOMB || A_CheckEnemySprite((uspritetype *)sj) || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL || (sj->cstat&257) || sj->picnum == DUKELYINGDEAD)) else if (sj->extra >= 0 && (uspritetype *)sj != s && (sj->picnum == TRIPBOMB || A_CheckEnemySprite(sj) || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL || (sj->cstat&257) || sj->picnum == DUKELYINGDEAD))
{ {
if (s->picnum == SHRINKSPARK && sj->picnum != SHARK && (j == s->owner || sj->xrepeat < 24)) if (s->picnum == SHRINKSPARK && sj->picnum != SHARK && (j == s->owner || sj->xrepeat < 24))
{ {
@ -397,7 +397,7 @@ static int32_t A_CheckNeedZUpdate(int32_t spritenum, int32_t changez, int32_t *d
int32_t A_MoveSpriteClipdist(int32_t spritenum, vec3_t const * const change, uint32_t cliptype, int32_t clipdist) int32_t A_MoveSpriteClipdist(int32_t spritenum, vec3_t const * const change, uint32_t cliptype, int32_t clipdist)
{ {
spritetype * const spr = &sprite[spritenum]; spritetype * const spr = &sprite[spritenum];
const int32_t badguy = A_CheckEnemySprite((uspritetype *)spr); const int32_t badguy = A_CheckEnemySprite(spr);
const int32_t oldx = spr->x, oldy = spr->y; const int32_t oldx = spr->x, oldy = spr->y;
if (spr->statnum == STAT_MISC || (badguy && spr->xrepeat < 4)) if (spr->statnum == STAT_MISC || (badguy && spr->xrepeat < 4))
@ -872,7 +872,7 @@ ACTOR_STATIC void G_MoveZombieActors(void)
actor[i].timetosleep++; actor[i].timetosleep++;
if (actor[i].timetosleep >= (x>>8)) if (actor[i].timetosleep >= (x>>8))
{ {
if (A_CheckEnemySprite((uspritetype *)s)) if (A_CheckEnemySprite(s))
{ {
const int32_t px = g_player[p].ps->opos.x+64-(krand()&127); const int32_t px = g_player[p].ps->opos.x+64-(krand()&127);
const int32_t py = g_player[p].ps->opos.y+64-(krand()&127); const int32_t py = g_player[p].ps->opos.y+64-(krand()&127);
@ -943,7 +943,7 @@ ACTOR_STATIC void G_MoveZombieActors(void)
} }
} }
if (A_CheckEnemySprite((uspritetype *)s) && A_CheckSpriteFlags(i,SFLAG_NOSHADE) == 0) if (A_CheckEnemySprite(s) && A_CheckSpriteFlags(i,SFLAG_NOSHADE) == 0)
{ {
if (sector[s->sectnum].ceilingstat&1) if (sector[s->sectnum].ceilingstat&1)
s->shade = sector[s->sectnum].ceilingshade; s->shade = sector[s->sectnum].ceilingshade;
@ -1445,7 +1445,7 @@ ACTOR_STATIC void G_MoveFallers(void)
int32_t j; int32_t j;
const int32_t oextra = s->extra; const int32_t oextra = s->extra;
s->z -= (16<<8); s->z -= ZOFFSET2;
T2 = s->ang; T2 = s->ang;
if ((j = A_IncurDamage(i)) >= 0) if ((j = A_IncurDamage(i)) >= 0)
{ {
@ -1474,7 +1474,7 @@ ACTOR_STATIC void G_MoveFallers(void)
} }
} }
s->ang = T2; s->ang = T2;
s->z += (16<<8); s->z += ZOFFSET2;
} }
else if (T1 == 1) else if (T1 == 1)
{ {
@ -1514,7 +1514,7 @@ ACTOR_STATIC void G_MoveFallers(void)
s->zvel = 6144; s->zvel = 6144;
s->z += s->zvel; s->z += s->zvel;
} }
if ((sector[sect].floorz-s->z) < (16<<8)) if ((sector[sect].floorz-s->z) < ZOFFSET2)
{ {
int32_t j = 1+(krand()&7); int32_t j = 1+(krand()&7);
for (x=0; x<j; x++) RANDOMSCRAP; for (x=0; x<j; x++) RANDOMSCRAP;
@ -2620,7 +2620,7 @@ static void G_WeaponHitCeilingOrFloor(int32_t i, spritetype *s, int32_t *j)
*j = 16384|s->sectnum; *j = 16384|s->sectnum;
s->zvel = -1; s->zvel = -1;
} }
else if (s->z > actor[i].floorz + (16<<8)*(sector[s->sectnum].lotag == ST_1_ABOVE_WATER)) else if (s->z > actor[i].floorz + ZOFFSET2*(sector[s->sectnum].lotag == ST_1_ABOVE_WATER))
{ {
*j = 16384|s->sectnum; *j = 16384|s->sectnum;
@ -3054,7 +3054,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
j &= (MAXSPRITES-1); j &= (MAXSPRITES-1);
if (s->picnum == FREEZEBLAST && sprite[j].pal == 1) if (s->picnum == FREEZEBLAST && sprite[j].pal == 1)
if (A_CheckEnemySprite((uspritetype *)&sprite[j]) || sprite[j].picnum == APLAYER) if (A_CheckEnemySprite(&sprite[j]) || sprite[j].picnum == APLAYER)
{ {
j = A_Spawn(i, TRANSPORTERSTAR); j = A_Spawn(i, TRANSPORTERSTAR);
sprite[j].pal = 1; sprite[j].pal = 1;
@ -3969,7 +3969,7 @@ ACTOR_STATIC void G_MoveActors(void)
A_Shoot(i,FIRELASER); A_Shoot(i,FIRELASER);
s->ang = a; s->ang = a;
} }
if (t[2] > (GAMETICSPERSEC*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps->pos.x,ps->pos.y,ps->pos.z,ps->cursectnum)) if (t[2] > (GAMETICSPERSEC*3) || !cansee(s->x,s->y,s->z-ZOFFSET2,s->sectnum, ps->pos.x,ps->pos.y,ps->pos.z,ps->cursectnum))
{ {
t[0] = 0; t[0] = 0;
t[2] = 0; t[2] = 0;
@ -3992,7 +3992,7 @@ ACTOR_STATIC void G_MoveActors(void)
else else
{ {
t[2]++; t[2]++;
if (t[2] > (GAMETICSPERSEC*3) || !cansee(s->x,s->y,s->z-(16<<8),s->sectnum, ps->pos.x,ps->pos.y,ps->pos.z,ps->cursectnum)) if (t[2] > (GAMETICSPERSEC*3) || !cansee(s->x,s->y,s->z-ZOFFSET2,s->sectnum, ps->pos.x,ps->pos.y,ps->pos.z,ps->cursectnum))
{ {
t[0] = 1; t[0] = 1;
t[2] = 0; t[2] = 0;
@ -4887,7 +4887,7 @@ DETONATEB:
goto BOLT; goto BOLT;
} }
if (!g_netServer && ud.multimode < 2 && A_CheckEnemySprite((uspritetype *)s)) if (!g_netServer && ud.multimode < 2 && A_CheckEnemySprite(s))
{ {
if (g_noEnemies == 1) if (g_noEnemies == 1)
{ {
@ -5049,7 +5049,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
else else
{ {
l = getflorzofslope(sect,s->x,s->y)-s->z; l = getflorzofslope(sect,s->x,s->y)-s->z;
if( l > (16<<8) ) KILLIT(i); if( l > ZOFFSET2 ) KILLIT(i);
} }
else else
*/ */
@ -5572,7 +5572,7 @@ static void MaybeTrainKillEnemies(int32_t i, int32_t numguts)
{ {
const int32_t nextj = nextspritesect[j]; const int32_t nextj = nextspritesect[j];
if (sprite[j].extra >= 0 && sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite((uspritetype *)&sprite[j])) if (sprite[j].extra >= 0 && sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite(&sprite[j]))
{ {
int16_t k = sprite[j].sectnum; int16_t k = sprite[j].sectnum;
@ -6533,7 +6533,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{ {
for (SPRITES_OF(STAT_ACTOR, k)) for (SPRITES_OF(STAT_ACTOR, k))
{ {
if (sprite[k].extra > 0 && A_CheckEnemySprite((uspritetype *)&sprite[k]) if (sprite[k].extra > 0 && A_CheckEnemySprite(&sprite[k])
&& clipinsidebox((vec2_t *)&sprite[k], j, 256) == 1) && clipinsidebox((vec2_t *)&sprite[k], j, 256) == 1)
goto BOLT; goto BOLT;
} }
@ -7239,7 +7239,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if (!(sprite[j].picnum >= CRANE && sprite[j].picnum <= CRANE+3)) if (!(sprite[j].picnum >= CRANE && sprite[j].picnum <= CRANE+3))
{ {
if (sprite[j].z > actor[j].floorz-(16<<8)) if (sprite[j].z > actor[j].floorz-ZOFFSET2)
{ {
actor[j].bpos.x = sprite[j].x; actor[j].bpos.x = sprite[j].x;
actor[j].bpos.y = sprite[j].y; actor[j].bpos.y = sprite[j].y;

View file

@ -32,6 +32,7 @@ extern "C" {
#define MAXSLEEPDIST 16384 #define MAXSLEEPDIST 16384
#define SLEEPTIME 1536 #define SLEEPTIME 1536
#define ZOFFSET (1<<8) #define ZOFFSET (1<<8)
#define ZOFFSET2 (16<<8)
#define ACTOR_MAXFALLINGZVEL 6144 #define ACTOR_MAXFALLINGZVEL 6144
#define ACTOR_ONWATER_ADDZ (24<<8) #define ACTOR_ONWATER_ADDZ (24<<8)
@ -56,7 +57,8 @@ extern "C" {
// Defines the motion characteristics of an actor // Defines the motion characteristics of an actor
enum amoveflags_t { enum amoveflags_t
{
face_player = 1, face_player = 1,
geth = 2, geth = 2,
getv = 4, getv = 4,
@ -73,7 +75,8 @@ enum amoveflags_t {
}; };
// Defines for 'useractor' keyword // Defines for 'useractor' keyword
enum uactortypes_t { enum uactortypes_t
{
notenemy, notenemy,
enemy, enemy,
enemystayput enemystayput
@ -93,14 +96,16 @@ enum uactortypes_t {
#define AC_AI_ID(t) ((t)[5]) /* the ID of the actor's current ai */ #define AC_AI_ID(t) ((t)[5]) /* the ID of the actor's current ai */
#ifdef LUNATIC #ifdef LUNATIC
struct action { struct action
{
// These members MUST be in this exact order because FFI cdata of this type // These members MUST be in this exact order because FFI cdata of this type
// can be initialized by passing a table with numeric indices (con.action). // can be initialized by passing a table with numeric indices (con.action).
int16_t startframe, numframes; int16_t startframe, numframes;
int16_t viewtype, incval, delay; int16_t viewtype, incval, delay;
}; };
struct move { struct move
{
// These members MUST be in this exact order. // These members MUST be in this exact order.
int16_t hvel, vvel; int16_t hvel, vvel;
}; };
@ -124,7 +129,8 @@ typedef struct { int32_t id; struct action ac; } con_action_t;
#endif #endif
// (+ 40 16 16 4 8 6 8 6 4 20) // (+ 40 16 16 4 8 6 8 6 4 20)
typedef struct { typedef struct
{
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
#ifdef LUNATIC #ifdef LUNATIC
@ -135,13 +141,12 @@ typedef struct {
uint16_t actiontics; uint16_t actiontics;
#endif #endif
int32_t flags; //4b int32_t flags; // 4b
vec3_t bpos; //12b vec3_t bpos; // 12b
int32_t floorz,ceilingz,lastvx,lastvy; //16b int32_t floorz, ceilingz, lastvx, lastvy; // 16b
int32_t lasttransport; //4b int32_t lasttransport; // 4b
int16_t picnum, ang, extra, owner; // 8b
int16_t picnum,ang,extra,owner; //8b int16_t movflag, tempang, timetosleep; // 6b
int16_t movflag,tempang,timetosleep; //6b
// NOTE: 'dispicnum' is updated locally, not in sync with the game! // NOTE: 'dispicnum' is updated locally, not in sync with the game!
int16_t actorstayput, dispicnum; int16_t actorstayput, dispicnum;
@ -153,12 +158,11 @@ typedef struct {
uint16_t movflags; uint16_t movflags;
#endif #endif
int16_t cgg; int16_t cgg;
int16_t lightId, lightcount, lightmaxrange; // 6b
int16_t lightId, lightcount, lightmaxrange; //6b
#ifdef POLYMER #ifdef POLYMER
_prlight *lightptr; //4b/8b _prlight *lightptr; // 4b/8b
#else #else
void *lightptr; void * lightptr;
#endif #endif
// pad struct to 128 bytes // pad struct to 128 bytes
@ -182,9 +186,10 @@ typedef struct {
#endif #endif
} actor_t; } actor_t;
#pragma pack(push,1) #pragma pack(push, 1)
// this struct needs to match the beginning of actor_t above // this struct needs to match the beginning of actor_t above
typedef struct { typedef struct
{
int32_t t_data[10]; // 40b sometimes used to hold offsets to con code int32_t t_data[10]; // 40b sometimes used to hold offsets to con code
#ifdef LUNATIC #ifdef LUNATIC
@ -193,13 +198,12 @@ typedef struct {
uint16_t actiontics; uint16_t actiontics;
#endif #endif
int32_t flags; //4b int32_t flags; // 4b
vec3_t bpos; //12b vec3_t bpos; // 12b
int32_t floorz,ceilingz,lastvx,lastvy; //16b int32_t floorz, ceilingz, lastvx, lastvy; // 16b
int32_t lasttransport; //4b int32_t lasttransport; // 4b
int16_t picnum, ang, extra, owner; // 8b
int16_t picnum,ang,extra,owner; //8b int16_t movflag, tempang, timetosleep; // 6b
int16_t movflag,tempang,timetosleep; // 6b
int16_t actorstayput, dispicnum; int16_t actorstayput, dispicnum;
#if !defined LUNATIC #if !defined LUNATIC
@ -208,30 +212,27 @@ typedef struct {
uint16_t movflags; uint16_t movflags;
#endif #endif
int16_t cgg; int16_t cgg;
spritetype sprite; spritetype sprite;
int16_t netIndex; int16_t netIndex;
} netactor_t; } netactor_t;
#pragma pack(pop) #pragma pack(pop)
typedef struct { typedef struct
{
#if !defined LUNATIC #if !defined LUNATIC
intptr_t *execPtr; // pointer to CON script for this tile, formerly actorscrptr intptr_t *execPtr; // pointer to CON script for this tile, formerly actorscrptr
intptr_t *loadPtr; // pointer to load time CON script, formerly actorLoadEventScrPtr or something intptr_t *loadPtr; // pointer to load time CON script, formerly actorLoadEventScrPtr or something
#endif #endif
uint32_t flags; // formerly SpriteFlags, ActorType uint32_t flags; // formerly SpriteFlags, ActorType
int32_t cacherange; // formerly SpriteCache int32_t cacherange; // formerly SpriteCache
// todo: make this a pointer and allocate at runtime
projectile_t *proj; projectile_t *proj;
projectile_t *defproj; projectile_t *defproj;
} tiledata_t; } tiledata_t;
// KEEPINSYNC lunatic/con_lang.lua // KEEPINSYNC lunatic/con_lang.lua
enum sflags_t { enum sflags_t
{
SFLAG_SHADOW = 0x00000001, SFLAG_SHADOW = 0x00000001,
SFLAG_NVG = 0x00000002, SFLAG_NVG = 0x00000002,
SFLAG_NOSHADE = 0x00000004, SFLAG_NOSHADE = 0x00000004,
@ -263,7 +264,8 @@ enum sflags_t {
// Custom projectiles "workslike" flags. // Custom projectiles "workslike" flags.
// XXX: Currently not predefined from CON. // XXX: Currently not predefined from CON.
enum pflags_t { enum pflags_t
{
PROJECTILE_HITSCAN = 0x00000001, PROJECTILE_HITSCAN = 0x00000001,
PROJECTILE_RPG = 0x00000002, PROJECTILE_RPG = 0x00000002,
PROJECTILE_BOUNCESOFFWALLS = 0x00000004, PROJECTILE_BOUNCESOFFWALLS = 0x00000004,
@ -287,7 +289,7 @@ enum pflags_t {
PROJECTILE_ACCURATE = 0x00100000, PROJECTILE_ACCURATE = 0x00100000,
PROJECTILE_NOSETOWNERSHADE = 0x00200000, PROJECTILE_NOSETOWNERSHADE = 0x00200000,
PROJECTILE_MOVED = 0x80000000, // internal flag, do not document PROJECTILE_MOVED = 0x80000000, // internal flag, do not document
PROJECTILE_TYPE_MASK = PROJECTILE_HITSCAN|PROJECTILE_RPG|PROJECTILE_KNEE|PROJECTILE_BLOOD, PROJECTILE_TYPE_MASK = PROJECTILE_HITSCAN | PROJECTILE_RPG | PROJECTILE_KNEE | PROJECTILE_BLOOD,
}; };
extern tiledata_t g_tile[MAXTILES]; extern tiledata_t g_tile[MAXTILES];
@ -299,28 +301,27 @@ extern int32_t ticrandomseed;
extern projectile_t SpriteProjectile[MAXSPRITES]; extern projectile_t SpriteProjectile[MAXSPRITES];
void A_AddToDeleteQueue(int32_t i); void A_AddToDeleteQueue(int32_t i);
int32_t A_CheckNoSE7Water(const spritetype *s, int32_t sectnum, int32_t slotag, int32_t *othersectptr); int32_t A_CheckNoSE7Water(const spritetype *s, int32_t sectnum, int32_t slotag, int32_t *othersectptr);
int32_t A_CheckSwitchTile(int32_t i); int32_t A_CheckSwitchTile(int32_t i);
void A_DeleteSprite(int32_t s); void A_DeleteSprite(int32_t s);
void A_DoGuts(int32_t sp,int32_t gtype,int32_t n); void A_DoGuts(int32_t sp, int32_t gtype, int32_t n);
void A_DoGutsDir(int32_t sp,int32_t gtype,int32_t n); void A_DoGutsDir(int32_t sp, int32_t gtype, int32_t n);
int32_t A_IncurDamage(int32_t sn); int32_t A_IncurDamage(int32_t sn);
void A_MoveCyclers(void); void A_MoveCyclers(void);
void A_MoveDummyPlayers(void); void A_MoveDummyPlayers(void);
void A_MoveSector(int i); void A_MoveSector(int i);
void A_PlayAlertSound(int32_t i); void A_PlayAlertSound(int32_t i);
void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4); void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4);
void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n); void A_SpawnMultiple(int32_t sp, int32_t pic, int32_t n);
void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoffset,int32_t range,int32_t color,int32_t priority); void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority);
void G_ClearCameraView(DukePlayer_t *ps); void G_ClearCameraView(DukePlayer_t *ps);
void G_DoInterpolations(int32_t smoothratio); void G_DoInterpolations(int32_t smoothratio);
void G_MoveWorld(void); void G_MoveWorld(void);
void G_RefreshLights(void); void G_RefreshLights(void);
int32_t G_SetInterpolation(int32_t * const posptr); int32_t G_SetInterpolation(int32_t *const posptr);
void G_StopInterpolation(int32_t * const posptr); void G_StopInterpolation(int32_t *const posptr);
// PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly // PK 20110701: changed input argument: int32_t i (== sprite, whose sectnum...) --> sectnum directly
void Sect_ToggleInterpolation(int sectnum, int doset); void Sect_ToggleInterpolation(int sectnum, int doset);
@ -347,7 +348,7 @@ ACTOR_INLINE_HEADER int32_t A_MoveSprite(int32_t spritenum, vec3_t const * const
EXTERN_INLINE_HEADER int32_t G_CheckForSpaceCeiling(int32_t sectnum); EXTERN_INLINE_HEADER int32_t G_CheckForSpaceCeiling(int32_t sectnum);
EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum); EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum);
EXTERN_INLINE_HEADER int32_t A_CheckEnemySprite(uspritetype const * const s); EXTERN_INLINE_HEADER int A_CheckEnemySprite(void const * const s);
#ifdef __cplusplus #ifdef __cplusplus
} }
@ -392,9 +393,9 @@ EXTERN_INLINE int32_t G_CheckForSpaceFloor(int32_t sectnum)
(sector[sectnum].floorpicnum==MOONSKY1 || sector[sectnum].floorpicnum==BIGORBIT1)); (sector[sectnum].floorpicnum==MOONSKY1 || sector[sectnum].floorpicnum==BIGORBIT1));
} }
EXTERN_INLINE int32_t A_CheckEnemySprite(uspritetype const * const s) EXTERN_INLINE int A_CheckEnemySprite(void const * const pSprite)
{ {
return A_CheckEnemyTile(s->picnum); return A_CheckEnemyTile(((uspritetype *) pSprite)->picnum);
} }
#endif #endif

View file

@ -1007,9 +1007,11 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
if (dont_draw != 1) // event return values other than 0 and 1 are reserved if (dont_draw != 1) // event return values other than 0 and 1 are reserved
{ {
/*
if (EDUKE32_PREDICT_FALSE(dont_draw != 0)) if (EDUKE32_PREDICT_FALSE(dont_draw != 0))
OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMS return value must be 0 or 1, " OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMS return value must be 0 or 1, "
"other values are reserved.\n"); "other values are reserved.\n");
*/
G_HandleMirror(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), CAMERA(ang), CAMERA(horiz), smoothratio); G_HandleMirror(CAMERA(pos.x), CAMERA(pos.y), CAMERA(pos.z), CAMERA(ang), CAMERA(horiz), smoothratio);
#ifdef LEGACY_ROR #ifdef LEGACY_ROR
@ -1216,17 +1218,17 @@ void G_DumpDebugInfo(void)
TrackerCast(sprite[j].x),TrackerCast(sprite[j].y),TrackerCast(sprite[j].z),TrackerCast(sprite[j].picnum)); TrackerCast(sprite[j].x),TrackerCast(sprite[j].y),TrackerCast(sprite[j].z),TrackerCast(sprite[j].picnum));
for (i=0; i<g_gameVarCount; i++) for (i=0; i<g_gameVarCount; i++)
{ {
if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR)) if (aGameVars[i].nFlags & (GAMEVAR_PERACTOR))
{ {
if (aGameVars[i].val.plValues[j] != aGameVars[i].lDefault) if (aGameVars[i].pValues[j] != aGameVars[i].nDefault)
{ {
OSD_Printf("gamevar %s ",aGameVars[i].szLabel); OSD_Printf("gamevar %s ",aGameVars[i].szLabel);
OSD_Printf("%" PRIdPTR "",aGameVars[i].val.plValues[j]); OSD_Printf("%" PRIdPTR "",aGameVars[i].pValues[j]);
OSD_Printf(" GAMEVAR_PERACTOR"); OSD_Printf(" GAMEVAR_PERACTOR");
if (aGameVars[i].dwFlags != GAMEVAR_PERACTOR) if (aGameVars[i].nFlags != GAMEVAR_PERACTOR)
{ {
OSD_Printf(" // "); OSD_Printf(" // ");
if (aGameVars[i].dwFlags & (GAMEVAR_SYSTEM)) if (aGameVars[i].nFlags & (GAMEVAR_SYSTEM))
{ {
OSD_Printf(" (system)"); OSD_Printf(" (system)");
} }
@ -1633,7 +1635,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
{ {
sp->xrepeat = 48; sp->xrepeat = 48;
sp->yrepeat = 64; sp->yrepeat = 64;
if (sprite[j].statnum == STAT_PLAYER || A_CheckEnemySprite((uspritetype *)&sprite[j])) if (sprite[j].statnum == STAT_PLAYER || A_CheckEnemySprite(&sprite[j]))
sp->z -= (32<<8); sp->z -= (32<<8);
} }
} }
@ -3576,7 +3578,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
continue; continue;
default: default:
// NOTE: wall-aligned sprites will never take on ceiling/floor shade... // NOTE: wall-aligned sprites will never take on ceiling/floor shade...
if ((t->cstat&16) || (A_CheckEnemySprite((uspritetype *)t) && if ((t->cstat&16) || (A_CheckEnemySprite(t) &&
(unsigned)t->owner < MAXSPRITES && sprite[t->owner].extra > 0) || t->statnum == STAT_PLAYER) (unsigned)t->owner < MAXSPRITES && sprite[t->owner].extra > 0) || t->statnum == STAT_PLAYER)
continue; continue;
} }
@ -4126,14 +4128,14 @@ skip:
// player has nightvision on. We should pass stuff like "from which player is this view // player has nightvision on. We should pass stuff like "from which player is this view
// supposed to be" as parameters ("drawing context") instead of relying on globals. // supposed to be" as parameters ("drawing context") instead of relying on globals.
if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on && if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on &&
(A_CheckEnemySprite((uspritetype *)s) || A_CheckSpriteFlags(t->owner,SFLAG_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER)) (A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SFLAG_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER))
{ {
t->pal = 6; t->pal = 6;
t->shade = 0; t->shade = 0;
} }
// Fake floor shadow, implemented by inserting a new tsprite. // Fake floor shadow, implemented by inserting a new tsprite.
if (s->statnum == STAT_DUMMYPLAYER || A_CheckEnemySprite((uspritetype *)s) || A_CheckSpriteFlags(t->owner,SFLAG_SHADOW) || (s->picnum == APLAYER && s->owner >= 0)) if (s->statnum == STAT_DUMMYPLAYER || A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SFLAG_SHADOW) || (s->picnum == APLAYER && s->owner >= 0))
if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE && s->picnum != HOTMEAT) if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE && s->picnum != HOTMEAT)
{ {
if (actor[i].dispicnum < 0) if (actor[i].dispicnum < 0)

View file

@ -1924,13 +1924,13 @@ static void C_GetNextVarType(int32_t type)
return; return;
} }
if (EDUKE32_PREDICT_FALSE(type == GAMEVAR_READONLY && aGameVars[i].dwFlags & GAMEVAR_READONLY)) if (EDUKE32_PREDICT_FALSE(type == GAMEVAR_READONLY && aGameVars[i].nFlags & GAMEVAR_READONLY))
{ {
g_numCompilerErrors++; g_numCompilerErrors++;
C_ReportError(ERROR_VARREADONLY); C_ReportError(ERROR_VARREADONLY);
return; return;
} }
else if (EDUKE32_PREDICT_FALSE(aGameVars[i].dwFlags & type)) else if (EDUKE32_PREDICT_FALSE(aGameVars[i].nFlags & type))
{ {
g_numCompilerErrors++; g_numCompilerErrors++;
C_ReportError(ERROR_VARTYPEMISMATCH); C_ReportError(ERROR_VARTYPEMISMATCH);
@ -3894,7 +3894,7 @@ DO_DEFSTATE:
C_ReportError(ERROR_NOTAGAMEVAR); C_ReportError(ERROR_NOTAGAMEVAR);
continue; continue;
} }
if (EDUKE32_PREDICT_FALSE(aGameVars[i].dwFlags & GAMEVAR_READONLY)) if (EDUKE32_PREDICT_FALSE(aGameVars[i].nFlags & GAMEVAR_READONLY))
{ {
g_numCompilerErrors++; g_numCompilerErrors++;
C_ReportError(ERROR_VARREADONLY); C_ReportError(ERROR_VARREADONLY);
@ -3904,7 +3904,7 @@ DO_DEFSTATE:
switch (tw) switch (tw)
{ {
case CON_SETACTORVAR: case CON_SETACTORVAR:
if (EDUKE32_PREDICT_FALSE(!(aGameVars[i].dwFlags & GAMEVAR_PERACTOR))) if (EDUKE32_PREDICT_FALSE(!(aGameVars[i].nFlags & GAMEVAR_PERACTOR)))
{ {
g_numCompilerErrors++; g_numCompilerErrors++;
C_ReportError(-1); C_ReportError(-1);
@ -3913,7 +3913,7 @@ DO_DEFSTATE:
} }
break; break;
case CON_SETPLAYERVAR: case CON_SETPLAYERVAR:
if (EDUKE32_PREDICT_FALSE(!(aGameVars[i].dwFlags & GAMEVAR_PERPLAYER))) if (EDUKE32_PREDICT_FALSE(!(aGameVars[i].nFlags & GAMEVAR_PERPLAYER)))
{ {
g_numCompilerErrors++; g_numCompilerErrors++;
C_ReportError(-1); C_ReportError(-1);
@ -4239,7 +4239,7 @@ DO_DEFSTATE:
BITPTR_CLEAR(g_scriptPtr-script); BITPTR_CLEAR(g_scriptPtr-script);
*g_scriptPtr++=i; *g_scriptPtr++=i;
if (EDUKE32_PREDICT_FALSE(aGameArrays[i].dwFlags & GAMEARRAY_READONLY)) if (EDUKE32_PREDICT_FALSE(aGameArrays[i].nFlags & GAMEARRAY_READONLY))
{ {
C_ReportError(ERROR_ARRAYREADONLY); C_ReportError(ERROR_ARRAYREADONLY);
g_numCompilerErrors++; g_numCompilerErrors++;
@ -4279,7 +4279,7 @@ DO_DEFSTATE:
BITPTR_CLEAR(g_scriptPtr-script); BITPTR_CLEAR(g_scriptPtr-script);
*g_scriptPtr++ = i; *g_scriptPtr++ = i;
if (tw==CON_RESIZEARRAY && (aGameArrays[i].dwFlags & GAMEARRAY_TYPE_MASK)) if (tw==CON_RESIZEARRAY && (aGameArrays[i].nFlags & GAMEARRAY_TYPE_MASK))
{ {
C_ReportError(-1); C_ReportError(-1);
initprintf("can't resize system array `%s'.", label+(g_numLabels<<6)); initprintf("can't resize system array `%s'.", label+(g_numLabels<<6));

File diff suppressed because it is too large Load diff

View file

@ -48,11 +48,11 @@ void A_LoadActor(int32_t iActor);
#endif #endif
void A_Execute(int32_t iActor, int32_t iPlayer, int32_t lDist); void A_Execute(int32_t iActor, int32_t iPlayer, int32_t lDist);
void A_Fall(int32_t iActor); void A_Fall(int nSprite);
int32_t A_FurthestVisiblePoint(int32_t iActor,uspritetype * const ts,int32_t *dax,int32_t *day); int32_t A_FurthestVisiblePoint(int32_t iActor,uspritetype * const ts,int32_t *dax,int32_t *day);
int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs); int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs);
void A_GetZLimits(int32_t iActor); void A_GetZLimits(int32_t iActor);
int32_t G_GetAngleDelta(int32_t a,int32_t na); int G_GetAngleDelta(int a,int na);
void G_RestoreMapState(); void G_RestoreMapState();
void G_SaveMapState(); void G_SaveMapState();
@ -66,38 +66,38 @@ void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
int32_t shade, int32_t orientation, int32_t p); int32_t shade, int32_t orientation, int32_t p);
#endif #endif
int32_t VM_OnEventWithBoth_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t iReturn); int32_t VM_OnEventWithBoth_(int nEventID, int nSprite, int nPlayer, int nDist, int32_t nReturn);
int32_t VM_OnEventWithReturn_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t iReturn); int32_t VM_OnEventWithReturn_(int nEventID, int nSprite, int nPlayer, int32_t nReturn);
int32_t VM_OnEventWithDist_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist); int32_t VM_OnEventWithDist_(int nEventID, int nSprite, int nPlayer, int nDist);
int32_t VM_OnEvent_(int32_t iEventID, int32_t iActor, int32_t iPlayer); int32_t VM_OnEvent_(int nEventID, int nSprite, int nPlayer);
FORCE_INLINE int32_t VM_HaveEvent(int32_t iEventID) FORCE_INLINE int VM_HaveEvent(int nEventID)
{ {
#ifdef LUNATIC #ifdef LUNATIC
return L_IsInitialized(&g_ElState) && El_HaveEvent(iEventID); return L_IsInitialized(&g_ElState) && El_HaveEvent(nEventID);
#else #else
return !!apScriptGameEvent[iEventID]; return !!apScriptGameEvent[nEventID];
#endif #endif
} }
FORCE_INLINE int32_t VM_OnEventWithBoth(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t iReturn) FORCE_INLINE int32_t VM_OnEventWithBoth(int nEventID, int nSprite, int nPlayer, int nDist, int32_t nReturn)
{ {
return VM_HaveEvent(iEventID) ? VM_OnEventWithBoth_(iEventID, iActor, iPlayer, lDist, iReturn) : iReturn; return VM_HaveEvent(nEventID) ? VM_OnEventWithBoth_(nEventID, nSprite, nPlayer, nDist, nReturn) : nReturn;
} }
FORCE_INLINE int32_t VM_OnEventWithReturn(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t iReturn) FORCE_INLINE int32_t VM_OnEventWithReturn(int nEventID, int nSprite, int nPlayer, int nReturn)
{ {
return VM_HaveEvent(iEventID) ? VM_OnEventWithReturn_(iEventID, iActor, iPlayer, iReturn) : iReturn; return VM_HaveEvent(nEventID) ? VM_OnEventWithReturn_(nEventID, nSprite, nPlayer, nReturn) : nReturn;
} }
FORCE_INLINE int32_t VM_OnEventWithDist(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist) FORCE_INLINE int32_t VM_OnEventWithDist(int nEventID, int nSprite, int nPlayer, int nDist)
{ {
return VM_HaveEvent(iEventID) ? VM_OnEventWithDist_(iEventID, iActor, iPlayer, lDist) : 0; return VM_HaveEvent(nEventID) ? VM_OnEventWithDist_(nEventID, nSprite, nPlayer, nDist) : 0;
} }
FORCE_INLINE int32_t VM_OnEvent(int32_t iEventID, int32_t iActor, int32_t iPlayer) FORCE_INLINE int32_t VM_OnEvent(int nEventID, int nSprite, int nPlayer)
{ {
return VM_HaveEvent(iEventID) ? VM_OnEvent_(iEventID, iActor, iPlayer) : 0; return VM_HaveEvent(nEventID) ? VM_OnEvent_(nEventID, nSprite, nPlayer) : 0;
} }
#define CON_ERRPRINTF(Text, ...) do { \ #define CON_ERRPRINTF(Text, ...) do { \
@ -105,7 +105,7 @@ FORCE_INLINE int32_t VM_OnEvent(int32_t iEventID, int32_t iActor, int32_t iPlaye
} while (0) } while (0)
void G_GetTimeDate(int32_t *vals); void G_GetTimeDate(int32_t *vals);
int32_t G_StartTrack(int32_t level); int G_StartTrack(int nLevel);
int32_t A_Dodge(spritetype *s); int32_t A_Dodge(spritetype *s);
#ifdef LUNATIC #ifdef LUNATIC
void G_ShowView(vec3_t vec, int32_t a, int32_t horiz, int32_t sect, void G_ShowView(vec3_t vec, int32_t a, int32_t horiz, int32_t sect,

File diff suppressed because it is too large Load diff

View file

@ -29,10 +29,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define MAXVARLABEL 26 #define MAXVARLABEL 26
// store global game definitions // store global game definitions
enum GamevarFlags_t { enum GamevarFlags_t
{
GAMEVAR_PERPLAYER = 0x00000001, // per-player variable GAMEVAR_PERPLAYER = 0x00000001, // per-player variable
GAMEVAR_PERACTOR = 0x00000002, // per-actor variable GAMEVAR_PERACTOR = 0x00000002, // per-actor variable
GAMEVAR_USER_MASK = (GAMEVAR_PERPLAYER|GAMEVAR_PERACTOR), GAMEVAR_USER_MASK = (GAMEVAR_PERPLAYER | GAMEVAR_PERACTOR),
GAMEVAR_RESET = 0x00000008, // INTERNAL, don't use GAMEVAR_RESET = 0x00000008, // INTERNAL, don't use
GAMEVAR_DEFAULT = 0x00000100, // UNUSED, but always cleared for user-defined gamevars GAMEVAR_DEFAULT = 0x00000100, // UNUSED, but always cleared for user-defined gamevars
GAMEVAR_NODEFAULT = 0x00000400, // don't reset on actor spawn GAMEVAR_NODEFAULT = 0x00000400, // don't reset on actor spawn
@ -41,7 +42,7 @@ enum GamevarFlags_t {
GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t
GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short
GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char
GAMEVAR_PTR_MASK = (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR), GAMEVAR_PTR_MASK = (GAMEVAR_INTPTR | GAMEVAR_SHORTPTR | GAMEVAR_CHARPTR),
GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars
GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets
@ -56,69 +57,67 @@ enum GamevarFlags_t {
# define MAXGAMEARRAYS (MAXGAMEVARS>>2) // must be strictly smaller than MAXGAMEVARS # define MAXGAMEARRAYS (MAXGAMEVARS>>2) // must be strictly smaller than MAXGAMEVARS
# define MAXARRAYLABEL MAXVARLABEL # define MAXARRAYLABEL MAXVARLABEL
enum GamearrayFlags_t { enum GamearrayFlags_t
{
GAMEARRAY_READONLY = 0x00001000, GAMEARRAY_READONLY = 0x00001000,
GAMEARRAY_WARN = 0x00002000, GAMEARRAY_WARN = 0x00002000,
GAMEARRAY_NORMAL = 0x00004000, GAMEARRAY_NORMAL = 0x00004000,
GAMEARRAY_OFCHAR = 0x00000001, GAMEARRAY_OFCHAR = 0x00000001,
GAMEARRAY_OFSHORT = 0x00000002, GAMEARRAY_OFSHORT = 0x00000002,
GAMEARRAY_OFINT = 0x00000004, GAMEARRAY_OFINT = 0x00000004,
GAMEARRAY_RESET = 0x00000008, GAMEARRAY_RESET = 0x00000008,
GAMEARRAY_TYPE_MASK = GAMEARRAY_OFCHAR|GAMEARRAY_OFSHORT|GAMEARRAY_OFINT, GAMEARRAY_TYPE_MASK = GAMEARRAY_OFCHAR | GAMEARRAY_OFSHORT | GAMEARRAY_OFINT,
GAMEARRAY_RESTORE = 0x00000010, GAMEARRAY_RESTORE = 0x00000010,
GAMEARRAY_VARSIZE = 0x00000020, GAMEARRAY_VARSIZE = 0x00000020,
GAMEARRAY_STRIDE2 = 0x00000100, GAMEARRAY_STRIDE2 = 0x00000100,
}; };
#pragma pack(push,1) #pragma pack(push,1)
typedef struct { typedef struct
{
union { union {
intptr_t lValue; intptr_t nValue;
intptr_t *plValues; // array of values when 'per-player', or 'per-actor' intptr_t *pValues; // array of values when 'per-player', or 'per-actor'
} val; };
intptr_t lDefault; intptr_t nDefault;
uintptr_t dwFlags; uintptr_t nFlags;
char *szLabel; char * szLabel;
} gamevar_t; } gamevar_t;
typedef struct { typedef struct
char *szLabel; {
intptr_t *plValues; // array of values char * szLabel;
intptr_t *pValues; // array of values
intptr_t size; intptr_t size;
intptr_t dwFlags; intptr_t nFlags;
} gamearray_t; } gamearray_t;
#pragma pack(pop) #pragma pack(pop)
# define GAR_ELTSZ (sizeof(aGameArrays[0].plValues[0])) # define GAR_ELTSZ (sizeof(aGameArrays[0].pValues[0]))
extern gamevar_t aGameVars[MAXGAMEVARS]; extern gamevar_t aGameVars[MAXGAMEVARS];
extern gamearray_t aGameArrays[MAXGAMEARRAYS]; extern gamearray_t aGameArrays[MAXGAMEARRAYS];
extern int32_t g_gameVarCount; extern int32_t g_gameVarCount;
extern int32_t g_gameArrayCount; extern int32_t g_gameArrayCount;
int32_t __fastcall Gv_GetGameArrayValue(register int32_t const id, register int32_t index); int32_t __fastcall Gv_GetGameArrayValue(int const id, int index);
int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer); int32_t __fastcall Gv_GetVar(int id, int nSprite, int nPlayer);
void __fastcall Gv_SetVar(int32_t const id, int32_t const lValue, int32_t const iActor, int32_t const iPlayer); void __fastcall Gv_SetVar(int const id, int32_t const lValue, int const nSprite, int const nPlayer);
int32_t __fastcall Gv_GetVarX(int32_t id); int32_t __fastcall Gv_GetVarX(int id);
void __fastcall Gv_GetManyVars(int32_t const count, int32_t * const rv); void __fastcall Gv_GetManyVars(int const count, int32_t * const rv);
void __fastcall Gv_SetVarX(int32_t const id, int32_t const lValue); void __fastcall Gv_SetVarX(int const id, int32_t const lValue);
int32_t Gv_GetVarByLabel(const char *szGameLabel,int32_t const lDefault,int32_t const iActor,int32_t const iPlayer); int32_t Gv_GetVarByLabel(const char *szGameLabel,int32_t const lDefault,int32_t const iActor,int32_t const iPlayer);
int32_t Gv_NewArray(const char *pszLabel,void *arrayptr,intptr_t asize,uint32_t dwFlags); int32_t Gv_NewArray(const char *pszLabel,void *arrayptr,intptr_t asize,uint32_t dwFlags);
int32_t Gv_NewVar(const char *pszLabel,intptr_t lValue,uint32_t dwFlags); int32_t Gv_NewVar(const char *pszLabel,intptr_t lValue,uint32_t dwFlags);
FORCE_INLINE void A_ResetVars(const int32_t iActor) FORCE_INLINE void A_ResetVars(int const nSprite)
{ {
for (int i = 0; i < g_gameVarCount; ++i) for (int i = 0; i < g_gameVarCount; ++i)
{ {
if ((aGameVars[i].dwFlags & (GAMEVAR_PERACTOR | GAMEVAR_NODEFAULT)) != GAMEVAR_PERACTOR) if ((aGameVars[i].nFlags & (GAMEVAR_PERACTOR | GAMEVAR_NODEFAULT)) != GAMEVAR_PERACTOR)
continue; continue;
aGameVars[i].val.plValues[iActor] = aGameVars[i].lDefault; aGameVars[i].pValues[nSprite] = aGameVars[i].nDefault;
} }
} }
@ -139,61 +138,61 @@ void Gv_FinalizeWeaponDefaults(void);
#if !defined LUNATIC #if !defined LUNATIC
#define VM_GAMEVAR_OPERATOR(func, operator) \ #define VM_GAMEVAR_OPERATOR(func, operator) \
FORCE_INLINE void __fastcall func(const int32_t id, const int32_t lValue) \ FORCE_INLINE void __fastcall func(int const id, int32_t const nValue) \
{ \ { \
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) \ switch (aGameVars[id].nFlags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) \
{ \ { \
default: aGameVars[id].val.lValue operator lValue; break; \ default: aGameVars[id].nValue operator nValue; break; \
case GAMEVAR_PERPLAYER: \ case GAMEVAR_PERPLAYER: \
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_p > MAXPLAYERS - 1)) \ if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_p > MAXPLAYERS - 1)) \
break; \ break; \
aGameVars[id].val.plValues[vm.g_p] operator lValue; \ aGameVars[id].pValues[vm.g_p] operator nValue; \
break; \ break; \
case GAMEVAR_PERACTOR: \ case GAMEVAR_PERACTOR: \
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_i > MAXSPRITES - 1)) \ if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_i > MAXSPRITES - 1)) \
break; \ break; \
aGameVars[id].val.plValues[vm.g_i] operator lValue; \ aGameVars[id].pValues[vm.g_i] operator nValue; \
break; \ break; \
case GAMEVAR_INTPTR: *((int32_t *)aGameVars[id].val.lValue) operator (int32_t) lValue; break; \ case GAMEVAR_INTPTR: *((int32_t *)aGameVars[id].nValue) operator(int32_t) nValue; break; \
case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[id].val.lValue) operator (int16_t) lValue; break; \ case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[id].nValue) operator(int16_t) nValue; break; \
case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[id].val.lValue) operator (uint8_t) lValue; break; \ case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[id].nValue) operator(uint8_t) nValue; break; \
} \ } \
} }
#if defined(__arm__) || defined(LIBDIVIDE_ALWAYS) #if defined(__arm__) || defined(LIBDIVIDE_ALWAYS)
FORCE_INLINE void __fastcall Gv_DivVar(const int32_t id, const int32_t lValue) FORCE_INLINE void __fastcall Gv_DivVar(int const id, int32_t const nValue)
{ {
if (EDUKE32_PREDICT_FALSE((aGameVars[id].dwFlags & GAMEVAR_PERPLAYER && (unsigned) vm.g_p > MAXPLAYERS - 1) || if (EDUKE32_PREDICT_FALSE((aGameVars[id].nFlags & GAMEVAR_PERPLAYER && (unsigned) vm.g_p > MAXPLAYERS - 1) ||
(aGameVars[id].dwFlags & GAMEVAR_PERACTOR && (unsigned) vm.g_i > MAXSPRITES - 1))) (aGameVars[id].nFlags & GAMEVAR_PERACTOR && (unsigned) vm.g_i > MAXSPRITES - 1)))
return; return;
static libdivide_s32_t sdiv; static libdivide_s32_t sdiv;
static int32_t lastlValue; static int32_t nLastValue;
libdivide_s32_t *dptr = ((unsigned) lValue < DIVTABLESIZE) ? (libdivide_s32_t *) &divtable32[lValue] : &sdiv; libdivide_s32_t *dptr = ((unsigned) nValue < DIVTABLESIZE) ? (libdivide_s32_t *) &divtable32[nValue] : &sdiv;
intptr_t *iptr = &aGameVars[id].val.lValue; intptr_t *iptr = &aGameVars[id].nValue;
if (lValue == lastlValue || dptr != &sdiv) if (nValue == nLastValue || dptr != &sdiv)
goto skip; goto skip;
sdiv = libdivide_s32_gen((lastlValue = lValue)); sdiv = libdivide_s32_gen((nLastValue = nValue));
skip: skip:
switch (aGameVars[id].dwFlags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) switch (aGameVars[id].nFlags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK))
{ {
case GAMEVAR_PERPLAYER: iptr = &aGameVars[id].val.plValues[vm.g_p]; case GAMEVAR_PERPLAYER: iptr = &aGameVars[id].pValues[vm.g_p];
default: break; default: break;
case GAMEVAR_PERACTOR: iptr = &aGameVars[id].val.plValues[vm.g_i]; break; case GAMEVAR_PERACTOR: iptr = &aGameVars[id].pValues[vm.g_i]; break;
case GAMEVAR_INTPTR: case GAMEVAR_INTPTR:
*((int32_t *)aGameVars[id].val.lValue) = *((int32_t *)aGameVars[id].nValue) =
(int32_t)libdivide_s32_do(*((int32_t *)aGameVars[id].val.lValue), dptr); (int32_t)libdivide_s32_do(*((int32_t *)aGameVars[id].nValue), dptr);
return; return;
case GAMEVAR_SHORTPTR: case GAMEVAR_SHORTPTR:
*((int16_t *)aGameVars[id].val.lValue) = *((int16_t *)aGameVars[id].nValue) =
(int16_t)libdivide_s32_do(*((int16_t *)aGameVars[id].val.lValue), dptr); (int16_t)libdivide_s32_do(*((int16_t *)aGameVars[id].nValue), dptr);
return; return;
case GAMEVAR_CHARPTR: case GAMEVAR_CHARPTR:
*((uint8_t *)aGameVars[id].val.lValue) = *((uint8_t *)aGameVars[id].nValue) =
(uint8_t)libdivide_s32_do(*((uint8_t *)aGameVars[id].val.lValue), dptr); (uint8_t)libdivide_s32_do(*((uint8_t *)aGameVars[id].nValue), dptr);
return; return;
} }

View file

@ -258,9 +258,9 @@ static int32_t A_FindTargetSprite(const spritetype *s, int32_t aang, int32_t atw
break; break;
for (i=headspritestat[aimstats[k]]; i >= 0; i=nextspritestat[i]) for (i=headspritestat[aimstats[k]]; i >= 0; i=nextspritestat[i])
if (sprite[i].xrepeat > 0 && sprite[i].extra >= 0 && (sprite[i].cstat&(257+32768)) == 257) if (sprite[i].xrepeat > 0 && sprite[i].extra >= 0 && (sprite[i].cstat&(257+32768)) == 257)
if (A_CheckEnemySprite((uspritetype *)&sprite[i]) || k < 2) if (A_CheckEnemySprite(&sprite[i]) || k < 2)
{ {
if (A_CheckEnemySprite((uspritetype *)&sprite[i]) || PN == APLAYER || PN == SHARK) if (A_CheckEnemySprite(&sprite[i]) || PN == APLAYER || PN == SHARK)
{ {
if (PN == APLAYER && s->picnum == APLAYER && s != &sprite[i] && if (PN == APLAYER && s->picnum == APLAYER && s != &sprite[i] &&
// ud.ffire == 0 && // ud.ffire == 0 &&
@ -978,7 +978,7 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
l = safeldist(g_player[j].ps->i, s); l = safeldist(g_player[j].ps->i, s);
zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect->z)*vel, l); zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect->z)*vel, l);
if (A_CheckEnemySprite((uspritetype *)s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart)) if (A_CheckEnemySprite(s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart))
sa = s->ang + (krand() & 31) - 16; sa = s->ang + (krand() & 31) - 16;
} }
} }
@ -1386,7 +1386,7 @@ static int32_t A_ShootHardcoded(int32_t i, int32_t atwith, int16_t sa, vec3_t sr
l = safeldist(g_player[j].ps->i, s); l = safeldist(g_player[j].ps->i, s);
zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect.z)*vel, l); zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect.z)*vel, l);
if (A_CheckEnemySprite((uspritetype *)s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart)) if (A_CheckEnemySprite(s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart))
sa = s->ang+(krand()&31)-16; sa = s->ang+(krand()&31)-16;
} }
@ -1636,7 +1636,7 @@ int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
{ {
srcvect.z -= (7<<8); srcvect.z -= (7<<8);
if (A_CheckEnemySprite((uspritetype *)s) && PN != COMMANDER) if (A_CheckEnemySprite(s) && PN != COMMANDER)
{ {
srcvect.x += (sintable[(sa+1024+96)&2047]>>7); srcvect.x += (sintable[(sa+1024+96)&2047]>>7);
srcvect.y += (sintable[(sa+512+96)&2047]>>7); srcvect.y += (sintable[(sa+512+96)&2047]>>7);
@ -3753,8 +3753,8 @@ void P_FragPlayer(int32_t snum)
{ {
P_PalFrom(p, 63, 63,0,0); P_PalFrom(p, 63, 63,0,0);
p->pos.z -= (16<<8); p->pos.z -= ZOFFSET2;
s->z -= (16<<8); s->z -= ZOFFSET2;
p->dead_flag = (512-((krand()&1)<<10)+(krand()&255)-512)&2047; p->dead_flag = (512-((krand()&1)<<10)+(krand()&255)-512)&2047;
if (p->dead_flag == 0) if (p->dead_flag == 0)
@ -4531,7 +4531,7 @@ void P_ProcessInput(int32_t snum)
truefdist = klabs(p->pos.z-j); truefdist = klabs(p->pos.z-j);
if ((lz&49152) == 16384 && psectlotag == 1 && truefdist > PHEIGHT+(16<<8)) if ((lz&49152) == 16384 && psectlotag == 1 && truefdist > PHEIGHT+ZOFFSET2)
psectlotag = 0; psectlotag = 0;
actor[p->i].floorz = fz; actor[p->i].floorz = fz;
@ -4587,7 +4587,7 @@ void P_ProcessInput(int32_t snum)
p->sbs = j; p->sbs = j;
} }
} }
else if (A_CheckEnemySprite((uspritetype *)&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8)) else if (A_CheckEnemySprite(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8))
{ {
// TX: I think this is what makes the player slide off enemies... might // TX: I think this is what makes the player slide off enemies... might
// be a good sprite flag to add later. // be a good sprite flag to add later.
@ -4707,7 +4707,7 @@ void P_ProcessInput(int32_t snum)
pushmove((vec3_t *)p,&p->cursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0); pushmove((vec3_t *)p,&p->cursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0);
if (fz > cz+(16<<8) && s->pal != 1) if (fz > cz+ZOFFSET2 && s->pal != 1)
p->rotscrnang = (p->dead_flag + ((fz+p->pos.z)>>7))&2047; p->rotscrnang = (p->dead_flag + ((fz+p->pos.z)>>7))&2047;
p->on_warping_sector = 0; p->on_warping_sector = 0;
@ -5024,7 +5024,7 @@ void P_ProcessInput(int32_t snum)
// not jumping or crouching // not jumping or crouching
if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && !TEST_SYNC_KEY(sb_snum, SK_CROUCH) && if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && !TEST_SYNC_KEY(sb_snum, SK_CROUCH) &&
p->on_ground && (sector[p->cursectnum].floorstat&2) && p->pos.z >= (fz-(i<<8)-(16<<8))) p->on_ground && (sector[p->cursectnum].floorstat&2) && p->pos.z >= (fz-(i<<8)-ZOFFSET2))
p->pos.z = fz-(i<<8); p->pos.z = fz-(i<<8);
else else
{ {
@ -5100,9 +5100,9 @@ void P_ProcessInput(int32_t snum)
else if (p->jumping_counter == 0) else if (p->jumping_counter == 0)
{ {
p->pos.z += ((fz-(i<<7))-p->pos.z)>>1; //Smooth on the water p->pos.z += ((fz-(i<<7))-p->pos.z)>>1; //Smooth on the water
if (p->on_warping_sector == 0 && p->pos.z > fz-(16<<8)) if (p->on_warping_sector == 0 && p->pos.z > fz-ZOFFSET2)
{ {
p->pos.z = fz-(16<<8); p->pos.z = fz-ZOFFSET2;
p->vel.z >>= 1; p->vel.z >>= 1;
} }
} }
@ -5220,7 +5220,7 @@ void P_ProcessInput(int32_t snum)
} }
} }
if (p->on_ground && truefdist <= PHEIGHT+(16<<8) && P_CheckFloorDamage(p, j)) if (p->on_ground && truefdist <= PHEIGHT+ZOFFSET2 && P_CheckFloorDamage(p, j))
{ {
P_DoQuote(QUOTE_BOOTS_ON, p); P_DoQuote(QUOTE_BOOTS_ON, p);
p->inv_amount[GET_BOOTS] -= 2; p->inv_amount[GET_BOOTS] -= 2;
@ -5567,7 +5567,7 @@ HORIZONLY:
break; break;
} }
default: default:
if (A_CheckEnemySprite((uspritetype *)&sprite[p->actorsqu])) if (A_CheckEnemySprite(&sprite[p->actorsqu]))
p->actors_killed++; p->actors_killed++;
A_DeleteSprite(p->actorsqu); A_DeleteSprite(p->actorsqu);
break; break;

View file

@ -71,7 +71,7 @@ static void G_CacheSpriteNum(int32_t i)
char maxc; char maxc;
int32_t j; int32_t j;
if (ud.monsters_off && A_CheckEnemySprite((uspritetype *)&sprite[i])) return; if (ud.monsters_off && A_CheckEnemySprite(&sprite[i])) return;
maxc = 1; maxc = 1;
@ -2039,8 +2039,8 @@ void G_FreeMapState(int32_t mapnum)
#if !defined LUNATIC #if !defined LUNATIC
for (j=0; j<g_gameVarCount; j++) for (j=0; j<g_gameVarCount; j++)
{ {
if (aGameVars[j].dwFlags & GAMEVAR_NORESET) continue; if (aGameVars[j].nFlags & GAMEVAR_NORESET) continue;
if (aGameVars[j].dwFlags & (GAMEVAR_PERPLAYER|GAMEVAR_PERACTOR)) if (aGameVars[j].nFlags & (GAMEVAR_PERPLAYER|GAMEVAR_PERACTOR))
Baligned_free(mapinfo->savedstate->vars[j]); Baligned_free(mapinfo->savedstate->vars[j]);
} }
#else #else

View file

@ -1196,10 +1196,10 @@ static void sv_makevarspec()
int32_t i, j, numsavedvars=0, numsavedarrays=0, per; int32_t i, j, numsavedvars=0, numsavedarrays=0, per;
for (i=0; i<g_gameVarCount; i++) for (i=0; i<g_gameVarCount; i++)
numsavedvars += (aGameVars[i].dwFlags&SV_SKIPMASK) ? 0 : 1; numsavedvars += (aGameVars[i].nFlags&SV_SKIPMASK) ? 0 : 1;
for (i=0; i<g_gameArrayCount; i++) for (i=0; i<g_gameArrayCount; i++)
numsavedarrays += !(aGameArrays[i].dwFlags & GAMEARRAY_READONLY); // SYSTEM_GAMEARRAY numsavedarrays += !(aGameArrays[i].nFlags & GAMEARRAY_READONLY); // SYSTEM_GAMEARRAY
Bfree(svgm_vars); Bfree(svgm_vars);
svgm_vars = (dataspec_gv_t *)Xmalloc((numsavedvars+numsavedarrays+2)*sizeof(dataspec_gv_t)); svgm_vars = (dataspec_gv_t *)Xmalloc((numsavedvars+numsavedarrays+2)*sizeof(dataspec_gv_t));
@ -1211,13 +1211,13 @@ static void sv_makevarspec()
j=1; j=1;
for (i=0; i<g_gameVarCount; i++) for (i=0; i<g_gameVarCount; i++)
{ {
if (aGameVars[i].dwFlags&SV_SKIPMASK) if (aGameVars[i].nFlags&SV_SKIPMASK)
continue; continue;
per = aGameVars[i].dwFlags&GAMEVAR_USER_MASK; per = aGameVars[i].nFlags&GAMEVAR_USER_MASK;
svgm_vars[j].flags = 0; svgm_vars[j].flags = 0;
svgm_vars[j].ptr = (per==0) ? &aGameVars[i].val.lValue : aGameVars[i].val.plValues; svgm_vars[j].ptr = (per==0) ? &aGameVars[i].nValue : aGameVars[i].pValues;
svgm_vars[j].size = sizeof(intptr_t); svgm_vars[j].size = sizeof(intptr_t);
svgm_vars[j].cnt = (per==0) ? 1 : (per==GAMEVAR_PERPLAYER ? MAXPLAYERS : MAXSPRITES); svgm_vars[j].cnt = (per==0) ? 1 : (per==GAMEVAR_PERPLAYER ? MAXPLAYERS : MAXSPRITES);
j++; j++;
@ -1228,13 +1228,13 @@ static void sv_makevarspec()
// We must not update read-only SYSTEM_GAMEARRAY gamearrays: besides // We must not update read-only SYSTEM_GAMEARRAY gamearrays: besides
// being questionable by itself, sizeof(...) may be e.g. 4 whereas the // being questionable by itself, sizeof(...) may be e.g. 4 whereas the
// actual element type is int16_t (such as tilesizx[]/tilesizy[]). // actual element type is int16_t (such as tilesizx[]/tilesizy[]).
if (aGameArrays[i].dwFlags & GAMEARRAY_READONLY) if (aGameArrays[i].nFlags & GAMEARRAY_READONLY)
continue; continue;
intptr_t * const plValues = aGameArrays[i].plValues; intptr_t * const plValues = aGameArrays[i].pValues;
svgm_vars[j].flags = 0; svgm_vars[j].flags = 0;
svgm_vars[j].ptr = plValues; svgm_vars[j].ptr = plValues;
svgm_vars[j].size = plValues == NULL ? 0 : sizeof(aGameArrays[0].plValues[0]); svgm_vars[j].size = plValues == NULL ? 0 : sizeof(aGameArrays[0].pValues[0]);
svgm_vars[j].cnt = aGameArrays[i].size; // assumed constant throughout demo, i.e. no RESIZEARRAY svgm_vars[j].cnt = aGameArrays[i].size; // assumed constant throughout demo, i.e. no RESIZEARRAY
j++; j++;
} }

File diff suppressed because it is too large Load diff

View file

@ -124,18 +124,18 @@ void G_AnimateWalls(void);
int32_t G_ActivateWarpElevators(int32_t s,int32_t d); int32_t G_ActivateWarpElevators(int32_t s,int32_t d);
int32_t G_CheckActivatorMotion(int32_t lotag); int32_t G_CheckActivatorMotion(int32_t lotag);
void G_DoSectorAnimations(void); void G_DoSectorAnimations(void);
void G_OperateActivators(int32_t low,int32_t snum); void G_OperateActivators(int nTag, int nPlayer);
void G_OperateForceFields(int32_t s,int32_t low); void G_OperateForceFields(int32_t s,int32_t low);
void G_OperateMasterSwitches(int32_t low); void G_OperateMasterSwitches(int nTag);
void G_OperateRespawns(int32_t low); void G_OperateRespawns(int32_t low);
void G_OperateSectors(int32_t sn,int32_t ii); void G_OperateSectors(int32_t sn,int32_t ii);
void P_HandleSharedKeys(int32_t snum); void P_HandleSharedKeys(int32_t snum);
int32_t GetAnimationGoal(const int32_t *animptr); int32_t GetAnimationGoal(const int32_t *animptr);
int32_t isanearoperator(int32_t lotag); int32_t isanearoperator(int32_t lotag);
int32_t isanunderoperator(int32_t lotag); int32_t isanunderoperator(int32_t lotag);
int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite); int P_ActivateSwitch(int nPlayer, int nObject, int nSwitchType);
void P_CheckSectors(int32_t snum); void P_CheckSectors(int32_t snum);
int32_t Sect_DamageCeilingOrFloor(int32_t floorp, int32_t sn); int Sect_DamageCeilingOrFloor(int nDmgFloor, int const nSectnum);
int32_t SetAnimation(int32_t animsect,int32_t *animptr,int32_t thegoal,int32_t thevel); int32_t SetAnimation(int32_t animsect,int32_t *animptr,int32_t thegoal,int32_t thevel);
#define FORCEFIELD_CSTAT (64+16+4+1) #define FORCEFIELD_CSTAT (64+16+4+1)