mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-09 05:35:30 +03:00
eb014cce6c
- Fixed path_track paths saving as pointers instead of handles - Fixed player animations not falling to base class correctly - Fixed logic_externaldata creating garbage in trailing spaces - Added "SetHandModelSkin" input - Added unique colors for various types of console message, adjustable via convars - Added the ability to use map-specific weapon scripts - Added a way to display (placeholder) text entirely from Faceposer scenes - Added "autobreak" keyvalue to game_text, which automatically breaks long text into different lines - Added the ability to change a game_text's font (very limited) - Added LightToggle input to point_spotlight - Added Enable/DisableSprites on npc_manhack - Added ai_goal_police behavior from metrocops to Combine soldiers and citizens - Added func_precipitation particle rain systems from the Alien Swarm SDK - Added new func_precipitation spawnflags for controlling behavior in particle types - Added "mapbase_version" cvar which shows the version of Mapbase a mod might be running on - Fixed an oversight with NPC crouch activities which was causing npc_metropolice to stop firing in standoffs - Added toggleable patches to npc_combine AI which make soldiers less likely to stand around without shooting or rush to melee when not needed - Added key for custom logo font on env_credits scripts - Added SetSpeed and SetPushDir inputs for trigger_push - Added a bunch of I/O/KV to func_fish_pool to allow for more control over the fish - Added OnLostEnemy/Player support for npc_combine_camera - Added enhanced save/restore for the Response System, toggleable via convar - Added a convar which allows users to disable weapon autoswitching when picking up ammo - Split VScript base script into its own file - Added VScript descriptions for NPC squads and the manager class which handles them - Moved several classes, functions, etc. to the VScript library itself for future usage in other projects, like VBSP - Added VScript to VBSP with basic map file interfacing - Made some VScript documentation more clear due to deprecation of online documentation - Added VScript "hook" registration, creating a standardized system which shows up in script_help documentation - Added VScript-driven custom weapons - Added clientside VScript scopes - Added a bunch of weapon-related VScript functions - Split a bunch of cluttered VScript stuff into different files - Added VScript functions for "following" entities/bonemerging - Added VScript functions for grenades - Added a few more VScript trigger functions - Added OnDeath hook for VScript - Fixed documentation for aliased functions in VScript - Fixed $bumpmask not working on SDK_LightmappedGeneric - Made vertex blend swapping in Hammer use a constant instead of a combo (makes it easier to compile the shader, especially for $bumpmask's sake) - Fixed brush phong, etc. causing SDK_WorldVertexTransition to stop working - Added limited support for $envmapmask in the bumpmapping shader - Fixed more issues with parallax corrected cubemaps and instances - Made instance variable recursion consistent with VMFII
156 lines
4.6 KiB
C++
156 lines
4.6 KiB
C++
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $NoKeywords: $
|
|
//
|
|
//=============================================================================//
|
|
// fish.h
|
|
// Simple fish behavior
|
|
// Author: Michael S. Booth, April 2005
|
|
|
|
#ifndef _FISH_H_
|
|
#define _FISH_H_
|
|
|
|
#include "baseanimating.h"
|
|
#include "GameEventListener.h"
|
|
|
|
class CFishPool;
|
|
|
|
//----------------------------------------------------------------------------------------------
|
|
/**
|
|
* Simple ambient fish
|
|
*/
|
|
class CFish : public CBaseAnimating
|
|
{
|
|
public:
|
|
DECLARE_CLASS( CFish, CBaseAnimating );
|
|
DECLARE_SERVERCLASS();
|
|
DECLARE_DATADESC();
|
|
|
|
CFish( void );
|
|
virtual ~CFish();
|
|
|
|
void Initialize( CFishPool *pool, unsigned int id );
|
|
|
|
virtual void Spawn( void );
|
|
|
|
virtual void Event_Killed( const CTakeDamageInfo &info );
|
|
virtual void Touch( CBaseEntity *other ); ///< in contact with "other"
|
|
|
|
void Update( float deltaT ); ///< invoked each server tick
|
|
|
|
void FlockTo( CFish *other, float amount ); ///< influence my motion to flock with other nearby fish
|
|
float Avoid( void );
|
|
void Panic( void ); ///< panic for awhile
|
|
|
|
void ResetVisible( void ); ///< zero the visible vector
|
|
void AddVisible( CFish *fish ); ///< add this fish to our visible vector
|
|
|
|
private:
|
|
friend void SendProxy_FishOriginX( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
|
|
friend void SendProxy_FishOriginY( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID );
|
|
|
|
CHandle<CFishPool> m_pool; ///< the pool we are in
|
|
unsigned int m_id; ///< our unique ID
|
|
|
|
CNetworkVar( float, m_x ); ///< have to send position coordinates separately since Z is unused
|
|
CNetworkVar( float, m_y ); ///< have to send position coordinates separately since Z is unused
|
|
CNetworkVar( float, m_z ); ///< only sent once since fish always swim at the same depth
|
|
|
|
CNetworkVar( float, m_angle ); ///< only yaw changes
|
|
float m_angleChange;
|
|
Vector m_forward;
|
|
Vector m_perp;
|
|
|
|
CNetworkVar( Vector, m_poolOrigin ); ///< used to efficiently network our relative position
|
|
CNetworkVar( float, m_waterLevel );
|
|
|
|
float m_speed;
|
|
float m_desiredSpeed;
|
|
|
|
float m_calmSpeed; ///< speed the fish moves when calm
|
|
float m_panicSpeed; ///< speed the fish moves when panicked
|
|
|
|
float m_avoidRange; ///< range to avoid obstacles
|
|
|
|
CountdownTimer m_turnTimer; ///< every so often our turn preference changes
|
|
bool m_turnClockwise; ///< if true this fish prefers to turn clockwise, else CCW
|
|
|
|
CountdownTimer m_goTimer; ///< start the fish moving when timer elapses
|
|
CountdownTimer m_moveTimer; ///< dont decay speed while we are moving
|
|
CountdownTimer m_panicTimer; ///< if active, fish is panicked
|
|
CountdownTimer m_disperseTimer; ///< initial non-flocking time
|
|
|
|
CUtlVector< CFish * > m_visible; ///< vector of fish that we can see
|
|
};
|
|
|
|
|
|
//----------------------------------------------------------------------------------------------
|
|
/**
|
|
* This class defines a volume of water where a number of CFish swim
|
|
*/
|
|
class CFishPool : public CBaseEntity, public CGameEventListener
|
|
{
|
|
public:
|
|
DECLARE_CLASS( CFishPool, CBaseEntity );
|
|
DECLARE_DATADESC();
|
|
|
|
CFishPool( void );
|
|
|
|
virtual void Spawn();
|
|
|
|
virtual bool KeyValue( const char *szKeyName, const char *szValue );
|
|
|
|
virtual void FireGameEvent( IGameEvent *event );
|
|
|
|
void Update( void ); ///< invoked each server tick
|
|
|
|
float GetWaterLevel( void ) const; ///< return Z coordinate of water in world coords
|
|
float GetMaxRange( void ) const; ///< return how far a fish is allowed to wander
|
|
|
|
#ifdef MAPBASE
|
|
void InputSpawnFish( inputdata_t &inputdata );
|
|
void InputPanicLoudFromPoint( inputdata_t &inputdata );
|
|
void InputPanicQuietFromPoint( inputdata_t &inputdata );
|
|
#endif
|
|
|
|
private:
|
|
int m_fishCount; ///< number of fish in the pool
|
|
float m_maxRange; ///< how far a fish is allowed to wander
|
|
float m_swimDepth; ///< the depth the fish swim below the water surface
|
|
|
|
float m_waterLevel; ///< Z of water surface
|
|
|
|
bool m_isDormant;
|
|
|
|
CUtlVector< CHandle<CFish> > m_fishes; ///< vector of all fish in this pool
|
|
|
|
#ifdef MAPBASE
|
|
int m_nSkin; // Sets the skin of spawned fish
|
|
|
|
float m_flLoudPanicRange;
|
|
float m_flQuietPanicRange;
|
|
|
|
COutputEHANDLE m_OnSpawnFish;
|
|
#endif
|
|
|
|
CountdownTimer m_visTimer; ///< for throttling line of sight checks between all fish
|
|
};
|
|
|
|
|
|
inline float CFishPool::GetMaxRange( void ) const
|
|
{
|
|
return m_maxRange;
|
|
}
|
|
|
|
|
|
inline float CFishPool::GetWaterLevel( void ) const
|
|
{
|
|
return m_waterLevel;
|
|
}
|
|
|
|
|
|
#endif // _FISH_H_
|
|
|