2010-08-02 08:13:51 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-08-02 08:13:51 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef player_h_
|
|
|
|
#define player_h_
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2016-05-23 04:47:22 +00:00
|
|
|
#include "inv.h"
|
2018-03-07 04:21:05 +00:00
|
|
|
#include "fix16.h"
|
2016-05-23 04:47:22 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
extern int32_t g_mostConcurrentPlayers;
|
2013-12-28 17:04:27 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
#define MOVEFIFOSIZ 2
|
|
|
|
|
|
|
|
#define NAM_GRENADE_LIFETIME 120
|
|
|
|
#define NAM_GRENADE_LIFETIME_VAR 30
|
|
|
|
|
|
|
|
#define HORIZ_MIN -99
|
|
|
|
#define HORIZ_MAX 299
|
|
|
|
#define AUTO_AIM_ANGLE 48
|
|
|
|
#define PHEIGHT (38<<8)
|
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
#define TRIPBOMB_TRIPWIRE 0x00000001
|
|
|
|
#define TRIPBOMB_TIMER 0x00000002
|
|
|
|
|
|
|
|
#define PIPEBOMB_REMOTE 0x00000001
|
|
|
|
#define PIPEBOMB_TIMER 0x00000002
|
|
|
|
|
2013-06-27 23:04:57 +00:00
|
|
|
#define WEAPON_POS_LOWER -9
|
|
|
|
#define WEAPON_POS_RAISE 10
|
|
|
|
#define WEAPON_POS_START 6
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
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
|
|
|
|
WEAPON_SEMIAUTO = 0x00004000, // cancel button press after each shot
|
|
|
|
WEAPON_RELOAD_TIMING = 0x00008000, // special casing for pistol reload sounds
|
|
|
|
WEAPON_RESET = 0x00010000 // cycle weapon back to frame 1 if fire is held, 0 if not
|
|
|
|
};
|
|
|
|
|
|
|
|
enum gamemode_t {
|
|
|
|
MODE_MENU = 0x00000001,
|
|
|
|
MODE_DEMO = 0x00000002,
|
|
|
|
MODE_GAME = 0x00000004,
|
|
|
|
MODE_EOL = 0x00000008,
|
|
|
|
MODE_TYPE = 0x00000010,
|
|
|
|
MODE_RESTART = 0x00000020,
|
|
|
|
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 {
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
vec3_t pos;
|
|
|
|
int16_t ang, sect;
|
2010-08-02 08:13:51 +00:00
|
|
|
} playerspawn_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int16_t got_access, last_extra, inv_amount[GET_MAX], curr_weapon, holoduke_on;
|
|
|
|
int16_t last_weapon, weapon_pos, kickback_pic;
|
|
|
|
int16_t ammo_amount[MAX_WEAPONS], frag[MAXPLAYERS];
|
|
|
|
uint16_t gotweapon;
|
|
|
|
char inven_icon, jetpack_on, heat_on;
|
|
|
|
} DukeStatus_t;
|
|
|
|
|
2013-02-03 12:48:25 +00:00
|
|
|
typedef struct {
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
uint32_t bits;
|
2018-03-07 04:21:18 +00:00
|
|
|
int16_t fvel, svel;
|
2018-03-07 04:23:58 +00:00
|
|
|
fix16_t q16avel, q16horz;
|
2018-03-07 04:21:05 +00:00
|
|
|
int8_t extbits;
|
2013-02-03 12:48:25 +00:00
|
|
|
} input_t;
|
|
|
|
|
|
|
|
#pragma pack(push,1)
|
2012-07-25 18:56:11 +00:00
|
|
|
// XXX: r1625 changed a lot types here, among others
|
|
|
|
// * int32_t --> int16_t
|
|
|
|
// * int16_t --> int8_t
|
|
|
|
// * char --> int8_t
|
|
|
|
// Need to carefully think about implications!
|
2013-04-07 15:20:41 +00:00
|
|
|
// TODO: rearrange this if the opportunity arises!
|
2017-02-01 10:20:54 +00:00
|
|
|
// KEEPINSYNC lunatic/_defs_game.lua
|
2010-08-02 08:13:51 +00:00
|
|
|
typedef struct {
|
2011-02-25 21:50:19 +00:00
|
|
|
vec3_t pos, opos, vel, npos;
|
Clean up some player code a bit... make bobposx/bobposy a vec2_t, make fricxv/fricyv a per-player vec2_t (TODO: CON access), promote angvel in input_t to int16_t and allow for player angle changes that result in odd numbered angles (we were effectively artificially limiting the angle to 1024 values before), fix some HUD model ID stuff that should help with the weapons in the HRP, clean up a bunch of random functions (P_FireWeapon(), P_DisplayTip(), P_DisplayAccess(), P_DisplayWeapon(), P_GetInput(), etc). Also clean up G_SetupFilenameBasedMusic() to loop through flac/ogg/mid when searching for usermap music replacements. Some of this really needs a BYTEVERSION bump, but these commits aren't for synthesis to build so we're not doing it yet. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4703 1a8010ca-5511-0410-912e-c29ae57300e0
2014-10-29 17:07:11 +00:00
|
|
|
vec2_t bobpos, fric;
|
2018-03-07 04:21:18 +00:00
|
|
|
|
|
|
|
fix16_t q16horiz, q16horizoff, oq16horiz, oq16horizoff;
|
|
|
|
fix16_t q16ang, oq16ang, q16angvel;
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
int32_t truefz, truecz, player_par;
|
|
|
|
int32_t randomflamex, exitx, exity;
|
|
|
|
int32_t runspeed, max_player_health, max_shield_amount;
|
2012-10-29 04:29:17 +00:00
|
|
|
int32_t autostep, autostep_sbw;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
uint32_t interface_toggle_flag;
|
2013-01-02 22:33:37 +00:00
|
|
|
#ifdef LUNATIC
|
2013-01-19 18:28:55 +00:00
|
|
|
int32_t pipebombControl, pipebombLifetime, pipebombLifetimeVar;
|
|
|
|
int32_t tripbombControl, tripbombLifetime, tripbombLifetimeVar;
|
|
|
|
|
2013-01-02 22:33:37 +00:00
|
|
|
int32_t zrange;
|
|
|
|
int16_t angrange, autoaimang;
|
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
uint16_t max_actors_killed, actors_killed;
|
|
|
|
uint16_t gotweapon, zoom;
|
|
|
|
|
|
|
|
int16_t loogiex[64], loogiey[64], sbs, sound_pitch;
|
|
|
|
|
2018-03-07 04:21:18 +00:00
|
|
|
int16_t cursectnum, look_ang, last_extra, subweapon;
|
2010-08-02 08:13:51 +00:00
|
|
|
int16_t max_ammo_amount[MAX_WEAPONS], ammo_amount[MAX_WEAPONS], inv_amount[GET_MAX];
|
|
|
|
int16_t wackedbyactor, pyoff, opyoff;
|
|
|
|
|
|
|
|
int16_t newowner, jumping_counter, airleft;
|
|
|
|
int16_t fta, ftq, access_wallnum, access_spritenum;
|
|
|
|
int16_t got_access, weapon_ang, visibility;
|
|
|
|
int16_t somethingonplayer, on_crane, i, one_parallax_sectnum;
|
|
|
|
int16_t random_club_frame, one_eighty_count;
|
|
|
|
int16_t dummyplayersprite, extra_extra8;
|
|
|
|
int16_t actorsqu, timebeforeexit, customexitsound, last_pissed_time;
|
|
|
|
|
|
|
|
int16_t weaprecs[MAX_WEAPONS], weapon_sway, crack_time, bobcounter;
|
|
|
|
|
|
|
|
int16_t orotscrnang, rotscrnang, dead_flag; // JBF 20031220: added orotscrnang
|
|
|
|
int16_t holoduke_on, pycount;
|
2017-06-23 03:58:43 +00:00
|
|
|
int16_t transporter_hold, clipdist;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
uint8_t max_secret_rooms, secret_rooms;
|
2013-02-28 17:30:04 +00:00
|
|
|
// XXX: 255 values for frag(gedself) seems too small.
|
2010-08-02 08:13:51 +00:00
|
|
|
uint8_t frag, fraggedself, quick_kick, last_quick_kick;
|
|
|
|
uint8_t return_to_center, reloading, weapreccnt;
|
|
|
|
uint8_t aim_mode, auto_aim, weaponswitch, movement_lock, team;
|
|
|
|
uint8_t tipincs, hbomb_hold_delay, frag_ps, kickback_pic;
|
|
|
|
|
|
|
|
uint8_t gm, on_warping_sector, footprintcount, hurt_delay;
|
|
|
|
uint8_t hbomb_on, jumping_toggle, rapid_fire_hold, on_ground;
|
|
|
|
uint8_t inven_icon, buttonpalette, over_shoulder_on, show_empty_weapon;
|
|
|
|
|
|
|
|
uint8_t jetpack_on, spritebridge, lastrandomspot;
|
|
|
|
uint8_t scuba_on, footprintpal, heat_on, invdisptime;
|
|
|
|
|
|
|
|
uint8_t holster_weapon, falling_counter, footprintshade;
|
|
|
|
uint8_t refresh_inventory, last_full_weapon;
|
|
|
|
|
|
|
|
uint8_t toggle_key_flag, knuckle_incs, knee_incs, access_incs;
|
|
|
|
uint8_t walking_snd_toggle, palookup, hard_landing, fist_incs;
|
|
|
|
|
2012-07-25 18:56:11 +00:00
|
|
|
int8_t numloogs, loogcnt, scream_voice;
|
2010-08-02 08:13:51 +00:00
|
|
|
int8_t last_weapon, cheat_phase, weapon_pos, wantweaponfire, curr_weapon;
|
|
|
|
|
2013-01-02 22:33:22 +00:00
|
|
|
uint8_t palette;
|
2010-08-02 08:13:51 +00:00
|
|
|
palette_t pals;
|
|
|
|
|
2018-03-08 03:54:54 +00:00
|
|
|
int8_t last_used_weapon;
|
|
|
|
|
2013-01-13 16:40:32 +00:00
|
|
|
#ifdef LUNATIC
|
2013-06-20 18:31:50 +00:00
|
|
|
int8_t palsfadespeed, palsfadenext, palsfadeprio, padding2_;
|
|
|
|
|
2013-01-13 16:40:32 +00:00
|
|
|
// The player index. Always valid since we have no loose DukePlayer_t's
|
2013-01-19 18:28:43 +00:00
|
|
|
// anywhere (like with spritetype_t): g_player[i].ps->wa.idx == i.
|
|
|
|
struct { int32_t idx; } wa;
|
2013-01-13 16:40:32 +00:00
|
|
|
#endif
|
2018-03-08 03:54:54 +00:00
|
|
|
// int8_t padding_[0];
|
2010-08-02 08:13:51 +00:00
|
|
|
} DukePlayer_t;
|
|
|
|
|
2017-02-01 10:20:54 +00:00
|
|
|
// KEEPINSYNC lunatic/_defs_game.lua
|
2010-08-02 08:13:51 +00:00
|
|
|
typedef struct {
|
|
|
|
DukePlayer_t *ps;
|
2016-08-27 01:40:46 +00:00
|
|
|
input_t *inputBits;
|
2010-08-02 08:13:51 +00:00
|
|
|
|
|
|
|
int32_t netsynctime;
|
|
|
|
int16_t ping, filler;
|
|
|
|
int32_t pcolor, pteam;
|
2013-12-26 19:44:56 +00:00
|
|
|
// NOTE: wchoice[HANDREMOTE_WEAPON .. MAX_WEAPONS-1] unused
|
2010-08-02 08:13:51 +00:00
|
|
|
uint8_t frags[MAXPLAYERS], wchoice[MAX_WEAPONS];
|
|
|
|
|
2012-10-14 22:16:07 +00:00
|
|
|
char vote, gotvote, pingcnt, playerquitflag, ready;
|
2010-08-02 08:13:51 +00:00
|
|
|
char user_name[32];
|
2012-05-17 23:54:43 +00:00
|
|
|
uint32_t revision;
|
2010-08-02 08:13:51 +00:00
|
|
|
} playerdata_t;
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
2013-01-13 16:40:32 +00:00
|
|
|
// KEEPINSYNC lunatic/con_lang.lua
|
2012-12-28 17:18:16 +00:00
|
|
|
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 ReloadSound1; // Sound of magazine being removed
|
|
|
|
int32_t ReloadSound2; // Sound of magazine being inserted
|
|
|
|
int32_t SelectSound; // Sound of weapon being selected
|
|
|
|
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])
|
2010-08-02 08:13:51 +00:00
|
|
|
extern intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in clip
|
|
|
|
extern intptr_t *aplWeaponReload[MAX_WEAPONS]; // delay to reload (include fire)
|
|
|
|
extern intptr_t *aplWeaponFireDelay[MAX_WEAPONS]; // delay to fire
|
|
|
|
extern intptr_t *aplWeaponHoldDelay[MAX_WEAPONS]; // delay after release fire button to fire (0 for none)
|
|
|
|
extern intptr_t *aplWeaponTotalTime[MAX_WEAPONS]; // The total time the weapon is cycling before next fire.
|
|
|
|
extern intptr_t *aplWeaponFlags[MAX_WEAPONS]; // Flags for weapon
|
|
|
|
extern intptr_t *aplWeaponShoots[MAX_WEAPONS]; // what the weapon shoots
|
|
|
|
extern intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn an item
|
|
|
|
extern intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn
|
|
|
|
extern intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst'
|
|
|
|
extern intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like
|
|
|
|
extern intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when initialy firing. zero for no sound
|
|
|
|
extern intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic)
|
|
|
|
extern intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time
|
|
|
|
extern intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID
|
|
|
|
extern intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed
|
|
|
|
extern intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted
|
|
|
|
extern intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound for weapon selection
|
|
|
|
extern intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Color for polymer muzzle flash
|
2012-12-28 17:18:16 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2015-04-18 21:59:21 +00:00
|
|
|
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;
|
|
|
|
|
2017-02-01 10:20:54 +00:00
|
|
|
// KEEPINSYNC lunatic/_defs_game.lua
|
2013-01-19 18:28:48 +00:00
|
|
|
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;
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
extern input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
|
|
|
|
extern playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
|
2015-02-07 17:29:11 +00:00
|
|
|
extern playerdata_t *const g_player;
|
2010-08-02 08:13:51 +00:00
|
|
|
extern int16_t WeaponPickupSprites[MAX_WEAPONS];
|
2013-01-19 18:28:48 +00:00
|
|
|
extern hudweapon_t hudweap;
|
2010-08-02 08:13:51 +00:00
|
|
|
extern int32_t g_levelTextTime;
|
|
|
|
extern int32_t g_myAimMode;
|
|
|
|
extern int32_t g_numObituaries;
|
|
|
|
extern int32_t g_numSelfObituaries;
|
2011-02-25 21:50:19 +00:00
|
|
|
extern int32_t g_emuJumpTics;
|
2010-08-02 08:13:51 +00:00
|
|
|
extern int32_t mouseyaxismode;
|
|
|
|
extern int32_t ticrandomseed;
|
|
|
|
|
2013-02-07 21:01:12 +00:00
|
|
|
#define SHOOT_HARDCODED_ZVEL INT32_MIN
|
|
|
|
|
2016-08-27 01:41:04 +00:00
|
|
|
int A_ShootWithZvel(int spriteNum, int projecTile, int forceZvel);
|
|
|
|
static inline int A_Shoot(int spriteNum, int projecTile)
|
2013-02-07 21:01:12 +00:00
|
|
|
{
|
2016-08-27 01:41:04 +00:00
|
|
|
return A_ShootWithZvel(spriteNum, projecTile, SHOOT_HARDCODED_ZVEL);
|
2013-02-07 21:01:12 +00:00
|
|
|
}
|
|
|
|
|
2016-08-27 01:41:04 +00:00
|
|
|
static inline void P_PalFrom(DukePlayer_t *pPlayer, uint8_t f, uint8_t r, uint8_t g, uint8_t b)
|
2013-06-27 23:04:24 +00:00
|
|
|
{
|
2013-07-04 19:38:39 +00:00
|
|
|
#ifdef LUNATIC
|
2017-02-01 10:20:54 +00:00
|
|
|
// Compare with _defs_game.lua: player[]:_palfrom().
|
2016-08-27 01:41:04 +00:00
|
|
|
if (pPlayer->pals.f == 0 || pPlayer->palsfadeprio <= 0)
|
2013-07-04 19:38:39 +00:00
|
|
|
#endif
|
|
|
|
{
|
2016-08-27 01:41:04 +00:00
|
|
|
pPlayer->pals.f = f;
|
|
|
|
pPlayer->pals.r = r;
|
|
|
|
pPlayer->pals.g = g;
|
|
|
|
pPlayer->pals.b = b;
|
2013-07-04 19:38:39 +00:00
|
|
|
#ifdef LUNATIC
|
2016-08-27 01:41:04 +00:00
|
|
|
pPlayer->palsfadespeed = pPlayer->palsfadenext = 0;
|
2013-07-04 19:38:39 +00:00
|
|
|
#endif
|
|
|
|
}
|
2013-06-27 23:04:24 +00:00
|
|
|
}
|
|
|
|
|
2017-07-05 05:37:58 +00:00
|
|
|
void P_AddKills(DukePlayer_t * const pPlayer, uint16_t kills);
|
2016-08-27 01:40:46 +00:00
|
|
|
int32_t A_GetHitscanRange(int spriteNum);
|
|
|
|
void P_GetInput(int playerNum);
|
2017-06-23 03:58:54 +00:00
|
|
|
void P_AddAmmo(DukePlayer_t * const pPlayer, int const weaponNum, int const addAmount);
|
2016-08-27 01:41:04 +00:00
|
|
|
void P_AddWeapon(DukePlayer_t *pPlayer, int weaponNum, int switchWeapon);
|
2016-08-27 01:40:46 +00:00
|
|
|
void P_CheckWeapon(DukePlayer_t *pPlayer);
|
|
|
|
void P_DisplayScuba(void);
|
|
|
|
void P_DisplayWeapon(void);
|
2017-06-23 03:58:54 +00:00
|
|
|
void P_DropWeapon(int const playerNum);
|
2016-08-27 01:41:04 +00:00
|
|
|
int P_FindOtherPlayer(int playerNum, int32_t *d);
|
2016-08-27 01:40:46 +00:00
|
|
|
void P_FragPlayer(int playerNum);
|
|
|
|
void P_UpdatePosWhenViewingCam(DukePlayer_t *pPlayer);
|
|
|
|
void P_ProcessInput(int playerNum);
|
|
|
|
void P_QuickKill(DukePlayer_t *pPlayer);
|
|
|
|
void P_SelectNextInvItem(DukePlayer_t *pPlayer);
|
|
|
|
void P_UpdateScreenPal(DukePlayer_t *pPlayer);
|
|
|
|
void P_EndLevel(void);
|
2016-08-27 01:41:04 +00:00
|
|
|
void P_CheckWeaponI(int playerNum);
|
2016-08-27 01:40:46 +00:00
|
|
|
int P_GetHudPal(const DukePlayer_t *pPlayer);
|
2018-07-23 02:56:08 +00:00
|
|
|
int P_GetKneePal(const DukePlayer_t *pPlayer);
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
int P_GetKneePal(const DukePlayer_t *pPlayer, int const hudPal);
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2016-08-27 01:40:35 +00:00
|
|
|
|
2016-08-27 01:41:04 +00:00
|
|
|
int Proj_GetDamage(projectile_t const *pProj);
|
2014-11-26 04:39:23 +00:00
|
|
|
|
2013-07-13 21:05:01 +00:00
|
|
|
#if !defined LUNATIC
|
2016-08-27 01:40:46 +00:00
|
|
|
void P_SetWeaponGamevars(int playerNum, const DukePlayer_t *pPlayer);
|
2013-07-13 21:05:01 +00:00
|
|
|
#else
|
2017-01-05 05:29:14 +00:00
|
|
|
static inline void P_SetWeaponGamevars(int playerNum, const DukePlayer_t *pPlayer)
|
2013-07-13 21:05:01 +00:00
|
|
|
{
|
2016-08-27 01:40:46 +00:00
|
|
|
UNREFERENCED_PARAMETER(playerNum);
|
|
|
|
UNREFERENCED_PARAMETER(pPlayer);
|
2013-07-13 21:05:01 +00:00
|
|
|
}
|
2010-08-02 08:13:51 +00:00
|
|
|
#endif
|
|
|
|
|
2013-12-28 17:04:27 +00:00
|
|
|
// Get the player index given an APLAYER sprite pointer.
|
2016-08-27 01:40:46 +00:00
|
|
|
static inline int P_GetP(const void *pSprite)
|
2013-12-28 17:04:27 +00:00
|
|
|
{
|
|
|
|
#if 0 // unprotected player index retrieval
|
|
|
|
return spr->yvel;
|
|
|
|
#elif defined NETCODE_DISABLE
|
2016-08-27 01:40:46 +00:00
|
|
|
UNREFERENCED_PARAMETER(pSprite); // for NDEBUG build
|
2013-12-28 17:04:27 +00:00
|
|
|
// NOTE: In the no-netcode build, there's no point to pass player indices
|
|
|
|
// at all since there is ever only one player. However, merely returning 0
|
|
|
|
// would mean making this build less strict than the normal one.
|
2016-08-27 01:42:12 +00:00
|
|
|
Bassert(((const uspritetype *)pSprite)->yvel == 0);
|
2013-12-28 17:04:27 +00:00
|
|
|
return 0;
|
|
|
|
#else
|
2016-08-27 01:40:46 +00:00
|
|
|
int playerNum = ((const uspritetype *)pSprite)->yvel;
|
2017-09-27 02:30:37 +00:00
|
|
|
// [JM] Check against MAXPLAYERS as opposed to g_mostConcurrentPlayers
|
|
|
|
// to prevent CON for disconnected/fake players from executing as playernum 0.
|
|
|
|
if ((unsigned)playerNum >= MAXPLAYERS)
|
2016-08-27 01:40:46 +00:00
|
|
|
playerNum = 0;
|
|
|
|
return playerNum;
|
2013-12-28 17:04:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the player index given an APLAYER sprite index.
|
2016-08-27 01:40:46 +00:00
|
|
|
static inline int P_Get(int32_t spriteNum) { return P_GetP((const uspritetype *)&sprite[spriteNum]); }
|
2013-12-28 17:04:27 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-07-13 21:05:01 +00:00
|
|
|
#endif
|