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.
|
|
|
|
#include "thingdef/thingdef.h"
|
|
|
|
|
2016-03-21 00:16:34 +00:00
|
|
|
#define WEAPONBOTTOM 128.
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// [RH] +0x6000 helps it meet the screen bottom
|
|
|
|
// at higher resolutions while still being in
|
|
|
|
// the right spot at 320x200.
|
2016-03-21 00:16:34 +00:00
|
|
|
#define WEAPONTOP (32+6./16)
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-05-09 18:03:47 +00:00
|
|
|
class AInventory;
|
|
|
|
class FArchive;
|
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-05-09 18:03:47 +00:00
|
|
|
enum psprnum_t // These are all called by the owner's ReadyWeapon.
|
2016-03-01 15:47:10 +00:00
|
|
|
{
|
2016-05-09 18:03:47 +00:00
|
|
|
ps_weapon = 1,
|
2016-03-01 15:47:10 +00:00
|
|
|
ps_flash,
|
|
|
|
ps_targetcenter,
|
|
|
|
ps_targetleft,
|
|
|
|
ps_targetright,
|
|
|
|
NUMPSPRITES
|
2016-05-09 18:03:47 +00:00
|
|
|
};
|
2016-03-01 15:47:10 +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:
|
|
|
|
DPSprite(player_t *owner, AInventory *caller, int id);
|
|
|
|
|
|
|
|
static void NewTick();
|
|
|
|
void SetState(FState *newstate, bool pending = false);
|
|
|
|
|
|
|
|
int GetID() const { return ID; }
|
|
|
|
int GetSprite() const { return Sprite; }
|
|
|
|
int GetFrame() const { return Frame; }
|
|
|
|
FState* GetState() const { return State; }
|
2016-05-21 11:11:43 +00:00
|
|
|
DPSprite* GetNext() { return Next; }
|
|
|
|
AInventory* GetCaller() { return Caller; }
|
2016-05-09 18:03:47 +00:00
|
|
|
|
|
|
|
double x, y;
|
|
|
|
double oldx, oldy;
|
|
|
|
bool firstTic;
|
|
|
|
int Tics;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DPSprite () {}
|
|
|
|
|
|
|
|
void Serialize(FArchive &arc);
|
|
|
|
void Tick();
|
|
|
|
void Destroy();
|
|
|
|
|
|
|
|
TObjPtr<AInventory> 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-05-24 11:05:43 +00:00
|
|
|
void P_SetPsprite(player_t *player, psprnum_t 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);
|
|
|
|
|
|
|
|
void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, DAngle pitch);
|
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);
|
|
|
|
|
|
|
|
DECLARE_ACTION(A_Raise)
|
|
|
|
void A_ReFire(AActor *self, FState *state = NULL);
|
|
|
|
|
|
|
|
#endif // __P_PSPR_H__
|