- started consolidating the struct types.h

This commit is contained in:
Christoph Oelckers 2020-07-06 23:24:35 +02:00
parent 642ae03d90
commit e8ebeefaad
17 changed files with 222 additions and 251 deletions

View file

@ -1,6 +1,8 @@
#pragma once
#include "tflags.h"
// all game constants got collected here.
// Most of these should be replaced by CCMDs eventually
enum GameFunction_t
{
@ -504,3 +506,10 @@ enum
ZOFFSET6 = (4 << 8),
FOURSLEIGHT = (1 << 8)
};
enum
{
// Control flags for WW2GI weapons.
TRIPBOMB_TRIPWIRE = 1,
TRIPBOMB_TIMER = 2
};

View file

@ -138,6 +138,8 @@ bool isanunderoperator(int lotag);
int setanimation(short animsect, int* animptr, int thegoal, int thevel);
void dofurniture(int wallNum, int sectNum, int playerNum);
void dotorch();
int hitawall(struct player_struct* pPlayer, int* hitWall);
int hits(int spriteNum);
void clearsectinterpolate(int sprnum);
void setsectinterpolate(int sprnum);

View file

@ -34,28 +34,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "cmdlib.h"
#include "screenjob.h"
#include "constants.h"
#include "types.h"
BEGIN_DUKE_NS
struct weaponhit
{
uint8_t cgg;
short picnum, ang, extra, owner, movflag;
short tempang, actorstayput, dispicnum;
short timetosleep;
int floorz, ceilingz, lastvx, lastvy, bposx, bposy, bposz, aflags;
int temp_data[6];
};
// Todo - put more state in here
struct ActorInfo
{
uint32_t scriptaddress;
uint32_t flags;
int aimoffset;
};
typedef struct {
vec3_t camerapos;
@ -143,11 +125,11 @@ void G_HandleLocalKeys(void);
void G_UpdatePlayerFromMenu(void);
void FTA(int q, struct player_struct* p);
void P_SetGamePalette(DukePlayer_t* player, uint32_t palid, ESetPalFlags flags);
void OnMotorcycle(DukePlayer_t *pPlayer, int spriteNum);
void OffMotorcycle(DukePlayer_t *pPlayer);
void OnBoat(DukePlayer_t *pPlayer, int spriteNum);
void OffBoat(DukePlayer_t *pPlayer);
void P_SetGamePalette(player_struct* player, uint32_t palid, ESetPalFlags flags);
void OnMotorcycle(player_struct *pPlayer, int spriteNum);
void OffMotorcycle(player_struct *pPlayer);
void OnBoat(player_struct *pPlayer, int spriteNum);
void OffBoat(player_struct *pPlayer);
void G_InitTimer(int32_t ticspersec);

View file

@ -77,7 +77,7 @@ void fakebubbaspawn(int g_i, int g_p);
void tearitup(int sect);
void destroyit(int g_i);
void mamaspawn(int g_i);
void forceplayerangle(DukePlayer_t* p);
void forceplayerangle(struct player_struct* p);
static bool killthesprite = false;
void addspritetodelete(int spnum)

View file

@ -305,7 +305,7 @@ void dointerpolations(int smoothratio);
// Hack struct to allow old code to access the EDuke-style player data without changing it.
struct psaccess
{
DukePlayer_t& operator[](int index)
struct player_struct& operator[](int index)
{
return *g_player[index].ps;
}

View file

@ -152,6 +152,10 @@ inline void clearfriction()
}
}
inline void SetPlayerPal(player_struct* p, PalEntry pe)
{
p->pals = pe;
}
//---------------------------------------------------------------------------
//

View file

@ -42,15 +42,6 @@ extern int32_t playerswhenstarted;
#define PHEIGHT_RR (40<<8);
extern int32_t PHEIGHT;
enum
{
// Control flags for WW2GI weapons.
TRIPBOMB_TRIPWIRE = 1,
TRIPBOMB_TIMER = 2
};
#define WEAPON_POS_LOWER -9
#define WEAPON_POS_RAISE 10
#define WEAPON_POS_START 6
@ -85,23 +76,6 @@ typedef struct {
};
} playerspawn_t;
typedef struct STATUSBARTYPE {
int16_t firstaid_amount;
int16_t steroids_amount;
int16_t holoduke_amount;
int16_t jetpack_amount;
int16_t heat_amount;
int16_t scuba_amount;
int16_t boot_amount;
int16_t shield_amount;
int16_t got_access, last_extra, curr_weapon, holoduke_on;
int16_t last_weapon, weapon_pos, kickback_pic;
int16_t ammo_amount[MAX_WEAPONS], frag[MAXPLAYERS];
FixedBitArray<MAX_WEAPONS> gotweapon;
char inven_icon, jetpack_on, heat_on;
} DukeStatus_t;
typedef struct {
ESyncBits bits;
int16_t fvel, svel;
@ -110,144 +84,11 @@ typedef struct {
#pragma pack(push,1)
typedef struct player_struct
{
// This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze.
// The sound code wants to read a vector out of this so we need to define one for the main coordinate.
union
{
vec3_t pos;
struct { int32_t posx, posy, posz; };
};
// input handles angle and horizon as fixed16 numbers. We need to account for that as well.
fixed_t q16ang, oq16ang, q16horiz, q16horizoff; // oq16horiz, oq16horizoff; // These two are currently not used but may be again later.
// using a bit field for this to save a bit of space.
FixedBitArray<MAX_WEAPONS> gotweapon;
// Palette management uses indices into the engine's palette table now.
unsigned int palette;
PalEntry pals;
// these did not exist in JFDuke.
uint8_t movement_lock;
vec2_t fric;
// From here on it is unaltered from JFDuke with the exception of a few fields that are no longer needed and were removed.
int zoom, exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt;
int invdisptime;
int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff;
int posxv, posyv, poszv, last_pissed_time, truefz, truecz;
int player_par, visibility;
int bobcounter, weapon_sway;
int pals_time, randomflamex, crack_time;
int aim_mode, auto_aim, weaponswitch;
short angvel, cursectnum, look_ang, last_extra, subweapon;
short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself;
short curr_weapon, last_weapon, tipincs, wantweaponfire;
short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay;
short jumping_counter, airleft, knee_incs, access_incs;
short ftq, access_wallnum, access_spritenum;
short kickback_pic, got_access, weapon_ang, firstaid_amount;
short somethingonplayer, on_crane, i, one_parallax_sectnum;
short over_shoulder_on, random_club_frame, fist_incs;
short one_eighty_count, cheat_phase;
short dummyplayersprite, extra_extra8, quick_kick;
short heat_amount, actorsqu, timebeforeexit, customexitsound;
short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag;
short orotscrnang, rotscrnang, dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang
short scuba_amount, jetpack_amount, steroids_amount, shield_amount;
short holoduke_on, pycount, weapon_pos, frag_ps;
short transporter_hold, last_full_weapon, footprintshade, boot_amount;
int scream_voice;
unsigned char gm;
unsigned char on_warping_sector, footprintcount;
unsigned char hbomb_on, jumping_toggle, rapid_fire_hold, on_ground;
char name[32];
unsigned char inven_icon, buttonpalette;
unsigned char jetpack_on, spritebridge, lastrandomspot;
unsigned char scuba_on, footprintpal, heat_on;
unsigned char holster_weapon;
unsigned char falling_counter;
unsigned char refresh_inventory;
unsigned char toggle_key_flag, knuckle_incs; // ,select_dir;
unsigned char walking_snd_toggle, palookup, hard_landing;
unsigned char return_to_center;
int max_secret_rooms, secret_rooms, max_actors_killed, actors_killed;
// Redneck Rampage additions. Those which did not have names in the reconstructed source got one from either RedneckGDX or RedNukem.
// Items were reordered by size.
int stairs;
int detonate_count; // at57e
int noise_x, noise_y, noise_radius; // at286, at28a, at290
int drink_timer; // at58e
int eat_timer; // at592
int SlotWin;
short recoil;
short detonate_time; // at57c
short yehaa_timer;
short drink_amt, eat, drunkang, eatang;
uint8_t shotgun_state[2];
uint8_t donoise; // at28e
uint8_t keys[5];
// RRRA. The same as for the RR block applies.
int drug_aspect;
int drug_timer;
int SeaSick;
short MamaEnd; // raat609
short MotoSpeed, TiltStatus, moto_drink;
short VBumpNow, VBumpTarget, TurbCount;
short drug_stat[3]; // raat5f1..5
uint8_t DrugMode, lotag800kill;
uint8_t sea_sick_stat; // raat5dd
uint8_t hurt_delay2, nocheat;
uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround;
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
int8_t crouch_toggle;
// Access helpers for the widened angle and horizon fields.
int getlookang() { return look_ang; }
void setlookang(int b) { look_ang = b; }
void addlookang(int b) { look_ang += b; }
int getrotscrnang() { return rotscrnang; }
void setrotscrnang(int b) { rotscrnang = b; }
void addrotscrnang(int b) { rotscrnang += b; }
int getang() { return q16ang >> FRACBITS; }
int getoang() { return oq16ang >> FRACBITS; }
void setang(int v) { q16ang = v << FRACBITS; }
void addang(int v) { q16ang = (q16ang + (v << FRACBITS)) & ((2048 << FRACBITS) - 1); }
void setoang(int v) { oq16ang = v << FRACBITS; }
void addhoriz(int v) { q16horiz += (v << FRACBITS); }
void addhorizoff(int v) { q16horiz += (v << FRACBITS); }
void sethoriz(int v) { q16horiz = (v << FRACBITS); }
void sethorizoff(int v) { q16horizoff = (v << FRACBITS); }
int gethoriz() { return q16horiz >> FRACBITS; }
int gethorizof() { return q16horizoff >> FRACBITS; }
int gethorizsum() { return (q16horiz + q16horizoff) >> FRACBITS; }
} DukePlayer_t;
// KEEPINSYNC lunatic/_defs_game.lua
typedef struct
{
DukePlayer_t *ps;
struct player_struct *ps;
input_t *input;
bool horizRecenter;
@ -267,51 +108,13 @@ typedef struct
#pragma pack(pop)
// KEEPINSYNC lunatic/con_lang.lua
typedef struct
{
// NOTE: the member names must be identical to aplWeapon* suffixes.
int32_t WorksLike; // What the original works like
int32_t Clip; // number of items in magazine
int32_t Reload; // delay to reload (include fire)
int32_t FireDelay; // delay to fire
int32_t TotalTime; // The total time the weapon is cycling before next fire.
int32_t HoldDelay; // delay after release fire button to fire (0 for none)
int32_t Flags; // Flags for weapon
int32_t Shoots; // what the weapon shoots
int32_t SpawnTime; // the frame at which to spawn an item
int32_t Spawn; // the item to spawn
int32_t ShotsPerBurst; // number of shots per 'burst' (one ammo per 'burst')
int32_t InitialSound; // Sound made when weapon starts firing. zero for no sound
int32_t FireSound; // Sound made when firing (each time for automatic)
int32_t Sound2Time; // Alternate sound time
int32_t Sound2Sound; // Alternate sound sound ID
int32_t FlashColor; // Muzzle flash color
} weapondata_t;
# define PWEAPON(Player, Weapon, Wmember) (aplWeapon ## Wmember [Weapon][Player])
// KEEPINSYNC lunatic/_defs_game.lua
typedef struct {
int32_t cur, count; // "cur" is the only member that is *used*
int32_t gunposx, lookhalfang; // weapon_xoffset, ps->look_ang>>1
int32_t gunposy, lookhoriz; // gun_pos, looking_arc
int32_t shade;
} hudweapon_t;
extern playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
extern playerdata_t *const g_player;
extern hudweapon_t hudweap;
extern int32_t mouseyaxismode;
inline void SetPlayerPal(DukePlayer_t* pPlayer, PalEntry pe)
{
pPlayer->pals = pe;
}
int hitawall(DukePlayer_t* pPlayer, int* hitWall);
int hits(int spriteNum);
void P_GetInput(int playerNum);
void P_GetInputMotorcycle(int playerNum);
void P_GetInputBoat(int playerNum);

View file

@ -93,7 +93,7 @@ void DDukeCommonStatusBar::displayfragbar(void)
//
//==========================================================================
std::pair<const char*, EColorRange> DDukeCommonStatusBar::ontext(DukePlayer_t *p)
std::pair<const char*, EColorRange> DDukeCommonStatusBar::ontext(struct player_struct *p)
{
std::pair<const char*, EColorRange> retval(nullptr, CR_RED);
@ -128,7 +128,7 @@ std::pair<const char*, EColorRange> DDukeCommonStatusBar::ontext(DukePlayer_t *p
//
//==========================================================================
void DDukeCommonStatusBar::DrawInventory(const DukePlayer_t* p, double x, double y, int align)
void DDukeCommonStatusBar::DrawInventory(const struct player_struct* p, double x, double y, int align)
{
if (p->invdisptime <= 0)return;

View file

@ -19,8 +19,8 @@ protected:
std::array<int, 8> item_icons;
DDukeCommonStatusBar();
std::pair<const char*, EColorRange> ontext(DukePlayer_t *p);
void DrawInventory(const DukePlayer_t* p, double x, double y, int align);
std::pair<const char*, EColorRange> ontext(struct player_struct *p);
void DrawInventory(const struct player_struct* p, double x, double y, int align);
PalEntry LightForShade(int shade);
public:
void PrintLevelStats(int bottomy);

View file

@ -71,7 +71,7 @@ public:
//
//==========================================================================
int getinvamount(const DukePlayer_t* p)
int getinvamount(const struct player_struct* p)
{
switch (p->inven_icon)
{
@ -94,7 +94,7 @@ public:
return -1;
}
int GetMoraleOrShield(DukePlayer_t *p, int snum)
int GetMoraleOrShield(struct player_struct *p, int snum)
{
// special handling for WW2GI
int lAmount = GetGameVar("PLR_MORALE", -1, p->i, snum);
@ -109,7 +109,7 @@ public:
//
//==========================================================================
void FullscreenHUD1(DukePlayer_t* p, int snum)
void FullscreenHUD1(struct player_struct* p, int snum)
{
//
// Health
@ -193,7 +193,7 @@ public:
//
//==========================================================================
void FullscreenHUD2(DukePlayer_t *p)
void FullscreenHUD2(struct player_struct *p)
{
//
// health
@ -312,7 +312,7 @@ public:
//
//==========================================================================
void DrawWeaponAmounts(const DukePlayer_t* p, int x, int y)
void DrawWeaponAmounts(const struct player_struct* p, int x, int y)
{
int cw = p->curr_weapon;

View file

@ -58,7 +58,7 @@ public:
}
int getinvamount(const DukePlayer_t* p)
int getinvamount(const struct player_struct* p)
{
switch (p->inven_icon)
{
@ -88,7 +88,7 @@ public:
//
//==========================================================================
void FullscreenHUD1(DukePlayer_t* p, int snum)
void FullscreenHUD1(struct player_struct* p, int snum)
{
//
// Health
@ -174,7 +174,7 @@ public:
//
//==========================================================================
void FullscreenHUD2(DukePlayer_t* p)
void FullscreenHUD2(struct player_struct* p)
{
//
// health
@ -250,7 +250,7 @@ public:
//
//==========================================================================
void DrawWeaponBar(const DukePlayer_t* p, int top)
void DrawWeaponBar(const struct player_struct* p, int top)
{
double sbscale = 32800. / 65536.;

View file

@ -0,0 +1,172 @@
#pragma once
BEGIN_DUKE_NS
// all the struct types from JFDuke's duke3d.h
struct STATUSBARTYPE
{
short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon;
short ammo_amount[MAX_WEAPONS], holoduke_on;
unsigned char inven_icon, jetpack_on, heat_on;
short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
short heat_amount, scuba_amount, boot_amount;
short last_weapon, weapon_pos, kickback_pic;
FixedBitArray<MAX_WEAPONS> gotweapon; // must be the same type as in player_struct
};
struct weaponhit
{
uint8_t cgg;
short picnum, ang, extra, owner, movflag;
short tempang, actorstayput, dispicnum;
short timetosleep;
int floorz, ceilingz, lastvx, lastvy, bposx, bposy, bposz, aflags;
int temp_data[6];
};
// Todo - put more state in here
struct ActorInfo
{
uint32_t scriptaddress;
uint32_t flags;
int aimoffset;
};
struct player_struct
{
// This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze.
// The sound code wants to read a vector out of this so we need to define one for the main coordinate.
union
{
vec3_t pos;
struct { int32_t posx, posy, posz; };
};
// input handles angle and horizon as fixed16 numbers. We need to account for that as well.
fixed_t q16ang, oq16ang, q16horiz, q16horizoff; // oq16horiz, oq16horizoff; // These two are currently not used but may be again later.
// using a bit field for this to save a bit of space.
FixedBitArray<MAX_WEAPONS> gotweapon;
// Palette management uses indices into the engine's palette table now.
unsigned int palette;
PalEntry pals;
// these did not exist in JFDuke.
uint8_t movement_lock;
vec2_t fric;
// From here on it is unaltered from JFDuke with the exception of a few fields that are no longer needed and were removed.
int zoom, exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt;
int invdisptime;
int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff;
int posxv, posyv, poszv, last_pissed_time, truefz, truecz;
int player_par, visibility;
int bobcounter, weapon_sway;
int pals_time, randomflamex, crack_time;
int aim_mode, auto_aim, weaponswitch;
short angvel, cursectnum, look_ang, last_extra, subweapon;
short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself;
short curr_weapon, last_weapon, tipincs, wantweaponfire;
short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay;
short jumping_counter, airleft, knee_incs, access_incs;
short ftq, access_wallnum, access_spritenum;
short kickback_pic, got_access, weapon_ang, firstaid_amount;
short somethingonplayer, on_crane, i, one_parallax_sectnum;
short over_shoulder_on, random_club_frame, fist_incs;
short one_eighty_count, cheat_phase;
short dummyplayersprite, extra_extra8, quick_kick;
short heat_amount, actorsqu, timebeforeexit, customexitsound;
short weaprecs[256], weapreccnt;
unsigned int interface_toggle_flag;
short orotscrnang, rotscrnang, dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang
short scuba_amount, jetpack_amount, steroids_amount, shield_amount;
short holoduke_on, pycount, weapon_pos, frag_ps;
short transporter_hold, last_full_weapon, footprintshade, boot_amount;
int scream_voice;
unsigned char gm;
unsigned char on_warping_sector, footprintcount;
unsigned char hbomb_on, jumping_toggle, rapid_fire_hold, on_ground;
char name[32];
unsigned char inven_icon, buttonpalette;
unsigned char jetpack_on, spritebridge, lastrandomspot;
unsigned char scuba_on, footprintpal, heat_on;
unsigned char holster_weapon;
unsigned char falling_counter;
unsigned char refresh_inventory;
unsigned char toggle_key_flag, knuckle_incs; // ,select_dir;
unsigned char walking_snd_toggle, palookup, hard_landing;
unsigned char return_to_center;
int max_secret_rooms, secret_rooms, max_actors_killed, actors_killed;
// Redneck Rampage additions. Those which did not have names in the reconstructed source got one from either RedneckGDX or RedNukem.
// Items were reordered by size.
int stairs;
int detonate_count; // at57e
int noise_x, noise_y, noise_radius; // at286, at28a, at290
int drink_timer; // at58e
int eat_timer; // at592
int SlotWin;
short recoil;
short detonate_time; // at57c
short yehaa_timer;
short drink_amt, eat, drunkang, eatang;
uint8_t shotgun_state[2];
uint8_t donoise; // at28e
uint8_t keys[5];
// RRRA. The same as for the RR block applies.
int drug_aspect;
int drug_timer;
int SeaSick;
short MamaEnd; // raat609
short MotoSpeed, TiltStatus, moto_drink;
short VBumpNow, VBumpTarget, TurbCount;
short drug_stat[3]; // raat5f1..5
uint8_t DrugMode, lotag800kill;
uint8_t sea_sick_stat; // raat5dd
uint8_t hurt_delay2, nocheat;
uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround;
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
int8_t crouch_toggle;
// Access helpers for the widened angle and horizon fields.
int getlookang() { return look_ang; }
void setlookang(int b) { look_ang = b; }
void addlookang(int b) { look_ang += b; }
int getrotscrnang() { return rotscrnang; }
void setrotscrnang(int b) { rotscrnang = b; }
void addrotscrnang(int b) { rotscrnang += b; }
int getang() { return q16ang >> FRACBITS; }
int getoang() { return oq16ang >> FRACBITS; }
void setang(int v) { q16ang = v << FRACBITS; }
void addang(int v) { q16ang = (q16ang + (v << FRACBITS)) & ((2048 << FRACBITS) - 1); }
void setoang(int v) { oq16ang = v << FRACBITS; }
void addhoriz(int v) { q16horiz += (v << FRACBITS); }
void addhorizoff(int v) { q16horiz += (v << FRACBITS); }
void sethoriz(int v) { q16horiz = (v << FRACBITS); }
void sethorizoff(int v) { q16horizoff = (v << FRACBITS); }
int gethoriz() { return q16horiz >> FRACBITS; }
int gethorizof() { return q16horizoff >> FRACBITS; }
int gethorizsum() { return (q16horiz + q16horizoff) >> FRACBITS; }
};
END_DUKE_NS

View file

@ -424,7 +424,7 @@ static void G_Startup(void)
static void P_SetupMiscInputSettings(void)
{
DukePlayer_t *ps = g_player[myconnectindex].ps;
struct player_struct *ps = g_player[myconnectindex].ps;
ps->aim_mode = in_mousemode;
ps->auto_aim = cl_autoaim;
@ -518,7 +518,7 @@ static int G_EndOfLevel(void)
void G_MaybeAllocPlayer(int32_t pnum)
{
if (g_player[pnum].ps == NULL)
g_player[pnum].ps = (DukePlayer_t *)Xcalloc(1, sizeof(DukePlayer_t));
g_player[pnum].ps = (struct player_struct *)Xcalloc(1, sizeof(struct player_struct));
if (g_player[pnum].input == NULL)
g_player[pnum].input = (input_t *)Xcalloc(1, sizeof(input_t));
}

View file

@ -31,7 +31,6 @@ BEGIN_DUKE_NS
int32_t PHEIGHT = PHEIGHT_DUKE;
int32_t lastvisinc;
hudweapon_t hudweap;
#define TURBOTURNTIME (TICRATE/8) // 7
#define NORMALTURN 15

View file

@ -85,7 +85,7 @@ void e4intro(CompletionFunc completion);
void G_NewGame(int volumeNum, int levelNum, int skillNum)
{
DukePlayer_t *const pPlayer = g_player[0].ps;
struct player_struct *const pPlayer = g_player[0].ps;
handleevents();
@ -231,7 +231,7 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
void cacheit_d();
void cacheit_r();
static int LoadTheMap(MapRecord &mi, DukePlayer_t *pPlayer, int gameMode)
static int LoadTheMap(MapRecord &mi, struct player_struct *pPlayer, int gameMode)
{
char levelName[BMAX_PATH];
int16_t lbang;
@ -361,7 +361,7 @@ int G_EnterLevel(int gameMode)
}
FStringf msg("%s . . .", GStrings("TXT_LOADMAP"));
DukePlayer_t *const pPlayer = g_player[0].ps;
struct player_struct *const pPlayer = g_player[0].ps;
/*

View file

@ -762,7 +762,7 @@ static void sv_rrrafog();
#define SVARDATALEN \
((sizeof(g_player[0].user_name)+sizeof(g_player[0].pcolor)+sizeof(g_player[0].pteam) \
+sizeof(g_player[0].frags)+sizeof(DukePlayer_t))*MAXPLAYERS)
+sizeof(g_player[0].frags)+sizeof(struct player_struct))*MAXPLAYERS)
static uint8_t savegame_restdata[SVARDATALEN];
@ -1242,9 +1242,9 @@ static void sv_postanimateptr()
static void sv_restsave()
{
uint8_t * mem = savegame_restdata;
DukePlayer_t dummy_ps;
struct player_struct dummy_ps;
Bmemset(&dummy_ps, 0, sizeof(DukePlayer_t));
Bmemset(&dummy_ps, 0, sizeof(struct player_struct));
#define CPDAT(ptr,sz) do { Bmemcpy(mem, ptr, sz), mem+=sz ; } while (0)
for (int i = 0; i < MAXPLAYERS; i++)
@ -1253,7 +1253,7 @@ static void sv_restsave()
CPDAT(&g_player[i].pcolor, sizeof(g_player[0].pcolor));
CPDAT(&g_player[i].pteam, sizeof(g_player[0].pteam));
CPDAT(&g_player[i].frags[0], sizeof(g_player[0].frags));
CPDAT(g_player[i].ps ? g_player[i].ps : &dummy_ps, sizeof(DukePlayer_t));
CPDAT(g_player[i].ps ? g_player[i].ps : &dummy_ps, sizeof(struct player_struct));
}
Bassert((savegame_restdata + SVARDATALEN) - mem == 0);
@ -1262,7 +1262,7 @@ static void sv_restsave()
static void sv_restload()
{
uint8_t * mem = savegame_restdata;
DukePlayer_t dummy_ps;
struct player_struct dummy_ps;
#define CPDAT(ptr,sz) Bmemcpy(ptr, mem, sz), mem+=sz
for (int i = 0; i < MAXPLAYERS; i++)
@ -1271,7 +1271,7 @@ static void sv_restload()
CPDAT(&g_player[i].pcolor, sizeof(g_player[0].pcolor));
CPDAT(&g_player[i].pteam, sizeof(g_player[0].pteam));
CPDAT(&g_player[i].frags[0], sizeof(g_player[0].frags));
CPDAT(g_player[i].ps ? g_player[i].ps : &dummy_ps, sizeof(DukePlayer_t));
CPDAT(g_player[i].ps ? g_player[i].ps : &dummy_ps, sizeof(struct player_struct));
}
#undef CPDAT

View file

@ -47,7 +47,7 @@ int32_t g_crosshairSum = -1;
double g_moveActorsTime, g_moveWorldTime; // in ms, smoothed
void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, ESetPalFlags set)
void P_SetGamePalette(struct player_struct *player, uint32_t palid, ESetPalFlags set)
{
if (palid >= MAXBASEPALS)
palid = 0;
@ -123,7 +123,7 @@ void G_DisplayRest(int32_t smoothratio)
int32_t i, j;
palaccum_t tint = PALACCUM_INITIALIZER;
DukePlayer_t *const pp = g_player[screenpeek].ps;
struct player_struct *const pp = g_player[screenpeek].ps;
int32_t cposx, cposy, cang;
// this takes care of fullscreen tint for OpenGL