2019-11-20 16:21:32 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 sirlemonhead, Nuke.YKT
|
|
|
|
This file is part of PCExhumed.
|
|
|
|
PCExhumed 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
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-10-11 10:41:38 +00:00
|
|
|
#pragma once
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-10-07 06:40:59 +00:00
|
|
|
#include "gamecontrol.h"
|
2020-10-11 14:33:43 +00:00
|
|
|
#include "gameinput.h"
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
BEGIN_PS_NS
|
|
|
|
|
2022-09-07 07:48:05 +00:00
|
|
|
void SetSavePoint(int nPlayer, const DVector3& pos, sectortype* pSector, DAngle nAngle);
|
2019-08-26 03:59:14 +00:00
|
|
|
void InitPlayer();
|
2021-11-16 17:50:02 +00:00
|
|
|
void InitPlayerKeys(int nPlayer);
|
2019-08-26 03:59:14 +00:00
|
|
|
int GrabPlayer();
|
2021-11-16 17:50:02 +00:00
|
|
|
void InitPlayerInventory(int nPlayer);
|
|
|
|
void RestartPlayer(int nPlayer);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2020-10-11 11:14:32 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
kMaxPlayers = 8,
|
|
|
|
kDefaultLives = 3,
|
|
|
|
kMaxPlayerLives = 5,
|
|
|
|
kMaxHealth = 800
|
2020-10-11 11:21:54 +00:00
|
|
|
};
|
2019-08-26 03:59:14 +00:00
|
|
|
|
|
|
|
extern int nLocalPlayer;
|
|
|
|
|
2021-10-21 10:51:16 +00:00
|
|
|
struct PlayerSave
|
|
|
|
{
|
2021-11-22 23:20:15 +00:00
|
|
|
sectortype* pSector;
|
2022-08-23 21:36:23 +00:00
|
|
|
DVector3 pos;
|
2022-09-07 07:48:05 +00:00
|
|
|
DAngle nAngle;
|
2021-10-21 10:51:16 +00:00
|
|
|
};
|
|
|
|
|
2019-08-26 03:59:14 +00:00
|
|
|
struct Player
|
|
|
|
{
|
2021-12-26 07:47:54 +00:00
|
|
|
DExhumedActor* pActor;
|
2021-11-16 17:45:07 +00:00
|
|
|
int16_t nHealth;
|
|
|
|
int16_t nLives;
|
|
|
|
int16_t nDouble;
|
|
|
|
int16_t nInvisible;
|
|
|
|
int16_t nTorch;
|
|
|
|
int16_t bIsMummified;
|
|
|
|
int16_t invincibility;
|
|
|
|
int16_t nAir;
|
|
|
|
int16_t nMaskAmount;
|
2019-08-31 09:08:38 +00:00
|
|
|
uint16_t keys;
|
2021-11-16 17:45:07 +00:00
|
|
|
int16_t nMagic;
|
|
|
|
int16_t nItem;
|
2023-03-16 02:05:22 +00:00
|
|
|
int8_t items[8];
|
2021-11-16 17:45:07 +00:00
|
|
|
int16_t nAmmo[7]; // TODO - kMaxWeapons?
|
2019-08-31 07:47:15 +00:00
|
|
|
|
2021-11-21 18:33:51 +00:00
|
|
|
int16_t nCurrentWeapon;
|
2023-04-16 06:49:51 +00:00
|
|
|
uint16_t nWeapFrame;
|
2021-11-21 18:33:51 +00:00
|
|
|
int16_t bIsFiring;
|
|
|
|
int16_t nNextWeapon;
|
|
|
|
int16_t nState;
|
|
|
|
int16_t nLastWeapon;
|
|
|
|
int16_t nRun;
|
2019-10-29 17:35:22 +00:00
|
|
|
|
2023-03-13 10:08:11 +00:00
|
|
|
InputPacket input;
|
2022-11-25 06:09:11 +00:00
|
|
|
PlayerAngles Angles;
|
2023-03-16 01:17:42 +00:00
|
|
|
DVector2 vel;
|
2021-11-22 20:09:24 +00:00
|
|
|
sectortype* pPlayerPushSect;
|
2021-11-22 23:20:15 +00:00
|
|
|
sectortype* pPlayerViewSect;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-16 17:45:07 +00:00
|
|
|
int16_t nBreathTimer;
|
|
|
|
int16_t nPlayerSwear;
|
|
|
|
int16_t nDeathType;
|
|
|
|
int16_t nPlayerScore;
|
|
|
|
int16_t nPlayerColor;
|
|
|
|
int16_t nPistolClip;
|
2022-09-09 20:59:16 +00:00
|
|
|
DVector2 nThrust;
|
2021-11-16 17:45:07 +00:00
|
|
|
int16_t nPlayerOldWeapon;
|
|
|
|
int16_t nPlayerClip;
|
|
|
|
int16_t nPlayerPushSound;
|
|
|
|
int16_t nTauntTimer;
|
2021-10-21 10:51:16 +00:00
|
|
|
uint16_t nPlayerWeapons; // each set bit represents a weapon the player has
|
2023-03-23 06:22:28 +00:00
|
|
|
int16_t dVertPan;
|
2023-03-23 06:32:26 +00:00
|
|
|
double nQuake;
|
2023-03-23 08:14:26 +00:00
|
|
|
uint8_t nPlayer;
|
2023-03-25 09:00:53 +00:00
|
|
|
int16_t nTemperature;
|
2023-03-26 09:05:11 +00:00
|
|
|
double nStandHeight;
|
2021-10-21 10:51:16 +00:00
|
|
|
PlayerSave sPlayerSave;
|
|
|
|
int ototalvel;
|
|
|
|
int totalvel;
|
2023-04-02 08:27:07 +00:00
|
|
|
bool crouch_toggle;
|
2023-04-19 06:50:52 +00:00
|
|
|
bool bTouchFloor;
|
2021-12-07 17:53:02 +00:00
|
|
|
TObjPtr<DExhumedActor*> pPlayerGrenade;
|
|
|
|
TObjPtr<DExhumedActor*> pPlayerFloorSprite;
|
|
|
|
TObjPtr<DExhumedActor*> pDoppleSprite;
|
2023-03-13 09:10:47 +00:00
|
|
|
TObjPtr<DExhumedActor*> pTarget;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-21 10:51:16 +00:00
|
|
|
};
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 20:09:27 +00:00
|
|
|
extern int PlayerCount;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-10-21 10:51:16 +00:00
|
|
|
extern Player PlayerList[kMaxPlayers];
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 20:09:27 +00:00
|
|
|
extern int obobangle, bobangle;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-12-07 17:53:02 +00:00
|
|
|
extern TObjPtr<DExhumedActor*> nNetStartSprite[kMaxPlayers];
|
2021-11-21 20:09:27 +00:00
|
|
|
extern int nNetStartSprites;
|
|
|
|
extern int nCurStartSprite;
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2021-11-21 19:48:11 +00:00
|
|
|
int GetPlayerFromActor(DExhumedActor* actor);
|
2019-08-26 03:59:14 +00:00
|
|
|
void SetPlayerMummified(int nPlayer, int bIsMummified);
|
|
|
|
int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount);
|
|
|
|
void ShootStaff(int nPlayer);
|
2023-04-17 05:35:58 +00:00
|
|
|
void updatePlayerTarget(Player* const pPlayer);
|
2019-08-26 03:59:14 +00:00
|
|
|
|
2023-03-27 06:10:07 +00:00
|
|
|
inline void doPlayerVertPanning(Player* const pPlayer, const double nDestVertPan)
|
|
|
|
{
|
|
|
|
const auto nVertPan = (nDestVertPan - pPlayer->Angles.ViewAngles.Pitch.Tan() * 128) * 0.25;
|
|
|
|
pPlayer->Angles.ViewAngles.Pitch += maphoriz(abs(nVertPan) >= 4 ? Sgn(nVertPan) * 4. : nVertPan * 2.);
|
|
|
|
}
|
|
|
|
|
2019-11-22 23:11:37 +00:00
|
|
|
END_PS_NS
|
|
|
|
|