Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
|
fdb2d67e7f |
53 changed files with 6891 additions and 2580 deletions
186
arcade_comm.cpp
Normal file
186
arcade_comm.cpp
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/arcade_comm.cpp $
|
||||||
|
// $Revision:: 5 $
|
||||||
|
// $Author:: Jimdose $
|
||||||
|
// $Date:: 2/16/99 8:38p $
|
||||||
|
//
|
||||||
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This source may not be distributed and/or modified without
|
||||||
|
// expressly written permission by Ritual Entertainment, Inc.
|
||||||
|
//
|
||||||
|
// $Log:: /Quake 2 Engine/Sin/code/game/arcade_comm.cpp $
|
||||||
|
//
|
||||||
|
// 5 2/16/99 8:38p Jimdose
|
||||||
|
// moved sin arcade comm stuff to client
|
||||||
|
//
|
||||||
|
// 4 12/14/98 8:16p Aldie
|
||||||
|
// Added a disablecom command
|
||||||
|
//
|
||||||
|
// 3 12/14/98 5:23p Aldie
|
||||||
|
// Added generic COM ports
|
||||||
|
//
|
||||||
|
// 2 12/08/98 7:04p Aldie
|
||||||
|
// First version of serial comm for arcade
|
||||||
|
//
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Sin Arcade Serial Communications
|
||||||
|
|
||||||
|
#ifdef SIN_ARCADE
|
||||||
|
|
||||||
|
#include "..\\client\\client.h"
|
||||||
|
#include "arcade_comm.h"
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
static LPDCB lpDCB=NULL;
|
||||||
|
static HANDLE COMHANDLE=NULL;
|
||||||
|
static cvar_t *disable_com;
|
||||||
|
|
||||||
|
void ARCADE_ComError
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
LPVOID lpMsgBuf;
|
||||||
|
|
||||||
|
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
|
NULL,
|
||||||
|
GetLastError(),
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||||
|
(LPTSTR)&lpMsgBuf,
|
||||||
|
0,
|
||||||
|
NULL );
|
||||||
|
|
||||||
|
// Display the string.
|
||||||
|
Com_Error( ERR_FATAL, (const char *)lpMsgBuf );
|
||||||
|
|
||||||
|
// Free the buffer.
|
||||||
|
LocalFree( lpMsgBuf );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
qboolean ARCADE_ComWriteByte
|
||||||
|
(
|
||||||
|
byte b
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
DWORD bytesWritten;
|
||||||
|
LPBYTE lpByte;
|
||||||
|
BOOL retval;
|
||||||
|
|
||||||
|
if ( disable_com->value )
|
||||||
|
return( true );
|
||||||
|
|
||||||
|
lpByte = (BYTE *)"UB";
|
||||||
|
|
||||||
|
if ( !lpDCB || !COMHANDLE )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
retval = WriteFile( COMHANDLE,
|
||||||
|
lpByte,
|
||||||
|
2,
|
||||||
|
&bytesWritten,
|
||||||
|
NULL );
|
||||||
|
if (!retval)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 50 millisecond wait for the board
|
||||||
|
Sleep( 50 );
|
||||||
|
|
||||||
|
// Byte command to send to the Universal Board
|
||||||
|
lpByte = &b;
|
||||||
|
|
||||||
|
// Send over the byte command
|
||||||
|
retval = WriteFile( COMHANDLE,
|
||||||
|
lpByte,
|
||||||
|
2,
|
||||||
|
&bytesWritten,
|
||||||
|
NULL );
|
||||||
|
|
||||||
|
if (!retval)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ARCADE_SetupCommunications
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
LPCTSTR lpDef;
|
||||||
|
BOOL retval;
|
||||||
|
cvar_t *comport;
|
||||||
|
const char *comstring;
|
||||||
|
|
||||||
|
if ( lpDCB ) // Already setup
|
||||||
|
return;
|
||||||
|
|
||||||
|
disable_com = Cvar_Get( "disablecom", "0", 0 );
|
||||||
|
|
||||||
|
if ( disable_com->value )
|
||||||
|
return;
|
||||||
|
|
||||||
|
comport = Cvar_Get( "comport", "1", 0 );
|
||||||
|
|
||||||
|
if ( comport->value == 2 )
|
||||||
|
{
|
||||||
|
lpDef = "COM2: baud=9600 parity=N data=8 stop=1";
|
||||||
|
comstring = "COM2";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lpDef = "COM1: baud=9600 parity=N data=8 stop=1";
|
||||||
|
comstring = "COM1";
|
||||||
|
}
|
||||||
|
|
||||||
|
lpDCB = new DCB;
|
||||||
|
|
||||||
|
retval = BuildCommDCB( lpDef, lpDCB );
|
||||||
|
|
||||||
|
if ( !retval )
|
||||||
|
{
|
||||||
|
// An error occurred creating the device
|
||||||
|
ARCADE_ComError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ( COMHANDLE = ( CreateFile( comstring,
|
||||||
|
GENERIC_WRITE,
|
||||||
|
0, // exclusive access
|
||||||
|
NULL, // no security attrs
|
||||||
|
OPEN_EXISTING,
|
||||||
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
|
NULL
|
||||||
|
) ) ) == (HANDLE) -1 )
|
||||||
|
{
|
||||||
|
Com_Error( ERR_FATAL, "Could not create COM I/O file\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PurgeComm( COMHANDLE, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ARCADE_CloseCommunications
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
CloseHandle( COMHANDLE );
|
||||||
|
free( lpDCB );
|
||||||
|
}
|
||||||
|
#endif
|
40
arcade_comm.h
Normal file
40
arcade_comm.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/arcade_comm.h $
|
||||||
|
// $Revision:: 3 $
|
||||||
|
// $Author:: Jimdose $
|
||||||
|
// $Date:: 2/16/99 8:38p $
|
||||||
|
//
|
||||||
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This source may not be distributed and/or modified without
|
||||||
|
// expressly written permission by Ritual Entertainment, Inc.
|
||||||
|
//
|
||||||
|
// $Log:: /Quake 2 Engine/Sin/code/game/arcade_comm.h $
|
||||||
|
//
|
||||||
|
// 3 2/16/99 8:38p Jimdose
|
||||||
|
// moved sin arcade comm stuff to client
|
||||||
|
//
|
||||||
|
// 2 12/14/98 5:55p Aldie
|
||||||
|
// First version of arcade communications
|
||||||
|
//
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Arcade Communications Functions
|
||||||
|
|
||||||
|
#ifndef __ARCADE_COMM_H__
|
||||||
|
#define __ARCADE_COMM_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ARCADE_SetupCommunications( void );
|
||||||
|
void ARCADE_CloseCommunications( void );
|
||||||
|
qboolean ARCADE_ComWriteByte( byte b );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
188
bspline.cpp
188
bspline.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/bspline.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/bspline.cpp $
|
||||||
// $Revision:: 12 $
|
// $Revision:: 14 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 10/19/98 9:51p $
|
// $Date:: 8/07/99 1:53p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,12 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/bspline.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/bspline.cpp $
|
||||||
//
|
//
|
||||||
|
// 14 8/07/99 1:53p Markd
|
||||||
|
// Fixed a bunch of more code for version 1.06
|
||||||
|
//
|
||||||
|
// 13 5/19/99 11:30a Markd
|
||||||
|
// Added new camera support
|
||||||
|
//
|
||||||
// 12 10/19/98 9:51p Jimdose
|
// 12 10/19/98 9:51p Jimdose
|
||||||
// fixed savegame bugs with bspline
|
// fixed savegame bugs with bspline
|
||||||
//
|
//
|
||||||
|
@ -601,10 +607,14 @@ int BSpline::PickControlPoint
|
||||||
CLASS_DECLARATION( Entity, SplinePath, "info_splinepath" );
|
CLASS_DECLARATION( Entity, SplinePath, "info_splinepath" );
|
||||||
|
|
||||||
Event EV_SplinePath_Create( "SplinePath_create" );
|
Event EV_SplinePath_Create( "SplinePath_create" );
|
||||||
|
Event EV_SplinePath_Loop( "loop", EV_CONSOLE );
|
||||||
|
Event EV_SplinePath_Speed( "speed" );
|
||||||
|
|
||||||
ResponseDef SplinePath::Responses[] =
|
ResponseDef SplinePath::Responses[] =
|
||||||
{
|
{
|
||||||
{ &EV_SplinePath_Create, ( Response )SplinePath::CreatePath },
|
{ &EV_SplinePath_Create, ( Response )SplinePath::CreatePath },
|
||||||
|
{ &EV_SplinePath_Loop, ( Response )SplinePath::SetLoop },
|
||||||
|
{ &EV_SplinePath_Speed, ( Response )SplinePath::SetSpeed },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -613,6 +623,9 @@ SplinePath::SplinePath()
|
||||||
owner = this;
|
owner = this;
|
||||||
next = NULL;
|
next = NULL;
|
||||||
loop = NULL;
|
loop = NULL;
|
||||||
|
doWatch = false;
|
||||||
|
watchEnt = "";
|
||||||
|
|
||||||
loop_name = G_GetStringArg( "loop" );
|
loop_name = G_GetStringArg( "loop" );
|
||||||
angles = G_GetVectorArg( "angles" );
|
angles = G_GetVectorArg( "angles" );
|
||||||
speed = G_GetFloatArg( "speed", 1 );
|
speed = G_GetFloatArg( "speed", 1 );
|
||||||
|
@ -626,6 +639,25 @@ SplinePath::SplinePath()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SplinePath::~SplinePath()
|
||||||
|
{
|
||||||
|
// disconnect from the chain
|
||||||
|
if ( owner != this )
|
||||||
|
{
|
||||||
|
owner->SetNext( next );
|
||||||
|
owner = this;
|
||||||
|
}
|
||||||
|
else if ( next )
|
||||||
|
{
|
||||||
|
next->SetPrev( NULL );
|
||||||
|
next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( owner == this );
|
||||||
|
assert( next == NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SplinePath::CreatePath
|
void SplinePath::CreatePath
|
||||||
(
|
(
|
||||||
Event *ev
|
Event *ev
|
||||||
|
@ -675,3 +707,153 @@ SplinePath *SplinePath::GetLoop
|
||||||
{
|
{
|
||||||
return loop;
|
return loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplinePath::SetLoop
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
loop_name = ev->GetString( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SplinePath::SetSpeed
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
speed = ev->GetFloat( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
SplinePath *SplinePath::GetPrev
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( owner == this )
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SplinePath::SetNext
|
||||||
|
(
|
||||||
|
SplinePath *node
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( next )
|
||||||
|
{
|
||||||
|
// remove ourselves from the chain
|
||||||
|
next->owner = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
next = node;
|
||||||
|
if ( next )
|
||||||
|
{
|
||||||
|
// disconnect next from it's previous node
|
||||||
|
if ( next->owner != next )
|
||||||
|
{
|
||||||
|
next->owner->next = NULL;
|
||||||
|
}
|
||||||
|
next->owner = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SplinePath::SetPrev
|
||||||
|
(
|
||||||
|
SplinePath *node
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( owner != this )
|
||||||
|
{
|
||||||
|
owner->next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( node && ( node != this ) )
|
||||||
|
{
|
||||||
|
// safely remove the node from its chain
|
||||||
|
if ( node->next )
|
||||||
|
{
|
||||||
|
node->next->owner = node->next;
|
||||||
|
}
|
||||||
|
node->next = this;
|
||||||
|
owner = node;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
owner = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SplinePath::SetWatch
|
||||||
|
(
|
||||||
|
const char *name
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
doWatch = true;
|
||||||
|
watchEnt = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SplinePath::NoWatch
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
doWatch = true;
|
||||||
|
watchEnt = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity *SplinePath::GetWatch
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
int t;
|
||||||
|
|
||||||
|
name = watchEnt.c_str();
|
||||||
|
if ( name[ 0 ] == '$' )
|
||||||
|
{
|
||||||
|
t = G_FindTarget( 0, &name[ 1 ] );
|
||||||
|
if ( !t )
|
||||||
|
{
|
||||||
|
warning( "GetWatch", "Entity with targetname of '%s' not found", &name[ 1 ] );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( name[ 0 ] != '*' )
|
||||||
|
{
|
||||||
|
warning( "GetWatch", "Expecting a '*'-prefixed entity number but found '%s'.", name );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !IsNumeric( &name[ 1 ] ) )
|
||||||
|
{
|
||||||
|
warning( "GetWatch", "Expecting a numeric value but found '%s'.", &name[ 1 ] );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = atoi( &name[ 1 ] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ( t < 0 ) || ( t > game.maxentities ) )
|
||||||
|
{
|
||||||
|
warning( "GetWatch", "%d out of valid range for entity.", t );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return G_GetEntity( t );
|
||||||
|
}
|
||||||
|
|
30
bspline.h
30
bspline.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/bspline.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/bspline.h $
|
||||||
// $Revision:: 19 $
|
// $Revision:: 20 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 10/25/98 11:52p $
|
// $Date:: 5/19/99 11:30a $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/bspline.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/bspline.h $
|
||||||
//
|
//
|
||||||
|
// 20 5/19/99 11:30a Markd
|
||||||
|
// Added new camera support
|
||||||
|
//
|
||||||
// 19 10/25/98 11:52p Jimdose
|
// 19 10/25/98 11:52p Jimdose
|
||||||
// added EXPORT_TEMPLATE
|
// added EXPORT_TEMPLATE
|
||||||
//
|
//
|
||||||
|
@ -554,6 +557,10 @@ template class EXPORT_FROM_DLL SafePtr<SplinePath>;
|
||||||
#endif
|
#endif
|
||||||
typedef SafePtr<SplinePath> SplinePathPtr;
|
typedef SafePtr<SplinePath> SplinePathPtr;
|
||||||
|
|
||||||
|
extern Event EV_SplinePath_Create;
|
||||||
|
extern Event EV_SplinePath_Loop;
|
||||||
|
extern Event EV_SplinePath_Speed;
|
||||||
|
|
||||||
class EXPORT_FROM_DLL SplinePath : public Entity
|
class EXPORT_FROM_DLL SplinePath : public Entity
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -563,15 +570,26 @@ class EXPORT_FROM_DLL SplinePath : public Entity
|
||||||
str loop_name;
|
str loop_name;
|
||||||
|
|
||||||
void CreatePath( Event *ev );
|
void CreatePath( Event *ev );
|
||||||
|
void SetLoop( Event *ev );
|
||||||
|
void SetSpeed( Event *ev );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float speed;
|
float speed;
|
||||||
|
qboolean doWatch;
|
||||||
|
str watchEnt;
|
||||||
|
|
||||||
CLASS_PROTOTYPE( SplinePath );
|
CLASS_PROTOTYPE( SplinePath );
|
||||||
|
|
||||||
SplinePath();
|
SplinePath();
|
||||||
|
~SplinePath();
|
||||||
SplinePath *GetNext( void );
|
SplinePath *GetNext( void );
|
||||||
|
SplinePath *GetPrev( void );
|
||||||
SplinePath *GetLoop( void );
|
SplinePath *GetLoop( void );
|
||||||
|
void SetWatch( const char *name );
|
||||||
|
void NoWatch( void );
|
||||||
|
Entity *GetWatch( void );
|
||||||
|
void SetNext( SplinePath *node );
|
||||||
|
void SetPrev( SplinePath *node );
|
||||||
virtual void Archive( Archiver &arc );
|
virtual void Archive( Archiver &arc );
|
||||||
virtual void Unarchive( Archiver &arc );
|
virtual void Unarchive( Archiver &arc );
|
||||||
};
|
};
|
||||||
|
@ -589,6 +607,8 @@ inline EXPORT_FROM_DLL void SplinePath::Archive
|
||||||
arc.WriteSafePointer( loop );
|
arc.WriteSafePointer( loop );
|
||||||
arc.WriteString( loop_name );
|
arc.WriteString( loop_name );
|
||||||
arc.WriteFloat( speed );
|
arc.WriteFloat( speed );
|
||||||
|
arc.WriteBoolean( doWatch );
|
||||||
|
arc.WriteString( watchEnt );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline EXPORT_FROM_DLL void SplinePath::Unarchive
|
inline EXPORT_FROM_DLL void SplinePath::Unarchive
|
||||||
|
@ -604,6 +624,10 @@ inline EXPORT_FROM_DLL void SplinePath::Unarchive
|
||||||
arc.ReadSafePointer( &loop );
|
arc.ReadSafePointer( &loop );
|
||||||
arc.ReadString( &loop_name );
|
arc.ReadString( &loop_name );
|
||||||
arc.ReadFloat( &speed );
|
arc.ReadFloat( &speed );
|
||||||
|
arc.ReadBoolean( &doWatch );
|
||||||
|
arc.ReadString( &watchEnt );
|
||||||
|
|
||||||
|
CancelEventsOfType( EV_SplinePath_Create );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __BSPLINE_H__ */
|
#endif /* __BSPLINE_H__ */
|
||||||
|
|
14
bullet.h
14
bullet.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/bullet.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/bullet.h $
|
||||||
// $Revision:: 21 $
|
// $Revision:: 22 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Markd $
|
||||||
// $Date:: 8/06/98 10:53p $
|
// $Date:: 2/26/99 5:54p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/bullet.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/bullet.h $
|
||||||
//
|
//
|
||||||
|
// 22 2/26/99 5:54p Markd
|
||||||
|
// Re-arranged for better sub-classing
|
||||||
|
//
|
||||||
// 21 8/06/98 10:53p Aldie
|
// 21 8/06/98 10:53p Aldie
|
||||||
// Added weapon tweaks and kickback. Also modified blast radius damage and
|
// Added weapon tweaks and kickback. Also modified blast radius damage and
|
||||||
// rocket jumping.
|
// rocket jumping.
|
||||||
|
@ -89,13 +92,14 @@
|
||||||
class EXPORT_FROM_DLL BulletWeapon : public Weapon
|
class EXPORT_FROM_DLL BulletWeapon : public Weapon
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
BulletWeapon();
|
|
||||||
virtual void TraceAttack( Vector start, Vector end, int damage, trace_t *trace, int numricochets, int kick, int dflags, int meansofdeath, qboolean server_effects );
|
virtual void TraceAttack( Vector start, Vector end, int damage, trace_t *trace, int numricochets, int kick, int dflags, int meansofdeath, qboolean server_effects );
|
||||||
virtual void FireBullets( int numbullets, Vector spread, int mindamage, int maxdamage, int dflags, int meansofdeath, qboolean server_effects );
|
|
||||||
virtual void FireTracer( void );
|
virtual void FireTracer( void );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLASS_PROTOTYPE( BulletWeapon );
|
CLASS_PROTOTYPE( BulletWeapon );
|
||||||
|
|
||||||
|
BulletWeapon();
|
||||||
|
virtual void FireBullets( int numbullets, Vector spread, int mindamage, int maxdamage, int dflags, int meansofdeath, qboolean server_effects );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* BULLET.h */
|
#endif /* BULLET.h */
|
||||||
|
|
776
camera.cpp
776
camera.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/camera.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/camera.cpp $
|
||||||
// $Revision:: 47 $
|
// $Revision:: 52 $
|
||||||
// $Author:: Markd $
|
// $Author:: Markd $
|
||||||
// $Date:: 11/14/98 2:33a $
|
// $Date:: 11/02/99 12:09p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,21 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/camera.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/camera.cpp $
|
||||||
//
|
//
|
||||||
|
// 52 11/02/99 12:09p Markd
|
||||||
|
// Fixed CTF cheat bug
|
||||||
|
//
|
||||||
|
// 51 10/28/99 10:43a Markd
|
||||||
|
// made a bunch of console commands cheat protected
|
||||||
|
//
|
||||||
|
// 50 5/19/99 4:57p Markd
|
||||||
|
// fixed some errors
|
||||||
|
//
|
||||||
|
// 49 5/19/99 11:30a Markd
|
||||||
|
// Added new camera support
|
||||||
|
//
|
||||||
|
// 48 3/19/99 8:58p Aldie
|
||||||
|
// Added SetCurrentDistance
|
||||||
|
//
|
||||||
// 47 11/14/98 2:33a Markd
|
// 47 11/14/98 2:33a Markd
|
||||||
// put in some better jump cutting
|
// put in some better jump cutting
|
||||||
//
|
//
|
||||||
|
@ -167,6 +182,10 @@
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
|
|
||||||
|
#define CAMERA_PATHFILE_VERSION 1
|
||||||
|
|
||||||
|
CameraManager CameraMan;
|
||||||
|
|
||||||
cvar_t *sv_showcameras;
|
cvar_t *sv_showcameras;
|
||||||
|
|
||||||
Event EV_Camera_FollowingPath( "followingpath" );
|
Event EV_Camera_FollowingPath( "followingpath" );
|
||||||
|
@ -1004,6 +1023,15 @@ void Camera::SetDistance
|
||||||
newstate.move.follow_dist = ev->GetFloat( 1 );
|
newstate.move.follow_dist = ev->GetFloat( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Camera::SetCurrentDistance
|
||||||
|
(
|
||||||
|
float dist
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
currentstate.move.follow_dist = dist;
|
||||||
|
}
|
||||||
|
|
||||||
void Camera::SetHeight
|
void Camera::SetHeight
|
||||||
(
|
(
|
||||||
Event *ev
|
Event *ev
|
||||||
|
@ -1345,6 +1373,19 @@ str &Camera::Thread
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Camera::Reset
|
||||||
|
(
|
||||||
|
Vector org,
|
||||||
|
Vector ang
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
setOrigin( org );
|
||||||
|
setAngles( ang );
|
||||||
|
InitializeState( currentstate );
|
||||||
|
InitializeState( newstate );
|
||||||
|
}
|
||||||
|
|
||||||
CLASS_DECLARATION( Camera, SecurityCamera, "func_securitycamera" );
|
CLASS_DECLARATION( Camera, SecurityCamera, "func_securitycamera" );
|
||||||
|
|
||||||
ResponseDef SecurityCamera::Responses[] =
|
ResponseDef SecurityCamera::Responses[] =
|
||||||
|
@ -1357,3 +1398,734 @@ SecurityCamera::SecurityCamera()
|
||||||
setModel( "camera.def" );
|
setModel( "camera.def" );
|
||||||
showModel();
|
showModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
|
||||||
|
Camera Manager
|
||||||
|
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
Event EV_CameraManager_NewPath( "new", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_SetPath( "setpath", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_SetTargetName( "settargetname", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_SetTarget( "settarget", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_AddPoint( "add", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_DeletePoint( "delete", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_MovePlayer( "moveplayer", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_ReplacePoint( "replace", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_NextPoint( "next", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_PreviousPoint( "prev", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_ShowPath( "show" );
|
||||||
|
Event EV_CameraManager_HidePath( "hide" );
|
||||||
|
Event EV_CameraManager_PlayPath( "play", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_LoopPath( "loop", EV_CONSOLE );
|
||||||
|
Event EV_CameraManager_StopPlayback( "stop" );
|
||||||
|
Event EV_CameraManager_Watch( "watch" );
|
||||||
|
Event EV_CameraManager_NoWatch( "nowatch" );
|
||||||
|
Event EV_CameraManager_Speed( "setspeed", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_Save( "save", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_Load( "load", EV_CONSOLE | EV_CHEAT );
|
||||||
|
Event EV_CameraManager_SaveMap( "savemap", EV_CONSOLE | EV_CHEAT );
|
||||||
|
|
||||||
|
CLASS_DECLARATION( Listener, CameraManager, NULL );
|
||||||
|
|
||||||
|
ResponseDef CameraManager::Responses[] =
|
||||||
|
{
|
||||||
|
{ &EV_CameraManager_NewPath, ( Response )CameraManager::NewPath },
|
||||||
|
{ &EV_CameraManager_SetPath, ( Response )CameraManager::SetPath },
|
||||||
|
{ &EV_CameraManager_SetTargetName, ( Response )CameraManager::SetTargetName },
|
||||||
|
{ &EV_CameraManager_SetTarget, ( Response )CameraManager::SetTarget },
|
||||||
|
{ &EV_CameraManager_SetPath, ( Response )CameraManager::SetPath },
|
||||||
|
{ &EV_CameraManager_AddPoint, ( Response )CameraManager::AddPoint },
|
||||||
|
{ &EV_CameraManager_ReplacePoint, ( Response )CameraManager::ReplacePoint },
|
||||||
|
{ &EV_CameraManager_DeletePoint, ( Response )CameraManager::DeletePoint },
|
||||||
|
{ &EV_CameraManager_MovePlayer, ( Response )CameraManager::MovePlayer },
|
||||||
|
{ &EV_CameraManager_NextPoint, ( Response )CameraManager::NextPoint },
|
||||||
|
{ &EV_CameraManager_PreviousPoint, ( Response )CameraManager::PreviousPoint },
|
||||||
|
{ &EV_CameraManager_ShowPath, ( Response )CameraManager::ShowPath },
|
||||||
|
{ &EV_CameraManager_HidePath, ( Response )CameraManager::HidePath },
|
||||||
|
{ &EV_CameraManager_PlayPath, ( Response )CameraManager::PlayPath },
|
||||||
|
{ &EV_CameraManager_LoopPath, ( Response )CameraManager::LoopPath },
|
||||||
|
{ &EV_CameraManager_StopPlayback, ( Response )CameraManager::StopPlayback },
|
||||||
|
{ &EV_CameraManager_Watch, ( Response )CameraManager::Watch },
|
||||||
|
{ &EV_CameraManager_NoWatch, ( Response )CameraManager::NoWatch },
|
||||||
|
{ &EV_CameraManager_Speed, ( Response )CameraManager::Speed },
|
||||||
|
{ &EV_CameraManager_Save, ( Response )CameraManager::Save },
|
||||||
|
{ &EV_CameraManager_Load, ( Response )CameraManager::Load },
|
||||||
|
{ &EV_CameraManager_SaveMap, ( Response )CameraManager::SaveMap },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
Player *CameraManager_GetPlayer
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
assert( g_edicts[ 1 ].entity && g_edicts[ 1 ].entity->isSubclassOf( Player ) );
|
||||||
|
if ( !g_edicts[ 1 ].entity || !( g_edicts[ 1 ].entity->isSubclassOf( Player ) ) )
|
||||||
|
{
|
||||||
|
gi.printf( "No player found.\n" );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( Player * )g_edicts[ 1 ].entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
CameraManager::CameraManager()
|
||||||
|
{
|
||||||
|
path = NULL;
|
||||||
|
current = NULL;
|
||||||
|
speed = 1;
|
||||||
|
watch = 0;
|
||||||
|
cam = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::NewPath
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( path )
|
||||||
|
{
|
||||||
|
path = NULL;
|
||||||
|
current = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessEvent( EV_CameraManager_ShowPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::SetPath
|
||||||
|
(
|
||||||
|
SplinePath *node
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
path = node;
|
||||||
|
current = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::SetPath
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Entity *ent;
|
||||||
|
|
||||||
|
if ( !ev->NumArgs() )
|
||||||
|
{
|
||||||
|
ev->Error( "Usage: cam setpath [pathname]" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ent = ev->GetEntity( 1 );
|
||||||
|
if ( !ent )
|
||||||
|
{
|
||||||
|
ev->Error( "Could not find path named '%s'.", ev->GetString( 1 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !ent->isSubclassOf( SplinePath ) )
|
||||||
|
{
|
||||||
|
ev->Error( "'%s' is not a camera path.", ev->GetString( 1 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPath( ( SplinePath * )ent );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::SetTargetName
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( ev->NumArgs() != 1 )
|
||||||
|
{
|
||||||
|
ev->Error( "Usage: cam targetname [name]" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !path )
|
||||||
|
{
|
||||||
|
ev->Error( "Camera path not set." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
path->SetTargetName( ev->GetString( 1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::SetTarget
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( ev->NumArgs() != 1 )
|
||||||
|
{
|
||||||
|
ev->Error( "Usage: cam target [name]" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !current )
|
||||||
|
{
|
||||||
|
ev->Error( "Camera path not set." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
current->SetTarget( ev->GetString( 1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::AddPoint
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Player *player;
|
||||||
|
SplinePath *prev;
|
||||||
|
SplinePath *next;
|
||||||
|
Vector ang;
|
||||||
|
Vector pos;
|
||||||
|
|
||||||
|
player = CameraManager_GetPlayer();
|
||||||
|
if ( player )
|
||||||
|
{
|
||||||
|
prev = current;
|
||||||
|
if ( current )
|
||||||
|
{
|
||||||
|
next = current->GetNext();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
player->GetPlayerView( &pos, &ang );
|
||||||
|
|
||||||
|
current = new SplinePath;
|
||||||
|
current->setOrigin( pos );
|
||||||
|
current->setAngles( ang );
|
||||||
|
current->speed = speed;
|
||||||
|
current->SetPrev( prev );
|
||||||
|
current->SetNext( next );
|
||||||
|
|
||||||
|
if ( !path )
|
||||||
|
{
|
||||||
|
path = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
CancelEventsOfType( EV_CameraManager_ShowPath );
|
||||||
|
ProcessEvent( EV_CameraManager_ShowPath );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::ReplacePoint
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Player *player;
|
||||||
|
Vector ang;
|
||||||
|
Vector pos;
|
||||||
|
|
||||||
|
player = CameraManager_GetPlayer();
|
||||||
|
if ( current && player )
|
||||||
|
{
|
||||||
|
player->GetPlayerView( &pos, &ang );
|
||||||
|
|
||||||
|
current->setOrigin( pos );
|
||||||
|
current->setAngles( ang );
|
||||||
|
current->speed = speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::DeletePoint
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
SplinePath *node;
|
||||||
|
|
||||||
|
if ( current )
|
||||||
|
{
|
||||||
|
node = current->GetNext();
|
||||||
|
if ( !node )
|
||||||
|
{
|
||||||
|
node = current->GetPrev();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( path == current )
|
||||||
|
{
|
||||||
|
path = current->GetNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
delete current;
|
||||||
|
current = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::MovePlayer
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Player *player;
|
||||||
|
Vector pos;
|
||||||
|
|
||||||
|
player = CameraManager_GetPlayer();
|
||||||
|
if ( current && player )
|
||||||
|
{
|
||||||
|
player->GetPlayerView( &pos, NULL );
|
||||||
|
|
||||||
|
player->setOrigin( current->origin - pos + player->origin );
|
||||||
|
player->setAngles( current->angles );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::NextPoint
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
SplinePath *next;
|
||||||
|
|
||||||
|
if ( current )
|
||||||
|
{
|
||||||
|
next = current->GetNext();
|
||||||
|
if ( next )
|
||||||
|
{
|
||||||
|
current = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::PreviousPoint
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
SplinePath *prev;
|
||||||
|
|
||||||
|
if ( current )
|
||||||
|
{
|
||||||
|
prev = current->GetPrev();
|
||||||
|
if ( prev )
|
||||||
|
{
|
||||||
|
current = prev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::ShowPath
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
SplinePath *node;
|
||||||
|
SplinePath *prev;
|
||||||
|
Vector mins( -8, -8, -8 );
|
||||||
|
Vector maxs( 8, 8, 8 );
|
||||||
|
|
||||||
|
if ( ev->NumArgs() )
|
||||||
|
{
|
||||||
|
Entity *ent;
|
||||||
|
|
||||||
|
ent = ev->GetEntity( 1 );
|
||||||
|
if ( !ent )
|
||||||
|
{
|
||||||
|
ev->Error( "Could not find path named '%s'.", ev->GetString( 1 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !ent->isSubclassOf( SplinePath ) )
|
||||||
|
{
|
||||||
|
ev->Error( "'%s' is not a camera path.", ev->GetString( 1 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPath( ( SplinePath * )ent );
|
||||||
|
}
|
||||||
|
|
||||||
|
prev = NULL;
|
||||||
|
for( node = path; node != NULL; node = node->GetNext() )
|
||||||
|
{
|
||||||
|
if ( prev )
|
||||||
|
{
|
||||||
|
//G_LineStipple( 4, ( unsigned short )( 0xF0F0F0F0 >> ( 7 - ( level.framenum & 7 ) ) ) );
|
||||||
|
G_DebugLine( prev->origin, node->origin, 1, 1, 1, 1 );
|
||||||
|
//G_LineStipple( 1, 0xffff );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( current == node )
|
||||||
|
{
|
||||||
|
G_DrawDebugNumber( node->origin + Vector( 0, 0, 20 ), node->speed, 0.5, 0, 1, 0, 1 );
|
||||||
|
G_DebugBBox( node->origin, mins, maxs, 1, 1, 0, 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
G_DebugBBox( node->origin, mins, maxs, 1, 0, 0, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
//G_LineWidth( 3 );
|
||||||
|
G_DebugLine( node->origin, node->origin + Vector( node->orientation[ 0 ] ) * 16, 1, 0, 0, 1 );
|
||||||
|
G_DebugLine( node->origin, node->origin + Vector( node->orientation[ 1 ] ) * 16, 0, 1, 0, 1 );
|
||||||
|
G_DebugLine( node->origin, node->origin + Vector( node->orientation[ 2 ] ) * 16, 0, 0, 1, 1 );
|
||||||
|
//G_LineWidth( 1 );
|
||||||
|
|
||||||
|
prev = node;
|
||||||
|
}
|
||||||
|
PostEvent( EV_CameraManager_ShowPath, FRAMETIME );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::HidePath
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
CancelEventsOfType( EV_CameraManager_ShowPath );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::StopPlayback
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( cam )
|
||||||
|
{
|
||||||
|
cam->Stop();
|
||||||
|
SetCamera( NULL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::PlayPath
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( cam )
|
||||||
|
{
|
||||||
|
SetCamera( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ev->NumArgs() )
|
||||||
|
{
|
||||||
|
Entity *ent;
|
||||||
|
|
||||||
|
ent = ev->GetEntity( 1 );
|
||||||
|
if ( !ent )
|
||||||
|
{
|
||||||
|
ev->Error( "Could not find path named '%s'.", ev->GetString( 1 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !ent->isSubclassOf( SplinePath ) )
|
||||||
|
{
|
||||||
|
ev->Error( "'%s' is not a camera path.", ev->GetString( 1 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPath( ( SplinePath * )ent );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( path )
|
||||||
|
{
|
||||||
|
if ( !cam )
|
||||||
|
{
|
||||||
|
cam = new Camera;
|
||||||
|
cam->SetTargetName( "_loadedcamera" );
|
||||||
|
}
|
||||||
|
|
||||||
|
cam->Reset( path->origin, path->angles );
|
||||||
|
cam->FollowPath( path, false, NULL );
|
||||||
|
SetCamera( cam );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::LoopPath
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( cam )
|
||||||
|
{
|
||||||
|
SetCamera( NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ev->NumArgs() )
|
||||||
|
{
|
||||||
|
Entity *ent;
|
||||||
|
|
||||||
|
ent = ev->GetEntity( 1 );
|
||||||
|
if ( !ent )
|
||||||
|
{
|
||||||
|
ev->Error( "Could not find path named '%s'.", ev->GetString( 1 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !ent->isSubclassOf( SplinePath ) )
|
||||||
|
{
|
||||||
|
ev->Error( "'%s' is not a camera path.", ev->GetString( 1 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetPath( ( SplinePath * )ent );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( path )
|
||||||
|
{
|
||||||
|
if ( !cam )
|
||||||
|
{
|
||||||
|
cam = new Camera;
|
||||||
|
cam->SetTargetName( "_loadedcamera" );
|
||||||
|
}
|
||||||
|
|
||||||
|
cam->Reset( path->origin, path->angles );
|
||||||
|
cam->FollowPath( path, true, NULL );
|
||||||
|
SetCamera( cam );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::Watch
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( current )
|
||||||
|
{
|
||||||
|
current->SetWatch( ev->GetString( 1 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::NoWatch
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( current )
|
||||||
|
{
|
||||||
|
current->NoWatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::Speed
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
speed = ev->GetFloat( 1 );
|
||||||
|
if ( current )
|
||||||
|
{
|
||||||
|
current->speed = speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::Save
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
SplinePath *node;
|
||||||
|
Archiver arc;
|
||||||
|
str filename;
|
||||||
|
int num;
|
||||||
|
|
||||||
|
if ( ev->NumArgs() != 1 )
|
||||||
|
{
|
||||||
|
ev->Error( "Usage: cam save [filename]" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
num = 0;
|
||||||
|
for( node = path; node != NULL; node = node->GetNext() )
|
||||||
|
{
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( num == 0 )
|
||||||
|
{
|
||||||
|
ev->Error( "Can't save. No points in path." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
filename = gi.GameDir();
|
||||||
|
filename += "/cams/";
|
||||||
|
filename += ev->GetString( 1 );
|
||||||
|
filename += ".cam";
|
||||||
|
|
||||||
|
if ( !path->targetname.length() )
|
||||||
|
{
|
||||||
|
path->SetTargetName( ev->GetString( 1 ) );
|
||||||
|
gi.printf( "Targetname set to '%s'\n", path->targetname.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
gi.printf( "Saving camera path to '%s'...\n", filename.c_str() );
|
||||||
|
|
||||||
|
arc.Create( filename );
|
||||||
|
arc.WriteInteger( CAMERA_PATHFILE_VERSION );
|
||||||
|
|
||||||
|
arc.WriteInteger( num );
|
||||||
|
arc.WriteSafePointer( path );
|
||||||
|
|
||||||
|
for( node = path; node != NULL; node = node->GetNext() )
|
||||||
|
{
|
||||||
|
arc.WriteObject( node );
|
||||||
|
}
|
||||||
|
|
||||||
|
arc.Close();
|
||||||
|
|
||||||
|
gi.printf( "done.\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraManager::Load
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Archiver arc;
|
||||||
|
str filename;
|
||||||
|
int version;
|
||||||
|
int i;
|
||||||
|
int num;
|
||||||
|
|
||||||
|
if ( ev->NumArgs() != 1 )
|
||||||
|
{
|
||||||
|
ev->Error( "Usage: cam load [filename]" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
filename = "cams/";
|
||||||
|
filename += ev->GetString( 1 );
|
||||||
|
filename += ".cam";
|
||||||
|
|
||||||
|
gi.printf( "Loading camera path from '%s'...\n", filename.c_str() );
|
||||||
|
|
||||||
|
arc.Read( filename );
|
||||||
|
version = arc.ReadInteger();
|
||||||
|
if ( version == CAMERA_PATHFILE_VERSION )
|
||||||
|
{
|
||||||
|
arc.ReadInteger( &num );
|
||||||
|
|
||||||
|
arc.ReadSafePointer( &path );
|
||||||
|
|
||||||
|
for( i = 0; i < num; i++ )
|
||||||
|
{
|
||||||
|
arc.ReadObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
arc.Close();
|
||||||
|
current = path;
|
||||||
|
|
||||||
|
gi.printf( "done.\n" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
arc.Close();
|
||||||
|
ev->Error( "Expecting version %d path file. Camera path file is version %d.", CAMERA_PATHFILE_VERSION, version );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CameraManager::SaveMap
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
SplinePath *node;
|
||||||
|
str buf;
|
||||||
|
char tempbuf[ 512 ];
|
||||||
|
str filename;
|
||||||
|
int num;
|
||||||
|
int index;
|
||||||
|
FILE * file;
|
||||||
|
|
||||||
|
if ( ev->NumArgs() != 1 )
|
||||||
|
{
|
||||||
|
ev->Error( "Usage: cam savemap [filename]" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
num = 0;
|
||||||
|
for( node = path; node != NULL; node = node->GetNext() )
|
||||||
|
{
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( num == 0 )
|
||||||
|
{
|
||||||
|
ev->Error( "Can't save. No points in path." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
filename = "cams/";
|
||||||
|
filename += ev->GetString( 1 );
|
||||||
|
filename += ".map";
|
||||||
|
|
||||||
|
if ( !path->targetname.length() )
|
||||||
|
{
|
||||||
|
path->SetTargetName( ev->GetString( 1 ) );
|
||||||
|
gi.printf( "Targetname set to '%s'\n", path->targetname.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
gi.printf( "Saving camera path to map '%s'...\n", filename.c_str() );
|
||||||
|
|
||||||
|
buf = "";
|
||||||
|
index = 0;
|
||||||
|
for( node = path; node != NULL; node = node->GetNext() )
|
||||||
|
{
|
||||||
|
sprintf( tempbuf, "// pathnode %d\n", index );
|
||||||
|
buf += str( tempbuf );
|
||||||
|
buf += "{\n";
|
||||||
|
sprintf( tempbuf, "\"classname\" \"info_splinepath\"\n" );
|
||||||
|
buf += str( tempbuf );
|
||||||
|
if ( index < ( num - 1 ) )
|
||||||
|
{
|
||||||
|
sprintf( tempbuf, "\"target\" \"camnode_%s_%d\"\n", ev->GetString( 1 ), index + 1 );
|
||||||
|
buf += str( tempbuf );
|
||||||
|
}
|
||||||
|
if ( !index )
|
||||||
|
{
|
||||||
|
sprintf( tempbuf, "\"targetname\" \"%s\"\n", ev->GetString( 1 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf( tempbuf, "\"targetname\" \"camnode_%s_%d\"\n", ev->GetString( 1 ), index );
|
||||||
|
}
|
||||||
|
buf += str( tempbuf );
|
||||||
|
sprintf( tempbuf, "\"origin\" \"%d %d %d\"\n", ( int )node->origin.x, ( int )node->origin.y, ( int )node->origin.z );
|
||||||
|
buf += str( tempbuf );
|
||||||
|
sprintf( tempbuf, "\"angles\" \"%d %d %d\"\n", ( int )anglemod( node->angles.x ), ( int )anglemod( node->angles.y ), ( int )anglemod( node->angles.z ) );
|
||||||
|
buf += str( tempbuf );
|
||||||
|
sprintf( tempbuf, "\"speed\" \"%.3f\"\n", node->speed );
|
||||||
|
buf += str( tempbuf );
|
||||||
|
buf += "}\n";
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
gi.CreatePath( filename.c_str() );
|
||||||
|
file = fopen( filename.c_str(), "wt" );
|
||||||
|
fwrite( buf.c_str(), 1, buf.length() + 1, file );
|
||||||
|
fclose( file );
|
||||||
|
|
||||||
|
gi.printf( "done.\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
88
camera.h
88
camera.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/camera.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/camera.h $
|
||||||
// $Revision:: 25 $
|
// $Revision:: 27 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 10/25/98 11:53p $
|
// $Date:: 5/19/99 11:30a $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,12 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/camera.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/camera.h $
|
||||||
//
|
//
|
||||||
|
// 27 5/19/99 11:30a Markd
|
||||||
|
// Added new camera support
|
||||||
|
//
|
||||||
|
// 26 3/19/99 8:59p Aldie
|
||||||
|
// Added SetCurrentDistance
|
||||||
|
//
|
||||||
// 25 10/25/98 11:53p Jimdose
|
// 25 10/25/98 11:53p Jimdose
|
||||||
// added EXPORT_TEMPLATE
|
// added EXPORT_TEMPLATE
|
||||||
//
|
//
|
||||||
|
@ -416,6 +422,9 @@ class EXPORT_FROM_DLL Camera : public Entity
|
||||||
str &NextCamera( void );
|
str &NextCamera( void );
|
||||||
str &Thread( void );
|
str &Thread( void );
|
||||||
str &Overlay( void );
|
str &Overlay( void );
|
||||||
|
void SetCurrentDistance( float dist );
|
||||||
|
|
||||||
|
void Reset( Vector org, Vector ang );
|
||||||
|
|
||||||
virtual void Archive( Archiver &arc );
|
virtual void Archive( Archiver &arc );
|
||||||
virtual void Unarchive( Archiver &arc );
|
virtual void Unarchive( Archiver &arc );
|
||||||
|
@ -510,4 +519,77 @@ class EXPORT_FROM_DLL SecurityCamera : public Camera
|
||||||
SecurityCamera();
|
SecurityCamera();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CameraManager : public Listener
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
SplinePathPtr path;
|
||||||
|
SplinePathPtr current;
|
||||||
|
float speed;
|
||||||
|
int watch;
|
||||||
|
CameraPtr cam;
|
||||||
|
|
||||||
|
void NewPath( Event *ev );
|
||||||
|
void SetPath( Event *ev );
|
||||||
|
void SetTargetName( Event *ev );
|
||||||
|
void SetTarget( Event *ev );
|
||||||
|
void AddPoint( Event *ev );
|
||||||
|
void ReplacePoint( Event *ev );
|
||||||
|
void DeletePoint( Event *ev );
|
||||||
|
void MovePlayer( Event *ev );
|
||||||
|
void NextPoint( Event *ev );
|
||||||
|
void PreviousPoint( Event *ev );
|
||||||
|
void ShowPath( Event *ev );
|
||||||
|
void HidePath( Event *ev );
|
||||||
|
void StopPlayback( Event *ev );
|
||||||
|
void PlayPath( Event *ev );
|
||||||
|
void LoopPath( Event *ev );
|
||||||
|
void Watch( Event *ev );
|
||||||
|
void NoWatch( Event *ev );
|
||||||
|
void Speed( Event *ev );
|
||||||
|
void Save( Event *ev );
|
||||||
|
void Load( Event *ev );
|
||||||
|
void SaveMap( Event *ev );
|
||||||
|
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CameraManager );
|
||||||
|
|
||||||
|
CameraManager();
|
||||||
|
void SetPath( SplinePath *node );
|
||||||
|
virtual void Archive( Archiver &arc );
|
||||||
|
virtual void Unarchive( Archiver &arc );
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void CameraManager::Archive
|
||||||
|
(
|
||||||
|
Archiver &arc
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Listener::Archive( arc );
|
||||||
|
|
||||||
|
arc.WriteSafePointer( path );
|
||||||
|
arc.WriteSafePointer( current );
|
||||||
|
arc.WriteFloat( speed );
|
||||||
|
arc.WriteInteger( watch );
|
||||||
|
arc.WriteSafePointer( cam );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void CameraManager::Unarchive
|
||||||
|
(
|
||||||
|
Archiver &arc
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Listener::Unarchive( arc );
|
||||||
|
|
||||||
|
arc.ReadSafePointer( &path );
|
||||||
|
arc.ReadSafePointer( ¤t );
|
||||||
|
arc.ReadFloat( &speed );
|
||||||
|
arc.ReadInteger( &watch );
|
||||||
|
arc.ReadSafePointer( &cam );
|
||||||
|
}
|
||||||
|
|
||||||
|
extern CameraManager CameraMan;
|
||||||
|
|
||||||
#endif /* camera.h */
|
#endif /* camera.h */
|
||||||
|
|
54
chaingun.cpp
54
chaingun.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/chaingun.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/chaingun.cpp $
|
||||||
// $Revision:: 43 $
|
// $Revision:: 45 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/18/98 6:11p $
|
// $Date:: 3/19/99 3:43p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,16 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/chaingun.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/chaingun.cpp $
|
||||||
//
|
//
|
||||||
|
// 45 3/19/99 3:43p Aldie
|
||||||
|
// Changed check for ammo in chaingun
|
||||||
|
//
|
||||||
|
// 44 3/02/99 9:06p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:08p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:38p Aldie
|
||||||
|
//
|
||||||
// 43 11/18/98 6:11p Jimdose
|
// 43 11/18/98 6:11p Jimdose
|
||||||
// fix problems with gravaxis
|
// fix problems with gravaxis
|
||||||
//
|
//
|
||||||
|
@ -289,6 +299,10 @@ EXPORT_FROM_DLL void Grenade::Setup
|
||||||
|
|
||||||
ev = new Event( EV_Grenade_Explode );
|
ev = new Event( EV_Grenade_Explode );
|
||||||
ev->AddEntity( world );
|
ev->AddEntity( world );
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
PostEvent( ev, 0.9 );
|
||||||
|
else
|
||||||
PostEvent( ev, 2.5 + G_Random(1.0) );
|
PostEvent( ev, 2.5 + G_Random(1.0) );
|
||||||
|
|
||||||
edict->s.effects |= EF_ROCKET;
|
edict->s.effects |= EF_ROCKET;
|
||||||
|
@ -331,8 +345,10 @@ ChainGun::ChainGun
|
||||||
modelIndex( "sprites/hvblast.spr" );
|
modelIndex( "sprites/hvblast.spr" );
|
||||||
modelIndex( "sprites/tracer.spr" );
|
modelIndex( "sprites/tracer.spr" );
|
||||||
modelIndex( "hvshell.def" );
|
modelIndex( "hvshell.def" );
|
||||||
}
|
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
alternate_fire = true;
|
||||||
|
}
|
||||||
|
|
||||||
void ChainGun::Shoot
|
void ChainGun::Shoot
|
||||||
(
|
(
|
||||||
|
@ -360,6 +376,36 @@ void ChainGun::Shoot
|
||||||
grenade = new Grenade;
|
grenade = new Grenade;
|
||||||
grenade->Setup( owner, pos, forward, up, right );
|
grenade->Setup( owner, pos, forward, up, right );
|
||||||
NextAttack( 0.8 );
|
NextAttack( 0.8 );
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
SetPrimaryMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qboolean ChainGun::HasAmmo
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( !owner )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( UnlimitedAmmo() )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ( ammo_clip_size && ammo_in_clip >= ammorequired ) || AmmoAvailable() >= ammorequired )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if ( ( ammo_clip_size && ammo_in_clip >= secondary_ammorequired ) || AmmoAvailable() >= secondary_ammorequired )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
10
chaingun.h
10
chaingun.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/chaingun.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/chaingun.h $
|
||||||
// $Revision:: 9 $
|
// $Revision:: 10 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/18/98 6:12p $
|
// $Date:: 3/19/99 3:43p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/chaingun.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/chaingun.h $
|
||||||
//
|
//
|
||||||
|
// 10 3/19/99 3:43p Aldie
|
||||||
|
// Changed ammo check for chaingun
|
||||||
|
//
|
||||||
// 9 11/18/98 6:12p Jimdose
|
// 9 11/18/98 6:12p Jimdose
|
||||||
// fix problems with gravaxis
|
// fix problems with gravaxis
|
||||||
//
|
//
|
||||||
|
@ -73,6 +76,7 @@ class EXPORT_FROM_DLL ChainGun : public BulletWeapon
|
||||||
|
|
||||||
ChainGun::ChainGun();
|
ChainGun::ChainGun();
|
||||||
virtual void Shoot( Event *ev );
|
virtual void Shoot( Event *ev );
|
||||||
|
virtual qboolean HasAmmo( Event *ev );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ChainGun.h */
|
#endif /* ChainGun.h */
|
||||||
|
|
261
ctf.h
261
ctf.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf.h $
|
||||||
// $Revision:: 2 $
|
// $Revision:: 11 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 10/10/98 3:03a $
|
// $Date:: 5/18/99 7:07p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,37 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/ctf.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/ctf.h $
|
||||||
//
|
//
|
||||||
|
// 11 5/18/99 7:07p Aldie
|
||||||
|
// Fix for forcejoin
|
||||||
|
//
|
||||||
|
// 10 3/19/99 9:41p Aldie
|
||||||
|
// Changed max_regen_health to 300 instead of 400
|
||||||
|
//
|
||||||
|
// 9 3/19/99 7:35p Aldie
|
||||||
|
// Added CTF_DROPPED_FLAG_TIMEOUT
|
||||||
|
//
|
||||||
|
// 8 3/19/99 4:28p Aldie
|
||||||
|
// externed ctfgame
|
||||||
|
//
|
||||||
|
// 7 3/19/99 4:19p Aldie
|
||||||
|
// Added tech regen time, changed grapple speed and max health
|
||||||
|
//
|
||||||
|
// 6 3/12/99 10:19p Aldie
|
||||||
|
// Change HALF to Shield
|
||||||
|
//
|
||||||
|
// 5 3/12/99 8:12p Aldie
|
||||||
|
// Added deathquad
|
||||||
|
//
|
||||||
|
// 4 3/12/99 4:55p Aldie
|
||||||
|
// Added CTF_CalcScores
|
||||||
|
//
|
||||||
|
// 3 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:08p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:38p Aldie
|
||||||
|
//
|
||||||
// 2 10/10/98 3:03a Jimdose
|
// 2 10/10/98 3:03a Jimdose
|
||||||
// Created file
|
// Created file
|
||||||
//
|
//
|
||||||
|
@ -34,29 +65,32 @@
|
||||||
#define __CTF_H__
|
#define __CTF_H__
|
||||||
|
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
|
#include "inventoryitem.h"
|
||||||
|
#include "specialfx.h"
|
||||||
|
#include "player.h"
|
||||||
|
|
||||||
#define CTF_VERSION 1.02
|
#define CTF_VERSION 1.00
|
||||||
#define CTF_VSTRING2(x) #x
|
#define CTF_VSTRING2(x) #x
|
||||||
#define CTF_VSTRING(x) CTF_VSTRING2(x)
|
#define CTF_VSTRING(x) CTF_VSTRING2(x)
|
||||||
#define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION)
|
#define CTF_STRING_VERSION CTF_VSTRING(CTF_VERSION)
|
||||||
|
|
||||||
#define STAT_CTF_TEAM1_PIC 17
|
#define STAT_CTF_TECH 7
|
||||||
#define STAT_CTF_TEAM1_CAPS 18
|
#define STAT_CTF_ID_VIEW 8
|
||||||
#define STAT_CTF_TEAM2_PIC 19
|
#define STAT_CTF_TEAM1_PIC 11
|
||||||
#define STAT_CTF_TEAM2_CAPS 20
|
#define STAT_CTF_TEAM1_CAPS 12
|
||||||
#define STAT_CTF_FLAG_PIC 21
|
#define STAT_CTF_TEAM2_PIC 13
|
||||||
#define STAT_CTF_JOINED_TEAM1_PIC 22
|
#define STAT_CTF_TEAM2_CAPS 14
|
||||||
#define STAT_CTF_JOINED_TEAM2_PIC 23
|
#define STAT_CTF_FLAG_PIC 15
|
||||||
#define STAT_CTF_TEAM1_HEADER 24
|
#define STAT_CTF_JOINED_TEAM1_PIC 16
|
||||||
#define STAT_CTF_TEAM2_HEADER 25
|
#define STAT_CTF_JOINED_TEAM2_PIC 17
|
||||||
#define STAT_CTF_TECH 26
|
#define STAT_CTF_TEAM1_HEADER 18
|
||||||
#define STAT_CTF_ID_VIEW 27
|
#define STAT_CTF_TEAM2_HEADER 19
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CTF_NOTEAM,
|
CTF_NOTEAM,
|
||||||
CTF_TEAM1,
|
CTF_TEAM_HARDCORPS,
|
||||||
CTF_TEAM2
|
CTF_TEAM_SINTEK
|
||||||
} ctfteam_t;
|
} ctfteam_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -72,14 +106,27 @@ typedef enum
|
||||||
CTF_GRAPPLE_STATE_HANG
|
CTF_GRAPPLE_STATE_HANG
|
||||||
} ctfgrapplestate_t;
|
} ctfgrapplestate_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
FIRE,
|
||||||
|
DAMAGE
|
||||||
|
} ctfsoundevent_t;
|
||||||
|
|
||||||
|
typedef struct ctfgame_s
|
||||||
|
{
|
||||||
|
int team_hardcorps;
|
||||||
|
int team_sintek;
|
||||||
|
int total_hardcorps, total_sintek; // these are only set when going into intermission!
|
||||||
|
float last_flag_capture;
|
||||||
|
int last_capture_team;
|
||||||
|
} ctfgame_t;
|
||||||
|
|
||||||
|
extern ctfgame_t ctfgame;
|
||||||
|
|
||||||
extern cvar_t *ctf;
|
extern cvar_t *ctf;
|
||||||
|
extern cvar_t *ctf_hardcorps_skin;
|
||||||
#define CTF_TEAM1_SKIN "ctf_r"
|
extern cvar_t *ctf_sintek_skin;
|
||||||
#define CTF_TEAM2_SKIN "ctf_b"
|
extern cvar_t *ctf_forcejoin;
|
||||||
|
|
||||||
#define DF_CTF_FORCEJOIN 131072
|
|
||||||
#define DF_ARMOR_PROTECT 262144
|
|
||||||
#define DF_CTF_NO_TECH 524288
|
|
||||||
|
|
||||||
#define CTF_CAPTURE_BONUS 15 // what you get for capture
|
#define CTF_CAPTURE_BONUS 15 // what you get for capture
|
||||||
#define CTF_TEAM_BONUS 10 // what your team gets for capture
|
#define CTF_TEAM_BONUS 10 // what your team gets for capture
|
||||||
|
@ -100,68 +147,132 @@ extern cvar_t *ctf;
|
||||||
#define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8
|
#define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8
|
||||||
#define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10
|
#define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10
|
||||||
#define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10
|
#define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10
|
||||||
|
|
||||||
#define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 // number of seconds before dropped flag auto-returns
|
#define CTF_AUTO_FLAG_RETURN_TIMEOUT 30 // number of seconds before dropped flag auto-returns
|
||||||
|
#define CTF_DROPPED_FLAG_RETURN_TIMEOUT 10 // number of seconds before dropped flag returns
|
||||||
#define CTF_TECH_TIMEOUT 60 // seconds before techs spawn again
|
#define CTF_TECH_TIMEOUT 60 // seconds before techs spawn again
|
||||||
|
#define CTF_GRAPPLE_SPEED 1000 // speed of grapple in flight
|
||||||
|
#define CTF_GRAPPLE_PULL_SPEED 700 // speed player is pulled at
|
||||||
|
#define CTF_TECH_REGENERATION_HEALTH 300 // max health with regeneration
|
||||||
|
#define CTF_TECH_REGENERATION_TIME 0.7 // time between regenerations
|
||||||
|
|
||||||
#define CTF_GRAPPLE_SPEED 650 // speed of grapple in flight
|
// FLAGS
|
||||||
#define CTF_GRAPPLE_PULL_SPEED 650 // speed player is pulled at
|
|
||||||
|
|
||||||
#if 0
|
class EXPORT_FROM_DLL CTF_Flag : public InventoryItem
|
||||||
void CTFInit(void);
|
{
|
||||||
|
protected:
|
||||||
|
ctfteam_t ctf_team;
|
||||||
|
|
||||||
void SP_info_player_team1(edict_t *self);
|
virtual void PickupFlag( Event *ev );
|
||||||
void SP_info_player_team2(edict_t *self);
|
virtual void ResetFlag( Event *ev );
|
||||||
|
|
||||||
char *CTFTeamName(int team);
|
public:
|
||||||
char *CTFOtherTeamName(int team);
|
qboolean limp;
|
||||||
void CTFAssignSkin(edict_t *ent, char *s);
|
|
||||||
void CTFAssignTeam(gclient_t *who);
|
|
||||||
edict_t *SelectCTFSpawnPoint (edict_t *ent);
|
|
||||||
qboolean CTFPickup_Flag(edict_t *ent, edict_t *other);
|
|
||||||
qboolean CTFDrop_Flag(edict_t *ent, gitem_t *item);
|
|
||||||
void CTFEffects(edict_t *player);
|
|
||||||
void CTFCalcScores(void);
|
|
||||||
void SetCTFStats(edict_t *ent);
|
|
||||||
void CTFDeadDropFlag(edict_t *self);
|
|
||||||
void CTFScoreboardMessage (edict_t *ent, edict_t *killer);
|
|
||||||
void CTFTeam_f (edict_t *ent);
|
|
||||||
void CTFID_f (edict_t *ent);
|
|
||||||
void CTFSay_Team(edict_t *who, char *msg);
|
|
||||||
void CTFFlagSetup (edict_t *ent);
|
|
||||||
void CTFResetFlag(int ctf_team);
|
|
||||||
void CTFFragBonuses(edict_t *targ, edict_t *inflictor, edict_t *attacker);
|
|
||||||
void CTFCheckHurtCarrier(edict_t *targ, edict_t *attacker);
|
|
||||||
|
|
||||||
// GRAPPLE
|
CLASS_PROTOTYPE( CTF_Flag );
|
||||||
void CTFWeapon_Grapple (edict_t *ent);
|
CTF_Flag();
|
||||||
void CTFPlayerResetGrapple(edict_t *ent);
|
};
|
||||||
void CTFGrapplePull(edict_t *self);
|
|
||||||
void CTFResetGrapple(edict_t *self);
|
class EXPORT_FROM_DLL CTF_Flag_Hardcorps : public CTF_Flag
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Flag_Hardcorps );
|
||||||
|
CTF_Flag_Hardcorps();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL CTF_Flag_Sintek : public CTF_Flag
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Flag_Sintek );
|
||||||
|
CTF_Flag_Sintek();
|
||||||
|
};
|
||||||
|
|
||||||
// TECH
|
// TECH
|
||||||
gitem_t *CTFWhat_Tech(edict_t *ent);
|
|
||||||
qboolean CTFPickup_Tech (edict_t *ent, edict_t *other);
|
|
||||||
void CTFDrop_Tech(edict_t *ent, gitem_t *item);
|
|
||||||
void CTFDeadDropTech(edict_t *ent);
|
|
||||||
void CTFSetupTechSpawn(void);
|
|
||||||
int CTFApplyResistance(edict_t *ent, int dmg);
|
|
||||||
int CTFApplyStrength(edict_t *ent, int dmg);
|
|
||||||
qboolean CTFApplyStrengthSound(edict_t *ent);
|
|
||||||
qboolean CTFApplyHaste(edict_t *ent);
|
|
||||||
void CTFApplyHasteSound(edict_t *ent);
|
|
||||||
void CTFApplyRegeneration(edict_t *ent);
|
|
||||||
qboolean CTFHasRegeneration(edict_t *ent);
|
|
||||||
void CTFRespawnTech(edict_t *ent);
|
|
||||||
|
|
||||||
void CTFOpenJoinMenu(edict_t *ent);
|
class EXPORT_FROM_DLL CTF_Tech : public InventoryItem
|
||||||
qboolean CTFStartClient(edict_t *ent);
|
{
|
||||||
|
protected:
|
||||||
|
Vector FindSpawnLocation( void );
|
||||||
|
void Timeout( Event *ev );
|
||||||
|
virtual void Pickup( Event *ev );
|
||||||
|
virtual qboolean Pickupable( Entity *other );
|
||||||
|
void HasTechMsg( edict_t *who );
|
||||||
|
|
||||||
qboolean CTFCheckRules(void);
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Tech );
|
||||||
|
CTF_Tech();
|
||||||
|
};
|
||||||
|
|
||||||
void SP_misc_ctf_banner (edict_t *ent);
|
class EXPORT_FROM_DLL CTF_Tech_Regeneration : public CTF_Tech
|
||||||
void SP_misc_ctf_small_banner (edict_t *ent);
|
{
|
||||||
#endif
|
protected:
|
||||||
|
void Regenerate( Event *ev );
|
||||||
|
float last_sound_event;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Tech_Regeneration );
|
||||||
|
CTF_Tech_Regeneration();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL CTF_Tech_Double : public CTF_Tech
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Tech_Double );
|
||||||
|
CTF_Tech_Double();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL CTF_Tech_Shield : public CTF_Tech
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Tech_Shield );
|
||||||
|
CTF_Tech_Shield();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL CTF_Tech_Aqua : public CTF_Tech
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Tech_Aqua );
|
||||||
|
CTF_Tech_Aqua();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL CTF_Tech_Jump : public CTF_Tech
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Tech_Jump );
|
||||||
|
CTF_Tech_Jump();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL CTF_Tech_Empathy : public CTF_Tech
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Tech_Empathy );
|
||||||
|
CTF_Tech_Empathy();
|
||||||
|
};
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL CTF_Tech_DeathQuad : public CTF_Tech
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
float last_sound_event;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTF_Tech_DeathQuad );
|
||||||
|
CTF_Tech_DeathQuad();
|
||||||
|
void Damage( Event *ev );
|
||||||
|
};
|
||||||
|
|
||||||
|
void CTF_Init(void);
|
||||||
|
char *CTF_TeamName(int team);
|
||||||
|
char *CTF_OtherTeamName(int team);
|
||||||
|
int CTF_OtherTeam( int team );
|
||||||
|
void CTF_UpdateStats( Player *player );
|
||||||
|
void CTF_ScoreboardMessage( Entity *ent, Entity *killer );
|
||||||
|
qboolean CTF_CheckRules( void );
|
||||||
|
Entity *SelectCTFSpawnPoint (edict_t *ent);
|
||||||
|
void CTF_InitFlags( void );
|
||||||
|
void CTF_FragBonuses( Sentient *targ, Sentient *attacker );
|
||||||
|
void CTF_CheckHurtCarrier( Entity *targ, Entity *attacker );
|
||||||
|
void CTF_CalcScores( void );
|
||||||
|
|
||||||
|
extern Event EV_Flag_Reset;
|
||||||
|
extern Event EV_Tech_Timeout;
|
||||||
|
|
||||||
#endif /* ctf.h */
|
#endif /* ctf.h */
|
||||||
|
|
93
ctf_player.h
93
ctf_player.h
|
@ -1,93 +0,0 @@
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf_player.h $
|
|
||||||
// $Revision:: 3 $
|
|
||||||
// $Author:: Jimdose $
|
|
||||||
// $Date:: 10/10/98 3:37a $
|
|
||||||
//
|
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// This source may not be distributed and/or modified without
|
|
||||||
// expressly written permission by Ritual Entertainment, Inc.
|
|
||||||
//
|
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/ctf_player.h $
|
|
||||||
//
|
|
||||||
// 3 10/10/98 3:37a Jimdose
|
|
||||||
// Began converting to Sin
|
|
||||||
//
|
|
||||||
// 2 10/10/98 3:03a Jimdose
|
|
||||||
// Created file
|
|
||||||
//
|
|
||||||
// 1 10/10/98 3:02a Jimdose
|
|
||||||
//
|
|
||||||
// DESCRIPTION:
|
|
||||||
// Player code for Threewave Capture the Flag.
|
|
||||||
//
|
|
||||||
// The original source for this code was graciously provided by Zoid and
|
|
||||||
// Id Software. Many thanks!
|
|
||||||
//
|
|
||||||
// Original credits:
|
|
||||||
//
|
|
||||||
// Programming - Dave 'Zoid' Kirsch
|
|
||||||
// Original CTF Art Design - Brian 'Whaleboy' Cozzens
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef __CTF_PLAYER_H__
|
|
||||||
#define __CTF_PLAYER_H__
|
|
||||||
|
|
||||||
#include "player.h"
|
|
||||||
#include "ctf.h"
|
|
||||||
|
|
||||||
class EXPORT_FROM_DLL CTF_Player : public Player
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
int team;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
CLASS_PROTOTYPE( CTF_Player );
|
|
||||||
|
|
||||||
CTF_Player();
|
|
||||||
virtual ~CTF_Player();
|
|
||||||
virtual void Init( void );
|
|
||||||
|
|
||||||
const char *TeamName( void );
|
|
||||||
const char *OtherTeamName( void );
|
|
||||||
int Team( void );
|
|
||||||
int OtherTeam( void );
|
|
||||||
|
|
||||||
virtual void Respawn( Event *ev );
|
|
||||||
virtual void Killed( Event *ev );
|
|
||||||
virtual void GotKill( Event *ev );
|
|
||||||
void ClientThink( Event *ev );
|
|
||||||
virtual void EndFrame( Event *ev );
|
|
||||||
|
|
||||||
virtual void UpdateStats( void );
|
|
||||||
|
|
||||||
virtual void Prethink( void );
|
|
||||||
virtual void Postthink( void );
|
|
||||||
|
|
||||||
virtual void Archive( Archiver &arc );
|
|
||||||
virtual void Unarchive( Archiver &arc );
|
|
||||||
};
|
|
||||||
|
|
||||||
inline EXPORT_FROM_DLL void CTF_Player::Archive
|
|
||||||
(
|
|
||||||
Archiver &arc
|
|
||||||
)
|
|
||||||
|
|
||||||
{
|
|
||||||
Player::Archive( arc );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline EXPORT_FROM_DLL void CTF_Player::Unarchive
|
|
||||||
(
|
|
||||||
Archiver &arc
|
|
||||||
)
|
|
||||||
|
|
||||||
{
|
|
||||||
Player::Unarchive( arc );
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ctf_player.h */
|
|
317
ctf_turret.cpp
317
ctf_turret.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf_turret.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf_turret.cpp $
|
||||||
// $Revision:: 2 $
|
// $Revision:: 14 $
|
||||||
// $Author:: Markd $
|
// $Author:: Aldie $
|
||||||
// $Date:: 2/19/99 7:49p $
|
// $Date:: 3/19/99 5:50p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,41 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/ctf_turret.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/ctf_turret.cpp $
|
||||||
//
|
//
|
||||||
|
// 14 3/19/99 5:50p Aldie
|
||||||
|
// Added MINLIGHT
|
||||||
|
//
|
||||||
|
// 13 3/19/99 5:49p Aldie
|
||||||
|
// Added minlight
|
||||||
|
//
|
||||||
|
// 12 3/19/99 5:13p Aldie
|
||||||
|
// Made turret non-droppable
|
||||||
|
//
|
||||||
|
// 11 3/17/99 3:55p Aldie
|
||||||
|
// Incremental CTF update
|
||||||
|
//
|
||||||
|
// 10 3/12/99 6:14p Markd
|
||||||
|
// added precaching and increased damages on heligun
|
||||||
|
//
|
||||||
|
// 9 3/11/99 1:46p Aldie
|
||||||
|
// Fix movement of turrets
|
||||||
|
//
|
||||||
|
// 8 3/05/99 5:51p Markd
|
||||||
|
// made vehicles respawn in CTF, fixed up turrets a bit more
|
||||||
|
//
|
||||||
|
// 7 3/05/99 5:10p Markd
|
||||||
|
// Fixed turrets being able to shoot themselves
|
||||||
|
//
|
||||||
|
// 6 2/26/99 7:42p Markd
|
||||||
|
// Fixed turrets some more
|
||||||
|
//
|
||||||
|
// 5 2/26/99 5:53p Markd
|
||||||
|
// Fixed up turrets a lot more
|
||||||
|
//
|
||||||
|
// 4 2/23/99 5:56p Markd
|
||||||
|
//
|
||||||
|
// 3 2/22/99 5:45p Aldie
|
||||||
|
// Removed stray ;
|
||||||
|
//
|
||||||
// 2 2/19/99 7:49p Markd
|
// 2 2/19/99 7:49p Markd
|
||||||
// implemented turret for CTF
|
// implemented turret for CTF
|
||||||
//
|
//
|
||||||
|
@ -26,9 +61,10 @@
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
#include "ctf_turret.h"
|
#include "ctf_turret.h"
|
||||||
#include "heligun.h"
|
#include "heligun.h"
|
||||||
|
#include "player.h"
|
||||||
|
|
||||||
|
|
||||||
CLASS_DECLARATION( Vehicle, CTFTurret, "ctf_turret" );
|
CLASS_DECLARATION( DrivableVehicle, CTFTurret, "ctf_turret" );
|
||||||
|
|
||||||
ResponseDef CTFTurret::Responses[] =
|
ResponseDef CTFTurret::Responses[] =
|
||||||
{
|
{
|
||||||
|
@ -40,7 +76,13 @@ CTFTurret::CTFTurret()
|
||||||
{
|
{
|
||||||
takedamage = DAMAGE_YES;
|
takedamage = DAMAGE_YES;
|
||||||
setModel( "ctf_turret.def" );
|
setModel( "ctf_turret.def" );
|
||||||
|
modelIndex( "ctf_turretgun.def" );
|
||||||
|
modelIndex( "view_ctf_turretgun.def" );
|
||||||
setOrigin( origin - Vector( "0 0 30") );
|
setOrigin( origin - Vector( "0 0 30") );
|
||||||
|
drivable = false;
|
||||||
|
setMoveType( MOVETYPE_NONE );
|
||||||
|
setSize( "-24 -24 -64", "24 24 0" );
|
||||||
|
edict->s.renderfx |= RF_MINLIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTFTurret::DriverUse
|
void CTFTurret::DriverUse
|
||||||
|
@ -52,18 +94,23 @@ void CTFTurret::DriverUse
|
||||||
Entity * old_driver;
|
Entity * old_driver;
|
||||||
|
|
||||||
old_driver = driver;
|
old_driver = driver;
|
||||||
Vehicle::DriverUse( ev );
|
DrivableVehicle::DriverUse( ev );
|
||||||
if ( old_driver != driver )
|
if ( old_driver != driver )
|
||||||
{
|
{
|
||||||
if ( driver )
|
if ( driver )
|
||||||
{
|
{
|
||||||
|
setSolidType( SOLID_NOT );
|
||||||
|
takedamage = DAMAGE_NO;
|
||||||
hideModel();
|
hideModel();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
setSolidType( SOLID_BBOX );
|
||||||
|
takedamage = DAMAGE_YES;
|
||||||
showModel();
|
showModel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setMoveType( MOVETYPE_NONE );
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_PITCH 45
|
#define MAX_PITCH 45
|
||||||
|
@ -93,7 +140,6 @@ float CTFTurret::SetDriverPitch
|
||||||
return pitch;
|
return pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CLASS_DECLARATION( HeliGun, CTFTurretGun, "ctf_weapon_turretgun" );
|
CLASS_DECLARATION( HeliGun, CTFTurretGun, "ctf_weapon_turretgun" );
|
||||||
|
|
||||||
ResponseDef CTFTurretGun::Responses[] =
|
ResponseDef CTFTurretGun::Responses[] =
|
||||||
|
@ -115,7 +161,264 @@ void CTFTurretGun::Shoot
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
FireBullets( 1, "20 20 20", 16, 28, DAMAGE_BULLET, MOD_HELIGUN, false );
|
FireBullets( 1, "20 20 20", 48, 64, DAMAGE_BULLET, MOD_CTFTURRET, false );
|
||||||
NextAttack( 0 );
|
NextAttack( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qboolean CTFTurretGun::IsDroppable
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// CTF turret which is lagged but has angle limits set on it.
|
||||||
|
//
|
||||||
|
CLASS_DECLARATION( DrivableVehicle, CTFDrivableTurret, "ctf_fixedturret" );
|
||||||
|
|
||||||
|
ResponseDef CTFDrivableTurret::Responses[] =
|
||||||
|
{
|
||||||
|
{ &EV_Use, ( Response )CTFDrivableTurret::DriverUse },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
CTFDrivableTurret::CTFDrivableTurret()
|
||||||
|
{
|
||||||
|
ClassDef *cls;
|
||||||
|
|
||||||
|
takedamage = DAMAGE_YES;
|
||||||
|
setModel( "ctf_fixedturret.def" );
|
||||||
|
setOrigin( origin - Vector( "0 0 30") );
|
||||||
|
baseangles = angles;
|
||||||
|
|
||||||
|
shotdamage = G_GetFloatArg( "shotdamage", 48 );
|
||||||
|
maxpitch = G_GetFloatArg( "maxpitch", 30 );
|
||||||
|
maxyaw = G_GetFloatArg( "maxyaw", 75 );
|
||||||
|
|
||||||
|
cls = getClass( "Sentient" );
|
||||||
|
if ( cls )
|
||||||
|
{
|
||||||
|
gunholder = ( Sentient * )cls->newInstance();
|
||||||
|
gunholder->hideModel();
|
||||||
|
}
|
||||||
|
cls = getClass( "BulletWeapon" );
|
||||||
|
if ( cls )
|
||||||
|
{
|
||||||
|
gun = ( BulletWeapon * )cls->newInstance();
|
||||||
|
gun->SetModels( "ctf_fixedturret.def", "ctf_fixedturret.def" );
|
||||||
|
gun->SetOwner( gunholder );
|
||||||
|
gun->hideModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
setSize( "-24 -24 -64", "24 24 0" );
|
||||||
|
lastbutton = -1;
|
||||||
|
entertime = -1;
|
||||||
|
exittime = -1;
|
||||||
|
setMoveType( MOVETYPE_NONE );
|
||||||
|
edict->s.renderfx |= RF_MINLIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTFDrivableTurret::Postthink
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Vector temp;
|
||||||
|
Vector diff;
|
||||||
|
|
||||||
|
// make sure we don't move
|
||||||
|
velocity = vec_zero;
|
||||||
|
|
||||||
|
if ( cmd_angles[ 0 ] > maxturnrate )
|
||||||
|
{
|
||||||
|
cmd_angles[ 0 ] = maxturnrate;
|
||||||
|
}
|
||||||
|
else if ( cmd_angles[ 0 ] < -maxturnrate )
|
||||||
|
{
|
||||||
|
cmd_angles[ 0 ] = -maxturnrate;
|
||||||
|
}
|
||||||
|
if ( cmd_angles[ 1 ] > maxturnrate )
|
||||||
|
{
|
||||||
|
cmd_angles[ 1 ] = maxturnrate;
|
||||||
|
}
|
||||||
|
else if ( cmd_angles[ 1 ] < -maxturnrate )
|
||||||
|
{
|
||||||
|
cmd_angles[ 1 ] = -maxturnrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
temp = angles + cmd_angles;
|
||||||
|
|
||||||
|
diff = temp - baseangles;
|
||||||
|
diff.x = angledist( diff.x );
|
||||||
|
diff.y = angledist( diff.y );
|
||||||
|
gi.dprintf( "diff x%5.2f y%5.2f\n", diff.x, diff.y );
|
||||||
|
|
||||||
|
if ( diff.x > maxpitch )
|
||||||
|
{
|
||||||
|
temp.x = baseangles.x + maxpitch;
|
||||||
|
}
|
||||||
|
else if ( diff.x < -maxpitch )
|
||||||
|
{
|
||||||
|
temp.x = baseangles.x - maxpitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( maxyaw < 180 )
|
||||||
|
{
|
||||||
|
if ( diff.y > maxyaw )
|
||||||
|
{
|
||||||
|
temp.y = baseangles.y + maxyaw;
|
||||||
|
}
|
||||||
|
else if ( diff.y < -maxyaw )
|
||||||
|
{
|
||||||
|
temp.y = baseangles.y - maxyaw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setAngles( temp );
|
||||||
|
|
||||||
|
|
||||||
|
if ( driver )
|
||||||
|
{
|
||||||
|
Vector i,j,k;
|
||||||
|
Player * player;
|
||||||
|
|
||||||
|
i = Vector( orientation[ 0 ] );
|
||||||
|
j = Vector( orientation[ 1 ] );
|
||||||
|
k = Vector( orientation[ 2 ] );
|
||||||
|
|
||||||
|
player = ( Player * )( Sentient * )driver;
|
||||||
|
player->setOrigin( worldorigin + i * driveroffset[0] + j * driveroffset[1] + k * driveroffset[2] );
|
||||||
|
if ( drivable )
|
||||||
|
{
|
||||||
|
player->velocity = vec_zero;
|
||||||
|
player->setAngles( angles );
|
||||||
|
player->SetViewAngles( angles );
|
||||||
|
player->SetDeltaAngles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckWater();
|
||||||
|
WorldEffects();
|
||||||
|
|
||||||
|
// save off last origin
|
||||||
|
last_origin = worldorigin;
|
||||||
|
|
||||||
|
if ( !driver && !velocity.length() && groundentity && !( watertype & CONTENTS_LAVA ) )
|
||||||
|
{
|
||||||
|
flags &= ~FL_POSTTHINK;
|
||||||
|
if ( drivable )
|
||||||
|
setMoveType( MOVETYPE_NONE );
|
||||||
|
}
|
||||||
|
if ( driver )
|
||||||
|
{
|
||||||
|
if ( buttons & BUTTON_ATTACK )
|
||||||
|
{
|
||||||
|
if ( !lastbutton )
|
||||||
|
{
|
||||||
|
lastbutton = 1;
|
||||||
|
RandomAnimate( "fire", NULL );
|
||||||
|
}
|
||||||
|
Fire();
|
||||||
|
}
|
||||||
|
else if ( buttons & BUTTON_USE )
|
||||||
|
{
|
||||||
|
Event * event;
|
||||||
|
|
||||||
|
if ( level.time > ( entertime + 0.5f ) )
|
||||||
|
{
|
||||||
|
event = new Event( EV_Use );
|
||||||
|
event->AddEntity( driver );
|
||||||
|
ProcessEvent( event );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( lastbutton )
|
||||||
|
{
|
||||||
|
lastbutton = 0;
|
||||||
|
RandomAnimate( "idle", NULL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTFDrivableTurret::Fire
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
setSolidType( SOLID_NOT );
|
||||||
|
gunholder->setOrigin( origin );
|
||||||
|
gunholder->setAngles( angles );
|
||||||
|
gun->FireBullets( 1, "20 20 20", shotdamage, shotdamage * 1.5f, DAMAGE_BULLET, MOD_CTFTURRET, true );
|
||||||
|
setSolidType( SOLID_BBOX );
|
||||||
|
}
|
||||||
|
|
||||||
|
float CTFDrivableTurret::SetDriverPitch
|
||||||
|
(
|
||||||
|
float pitch
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
qboolean CTFDrivableTurret::Drive
|
||||||
|
(
|
||||||
|
usercmd_t *ucmd
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
if ( !driver || !driver->isClient() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrivableVehicle::Drive( ucmd );
|
||||||
|
ucmd->buttons &= ~BUTTON_ATTACK;
|
||||||
|
ucmd->buttons &= ~BUTTON_USE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTFDrivableTurret::DriverUse
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Entity * old_driver;
|
||||||
|
|
||||||
|
if ( !driver && ( level.time < ( exittime + 0.5f ) ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
cmd_angles[ 0 ] = 0;
|
||||||
|
cmd_angles[ 1 ] = 0;
|
||||||
|
cmd_angles[ 2 ] = 0;
|
||||||
|
buttons = 0;
|
||||||
|
lastbutton = -1;
|
||||||
|
setMoveType( MOVETYPE_NONE );
|
||||||
|
RandomAnimate( "idle", NULL );
|
||||||
|
|
||||||
|
old_driver = driver;
|
||||||
|
|
||||||
|
DrivableVehicle::DriverUse( ev );
|
||||||
|
|
||||||
|
if ( old_driver != driver )
|
||||||
|
{
|
||||||
|
if ( driver )
|
||||||
|
{
|
||||||
|
entertime = level.time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exittime = level.time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
49
ctf_turret.h
49
ctf_turret.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf_turret.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf_turret.h $
|
||||||
// $Revision:: 2 $
|
// $Revision:: 6 $
|
||||||
// $Author:: Markd $
|
// $Author:: Aldie $
|
||||||
// $Date:: 2/19/99 7:49p $
|
// $Date:: 3/19/99 5:13p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,18 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/ctf_turret.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/ctf_turret.h $
|
||||||
//
|
//
|
||||||
|
// 6 3/19/99 5:13p Aldie
|
||||||
|
// Made turret non-droppable
|
||||||
|
//
|
||||||
|
// 5 3/05/99 5:51p Markd
|
||||||
|
// made vehicles respawn in CTF, fixed up turrets a bit more
|
||||||
|
//
|
||||||
|
// 4 2/26/99 7:42p Markd
|
||||||
|
// Fixed turrets some more
|
||||||
|
//
|
||||||
|
// 3 2/26/99 5:53p Markd
|
||||||
|
// Fixed up turrets a lot more
|
||||||
|
//
|
||||||
// 2 2/19/99 7:49p Markd
|
// 2 2/19/99 7:49p Markd
|
||||||
// implemented turret for CTF
|
// implemented turret for CTF
|
||||||
//
|
//
|
||||||
|
@ -40,9 +52,11 @@
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
#include "heligun.h"
|
#include "heligun.h"
|
||||||
|
#include "bullet.h"
|
||||||
|
#include "sentient.h"
|
||||||
|
|
||||||
|
|
||||||
class EXPORT_FROM_DLL CTFTurret : public Vehicle
|
class EXPORT_FROM_DLL CTFTurret : public DrivableVehicle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLASS_PROTOTYPE( CTFTurret );
|
CLASS_PROTOTYPE( CTFTurret );
|
||||||
|
@ -60,5 +74,32 @@ class EXPORT_FROM_DLL CTFTurretGun : public HeliGun
|
||||||
|
|
||||||
CTFTurretGun();
|
CTFTurretGun();
|
||||||
virtual void Shoot( Event *ev );
|
virtual void Shoot( Event *ev );
|
||||||
|
qboolean IsDroppable( void );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL CTFDrivableTurret : public DrivableVehicle
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
Vector baseangles;
|
||||||
|
float maxpitch;
|
||||||
|
float maxyaw;
|
||||||
|
float entertime;
|
||||||
|
float exittime;
|
||||||
|
int lastbutton;
|
||||||
|
float shotdamage;
|
||||||
|
Sentient *gunholder;
|
||||||
|
BulletWeapon *gun;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( CTFDrivableTurret );
|
||||||
|
|
||||||
|
CTFDrivableTurret ();
|
||||||
|
virtual qboolean Drive( usercmd_t *ucmd );
|
||||||
|
virtual void Postthink( void );
|
||||||
|
virtual void Fire( void );
|
||||||
|
virtual float SetDriverPitch( float pitch );
|
||||||
|
virtual void DriverUse( Event *ev );
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* ctfturret.h */
|
#endif /* ctfturret.h */
|
||||||
|
|
11
entity.cpp
11
entity.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/entity.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/entity.cpp $
|
||||||
// $Revision:: 296 $
|
// $Revision:: 297 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/18/98 5:22a $
|
// $Date:: 3/18/99 6:44p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/entity.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/entity.cpp $
|
||||||
//
|
//
|
||||||
|
// 297 3/18/99 6:44p Aldie
|
||||||
|
// CancelPendingEvents when removiiung
|
||||||
|
//
|
||||||
// 296 11/18/98 5:22a Jimdose
|
// 296 11/18/98 5:22a Jimdose
|
||||||
// CheckGround properly checks normal an alternate grav axis
|
// CheckGround properly checks normal an alternate grav axis
|
||||||
//
|
//
|
||||||
|
@ -1468,6 +1471,8 @@ Entity::~Entity()
|
||||||
{
|
{
|
||||||
world->RemoveTargetEntity( targetname, this );
|
world->RemoveTargetEntity( targetname, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->CancelPendingEvents();
|
||||||
G_FreeEdict( edict );
|
G_FreeEdict( edict );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
68
entity.h
68
entity.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/entity.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/entity.h $
|
||||||
// $Revision:: 157 $
|
// $Revision:: 163 $
|
||||||
// $Author:: Markd $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/15/98 11:33p $
|
// $Date:: 3/19/99 4:12p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,24 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/entity.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/entity.h $
|
||||||
//
|
//
|
||||||
|
// 163 3/19/99 4:12p Aldie
|
||||||
|
// Moved MOD to client
|
||||||
|
//
|
||||||
|
// 162 3/17/99 3:55p Aldie
|
||||||
|
// Incremental CTF update
|
||||||
|
//
|
||||||
|
// 161 3/12/99 8:12p Aldie
|
||||||
|
// Added deathquad
|
||||||
|
//
|
||||||
|
// 160 3/11/99 3:48p Aldie
|
||||||
|
// Add more meansofdeath
|
||||||
|
//
|
||||||
|
// 159 3/05/99 5:47p Aldie
|
||||||
|
// Added mod_thrallball
|
||||||
|
//
|
||||||
|
// 158 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
// 157 11/15/98 11:33p Markd
|
// 157 11/15/98 11:33p Markd
|
||||||
// added fat projectile flag
|
// added fat projectile flag
|
||||||
//
|
//
|
||||||
|
@ -589,50 +607,6 @@ typedef enum
|
||||||
#define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect
|
#define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect
|
||||||
#define DAMAGE_NO_SKILL 0x00000040 // damage is not affected by skill level
|
#define DAMAGE_NO_SKILL 0x00000040 // damage is not affected by skill level
|
||||||
|
|
||||||
// means of death flags
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
MOD_FISTS,
|
|
||||||
MOD_MAGNUM,
|
|
||||||
MOD_SHOTGUN,
|
|
||||||
MOD_ASSRIFLE,
|
|
||||||
MOD_CHAINGUN,
|
|
||||||
MOD_GRENADE,
|
|
||||||
MOD_ROCKET,
|
|
||||||
MOD_ROCKETSPLASH,
|
|
||||||
MOD_PULSE,
|
|
||||||
MOD_PULSELASER,
|
|
||||||
MOD_SPEARGUN,
|
|
||||||
MOD_SNIPER,
|
|
||||||
MOD_VEHICLE,
|
|
||||||
MOD_CRUSH,
|
|
||||||
MOD_SHOTROCKET,
|
|
||||||
MOD_FALLING,
|
|
||||||
MOD_DROWN,
|
|
||||||
MOD_SUICIDE,
|
|
||||||
MOD_EXPLODEWALL,
|
|
||||||
MOD_ELECTRIC,
|
|
||||||
MOD_TELEFRAG,
|
|
||||||
MOD_GENBULLET,
|
|
||||||
MOD_LASER,
|
|
||||||
MOD_BETTYSPIKE,
|
|
||||||
MOD_HELIGUN,
|
|
||||||
MOD_DEBRIS,
|
|
||||||
MOD_THROWNOBJECT,
|
|
||||||
MOD_LAVA,
|
|
||||||
MOD_SLIME,
|
|
||||||
MOD_ADRENALINE,
|
|
||||||
MOD_ION,
|
|
||||||
MOD_ION_DESTRUCT,
|
|
||||||
MOD_QUANTUM,
|
|
||||||
MOD_BEAM,
|
|
||||||
MOD_IMPACT,
|
|
||||||
MOD_FRIENDLY_FIRE,
|
|
||||||
MOD_SPIDERSPLASH,
|
|
||||||
MOD_MUTANTHANDS,
|
|
||||||
MOD_MUTANT_DRAIN
|
|
||||||
} mod_type_t;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sound travel distances
|
// Sound travel distances
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/explosion.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/explosion.cpp $
|
||||||
// $Revision:: 48 $
|
// $Revision:: 51 $
|
||||||
// $Author:: Markd $
|
// $Author:: Aldie $
|
||||||
// $Date:: 10/24/98 12:42a $
|
// $Date:: 3/30/99 4:51p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,14 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/explosion.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/explosion.cpp $
|
||||||
//
|
//
|
||||||
|
// 51 3/30/99 4:51p Aldie
|
||||||
|
//
|
||||||
|
// 50 3/11/99 3:45p Aldie
|
||||||
|
// Added meansofdeath to explosion
|
||||||
|
//
|
||||||
|
// 49 3/11/99 2:03p Aldie
|
||||||
|
// Added mod to explosion damage
|
||||||
|
//
|
||||||
// 48 10/24/98 12:42a Markd
|
// 48 10/24/98 12:42a Markd
|
||||||
// changed origins to worldorigins where appropriate
|
// changed origins to worldorigins where appropriate
|
||||||
//
|
//
|
||||||
|
@ -289,6 +297,7 @@ void CreateExplosion
|
||||||
Entity *inflictor,
|
Entity *inflictor,
|
||||||
Entity *attacker,
|
Entity *attacker,
|
||||||
Entity *ignore,
|
Entity *ignore,
|
||||||
|
int meansofdeath,
|
||||||
float volume,
|
float volume,
|
||||||
float attenuation,
|
float attenuation,
|
||||||
float r,
|
float r,
|
||||||
|
@ -324,7 +333,8 @@ void CreateExplosion
|
||||||
inflictor->RandomPositionedSound( pos, "impact_bigexplosion", volume, CHAN_AUTO, attenuation );
|
inflictor->RandomPositionedSound( pos, "impact_bigexplosion", volume, CHAN_AUTO, attenuation );
|
||||||
}
|
}
|
||||||
|
|
||||||
RadiusDamage( inflictor, attacker, damage, ignore, MOD_ROCKETSPLASH );
|
RadiusDamage( inflictor, attacker, damage, ignore, meansofdeath );
|
||||||
|
if ( inflictor )
|
||||||
inflictor->ProcessEvent( EV_WeaponSound );
|
inflictor->ProcessEvent( EV_WeaponSound );
|
||||||
|
|
||||||
if ( bigexplosion )
|
if ( bigexplosion )
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/explosion.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/explosion.h $
|
||||||
// $Revision:: 14 $
|
// $Revision:: 15 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Aldie $
|
||||||
// $Date:: 10/02/98 7:20p $
|
// $Date:: 3/11/99 3:48p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/explosion.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/explosion.h $
|
||||||
//
|
//
|
||||||
|
// 15 3/11/99 3:48p Aldie
|
||||||
|
// Added meansofdeath to explosion
|
||||||
|
//
|
||||||
// 14 10/02/98 7:20p Aldie
|
// 14 10/02/98 7:20p Aldie
|
||||||
// Added flashplayers to do blinding flashes
|
// Added flashplayers to do blinding flashes
|
||||||
//
|
//
|
||||||
|
@ -169,6 +172,7 @@ void CreateExplosion
|
||||||
Entity *inflictor = NULL,
|
Entity *inflictor = NULL,
|
||||||
Entity *attacker = NULL,
|
Entity *attacker = NULL,
|
||||||
Entity *ignore = NULL,
|
Entity *ignore = NULL,
|
||||||
|
int meansofdeath = MOD_ROCKETSPLASH,
|
||||||
float volume = 1.0f,
|
float volume = 1.0f,
|
||||||
float attenuation = ATTN_NORM,
|
float attenuation = ATTN_NORM,
|
||||||
float r = 1.0f,
|
float r = 1.0f,
|
||||||
|
|
19
g_local.h
19
g_local.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_local.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_local.h $
|
||||||
// $Revision:: 98 $
|
// $Revision:: 100 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/10/98 5:51p $
|
// $Date:: 3/12/99 8:12p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,12 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/g_local.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/g_local.h $
|
||||||
//
|
//
|
||||||
|
// 100 3/12/99 8:12p Aldie
|
||||||
|
// added idtime
|
||||||
|
//
|
||||||
|
// 99 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
// 98 11/10/98 5:51p Jimdose
|
// 98 11/10/98 5:51p Jimdose
|
||||||
// disabled exporting symbols from the dll
|
// disabled exporting symbols from the dll
|
||||||
//
|
//
|
||||||
|
@ -409,6 +415,13 @@ typedef struct
|
||||||
int enterframe; // level.framenum the client entered the game
|
int enterframe; // level.framenum the client entered the game
|
||||||
int score; // frags, etc
|
int score; // frags, etc
|
||||||
vec3_t cmd_angles; // angles sent over in the last command
|
vec3_t cmd_angles; // angles sent over in the last command
|
||||||
|
int ctf_team; // CTF team number
|
||||||
|
int ctf_state; // CTF player state
|
||||||
|
float ctf_lasttechmsg; // CTF Last time a tech message was sent
|
||||||
|
float ctf_lastfraggedcarrier; // Last time a carrier was fragged
|
||||||
|
float ctf_lasthurtcarrier; // List time carrier was hurt
|
||||||
|
float ctf_lastreturnedflag; // Last time flag was returned
|
||||||
|
float ctf_idtime; // Last time a player id was made
|
||||||
} client_respawn_t;
|
} client_respawn_t;
|
||||||
|
|
||||||
// this structure is cleared on each PutClientInServer(),
|
// this structure is cleared on each PutClientInServer(),
|
||||||
|
|
298
g_main.cpp
298
g_main.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_main.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_main.cpp $
|
||||||
// $Revision:: 170 $
|
// $Revision:: 178 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Jimdose $
|
||||||
// $Date:: 2/16/99 8:37p $
|
// $Date:: 8/03/99 7:09p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,9 +13,33 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/g_main.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/g_main.cpp $
|
||||||
//
|
//
|
||||||
// 170 2/16/99 8:37p Jimdose
|
// 178 8/03/99 7:09p Jimdose
|
||||||
// moved sin arcade comm stuff to client
|
// changes for Sin Arcade
|
||||||
// made dmflags, timelimit, and fraglimit archived under SIN_ARCADE
|
//
|
||||||
|
// 177 7/27/99 2:35p Markd
|
||||||
|
// fixed potential text concatenation bug
|
||||||
|
//
|
||||||
|
// 176 7/26/99 7:05p Markd
|
||||||
|
// Fixed the say_talk stuff
|
||||||
|
//
|
||||||
|
// 175 7/24/99 6:47p Markd
|
||||||
|
// Added talk feature and added speech code
|
||||||
|
//
|
||||||
|
// 174 5/19/99 4:57p Markd
|
||||||
|
// fixed some errors
|
||||||
|
//
|
||||||
|
// 173 5/19/99 11:30a Markd
|
||||||
|
// Added new camera support
|
||||||
|
//
|
||||||
|
// 172 3/12/99 4:54p Aldie
|
||||||
|
// Added CTF_CalcScores
|
||||||
|
//
|
||||||
|
// 171 3/02/99 9:08p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:08p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:38p Aldie
|
||||||
//
|
//
|
||||||
// 169 1/22/99 8:00p Jimdose
|
// 169 1/22/99 8:00p Jimdose
|
||||||
// added "showvar" command for inspecting script variables
|
// added "showvar" command for inspecting script variables
|
||||||
|
@ -569,6 +593,7 @@
|
||||||
#define SAVEGAME_VERSION 13
|
#define SAVEGAME_VERSION 13
|
||||||
|
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
#include "limits.h"
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
#include "g_utils.h"
|
#include "g_utils.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
|
@ -581,6 +606,7 @@
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
#include "gravpath.h"
|
#include "gravpath.h"
|
||||||
#include "deadbody.h"
|
#include "deadbody.h"
|
||||||
|
#include "ctf.h"
|
||||||
|
|
||||||
Vector vec_origin = "0 0 0";
|
Vector vec_origin = "0 0 0";
|
||||||
Vector vec_zero = "0 0 0";
|
Vector vec_zero = "0 0 0";
|
||||||
|
@ -688,6 +714,11 @@ void ( *ServerError )( const char *fmt, ... );
|
||||||
char G_ErrorMessage[ 1024 ];
|
char G_ErrorMessage[ 1024 ];
|
||||||
jmp_buf G_AbortGame;
|
jmp_buf G_AbortGame;
|
||||||
|
|
||||||
|
#ifdef SIN_ARCADE
|
||||||
|
void G_CheckFirstPlace( void );
|
||||||
|
void G_DrawFirstPlace( void );
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
G_Error
|
G_Error
|
||||||
|
@ -813,11 +844,8 @@ void G_InitGame
|
||||||
deathmatch = gi.cvar ("deathmatch", "0", CVAR_SERVERINFO|CVAR_LATCH);
|
deathmatch = gi.cvar ("deathmatch", "0", CVAR_SERVERINFO|CVAR_LATCH);
|
||||||
coop = gi.cvar ("coop", "0", CVAR_SERVERINFO|CVAR_LATCH);
|
coop = gi.cvar ("coop", "0", CVAR_SERVERINFO|CVAR_LATCH);
|
||||||
skill = gi.cvar ("skill", "1", CVAR_SERVERINFO|CVAR_LATCH);
|
skill = gi.cvar ("skill", "1", CVAR_SERVERINFO|CVAR_LATCH);
|
||||||
#ifdef SIN
|
|
||||||
maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH | CVAR_ARCHIVE );
|
maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH | CVAR_ARCHIVE );
|
||||||
#else
|
|
||||||
maxclients = gi.cvar ("maxclients", "4", CVAR_SERVERINFO | CVAR_LATCH);
|
|
||||||
#endif
|
|
||||||
maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH);
|
maxentities = gi.cvar ("maxentities", "1024", CVAR_LATCH);
|
||||||
maxconsoles = gi.cvar ("maxconsoles", "32", CVAR_LATCH);
|
maxconsoles = gi.cvar ("maxconsoles", "32", CVAR_LATCH);
|
||||||
maxsurfaces = gi.cvar ("maxsurfaces", "1024", CVAR_LATCH);
|
maxsurfaces = gi.cvar ("maxsurfaces", "1024", CVAR_LATCH);
|
||||||
|
@ -839,6 +867,8 @@ void G_InitGame
|
||||||
fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO);
|
fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO);
|
||||||
timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO);
|
timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO);
|
||||||
#endif
|
#endif
|
||||||
|
// CTF
|
||||||
|
capturelimit = gi.cvar ("capturelimit", "0", CVAR_SERVERINFO);
|
||||||
g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE);
|
g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE);
|
||||||
g_unlimited_ammo = gi.cvar ("g_unlimited_ammo", "0", CVAR_SERVERINFO);
|
g_unlimited_ammo = gi.cvar ("g_unlimited_ammo", "0", CVAR_SERVERINFO);
|
||||||
g_showmem = gi.cvar ("g_showmem", "0", 0 );
|
g_showmem = gi.cvar ("g_showmem", "0", 0 );
|
||||||
|
@ -890,6 +920,8 @@ void G_InitGame
|
||||||
|
|
||||||
parentmode = gi.cvar ("parentmode", "0", CVAR_USERINFO|CVAR_SERVERINFO|CVAR_ARCHIVE);
|
parentmode = gi.cvar ("parentmode", "0", CVAR_USERINFO|CVAR_SERVERINFO|CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
CTF_Init();
|
||||||
|
|
||||||
G_InitEvents();
|
G_InitEvents();
|
||||||
sv_numtraces = 0;
|
sv_numtraces = 0;
|
||||||
|
|
||||||
|
@ -1507,6 +1539,10 @@ void G_EndDMLevel
|
||||||
char *s, *t, *f;
|
char *s, *t, *f;
|
||||||
static const char *seps = " ,\n\r";
|
static const char *seps = " ,\n\r";
|
||||||
|
|
||||||
|
#ifdef SIN_ARCADE
|
||||||
|
G_DrawFirstPlace();
|
||||||
|
#endif
|
||||||
|
|
||||||
// stay on same level flag
|
// stay on same level flag
|
||||||
if ( DM_FLAG( DF_SAME_LEVEL ) )
|
if ( DM_FLAG( DF_SAME_LEVEL ) )
|
||||||
{
|
{
|
||||||
|
@ -1601,6 +1637,17 @@ void G_CheckDMRules
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CTF
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
if ( CTF_CheckRules() )
|
||||||
|
{
|
||||||
|
gi.bprintf( PRINT_HIGH, "Capturelimit hit.\n" );
|
||||||
|
G_EndDMLevel ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( fraglimit->value )
|
if ( fraglimit->value )
|
||||||
{
|
{
|
||||||
for( i = 0; i < maxclients->value; i++ )
|
for( i = 0; i < maxclients->value; i++ )
|
||||||
|
@ -1685,6 +1732,9 @@ void G_BeginIntermission
|
||||||
// find an intermission spot
|
// find an intermission spot
|
||||||
num = G_FindClass( 0, "info_player_intermission" );
|
num = G_FindClass( 0, "info_player_intermission" );
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
CTF_CalcScores();
|
||||||
|
|
||||||
// Only do the camera stuff if the node exists.
|
// Only do the camera stuff if the node exists.
|
||||||
if ( num )
|
if ( num )
|
||||||
{
|
{
|
||||||
|
@ -1748,6 +1798,8 @@ void G_ExitLevel
|
||||||
level.exitintermission = 0;
|
level.exitintermission = 0;
|
||||||
level.intermissiontime = 0;
|
level.intermissiontime = 0;
|
||||||
|
|
||||||
|
CTF_Init();
|
||||||
|
|
||||||
G_SaveClientData();
|
G_SaveClientData();
|
||||||
|
|
||||||
// Tell all the client that the level is done
|
// Tell all the client that the level is done
|
||||||
|
@ -1938,6 +1990,10 @@ void G_RunFrame
|
||||||
|
|
||||||
// reset out count of the number of game traces
|
// reset out count of the number of game traces
|
||||||
sv_numtraces = 0;
|
sv_numtraces = 0;
|
||||||
|
|
||||||
|
#ifdef SIN_ARCADE
|
||||||
|
G_CheckFirstPlace();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_ClientThink
|
void G_ClientThink
|
||||||
|
@ -1988,6 +2044,10 @@ void G_PutClientInServer
|
||||||
if ( ent->entity && ent->entity->isSubclassOf( Player ) )
|
if ( ent->entity && ent->entity->isSubclassOf( Player ) )
|
||||||
{
|
{
|
||||||
( ( Player * )ent->entity )->Init();
|
( ( Player * )ent->entity )->Init();
|
||||||
|
|
||||||
|
// Initialize the player to CTF
|
||||||
|
if ( ctf->value )
|
||||||
|
( ( Player * )ent->entity )->InitCTF();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2205,6 +2265,22 @@ void G_ClientUserinfoChanged
|
||||||
player->ProcessEvent( ev );
|
player->ProcessEvent( ev );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CTF
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
switch ( ent->client->resp.ctf_team )
|
||||||
|
{
|
||||||
|
case CTF_TEAM_HARDCORPS:
|
||||||
|
strcpy( ent->client->pers.skin, ctf_hardcorps_skin->string );
|
||||||
|
break;
|
||||||
|
case CTF_TEAM_SINTEK:
|
||||||
|
strcpy( ent->client->pers.skin, ctf_sintek_skin->string );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Player number
|
// Player number
|
||||||
playernum = ent - g_edicts - 1;
|
playernum = ent - g_edicts - 1;
|
||||||
|
|
||||||
|
@ -2346,7 +2422,7 @@ void G_Say
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !DM_FLAG( DF_MODELTEAMS | DF_SKINTEAMS ) )
|
if ( !DM_FLAG( DF_MODELTEAMS | DF_SKINTEAMS ) && !ctf->value )
|
||||||
{
|
{
|
||||||
team = false;
|
team = false;
|
||||||
}
|
}
|
||||||
|
@ -2402,19 +2478,129 @@ void G_Say
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if ( team )
|
if ( team )
|
||||||
{
|
{
|
||||||
if ( !OnSameTeam( ent, other ) )
|
if ( !OnSameTeam( ent->entity, other->entity ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
gi.cprintf( other, PRINT_CHAT, "%s", text );
|
gi.cprintf( other, PRINT_CHAT, "%s", text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
G_Talk
|
||||||
|
// send over a speech command
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void G_Talk
|
||||||
|
(
|
||||||
|
edict_t *ent
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
edict_t *other;
|
||||||
|
const char *p;
|
||||||
|
char text[ 2048 ];
|
||||||
|
|
||||||
|
if ( gi.argc() < 2 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = gi.args();
|
||||||
|
|
||||||
|
if ( *p == '"' )
|
||||||
|
{
|
||||||
|
p++;
|
||||||
|
strcpy( text, p );
|
||||||
|
text[ strlen( text ) - 1 ] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy( text, p );
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't let text be too long for malicious reasons
|
||||||
|
if ( strlen( text ) > 150 )
|
||||||
|
{
|
||||||
|
text[ 150 ] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcat( text, "\n" );
|
||||||
|
|
||||||
|
if ( dedicated->value )
|
||||||
|
{
|
||||||
|
gi.cprintf( NULL, PRINT_TALK, "speech %s", text );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( j = 1; j <= game.maxclients; j++ )
|
||||||
|
{
|
||||||
|
float len;
|
||||||
|
vec3_t delta;
|
||||||
|
|
||||||
|
other = &g_edicts[ j ];
|
||||||
|
if ( !other->inuse || !other->client )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// cull the talking based off of distance
|
||||||
|
VectorSubtract (other->s.origin, ent->s.origin, delta);
|
||||||
|
len = VectorLength (delta);
|
||||||
|
if ( len > 2000 )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
gi.cprintf( other, PRINT_TALK, "%d %s", ent->s.number, text );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void G_CameraCommand
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Event *ev;
|
||||||
|
const char *cmd;
|
||||||
|
int i;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
n = gi.argc();
|
||||||
|
if ( !n )
|
||||||
|
{
|
||||||
|
gi.printf( "Usage: cam [command] [arg 1]...[arg n]\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd = gi.argv( 1 );
|
||||||
|
if ( Event::Exists( cmd ) )
|
||||||
|
{
|
||||||
|
ev = new Event( cmd );
|
||||||
|
// this is a hack but necessary
|
||||||
|
//ev->SetSource( EV_FROM_CONSOLE );
|
||||||
|
ev->SetSource( EV_FROM_SCRIPT );
|
||||||
|
ev->SetConsoleEdict( NULL );
|
||||||
|
|
||||||
|
for( i = 2; i < n; i++ )
|
||||||
|
{
|
||||||
|
ev->AddToken( gi.argv( i ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
CameraMan.ProcessEvent( ev );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gi.printf( "Unknown camera command '%s'.\n", cmd );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ClientCommand
|
void ClientCommand
|
||||||
(
|
(
|
||||||
edict_t *ent
|
edict_t *ent
|
||||||
|
@ -2443,6 +2629,16 @@ void ClientCommand
|
||||||
G_Say( ent, false, false );
|
G_Say( ent, false, false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if ( !Q_strcasecmp( cmd, "say_team" ) )
|
||||||
|
{
|
||||||
|
G_Say( ent, true, false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if ( !Q_strcasecmp( cmd, "say_talk" ) )
|
||||||
|
{
|
||||||
|
G_Talk( ent );
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if ( game.maxclients == 1 )
|
else if ( game.maxclients == 1 )
|
||||||
{
|
{
|
||||||
// only allow these commands when we only have one client (most likely only a local game)
|
// only allow these commands when we only have one client (most likely only a local game)
|
||||||
|
@ -2504,6 +2700,11 @@ void ClientCommand
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if ( !Q_strcasecmp (cmd, "cam") )
|
||||||
|
{
|
||||||
|
G_CameraCommand();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
found = false;
|
found = false;
|
||||||
|
@ -2561,6 +2762,70 @@ void G_ClientCommand
|
||||||
ClientCommand( ent );
|
ClientCommand( ent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SIN_ARCADE
|
||||||
|
void G_CheckFirstPlace
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int maxscore;
|
||||||
|
int maxplayer;
|
||||||
|
int score;
|
||||||
|
|
||||||
|
// sort the clients by score
|
||||||
|
maxscore = INT_MIN;
|
||||||
|
maxplayer = -1;
|
||||||
|
for( i = 0; i < game.maxclients; i++ )
|
||||||
|
{
|
||||||
|
game.clients[ i ].ps.stats[ STAT_FIRSTPLACE ] = 0;
|
||||||
|
|
||||||
|
if ( !g_edicts[ 1 + i ].inuse )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
score = game.clients[ i ].resp.score;
|
||||||
|
if ( score > maxscore )
|
||||||
|
{
|
||||||
|
maxplayer = i;
|
||||||
|
maxscore = score;
|
||||||
|
}
|
||||||
|
else if ( score == maxscore )
|
||||||
|
{
|
||||||
|
// if a tie, clear out the maxplayer
|
||||||
|
maxplayer = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( maxplayer != -1 )
|
||||||
|
{
|
||||||
|
game.clients[ maxplayer ].ps.stats[ STAT_FIRSTPLACE ] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void G_DrawFirstPlace
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// sort the clients by score
|
||||||
|
for( i = 0; i < game.maxclients; i++ )
|
||||||
|
{
|
||||||
|
game.clients[ i ].ps.stats[ STAT_DRAWFIRSTPLACE ] = 0;
|
||||||
|
if ( game.clients[ i ].ps.stats[ STAT_FIRSTPLACE ] )
|
||||||
|
{
|
||||||
|
game.clients[ i ].ps.stats[ STAT_DRAWFIRSTPLACE ] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
G_DeathmatchScoreboardMessage
|
G_DeathmatchScoreboardMessage
|
||||||
|
@ -2586,6 +2851,13 @@ void G_DeathmatchScoreboardMessage
|
||||||
edict_t *cl_ent, *killeredict, *entedict;
|
edict_t *cl_ent, *killeredict, *entedict;
|
||||||
const char *tag;
|
const char *tag;
|
||||||
|
|
||||||
|
// CTF
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
CTF_ScoreboardMessage (ent, killer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
killeredict = NULL;
|
killeredict = NULL;
|
||||||
entedict = NULL;
|
entedict = NULL;
|
||||||
if ( killer )
|
if ( killer )
|
||||||
|
|
16
g_main.h
16
g_main.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_main.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_main.h $
|
||||||
// $Revision:: 14 $
|
// $Revision:: 16 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Markd $
|
||||||
// $Date:: 11/13/98 2:35a $
|
// $Date:: 4/01/99 3:20p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,12 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/g_main.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/g_main.h $
|
||||||
//
|
//
|
||||||
|
// 16 4/01/99 3:20p Markd
|
||||||
|
// Added dedicated support to Means of Death.
|
||||||
|
//
|
||||||
|
// 15 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
// 14 11/13/98 2:35a Aldie
|
// 14 11/13/98 2:35a Aldie
|
||||||
// Declared fixbodiesforplayer
|
// Declared fixbodiesforplayer
|
||||||
//
|
//
|
||||||
|
@ -96,7 +102,8 @@ extern cvar_t *dmflags;
|
||||||
extern cvar_t *skill;
|
extern cvar_t *skill;
|
||||||
extern cvar_t *fraglimit;
|
extern cvar_t *fraglimit;
|
||||||
extern cvar_t *timelimit;
|
extern cvar_t *timelimit;
|
||||||
|
extern cvar_t *ctf;
|
||||||
|
extern cvar_t *capturelimit;
|
||||||
extern cvar_t *filterban;
|
extern cvar_t *filterban;
|
||||||
|
|
||||||
extern cvar_t *flood_msgs;
|
extern cvar_t *flood_msgs;
|
||||||
|
@ -144,6 +151,7 @@ extern cvar_t *sv_drawtrace;
|
||||||
extern int sv_numtraces;
|
extern int sv_numtraces;
|
||||||
|
|
||||||
extern cvar_t *parentmode;
|
extern cvar_t *parentmode;
|
||||||
|
extern cvar_t *dedicated;
|
||||||
|
|
||||||
extern usercmd_t *current_ucmd;
|
extern usercmd_t *current_ucmd;
|
||||||
|
|
||||||
|
|
204
g_utils.cpp
204
g_utils.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_utils.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_utils.cpp $
|
||||||
// $Revision:: 68 $
|
// $Revision:: 71 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 12/15/98 6:17p $
|
// $Date:: 5/20/99 6:41p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,19 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/g_utils.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/g_utils.cpp $
|
||||||
//
|
//
|
||||||
|
// 71 5/20/99 6:41p Markd
|
||||||
|
// Fixed debug number code
|
||||||
|
//
|
||||||
|
// 70 5/19/99 4:57p Markd
|
||||||
|
// fixed some errors
|
||||||
|
//
|
||||||
|
// 69 3/02/99 9:14p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:08p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:38p Aldie
|
||||||
|
//
|
||||||
// 68 12/15/98 6:17p Jimdose
|
// 68 12/15/98 6:17p Jimdose
|
||||||
// made SelectSpawnPoint handle progressive starts
|
// made SelectSpawnPoint handle progressive starts
|
||||||
//
|
//
|
||||||
|
@ -241,6 +254,7 @@
|
||||||
#include "worldspawn.h"
|
#include "worldspawn.h"
|
||||||
#include "scriptmaster.h"
|
#include "scriptmaster.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
#include "ctf.h"
|
||||||
|
|
||||||
cvar_t *g_numdebuglines;
|
cvar_t *g_numdebuglines;
|
||||||
|
|
||||||
|
@ -738,6 +752,7 @@ Entity *SelectFarthestDeathmatchSpawnPoint
|
||||||
return spot;
|
return spot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Entity *SelectDeathmatchSpawnPoint
|
Entity *SelectDeathmatchSpawnPoint
|
||||||
(
|
(
|
||||||
void
|
void
|
||||||
|
@ -795,6 +810,7 @@ void SelectSpawnPoint
|
||||||
(
|
(
|
||||||
Vector &origin,
|
Vector &origin,
|
||||||
Vector &angles,
|
Vector &angles,
|
||||||
|
edict_t *edict,
|
||||||
int *gravaxis
|
int *gravaxis
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -823,6 +839,10 @@ void SelectSpawnPoint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( ctf->value )
|
||||||
|
{
|
||||||
|
spot = SelectCTFSpawnPoint( edict );
|
||||||
|
}
|
||||||
else if ( deathmatch->value || level.training == 1 )
|
else if ( deathmatch->value || level.training == 1 )
|
||||||
{
|
{
|
||||||
spot = SelectDeathmatchSpawnPoint();
|
spot = SelectDeathmatchSpawnPoint();
|
||||||
|
@ -1587,6 +1607,144 @@ void G_DebugBBox
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// LED style digits
|
||||||
|
//
|
||||||
|
// ****1***
|
||||||
|
// * * 8 == /
|
||||||
|
// 6 *4
|
||||||
|
// * * *
|
||||||
|
// ****2***
|
||||||
|
// * * *
|
||||||
|
// 7 *--8 5 9
|
||||||
|
// ** * **10
|
||||||
|
// ****3*** 12**
|
||||||
|
// 11
|
||||||
|
|
||||||
|
static int Numbers[ 12 ][ 8 ] =
|
||||||
|
{
|
||||||
|
{ 1, 3, 4, 5, 6, 7, 0, 0 }, // 0
|
||||||
|
{ 4, 5, 0, 0, 0, 0, 0, 0 }, // 1
|
||||||
|
{ 1, 4, 2, 7, 3, 0, 0, 0 }, // 2
|
||||||
|
{ 1, 4, 2, 5, 3, 0, 0, 0 }, // 3
|
||||||
|
{ 6, 4, 2, 5, 0, 0, 0, 0 }, // 4
|
||||||
|
{ 1, 6, 2, 5, 3, 0, 0, 0 }, // 5
|
||||||
|
{ 1, 6, 2, 5, 7, 3, 0, 0 }, // 6
|
||||||
|
{ 1, 8, 0, 0, 0, 0, 0, 0 }, // 7
|
||||||
|
{ 1, 2, 3, 4, 5, 6, 7, 0 }, // 8
|
||||||
|
{ 1, 6, 4, 2, 5, 3, 0, 0 }, // 9
|
||||||
|
{ 9, 10, 11, 12, 0, 0, 0, 0 }, // .
|
||||||
|
{ 2, 0, 0, 0, 0, 0, 0, 0 }, // -
|
||||||
|
};
|
||||||
|
|
||||||
|
static float Lines[ 13 ][ 4 ] =
|
||||||
|
{
|
||||||
|
{ 0, 0, 0, 0 }, // Unused
|
||||||
|
{ -4, 8, 4, 8 }, // 1
|
||||||
|
{ -4, 4, 4, 4 }, // 2
|
||||||
|
{ -4, 0, 4, 0 }, // 3
|
||||||
|
{ 4, 8, 4, 4 }, // 4
|
||||||
|
{ 4, 4, 4, 0 }, // 5
|
||||||
|
{ -4, 8, -4, 4 }, // 6
|
||||||
|
{ -4, 4, -4, 0 }, // 7
|
||||||
|
{ 4, 8, -4, 0 }, // 8
|
||||||
|
|
||||||
|
{ -1, 2, 1, 2 }, // 9
|
||||||
|
{ 1, 2, 1, 0 }, // 10
|
||||||
|
{ -1, 0, 1, 0 }, // 11
|
||||||
|
{ -1, 0, -1, 2 }, // 12
|
||||||
|
};
|
||||||
|
|
||||||
|
void G_DrawDebugNumber
|
||||||
|
(
|
||||||
|
Vector org,
|
||||||
|
float number,
|
||||||
|
float scale,
|
||||||
|
float r,
|
||||||
|
float g,
|
||||||
|
float b,
|
||||||
|
int precision
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int l;
|
||||||
|
int num;
|
||||||
|
Vector up;
|
||||||
|
Vector right;
|
||||||
|
Vector pos;
|
||||||
|
Vector start;
|
||||||
|
Vector ang;
|
||||||
|
str text;
|
||||||
|
Vector delta;
|
||||||
|
char format[ 20 ];
|
||||||
|
|
||||||
|
// only draw entity numbers within a certain radius
|
||||||
|
delta = Vector( g_edicts[ 1 ].s.origin ) - org;
|
||||||
|
if ( ( delta * delta ) > ( 1000 * 1000 ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_Color4f( r, g, b, 1.0 );
|
||||||
|
|
||||||
|
ang = game.clients[ 0 ].ps.viewangles;
|
||||||
|
ang.AngleVectors( NULL, &right, &up );
|
||||||
|
|
||||||
|
up *= scale;
|
||||||
|
right *= scale;
|
||||||
|
|
||||||
|
if ( precision > 0 )
|
||||||
|
{
|
||||||
|
sprintf( format, "%%.%df", precision );
|
||||||
|
text = va( format, number );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text = va( "%d", ( int )number );
|
||||||
|
}
|
||||||
|
|
||||||
|
start = org - ( text.length() - 1 ) * 5 * right;
|
||||||
|
|
||||||
|
for( i = 0; i < text.length(); i++ )
|
||||||
|
{
|
||||||
|
if ( text[ i ] == '.' )
|
||||||
|
{
|
||||||
|
num = 10;
|
||||||
|
}
|
||||||
|
else if ( text[ i ] == '-' )
|
||||||
|
{
|
||||||
|
num = 11;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
num = text[ i ] - '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
for( j = 0; j < 8; j++ )
|
||||||
|
{
|
||||||
|
l = Numbers[ num ][ j ];
|
||||||
|
if ( l == 0 )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_BeginLine();
|
||||||
|
|
||||||
|
pos = start + Lines[ l ][ 0 ] * right + Lines[ l ][ 1 ] * up;
|
||||||
|
G_Vertex( pos );
|
||||||
|
|
||||||
|
pos = start + Lines[ l ][ 2 ] * right + Lines[ l ][ 3 ] * up;
|
||||||
|
G_Vertex( pos );
|
||||||
|
|
||||||
|
G_EndLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
start += 10 * right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
//
|
//
|
||||||
// LED style digits
|
// LED style digits
|
||||||
//
|
//
|
||||||
|
@ -1631,11 +1789,12 @@ static float Lines[ 9 ][ 4 ] =
|
||||||
void G_DrawDebugNumber
|
void G_DrawDebugNumber
|
||||||
(
|
(
|
||||||
Vector origin,
|
Vector origin,
|
||||||
int number,
|
float number,
|
||||||
float scale,
|
float scale,
|
||||||
float r,
|
float r,
|
||||||
float g,
|
float g,
|
||||||
float b
|
float b,
|
||||||
|
int precision
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1650,6 +1809,7 @@ void G_DrawDebugNumber
|
||||||
Vector ang;
|
Vector ang;
|
||||||
str text;
|
str text;
|
||||||
Vector delta;
|
Vector delta;
|
||||||
|
char format[ 20 ];
|
||||||
|
|
||||||
// only draw entity numbers within a certain radius
|
// only draw entity numbers within a certain radius
|
||||||
delta = Vector( g_edicts[ 1 ].s.origin ) - origin;
|
delta = Vector( g_edicts[ 1 ].s.origin ) - origin;
|
||||||
|
@ -1666,7 +1826,16 @@ void G_DrawDebugNumber
|
||||||
up *= scale;
|
up *= scale;
|
||||||
right *= scale;
|
right *= scale;
|
||||||
|
|
||||||
text = va( "%d", number );
|
if ( precision > 0 )
|
||||||
|
{
|
||||||
|
sprintf( format, "%%.%df", precision );
|
||||||
|
text = va( format, number );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text = va( "%d", ( int )number );
|
||||||
|
}
|
||||||
|
|
||||||
start = origin - ( text.length() - 1 ) * 5 * right;
|
start = origin - ( text.length() - 1 ) * 5 * right;
|
||||||
|
|
||||||
for( i = 0; i < text.length(); i++ )
|
for( i = 0; i < text.length(); i++ )
|
||||||
|
@ -1679,6 +1848,10 @@ void G_DrawDebugNumber
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ( ( l < 0 ) || ( l > 8 ) )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
G_BeginLine();
|
G_BeginLine();
|
||||||
|
|
||||||
|
@ -1694,6 +1867,7 @@ void G_DrawDebugNumber
|
||||||
start += 10 * right;
|
start += 10 * right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Vector G_CalculateImpulse
|
Vector G_CalculateImpulse
|
||||||
(
|
(
|
||||||
|
@ -1824,6 +1998,24 @@ qboolean OnSameTeam
|
||||||
char ent1Team [512];
|
char ent1Team [512];
|
||||||
char ent2Team [512];
|
char ent2Team [512];
|
||||||
|
|
||||||
|
// CTF check for same team
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
if ( !ent1->client || !ent2->client )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ent1->client->resp.ctf_team == ent2->client->resp.ctf_team )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !DM_FLAG( DF_MODELTEAMS | DF_SKINTEAMS ) )
|
if ( !DM_FLAG( DF_MODELTEAMS | DF_SKINTEAMS ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
18
g_utils.h
18
g_utils.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_utils.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_utils.h $
|
||||||
// $Revision:: 15 $
|
// $Revision:: 17 $
|
||||||
// $Author:: Markd $
|
// $Author:: Markd $
|
||||||
// $Date:: 10/26/98 3:50a $
|
// $Date:: 5/19/99 4:57p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,16 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/g_utils.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/g_utils.h $
|
||||||
//
|
//
|
||||||
|
// 17 5/19/99 4:57p Markd
|
||||||
|
// fixed some errors
|
||||||
|
//
|
||||||
|
// 16 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:08p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:38p Aldie
|
||||||
|
//
|
||||||
// 15 10/26/98 3:50a Markd
|
// 15 10/26/98 3:50a Markd
|
||||||
// put in prediction
|
// put in prediction
|
||||||
//
|
//
|
||||||
|
@ -91,7 +101,7 @@ EXPORT_FROM_DLL trace_t G_Trace( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t
|
||||||
EXPORT_FROM_DLL trace_t G_FullTrace( Vector &start, Vector &mins, Vector &maxs, Vector &end, float radius, Entity *passent, int contentmask, const char *reason );
|
EXPORT_FROM_DLL trace_t G_FullTrace( Vector &start, Vector &mins, Vector &maxs, Vector &end, float radius, Entity *passent, int contentmask, const char *reason );
|
||||||
EXPORT_FROM_DLL trace_t G_FullTrace( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, float radius, edict_t *passent, int contentmask, const char *reason );
|
EXPORT_FROM_DLL trace_t G_FullTrace( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, float radius, edict_t *passent, int contentmask, const char *reason );
|
||||||
|
|
||||||
EXPORT_FROM_DLL void SelectSpawnPoint( Vector &origin, Vector &angles, int *gravaxis = NULL );
|
EXPORT_FROM_DLL void SelectSpawnPoint( Vector &origin, Vector &angles, edict_t *edcit, int *gravaxis = NULL );
|
||||||
|
|
||||||
EXPORT_FROM_DLL int G_FindTarget( int entnum, const char *name );
|
EXPORT_FROM_DLL int G_FindTarget( int entnum, const char *name );
|
||||||
EXPORT_FROM_DLL Entity *G_NextEntity( Entity *ent );
|
EXPORT_FROM_DLL Entity *G_NextEntity( Entity *ent );
|
||||||
|
@ -119,7 +129,7 @@ EXPORT_FROM_DLL void G_BeginLine( void );
|
||||||
EXPORT_FROM_DLL void G_Vertex( Vector v );
|
EXPORT_FROM_DLL void G_Vertex( Vector v );
|
||||||
EXPORT_FROM_DLL void G_EndLine( void );
|
EXPORT_FROM_DLL void G_EndLine( void );
|
||||||
EXPORT_FROM_DLL void G_DebugBBox( Vector origin, Vector mins, Vector maxs, float r, float g, float b, float alpha );
|
EXPORT_FROM_DLL void G_DebugBBox( Vector origin, Vector mins, Vector maxs, float r, float g, float b, float alpha );
|
||||||
EXPORT_FROM_DLL void G_DrawDebugNumber( Vector origin, int number, float scale, float r, float g, float b );
|
EXPORT_FROM_DLL void G_DrawDebugNumber( Vector org, float number, float scale, float r, float g, float b, int precision = 0 );
|
||||||
|
|
||||||
EXPORT_FROM_DLL void G_LoadAndExecScript( const char *filename, const char *label = NULL );
|
EXPORT_FROM_DLL void G_LoadAndExecScript( const char *filename, const char *label = NULL );
|
||||||
EXPORT_FROM_DLL ScriptThread *ExecuteThread( str thread_name, qboolean start = true );
|
EXPORT_FROM_DLL ScriptThread *ExecuteThread( str thread_name, qboolean start = true );
|
||||||
|
|
69
game.dsp
69
game.dsp
|
@ -47,7 +47,7 @@ CFG=game - Win32 Debug Arcade
|
||||||
# PROP BASE Target_Dir "."
|
# PROP BASE Target_Dir "."
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 0
|
# PROP Use_Debug_Libraries 0
|
||||||
# PROP Output_Dir ".\Release"
|
# PROP Output_Dir "..\Release"
|
||||||
# PROP Intermediate_Dir ".\Release"
|
# PROP Intermediate_Dir ".\Release"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir "."
|
# PROP Target_Dir "."
|
||||||
|
@ -65,8 +65,8 @@ BSC32=bscmake.exe
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /machine:I386 /out:"Release/gamex86.dll"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /machine:I386 /out:"..\Release/gamex86.dll"
|
||||||
# SUBTRACT LINK32 /incremental:yes /map /debug
|
# SUBTRACT LINK32 /incremental:yes /debug
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "game - Win32 Debug"
|
!ELSEIF "$(CFG)" == "game - Win32 Debug"
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ LINK32=link.exe
|
||||||
# PROP BASE Target_Dir "."
|
# PROP BASE Target_Dir "."
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 1
|
# PROP Use_Debug_Libraries 1
|
||||||
# PROP Output_Dir ".\Debug"
|
# PROP Output_Dir "..\Debug"
|
||||||
# PROP Intermediate_Dir ".\Debug"
|
# PROP Intermediate_Dir ".\Debug"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir "."
|
# PROP Target_Dir "."
|
||||||
|
@ -95,7 +95,7 @@ BSC32=bscmake.exe
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"Debug/gamex86.dll"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"..\Debug/gamex86.dll"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "game - Win32 Debug Alpha"
|
!ELSEIF "$(CFG)" == "game - Win32 Debug Alpha"
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ LINK32=link.exe
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 1
|
# PROP Use_Debug_Libraries 1
|
||||||
# PROP Output_Dir ".\DebugAxp"
|
# PROP Output_Dir "..\DebugAxp"
|
||||||
# PROP Intermediate_Dir ".\DebugAxp"
|
# PROP Intermediate_Dir ".\DebugAxp"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
|
@ -125,7 +125,7 @@ BSC32=bscmake.exe
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x20000000" /subsystem:windows /dll /debug /machine:ALPHA
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x20000000" /subsystem:windows /dll /debug /machine:ALPHA
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x20000000" /subsystem:windows /dll /debug /machine:ALPHA /out:".\DebugAxp/gameaxp.dll"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x20000000" /subsystem:windows /dll /debug /machine:ALPHA /out:"..\DebugAxp/gameaxp.dll"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "game - Win32 Release Alpha"
|
!ELSEIF "$(CFG)" == "game - Win32 Release Alpha"
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ LINK32=link.exe
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 0
|
# PROP Use_Debug_Libraries 0
|
||||||
# PROP Output_Dir ".\ReleaseAXP"
|
# PROP Output_Dir "..\ReleaseAXP"
|
||||||
# PROP Intermediate_Dir ".\ReleaseAXP"
|
# PROP Intermediate_Dir ".\ReleaseAXP"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
|
@ -154,8 +154,8 @@ BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:ALPHA /out:"Release/gamex86.dll"
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:ALPHA /out:"..\Release/gamex86.dll"
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:ALPHA /out:".\ReleaseAXP/gameaxp.dll"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:ALPHA /out:"..\ReleaseAXP/gameaxp.dll"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "game - Win32 Debug Demo"
|
!ELSEIF "$(CFG)" == "game - Win32 Debug Demo"
|
||||||
|
|
||||||
|
@ -184,8 +184,8 @@ BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /out:"Debug/gamex86.dll"
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /out:"..\Debug/gamex86.dll"
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"Demo_Debug/gamex86.dll"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"../Demo_Debug/gamex86.dll"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "game - Win32 Release Demo"
|
!ELSEIF "$(CFG)" == "game - Win32 Release Demo"
|
||||||
|
|
||||||
|
@ -214,9 +214,9 @@ BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:I386 /out:"Release/gamex86.dll"
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /machine:I386 /out:"..\Release/gamex86.dll"
|
||||||
# SUBTRACT BASE LINK32 /incremental:yes /debug
|
# SUBTRACT BASE LINK32 /incremental:yes /debug
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /machine:I386 /out:"Demo_Release/gamex86.dll"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /machine:I386 /out:"..\Demo_Release/gamex86.dll"
|
||||||
# SUBTRACT LINK32 /incremental:yes /debug
|
# SUBTRACT LINK32 /incremental:yes /debug
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "game - Win32 Debug Arcade"
|
!ELSEIF "$(CFG)" == "game - Win32 Debug Arcade"
|
||||||
|
@ -229,7 +229,7 @@ LINK32=link.exe
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 1
|
# PROP Use_Debug_Libraries 1
|
||||||
# PROP Output_Dir "./Arcade_Debug"
|
# PROP Output_Dir "../Arcade_Debug"
|
||||||
# PROP Intermediate_Dir "./Arcade_Debug"
|
# PROP Intermediate_Dir "./Arcade_Debug"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
|
@ -246,8 +246,8 @@ BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"Debug/gamex86.dll"
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"..\Debug/gamex86.dll"
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"Arcade_Debug/gamex86.dll"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /debug /machine:I386 /out:"..\Arcade_Debug/gamex86.dll"
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "game - Win32 Release Arcade"
|
!ELSEIF "$(CFG)" == "game - Win32 Release Arcade"
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ LINK32=link.exe
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_MFC 0
|
# PROP Use_MFC 0
|
||||||
# PROP Use_Debug_Libraries 0
|
# PROP Use_Debug_Libraries 0
|
||||||
# PROP Output_Dir "./Arcade_Release"
|
# PROP Output_Dir "../Arcade_Release"
|
||||||
# PROP Intermediate_Dir "./Arcade_Release"
|
# PROP Intermediate_Dir "./Arcade_Release"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
|
@ -276,10 +276,10 @@ BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /machine:I386 /out:"Release/gamex86.dll"
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /machine:I386 /out:"..\Release/gamex86.dll"
|
||||||
# SUBTRACT BASE LINK32 /incremental:yes /map /debug
|
# SUBTRACT BASE LINK32 /incremental:yes /map /debug
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /machine:I386 /out:"Arcade_Release/gamex86.dll"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winmm.lib /nologo /base:"0x11000000" /subsystem:windows /dll /map /machine:I386 /out:"..\Arcade_Release/gamex86.dll"
|
||||||
# SUBTRACT LINK32 /incremental:yes /map /debug
|
# SUBTRACT LINK32 /incremental:yes /debug
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
|
@ -1126,6 +1126,29 @@ SOURCE=.\glowstick.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\grapple.cpp
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "game - Win32 Release"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "game - Win32 Debug"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "game - Win32 Debug Alpha"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "game - Win32 Release Alpha"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "game - Win32 Debug Demo"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "game - Win32 Release Demo"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "game - Win32 Debug Arcade"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "game - Win32 Release Arcade"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\gravpath.cpp
|
SOURCE=.\gravpath.cpp
|
||||||
|
|
||||||
!IF "$(CFG)" == "game - Win32 Release"
|
!IF "$(CFG)" == "game - Win32 Release"
|
||||||
|
@ -2597,6 +2620,10 @@ SOURCE=.\gibs.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\grapple.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\gravpath.h
|
SOURCE=.\gravpath.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
29
game.dsw
Normal file
29
game.dsw
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "game"=.\game.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
38
grapple.cpp
38
grapple.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/grapple.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/grapple.cpp $
|
||||||
// $Revision:: 1 $
|
// $Revision:: 6 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Aldie $
|
||||||
// $Date:: 2/17/99 8:03p $
|
// $Date:: 3/25/99 6:29p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,21 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/grapple.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/grapple.cpp $
|
||||||
//
|
//
|
||||||
|
// 6 3/25/99 6:29p Aldie
|
||||||
|
// Fixed grappling hook crash bug
|
||||||
|
//
|
||||||
|
// 5 3/14/99 1:53a Aldie
|
||||||
|
// Fixed NULL surface flag check for hook
|
||||||
|
//
|
||||||
|
// 4 3/12/99 8:13p Aldie
|
||||||
|
// Added hack for Richard's level
|
||||||
|
//
|
||||||
|
// 3 3/03/99 12:38p Aldie
|
||||||
|
// Fixed hook for gravaxis
|
||||||
|
//
|
||||||
|
// 2 3/02/99 9:23p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
// 1 2/17/99 8:03p Aldie
|
// 1 2/17/99 8:03p Aldie
|
||||||
//
|
//
|
||||||
// 2 2/16/99 4:08p Aldie
|
// 2 2/16/99 4:08p Aldie
|
||||||
|
@ -62,6 +77,7 @@ EXPORT_FROM_DLL void Hook::Touch
|
||||||
|
|
||||||
stopsound( CHAN_VOICE );
|
stopsound( CHAN_VOICE );
|
||||||
setSolidType( SOLID_NOT );
|
setSolidType( SOLID_NOT );
|
||||||
|
setMoveType( MOVETYPE_NONE );
|
||||||
|
|
||||||
if ( HitSky() || other->isSubclassOf( Teleporter ) )
|
if ( HitSky() || other->isSubclassOf( Teleporter ) )
|
||||||
{
|
{
|
||||||
|
@ -69,6 +85,17 @@ EXPORT_FROM_DLL void Hook::Touch
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK for Richard's map
|
||||||
|
if
|
||||||
|
(
|
||||||
|
( level.impact_trace.surface ) &&
|
||||||
|
( level.impact_trace.surface->flags & SURF_DAMAGE )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
PostEvent( EV_Remove, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
damg = 10;
|
damg = 10;
|
||||||
|
|
||||||
owner = G_GetEntity( this->owner );
|
owner = G_GetEntity( this->owner );
|
||||||
|
@ -78,7 +105,9 @@ EXPORT_FROM_DLL void Hook::Touch
|
||||||
|
|
||||||
if (other->takedamage)
|
if (other->takedamage)
|
||||||
{
|
{
|
||||||
other->Damage( this, owner, damg, worldorigin, velocity, level.impact_trace.plane.normal, 200, 0, MOD_ROCKET, -1, -1, 1.0f );
|
player = (Player *)( Entity * )owner;
|
||||||
|
player->ClearGrapplePull();
|
||||||
|
other->Damage( this, owner, damg, worldorigin, velocity, level.impact_trace.plane.normal, 200, 0, MOD_GRAPPLE, -1, -1, 1.0f );
|
||||||
PostEvent( EV_Remove, 0.1 );
|
PostEvent( EV_Remove, 0.1 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -116,6 +145,7 @@ EXPORT_FROM_DLL void Hook::Setup
|
||||||
setMoveType( MOVETYPE_FLYMISSILE );
|
setMoveType( MOVETYPE_FLYMISSILE );
|
||||||
setSolidType( SOLID_BBOX );
|
setSolidType( SOLID_BBOX );
|
||||||
edict->clipmask = MASK_PROJECTILE;
|
edict->clipmask = MASK_PROJECTILE;
|
||||||
|
SetGravityAxis( owner->gravaxis );
|
||||||
|
|
||||||
angles = dir.toAngles();
|
angles = dir.toAngles();
|
||||||
angles[ PITCH ] = - angles[ PITCH ];
|
angles[ PITCH ] = - angles[ PITCH ];
|
||||||
|
@ -130,7 +160,7 @@ EXPORT_FROM_DLL void Hook::Setup
|
||||||
|
|
||||||
takedamage = DAMAGE_NO;
|
takedamage = DAMAGE_NO;
|
||||||
|
|
||||||
setModel( "hook.def" );
|
setModel( "ctf_grap.def" );
|
||||||
gravity = 0;
|
gravity = 0;
|
||||||
|
|
||||||
setSize( "-1 -1 -1", "1 1 1" );
|
setSize( "-1 -1 -1", "1 1 1" );
|
||||||
|
|
91
grapple.h
Normal file
91
grapple.h
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/grapple.h $
|
||||||
|
// $Revision:: 1 $
|
||||||
|
// $Author:: Aldie $
|
||||||
|
// $Date:: 3/02/99 9:24p $
|
||||||
|
//
|
||||||
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// This source may not be distributed and/or modified without
|
||||||
|
// expressly written permission by Ritual Entertainment, Inc.
|
||||||
|
//
|
||||||
|
// $Log:: /Quake 2 Engine/Sin/code/game/grapple.h $
|
||||||
|
//
|
||||||
|
// 1 3/02/99 9:24p Aldie
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:08p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:38p Aldie
|
||||||
|
//
|
||||||
|
// 2 2/10/99 9:35p Aldie
|
||||||
|
// First Version
|
||||||
|
//
|
||||||
|
// DESCRIPTION:
|
||||||
|
// Grappling Hook
|
||||||
|
|
||||||
|
#ifndef __GRAPPLE_H__
|
||||||
|
#define __GRAPPLE_H__
|
||||||
|
|
||||||
|
#include "g_local.h"
|
||||||
|
#include "item.h"
|
||||||
|
#include "weapon.h"
|
||||||
|
#include "specialfx.h"
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL Hook : public Projectile
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
float speed;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( Hook );
|
||||||
|
|
||||||
|
void Setup( Entity *owner, Vector pos, Vector dir );
|
||||||
|
virtual void Archive( Archiver &arc );
|
||||||
|
virtual void Unarchive( Archiver &arc );
|
||||||
|
virtual void Touch( Event *ev );
|
||||||
|
};
|
||||||
|
|
||||||
|
inline EXPORT_FROM_DLL void Hook::Archive
|
||||||
|
(
|
||||||
|
Archiver &arc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Projectile::Archive( arc );
|
||||||
|
|
||||||
|
arc.WriteFloat( speed );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline EXPORT_FROM_DLL void Hook::Unarchive
|
||||||
|
(
|
||||||
|
Archiver &arc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Projectile::Unarchive( arc );
|
||||||
|
|
||||||
|
arc.ReadFloat( &speed );
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef SafePtr<Hook> HookPtr;
|
||||||
|
typedef SafePtr<Beam> BeamPtr;
|
||||||
|
|
||||||
|
class EXPORT_FROM_DLL Grapple : public Weapon
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
HookPtr hook;
|
||||||
|
BeamPtr beam;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CLASS_PROTOTYPE( Grapple );
|
||||||
|
|
||||||
|
Grapple();
|
||||||
|
~Grapple();
|
||||||
|
virtual void Shoot( Event *ev );
|
||||||
|
virtual qboolean HasAmmo( void );
|
||||||
|
virtual void ReleaseFire( float t );
|
||||||
|
virtual void UpdateBeam( Event *ev );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* grapple.h */
|
19
health.cpp
19
health.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/health.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/health.cpp $
|
||||||
// $Revision:: 19 $
|
// $Revision:: 20 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/17/98 6:08a $
|
// $Date:: 3/19/99 5:03p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/health.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/health.cpp $
|
||||||
//
|
//
|
||||||
|
// 20 3/19/99 5:03p Aldie
|
||||||
|
// Added REGENERATION TECH support
|
||||||
|
//
|
||||||
// 19 11/17/98 6:08a Jimdose
|
// 19 11/17/98 6:08a Jimdose
|
||||||
// made PickupHealth take health from player's inventory before checking if
|
// made PickupHealth take health from player's inventory before checking if
|
||||||
// they can pick it up. Fixes bug where player can't pickup health due to
|
// they can pick it up. Fixes bug where player can't pickup health due to
|
||||||
|
@ -81,6 +84,7 @@
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
#include "sentient.h"
|
#include "sentient.h"
|
||||||
#include "health.h"
|
#include "health.h"
|
||||||
|
#include "ctf.h"
|
||||||
|
|
||||||
CLASS_DECLARATION( Item, Health, "health_020" );
|
CLASS_DECLARATION( Item, Health, "health_020" );
|
||||||
|
|
||||||
|
@ -139,7 +143,14 @@ void Health::PickupHealth
|
||||||
}
|
}
|
||||||
|
|
||||||
sen->health += amount;
|
sen->health += amount;
|
||||||
if ( sen->health > 200 )
|
if ( ctf->value && sen->HasItem( "CTF_Tech_Regeneration" ) )
|
||||||
|
{
|
||||||
|
if ( sen->health > CTF_TECH_REGENERATION_HEALTH )
|
||||||
|
{
|
||||||
|
sen->health = CTF_TECH_REGENERATION_HEALTH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( sen->health > 200 )
|
||||||
{
|
{
|
||||||
sen->health = 200;
|
sen->health = 200;
|
||||||
}
|
}
|
||||||
|
|
10
item.h
10
item.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/item.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/item.h $
|
||||||
// $Revision:: 23 $
|
// $Revision:: 24 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/08/98 10:52p $
|
// $Date:: 3/02/99 9:16p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/item.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/item.h $
|
||||||
//
|
//
|
||||||
|
// 24 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
// 23 11/08/98 10:52p Jimdose
|
// 23 11/08/98 10:52p Jimdose
|
||||||
// amountoverride wasn't archived
|
// amountoverride wasn't archived
|
||||||
// made icon_index and item_index be calculated in unarchive
|
// made icon_index and item_index be calculated in unarchive
|
||||||
|
@ -162,6 +165,7 @@ class EXPORT_FROM_DLL Item : public Trigger
|
||||||
virtual void RespawnSound( Event *ev );
|
virtual void RespawnSound( Event *ev );
|
||||||
virtual void DialogNeeded( Event *ev );
|
virtual void DialogNeeded( Event *ev );
|
||||||
virtual str GetDialogNeeded( void );
|
virtual str GetDialogNeeded( void );
|
||||||
|
virtual void ClearOwner( void ){ owner = NULL; }
|
||||||
virtual void Archive( Archiver &arc );
|
virtual void Archive( Archiver &arc );
|
||||||
virtual void Unarchive( Archiver &arc );
|
virtual void Unarchive( Archiver &arc );
|
||||||
};
|
};
|
||||||
|
|
18
listener.cpp
18
listener.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/listener.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/listener.cpp $
|
||||||
// $Revision:: 45 $
|
// $Revision:: 48 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/10/98 5:48p $
|
// $Date:: 3/26/99 6:26p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,15 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/listener.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/listener.cpp $
|
||||||
//
|
//
|
||||||
|
// 48 3/26/99 6:26p Aldie
|
||||||
|
// Fixed more CTF bugs, probably the last ones
|
||||||
|
//
|
||||||
|
// 47 3/18/99 6:44p Aldie
|
||||||
|
// CancelPendingEvents when destructing
|
||||||
|
//
|
||||||
|
// 46 3/17/99 4:00p Aldie
|
||||||
|
// CTF Update
|
||||||
|
//
|
||||||
// 45 11/10/98 5:48p Jimdose
|
// 45 11/10/98 5:48p Jimdose
|
||||||
// Made SortEventList sort the list manually when TEMPLATE_EXPORT is not
|
// Made SortEventList sort the list manually when TEMPLATE_EXPORT is not
|
||||||
// defined
|
// defined
|
||||||
|
@ -762,7 +771,7 @@ EXPORT_FROM_DLL void Event::AddEntity
|
||||||
{
|
{
|
||||||
char text[ 128 ];
|
char text[ 128 ];
|
||||||
|
|
||||||
assert( ent );
|
//assert( ent );
|
||||||
if ( !ent )
|
if ( !ent )
|
||||||
{
|
{
|
||||||
sprintf( text, "*0" );
|
sprintf( text, "*0" );
|
||||||
|
@ -1240,6 +1249,7 @@ EXPORT_FROM_DLL void Listener::Remove
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
this->CancelPendingEvents();
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
listener.h
11
listener.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/listener.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/listener.h $
|
||||||
// $Revision:: 30 $
|
// $Revision:: 31 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 10/26/98 4:27p $
|
// $Date:: 5/19/99 11:30a $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/listener.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/listener.h $
|
||||||
//
|
//
|
||||||
|
// 31 5/19/99 11:30a Markd
|
||||||
|
// Added new camera support
|
||||||
|
//
|
||||||
// 30 10/26/98 4:27p Jimdose
|
// 30 10/26/98 4:27p Jimdose
|
||||||
// Sped up ValidEvent
|
// Sped up ValidEvent
|
||||||
// Added FindEvent( const char * )
|
// Added FindEvent( const char * )
|
||||||
|
@ -390,8 +393,6 @@ inline EXPORT_FROM_DLL void Event::SetConsoleEdict
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
assert( consoleedict );
|
|
||||||
|
|
||||||
// linenumber does double duty in the case of the console commands
|
// linenumber does double duty in the case of the console commands
|
||||||
if ( consoleedict )
|
if ( consoleedict )
|
||||||
{
|
{
|
||||||
|
|
2564
player.cpp
2564
player.cpp
File diff suppressed because it is too large
Load diff
425
player.h
425
player.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/player.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/player.h $
|
||||||
// $Revision:: 119 $
|
// $Revision:: 125 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 11/16/98 8:26p $
|
// $Date:: 11/02/99 12:09p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,378 +13,26 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/player.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/player.h $
|
||||||
//
|
//
|
||||||
// 119 11/16/98 8:26p Jimdose
|
// 125 11/02/99 12:09p Markd
|
||||||
// Added CheckWater
|
// Fixed CTF cheat bug
|
||||||
//
|
//
|
||||||
// 118 11/14/98 2:53a Aldie
|
// 124 5/19/99 11:30a Markd
|
||||||
// Added InitSkin for keeping the skin intact for savegames
|
// Added new camera support
|
||||||
//
|
//
|
||||||
// 117 11/13/98 2:35a Aldie
|
// 123 3/19/99 8:59p Aldie
|
||||||
// Changed variable name
|
// Added spectator_distance
|
||||||
//
|
//
|
||||||
// 116 11/08/98 10:53p Jimdose
|
// 122 3/19/99 5:59p Aldie
|
||||||
// some variables weren't being archived. They were benign, but it helps
|
// Added dropweapon and droptech
|
||||||
// ensure that we don't miss important variables
|
|
||||||
//
|
//
|
||||||
// 115 11/07/98 10:15p Markd
|
// 121 3/03/99 12:39p Aldie
|
||||||
// Added forcemusic support
|
// Remove the bot stuff
|
||||||
//
|
//
|
||||||
// 114 11/07/98 8:01p Markd
|
// 120 3/02/99 9:16p Aldie
|
||||||
// Added in damage_since_pain, fixed some camera stuff
|
// Added CTF game code
|
||||||
//
|
//
|
||||||
// 113 11/06/98 9:38p Aldie
|
// 2 2/16/99 4:09p Aldie
|
||||||
// Moved waitforplayer stuff to think function
|
|
||||||
//
|
//
|
||||||
// 112 10/25/98 11:57p Jimdose
|
|
||||||
// exported EV_Player_Respawn
|
|
||||||
//
|
|
||||||
// 111 10/24/98 5:44p Markd
|
|
||||||
// Added killent, removent, killclass removeclass and added parameters to
|
|
||||||
// whatis
|
|
||||||
//
|
|
||||||
// 110 10/21/98 5:29p Aldie
|
|
||||||
// Added a setskin command
|
|
||||||
//
|
|
||||||
// 109 10/16/98 1:59a Jimdose
|
|
||||||
// Added EV_Player_EndLevel and EndLevel
|
|
||||||
// Made third person view work with savegames
|
|
||||||
//
|
|
||||||
// 108 10/14/98 1:36a Jimdose
|
|
||||||
// Got cross-level persitant data working
|
|
||||||
//
|
|
||||||
// 107 10/12/98 8:45p Jimdose
|
|
||||||
// Rewrote init function
|
|
||||||
// started adding persistant functions
|
|
||||||
//
|
|
||||||
// 106 10/11/98 8:58p Aldie
|
|
||||||
// Changed Restore to Human
|
|
||||||
//
|
|
||||||
// 105 10/11/98 7:41p Aldie
|
|
||||||
// Mutate and restore commands for Richard
|
|
||||||
//
|
|
||||||
// 104 10/10/98 9:59p Aldie
|
|
||||||
// Added trappedinquantum flag to archiver
|
|
||||||
//
|
|
||||||
// 103 10/10/98 5:58p Aldie
|
|
||||||
// More quantumdestab fixes
|
|
||||||
//
|
|
||||||
// 102 10/09/98 9:01p Aldie
|
|
||||||
// Moved GiveOxygen to player
|
|
||||||
//
|
|
||||||
// 101 10/07/98 11:54p Jimdose
|
|
||||||
// Added old_pmove to Player
|
|
||||||
// Added SetDeltaAngles
|
|
||||||
// Moved PlayerFrozen to game
|
|
||||||
//
|
|
||||||
// 100 10/02/98 7:20p Aldie
|
|
||||||
// Added flashcolor
|
|
||||||
//
|
|
||||||
// 99 9/30/98 5:39p Aldie
|
|
||||||
// Added showinfo command
|
|
||||||
//
|
|
||||||
// 98 9/29/98 5:06p Aldie
|
|
||||||
// Relocated gravity node functions
|
|
||||||
//
|
|
||||||
// 97 9/26/98 4:46p Aldie
|
|
||||||
// Added mutant mode
|
|
||||||
//
|
|
||||||
// 96 9/22/98 3:27p Markd
|
|
||||||
// Took out old variable
|
|
||||||
//
|
|
||||||
// 95 9/22/98 12:49p Markd
|
|
||||||
// Put in archive and unarchive functions
|
|
||||||
//
|
|
||||||
// 94 9/21/98 1:35a Aldie
|
|
||||||
// Moved some vars to sentient
|
|
||||||
//
|
|
||||||
// 93 9/19/98 4:47p Markd
|
|
||||||
// fixed music stuff and added actionincrement to weapons
|
|
||||||
//
|
|
||||||
// 92 9/18/98 10:57p Jimdose
|
|
||||||
// Added spawnactor and actorinfo
|
|
||||||
//
|
|
||||||
// 91 9/17/98 1:48p Markd
|
|
||||||
// Fixed swimmin animations
|
|
||||||
//
|
|
||||||
// 90 9/16/98 8:58p Aldie
|
|
||||||
// Added ability to do a hold down weapon charge
|
|
||||||
//
|
|
||||||
// 89 9/11/98 2:50p Aldie
|
|
||||||
// Added release firing functionality
|
|
||||||
//
|
|
||||||
// 88 9/10/98 8:53p Markd
|
|
||||||
// put in proper falling and landing animation thresholds.
|
|
||||||
//
|
|
||||||
// 87 9/09/98 5:06p Markd
|
|
||||||
// Added savefov and restorefov, also added fov change when teleporting
|
|
||||||
//
|
|
||||||
// 86 8/31/98 7:16p Markd
|
|
||||||
// Fixed player animation naming convention
|
|
||||||
//
|
|
||||||
// 85 8/31/98 5:45p Aldie
|
|
||||||
// Powerup timer stuff
|
|
||||||
//
|
|
||||||
// 84 8/30/98 7:29p Markd
|
|
||||||
// Put in auto-dead camera where after 10 seconds, player will follow the
|
|
||||||
// endnode1 path
|
|
||||||
//
|
|
||||||
// 83 8/29/98 9:53p Jimdose
|
|
||||||
// moved enums and #defines from g_local.h
|
|
||||||
//
|
|
||||||
// 82 8/29/98 5:27p Markd
|
|
||||||
// added specialfx, replaced misc with specialfx where appropriate
|
|
||||||
//
|
|
||||||
// 81 8/28/98 7:54p Markd
|
|
||||||
// Added TauntTime
|
|
||||||
//
|
|
||||||
// 80 8/27/98 4:50p Markd
|
|
||||||
// Added fallsurface
|
|
||||||
//
|
|
||||||
// 79 8/25/98 7:52p Markd
|
|
||||||
// Added crosshair to player again
|
|
||||||
//
|
|
||||||
// 78 8/25/98 4:11p Markd
|
|
||||||
// Added taunt support
|
|
||||||
//
|
|
||||||
// 77 8/17/98 8:59p Jimdose
|
|
||||||
// Added WhatIs
|
|
||||||
//
|
|
||||||
// 76 8/17/98 6:20p Markd
|
|
||||||
// Changed SetCamera to a Player method
|
|
||||||
//
|
|
||||||
// 75 8/17/98 3:07p Aldie
|
|
||||||
// Added the weaponuse command
|
|
||||||
//
|
|
||||||
// 74 8/12/98 6:04p Aldie
|
|
||||||
// Added a shield timer
|
|
||||||
//
|
|
||||||
// 73 8/07/98 6:01p Aldie
|
|
||||||
// Added frag credits for falling damage
|
|
||||||
//
|
|
||||||
// 72 7/31/98 8:10p Jimdose
|
|
||||||
// Script commands now include flags to indicate cheats and console commands
|
|
||||||
// Cheat function removed since events have cheat flags
|
|
||||||
//
|
|
||||||
// 71 7/31/98 4:20p Jimdose
|
|
||||||
// Added GiveHealthCheat
|
|
||||||
//
|
|
||||||
// 70 7/26/98 12:35p Jimdose
|
|
||||||
// Added GiveAllCheat
|
|
||||||
//
|
|
||||||
// 69 7/26/98 4:12a Aldie
|
|
||||||
// Updated getVehicle
|
|
||||||
//
|
|
||||||
// 68 7/25/98 5:21p Markd
|
|
||||||
// Added GotKill to player
|
|
||||||
//
|
|
||||||
// 67 7/24/98 7:37p Aldie
|
|
||||||
// Changed hud event
|
|
||||||
//
|
|
||||||
// 66 7/23/98 9:56p Aldie
|
|
||||||
// Added hud event
|
|
||||||
//
|
|
||||||
// 65 7/23/98 12:31p Markd
|
|
||||||
// Added onladder variable
|
|
||||||
//
|
|
||||||
// 64 7/22/98 10:20p Markd
|
|
||||||
// Added AnimPrefixForWeapon
|
|
||||||
//
|
|
||||||
// 63 7/21/98 9:07p Markd
|
|
||||||
// Added UpdateMusic
|
|
||||||
//
|
|
||||||
// 62 7/21/98 1:10p Aldie
|
|
||||||
// Added meansofdeath to obituaries
|
|
||||||
//
|
|
||||||
// 61 7/20/98 12:09p Markd
|
|
||||||
// Added vehicleanim support
|
|
||||||
//
|
|
||||||
// 60 7/17/98 4:04p Markd
|
|
||||||
// Added useWeapon
|
|
||||||
//
|
|
||||||
// 59 7/14/98 9:54p Markd
|
|
||||||
// Fixed camera stuff
|
|
||||||
//
|
|
||||||
// 58 7/13/98 5:02p Aldie
|
|
||||||
// Added dead player bodies with gibbing
|
|
||||||
//
|
|
||||||
// 57 7/11/98 8:58p Markd
|
|
||||||
// Added testthread command
|
|
||||||
//
|
|
||||||
// 56 7/10/98 11:18p Jimdose
|
|
||||||
// Removed third-person crosshair
|
|
||||||
//
|
|
||||||
// 55 7/08/98 3:12p Aldie
|
|
||||||
// First try at spectator mode
|
|
||||||
//
|
|
||||||
// 54 7/07/98 8:06p Aldie
|
|
||||||
// Spectator and dead stuff
|
|
||||||
//
|
|
||||||
// 53 7/02/98 2:34p Aldie
|
|
||||||
// Mission computer
|
|
||||||
//
|
|
||||||
// 52 6/24/98 1:39p Aldie
|
|
||||||
// Implementation of inventory system and picking stuff up
|
|
||||||
//
|
|
||||||
// 51 6/22/98 2:04p Jimdose
|
|
||||||
// Added vehicles back in
|
|
||||||
// Organized the control code a bit more. May want to make physics into a
|
|
||||||
// class
|
|
||||||
//
|
|
||||||
// 50 6/19/98 6:39p Aldie
|
|
||||||
// More inventory stuff
|
|
||||||
//
|
|
||||||
// 49 6/18/98 9:26p Aldie
|
|
||||||
// Started inventory system
|
|
||||||
//
|
|
||||||
// 48 6/15/98 10:48p Jimdose
|
|
||||||
// Added AddPathNode
|
|
||||||
//
|
|
||||||
// 47 6/13/98 8:20p Jimdose
|
|
||||||
// removed optimize path stuff
|
|
||||||
//
|
|
||||||
// 46 6/10/98 2:10p Aldie
|
|
||||||
// Updated damage function.
|
|
||||||
//
|
|
||||||
// 45 6/03/98 4:39p Markd
|
|
||||||
// removed parameters from SetCameraEntity stuff
|
|
||||||
//
|
|
||||||
// 44 5/27/98 7:03a Markd
|
|
||||||
// added action_level
|
|
||||||
//
|
|
||||||
// 43 5/26/98 7:56p Jimdose
|
|
||||||
// added scripted cameras
|
|
||||||
//
|
|
||||||
// 42 5/26/98 4:46p Aldie
|
|
||||||
// Added take (object) from player
|
|
||||||
//
|
|
||||||
// 41 5/26/98 4:38a Jimdose
|
|
||||||
// Added tracking crosshair
|
|
||||||
//
|
|
||||||
// 40 5/25/98 6:47p Jimdose
|
|
||||||
// Made animateframe, prethink and posthink into functions built into the base
|
|
||||||
// entity class
|
|
||||||
//
|
|
||||||
// 39 5/24/98 8:46p Jimdose
|
|
||||||
// Made a lot of functions more str-friendly.
|
|
||||||
// Got rid of a lot of char * based strings
|
|
||||||
// Cleaned up get spawn arg functions and sound functions
|
|
||||||
// sound functions now use consistant syntax
|
|
||||||
//
|
|
||||||
// 38 5/13/98 4:49p Jimdose
|
|
||||||
// Now use SafePtrs for keeping track of nodes and cameras
|
|
||||||
//
|
|
||||||
// 37 5/05/98 2:41p Jimdose
|
|
||||||
// New interface for controlling the clients view
|
|
||||||
// moved a lot of variables from gclient_t to be internal to player
|
|
||||||
//
|
|
||||||
// 36 5/03/98 4:37p Jimdose
|
|
||||||
// Added camera
|
|
||||||
//
|
|
||||||
// 35 5/01/98 6:16p Jimdose
|
|
||||||
// Made Respawn an event so that Trigger_Hurt wouldn't rekill a player after
|
|
||||||
// respawn
|
|
||||||
//
|
|
||||||
// 34 4/27/98 5:27p Jimdose
|
|
||||||
// Working on ai
|
|
||||||
//
|
|
||||||
// 33 4/21/98 2:25p Aldie
|
|
||||||
// Added enterconsole and exitconsole events.
|
|
||||||
//
|
|
||||||
// 32 4/20/98 2:45p Jimdose
|
|
||||||
// working on ai
|
|
||||||
//
|
|
||||||
// 31 4/18/98 3:02p Jimdose
|
|
||||||
// Removed nodebeam
|
|
||||||
//
|
|
||||||
// 30 4/16/98 2:10p Jimdose
|
|
||||||
// Working on ai.
|
|
||||||
// Removed TESTPATH stuff
|
|
||||||
//
|
|
||||||
// 29 4/09/98 8:44p Jimdose
|
|
||||||
// Added view blend effects
|
|
||||||
// added drowing
|
|
||||||
//
|
|
||||||
// 28 4/07/98 3:49p Aldie
|
|
||||||
// Added zooming crosshair
|
|
||||||
//
|
|
||||||
// 27 4/06/98 7:10p Aldie
|
|
||||||
// Added zooming for SniperRifle
|
|
||||||
//
|
|
||||||
// 26 4/05/98 2:58a Jimdose
|
|
||||||
// added respawn_time
|
|
||||||
//
|
|
||||||
// 25 4/04/98 6:13p Jimdose
|
|
||||||
// Added events for syncing firing to animation
|
|
||||||
//
|
|
||||||
// 24 4/02/98 4:46p Jimdose
|
|
||||||
// Added Obituary, Pain, and ShowScores
|
|
||||||
//
|
|
||||||
// 23 3/31/98 1:44p Jimdose
|
|
||||||
// Removed footstep stuff
|
|
||||||
//
|
|
||||||
// 22 3/29/98 9:42p Jimdose
|
|
||||||
// Moved animation stuff to sentient
|
|
||||||
//
|
|
||||||
// 21 3/29/98 5:57p Jimdose
|
|
||||||
// Added SpawnEntity command
|
|
||||||
//
|
|
||||||
// 20 3/28/98 4:36p Jimdose
|
|
||||||
// Added kill event
|
|
||||||
//
|
|
||||||
// 19 3/27/98 9:59p Jimdose
|
|
||||||
// Changed CalcRoll to return a float
|
|
||||||
//
|
|
||||||
// 18 3/27/98 6:36p Jimdose
|
|
||||||
// Added third person view
|
|
||||||
//
|
|
||||||
// 17 3/26/98 8:16p Jimdose
|
|
||||||
// Added animation control functions
|
|
||||||
// Added respawn and init functions for deathmatch
|
|
||||||
//
|
|
||||||
// 16 3/23/98 1:33p Jimdose
|
|
||||||
// Revamped event and command system
|
|
||||||
//
|
|
||||||
// 15 3/18/98 7:21p Jimdose
|
|
||||||
// Added CalcGunOffset
|
|
||||||
//
|
|
||||||
// 14 3/03/98 6:03p Aldie
|
|
||||||
// First pass at footsteps.
|
|
||||||
//
|
|
||||||
// 13 3/02/98 8:49p Jimdose
|
|
||||||
// Changed CLASS_PROTOTYPE to only take the classname
|
|
||||||
//
|
|
||||||
// 12 2/21/98 1:22p Jimdose
|
|
||||||
// Removed A LOT of unused varables and code.
|
|
||||||
//
|
|
||||||
// 11 2/19/98 2:36p Jimdose
|
|
||||||
// Added weapons back in
|
|
||||||
//
|
|
||||||
// 10 2/17/98 8:35p Jimdose
|
|
||||||
// Removed useHeld
|
|
||||||
//
|
|
||||||
// 9 2/06/98 5:44p Jimdose
|
|
||||||
// replaced use of think and touch functions with events
|
|
||||||
// move client to Entity
|
|
||||||
//
|
|
||||||
// 8 2/03/98 10:59a Jimdose
|
|
||||||
// Updated to work with Quake 2 engine
|
|
||||||
// Moved initialization to constructor and removed Init function
|
|
||||||
// This will probably be rewritten to be simpler. This first rewrite sucks.
|
|
||||||
//
|
|
||||||
// 6 12/05/97 4:08p Aldie
|
|
||||||
// Added event to player for giving weapons.
|
|
||||||
//
|
|
||||||
// 5 11/12/97 5:12p Jimdose
|
|
||||||
// Added event definitions
|
|
||||||
//
|
|
||||||
// 4 10/27/97 2:59p Jimdose
|
|
||||||
// Removed dependency on quakedef.h
|
|
||||||
//
|
|
||||||
// 3 10/08/97 6:03p Jimdose
|
|
||||||
// Began vehicle support.
|
|
||||||
//
|
|
||||||
// 2 9/26/97 6:47p Jimdose
|
|
||||||
// Added standard Ritual headers
|
|
||||||
//
|
//
|
||||||
// DESCRIPTION:
|
// DESCRIPTION:
|
||||||
// Class definition of the player.
|
// Class definition of the player.
|
||||||
|
@ -404,6 +52,7 @@
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
#include "specialfx.h"
|
#include "specialfx.h"
|
||||||
|
#include "grapple.h"
|
||||||
|
|
||||||
extern Event EV_Player_EndLevel;
|
extern Event EV_Player_EndLevel;
|
||||||
extern Event EV_Player_PrevWeapon;
|
extern Event EV_Player_PrevWeapon;
|
||||||
|
@ -427,6 +76,7 @@ extern Event EV_Player_HideStats;
|
||||||
extern Event EV_Player_SetFlashColor;
|
extern Event EV_Player_SetFlashColor;
|
||||||
extern Event EV_Player_ClearFlashColor;
|
extern Event EV_Player_ClearFlashColor;
|
||||||
extern Event EV_Player_Respawn;
|
extern Event EV_Player_Respawn;
|
||||||
|
extern Event EV_Player_CTF_SoundEvent;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -449,7 +99,7 @@ typedef enum
|
||||||
|
|
||||||
class EXPORT_FROM_DLL Player : public Sentient
|
class EXPORT_FROM_DLL Player : public Sentient
|
||||||
{
|
{
|
||||||
private:
|
protected:
|
||||||
pmove_state_t old_pmove; // for detecting out-of-pmove changes
|
pmove_state_t old_pmove; // for detecting out-of-pmove changes
|
||||||
|
|
||||||
// bobbing
|
// bobbing
|
||||||
|
@ -501,7 +151,6 @@ class EXPORT_FROM_DLL Player : public Sentient
|
||||||
viewmode_t viewmode;
|
viewmode_t viewmode;
|
||||||
viewmode_t defaultViewMode;
|
viewmode_t defaultViewMode;
|
||||||
zoom_mode_t zoom_mode;
|
zoom_mode_t zoom_mode;
|
||||||
float respawn_time;
|
|
||||||
|
|
||||||
qboolean firing;
|
qboolean firing;
|
||||||
qboolean in_console;
|
qboolean in_console;
|
||||||
|
@ -541,6 +190,11 @@ class EXPORT_FROM_DLL Player : public Sentient
|
||||||
qboolean hidestats;
|
qboolean hidestats;
|
||||||
qboolean drawoverlay;
|
qboolean drawoverlay;
|
||||||
|
|
||||||
|
qboolean grapple_pull;
|
||||||
|
Vector grapple_org;
|
||||||
|
float grapple_speed;
|
||||||
|
float grapple_time;
|
||||||
|
|
||||||
// music mood stuff
|
// music mood stuff
|
||||||
float action_level;
|
float action_level;
|
||||||
int music_current_mood;
|
int music_current_mood;
|
||||||
|
@ -570,10 +224,16 @@ class EXPORT_FROM_DLL Player : public Sentient
|
||||||
float last_damage_time;
|
float last_damage_time;
|
||||||
qboolean music_forced;
|
qboolean music_forced;
|
||||||
|
|
||||||
|
// CTF
|
||||||
|
HookPtr hook;
|
||||||
|
BeamPtr beam;
|
||||||
|
float spectator_distance;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CLASS_PROTOTYPE( Player );
|
CLASS_PROTOTYPE( Player );
|
||||||
|
|
||||||
|
float respawn_time;
|
||||||
qboolean trappedInQuantum;
|
qboolean trappedInQuantum;
|
||||||
|
|
||||||
Player();
|
Player();
|
||||||
|
@ -660,7 +320,8 @@ class EXPORT_FROM_DLL Player : public Sentient
|
||||||
virtual void AddBlend( float r, float g, float b, float a );
|
virtual void AddBlend( float r, float g, float b, float a );
|
||||||
virtual void CalcBlend( void );
|
virtual void CalcBlend( void );
|
||||||
virtual void DamageFeedback( void );
|
virtual void DamageFeedback( void );
|
||||||
|
void SetGrapplePull( Vector dir, float speed );
|
||||||
|
void ClearGrapplePull( void );
|
||||||
virtual void ChooseAnim( void );
|
virtual void ChooseAnim( void );
|
||||||
|
|
||||||
virtual qboolean CanMoveTo( Vector pos );
|
virtual qboolean CanMoveTo( Vector pos );
|
||||||
|
@ -705,6 +366,7 @@ class EXPORT_FROM_DLL Player : public Sentient
|
||||||
virtual viewmode_t ViewMode( void );
|
virtual viewmode_t ViewMode( void );
|
||||||
virtual Camera *CurrentCamera( void );
|
virtual Camera *CurrentCamera( void );
|
||||||
virtual void SetCamera( Entity * ent );
|
virtual void SetCamera( Entity * ent );
|
||||||
|
void GetPlayerView( Vector *pos, Vector *angle );
|
||||||
|
|
||||||
void WhatIs( Event *ev );
|
void WhatIs( Event *ev );
|
||||||
void ActorInfo( Event *ev );
|
void ActorInfo( Event *ev );
|
||||||
|
@ -731,6 +393,27 @@ class EXPORT_FROM_DLL Player : public Sentient
|
||||||
void RemoveEnt( Event *ev );
|
void RemoveEnt( Event *ev );
|
||||||
void KillClass( Event *ev );
|
void KillClass( Event *ev );
|
||||||
void RemoveClass( Event *ev );
|
void RemoveClass( Event *ev );
|
||||||
|
|
||||||
|
// CTF
|
||||||
|
void InitCTF( void );
|
||||||
|
void CTF_JoinTeamHardcorps( Event *ev );
|
||||||
|
void CTF_JoinTeamSintek( Event *ev );
|
||||||
|
void CTF_JoinTeam( int desired_team );
|
||||||
|
void CTF_Team( Event *ev );
|
||||||
|
void CTF_ExtendGrapple( void );
|
||||||
|
void CTF_ReleaseGrapple( void );
|
||||||
|
void CTF_DeadDropFlag( void );
|
||||||
|
void CTF_UpdateHookBeam( Event *ev );
|
||||||
|
Vector CTF_GetGrapplePosition( void );
|
||||||
|
void CTF_AssignTeam( void );
|
||||||
|
void CTF_OpenJoinMenu( void );
|
||||||
|
void CTF_UpdateNumberOfPlayers( void );
|
||||||
|
void CTF_DeadDropTech( void );
|
||||||
|
void CTF_DropTech( Event *ev );
|
||||||
|
void CTF_SoundEvent( Event *ev );
|
||||||
|
void SetViewAngles( Vector ang );
|
||||||
|
void DropWeaponEvent( Event *ev );
|
||||||
|
void CTF_DropFlag( Event *ev );
|
||||||
};
|
};
|
||||||
|
|
||||||
inline EXPORT_FROM_DLL void Player::Archive
|
inline EXPORT_FROM_DLL void Player::Archive
|
||||||
|
|
56
powerups.cpp
56
powerups.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/powerups.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/powerups.cpp $
|
||||||
// $Revision:: 23 $
|
// $Revision:: 24 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/13/98 2:36a $
|
// $Date:: 3/24/99 4:30p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/powerups.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/powerups.cpp $
|
||||||
//
|
//
|
||||||
|
// 24 3/24/99 4:30p Aldie
|
||||||
|
// tried to bullet proof certain crash bugs
|
||||||
|
//
|
||||||
// 23 11/13/98 2:36a Aldie
|
// 23 11/13/98 2:36a Aldie
|
||||||
// Added a fixdeadbodies for mutagen
|
// Added a fixdeadbodies for mutagen
|
||||||
//
|
//
|
||||||
|
@ -133,6 +136,7 @@ void Adrenaline::Powerdown
|
||||||
{
|
{
|
||||||
if ( !owner )
|
if ( !owner )
|
||||||
{
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +147,9 @@ void Adrenaline::Powerdown
|
||||||
owner->edict->s.color_g = 0;
|
owner->edict->s.color_g = 0;
|
||||||
owner->edict->s.color_b = 0;
|
owner->edict->s.color_b = 0;
|
||||||
owner->edict->s.radius = 0;
|
owner->edict->s.radius = 0;
|
||||||
|
|
||||||
|
CancelPendingEvents();
|
||||||
|
PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Adrenaline::Use
|
void Adrenaline::Use
|
||||||
|
@ -154,7 +161,12 @@ void Adrenaline::Use
|
||||||
str realname;
|
str realname;
|
||||||
Event *event;
|
Event *event;
|
||||||
|
|
||||||
assert( owner );
|
if ( !owner )
|
||||||
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
|
PostEvent( EV_Remove, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( owner->PowerupActive() )
|
if ( owner->PowerupActive() )
|
||||||
{
|
{
|
||||||
|
@ -218,6 +230,7 @@ void Cloak::Powerdown
|
||||||
{
|
{
|
||||||
if ( !owner )
|
if ( !owner )
|
||||||
{
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -236,6 +249,7 @@ void Cloak::Powerdown
|
||||||
owner->edict->s.color_b = 0;
|
owner->edict->s.color_b = 0;
|
||||||
owner->edict->s.radius = 0;
|
owner->edict->s.radius = 0;
|
||||||
}
|
}
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +262,12 @@ void Cloak::Use
|
||||||
str realname;
|
str realname;
|
||||||
Event *event;
|
Event *event;
|
||||||
|
|
||||||
assert( owner );
|
if ( !owner )
|
||||||
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
|
PostEvent( EV_Remove, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( owner->PowerupActive() )
|
if ( owner->PowerupActive() )
|
||||||
{
|
{
|
||||||
|
@ -315,6 +334,7 @@ void Mutagen::Powerdown
|
||||||
|
|
||||||
if ( !owner )
|
if ( !owner )
|
||||||
{
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -343,6 +363,7 @@ void Mutagen::Powerdown
|
||||||
}
|
}
|
||||||
|
|
||||||
owner->takeWeapon( "MutantHands" );
|
owner->takeWeapon( "MutantHands" );
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +377,12 @@ void Mutagen::Use
|
||||||
Event *event;
|
Event *event;
|
||||||
Weapon *mutanthands;
|
Weapon *mutanthands;
|
||||||
|
|
||||||
assert( owner );
|
if ( !owner )
|
||||||
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
|
PostEvent( EV_Remove, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( owner->PowerupActive() )
|
if ( owner->PowerupActive() )
|
||||||
{
|
{
|
||||||
|
@ -457,7 +483,7 @@ void Medkit::Use
|
||||||
str realname;
|
str realname;
|
||||||
|
|
||||||
other = ev->GetEntity( 1 );
|
other = ev->GetEntity( 1 );
|
||||||
if ( other->health < other->max_health )
|
if ( other && other->health < other->max_health )
|
||||||
{
|
{
|
||||||
other->health = other->max_health;
|
other->health = other->max_health;
|
||||||
realname = GetRandomAlias( "snd_activate" );
|
realname = GetRandomAlias( "snd_activate" );
|
||||||
|
@ -496,6 +522,7 @@ void Oxygen::Powerdown
|
||||||
{
|
{
|
||||||
if ( !owner )
|
if ( !owner )
|
||||||
{
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -509,6 +536,7 @@ void Oxygen::Powerdown
|
||||||
if ( realname.length() )
|
if ( realname.length() )
|
||||||
owner->sound( realname, 1, CHAN_ITEM, ATTN_NORM );
|
owner->sound( realname, 1, CHAN_ITEM, ATTN_NORM );
|
||||||
}
|
}
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,10 +552,12 @@ void Oxygen::Pickup
|
||||||
|
|
||||||
other = ev->GetEntity( 1 );
|
other = ev->GetEntity( 1 );
|
||||||
|
|
||||||
assert( other );
|
|
||||||
|
|
||||||
if ( !other )
|
if ( !other )
|
||||||
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
|
PostEvent( EV_Remove, 0 );
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sen = ( Sentient * )other;
|
sen = ( Sentient * )other;
|
||||||
|
|
||||||
|
@ -559,8 +589,11 @@ void Oxygen::Pickup
|
||||||
|
|
||||||
item = sen->FindItem( getClassname() );
|
item = sen->FindItem( getClassname() );
|
||||||
if ( item )
|
if ( item )
|
||||||
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
item->PostEvent( EV_Remove, 0 );
|
item->PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Oxygen::Use
|
void Oxygen::Use
|
||||||
(
|
(
|
||||||
|
@ -571,7 +604,12 @@ void Oxygen::Use
|
||||||
str realname;
|
str realname;
|
||||||
Event *event;
|
Event *event;
|
||||||
|
|
||||||
assert( owner );
|
if ( !owner )
|
||||||
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
|
PostEvent( EV_Remove, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Single player must have the scuba gear to use oxygen
|
// Single player must have the scuba gear to use oxygen
|
||||||
if ( !deathmatch->value && !owner->FindItem( "ScubaGear" ) )
|
if ( !deathmatch->value && !owner->FindItem( "ScubaGear" ) )
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/pulserifle.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/pulserifle.cpp $
|
||||||
// $Revision:: 68 $
|
// $Revision:: 69 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/16/98 3:11a $
|
// $Date:: 3/02/99 9:14p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/pulserifle.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/pulserifle.cpp $
|
||||||
//
|
//
|
||||||
|
// 69 3/02/99 9:14p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
// 68 11/16/98 3:11a Jimdose
|
// 68 11/16/98 3:11a Jimdose
|
||||||
// pulse now takes gravity of owner
|
// pulse now takes gravity of owner
|
||||||
//
|
//
|
||||||
|
@ -622,6 +625,9 @@ void PulseRifle::Shoot
|
||||||
angles = dir.toAngles();
|
angles = dir.toAngles();
|
||||||
setAngles( angles );
|
setAngles( angles );
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
damg = 30;
|
||||||
|
else
|
||||||
damg = 15;
|
damg = 15;
|
||||||
TraceAttack( pos, trace.endpos, damg, &trace, 0, 0, 0 );
|
TraceAttack( pos, trace.endpos, damg, &trace, 0, 0, 0 );
|
||||||
NextAttack( 0 );
|
NextAttack( 0 );
|
||||||
|
|
|
@ -106,8 +106,6 @@
|
||||||
// DESCRIPTION:
|
// DESCRIPTION:
|
||||||
//
|
//
|
||||||
|
|
||||||
#define SIN
|
|
||||||
|
|
||||||
#include "q_shared.h"
|
#include "q_shared.h"
|
||||||
#include "float.h"
|
#include "float.h"
|
||||||
|
|
||||||
|
|
88
q_shared.h
88
q_shared.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/q_shared.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/q_shared.h $
|
||||||
// $Revision:: 189 $
|
// $Revision:: 195 $
|
||||||
// $Author:: Markd $
|
// $Author:: Jimdose $
|
||||||
// $Date:: 1/27/99 10:02p $
|
// $Date:: 8/03/99 7:09p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,28 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/q_shared.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/q_shared.h $
|
||||||
//
|
//
|
||||||
|
// 195 8/03/99 7:09p Jimdose
|
||||||
|
// changes for Sin Arcade
|
||||||
|
//
|
||||||
|
// 194 7/24/99 6:47p Markd
|
||||||
|
// Added talk feature and added speech code
|
||||||
|
//
|
||||||
|
// 193 7/24/99 5:45p Markd
|
||||||
|
// Added new NO_WEAPON_CHANGE DM Flag
|
||||||
|
//
|
||||||
|
// 192 5/18/99 7:08p Aldie
|
||||||
|
// remove useless ctf flag
|
||||||
|
//
|
||||||
|
// 191 3/19/99 4:14p Aldie
|
||||||
|
// Moved MOD to client
|
||||||
|
//
|
||||||
|
// 190 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:09p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:39p Aldie
|
||||||
|
//
|
||||||
// 189 1/27/99 10:02p Markd
|
// 189 1/27/99 10:02p Markd
|
||||||
// Merged 2015 source into main code base
|
// Merged 2015 source into main code base
|
||||||
//
|
//
|
||||||
|
@ -699,6 +721,7 @@ typedef enum {false, true} qboolean;
|
||||||
#define PRINT_MEDIUM 1 // death messages
|
#define PRINT_MEDIUM 1 // death messages
|
||||||
#define PRINT_HIGH 2 // critical messages
|
#define PRINT_HIGH 2 // critical messages
|
||||||
#define PRINT_CHAT 3 // chat messages
|
#define PRINT_CHAT 3 // chat messages
|
||||||
|
#define PRINT_TALK 4 // speech synthesis messages
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1294,7 +1317,8 @@ typedef enum
|
||||||
PM_FREEZE,
|
PM_FREEZE,
|
||||||
PM_MOVECAPTURED, // using a movement capturer
|
PM_MOVECAPTURED, // using a movement capturer
|
||||||
PM_ONBIKE, // added for hoverbike
|
PM_ONBIKE, // added for hoverbike
|
||||||
PM_ATTACHVIEW // added for guided missile
|
PM_ATTACHVIEW, // added for guided missile
|
||||||
|
PM_GRAPPLE_PULL,
|
||||||
#else
|
#else
|
||||||
PM_FREEZE
|
PM_FREEZE
|
||||||
#endif
|
#endif
|
||||||
|
@ -1996,6 +2020,11 @@ typedef enum
|
||||||
#define STAT_CPCOUNT 14 // number of checkpoints left to touch this lap
|
#define STAT_CPCOUNT 14 // number of checkpoints left to touch this lap
|
||||||
#define STAT_NIGHTVISION 15 // set when player is in night vision mode
|
#define STAT_NIGHTVISION 15 // set when player is in night vision mode
|
||||||
|
|
||||||
|
#ifdef SIN_ARCADE
|
||||||
|
#define STAT_FIRSTPLACE 16 // set if the player is in first place
|
||||||
|
#define STAT_DRAWFIRSTPLACE 17 // set if the player is in first place and we should show the icon
|
||||||
|
#endif
|
||||||
|
|
||||||
#define P_SHIELDS 1
|
#define P_SHIELDS 1
|
||||||
#define P_ADRENALINE 2
|
#define P_ADRENALINE 2
|
||||||
#define P_CLOAK 3
|
#define P_CLOAK 3
|
||||||
|
@ -2067,6 +2096,7 @@ typedef enum
|
||||||
#define DF_INFINITE_AMMO (1<<14)
|
#define DF_INFINITE_AMMO (1<<14)
|
||||||
#define DF_FIXED_FOV (1<<15)
|
#define DF_FIXED_FOV (1<<15)
|
||||||
#define DF_NO_DROP_WEAPONS (1<<16)
|
#define DF_NO_DROP_WEAPONS (1<<16)
|
||||||
|
#define DF_NO_WEAPON_CHANGE (1<<17)
|
||||||
|
|
||||||
// 2015 code
|
// 2015 code
|
||||||
#define DF_BBOX_BULLETS (1<<17)
|
#define DF_BBOX_BULLETS (1<<17)
|
||||||
|
@ -2261,6 +2291,56 @@ typedef struct entity_state_s
|
||||||
|
|
||||||
|
|
||||||
#ifdef SIN
|
#ifdef SIN
|
||||||
|
// means of death flags
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MOD_FISTS,
|
||||||
|
MOD_MAGNUM,
|
||||||
|
MOD_SHOTGUN,
|
||||||
|
MOD_ASSRIFLE,
|
||||||
|
MOD_CHAINGUN,
|
||||||
|
MOD_GRENADE,
|
||||||
|
MOD_ROCKET,
|
||||||
|
MOD_ROCKETSPLASH,
|
||||||
|
MOD_PULSE,
|
||||||
|
MOD_PULSELASER,
|
||||||
|
MOD_SPEARGUN,
|
||||||
|
MOD_SNIPER,
|
||||||
|
MOD_VEHICLE,
|
||||||
|
MOD_CRUSH,
|
||||||
|
MOD_SHOTROCKET,
|
||||||
|
MOD_FALLING,
|
||||||
|
MOD_DROWN,
|
||||||
|
MOD_SUICIDE,
|
||||||
|
MOD_EXPLODEWALL,
|
||||||
|
MOD_ELECTRIC,
|
||||||
|
MOD_TELEFRAG,
|
||||||
|
MOD_GENBULLET,
|
||||||
|
MOD_LASER,
|
||||||
|
MOD_BETTYSPIKE,
|
||||||
|
MOD_HELIGUN,
|
||||||
|
MOD_DEBRIS,
|
||||||
|
MOD_THROWNOBJECT,
|
||||||
|
MOD_LAVA,
|
||||||
|
MOD_SLIME,
|
||||||
|
MOD_ADRENALINE,
|
||||||
|
MOD_ION,
|
||||||
|
MOD_ION_DESTRUCT,
|
||||||
|
MOD_QUANTUM,
|
||||||
|
MOD_BEAM,
|
||||||
|
MOD_IMPACT,
|
||||||
|
MOD_FRIENDLY_FIRE,
|
||||||
|
MOD_SPIDERSPLASH,
|
||||||
|
MOD_MUTANTHANDS,
|
||||||
|
MOD_MUTANT_DRAIN,
|
||||||
|
MOD_GRAPPLE,
|
||||||
|
MOD_EMPATHY,
|
||||||
|
MOD_THRALLBALL,
|
||||||
|
MOD_THRALLSPLASH,
|
||||||
|
MOD_DEATHQUAD,
|
||||||
|
MOD_CTFTURRET
|
||||||
|
} mod_type_t;
|
||||||
|
|
||||||
// CONSOLE3D State
|
// CONSOLE3D State
|
||||||
#define MAIN_CONSOLE "maincon"
|
#define MAIN_CONSOLE "maincon"
|
||||||
#define GENERIC_CONSOLE "gencon"
|
#define GENERIC_CONSOLE "gencon"
|
||||||
|
|
33
quantumd.cpp
33
quantumd.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/quantumd.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/quantumd.cpp $
|
||||||
// $Revision:: 46 $
|
// $Revision:: 50 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/18/98 8:28p $
|
// $Date:: 5/18/99 7:07p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,18 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/quantumd.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/quantumd.cpp $
|
||||||
//
|
//
|
||||||
|
// 50 5/18/99 7:07p Aldie
|
||||||
|
// remove qd overload from ctf
|
||||||
|
//
|
||||||
|
// 49 3/29/99 6:21p Aldie
|
||||||
|
// Fixed sin again - Jack
|
||||||
|
//
|
||||||
|
// 48 3/29/99 6:14p Aldie
|
||||||
|
// Fixed by Jack. :-)
|
||||||
|
//
|
||||||
|
// 47 3/18/99 6:45p Aldie
|
||||||
|
// Only damage people with overload that you can damage
|
||||||
|
//
|
||||||
// 46 11/18/98 8:28p Aldie
|
// 46 11/18/98 8:28p Aldie
|
||||||
// Added NOION check for quantum overload
|
// Added NOION check for quantum overload
|
||||||
//
|
//
|
||||||
|
@ -704,8 +716,22 @@ void QuantumDestabilizer::Destruct
|
||||||
{
|
{
|
||||||
Entity *ent;
|
Entity *ent;
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
Event *event;
|
||||||
|
event = new Event( EV_Sentient_ReleaseAttack );
|
||||||
|
event->AddFloat( level.time - owner->firedowntime );
|
||||||
|
owner->ProcessEvent( event );
|
||||||
|
owner->firedown = false;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CancelEventsOfType( EV_Quantum_EatAmmo );
|
CancelEventsOfType( EV_Quantum_EatAmmo );
|
||||||
|
|
||||||
|
if ( !owner )
|
||||||
|
return;
|
||||||
|
|
||||||
CreateExplosion( owner->centroid, 200, 1.0f, true, this, owner, owner );
|
CreateExplosion( owner->centroid, 200, 1.0f, true, this, owner, owner );
|
||||||
|
|
||||||
ent = findradius( NULL, owner->centroid, 512 );
|
ent = findradius( NULL, owner->centroid, 512 );
|
||||||
|
@ -713,8 +739,11 @@ void QuantumDestabilizer::Destruct
|
||||||
{
|
{
|
||||||
if ( ( ent != owner ) && ( !ent->deadflag ) && ( ent->takedamage ) && !(ent->flags & FL_NOION ) )
|
if ( ( ent != owner ) && ( !ent->deadflag ) && ( ent->takedamage ) && !(ent->flags & FL_NOION ) )
|
||||||
{
|
{
|
||||||
|
if ( owner->CanDamage( ent ) )
|
||||||
ent->Damage( this, owner, 10000+ent->health, ent->worldorigin, vec_zero, vec_zero, 0, DAMAGE_NO_ARMOR|DAMAGE_NO_SKILL, MOD_ION, -1, -1, 1.0f );
|
ent->Damage( this, owner, 10000+ent->health, ent->worldorigin, vec_zero, vec_zero, 0, DAMAGE_NO_ARMOR|DAMAGE_NO_SKILL, MOD_ION, -1, -1, 1.0f );
|
||||||
}
|
}
|
||||||
|
if ( !owner )
|
||||||
|
return;
|
||||||
ent = findradius( ent, owner->centroid, 512 );
|
ent = findradius( ent, owner->centroid, 512 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/reactiveshields.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/reactiveshields.cpp $
|
||||||
// $Revision:: 11 $
|
// $Revision:: 12 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Aldie $
|
||||||
// $Date:: 10/13/98 2:30p $
|
// $Date:: 3/24/99 4:30p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/reactiveshields.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/reactiveshields.cpp $
|
||||||
//
|
//
|
||||||
|
// 12 3/24/99 4:30p Aldie
|
||||||
|
// tried to bullet proof certain crash bugs
|
||||||
|
//
|
||||||
// 11 10/13/98 2:30p Aldie
|
// 11 10/13/98 2:30p Aldie
|
||||||
// Check for owner
|
// Check for owner
|
||||||
//
|
//
|
||||||
|
@ -88,7 +91,13 @@ void ReactiveShields::Use
|
||||||
{
|
{
|
||||||
Event *event;
|
Event *event;
|
||||||
str realname;
|
str realname;
|
||||||
assert( owner );
|
|
||||||
|
if ( !owner )
|
||||||
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
|
PostEvent( EV_Remove, 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( owner->PowerupActive() )
|
if ( owner->PowerupActive() )
|
||||||
{
|
{
|
||||||
|
@ -130,6 +139,7 @@ void ReactiveShields::PowerDown
|
||||||
{
|
{
|
||||||
if ( !owner )
|
if ( !owner )
|
||||||
{
|
{
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -148,6 +158,7 @@ void ReactiveShields::PowerDown
|
||||||
owner->edict->s.color_b = 0;
|
owner->edict->s.color_b = 0;
|
||||||
owner->edict->s.radius = 0;
|
owner->edict->s.radius = 0;
|
||||||
}
|
}
|
||||||
|
CancelPendingEvents();
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/rocketlauncher.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/rocketlauncher.cpp $
|
||||||
// $Revision:: 83 $
|
// $Revision:: 84 $
|
||||||
// $Author:: Markd $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/15/98 12:22a $
|
// $Date:: 3/02/99 9:14p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,13 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/rocketlauncher.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/rocketlauncher.cpp $
|
||||||
//
|
//
|
||||||
|
// 84 3/02/99 9:14p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:09p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:39p Aldie
|
||||||
|
//
|
||||||
// 83 11/15/98 12:22a Markd
|
// 83 11/15/98 12:22a Markd
|
||||||
// Fixed pre-caching issues
|
// Fixed pre-caching issues
|
||||||
//
|
//
|
||||||
|
@ -277,6 +284,8 @@
|
||||||
#include "specialfx.h"
|
#include "specialfx.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "surface.h"
|
#include "surface.h"
|
||||||
|
#include "thrall.h"
|
||||||
|
#include "ctf.h"
|
||||||
|
|
||||||
#define ROCKET_SPEED 1000
|
#define ROCKET_SPEED 1000
|
||||||
#define ROCKET_RADIUS 150 // FIXME: max damage (90 +rand(20)) + 40 == 150... hard coded. gotta pass this in
|
#define ROCKET_RADIUS 150 // FIXME: max damage (90 +rand(20)) + 40 == 150... hard coded. gotta pass this in
|
||||||
|
@ -427,6 +436,15 @@ RocketLauncher::RocketLauncher()
|
||||||
|
|
||||||
SetMinRange( ROCKET_RADIUS );
|
SetMinRange( ROCKET_RADIUS );
|
||||||
SetProjectileSpeed( ROCKET_SPEED );
|
SetProjectileSpeed( ROCKET_SPEED );
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
// CTF rocketlauncher has alternate fire mode
|
||||||
|
modelIndex( "sprites/thrallpulse.spr" );
|
||||||
|
SetSecondaryAmmo( "Rockets", 10, 0);
|
||||||
|
dualmode = true;
|
||||||
|
alternate_fire = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RocketLauncher::Shoot
|
void RocketLauncher::Shoot
|
||||||
|
@ -436,6 +454,7 @@ void RocketLauncher::Shoot
|
||||||
|
|
||||||
{
|
{
|
||||||
Rocket *rocket;
|
Rocket *rocket;
|
||||||
|
ThrallPulse *pulse;
|
||||||
Vector pos;
|
Vector pos;
|
||||||
Vector dir;
|
Vector dir;
|
||||||
|
|
||||||
|
@ -447,7 +466,17 @@ void RocketLauncher::Shoot
|
||||||
|
|
||||||
GetMuzzlePosition( &pos, &dir );
|
GetMuzzlePosition( &pos, &dir );
|
||||||
|
|
||||||
|
if ( weaponmode == PRIMARY )
|
||||||
|
{
|
||||||
rocket = new Rocket;
|
rocket = new Rocket;
|
||||||
rocket->Setup( owner, pos, dir );
|
rocket->Setup( owner, pos, dir );
|
||||||
NextAttack( 1.0 );
|
NextAttack( 1.0 );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pulse = new ThrallPulse;
|
||||||
|
pulse->Setup( owner, pos, dir );
|
||||||
|
NextAttack( 1.0 );
|
||||||
|
SetPrimaryMode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/scriptmaster.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/scriptmaster.cpp $
|
||||||
// $Revision:: 156 $
|
// $Revision:: 158 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 2/16/99 8:38p $
|
// $Date:: 10/28/99 10:43a $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,12 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/scriptmaster.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/scriptmaster.cpp $
|
||||||
//
|
//
|
||||||
|
// 158 10/28/99 10:43a Markd
|
||||||
|
// made a bunch of console commands cheat protected
|
||||||
|
//
|
||||||
|
// 157 5/19/99 11:30a Markd
|
||||||
|
// Added new camera support
|
||||||
|
//
|
||||||
// 156 2/16/99 8:38p Jimdose
|
// 156 2/16/99 8:38p Jimdose
|
||||||
// moved sin arcade comm stuff to client
|
// moved sin arcade comm stuff to client
|
||||||
//
|
//
|
||||||
|
@ -588,10 +594,10 @@ Event EV_ScriptThread_FreezePlayer( "freezeplayer" );
|
||||||
Event EV_ScriptThread_ReleasePlayer( "releaseplayer" );
|
Event EV_ScriptThread_ReleasePlayer( "releaseplayer" );
|
||||||
Event EV_ScriptThread_Menu( "menu" );
|
Event EV_ScriptThread_Menu( "menu" );
|
||||||
Event EV_ScriptThread_MissionFailed( "missionfailed" );
|
Event EV_ScriptThread_MissionFailed( "missionfailed" );
|
||||||
Event EV_ScriptThread_KillEnt( "killent", EV_CONSOLE );
|
Event EV_ScriptThread_KillEnt( "killent", EV_CONSOLE | EV_CHEAT );
|
||||||
Event EV_ScriptThread_KillClass( "killclass", EV_CONSOLE );
|
Event EV_ScriptThread_KillClass( "killclass", EV_CONSOLE | EV_CHEAT );
|
||||||
Event EV_ScriptThread_RemoveEnt( "removeent", EV_CONSOLE );
|
Event EV_ScriptThread_RemoveEnt( "removeent", EV_CONSOLE | EV_CHEAT );
|
||||||
Event EV_ScriptThread_RemoveClass( "removeclass", EV_CONSOLE );
|
Event EV_ScriptThread_RemoveClass( "removeclass", EV_CONSOLE | EV_CHEAT );
|
||||||
|
|
||||||
// client/server flow control
|
// client/server flow control
|
||||||
Event EV_ScriptThread_ServerOnly( "server" );
|
Event EV_ScriptThread_ServerOnly( "server" );
|
||||||
|
@ -629,6 +635,7 @@ Event EV_ScriptThread_ScreenPrintFile( "screenprintfile" );
|
||||||
Event EV_ScriptThread_ClearScreenPrintFile( "clearscreenprintfile" );
|
Event EV_ScriptThread_ClearScreenPrintFile( "clearscreenprintfile" );
|
||||||
Event EV_ScriptThread_MapName( "mapname" );
|
Event EV_ScriptThread_MapName( "mapname" );
|
||||||
Event EV_ScriptThread_EndGame( "endgame" );
|
Event EV_ScriptThread_EndGame( "endgame" );
|
||||||
|
Event EV_ScriptThread_CameraCommand( "cam" );
|
||||||
|
|
||||||
// music command
|
// music command
|
||||||
Event EV_ScriptThread_MusicEvent( "music" );
|
Event EV_ScriptThread_MusicEvent( "music" );
|
||||||
|
@ -1351,6 +1358,7 @@ ResponseDef ScriptThread::Responses[] =
|
||||||
{ &EV_AI_RecalcPaths, ( Response )ScriptThread::PassToPathmanager },
|
{ &EV_AI_RecalcPaths, ( Response )ScriptThread::PassToPathmanager },
|
||||||
{ &EV_AI_CalcPath, ( Response )ScriptThread::PassToPathmanager },
|
{ &EV_AI_CalcPath, ( Response )ScriptThread::PassToPathmanager },
|
||||||
{ &EV_AI_DisconnectPath, ( Response )ScriptThread::PassToPathmanager },
|
{ &EV_AI_DisconnectPath, ( Response )ScriptThread::PassToPathmanager },
|
||||||
|
{ &EV_ScriptThread_CameraCommand, ( Response )ScriptThread::CameraCommand },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3866,3 +3874,42 @@ void ScriptThread::EndGame
|
||||||
gi.multicast( NULL, MULTICAST_ALL );
|
gi.multicast( NULL, MULTICAST_ALL );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptThread::CameraCommand
|
||||||
|
(
|
||||||
|
Event * ev
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Event *e;
|
||||||
|
const char *cmd;
|
||||||
|
int i;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if ( !ev->NumArgs() )
|
||||||
|
{
|
||||||
|
ev->Error( "Usage: cam [command] [arg 1]...[arg n]" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd = ev->GetString( 1 );
|
||||||
|
if ( Event::Exists( cmd ) )
|
||||||
|
{
|
||||||
|
e = new Event( cmd );
|
||||||
|
e->SetSource( EV_FROM_SCRIPT );
|
||||||
|
e->SetThread( this );
|
||||||
|
e->SetLineNumber( linenumber );
|
||||||
|
|
||||||
|
n = ev->NumArgs();
|
||||||
|
for( i = 2; i <= n; i++ )
|
||||||
|
{
|
||||||
|
e->AddToken( ev->GetToken( i ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
CameraMan.ProcessEvent( e );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ev->Error( "Unknown camera command '%s'.\n", cmd );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/scriptmaster.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/scriptmaster.h $
|
||||||
// $Revision:: 88 $
|
// $Revision:: 89 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Markd $
|
||||||
// $Date:: 12/16/98 12:42a $
|
// $Date:: 5/19/99 11:30a $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/scriptmaster.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/scriptmaster.h $
|
||||||
//
|
//
|
||||||
|
// 89 5/19/99 11:30a Markd
|
||||||
|
// Added new camera support
|
||||||
|
//
|
||||||
// 88 12/16/98 12:42a Aldie
|
// 88 12/16/98 12:42a Aldie
|
||||||
// Added endgame command for Sin Arcade
|
// Added endgame command for Sin Arcade
|
||||||
//
|
//
|
||||||
|
@ -473,6 +476,7 @@ class EXPORT_FROM_DLL ScriptThread : public Listener
|
||||||
void RemoveClass( Event *ev );
|
void RemoveClass( Event *ev );
|
||||||
void MapName( Event *ev );
|
void MapName( Event *ev );
|
||||||
void EndGame( Event *ev );
|
void EndGame( Event *ev );
|
||||||
|
void CameraCommand( Event *ev );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CLASS_PROTOTYPE( ScriptThread );
|
CLASS_PROTOTYPE( ScriptThread );
|
||||||
|
|
164
sentient.cpp
164
sentient.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/sentient.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/sentient.cpp $
|
||||||
// $Revision:: 189 $
|
// $Revision:: 198 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/17/98 6:56p $
|
// $Date:: 4/16/99 5:00p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,38 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/sentient.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/sentient.cpp $
|
||||||
//
|
//
|
||||||
|
// 198 4/16/99 5:00p Aldie
|
||||||
|
// Added higher rocket jump
|
||||||
|
//
|
||||||
|
// 197 3/26/99 6:26p Aldie
|
||||||
|
// Fixed more CTF bugs, probably the last ones
|
||||||
|
//
|
||||||
|
// 196 3/18/99 6:45p Aldie
|
||||||
|
// Empath shield damage is posted 0 time not FRAMETIME
|
||||||
|
//
|
||||||
|
// 195 3/17/99 4:00p Aldie
|
||||||
|
// CTF Update
|
||||||
|
//
|
||||||
|
// 194 3/12/99 10:19p Aldie
|
||||||
|
// Added MOD_DEATHQUAD
|
||||||
|
//
|
||||||
|
// 193 3/12/99 8:13p Aldie
|
||||||
|
// Moved damage code around
|
||||||
|
//
|
||||||
|
// 192 3/11/99 8:49p Markd
|
||||||
|
// Fixed minor weapon bugs with setting new weapon and new weapon being null
|
||||||
|
// already.
|
||||||
|
//
|
||||||
|
// 191 3/11/99 3:47p Aldie
|
||||||
|
// Added some damage changes
|
||||||
|
//
|
||||||
|
// 190 3/02/99 9:15p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:09p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:39p Aldie
|
||||||
|
//
|
||||||
// 189 11/17/98 6:56p Jimdose
|
// 189 11/17/98 6:56p Jimdose
|
||||||
// made EventGiveHealth clear the damage skin on the player
|
// made EventGiveHealth clear the damage skin on the player
|
||||||
//
|
//
|
||||||
|
@ -618,6 +650,7 @@
|
||||||
#include "inventoryitem.h"
|
#include "inventoryitem.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "actor.h"
|
#include "actor.h"
|
||||||
|
#include "ctf.h"
|
||||||
|
|
||||||
CLASS_DECLARATION( Entity, Sentient, NULL );
|
CLASS_DECLARATION( Entity, Sentient, NULL );
|
||||||
|
|
||||||
|
@ -989,6 +1022,29 @@ Item *Sentient::FindItem
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item *Sentient::HasItemOfSuperclass
|
||||||
|
(
|
||||||
|
const char *superclassname
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
int i;
|
||||||
|
Item *item;
|
||||||
|
|
||||||
|
num = inventory.NumObjects();
|
||||||
|
for( i = 1; i <= num; i++ )
|
||||||
|
{
|
||||||
|
item = ( Item * )G_GetEntity( inventory.ObjectAt( i ) );
|
||||||
|
if ( !Q_stricmp( item->getSuperclass(), superclassname ) )
|
||||||
|
{
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void Sentient::FreeInventory
|
void Sentient::FreeInventory
|
||||||
(
|
(
|
||||||
void
|
void
|
||||||
|
@ -1454,12 +1510,12 @@ void Sentient::DropWeapon
|
||||||
{
|
{
|
||||||
// can't drop it, probably because there's no worldmodel
|
// can't drop it, probably because there's no worldmodel
|
||||||
// since we're dead, just delete the weapon.
|
// since we're dead, just delete the weapon.
|
||||||
delete weapon;
|
weapon->PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete weapon;
|
weapon->PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1488,6 +1544,11 @@ void Sentient::takeWeapon
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( weapon == newWeapon )
|
||||||
|
{
|
||||||
|
newWeapon = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if ( weapon == currentWeapon )
|
if ( weapon == currentWeapon )
|
||||||
{
|
{
|
||||||
SetCurrentWeapon( BestWeapon( weapon ) );
|
SetCurrentWeapon( BestWeapon( weapon ) );
|
||||||
|
@ -1843,9 +1904,22 @@ void Sentient::WeaponPutAway
|
||||||
Event *ev
|
Event *ev
|
||||||
)
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Weapon *best;
|
||||||
|
|
||||||
|
if ( newWeapon )
|
||||||
{
|
{
|
||||||
SetCurrentWeapon( newWeapon );
|
SetCurrentWeapon( newWeapon );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
best = BestWeapon();
|
||||||
|
if ( best )
|
||||||
|
{
|
||||||
|
SetCurrentWeapon( best );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Sentient::WeaponReady
|
void Sentient::WeaponReady
|
||||||
(
|
(
|
||||||
|
@ -2021,9 +2095,11 @@ qboolean Sentient::DoGib
|
||||||
( meansofdeath == MOD_TELEFRAG ) ||
|
( meansofdeath == MOD_TELEFRAG ) ||
|
||||||
( meansofdeath == MOD_MUTANTHANDS ) ||
|
( meansofdeath == MOD_MUTANTHANDS ) ||
|
||||||
( meansofdeath == MOD_HELIGUN ) ||
|
( meansofdeath == MOD_HELIGUN ) ||
|
||||||
|
( meansofdeath == MOD_CTFTURRET ) ||
|
||||||
( meansofdeath == MOD_LAVA ) ||
|
( meansofdeath == MOD_LAVA ) ||
|
||||||
|
( meansofdeath == MOD_SNIPER ) ||
|
||||||
( ( meansofdeath == MOD_FISTS ) && ( inflictor->flags & FL_ADRENALINE ) ) ||
|
( ( meansofdeath == MOD_FISTS ) && ( inflictor->flags & FL_ADRENALINE ) ) ||
|
||||||
( ( meansofdeath == MOD_SHOTGUN ) && ( G_Random() < 0.3 ) )
|
( ( meansofdeath == MOD_SHOTGUN ) && ( G_Random() < 0.5 ) )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -2118,6 +2194,10 @@ void Sentient::ArmorDamage
|
||||||
trinum = ev->GetInteger( 11 );
|
trinum = ev->GetInteger( 11 );
|
||||||
damage_mult = ev->GetFloat ( 12 );
|
damage_mult = ev->GetFloat ( 12 );
|
||||||
|
|
||||||
|
// Make sure attacker is there
|
||||||
|
if ( !attacker )
|
||||||
|
return;
|
||||||
|
|
||||||
// Forcefields make objects invulnerable
|
// Forcefields make objects invulnerable
|
||||||
if ( flags & FL_FORCEFIELD )
|
if ( flags & FL_FORCEFIELD )
|
||||||
{
|
{
|
||||||
|
@ -2159,12 +2239,12 @@ void Sentient::ArmorDamage
|
||||||
|
|
||||||
// if enabled you can't hurt teammates (but you can hurt yourself)
|
// if enabled you can't hurt teammates (but you can hurt yourself)
|
||||||
// knockback still occurs
|
// knockback still occurs
|
||||||
if ( ( attacker != this ) && ( DM_FLAG( DF_MODELTEAMS | DF_SKINTEAMS ) ) )
|
if ( ( attacker != this ) && ( DM_FLAG( DF_MODELTEAMS | DF_SKINTEAMS ) || ctf->value ) )
|
||||||
{
|
{
|
||||||
if ( OnSameTeam ( this, attacker ) )
|
if ( OnSameTeam ( this, attacker ) )
|
||||||
{
|
{
|
||||||
// check for friendly fire
|
// check for friendly fire
|
||||||
if ( DM_FLAG( DF_FRIENDLY_FIRE ) )
|
if ( DM_FLAG( DF_FRIENDLY_FIRE ) || ( dflags & DAMAGE_NO_PROTECTION ) )
|
||||||
meansofdeath = MOD_FRIENDLY_FIRE;
|
meansofdeath = MOD_FRIENDLY_FIRE;
|
||||||
else
|
else
|
||||||
damage = 0;
|
damage = 0;
|
||||||
|
@ -2285,6 +2365,67 @@ void Sentient::ArmorDamage
|
||||||
// Damage multiplier
|
// Damage multiplier
|
||||||
damage *= damage_mult;
|
damage *= damage_mult;
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
// Check to see if the attacker had double
|
||||||
|
if ( attacker->isClient() )
|
||||||
|
{
|
||||||
|
Player *pl_attacker;
|
||||||
|
|
||||||
|
pl_attacker = ( Player * )( Sentient * )attacker;
|
||||||
|
if ( pl_attacker->HasItem( "CTF_Tech_Double" ) ) // DOUBLE
|
||||||
|
damage *= 2;
|
||||||
|
else if ( pl_attacker->HasItem( "CTF_Tech_DeathQuad" ) ) // QUAD
|
||||||
|
damage *= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check to see if the client has the shield or empathy
|
||||||
|
if ( this->isClient() )
|
||||||
|
{
|
||||||
|
Player *pl_defender;
|
||||||
|
Event *ctfev;
|
||||||
|
|
||||||
|
pl_defender = ( Player * )this;
|
||||||
|
|
||||||
|
if ( pl_defender->HasItem( "CTF_Tech_Half" ) && !( dflags & DAMAGE_NO_ARMOR ) )
|
||||||
|
{
|
||||||
|
damage *= 0.3f;
|
||||||
|
|
||||||
|
ctfev = new Event( EV_Player_CTF_SoundEvent );
|
||||||
|
ctfev->AddInteger( DAMAGE );
|
||||||
|
pl_defender->ProcessEvent( ctfev );
|
||||||
|
}
|
||||||
|
else if ( pl_defender->HasItem( "CTF_Tech_Empathy" ) ) // EMPATHY
|
||||||
|
{
|
||||||
|
ctfev = new Event( EV_Player_CTF_SoundEvent );
|
||||||
|
ctfev->AddInteger( DAMAGE );
|
||||||
|
pl_defender->ProcessEvent( ctfev );
|
||||||
|
|
||||||
|
// Send the damage back to the attacker if it is a client
|
||||||
|
if ( ( attacker != this ) && attacker->isClient() )
|
||||||
|
{
|
||||||
|
Event *ev2;
|
||||||
|
|
||||||
|
ev2 = new Event( EV_Damage );
|
||||||
|
ev2->AddInteger( damage );
|
||||||
|
ev2->AddEntity ( this );
|
||||||
|
ev2->AddEntity ( this );
|
||||||
|
ev2->AddVector ( vec_zero );
|
||||||
|
ev2->AddVector ( vec_zero );
|
||||||
|
ev2->AddVector ( vec_zero );
|
||||||
|
ev2->AddInteger( 0 );
|
||||||
|
ev2->AddInteger( DAMAGE_NO_ARMOR );
|
||||||
|
ev2->AddInteger( MOD_EMPATHY );
|
||||||
|
ev2->AddInteger( -1 );
|
||||||
|
ev2->AddInteger( -1 );
|
||||||
|
ev2->AddFloat ( 1 );
|
||||||
|
attacker->PostEvent( ev2, 0 );
|
||||||
|
//attacker->Damage( this, this, damage, vec_zero, vec_zero, vec_zero, 0, DAMAGE_NO_ARMOR, MOD_EMPATHY, -1, -1, 1.0f );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Damage skins if armor didn't absorb all damage
|
// Damage skins if armor didn't absorb all damage
|
||||||
if ( ( damage > 0 ) && ( groupnum != -1 ) && ( flags & FL_BLOOD ) )
|
if ( ( damage > 0 ) && ( groupnum != -1 ) && ( flags & FL_BLOOD ) )
|
||||||
if ( !edict->s.groups[ groupnum ] )
|
if ( !edict->s.groups[ groupnum ] )
|
||||||
|
@ -2402,7 +2543,7 @@ void Sentient::ArmorDamage
|
||||||
|
|
||||||
direction.normalize();
|
direction.normalize();
|
||||||
if ( isClient() && ( attacker == this ) && deathmatch->value )
|
if ( isClient() && ( attacker == this ) && deathmatch->value )
|
||||||
momentum = direction * ( 1700.0f * ( float )knockback / m ); // the rocket jump hack...
|
momentum = direction * ( 2100.0f * ( float )knockback / m ); // the rocket jump hack...
|
||||||
else
|
else
|
||||||
momentum = direction * ( 500.0f * ( float )knockback / m );
|
momentum = direction * ( 500.0f * ( float )knockback / m );
|
||||||
|
|
||||||
|
@ -2425,6 +2566,9 @@ void Sentient::ArmorDamage
|
||||||
// do the damage
|
// do the damage
|
||||||
health -= damage;
|
health -= damage;
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
CTF_CheckHurtCarrier( this, attacker );
|
||||||
|
|
||||||
// He's dead jim, send out a bunch of events
|
// He's dead jim, send out a bunch of events
|
||||||
if ( health <= 0 )
|
if ( health <= 0 )
|
||||||
{
|
{
|
||||||
|
@ -2507,7 +2651,7 @@ void Sentient::ArmorDamage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( meansofdeath == MOD_MUTANT_DRAIN )
|
if ( ( meansofdeath == MOD_MUTANT_DRAIN ) || ( meansofdeath == MOD_DEATHQUAD ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Send pain event
|
// Send pain event
|
||||||
|
|
17
sentient.h
17
sentient.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/sentient.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/sentient.h $
|
||||||
// $Revision:: 70 $
|
// $Revision:: 71 $
|
||||||
// $Author:: Markd $
|
// $Author:: Aldie $
|
||||||
// $Date:: 11/16/98 8:59p $
|
// $Date:: 3/02/99 9:16p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,13 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/sentient.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/sentient.h $
|
||||||
//
|
//
|
||||||
|
// 71 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:09p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:39p Aldie
|
||||||
|
//
|
||||||
// 70 11/16/98 8:59p Markd
|
// 70 11/16/98 8:59p Markd
|
||||||
// Added TakeItem event to header
|
// Added TakeItem event to header
|
||||||
//
|
//
|
||||||
|
@ -308,6 +315,7 @@ class EXPORT_FROM_DLL Sentient : public Entity
|
||||||
// Weapon charging stuff
|
// Weapon charging stuff
|
||||||
float firedowntime;
|
float firedowntime;
|
||||||
qboolean firedown;
|
qboolean firedown;
|
||||||
|
qboolean usedown;
|
||||||
|
|
||||||
str saveskin;
|
str saveskin;
|
||||||
str savemodel;
|
str savemodel;
|
||||||
|
@ -373,6 +381,9 @@ class EXPORT_FROM_DLL Sentient : public Entity
|
||||||
virtual qboolean DoGib( int meansofdeath, Entity *inflictor );
|
virtual qboolean DoGib( int meansofdeath, Entity *inflictor );
|
||||||
virtual void SetDropWeapon( Event *ev );
|
virtual void SetDropWeapon( Event *ev );
|
||||||
virtual void DropWeaponNowEvent( Event *ev );
|
virtual void DropWeaponNowEvent( Event *ev );
|
||||||
|
|
||||||
|
// CTF
|
||||||
|
virtual Item *HasItemOfSuperclass( const char *superclassname );
|
||||||
};
|
};
|
||||||
|
|
||||||
inline EXPORT_FROM_DLL void Sentient::setModel
|
inline EXPORT_FROM_DLL void Sentient::setModel
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/sniperrifle.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/sniperrifle.cpp $
|
||||||
// $Revision:: 26 $
|
// $Revision:: 28 $
|
||||||
// $Author:: Markd $
|
// $Author:: Jimdose $
|
||||||
// $Date:: 11/13/98 3:30p $
|
// $Date:: 3/12/99 8:15p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,16 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/sniperrifle.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/sniperrifle.cpp $
|
||||||
//
|
//
|
||||||
|
// 28 3/12/99 8:15p Jimdose
|
||||||
|
// made weapons fire 1/10th of a second sooner on clients
|
||||||
|
//
|
||||||
|
// 27 3/02/99 9:15p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:09p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:39p Aldie
|
||||||
|
//
|
||||||
// 26 11/13/98 3:30p Markd
|
// 26 11/13/98 3:30p Markd
|
||||||
// put in more precaching on weapons
|
// put in more precaching on weapons
|
||||||
//
|
//
|
||||||
|
@ -123,6 +133,18 @@ SniperRifle::SniperRifle()
|
||||||
SetType( WEAPON_2HANDED_HI );
|
SetType( WEAPON_2HANDED_HI );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CTF - Fire upon release of the weapon
|
||||||
|
void SniperRifle::ReleaseFire
|
||||||
|
(
|
||||||
|
float holdfiretime
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
StopAnimating();
|
||||||
|
RandomAnimate( "releasefire", EV_Weapon_DoneFiring );
|
||||||
|
last_animation_time = ( level.framenum + 1 ) * FRAMETIME;
|
||||||
|
}
|
||||||
|
|
||||||
void SniperRifle::Shoot
|
void SniperRifle::Shoot
|
||||||
(
|
(
|
||||||
Event *ev
|
Event *ev
|
||||||
|
@ -135,10 +157,19 @@ void SniperRifle::Shoot
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( deathmatch->value )
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
// CTF - kill the target
|
||||||
|
FireBullets( 1, vec_zero, 10000, 10000, DAMAGE_BULLET|DAMAGE_NO_ARMOR, MOD_SNIPER, false );
|
||||||
|
}
|
||||||
|
else if ( deathmatch->value )
|
||||||
|
{
|
||||||
FireBullets( 1, vec_zero, 105, 135, DAMAGE_BULLET|DAMAGE_NO_ARMOR, MOD_SNIPER, false );
|
FireBullets( 1, vec_zero, 105, 135, DAMAGE_BULLET|DAMAGE_NO_ARMOR, MOD_SNIPER, false );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
FireBullets( 1, vec_zero, 105, 135, DAMAGE_BULLET, MOD_SNIPER, false );
|
FireBullets( 1, vec_zero, 105, 135, DAMAGE_BULLET, MOD_SNIPER, false );
|
||||||
|
}
|
||||||
|
|
||||||
NextAttack( 1.5 );
|
NextAttack( 1.5 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/sniperrifle.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/sniperrifle.h $
|
||||||
// $Revision:: 10 $
|
// $Revision:: 11 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Aldie $
|
||||||
// $Date:: 10/05/98 10:42p $
|
// $Date:: 3/02/99 9:16p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,13 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/sniperrifle.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/sniperrifle.h $
|
||||||
//
|
//
|
||||||
|
// 11 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:09p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:39p Aldie
|
||||||
|
//
|
||||||
// 10 10/05/98 10:42p Aldie
|
// 10 10/05/98 10:42p Aldie
|
||||||
// Converted over to new silencer methods
|
// Converted over to new silencer methods
|
||||||
//
|
//
|
||||||
|
@ -63,6 +70,7 @@ class EXPORT_FROM_DLL SniperRifle : public BulletWeapon
|
||||||
virtual void SecondaryUse(Event *ev);
|
virtual void SecondaryUse(Event *ev);
|
||||||
virtual void DoneLowering(Event *ev);
|
virtual void DoneLowering(Event *ev);
|
||||||
virtual qboolean AutoChange( void );
|
virtual qboolean AutoChange( void );
|
||||||
|
virtual void ReleaseFire( float time );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* sniperrifle.h */
|
#endif /* sniperrifle.h */
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/spidermine.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/spidermine.cpp $
|
||||||
// $Revision:: 49 $
|
// $Revision:: 50 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 11/18/98 1:27a $
|
// $Date:: 6/07/99 2:29p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/spidermine.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/spidermine.cpp $
|
||||||
//
|
//
|
||||||
|
// 50 6/07/99 2:29p Markd
|
||||||
|
// fixed null pointer bug
|
||||||
|
//
|
||||||
// 49 11/18/98 1:27a Jimdose
|
// 49 11/18/98 1:27a Jimdose
|
||||||
// Fixed sliding and orientation issues with gravaxis
|
// Fixed sliding and orientation issues with gravaxis
|
||||||
//
|
//
|
||||||
|
@ -724,6 +727,11 @@ void Detonator::CycleCamera
|
||||||
currentMine++;
|
currentMine++;
|
||||||
|
|
||||||
mine = mineList.ObjectAt( ( currentMine % numMines ) + 1 );
|
mine = mineList.ObjectAt( ( currentMine % numMines ) + 1 );
|
||||||
|
if ( !mine )
|
||||||
|
{
|
||||||
|
mineList.RemoveObjectAt( ( currentMine % numMines ) + 1 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
client = ( Player * )( Entity * ) owner;
|
client = ( Player * )( Entity * ) owner;
|
||||||
if ( client->edict->areanum == mine->edict->areanum )
|
if ( client->edict->areanum == mine->edict->areanum )
|
||||||
|
|
62
thrall.cpp
62
thrall.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/thrall.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/thrall.cpp $
|
||||||
// $Revision:: 12 $
|
// $Revision:: 18 $
|
||||||
// $Author:: Aldie $
|
// $Author:: Jimdose $
|
||||||
// $Date:: 11/09/98 12:58a $
|
// $Date:: 8/03/99 7:09p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
// Copyright (C) 1998 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,24 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/thrall.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/thrall.cpp $
|
||||||
//
|
//
|
||||||
|
// 18 8/03/99 7:09p Jimdose
|
||||||
|
// changes for Sin Arcade
|
||||||
|
//
|
||||||
|
// 17 3/19/99 7:44p Aldie
|
||||||
|
// Put thrallball back
|
||||||
|
//
|
||||||
|
// 16 3/16/99 11:51a Aldie
|
||||||
|
// Fix for ctf network bandwidth
|
||||||
|
//
|
||||||
|
// 15 3/11/99 3:47p Aldie
|
||||||
|
// Added meansofdeath
|
||||||
|
//
|
||||||
|
// 14 3/05/99 5:48p Aldie
|
||||||
|
// Added MOD_THRALLBALL
|
||||||
|
//
|
||||||
|
// 13 3/02/99 9:15p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
// 12 11/09/98 12:58a Aldie
|
// 12 11/09/98 12:58a Aldie
|
||||||
// Parentmode for death sequence
|
// Parentmode for death sequence
|
||||||
//
|
//
|
||||||
|
@ -346,6 +364,17 @@ void ThrallMaster::GibFest
|
||||||
Vector pos;
|
Vector pos;
|
||||||
Gib *gib1, *gib2;
|
Gib *gib1, *gib2;
|
||||||
|
|
||||||
|
#ifdef SIN_ARCADE
|
||||||
|
//HACK to make game over only be sent once.
|
||||||
|
if ( max_health != 0 )
|
||||||
|
{
|
||||||
|
max_health = 0;
|
||||||
|
gi.WriteByte( svc_stufftext );
|
||||||
|
gi.WriteString( "gameover" );
|
||||||
|
gi.multicast( NULL, MULTICAST_ALL );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( sv_gibs->value && !parentmode->value )
|
if ( sv_gibs->value && !parentmode->value )
|
||||||
{
|
{
|
||||||
GetBone( "chest", &pos, NULL, NULL, NULL );
|
GetBone( "chest", &pos, NULL, NULL, NULL );
|
||||||
|
@ -510,7 +539,7 @@ EXPORT_FROM_DLL void DrunkMissile::Explode
|
||||||
|
|
||||||
damg = 40 + ( int )G_Random( 20 );
|
damg = 40 + ( int )G_Random( 20 );
|
||||||
|
|
||||||
other->Damage( this, owner, damg, worldorigin, velocity, level.impact_trace.plane.normal, 200, 0, MOD_ROCKET, -1, -1, 1.0f );
|
other->Damage( this, owner, damg, worldorigin, velocity, level.impact_trace.plane.normal, 200, 0, MOD_ROCKETSPLASH, -1, -1, 1.0f );
|
||||||
|
|
||||||
SpawnBlastDamage( &level.impact_trace, damg, owner );
|
SpawnBlastDamage( &level.impact_trace, damg, owner );
|
||||||
|
|
||||||
|
@ -824,9 +853,12 @@ EXPORT_FROM_DLL void ThrallPulse::Explode
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
damg = 150;
|
||||||
|
else
|
||||||
damg = 160 + ( int )G_Random( 50 );
|
damg = 160 + ( int )G_Random( 50 );
|
||||||
|
|
||||||
other->Damage( this, owner, damg, worldorigin, velocity, level.impact_trace.plane.normal, 320, 0, MOD_ROCKET, -1, -1, 1.0f );
|
other->Damage( this, owner, damg, worldorigin, velocity, level.impact_trace.plane.normal, 320, 0, MOD_THRALLBALL, -1, -1, 1.0f );
|
||||||
|
|
||||||
SpawnBlastDamage( &level.impact_trace, damg, owner );
|
SpawnBlastDamage( &level.impact_trace, damg, owner );
|
||||||
|
|
||||||
|
@ -836,16 +868,33 @@ EXPORT_FROM_DLL void ThrallPulse::Explode
|
||||||
// don't do radius damage to the other, because all the damage
|
// don't do radius damage to the other, because all the damage
|
||||||
// was done in the impact
|
// was done in the impact
|
||||||
v = worldorigin - v * 36;
|
v = worldorigin - v * 36;
|
||||||
CreateExplosion( v, damg, 0.7f, true, this, owner, other );
|
CreateExplosion( v, damg, 0.7f, true, this, owner, other, MOD_THRALLSPLASH );
|
||||||
PostEvent( EV_Remove, 0.1 );
|
PostEvent( EV_Remove, 0.1 );
|
||||||
FlashPlayers( v, 1, 1, 1, 0.5, 768 );
|
FlashPlayers( v, 1, 1, 1, 0.5, 768 );
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
Entity *stuff;
|
||||||
|
|
||||||
|
stuff = new Entity;
|
||||||
|
stuff->setModel( "ctfpulse.def" );
|
||||||
|
stuff->setOrigin( origin );
|
||||||
|
stuff->showModel();
|
||||||
|
stuff->worldorigin.copyTo( stuff->edict->s.old_origin );
|
||||||
|
stuff->RandomAnimate( "explode", NULL );
|
||||||
|
stuff->PostEvent( EV_Remove, FRAMETIME*2 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
for( i = 1; i < 4; i++ )
|
for( i = 1; i < 4; i++ )
|
||||||
{
|
{
|
||||||
debris = new ThrallPulseDebris;
|
debris = new ThrallPulseDebris;
|
||||||
debris->Setup( owner, v, i );
|
debris->Setup( owner, v, i );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EXPORT_FROM_DLL void ThrallPulse::Setup
|
EXPORT_FROM_DLL void ThrallPulse::Setup
|
||||||
(
|
(
|
||||||
|
@ -876,6 +925,7 @@ EXPORT_FROM_DLL void ThrallPulse::Setup
|
||||||
velocity = Vector( orientation[ 0 ] ) * 1400.0f;
|
velocity = Vector( orientation[ 0 ] ) * 1400.0f;
|
||||||
|
|
||||||
setModel( "sprites/thrallpulse.spr" );
|
setModel( "sprites/thrallpulse.spr" );
|
||||||
|
|
||||||
setSize( "-8 -8 -8", "8 8 8" );
|
setSize( "-8 -8 -8", "8 8 8" );
|
||||||
takedamage = DAMAGE_NO;
|
takedamage = DAMAGE_NO;
|
||||||
setOrigin( pos );
|
setOrigin( pos );
|
||||||
|
|
10
trigger.h
10
trigger.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/trigger.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/trigger.h $
|
||||||
// $Revision:: 46 $
|
// $Revision:: 47 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 12/10/98 1:45p $
|
// $Date:: 3/02/99 9:16p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,9 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/trigger.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/trigger.h $
|
||||||
//
|
//
|
||||||
|
// 47 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
// 46 12/10/98 1:45p Jimdose
|
// 46 12/10/98 1:45p Jimdose
|
||||||
// added TriggerBox
|
// added TriggerBox
|
||||||
//
|
//
|
||||||
|
@ -209,6 +212,7 @@ class EXPORT_FROM_DLL Trigger : public Entity
|
||||||
void EventSetKey( Event *ev );
|
void EventSetKey( Event *ev );
|
||||||
|
|
||||||
void EventSetMessage( Event *ev );
|
void EventSetMessage( Event *ev );
|
||||||
|
void SetTriggerTime( float t ){ trigger_time = t; }
|
||||||
void SetMessage( const char *message );
|
void SetMessage( const char *message );
|
||||||
str &Message( void );
|
str &Message( void );
|
||||||
|
|
||||||
|
|
108
vehicle.cpp
108
vehicle.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/vehicle.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/vehicle.cpp $
|
||||||
// $Revision:: 51 $
|
// $Revision:: 56 $
|
||||||
// $Author:: Markd $
|
// $Author:: Aldie $
|
||||||
// $Date:: 2/19/99 7:49p $
|
// $Date:: 3/17/99 4:00p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,21 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/vehicle.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/vehicle.cpp $
|
||||||
//
|
//
|
||||||
|
// 56 3/17/99 4:00p Aldie
|
||||||
|
// CTF Update
|
||||||
|
//
|
||||||
|
// 55 3/11/99 9:24p Markd
|
||||||
|
// don't let alternate gravaxis people enter vehicle
|
||||||
|
//
|
||||||
|
// 54 3/05/99 6:36p Markd
|
||||||
|
// Fixed Tire issues
|
||||||
|
//
|
||||||
|
// 53 3/05/99 5:51p Markd
|
||||||
|
// made vehicles respawn in CTF, fixed up turrets a bit more
|
||||||
|
//
|
||||||
|
// 52 2/26/99 5:53p Markd
|
||||||
|
// fixed some stuff for turrets
|
||||||
|
//
|
||||||
// 51 2/19/99 7:49p Markd
|
// 51 2/19/99 7:49p Markd
|
||||||
// implemented turret for CTF
|
// implemented turret for CTF
|
||||||
//
|
//
|
||||||
|
@ -176,6 +191,7 @@
|
||||||
#include "explosion.h"
|
#include "explosion.h"
|
||||||
#include "earthquake.h"
|
#include "earthquake.h"
|
||||||
#include "gibs.h"
|
#include "gibs.h"
|
||||||
|
#include "item.h"
|
||||||
|
|
||||||
Event EV_Vehicle_Start( "start" );
|
Event EV_Vehicle_Start( "start" );
|
||||||
Event EV_Vehicle_Enter( "enter" );
|
Event EV_Vehicle_Enter( "enter" );
|
||||||
|
@ -293,7 +309,7 @@ Vehicle::Vehicle()
|
||||||
health = G_GetFloatArg( "health", 1000 );
|
health = G_GetFloatArg( "health", 1000 );
|
||||||
speed = G_GetFloatArg( "speed", 600 );
|
speed = G_GetFloatArg( "speed", 600 );
|
||||||
maxturnrate = G_GetFloatArg( "maxturnrate", 40.0f );
|
maxturnrate = G_GetFloatArg( "maxturnrate", 40.0f );
|
||||||
PostEvent( EV_Vehicle_Start, 0 );
|
PostEvent( EV_Vehicle_Start, 0.2f );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::VehicleStart
|
void Vehicle::VehicleStart
|
||||||
|
@ -389,6 +405,7 @@ void Vehicle::VehicleStart
|
||||||
}
|
}
|
||||||
last_origin = worldorigin;
|
last_origin = worldorigin;
|
||||||
setSize( drivemins, drivemaxs );
|
setSize( drivemins, drivemaxs );
|
||||||
|
startorigin = worldorigin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::Drivable
|
void Vehicle::Drivable
|
||||||
|
@ -651,6 +668,11 @@ void Vehicle::DriverUse
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( other->gravaxis != gravaxis )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sent = ( Sentient * )other;
|
sent = ( Sentient * )other;
|
||||||
if ( driver )
|
if ( driver )
|
||||||
{
|
{
|
||||||
|
@ -698,6 +720,15 @@ void Vehicle::DriverUse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we are in CTF choose a place by default
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
pos = worldorigin;
|
||||||
|
pos[ 2 ] += 192;
|
||||||
|
driver->setOrigin( pos );
|
||||||
|
goto foundpos;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foundpos:
|
foundpos:
|
||||||
|
@ -775,8 +806,6 @@ qboolean Vehicle::Drive
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
Vector i, j, k;
|
|
||||||
|
|
||||||
if ( !driver || !driver->isClient() )
|
if ( !driver || !driver->isClient() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -799,8 +828,14 @@ qboolean Vehicle::Drive
|
||||||
if ( ( jumpimpulse < 0 ) || ( !jumpable ) )
|
if ( ( jumpimpulse < 0 ) || ( !jumpable ) )
|
||||||
jumpimpulse = 0;
|
jumpimpulse = 0;
|
||||||
|
|
||||||
|
buttons = ucmd->buttons;
|
||||||
|
|
||||||
turnimpulse += 2*angledist( SHORT2ANGLE( ucmd->angles[ 1 ] ) - driver->client->resp.cmd_angles[ 1 ] );
|
turnimpulse += 2*angledist( SHORT2ANGLE( ucmd->angles[ 1 ] ) - driver->client->resp.cmd_angles[ 1 ] );
|
||||||
|
|
||||||
|
cmd_angles.x = 2*angledist( SHORT2ANGLE( ucmd->angles[ 0 ] ) - driver->client->resp.cmd_angles[ 0 ] );
|
||||||
|
cmd_angles.y = 2*angledist( SHORT2ANGLE( ucmd->angles[ 1 ] ) - driver->client->resp.cmd_angles[ 1 ] );
|
||||||
|
cmd_angles.z = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1128,7 +1163,7 @@ float Vehicle::SetDriverPitch
|
||||||
float pitch
|
float pitch
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return pitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1138,6 +1173,7 @@ ResponseDef DrivableVehicle::Responses[] =
|
||||||
{
|
{
|
||||||
{ &EV_Damage, ( Response )Entity::DamageEvent },
|
{ &EV_Damage, ( Response )Entity::DamageEvent },
|
||||||
{ &EV_Killed, ( Response )DrivableVehicle::Killed },
|
{ &EV_Killed, ( Response )DrivableVehicle::Killed },
|
||||||
|
{ &EV_Item_Respawn, ( Response )DrivableVehicle::Respawn },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1145,6 +1181,8 @@ DrivableVehicle::DrivableVehicle()
|
||||||
{
|
{
|
||||||
drivable = true;
|
drivable = true;
|
||||||
flags |= FL_SPARKS|FL_DIE_TESSELATE|FL_DIE_EXPLODE|FL_DARKEN;
|
flags |= FL_SPARKS|FL_DIE_TESSELATE|FL_DIE_EXPLODE|FL_DARKEN;
|
||||||
|
if ( ctf->value )
|
||||||
|
respawntime = G_GetFloatArg( "respawntime", 60 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrivableVehicle::Killed(Event *ev)
|
void DrivableVehicle::Killed(Event *ev)
|
||||||
|
@ -1202,7 +1240,7 @@ void DrivableVehicle::Killed(Event *ev)
|
||||||
|
|
||||||
if (flags & FL_DIE_EXPLODE)
|
if (flags & FL_DIE_EXPLODE)
|
||||||
{
|
{
|
||||||
CreateExplosion( worldorigin, 150*edict->s.scale, edict->s.scale * 2, true, this, this, this );
|
CreateExplosion( centroid, 150*edict->s.scale, edict->s.scale * 2, true, this, this, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & FL_DIE_GIBS)
|
if (flags & FL_DIE_GIBS)
|
||||||
|
@ -1215,12 +1253,25 @@ void DrivableVehicle::Killed(Event *ev)
|
||||||
//
|
//
|
||||||
// kill all my wheels
|
// kill all my wheels
|
||||||
//
|
//
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
last = this;
|
||||||
|
while( last->vlink )
|
||||||
|
{
|
||||||
|
last->vlink->hideModel();
|
||||||
|
last = last->vlink;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
last = this;
|
last = this;
|
||||||
while( last->vlink )
|
while( last->vlink )
|
||||||
{
|
{
|
||||||
last->vlink->PostEvent( EV_Remove, 0 );
|
last->vlink->PostEvent( EV_Remove, 0 );
|
||||||
last = last->vlink;
|
last = last->vlink;
|
||||||
}
|
}
|
||||||
|
vlink = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1268,5 +1319,46 @@ void DrivableVehicle::Killed(Event *ev)
|
||||||
while ( 1 );
|
while ( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ctf->value )
|
||||||
|
{
|
||||||
|
hideModel();
|
||||||
|
// cancel events of type remove
|
||||||
|
CancelEventsOfType( EV_Remove );
|
||||||
|
PostEvent( EV_Item_Respawn, respawntime );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
PostEvent( EV_Remove, 0 );
|
PostEvent( EV_Remove, 0 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrivableVehicle::Respawn
|
||||||
|
(
|
||||||
|
Event *ev
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VehicleBase *last;
|
||||||
|
|
||||||
|
health = max_health;
|
||||||
|
edict->s.lightofs = 0;
|
||||||
|
|
||||||
|
showModel();
|
||||||
|
|
||||||
|
last = this;
|
||||||
|
while( last->vlink )
|
||||||
|
{
|
||||||
|
last->vlink->showModel();
|
||||||
|
last = last->vlink;
|
||||||
|
}
|
||||||
|
|
||||||
|
// allow it to be touched again
|
||||||
|
setSolidType( SOLID_BBOX );
|
||||||
|
takedamage = DAMAGE_YES;
|
||||||
|
|
||||||
|
// play respawn sound
|
||||||
|
RandomGlobalSound( "snd_itemspawn" );
|
||||||
|
|
||||||
|
setOrigin( startorigin );
|
||||||
|
KillBox( this );
|
||||||
|
Postthink();
|
||||||
|
};
|
||||||
|
|
17
vehicle.h
17
vehicle.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/vehicle.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/vehicle.h $
|
||||||
// $Revision:: 29 $
|
// $Revision:: 31 $
|
||||||
// $Author:: Markd $
|
// $Author:: Markd $
|
||||||
// $Date:: 2/19/99 7:49p $
|
// $Date:: 3/05/99 5:51p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,12 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/vehicle.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/vehicle.h $
|
||||||
//
|
//
|
||||||
|
// 31 3/05/99 5:51p Markd
|
||||||
|
// made vehicles respawn in CTF, fixed up turrets a bit more
|
||||||
|
//
|
||||||
|
// 30 2/26/99 5:54p Markd
|
||||||
|
// Fixed some stuff for turrets
|
||||||
|
//
|
||||||
// 29 2/19/99 7:49p Markd
|
// 29 2/19/99 7:49p Markd
|
||||||
// implemented turret for CTF
|
// implemented turret for CTF
|
||||||
//
|
//
|
||||||
|
@ -185,6 +191,8 @@ class EXPORT_FROM_DLL Vehicle : public VehicleBase
|
||||||
float speed;
|
float speed;
|
||||||
float conesize;
|
float conesize;
|
||||||
float maxtracedist;
|
float maxtracedist;
|
||||||
|
int buttons;
|
||||||
|
Vector cmd_angles;
|
||||||
str weaponName;
|
str weaponName;
|
||||||
str driveranim;
|
str driveranim;
|
||||||
Vector last_origin;
|
Vector last_origin;
|
||||||
|
@ -200,6 +208,9 @@ class EXPORT_FROM_DLL Vehicle : public VehicleBase
|
||||||
qboolean steerinplace;
|
qboolean steerinplace;
|
||||||
qboolean jumpable;
|
qboolean jumpable;
|
||||||
|
|
||||||
|
// CTF only stuff
|
||||||
|
Vector startorigin;
|
||||||
|
|
||||||
virtual void WorldEffects( void );
|
virtual void WorldEffects( void );
|
||||||
virtual void CheckWater( void );
|
virtual void CheckWater( void );
|
||||||
virtual void DriverUse( Event *ev );
|
virtual void DriverUse( Event *ev );
|
||||||
|
@ -316,12 +327,14 @@ inline EXPORT_FROM_DLL void Vehicle::Unarchive
|
||||||
class EXPORT_FROM_DLL DrivableVehicle : public Vehicle
|
class EXPORT_FROM_DLL DrivableVehicle : public Vehicle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
float respawntime;
|
||||||
|
|
||||||
CLASS_PROTOTYPE( DrivableVehicle );
|
CLASS_PROTOTYPE( DrivableVehicle );
|
||||||
|
|
||||||
DrivableVehicle();
|
DrivableVehicle();
|
||||||
|
|
||||||
virtual void Killed( Event *ev );
|
virtual void Killed( Event *ev );
|
||||||
|
virtual void Respawn( Event *ev );
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef EXPORT_TEMPLATE
|
#ifdef EXPORT_TEMPLATE
|
||||||
|
|
87
weapon.cpp
87
weapon.cpp
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/weapon.cpp $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/weapon.cpp $
|
||||||
// $Revision:: 143 $
|
// $Revision:: 147 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Markd $
|
||||||
// $Date:: 12/16/98 5:43p $
|
// $Date:: 7/24/99 5:45p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,22 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/weapon.cpp $
|
// $Log:: /Quake 2 Engine/Sin/code/game/weapon.cpp $
|
||||||
//
|
//
|
||||||
|
// 147 7/24/99 5:45p Markd
|
||||||
|
// Added No Weapon Change Deathmatch bug
|
||||||
|
//
|
||||||
|
// 146 4/16/99 5:01p Aldie
|
||||||
|
// Added takeallammo
|
||||||
|
//
|
||||||
|
// 145 3/12/99 7:49p Jimdose
|
||||||
|
// made weapons fire 1/10th of a second sooner on clients
|
||||||
|
//
|
||||||
|
// 144 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:09p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:40p Aldie
|
||||||
|
//
|
||||||
// 143 12/16/98 5:43p Jimdose
|
// 143 12/16/98 5:43p Jimdose
|
||||||
// infiniterockets no longer gives infinite mines
|
// infiniterockets no longer gives infinite mines
|
||||||
//
|
//
|
||||||
|
@ -489,6 +505,8 @@
|
||||||
#include "sentient.h"
|
#include "sentient.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "specialfx.h"
|
#include "specialfx.h"
|
||||||
|
#include "chaingun.h"
|
||||||
|
#include "assaultrifle.h"
|
||||||
|
|
||||||
#ifdef SIN_ARCADE
|
#ifdef SIN_ARCADE
|
||||||
static ScriptVariablePtr sv_infinitebullets;
|
static ScriptVariablePtr sv_infinitebullets;
|
||||||
|
@ -600,6 +618,9 @@ Weapon::Weapon()
|
||||||
|
|
||||||
// default action_level_increment
|
// default action_level_increment
|
||||||
action_level_increment = 2;
|
action_level_increment = 2;
|
||||||
|
|
||||||
|
// default weapons don't have alt fire
|
||||||
|
alternate_fire = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Weapon::~Weapon()
|
Weapon::~Weapon()
|
||||||
|
@ -1026,6 +1047,27 @@ void Weapon::SetOwner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Weapon::TakeAllAmmo
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
Ammo *ammo;
|
||||||
|
|
||||||
|
if ( owner )
|
||||||
|
{
|
||||||
|
if ( ammotype.length() )
|
||||||
|
{
|
||||||
|
ammo = ( Ammo * )owner->FindItem( ammotype.c_str() );
|
||||||
|
if ( ammo )
|
||||||
|
{
|
||||||
|
owner->takeItem( ammotype.c_str(), ammo->Amount() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Weapon::AmmoAvailable
|
int Weapon::AmmoAvailable
|
||||||
(
|
(
|
||||||
void
|
void
|
||||||
|
@ -1456,13 +1498,14 @@ qboolean Weapon::Drop
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Weapon::Fire
|
void Weapon::Fire
|
||||||
(
|
(
|
||||||
void
|
void
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
qboolean skipframefix;
|
||||||
|
|
||||||
if ( !ReadyToFire() )
|
if ( !ReadyToFire() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1485,6 +1528,13 @@ void Weapon::Fire
|
||||||
// this is just a precaution that we can re-trigger
|
// this is just a precaution that we can re-trigger
|
||||||
NextAttack( 5 );
|
NextAttack( 5 );
|
||||||
|
|
||||||
|
skipframefix = false;
|
||||||
|
if ( owner && owner->isClient() && !isSubclassOf( ChainGun ) && !isSubclassOf( AssaultRifle ) )
|
||||||
|
{
|
||||||
|
skipframefix = true;
|
||||||
|
StopAnimating();
|
||||||
|
}
|
||||||
|
|
||||||
if ( dualmode )
|
if ( dualmode )
|
||||||
{
|
{
|
||||||
if ( weaponmode == PRIMARY )
|
if ( weaponmode == PRIMARY )
|
||||||
|
@ -1504,6 +1554,11 @@ void Weapon::Fire
|
||||||
RandomAnimate( "fire", EV_Weapon_DoneFiring );
|
RandomAnimate( "fire", EV_Weapon_DoneFiring );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( skipframefix )
|
||||||
|
{
|
||||||
|
last_animation_time = ( level.framenum + 1 ) * FRAMETIME;
|
||||||
|
}
|
||||||
|
|
||||||
last_attack_time = level.time;
|
last_attack_time = level.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1648,11 +1703,14 @@ void Weapon::PickupWeapon
|
||||||
// Sentient should probably handle this when itempickup is called
|
// Sentient should probably handle this when itempickup is called
|
||||||
// Check if we should switch his weapon
|
// Check if we should switch his weapon
|
||||||
current = sen->CurrentWeapon();
|
current = sen->CurrentWeapon();
|
||||||
|
if ( !DM_FLAG( DF_NO_WEAPON_CHANGE ) )
|
||||||
|
{
|
||||||
if ( !hasweapon && current && ( current != weapon ) && ( current->AutoChange() ) &&
|
if ( !hasweapon && current && ( current != weapon ) && ( current->AutoChange() ) &&
|
||||||
( ( current->Rank() < weapon->Rank() ) || ( !current->HasAmmo() && weapon->HasAmmo() ) ) )
|
( ( current->Rank() < weapon->Rank() ) || ( !current->HasAmmo() && weapon->HasAmmo() ) ) )
|
||||||
{
|
{
|
||||||
sen->ChangeWeapon( weapon );
|
sen->ChangeWeapon( weapon );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if we should give him ammo
|
// check if we should give him ammo
|
||||||
if ( giveammo )
|
if ( giveammo )
|
||||||
|
@ -2335,3 +2393,24 @@ void Weapon::PutAwayAndRaise
|
||||||
|
|
||||||
RandomAnimate( "putaway", EV_Weapon_Raise );
|
RandomAnimate( "putaway", EV_Weapon_Raise );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Weapon::SetPrimaryMode
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
weaponmode = PRIMARY;
|
||||||
|
ammotype = primary_ammo_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Weapon::SetSecondaryMode
|
||||||
|
(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
|
||||||
|
{
|
||||||
|
weaponmode = SECONDARY;
|
||||||
|
ammotype = secondary_ammo_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
26
weapon.h
26
weapon.h
|
@ -1,9 +1,9 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Quake 2 Engine/Sin/code/game/weapon.h $
|
// $Logfile:: /Quake 2 Engine/Sin/code/game/weapon.h $
|
||||||
// $Revision:: 67 $
|
// $Revision:: 69 $
|
||||||
// $Author:: Jimdose $
|
// $Author:: Aldie $
|
||||||
// $Date:: 12/10/98 1:46p $
|
// $Date:: 4/16/99 5:03p $
|
||||||
//
|
//
|
||||||
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
// Copyright (C) 1997 by Ritual Entertainment, Inc.
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
@ -13,6 +13,16 @@
|
||||||
//
|
//
|
||||||
// $Log:: /Quake 2 Engine/Sin/code/game/weapon.h $
|
// $Log:: /Quake 2 Engine/Sin/code/game/weapon.h $
|
||||||
//
|
//
|
||||||
|
// 69 4/16/99 5:03p Aldie
|
||||||
|
// Added TakeAllAmmo
|
||||||
|
//
|
||||||
|
// 68 3/02/99 9:16p Aldie
|
||||||
|
// Added CTF game code
|
||||||
|
//
|
||||||
|
// 2 2/16/99 4:09p Aldie
|
||||||
|
//
|
||||||
|
// 1 2/11/99 1:40p Aldie
|
||||||
|
//
|
||||||
// 67 12/10/98 1:46p Jimdose
|
// 67 12/10/98 1:46p Jimdose
|
||||||
// Added UnlimitedAmmo
|
// Added UnlimitedAmmo
|
||||||
//
|
//
|
||||||
|
@ -315,6 +325,9 @@ class EXPORT_FROM_DLL Weapon : public Item
|
||||||
int aimanim;
|
int aimanim;
|
||||||
int aimframe;
|
int aimframe;
|
||||||
|
|
||||||
|
// CTF
|
||||||
|
qboolean alternate_fire;
|
||||||
|
|
||||||
void SetMaxRangeEvent( Event *ev );
|
void SetMaxRangeEvent( Event *ev );
|
||||||
void SetMinRangeEvent( Event *ev );
|
void SetMinRangeEvent( Event *ev );
|
||||||
void SetProjectileSpeedEvent( Event *ev );
|
void SetProjectileSpeedEvent( Event *ev );
|
||||||
|
@ -337,6 +350,7 @@ class EXPORT_FROM_DLL Weapon : public Item
|
||||||
virtual void SetAimAnim( Event *ev );
|
virtual void SetAimAnim( Event *ev );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CLASS_PROTOTYPE( Weapon );
|
CLASS_PROTOTYPE( Weapon );
|
||||||
|
|
||||||
Weapon();
|
Weapon();
|
||||||
|
@ -420,6 +434,12 @@ class EXPORT_FROM_DLL Weapon : public Item
|
||||||
|
|
||||||
virtual void Archive( Archiver &arc );
|
virtual void Archive( Archiver &arc );
|
||||||
virtual void Unarchive( Archiver &arc );
|
virtual void Unarchive( Archiver &arc );
|
||||||
|
|
||||||
|
// CTF
|
||||||
|
void SetPrimaryMode( void );
|
||||||
|
void SetSecondaryMode( void );
|
||||||
|
virtual void TakeAllAmmo( void );
|
||||||
|
qboolean AlternateFire( void ) { return alternate_fire; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue