Browse Source

Update env_spritetrain

opforfixed
Roman Chistokhodov 5 years ago
parent
commit
10468b5f4e
  1. 70
      dlls/gearbox/gearbox_effects.cpp
  2. 60
      dlls/plats.cpp

70
dlls/gearbox/gearbox_effects.cpp

@ -19,7 +19,6 @@
#include "monsters.h" #include "monsters.h"
#include "effects.h" #include "effects.h"
//========================================================= //=========================================================
// CPitwormGibShooter // CPitwormGibShooter
//========================================================= //=========================================================
@ -63,72 +62,3 @@ CGib *CPitwormGibShooter::CreateGib(void)
return pGib; return pGib;
} }
//=========================================================
// CSpriteTrain
//=========================================================
class CSpriteTrain : public CSprite
{
public:
void Spawn( void );
void Precache( void );
void KeyValue(KeyValueData* pkvd);
virtual int Save(CSave &save);
virtual int Restore(CRestore &restore);
static TYPEDESCRIPTION m_SaveData[];
int m_iModelIndex;
int m_iSpeed;
float m_flScale;
};
LINK_ENTITY_TO_CLASS(env_spritetrain, CSpriteTrain);
TYPEDESCRIPTION CSpriteTrain::m_SaveData[] =
{
DEFINE_FIELD(CSpriteTrain, m_iModelIndex, FIELD_INTEGER),
DEFINE_FIELD(CSpriteTrain, m_iSpeed, FIELD_INTEGER),
DEFINE_FIELD(CSpriteTrain, m_flScale, FIELD_FLOAT),
};
IMPLEMENT_SAVERESTORE(CSpriteTrain, CSprite);
void CSpriteTrain::KeyValue(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "model"))
{
m_iModelIndex = PRECACHE_MODEL(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "scale"))
{
pev->scale = (float)atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "speed"))
{
pev->speed = (int)atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
CSprite::KeyValue(pkvd);
}
void CSpriteTrain::Spawn(void)
{
CSprite::Spawn();
}
void CSpriteTrain::Precache(void)
{
CSprite::Precache();
}

60
dlls/plats.cpp

@ -2222,3 +2222,63 @@ void CGunTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
Next(); Next();
} }
} }
//=========================================================
// CSpriteTrain
//=========================================================
class CSpriteTrain : public CFuncTrain
{
public:
void Spawn( void );
void Precache( void );
float m_maxFrame;
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
};
LINK_ENTITY_TO_CLASS(env_spritetrain, CSpriteTrain)
TYPEDESCRIPTION CSpriteTrain::m_SaveData[] =
{
DEFINE_FIELD( CSpriteTrain, m_maxFrame, FIELD_FLOAT ),
};
IMPLEMENT_SAVERESTORE( CSpriteTrain, CFuncTrain )
void CSpriteTrain::Spawn(void)
{
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_PUSH;
pev->effects = 0;
Precache();
SET_MODEL( ENT( pev ), STRING( pev->model ) );
if( pev->speed == 0 )
pev->speed = 100;
if( FStringNull(pev->target) )
ALERT( at_console, "%s with no target\n", STRING(pev->classname) );
if (!pev->rendermode)
pev->rendermode = kRenderTransAdd;
if (!pev->renderamt)
pev->renderamt = 255;
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
if( m_maxFrame > 0 )
pev->frame = m_maxFrame / 2;
UTIL_SetOrigin( pev, pev->origin );
m_activated = FALSE;
m_volume = 0;
}
void CSpriteTrain::Precache(void)
{
PRECACHE_MODEL( STRING( pev->model ) );
}

Loading…
Cancel
Save