- more header cleanup.

This commit is contained in:
Christoph Oelckers 2020-07-06 16:24:22 +02:00
parent a4879fb338
commit f1babcee95
8 changed files with 29 additions and 136 deletions

View file

@ -76,6 +76,7 @@ void alterang(int a, int g_i, int g_p);
void fall_common(int g_i, int g_p, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(int, int), void (*falladjustz)(spritetype*));
void checkavailweapon(struct player_struct* p);
void deletesprite(int num);
void addammo(int weapon, struct player_struct* p, int amount);
int ssp(int i, unsigned int cliptype); //The set sprite function
void insertspriteq(int i);

View file

@ -84,7 +84,7 @@ void deletesprite(int num)
//
//---------------------------------------------------------------------------
void addammo(short weapon, struct player_struct* p, short amount)
void addammo(int weapon, struct player_struct* p, int amount)
{
p->ammo_amount[weapon] += amount;

View file

@ -40,6 +40,29 @@ source as it is released.
BEGIN_DUKE_NS
// Player Actions - used by ifp instruction.
enum playeraction_t {
pstanding = 0x00000001,
pwalking = 0x00000002,
prunning = 0x00000004,
pducking = 0x00000008,
pfalling = 0x00000010,
pjumping = 0x00000020,
phigher = 0x00000040,
pwalkingback = 0x00000080,
prunningback = 0x00000100,
pkicking = 0x00000200,
pshrunk = 0x00000400,
pjetpack = 0x00000800,
ponsteroids = 0x00001000,
ponground = 0x00002000,
palive = 0x00004000,
pdead = 0x00008000,
pfacing = 0x00010000
};
// curse these global variables for parameter passing...
static int g_i, g_p;
static int g_x;

View file

@ -86,34 +86,6 @@ inline bool AFLAMABLE(int X)
#define CSTAT_SPRITE_NOSHADE BIT(11)
#define CSTAT_SPRITE_BREAKABLE (CSTAT_SPRITE_BLOCK_HITSCAN)
#define SP(i) sprite[i].yvel
#define SX(i) sprite[i].x
#define SY(i) sprite[i].y
#define SZ(i) sprite[i].z
#define SS(i) sprite[i].shade
#define PN(i) sprite[i].picnum
#define SA(i) sprite[i].ang
//#define SV sprite[i].xvel
//#define ZV sprite[i].zvel
//#define RX sprite[i].xrepeat
//#define RY sprite[i].yrepeat
#define OW(i) sprite[i].owner
#define CS(i) sprite[i].cstat
#define SH(i) sprite[i].extra
//#define CX sprite[i].xoffset
//#define CY sprite[i].yoffset
//#define CD sprite[i].clipdist
//#define PL sprite[i].pal
#define SLT(i) sprite[i].lotag
#define SHT(i) sprite[i].hitag
#define SECT(i) sprite[i].sectnum
#define T1(i) actor[i].t_data[0]
#define T2(i) actor[i].t_data[1]
#define T3(i) actor[i].t_data[2]
#define T4(i) actor[i].t_data[3]
#define T5(i) actor[i].t_data[4]
#define T6(i) actor[i].t_data[5]
END_DUKE_NS

View file

@ -44,8 +44,7 @@ extern int32_t PHEIGHT;
enum
{
PIPEBOMB_REMOTE = 0x00000001,
PIPEBOMB_TIMER = 0x00000002,
// Control flags for WW2GI weapons.
TRIPBOMB_TRIPWIRE = 1,
TRIPBOMB_TIMER = 2
};
@ -58,24 +57,6 @@ enum
#define MAX_WEAPON_RECS 256
enum weaponflags_t {
WEAPON_SPAWNTYPE1 = 0x00000000, // just spawn
WEAPON_HOLSTER_CLEARS_CLIP = 0x00000001, // 'holstering' clears the current clip
WEAPON_GLOWS = 0x00000002, // weapon 'glows' (shrinker and grower)
WEAPON_AUTOMATIC = 0x00000004, // automatic fire (continues while 'fire' is held down
WEAPON_FIREEVERYOTHER = 0x00000008, // during 'hold time' fire every frame
WEAPON_FIREEVERYTHIRD = 0x00000010, // during 'hold time' fire every third frame
WEAPON_RANDOMRESTART = 0x00000020, // restart for automatic is 'randomized' by RND 3
WEAPON_AMMOPERSHOT = 0x00000040, // uses ammo for each shot (for automatic)
WEAPON_BOMB_TRIGGER = 0x00000080, // weapon is the 'bomb' trigger
WEAPON_NOVISIBLE = 0x00000100, // weapon use does not cause user to become 'visible'
WEAPON_THROWIT = 0x00000200, // weapon 'throws' the 'shoots' item...
WEAPON_CHECKATRELOAD = 0x00000400, // check weapon availability at 'reload' time
WEAPON_STANDSTILL = 0x00000800, // player stops jumping before actual fire (like tripbomb in duke)
WEAPON_SPAWNTYPE2 = 0x00001000, // spawn like shotgun shells
WEAPON_SPAWNTYPE3 = 0x00002000, // spawn like chaingun shells
};
enum gamemode_t {
MODE_MENU = 0x00000001,
MODE_DEMO = 0x00000002,
@ -86,27 +67,6 @@ enum gamemode_t {
MODE_SENDTOWHOM = 0x00000040,
};
// Player Actions.
enum playeraction_t {
pstanding = 0x00000001,
pwalking = 0x00000002,
prunning = 0x00000004,
pducking = 0x00000008,
pfalling = 0x00000010,
pjumping = 0x00000020,
phigher = 0x00000040,
pwalkingback = 0x00000080,
prunningback = 0x00000100,
pkicking = 0x00000200,
pshrunk = 0x00000400,
pjetpack = 0x00000800,
ponsteroids = 0x00001000,
ponground = 0x00002000,
palive = 0x00004000,
pdead = 0x00008000,
pfacing = 0x00010000
};
typedef struct {
union
{
@ -349,12 +309,7 @@ typedef struct
int32_t FlashColor; // Muzzle flash color
} weapondata_t;
#ifdef LUNATIC
# define PWEAPON(Player, Weapon, Wmember) (g_playerWeapon[Player][Weapon].Wmember)
extern weapondata_t g_playerWeapon[MAXPLAYERS][MAX_WEAPONS];
#else
# define PWEAPON(Player, Weapon, Wmember) (aplWeapon ## Wmember [Weapon][Player])
#endif
// KEEPINSYNC lunatic/_defs_game.lua
typedef struct {
@ -369,15 +324,6 @@ extern playerdata_t *const g_player;
extern hudweapon_t hudweap;
extern int32_t mouseyaxismode;
#define SHOOT_HARDCODED_ZVEL INT32_MIN
static inline void P_PalFrom(DukePlayer_t *pPlayer, uint8_t f, uint8_t r, uint8_t g, uint8_t b)
{
pPlayer->pals.f = f;
pPlayer->pals.r = r;
pPlayer->pals.g = g;
pPlayer->pals.b = b;
}
inline void SetPlayerPal(DukePlayer_t* pPlayer, PalEntry pe)
{
@ -392,38 +338,15 @@ int hits(int spriteNum);
void P_GetInput(int playerNum);
void P_GetInputMotorcycle(int playerNum);
void P_GetInputBoat(int playerNum);
void P_AddAmmo(DukePlayer_t * pPlayer, int weaponNum, int addAmount);
inline void addammo(int weaponNum, DukePlayer_t* pPlayer, int addAmount)
{
P_AddAmmo(pPlayer, weaponNum, addAmount);
}
void P_CheckWeapon(DukePlayer_t *pPlayer);
void P_DisplayWeapon(void);
void checkweapons(DukePlayer_t* const pPlayer);
int findotherplayer(int p, int* d);
void P_FragPlayer(int playerNum);
void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer);
void P_ProcessInput(int playerNum);
void P_DHProcessInput(int playerNum);
void quickkill(DukePlayer_t* pPlayer);
void setpal(DukePlayer_t* pPlayer);
void P_EndLevel(void);
void P_CheckWeaponI(int playerNum);
int madenoise(int playerNum);
int haskey(int sect, int snum);
// Get the player index given an TILE_APLAYER sprite pointer.
static inline int P_GetP(const void *pSprite)
{
return ((const uspritetype*)pSprite)->yvel;
}
// Get the player index given an TILE_APLAYER sprite index.
static inline int P_Get(int32_t spriteNum) { return P_GetP((const uspritetype *)&sprite[spriteNum]); }
extern int16_t max_ammo_amount[MAX_WEAPONS];
void P_SetWeaponGamevars(int playerNum, const DukePlayer_t* const pPlayer);
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n);
int hits(int i);
int hitasprite(int i, short* hitsp);

View file

@ -508,7 +508,7 @@ void S_StopEnvSound(int sndNum, int sprNum, int channel)
else soundEngine->StopSound(SOURCE_Actor, &sprite[sprNum], channel, -1);
// StopSound kills the actor reference so this cannot be delayed until ChannelEnded gets called. At that point the actor may also not be valid anymore.
if (S_IsAmbientSFX(sprNum) && sector[SECT(sprNum)].lotag < 3) // ST_2_UNDERWATER
if (S_IsAmbientSFX(sprNum) && sector[sprite[sprNum].sectnum].lotag < 3) // ST_2_UNDERWATER
actor[sprNum].t_data[0] = 0;
}
}

View file

@ -806,30 +806,4 @@ void P_GetInputBoat(int playerNum)
localInput.fvel = clamp((input.fvel += pPlayer->MotoSpeed), -(MAXVELMOTO / 8), MAXVELMOTO);
}
void P_AddAmmo(DukePlayer_t * const pPlayer, int const weaponNum, int const addAmount)
{
pPlayer->ammo_amount[weaponNum] += addAmount;
if (pPlayer->ammo_amount[weaponNum] > max_ammo_amount[weaponNum])
pPlayer->ammo_amount[weaponNum] = max_ammo_amount[weaponNum];
}
void P_CheckWeapon(DukePlayer_t *pPlayer)
{
checkavailweapon(pPlayer);
}
void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer)
{
int const newOwner = pPlayer->newowner;
pPlayer->pos = *(vec3_t *)&sprite[newOwner];
pPlayer->q16ang = fix16_from_int(SA(newOwner));
pPlayer->vel.x = 0;
pPlayer->vel.y = 0;
sprite[pPlayer->i].xvel = 0;
pPlayer->look_ang = 0;
pPlayer->rotscrnang = 0;
}
END_DUKE_NS

View file

@ -1419,8 +1419,8 @@ static void postloadplayer(int32_t savegamep)
for (SPRITES_OF(STAT_FX, i))
if (sprite[i].picnum == MUSICANDSFX)
{
T2(i) = SoundEnabled();
T1(i) = 0;
hittype[i].temp_data[1] = SoundEnabled();
hittype[i].temp_data[0] = 0;
}
FX_SetReverb(0);