2016-03-01 15:47:10 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Sprite animation.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __P_PSPR_H__
|
|
|
|
#define __P_PSPR_H__
|
|
|
|
|
|
|
|
// 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
|
2016-05-09 18:03:47 +00:00
|
|
|
class AInventory;
|
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
|
|
|
|
{
|
|
|
|
PSPF_ADDWEAPON = 1 << 0,
|
|
|
|
PSPF_ADDBOB = 1 << 1,
|
2016-06-02 21:58:21 +00:00
|
|
|
PSPF_POWDOUBLE = 1 << 2,
|
|
|
|
PSPF_CVARFAST = 1 << 3,
|
2016-10-11 22:20:58 +00:00
|
|
|
PSPF_FLIP = 1 << 6,
|
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)
|
2016-11-19 15:39:45 +00:00
|
|
|
HAS_FIELDS
|
2016-05-09 18:03:47 +00:00
|
|
|
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; }
|
|
|
|
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; }
|
2016-05-09 18:03:47 +00:00
|
|
|
|
|
|
|
double x, y;
|
|
|
|
double oldx, oldy;
|
|
|
|
bool firstTic;
|
|
|
|
int Tics;
|
2016-05-26 19:51:52 +00:00
|
|
|
int Flags;
|
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
|
|
|
void Tick();
|
|
|
|
void Destroy();
|
|
|
|
|
2016-06-03 17:18:58 +00:00
|
|
|
TObjPtr<AActor> Caller;
|
2016-05-21 11:11:43 +00:00
|
|
|
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);
|
|
|
|
void P_DropWeapon (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 DoReadyWeapon(AActor *self);
|
|
|
|
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__
|