Browse Source

Do not break Save/Restore(Think/Touch-functions must not virtual).

residual_point
Andrey Akhmichin 5 years ago
parent
commit
1ea69570cb
  1. 10
      dlls/hgrunt.cpp
  2. 14
      dlls/hgrunt.h
  3. 12
      dlls/osprey.cpp
  4. 4
      dlls/osprey.h
  5. 73
      dlls/rp/blkop_osprey.cpp
  6. 3
      dlls/rp/fgrunt.cpp
  7. 12
      dlls/rp/massn.cpp
  8. 3
      dlls/rp/ngrunt.cpp
  9. 3
      dlls/rp/zgrunt.cpp

10
dlls/hgrunt.cpp

@ -2189,6 +2189,16 @@ Schedule_t *CHGrunt::GetScheduleOfType( int Type )
// CHGruntRepel - when triggered, spawns a monster_human_grunt // CHGruntRepel - when triggered, spawns a monster_human_grunt
// repelling down a line. // repelling down a line.
//========================================================= //=========================================================
class CHGruntRepel : public CBaseMonster
{
public:
void Spawn(void);
void Precache(void);
void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
int m_iSpriteTexture; // Don't save, precache
};
LINK_ENTITY_TO_CLASS( monster_grunt_repel, CHGruntRepel ) LINK_ENTITY_TO_CLASS( monster_grunt_repel, CHGruntRepel )
void CHGruntRepel::Spawn( void ) void CHGruntRepel::Spawn( void )

14
dlls/hgrunt.h

@ -171,18 +171,4 @@ typedef enum
HGRUNT_SENT_TAUNT HGRUNT_SENT_TAUNT
} HGRUNT_SENTENCE_TYPES; } HGRUNT_SENTENCE_TYPES;
//=========================================================
// CHGruntRepel - when triggered, spawns a monster_human_grunt
// repelling down a line.
//=========================================================
class CHGruntRepel : public CBaseMonster
{
public:
virtual void Spawn(void);
virtual void Precache(void);
virtual void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
int m_iSpriteTexture; // Don't save, precache
};
#endif // HGRUNT_H #endif // HGRUNT_H

12
dlls/osprey.cpp

@ -135,9 +135,13 @@ void COsprey::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
void COsprey::FindAllThink( void ) void COsprey::FindAllThink( void )
{ {
CBaseEntity *pEntity = NULL; CBaseEntity *pEntity = NULL;
const char *pszName = "monster_human_grunt";
if( FClassnameIs( pev, "monster_blkop_osprey" ) )
pszName = "monster_male_assassin";
m_iUnits = 0; m_iUnits = 0;
while( m_iUnits < OSPREY_MAX_CARRY && ( pEntity = UTIL_FindEntityByClassname( pEntity, "monster_human_grunt" ) ) != NULL ) while( m_iUnits < OSPREY_MAX_CARRY && ( pEntity = UTIL_FindEntityByClassname( pEntity, pszName ) ) != NULL )
{ {
if( pEntity->IsAlive() ) if( pEntity->IsAlive() )
{ {
@ -208,6 +212,10 @@ CBaseMonster *COsprey::MakeGrunt( Vector vecSrc )
{ {
CBaseEntity *pEntity; CBaseEntity *pEntity;
CBaseMonster *pGrunt; CBaseMonster *pGrunt;
const char *pszName = "monster_human_grunt";
if( FClassnameIs( pev, "monster_blkop_osprey" ) )
pszName = "monster_male_assassin";
TraceResult tr; TraceResult tr;
UTIL_TraceLine( vecSrc, vecSrc + Vector( 0, 0, -4096.0 ), dont_ignore_monsters, ENT( pev ), &tr ); UTIL_TraceLine( vecSrc, vecSrc + Vector( 0, 0, -4096.0 ), dont_ignore_monsters, ENT( pev ), &tr );
@ -222,7 +230,7 @@ CBaseMonster *COsprey::MakeGrunt( Vector vecSrc )
{ {
m_hGrunt[i]->SUB_StartFadeOut(); m_hGrunt[i]->SUB_StartFadeOut();
} }
pEntity = Create( "monster_human_grunt", vecSrc, pev->angles ); pEntity = Create( pszName, vecSrc, pev->angles );
pGrunt = pEntity->MyMonsterPointer(); pGrunt = pEntity->MyMonsterPointer();
pGrunt->pev->movetype = MOVETYPE_FLY; pGrunt->pev->movetype = MOVETYPE_FLY;
pGrunt->pev->velocity = Vector( 0, 0, RANDOM_FLOAT( -196, -128 ) ); pGrunt->pev->velocity = Vector( 0, 0, RANDOM_FLOAT( -196, -128 ) );

4
dlls/osprey.h

@ -37,9 +37,9 @@ public:
void EXPORT DeployThink(void); void EXPORT DeployThink(void);
void Flight(void); void Flight(void);
void EXPORT HitTouch(CBaseEntity *pOther); void EXPORT HitTouch(CBaseEntity *pOther);
virtual void EXPORT FindAllThink(void); void EXPORT FindAllThink(void);
void EXPORT HoverThink(void); void EXPORT HoverThink(void);
virtual CBaseMonster *MakeGrunt(Vector vecSrc); CBaseMonster *MakeGrunt(Vector vecSrc);
void EXPORT CrashTouch(CBaseEntity *pOther); void EXPORT CrashTouch(CBaseEntity *pOther);
void EXPORT DyingThink(void); void EXPORT DyingThink(void);
void EXPORT CommandUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void EXPORT CommandUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);

73
dlls/rp/blkop_osprey.cpp

@ -31,13 +31,8 @@
class CBlkopOsprey : public COsprey class CBlkopOsprey : public COsprey
{ {
public: public:
void Spawn( void ); void Spawn( void );
void Precache( void ); void Precache( void );
void EXPORT FindAllThink(void);
CBaseMonster *MakeGrunt(Vector vecSrc);
}; };
LINK_ENTITY_TO_CLASS(monster_blkop_osprey, CBlkopOsprey); LINK_ENTITY_TO_CLASS(monster_blkop_osprey, CBlkopOsprey);
@ -99,71 +94,3 @@ void CBlkopOsprey::Precache(void)
m_iEngineGibs = PRECACHE_MODEL("models/blkop_enginegibs.mdl"); m_iEngineGibs = PRECACHE_MODEL("models/blkop_enginegibs.mdl");
} }
void CBlkopOsprey::FindAllThink(void)
{
CBaseEntity *pEntity = NULL;
m_iUnits = 0;
while (m_iUnits < MAX_CARRY && (pEntity = UTIL_FindEntityByClassname(pEntity, "monster_male_assassin")) != NULL)
{
if (pEntity->IsAlive())
{
m_hGrunt[m_iUnits] = pEntity;
m_vecOrigin[m_iUnits] = pEntity->pev->origin;
m_iUnits++;
}
}
if (m_iUnits == 0)
{
ALERT(at_console, "osprey error: no assassins to resupply\n");
UTIL_Remove(this);
return;
}
SetThink(&COsprey::FlyThink);
pev->nextthink = gpGlobals->time + 0.1;
m_startTime = gpGlobals->time;
}
CBaseMonster *CBlkopOsprey::MakeGrunt(Vector vecSrc)
{
CBaseEntity *pEntity;
CBaseMonster *pGrunt;
TraceResult tr;
UTIL_TraceLine(vecSrc, vecSrc + Vector(0, 0, -4096.0), dont_ignore_monsters, ENT(pev), &tr);
if (tr.pHit && Instance(tr.pHit)->pev->solid != SOLID_BSP)
return NULL;
for (int i = 0; i < m_iUnits; i++)
{
if (m_hGrunt[i] == 0 || !m_hGrunt[i]->IsAlive())
{
if (m_hGrunt[i] != 0 && m_hGrunt[i]->pev->rendermode == kRenderNormal)
{
m_hGrunt[i]->SUB_StartFadeOut();
}
pEntity = Create("monster_male_assassin", vecSrc, pev->angles);
pGrunt = pEntity->MyMonsterPointer();
pGrunt->pev->movetype = MOVETYPE_FLY;
pGrunt->pev->velocity = Vector(0, 0, RANDOM_FLOAT(-196, -128));
pGrunt->SetActivity(ACT_GLIDE);
CBeam *pBeam = CBeam::BeamCreate("sprites/rope.spr", 10);
pBeam->PointEntInit(vecSrc + Vector(0, 0, 112), pGrunt->entindex());
pBeam->SetFlags(BEAM_FSOLID);
pBeam->SetColor(255, 255, 255);
pBeam->SetThink(&CBeam::SUB_Remove);
pBeam->pev->nextthink = gpGlobals->time + -4096.0 * tr.flFraction / pGrunt->pev->velocity.z + 0.5;
// ALERT( at_console, "%d at %.0f %.0f %.0f\n", i, m_vecOrigin[i].x, m_vecOrigin[i].y, m_vecOrigin[i].z );
pGrunt->m_vecLastPosition = m_vecOrigin[i];
m_hGrunt[i] = pGrunt;
return pGrunt;
}
}
// ALERT( at_console, "none dead\n");
return NULL;
}

3
dlls/rp/fgrunt.cpp

@ -915,12 +915,13 @@ Schedule_t *CFGrunt::GetScheduleOfType( int Type )
// CNGruntRepel - when triggered, spawns a monster_nari_grunt // CNGruntRepel - when triggered, spawns a monster_nari_grunt
// repelling down a line. // repelling down a line.
//========================================================= //=========================================================
class CFGruntRepel : public CHGruntRepel class CFGruntRepel : public CBaseMonster
{ {
public: public:
void Spawn(void); void Spawn(void);
void Precache(void); void Precache(void);
void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
int m_iSpriteTexture; // Don't save, precache
}; };
LINK_ENTITY_TO_CLASS( monster_grunt_repel_ally, CFGruntRepel ) LINK_ENTITY_TO_CLASS( monster_grunt_repel_ally, CFGruntRepel )

12
dlls/rp/massn.cpp

@ -349,11 +349,13 @@ void CMassn::DeathSound(void)
// repelling down a line. // repelling down a line.
//========================================================= //=========================================================
class CAssassinRepel : public CHGruntRepel class CAssassinRepel : public CBaseMonster
{ {
public: public:
void Precache(void); void Precache(void);
void Spawn();
void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
int m_iSpriteTexture; // Don't save, precache
}; };
LINK_ENTITY_TO_CLASS(monster_assassin_repel, CAssassinRepel); LINK_ENTITY_TO_CLASS(monster_assassin_repel, CAssassinRepel);
@ -364,6 +366,14 @@ void CAssassinRepel::Precache(void)
m_iSpriteTexture = PRECACHE_MODEL("sprites/rope.spr"); m_iSpriteTexture = PRECACHE_MODEL("sprites/rope.spr");
} }
void CAssassinRepel::Spawn( void )
{
Precache();
pev->solid = SOLID_NOT;
SetUse( &CAssassinRepel::RepelUse );
}
void CAssassinRepel::RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) void CAssassinRepel::RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
TraceResult tr; TraceResult tr;

3
dlls/rp/ngrunt.cpp

@ -882,12 +882,13 @@ Schedule_t *CNGrunt::GetScheduleOfType( int Type )
// CNGruntRepel - when triggered, spawns a monster_nari_grunt // CNGruntRepel - when triggered, spawns a monster_nari_grunt
// repelling down a line. // repelling down a line.
//========================================================= //=========================================================
class CNGruntRepel : public CHGruntRepel class CNGruntRepel : public CBaseMonster
{ {
public: public:
void Spawn(void); void Spawn(void);
void Precache(void); void Precache(void);
void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
int m_iSpriteTexture; // Don't save, precache
}; };
LINK_ENTITY_TO_CLASS( monster_ngrunt_repel, CNGruntRepel ) LINK_ENTITY_TO_CLASS( monster_ngrunt_repel, CNGruntRepel )

3
dlls/rp/zgrunt.cpp

@ -933,12 +933,13 @@ Schedule_t *CZGrunt::GetScheduleOfType( int Type )
// CZGruntRepel - when triggered, spawns a monster_nari_grunt // CZGruntRepel - when triggered, spawns a monster_nari_grunt
// repelling down a line. // repelling down a line.
//========================================================= //=========================================================
class CZGruntRepel : public CHGruntRepel class CZGruntRepel : public CBaseMonster
{ {
public: public:
void Spawn(void); void Spawn(void);
void Precache(void); void Precache(void);
void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void EXPORT RepelUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
int m_iSpriteTexture; // Don't save, precache
}; };
LINK_ENTITY_TO_CLASS( monster_zgrunt_repel, CZGruntRepel ) LINK_ENTITY_TO_CLASS( monster_zgrunt_repel, CZGruntRepel )

Loading…
Cancel
Save