2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
|
|
|
|
|
|
|
This file is part of NBlood.
|
|
|
|
|
|
|
|
NBlood 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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "actor.h"
|
2020-01-01 20:53:29 +00:00
|
|
|
#include "build.h"
|
|
|
|
#include "common_game.h"
|
|
|
|
#include "compat.h"
|
2020-07-26 21:59:29 +00:00
|
|
|
#include "globals.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "db.h"
|
|
|
|
#include "dude.h"
|
2019-09-22 07:53:42 +00:00
|
|
|
#include "levels.h"
|
2019-10-25 20:53:41 +00:00
|
|
|
#include "qav.h"
|
2020-10-11 14:33:43 +00:00
|
|
|
#include "gameinput.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
2019-10-21 19:46:41 +00:00
|
|
|
// life modes of the player
|
2020-01-01 20:53:29 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
kModeHuman = 0,
|
|
|
|
kModeBeast = 1,
|
|
|
|
kModeHumanShrink = 2,
|
|
|
|
kModeHumanGrown = 3,
|
|
|
|
kModeMax = 4,
|
2019-10-21 19:46:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// postures
|
2020-01-01 20:53:29 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
kPostureStand = 0,
|
2020-02-07 19:47:43 +00:00
|
|
|
kPostureSwim = 1,
|
|
|
|
kPostureCrouch = 2,
|
2020-01-01 20:53:29 +00:00
|
|
|
kPostureMax = 3,
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
2020-01-01 20:53:29 +00:00
|
|
|
struct PACKINFO
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
bool isActive; // is active (0/1)
|
|
|
|
int curAmount = 0; // remaining percent
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
2020-01-01 20:53:29 +00:00
|
|
|
struct POSTURE
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int frontAccel;
|
|
|
|
int sideAccel;
|
|
|
|
int backAccel;
|
|
|
|
int pace[2];
|
|
|
|
int bobV;
|
|
|
|
int bobH;
|
|
|
|
int swayV;
|
|
|
|
int swayH;
|
|
|
|
int eyeAboveZ;
|
|
|
|
int weaponAboveZ;
|
|
|
|
int xOffset;
|
|
|
|
int zOffset;
|
2020-01-01 20:53:29 +00:00
|
|
|
int normalJumpZ;
|
|
|
|
int pwupJumpZ;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern POSTURE gPostureDefaults[kModeMax][kPostureMax];
|
|
|
|
|
|
|
|
struct PLAYER
|
|
|
|
{
|
2020-12-05 22:49:51 +00:00
|
|
|
DBloodActor* actor();
|
2020-01-01 20:53:29 +00:00
|
|
|
spritetype* pSprite;
|
|
|
|
XSPRITE* pXSprite;
|
|
|
|
DUDEINFO* pDudeInfo;
|
2020-10-07 06:16:58 +00:00
|
|
|
InputPacket input;
|
|
|
|
PlayerHorizon horizon;
|
2020-10-07 20:55:54 +00:00
|
|
|
PlayerAngle angle;
|
2020-08-26 14:48:33 +00:00
|
|
|
uint8_t newWeapon;
|
2020-01-01 20:53:29 +00:00
|
|
|
int used1; // something related to game checksum
|
|
|
|
int weaponQav;
|
|
|
|
int qavCallback;
|
|
|
|
bool isRunning;
|
|
|
|
int posture; // stand, crouch, swim
|
|
|
|
int sceneQav; // by NoOne: used to keep qav id
|
|
|
|
int bobPhase;
|
|
|
|
int bobAmp;
|
|
|
|
int bobHeight;
|
|
|
|
int bobWidth;
|
|
|
|
int swayPhase;
|
|
|
|
int swayAmp;
|
|
|
|
int swayHeight;
|
|
|
|
int swayWidth;
|
|
|
|
int nPlayer; // Connect id
|
|
|
|
int nSprite;
|
|
|
|
int lifeMode;
|
|
|
|
int bloodlust; // ---> useless
|
|
|
|
int zView;
|
|
|
|
int zViewVel;
|
|
|
|
int zWeapon;
|
|
|
|
int zWeaponVel;
|
|
|
|
int slope;
|
|
|
|
bool isUnderwater;
|
|
|
|
bool hasKey[8];
|
2020-11-22 13:24:55 +00:00
|
|
|
int8_t hasFlag;
|
2021-09-04 19:02:51 +00:00
|
|
|
DBloodActor* ctfFlagState[2];
|
2020-01-01 20:53:29 +00:00
|
|
|
int damageControl[7];
|
2020-08-26 22:53:35 +00:00
|
|
|
int8_t curWeapon;
|
|
|
|
int8_t nextWeapon;
|
2020-01-01 20:53:29 +00:00
|
|
|
int weaponTimer;
|
|
|
|
int weaponState;
|
|
|
|
int weaponAmmo; //rename
|
|
|
|
bool hasWeapon[14];
|
|
|
|
int weaponMode[14];
|
|
|
|
int weaponOrder[2][14];
|
|
|
|
//int at149[14];
|
|
|
|
int ammoCount[12];
|
|
|
|
bool qavLoop;
|
2021-08-05 02:38:26 +00:00
|
|
|
int qavLastTick;
|
|
|
|
int qavTimer;
|
2020-01-01 20:53:29 +00:00
|
|
|
int fuseTime;
|
|
|
|
int throwTime;
|
|
|
|
int throwPower;
|
|
|
|
Aim aim; // world
|
|
|
|
//int at1c6;
|
|
|
|
Aim relAim; // relative
|
|
|
|
//int relAim;
|
|
|
|
//int at1ce;
|
|
|
|
//int at1d2;
|
2021-08-29 16:13:15 +00:00
|
|
|
DBloodActor* aimTarget; // aim target sprite
|
2020-01-01 20:53:29 +00:00
|
|
|
int aimTargetsCount;
|
|
|
|
short aimTargets[16];
|
|
|
|
int deathTime;
|
|
|
|
int pwUpTime[kMaxPowerUps];
|
|
|
|
int fragCount;
|
|
|
|
int fragInfo[8];
|
|
|
|
int teamId;
|
2021-09-04 19:59:34 +00:00
|
|
|
DBloodActor* fragger;
|
2020-01-01 20:53:29 +00:00
|
|
|
int underwaterTime;
|
|
|
|
int bubbleTime;
|
|
|
|
int restTime;
|
|
|
|
int kickPower;
|
|
|
|
int laughCount;
|
|
|
|
bool godMode;
|
|
|
|
bool fallScream;
|
|
|
|
bool cantJump;
|
|
|
|
int packItemTime; // pack timer
|
|
|
|
int packItemId; // pack id 1: diving suit, 2: crystal ball, 3: beast vision 4: jump boots
|
|
|
|
PACKINFO packSlots[5]; // at325 [1]: diving suit, [2]: crystal ball, [3]: beast vision [4]: jump boots
|
|
|
|
int armor[3]; // armor
|
|
|
|
//int at342;
|
|
|
|
//int at346;
|
2021-08-29 16:13:15 +00:00
|
|
|
DBloodActor* voodooTarget;
|
2020-01-01 20:53:29 +00:00
|
|
|
int voodooTargets; // --> useless
|
|
|
|
int voodooVar1; // --> useless
|
|
|
|
int vodooVar2; // --> useless
|
|
|
|
int flickerEffect;
|
|
|
|
int tiltEffect;
|
|
|
|
int visibility;
|
|
|
|
int painEffect;
|
|
|
|
int blindEffect;
|
|
|
|
int chokeEffect;
|
|
|
|
int handTime;
|
|
|
|
bool hand; // if true, there is hand start choking the player
|
|
|
|
int pickupEffect;
|
|
|
|
bool flashEffect; // if true, reduce pPlayer->visibility counter
|
|
|
|
int quakeEffect;
|
|
|
|
int player_par;
|
|
|
|
int nWaterPal;
|
|
|
|
POSTURE pPosture[kModeMax][kPostureMax];
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
2020-01-01 20:53:29 +00:00
|
|
|
struct AMMOINFO
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int max;
|
2021-04-17 08:14:03 +00:00
|
|
|
int8_t vectorType;
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
2020-01-01 20:53:29 +00:00
|
|
|
struct POWERUPINFO
|
|
|
|
{
|
2019-10-19 19:11:39 +00:00
|
|
|
short picnum;
|
|
|
|
bool pickupOnce;
|
|
|
|
int bonusTime;
|
|
|
|
int maxTime;
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
2020-01-26 11:19:01 +00:00
|
|
|
void playerResetPosture(PLAYER* pPlayer);
|
2019-10-25 20:53:41 +00:00
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
extern PLAYER gPlayer[kMaxPlayers];
|
|
|
|
extern PLAYER *gMe, *gView;
|
|
|
|
|
2019-09-15 11:59:27 +00:00
|
|
|
extern bool gBlueFlagDropped;
|
|
|
|
extern bool gRedFlagDropped;
|
|
|
|
|
2020-11-22 12:16:58 +00:00
|
|
|
extern int team_score[kMaxPlayers];
|
|
|
|
extern int team_ticker[kMaxPlayers];
|
2019-09-19 22:42:45 +00:00
|
|
|
extern AMMOINFO gAmmoInfo[];
|
|
|
|
extern POWERUPINFO gPowerUpInfo[kMaxPowerUps];
|
|
|
|
|
2020-01-01 20:53:29 +00:00
|
|
|
inline bool IsTargetTeammate(PLAYER *pSourcePlayer, spritetype *pTargetSprite)
|
2019-09-22 07:53:42 +00:00
|
|
|
{
|
|
|
|
if (pSourcePlayer == NULL)
|
|
|
|
return false;
|
|
|
|
if (!IsPlayerSprite(pTargetSprite))
|
|
|
|
return false;
|
|
|
|
if (gGameOptions.nGameType == 1 || gGameOptions.nGameType == 3)
|
|
|
|
{
|
2020-01-01 20:53:29 +00:00
|
|
|
PLAYER *pTargetPlayer = &gPlayer[pTargetSprite->type - kDudePlayer1];
|
2019-09-22 07:53:42 +00:00
|
|
|
if (pSourcePlayer != pTargetPlayer)
|
|
|
|
{
|
|
|
|
if (gGameOptions.nGameType == 1)
|
|
|
|
return true;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (gGameOptions.nGameType == 3 && (pSourcePlayer->teamId & 3) == (pTargetPlayer->teamId & 3))
|
2019-09-22 07:53:42 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-01-01 20:53:29 +00:00
|
|
|
inline bool IsTargetTeammate(spritetype *pSourceSprite, spritetype *pTargetSprite)
|
2019-09-22 07:53:42 +00:00
|
|
|
{
|
|
|
|
if (!IsPlayerSprite(pSourceSprite))
|
|
|
|
return false;
|
2020-01-01 20:53:29 +00:00
|
|
|
PLAYER *pSourcePlayer = &gPlayer[pSourceSprite->type - kDudePlayer1];
|
2019-09-22 07:53:42 +00:00
|
|
|
return IsTargetTeammate(pSourcePlayer, pTargetSprite);
|
|
|
|
}
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
int powerupCheck(PLAYER *pPlayer, int nPowerUp);
|
|
|
|
char powerupActivate(PLAYER *pPlayer, int nPowerUp);
|
|
|
|
void powerupDeactivate(PLAYER *pPlayer, int nPowerUp);
|
|
|
|
void powerupSetState(PLAYER *pPlayer, int nPowerUp, char bState);
|
|
|
|
void powerupProcess(PLAYER *pPlayer);
|
|
|
|
void powerupClear(PLAYER *pPlayer);
|
|
|
|
int packItemToPowerup(int nPack);
|
|
|
|
int powerupToPackItem(int nPowerUp);
|
|
|
|
char packAddItem(PLAYER *pPlayer, unsigned int nPack);
|
|
|
|
int packCheckItem(PLAYER *pPlayer, int nPack);
|
|
|
|
char packItemActive(PLAYER *pPlayer, int nPack);
|
|
|
|
void packUseItem(PLAYER *pPlayer, int nPack);
|
|
|
|
void packPrevItem(PLAYER *pPlayer);
|
|
|
|
void packNextItem(PLAYER *pPlayer);
|
2020-01-01 20:53:29 +00:00
|
|
|
char playerSeqPlaying(PLAYER *pPlayer, int nSeq);
|
2019-09-19 22:42:45 +00:00
|
|
|
void playerSetRace(PLAYER *pPlayer, int nLifeMode);
|
2020-09-02 22:29:17 +00:00
|
|
|
void playerSetGodMode(PLAYER *pPlayer, bool bGodMode);
|
2019-09-19 22:42:45 +00:00
|
|
|
void playerResetInertia(PLAYER *pPlayer);
|
2020-01-01 20:53:29 +00:00
|
|
|
void playerCorrectInertia(PLAYER *pPlayer, vec3_t const *oldpos);
|
2020-02-10 05:23:49 +00:00
|
|
|
void playerStart(int nPlayer, int bNewLevel = 0);
|
2019-09-19 22:42:45 +00:00
|
|
|
void playerReset(PLAYER *pPlayer);
|
|
|
|
void playerInit(int nPlayer, unsigned int a2);
|
|
|
|
void CheckPickUp(PLAYER *pPlayer);
|
|
|
|
void ProcessInput(PLAYER *pPlayer);
|
|
|
|
void playerProcess(PLAYER *pPlayer);
|
2021-09-04 20:18:27 +00:00
|
|
|
DBloodActor *playerFireMissile(PLAYER *pPlayer, int a2, int a3, int a4, int a5, int a6);
|
|
|
|
DBloodActor *playerFireThing(PLAYER *pPlayer, int a2, int a3, int thingType, int a5);
|
2019-09-19 22:42:45 +00:00
|
|
|
void playerFrag(PLAYER *pKiller, PLAYER *pVictim);
|
|
|
|
int playerDamageArmor(PLAYER *pPlayer, DAMAGE_TYPE nType, int nDamage);
|
2020-12-02 23:30:19 +00:00
|
|
|
int playerDamageSprite(DBloodActor* nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, int nDamage);
|
2019-09-19 22:42:45 +00:00
|
|
|
int UseAmmo(PLAYER *pPlayer, int nAmmoType, int nDec);
|
2020-11-21 19:10:45 +00:00
|
|
|
void voodooTarget(PLAYER *pPlayer);
|
2019-09-19 22:42:45 +00:00
|
|
|
void playerLandingSound(PLAYER *pPlayer);
|
2020-11-07 14:16:12 +00:00
|
|
|
void PlayerSurvive(int, DBloodActor*);
|
2019-09-22 06:39:22 +00:00
|
|
|
|
|
|
|
END_BLD_NS
|