sin-2015/mortician.h
1999-04-22 00:00:00 +00:00

119 lines
3.5 KiB
C++

//-----------------------------------------------------------------------------
//
// Mortician header file by Boon, created 11-11-98
//
// DESCRIPTION:
// Mortician
//
#ifndef __MORTICIAN_H__
#define __MORTICIAN_H__
#include "g_local.h"
#include "actor.h"
class EXPORT_FROM_DLL Mortician : public Actor
{
public:
CLASS_PROTOTYPE( Mortician );
Mortician::Mortician();
/* virtual float MJumpTo( Vector targ,
float speed
);
virtual float MJumpTo( PathNode *goal,
float speed
);
virtual float MJumpTo( Entity *goal,
float speed
);
*/
virtual void JumpToEvent(Event *ev);
virtual void FlashEvent(Event *ev);
float JumpTo( Vector targ ); //Subtle alteration of regular jumpto
};
class EXPORT_FROM_DLL MJump : public Behavior
{
private:
float endtime;
str anim; //Temp variable for assembling animation names in
str jumpdir; //Used for the direction part of the animation name to be played
int state;
qboolean animdone;
Vector goal;
Vector temp_vel; //Used for destructive testing of velocity
qboolean accurate; //Do we need to land exactly there, or only near there?
EntityPtr target; //Used to tell him where to face if he's jumping around the player
Vector FindCloseSightNodeTo( Actor &self, Vector pos, float maxjumpdistance );
float heightwanted; // Height of ceiling which allows unrestricted jumping
float heightneeded; // Minimum height of ceiling for reasonable jumping
qboolean jumpok; // Set to false if there is not enough ceiling height
float oldworldheight; //Since self.velocity doesn't work real reliably due to animation vectors, I'm making my own
float upspeed; // Keep a flag on vertical velocity
qboolean jumpbegun; //Flag to note that we have taken off
public:
CLASS_PROTOTYPE( MJump );
MJump();
void SetArgs( Event *ev );
void ShowInfo( Actor &self );
void Begin( Actor &self );
qboolean Evaluate( Actor &self );
void End( Actor &self );
void AnimDone( Event *ev );
virtual void Archive( Archiver &arc );
virtual void Unarchive( Archiver &arc );
};
inline EXPORT_FROM_DLL void MJump::Archive
(
Archiver &arc
)
{
Behavior::Archive( arc );
arc.WriteFloat( endtime );
arc.WriteString( anim );
arc.WriteString( jumpdir );
arc.WriteInteger( state );
arc.WriteBoolean( animdone );
arc.WriteVector( goal );
arc.WriteVector( temp_vel );
arc.WriteBoolean( accurate );
arc.WriteSafePointer( target );
arc.WriteFloat( heightwanted );
arc.WriteFloat( heightneeded );
arc.WriteBoolean( jumpok );
arc.WriteFloat( oldworldheight );
arc.WriteFloat( upspeed );
arc.WriteBoolean( jumpbegun );
}
inline EXPORT_FROM_DLL void MJump::Unarchive
(
Archiver &arc
)
{
Behavior::Unarchive( arc );
arc.ReadFloat( &endtime );
arc.ReadString( &anim );
arc.ReadString( &jumpdir );
arc.ReadInteger( &state );
arc.ReadBoolean( &animdone );
arc.ReadVector( &goal );
arc.ReadVector( &temp_vel );
arc.ReadBoolean( &accurate );
arc.ReadSafePointer( &target );
arc.ReadFloat( &heightwanted );
arc.ReadFloat( &heightneeded );
arc.ReadBoolean( &jumpok );
arc.ReadFloat( &oldworldheight );
arc.ReadFloat( &upspeed );
arc.ReadBoolean( &jumpbegun );
}
#endif /* mortician.h */