mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-21 03:21:28 +00:00
move visual thinker definition into its own header
This commit is contained in:
parent
3622e2bb2a
commit
174344ddf1
9 changed files with 80 additions and 64 deletions
|
@ -46,6 +46,8 @@
|
|||
#include "symbols.h"
|
||||
#include "types.h"
|
||||
|
||||
#include "p_visualthinker.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
@ -421,7 +423,7 @@ PClass *PClass::FindClass (FName zaname)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
DObject *PClass::CreateNew()
|
||||
DObject *PClass::CreateNew(int *statnum)
|
||||
{
|
||||
uint8_t *mem = (uint8_t *)M_Malloc (Size);
|
||||
assert (mem != nullptr);
|
||||
|
@ -444,6 +446,12 @@ DObject *PClass::CreateNew()
|
|||
|
||||
((DObject *)mem)->SetClass (const_cast<PClass *>(this));
|
||||
InitializeSpecials(mem, Defaults, &PClass::SpecialInits);
|
||||
|
||||
if(statnum && ((DObject *)mem)->IsKindOf(RUNTIME_CLASS(DVisualThinker)))
|
||||
{
|
||||
*statnum = STAT_VISUALTHINKER;
|
||||
}
|
||||
|
||||
return (DObject *)mem;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
PClass();
|
||||
~PClass();
|
||||
void InsertIntoHash(bool native);
|
||||
DObject *CreateNew();
|
||||
DObject *CreateNew(int *statnum = nullptr);
|
||||
PClass *CreateDerivedClass(FName name, unsigned int size, bool *newlycreated = nullptr, int fileno = 0);
|
||||
|
||||
void InitializeActorInfo();
|
||||
|
|
|
@ -425,11 +425,9 @@ public:
|
|||
|
||||
DThinker *CreateThinker(PClass *cls, int statnum = STAT_DEFAULT)
|
||||
{
|
||||
DThinker *thinker = static_cast<DThinker*>(cls->CreateNew());
|
||||
DThinker *thinker = static_cast<DThinker*>(cls->CreateNew(&statnum));
|
||||
assert(thinker->IsKindOf(RUNTIME_CLASS(DThinker)));
|
||||
thinker->ObjectFlags |= OF_JustSpawned;
|
||||
if (thinker->IsKindOf(RUNTIME_CLASS(DVisualThinker))) // [MC] This absolutely must happen for this class!
|
||||
statnum = STAT_VISUALTHINKER;
|
||||
Thinkers.Link(thinker, statnum);
|
||||
thinker->Level = this;
|
||||
return thinker;
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "g_cvars.h"
|
||||
#include "d_main.h"
|
||||
|
||||
#include "p_visualthinker.h"
|
||||
|
||||
static int ThinkCount;
|
||||
static cycle_t ThinkCycles;
|
||||
extern cycle_t BotSupportCycles;
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "actorinlines.h"
|
||||
#include "g_game.h"
|
||||
#include "serializer_doom.h"
|
||||
#include "p_visualthinker.h"
|
||||
|
||||
#include "hwrenderer/scene/hw_drawstructs.h"
|
||||
|
||||
|
|
|
@ -147,62 +147,4 @@ struct SPortalHit
|
|||
void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff = 0, int flags = 0, PClassActor *spawnclass = NULL, DAngle angle = nullAngle, int duration = TICRATE, double sparsity = 1.0, double drift = 1.0, int SpiralOffset = 270, DAngle pitch = nullAngle);
|
||||
void P_DrawSplash (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int kind);
|
||||
void P_DrawSplash2 (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int updown, int kind);
|
||||
void P_DisconnectEffect (AActor *actor);
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// VisualThinkers
|
||||
// by Major Cooke
|
||||
// Credit to phantombeta, RicardoLuis0 & RaveYard for aid
|
||||
//
|
||||
//===========================================================================
|
||||
class HWSprite;
|
||||
struct FTranslationID;
|
||||
|
||||
enum EVisualThinkerFlags
|
||||
{
|
||||
VTF_FlipOffsetX = 1 << 0,
|
||||
VTF_FlipOffsetY = 1 << 1,
|
||||
VTF_FlipX = 1 << 2,
|
||||
VTF_FlipY = 1 << 3, // flip the sprite on the x/y axis.
|
||||
VTF_DontInterpolate = 1 << 4, // disable all interpolation
|
||||
VTF_AddLightLevel = 1 << 5, // adds sector light level to 'LightLevel'
|
||||
};
|
||||
|
||||
class DVisualThinker : public DThinker
|
||||
{
|
||||
DECLARE_CLASS(DVisualThinker, DThinker);
|
||||
public:
|
||||
DVector3 Prev;
|
||||
DVector2 Scale,
|
||||
Offset;
|
||||
float PrevRoll;
|
||||
int16_t LightLevel;
|
||||
FTranslationID Translation;
|
||||
FTextureID AnimatedTexture;
|
||||
sector_t *cursector;
|
||||
|
||||
int flags;
|
||||
|
||||
// internal only variables
|
||||
particle_t PT;
|
||||
HWSprite *spr; //in an effort to cache the result.
|
||||
|
||||
DVisualThinker();
|
||||
void Construct();
|
||||
void OnDestroy() override;
|
||||
|
||||
static DVisualThinker* NewVisualThinker(FLevelLocals* Level, PClass* type);
|
||||
void SetTranslation(FName trname);
|
||||
int GetRenderStyle();
|
||||
bool isFrozen();
|
||||
int GetLightLevel(sector_t *rendersector) const;
|
||||
FVector3 InterpolatedPosition(double ticFrac) const;
|
||||
float InterpolatedRoll(double ticFrac) const;
|
||||
|
||||
void Tick() override;
|
||||
void UpdateSpriteInfo();
|
||||
void Serialize(FSerializer& arc) override;
|
||||
|
||||
float GetOffset(bool y) const;
|
||||
};
|
||||
void P_DisconnectEffect (AActor *actor);
|
61
src/playsim/p_visualthinker.h
Normal file
61
src/playsim/p_visualthinker.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
|
||||
#include "palettecontainer.h"
|
||||
#include "hwrenderer/scene/hw_drawstructs.h"
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// VisualThinkers
|
||||
// by Major Cooke
|
||||
// Credit to phantombeta, RicardoLuis0 & RaveYard for aid
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
enum EVisualThinkerFlags
|
||||
{
|
||||
VTF_FlipOffsetX = 1 << 0,
|
||||
VTF_FlipOffsetY = 1 << 1,
|
||||
VTF_FlipX = 1 << 2,
|
||||
VTF_FlipY = 1 << 3, // flip the sprite on the x/y axis.
|
||||
VTF_DontInterpolate = 1 << 4, // disable all interpolation
|
||||
VTF_AddLightLevel = 1 << 5, // adds sector light level to 'LightLevel'
|
||||
};
|
||||
|
||||
class DVisualThinker : public DThinker
|
||||
{
|
||||
DECLARE_CLASS(DVisualThinker, DThinker);
|
||||
public:
|
||||
DVector3 Prev;
|
||||
DVector2 Scale,
|
||||
Offset;
|
||||
float PrevRoll;
|
||||
int16_t LightLevel;
|
||||
FTranslationID Translation;
|
||||
FTextureID AnimatedTexture;
|
||||
sector_t *cursector;
|
||||
|
||||
int flags;
|
||||
|
||||
// internal only variables
|
||||
particle_t PT;
|
||||
HWSprite *spr; //in an effort to cache the result.
|
||||
|
||||
DVisualThinker();
|
||||
void Construct();
|
||||
void OnDestroy() override;
|
||||
|
||||
static DVisualThinker* NewVisualThinker(FLevelLocals* Level, PClass* type);
|
||||
void SetTranslation(FName trname);
|
||||
int GetRenderStyle();
|
||||
bool isFrozen();
|
||||
int GetLightLevel(sector_t *rendersector) const;
|
||||
FVector3 InterpolatedPosition(double ticFrac) const;
|
||||
float InterpolatedRoll(double ticFrac) const;
|
||||
|
||||
void Tick() override;
|
||||
void UpdateSpriteInfo();
|
||||
void Serialize(FSerializer& arc) override;
|
||||
|
||||
float GetOffset(bool y) const;
|
||||
};
|
|
@ -44,6 +44,8 @@
|
|||
#include "hw_vertexbuilder.h"
|
||||
#include "hw_walldispatcher.h"
|
||||
|
||||
#include "p_visualthinker.h"
|
||||
|
||||
#ifdef ARCH_IA32
|
||||
#include <immintrin.h>
|
||||
#endif // ARCH_IA32
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
#include "hw_renderstate.h"
|
||||
#include "quaternion.h"
|
||||
|
||||
#include "p_visualthinker.h"
|
||||
|
||||
extern TArray<spritedef_t> sprites;
|
||||
extern TArray<spriteframe_t> SpriteFrames;
|
||||
extern uint32_t r_renderercaps;
|
||||
|
|
Loading…
Reference in a new issue