2016-03-01 15:47:10 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2017-04-17 11:33:19 +00:00
|
|
|
// Copyright 1993-1996 id Software
|
|
|
|
// Copyright 1994-1996 Raven Software
|
|
|
|
// Copyright 1999-2016 Randy Heit
|
|
|
|
// Copyright 2002-2016 Christoph Oelckers
|
2016-03-01 15:47:10 +00:00
|
|
|
//
|
2017-04-17 11:33:19 +00:00
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
2016-03-01 15:47:10 +00:00
|
|
|
//
|
2017-04-17 11:33:19 +00:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
2016-03-01 15:47:10 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2017-04-17 11:33:19 +00:00
|
|
|
// 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, see http://www.gnu.org/licenses/
|
2016-03-01 15:47:10 +00:00
|
|
|
//
|
2017-04-17 11:33:19 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
// DESCRIPTION:
|
|
|
|
// Sprite animation.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __P_PSPR_H__
|
|
|
|
#define __P_PSPR_H__
|
|
|
|
|
2020-04-11 17:02:14 +00:00
|
|
|
#include "renderstyle.h"
|
2017-04-15 14:41:00 +00:00
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
// Basic data types.
|
|
|
|
// Needs fixed point, and BAM angles.
|
|
|
|
|
2016-03-21 00:16:34 +00:00
|
|
|
#define WEAPONBOTTOM 128.
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-10-31 17:51:58 +00:00
|
|
|
#define WEAPONTOP 32.
|
|
|
|
#define WEAPON_FUDGE_Y 0.375
|
2017-03-10 01:22:42 +00:00
|
|
|
struct FTranslatedLineTarget;
|
2020-04-11 17:22:16 +00:00
|
|
|
struct FState;
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Overlay psprites are scaled shapes
|
|
|
|
// drawn directly on the view screen,
|
|
|
|
// coordinates are given for a 320*200 view screen.
|
|
|
|
//
|
2016-06-18 09:29:02 +00:00
|
|
|
enum PSPLayers
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-06-03 17:46:31 +00:00
|
|
|
PSP_STRIFEHANDS = -1,
|
2016-05-27 16:08:56 +00:00
|
|
|
PSP_WEAPON = 1,
|
|
|
|
PSP_FLASH = 1000,
|
|
|
|
PSP_TARGETCENTER = INT_MAX - 2,
|
|
|
|
PSP_TARGETLEFT,
|
|
|
|
PSP_TARGETRIGHT,
|
2016-05-09 18:03:47 +00:00
|
|
|
};
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-05-26 19:51:52 +00:00
|
|
|
enum PSPFlags
|
|
|
|
{
|
2016-09-29 02:20:15 +00:00
|
|
|
PSPF_ADDWEAPON = 1 << 0,
|
|
|
|
PSPF_ADDBOB = 1 << 1,
|
|
|
|
PSPF_POWDOUBLE = 1 << 2,
|
|
|
|
PSPF_CVARFAST = 1 << 3,
|
|
|
|
PSPF_ALPHA = 1 << 4,
|
|
|
|
PSPF_RENDERSTYLE = 1 << 5,
|
|
|
|
PSPF_FLIP = 1 << 6,
|
2016-09-29 16:10:15 +00:00
|
|
|
PSPF_FORCEALPHA = 1 << 7,
|
|
|
|
PSPF_FORCESTYLE = 1 << 8,
|
2017-05-26 00:46:36 +00:00
|
|
|
PSPF_MIRROR = 1 << 9,
|
2019-09-01 08:04:53 +00:00
|
|
|
PSPF_PLAYERTRANSLATED = 1 << 10
|
2016-05-26 19:51:52 +00:00
|
|
|
};
|
|
|
|
|
2016-05-09 18:03:47 +00:00
|
|
|
class DPSprite : public DObject
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-05-09 18:03:47 +00:00
|
|
|
DECLARE_CLASS (DPSprite, DObject)
|
|
|
|
HAS_OBJECT_POINTERS
|
|
|
|
public:
|
2016-06-03 17:18:58 +00:00
|
|
|
DPSprite(player_t *owner, AActor *caller, int id);
|
2016-05-09 18:03:47 +00:00
|
|
|
|
|
|
|
static void NewTick();
|
|
|
|
void SetState(FState *newstate, bool pending = false);
|
|
|
|
|
2016-05-26 19:58:46 +00:00
|
|
|
int GetID() const { return ID; }
|
|
|
|
int GetSprite() const { return Sprite; }
|
|
|
|
int GetFrame() const { return Frame; }
|
2016-06-17 15:21:42 +00:00
|
|
|
int GetTics() const { return Tics; }
|
2016-05-26 19:58:46 +00:00
|
|
|
FState* GetState() const { return State; }
|
|
|
|
DPSprite* GetNext() { return Next; }
|
2016-06-03 17:18:58 +00:00
|
|
|
AActor* GetCaller() { return Caller; }
|
2016-07-16 17:55:00 +00:00
|
|
|
void SetCaller(AActor *newcaller) { Caller = newcaller; }
|
2016-10-31 17:51:58 +00:00
|
|
|
void ResetInterpolation() { oldx = x; oldy = y; }
|
2017-01-12 21:49:18 +00:00
|
|
|
void OnDestroy() override;
|
2017-04-15 14:41:00 +00:00
|
|
|
std::pair<FRenderStyle, float> GetRenderStyle(FRenderStyle ownerstyle, double owneralpha);
|
2018-11-24 21:40:14 +00:00
|
|
|
float GetYAdjust(bool fullscreen);
|
2016-05-09 18:03:47 +00:00
|
|
|
|
2016-09-29 02:20:15 +00:00
|
|
|
double x, y, alpha;
|
2016-05-09 18:03:47 +00:00
|
|
|
double oldx, oldy;
|
|
|
|
bool firstTic;
|
|
|
|
int Tics;
|
2016-05-26 19:51:52 +00:00
|
|
|
int Flags;
|
2017-04-15 14:41:00 +00:00
|
|
|
FRenderStyle Renderstyle;
|
2016-05-09 18:03:47 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DPSprite () {}
|
|
|
|
|
2016-09-20 08:27:53 +00:00
|
|
|
void Serialize(FSerializer &arc);
|
2016-05-09 18:03:47 +00:00
|
|
|
|
2016-11-22 22:42:32 +00:00
|
|
|
public: // must be public to be able to generate the field export tables. Grrr...
|
2017-03-08 12:34:26 +00:00
|
|
|
TObjPtr<AActor*> Caller;
|
|
|
|
TObjPtr<DPSprite*> Next;
|
2016-05-09 18:03:47 +00:00
|
|
|
player_t *Owner;
|
|
|
|
FState *State;
|
|
|
|
int Sprite;
|
|
|
|
int Frame;
|
|
|
|
int ID;
|
|
|
|
bool processPending; // true: waiting for periodic processing on this tick
|
|
|
|
|
|
|
|
friend class player_t;
|
|
|
|
friend void CopyPlayer(player_t *dst, player_t *src, const char *name);
|
2016-03-01 15:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void P_NewPspriteTick();
|
|
|
|
void P_CalcSwing (player_t *player);
|
2016-06-16 12:24:00 +00:00
|
|
|
void P_SetPsprite(player_t *player, PSPLayers id, FState *state, bool pending = false);
|
2016-03-01 15:47:10 +00:00
|
|
|
void P_BringUpWeapon (player_t *player);
|
|
|
|
void P_FireWeapon (player_t *player);
|
2016-05-09 18:03:47 +00:00
|
|
|
void P_BobWeapon (player_t *player, float *x, float *y, double ticfrac);
|
2016-03-17 10:38:56 +00:00
|
|
|
DAngle P_BulletSlope (AActor *mo, FTranslatedLineTarget *pLineTarget = NULL, int aimflags = 0);
|
2016-11-14 13:12:27 +00:00
|
|
|
AActor *P_AimTarget(AActor *mo);
|
2016-03-17 10:38:56 +00:00
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
void DoReadyWeaponToBob(AActor *self);
|
|
|
|
void DoReadyWeaponToFire(AActor *self, bool primary = true, bool secondary = true);
|
|
|
|
void DoReadyWeaponToSwitch(AActor *self, bool switchable = true);
|
|
|
|
|
|
|
|
void A_ReFire(AActor *self, FState *state = NULL);
|
|
|
|
|
|
|
|
#endif // __P_PSPR_H__
|