as released 1999-03-20

This commit is contained in:
archive 1999-03-20 00:00:00 +00:00
parent 09e039d47e
commit f436045631
21 changed files with 2733 additions and 501 deletions

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/actor.cpp $
// $Revision:: 230 $
// $Revision:: 233 $
// $Author:: Markd $
// $Date:: 11/16/98 8:50p $
// $Date:: 2/08/99 5:12p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,15 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/actor.cpp $
//
// 233 2/08/99 5:12p Markd
// fixed 2015 actor problem
//
// 232 1/29/99 6:14p Jimdose
// added 2015 changes
//
// 231 1/27/99 10:02p Markd
// Merged 2015 source into main code base
//
// 230 11/16/98 8:50p Markd
// increased chat times
//
@ -808,6 +817,10 @@ ResponseDef ActorState::Responses[] =
cvar_t *ai_actorscript;
// used below for a slight movement tweak
// added as a global here to prevent constant re-allocation
const Vector movetweak = "0 0 2";
#define TURN_SPEED 30
CLASS_DECLARATION( Sentient, Actor, "monster_generic" );
@ -2883,6 +2896,12 @@ void Actor::SetStateEvent
name.c_str(), response.c_str() );
#endif
// check the existance of the actor's thread to prevent a crash
if ( !actorthread )
{
return;
}
actorthread->Mark( &marker );
if ( response != "" && actorthread->Goto( response.c_str() ) )
{
@ -5219,7 +5238,7 @@ void Actor::Accelerate
)
{
//### activate this to limit turnrate
// activate this to limit turnrate
#if 0
if ( steering.y > turnspeed )
steering.y = turnspeed;
@ -5452,7 +5471,20 @@ stepmoveresult_t Actor::TryMove
if ( trace.startsolid )
{
neworg[ 2 ] -= STEPSIZE;
#if 0
trace = G_Trace( neworg, mins, maxs, end, this, edict->clipmask, "Actor::TryMove 2" );
#else
// 2015 - The following line altered to allow short actors to detect doors,
// It doesn't seem to break anything else...
if ( maxs[ 2 ] > ( STEPSIZE * 3 ) )
{
trace = G_Trace( neworg, mins, maxs, end, this, edict->clipmask, "Actor::TryMove 2" );
}
else
{
trace = G_Trace( neworg + movetweak, mins, maxs - movetweak, end, this, edict->clipmask, "Actor::TryMove 2" );
}
#endif
if ( trace.allsolid || trace.startsolid )
{
ent = trace.ent->entity;

21
actor.h
View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/actor.h $
// $Revision:: 89 $
// $Author:: Markd $
// $Date:: 11/09/98 6:23p $
// $Revision:: 90 $
// $Author:: Jimdose $
// $Date:: 1/29/99 7:02p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,9 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/actor.h $
//
// 90 1/29/99 7:02p Jimdose
// added 2015 changes
//
// 89 11/09/98 6:23p Markd
// Added turnspeed event
//
@ -1312,8 +1315,16 @@ class EXPORT_FROM_DLL FindEnemyMovement : public StandardMovement
if ( self )
{
node->reject = !self->CanShootFrom( node->worldorigin, self->currentEnemy, false );
return !node->reject;
if ( self->currentEnemy )
{
node->reject = !self->CanShootFrom( node->worldorigin, self->currentEnemy, false );
}
else
{
node->reject = false;
}
return !node->reject;
}
return false;

View file

@ -1,182 +0,0 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/arcade_comm.cpp $
// $Revision:: 4 $
// $Author:: Aldie $
// $Date:: 12/14/98 8:16p $
//
// 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 $
//
// 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 "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.
gi.error( (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 = gi.cvar( "disablecom", "0", 0 );
if ( disable_com->value )
return;
comport = gi.cvar( "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 )
{
gi.error( "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

View file

@ -1,26 +0,0 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/arcade_comm.h $
// $Revision:: 2 $
// $Author:: Aldie $
// $Date:: 12/14/98 5:55p $
//
// 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 $
//
// 2 12/14/98 5:55p Aldie
// First version of arcade communications
//
// DESCRIPTION:
// Arcade Communications Functions
#include "g_local.h"
void ARCADE_SetupCommunications( void );
void ARCADE_CloseCommunications( void );
qboolean ARCADE_ComWriteByte( byte b );

View file

@ -1,208 +0,0 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf_player.cpp $
// $Revision:: 4 $
// $Author:: Markd $
// $Date:: 10/10/98 12: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/ctf_player.cpp $
//
// 4 10/10/98 12:38p Markd
// Fixed a misnamed function
//
// 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
//
#include "g_local.h"
#include "ctf_player.h"
extern Event EV_Player_Respawn;
CLASS_DECLARATION( Player, CTF_Player, "player" );
ResponseDef CTF_Player::Responses[] =
{
{ &EV_ClientMove, ( Response )CTF_Player::ClientThink },
{ &EV_Player_Respawn, ( Response )CTF_Player::Respawn },
{ &EV_Killed, ( Response )CTF_Player::Killed },
{ &EV_GotKill, ( Response )CTF_Player::GotKill },
{ &EV_ClientEndFrame, ( Response )CTF_Player::EndFrame },
{ NULL, NULL }
};
CTF_Player::CTF_Player()
{
}
void CTF_Player::Init
(
void
)
{
Player::Init();
}
CTF_Player::~CTF_Player()
{
}
void CTF_Player::Respawn
(
Event *ev
)
{
Player::Respawn( ev );
}
const char *CTF_Player::TeamName
(
void
)
{
switch ( team )
{
case CTF_TEAM1:
return "RED";
case CTF_TEAM2:
return "BLUE";
}
return "UKNOWN";
}
const char *CTF_Player::OtherTeamName
(
void
)
{
switch ( team )
{
case CTF_TEAM1:
return "BLUE";
case CTF_TEAM2:
return "RED";
}
return "UKNOWN";
}
int CTF_Player::Team
(
void
)
{
return team;
}
int CTF_Player::OtherTeam
(
void
)
{
switch ( team )
{
case CTF_TEAM1:
return CTF_TEAM2;
case CTF_TEAM2:
return CTF_TEAM1;
}
// invalid value
return -1;
}
void CTF_Player::Killed
(
Event *ev
)
{
Player::Killed( ev );
}
void CTF_Player::Prethink
(
void
)
{
Player::Prethink();
}
void CTF_Player::Postthink
(
void
)
{
Player::Postthink();
}
void CTF_Player::ClientThink
(
Event *ev
)
{
Player::ClientThink( ev );
}
void CTF_Player::UpdateStats
(
void
)
{
Player::UpdateStats();
}
void CTF_Player::EndFrame
(
Event *ev
)
{
Player::EndFrame( ev );
}
void CTF_Player::GotKill
(
Event *ev
)
{
Player::GotKill( ev );
}

121
ctf_turret.cpp Normal file
View file

@ -0,0 +1,121 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf_turret.cpp $
// $Revision:: 2 $
// $Author:: Markd $
// $Date:: 2/19/99 7:49p $
//
// Copyright (C) 1997 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/ctf_turret.cpp $
//
// 2 2/19/99 7:49p Markd
// implemented turret for CTF
//
// 1 2/19/99 6:03p Markd
//
// DESCRIPTION:
// CTF turret, usable turret
//
#include "g_local.h"
#include "vehicle.h"
#include "ctf_turret.h"
#include "heligun.h"
CLASS_DECLARATION( Vehicle, CTFTurret, "ctf_turret" );
ResponseDef CTFTurret::Responses[] =
{
{ &EV_Use, ( Response )CTFTurret::DriverUse },
{ NULL, NULL }
};
CTFTurret::CTFTurret()
{
takedamage = DAMAGE_YES;
setModel( "ctf_turret.def" );
setOrigin( origin - Vector( "0 0 30") );
}
void CTFTurret::DriverUse
(
Event *ev
)
{
Entity * old_driver;
old_driver = driver;
Vehicle::DriverUse( ev );
if ( old_driver != driver )
{
if ( driver )
{
hideModel();
}
else
{
showModel();
}
}
}
#define MAX_PITCH 45
float CTFTurret::SetDriverPitch
(
float pitch
)
{
if ( pitch > 180 )
{
if ( pitch < 360 - MAX_PITCH )
{
pitch = 360 - MAX_PITCH;
}
}
else
{
if ( pitch > MAX_PITCH )
{
pitch = MAX_PITCH;
}
if ( pitch < -MAX_PITCH )
{
pitch = -MAX_PITCH;
}
}
return pitch;
}
CLASS_DECLARATION( HeliGun, CTFTurretGun, "ctf_weapon_turretgun" );
ResponseDef CTFTurretGun::Responses[] =
{
{ NULL, NULL }
};
CTFTurretGun::CTFTurretGun
(
)
{
SetModels( "ctf_turretgun.def", "view_ctf_turretgun.def" );
}
void CTFTurretGun::Shoot
(
Event *ev
)
{
FireBullets( 1, "20 20 20", 16, 28, DAMAGE_BULLET, MOD_HELIGUN, false );
NextAttack( 0 );
}

64
ctf_turret.h Normal file
View file

@ -0,0 +1,64 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/ctf_turret.h $
// $Revision:: 2 $
// $Author:: Markd $
// $Date:: 2/19/99 7:49p $
//
// Copyright (C) 1997 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// $Log:: /Quake 2 Engine/Sin/code/game/ctf_turret.h $
//
// 2 2/19/99 7:49p Markd
// implemented turret for CTF
//
// 1 2/19/99 6:03p Markd
//
// 8 10/06/98 10:52p Aldie
// Moved bubble trail to client
//
// 7 9/21/98 4:50p Markd
// Fixed projectile owner
//
// 6 8/29/98 5:27p Markd
// added specialfx, replaced misc with specialfx where appropriate
//
// 5 4/04/98 6:12p Jimdose
// Created file
//
// DESCRIPTION:
// Fires a spear. Used by Seabonites.
//
#ifndef __CTF_TURRET_H__
#define __CTF_TURRET_H__
#include "g_local.h"
#include "vehicle.h"
#include "heligun.h"
class EXPORT_FROM_DLL CTFTurret : public Vehicle
{
public:
CLASS_PROTOTYPE( CTFTurret );
CTFTurret ();
virtual void DriverUse( Event *ev );
virtual float SetDriverPitch( float pitch );
};
class EXPORT_FROM_DLL CTFTurretGun : public HeliGun
{
public:
CLASS_PROTOTYPE( CTFTurretGun );
CTFTurretGun();
virtual void Shoot( Event *ev );
};
#endif /* ctfturret.h */

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_main.cpp $
// $Revision:: 168 $
// $Author:: Aldie $
// $Date:: 12/08/98 7:04p $
// $Revision:: 170 $
// $Author:: Jimdose $
// $Date:: 2/16/99 8:37p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,13 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/g_main.cpp $
//
// 170 2/16/99 8:37p Jimdose
// moved sin arcade comm stuff to client
// made dmflags, timelimit, and fraglimit archived under SIN_ARCADE
//
// 169 1/22/99 8:00p Jimdose
// added "showvar" command for inspecting script variables
//
// 168 12/08/98 7:04p Aldie
// Added setup and shutdown calls to comm for arcade
//
@ -575,10 +582,6 @@
#include "gravpath.h"
#include "deadbody.h"
#ifdef SIN_ARCADE
#include "arcade_comm.h"
#endif
Vector vec_origin = "0 0 0";
Vector vec_zero = "0 0 0";
@ -751,9 +754,6 @@ void G_ShutdownGame
G_LevelShutdown();
gi.FreeTags (TAG_GAME);
#ifdef SIN_ARCADE
ARCADE_CloseCommunications();
#endif
}
/*
@ -830,9 +830,15 @@ void G_InitGame
// change anytime vars
password = gi.cvar ("password", "", CVAR_USERINFO);
filterban = gi.cvar ("filterban", "1", 0);
#ifdef SIN_ARCADE
dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO|CVAR_ARCHIVE);
fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO|CVAR_ARCHIVE);
timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO|CVAR_ARCHIVE);
#else
dmflags = gi.cvar ("dmflags", "0", CVAR_SERVERINFO);
fraglimit = gi.cvar ("fraglimit", "0", CVAR_SERVERINFO);
timelimit = gi.cvar ("timelimit", "0", CVAR_SERVERINFO);
#endif
g_select_empty = gi.cvar ("g_select_empty", "0", CVAR_ARCHIVE);
g_unlimited_ammo = gi.cvar ("g_unlimited_ammo", "0", CVAR_SERVERINFO);
g_showmem = gi.cvar ("g_showmem", "0", 0 );
@ -896,9 +902,6 @@ void G_InitGame
game.maxconsoles = maxconsoles->value;
game.maxsurfaces = maxsurfaces->value;
G_AllocGameData();
#ifdef SIN_ARCADE
ARCADE_SetupCommunications();
#endif
}
void G_AllocGameData
@ -2486,6 +2489,21 @@ void ClientCommand
}
return;
}
else if ( !Q_strcasecmp( cmd, "showvar" ) )
{
ScriptVariable *var;
var = Director.GetExistingVariable( gi.argv( 1 ) );
if ( var )
{
gi.cprintf( ent, PRINT_HIGH, "%s = '%s'\n", gi.argv( 1 ), var->stringValue() );
}
else
{
gi.cprintf( ent, PRINT_HIGH, "Variable '%s' does not exist.\n", gi.argv( 1 ) );
}
return;
}
}
found = false;

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/g_spawn.cpp $
// $Revision:: 66 $
// $Revision:: 68 $
// $Author:: Jimdose $
// $Date:: 11/07/98 10:01p $
// $Date:: 1/29/99 6:14p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,13 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/g_spawn.cpp $
//
// 68 1/29/99 6:14p Jimdose
// fixed savegame bug
//
// 67 1/22/99 8:01p Jimdose
// G_SoawnEntities no longer calls G_LevelStart when loading a savegame. This
// fixes the Darwin tubes bug in Area57.
//
// 66 11/07/98 10:01p Jimdose
// added G_GetClassFromArgs
//
@ -1637,7 +1644,11 @@ void G_SpawnEntities
gi.dprintf ("%i entities inhibited\n", inhibit);
G_InitSpawnArguments();
G_LevelStart();
if ( !LoadingServer || game.autosaved )
{
G_LevelStart();
}
}
/*

1996
game.dsp

File diff suppressed because it is too large Load diff

11
game.h
View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/game.h $
// $Revision:: 51 $
// $Author:: Jimdose $
// $Date:: 12/18/98 11:05p $
// $Revision:: 52 $
// $Author:: Markd $
// $Date:: 1/27/99 10:02p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,9 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/game.h $
//
// 52 1/27/99 10:02p Markd
// Merged 2015 source into main code base
//
// 51 12/18/98 11:05p Jimdose
// added definitions of server side stuff to get rid of qcommon.h includes
//
@ -188,6 +191,8 @@ extern "C" {
#define SVF_HIDEOWNER 0x00000040 // hide the owner of the client
#define SVF_MONSTERCLIP 0x00000080 // treat as CONTENTS_MONSTERCLIP for collision
#define SVF_PLAYERCLIP 0x00000100 // treat as CONTENTS_PLAYERCLIP for collision
// 2015 code
#define SVF_NOTOWNER 0x00000200 // don't draw for owner
// edict->solid values

262
grapple.cpp Normal file
View file

@ -0,0 +1,262 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/grapple.cpp $
// $Revision:: 1 $
// $Author:: Aldie $
// $Date:: 2/17/99 8:03p $
//
// 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.cpp $
//
// 1 2/17/99 8:03p 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
#include "g_local.h"
#include "grapple.h"
#include "player.h"
#include "ctf.h"
CLASS_DECLARATION( Projectile, Hook, NULL );
Event EV_Grapple_PullPlayer( "pullplayer" );
ResponseDef Hook::Responses[] =
{
{ &EV_Touch, (Response)Hook::Touch },
{ NULL, NULL }
};
EXPORT_FROM_DLL void Hook::Touch
(
Event *ev
)
{
int damg;
Vector v;
Entity *other;
Entity *owner;
Player *player;
other = ev->GetEntity( 1 );
assert( other );
if ( other->entnum == this->owner )
{
return;
}
stopsound( CHAN_VOICE );
setSolidType( SOLID_NOT );
if ( HitSky() || other->isSubclassOf( Teleporter ) )
{
PostEvent( EV_Remove, 0 );
return;
}
damg = 10;
owner = G_GetEntity( this->owner );
if ( !owner )
owner = world;
if (other->takedamage)
{
other->Damage( this, owner, damg, worldorigin, velocity, level.impact_trace.plane.normal, 200, 0, MOD_ROCKET, -1, -1, 1.0f );
PostEvent( EV_Remove, 0.1 );
return;
}
// Hit a solid wall
if ( owner->isClient() )
{
setMoveType( MOVETYPE_NONE );
player = (Player *)( Entity * )owner;
player->SetGrapplePull( worldorigin, CTF_GRAPPLE_PULL_SPEED );
RandomAnimate( "hooked", NULL );
// Don't remove the hook, once it's implanted in a wall
CancelEventsOfType( EV_Remove );
}
else
{
PostEvent( EV_Remove, 0.1 );
}
}
EXPORT_FROM_DLL void Hook::Setup
(
Entity *owner,
Vector pos,
Vector dir
)
{
Event *ev;
this->owner = owner->entnum;
edict->owner = owner->edict;
setMoveType( MOVETYPE_FLYMISSILE );
setSolidType( SOLID_BBOX );
edict->clipmask = MASK_PROJECTILE;
angles = dir.toAngles();
angles[ PITCH ] = - angles[ PITCH ];
setAngles( angles );
velocity = dir * CTF_GRAPPLE_SPEED;
// set duration
ev = new Event( EV_Remove );
ev->AddEntity( world );
PostEvent( ev, 10 );
takedamage = DAMAGE_NO;
setModel( "hook.def" );
gravity = 0;
setSize( "-1 -1 -1", "1 1 1" );
setOrigin( pos );
worldorigin.copyTo(edict->s.old_origin);
}
#if 0
CLASS_DECLARATION( Weapon, Grapple, "weapon_grapple" );
Event EV_Grapple_UpdateBeam( "grapple_updatebeam" );
ResponseDef Grapple::Responses[] =
{
{ &EV_Grapple_UpdateBeam, ( Response )Grapple::UpdateBeam },
{ &EV_Weapon_Shoot, ( Response )Grapple::Shoot },
{ NULL, NULL }
};
Grapple::Grapple()
{
SetModels( "grapple.def", "view_grapple.def" );
SetRank( 0, 0 );
SetType( WEAPON_2HANDED_LO );
}
Grapple::~Grapple()
{
// Kill the beam
CancelEventsOfType( EV_Grapple_UpdateBeam );
if ( beam )
beam->PostEvent( EV_Remove, 0 );
}
qboolean Grapple::HasAmmo
(
void
)
{
return true;
}
void Grapple::ReleaseFire
(
float holdfiretime
)
{
//Client released the fire button, kill the hook
if ( hook )
{
hook->ProcessEvent( EV_Remove );
}
if ( owner->isClient() )
{
Player *player;
player = ( Player * )( Sentient *)owner;
player->ClearGrapplePull();
}
if ( beam )
{
beam->PostEvent( EV_Remove, 0 );
}
NextAttack( 0.1 );
CancelEventsOfType( EV_Grapple_UpdateBeam );
ProcessEvent( EV_Weapon_DoneFiring );
}
void Grapple::UpdateBeam
(
Event *ev
)
{
Vector pos, dir;
if ( !hook )
{
beam->ProcessEvent( EV_Remove );
return;
}
if ( beam )
{
GetMuzzlePosition( &pos, &dir );
beam->setBeam( pos, hook->worldorigin, 2, 1, 1, 1, 1, 0 );
PostEvent( EV_Grapple_UpdateBeam, FRAMETIME );
}
}
void Grapple::Shoot
(
Event *ev
)
{
Vector pos;
Vector dir;
assert( owner );
if ( !owner )
{
return;
}
// Check to see if hook is out, don't fire another one
if ( hook )
{
return;
}
GetMuzzlePosition( &pos, &dir );
hook = new Hook;
hook->Setup( owner, pos, dir );
beam = new Beam;
beam->setBeam( pos, hook->worldorigin, 2, 1, 1, 1, 1, 0 );
PostEvent( EV_Grapple_UpdateBeam, 0.1 );
}
#endif

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/player.cpp $
// $Revision:: 419 $
// $Revision:: 422 $
// $Author:: Jimdose $
// $Date:: 12/18/98 11:03p $
// $Date:: 2/16/99 8:38p $
//
// Copyright (C) 1997 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,15 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/player.cpp $
//
// 422 2/16/99 8:38p Jimdose
// moved sin arcade comm stuff to client
//
// 421 1/29/99 6:14p Jimdose
// added 2015 changes
//
// 420 1/27/99 5:15p Jimdose
// Fixed no weapon bug in arcade mode deathmatch
//
// 419 12/18/98 11:03p Jimdose
// removed include of qcommon.h
//
@ -1370,10 +1379,6 @@
#include "actor.h"
#include <windows.h>
#ifdef SIN_ARCADE
#include "arcade_comm.h"
#endif
const Vector power_color( 0.0, 1.0, 0.0 );
const Vector acolor( 1.0, 1.0, 1.0 );
const Vector bcolor( 1.0, 0.0, 0.0 );
@ -1627,7 +1632,7 @@ void Player::Init
InitWeapons();
InitSkin();
// don't call RestoeEnt when respawning on a training level
// don't call RestoreEnt when respawning on a training level
if ( !LoadingServer && ( deathmatch->value || ( level.training && ( respawn_time != -1 ) ) ||
!PersistantData.RestoreEnt( this ) ) )
{
@ -2156,7 +2161,12 @@ void Player::Respawn
{
assert ( deadflag == DEAD_DEAD );
#ifndef SIN_ARCADE
#ifdef SIN_ARCADE
if ( deathmatch->value )
{
FreeInventory();
}
#else
FreeInventory();
#endif
@ -2599,8 +2609,9 @@ void Player::Dead
}
#ifdef SIN_ARCADE
if ( !ARCADE_ComWriteByte( 0x03 ) )
gi.error( "Could not send lost player life to communications port" );
gi.WriteByte( svc_stufftext );
gi.WriteString( "playerdead" );
gi.unicast( edict, true );
#endif
}
@ -2692,6 +2703,12 @@ void Player::Killed
aname = prefix + str("death");
}
// moved to before the deadflag being set to prevent a definate game crash
if ( flags & ( FL_MUTANT|FL_SP_MUTANT ) )
{
Human( NULL );
}
deadflag = DEAD_DYING;
respawn_time = level.time + 1.0;
@ -2735,7 +2752,6 @@ void Player::Killed
if ( flags & ( FL_MUTANT|FL_SP_MUTANT ) )
{
Human( NULL );
ev1 = new Event( EV_Gib );
ev1->AddInteger( 0 );
ProcessEvent( ev1 );
@ -6052,7 +6068,6 @@ EXPORT_FROM_DLL void Player::UpdateStats
)
{
Ammo *ammo;
Armor *armor;
int i;
@ -6067,9 +6082,14 @@ EXPORT_FROM_DLL void Player::UpdateStats
client->ps.stats[ STAT_AMMO ] = 0;
}
// not used, so don't set to save net bandwidth
#if 0
// All ammo types
for( i = 0; i < NUM_AMMO_TYPES; i++ )
{
Ammo *ammo;
assert( ammo_types[ i ] );
ammo = ( Ammo * )FindItem( ammo_types[ i ] );
if ( ammo )
@ -6081,6 +6101,7 @@ EXPORT_FROM_DLL void Player::UpdateStats
client->ps.stats[ STAT_AMMO_BASE + i ] = 0;
}
}
#endif
//
// Armor

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/q_shared.c $
// $Revision:: 30 $
// $Author:: Jimdose $
// $Date:: 10/05/98 12:28a $
// $Revision:: 31 $
// $Author:: Markd $
// $Date:: 1/26/99 5:45p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,9 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/q_shared.c $
//
// 31 1/26/99 5:45p Markd
// Added TransformFromTriangle for 2015
//
// 30 10/05/98 12:28a Jimdose
// Added angledist
//
@ -103,6 +106,8 @@
// DESCRIPTION:
//
#define SIN
#include "q_shared.h"
#include "float.h"
@ -1074,6 +1079,7 @@ void TransformFromTriangle( const float tri[3][3], float trans[3][3], vec3_t pos
VectorCopy( forward, trans[0] );
VectorCopy( right, trans[1] );
VectorCopy( up, trans[2] );
/*
switch( (type>>2)&0x3 )
{
@ -1163,6 +1169,36 @@ void TransformFromTriangle( const float tri[3][3], float trans[3][3], vec3_t pos
*/
}
// 2015 code
void TransformFromTriangle_2015(const float tri[3][3], float trans[3][3], vec3_t pos)
{
vec3_t edge[2];
vec3_t cross;
vec3_t other;
vec3_t forward, right, up;
OriginFromTriangle( tri, pos );
VectorSubtract( tri[2], tri[0], edge[0] );
VectorSubtract( tri[1], tri[0], edge[1] );
VectorNormalize( edge[0] );
VectorNormalize( edge[1] );
CrossProduct( edge[1], edge[0], cross );
VectorNormalize( cross ); //
CrossProduct( edge[1], cross, other );
VectorNormalize( other ); //
VectorCopy( cross, forward );
VectorCopy( other, right );
// VectorNegate( edge[1], up );
VectorCopy( edge[1], up );
VectorCopy( forward, trans[0] );
VectorCopy( right, trans[1] );
VectorCopy( up, trans[2] );
}
static char musicmoods[ mood_totalnumber ][ 16 ] =
{
"none",

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/q_shared.h $
// $Revision:: 187 $
// $Author:: Jimdose $
// $Date:: 11/14/98 8:07p $
// $Revision:: 189 $
// $Author:: Markd $
// $Date:: 1/27/99 10:02p $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,12 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/q_shared.h $
//
// 189 1/27/99 10:02p Markd
// Merged 2015 source into main code base
//
// 188 1/26/99 5:46p Markd
// Added bone flags, new particle types and TransformFromTriangle for 2015
//
// 187 11/14/98 8:07p Jimdose
// added DF_NO_DROP_WEAPONS
//
@ -1284,7 +1290,14 @@ typedef enum
// no acceleration or turning
PM_DEAD,
PM_GIB, // different bounding box
#ifdef SIN
PM_FREEZE,
PM_MOVECAPTURED, // using a movement capturer
PM_ONBIKE, // added for hoverbike
PM_ATTACHVIEW // added for guided missile
#else
PM_FREEZE
#endif
} pmtype_t;
// pmove->pm_flags
@ -1308,6 +1321,9 @@ typedef enum
#define CROUCH_EYE_HEIGHT 30
#define STAND_HEIGHT 72
#define STAND_EYE_HEIGHT 66
// 2015 code
#define HOVERBIKE_HEIGHT 32
#define HOVERBIKE_EYE_HEIGHT 24
#endif
// this structure needs to be communicated bit-accurate
@ -1364,6 +1380,10 @@ extern const gravityaxis_t gravity_axis[ GRAVITY_NUM_AXIS ];
//
#define BUTTON_ATTACK 1
#define BUTTON_USE 2
#ifdef SIN
// 2015 code
#define BUTTON_JUMP 4 // for detecting when the player is jumping
#endif
#define BUTTON_ANY 128 // any key whatsoever
@ -1458,6 +1478,19 @@ typedef struct
#define EF_NOFOOTSTEPS (1<<13) // don't play footsteps on model
#define EF_EFFECTS_32 (1<<15) // reserved for net transmission
#define EF_WARM (1<<14) // used to signify something that should be
// light up by therm-optic goggles
#define EF_HOVER (1<<16) // hovering effect for the hoverbike
#define EF_HOVERTHRUST (1<<17) // engine thrust hoverbike effect
#define EF_HOVERTURBO (1<<18) // turbo thrust hoverbike effect
#define EF_VIEWMODEL (1<<19) // entity is a secondary view model
#define EF_ANIMEROCKET (1<<20) // added effect for anime rockets
#define EF_FLAMES (1<<21) // added flame trail effect
#define EF_DEATHFLAMES (1<<22) // added flame trail effect
#define EF_PLASMATRAIL1 (1<<23) // trail effect for plasma bow
#define EF_PLASMATRAIL2 (1<<24) // secondary trail effect for plasma bow
#define EF_NUKETRAIL (1<<25) // particle effect for a flying nuke ball
#define EF_FORCEBASELINE EF_CROUCH // used to make sure we create a baseline for entities that wouldn't be processed
// ordinarily.
@ -1512,12 +1545,22 @@ typedef struct
#define MDL_GROUP_MASKED 0x4000
#define MDL_GROUP_TWOSIDED 0x8000
// 2015 code
#define BONE_ORIGIN 0xfff
#define BONE_2015ATTACH 0x800
#endif
#ifdef SIN
// Particle flags
#define PARTICLE_RANDOM (1<<0)
#define PARTICLE_OVERBRIGHT (1<<1)
// 2015 code
#define PARTICLE_ADDITIVE (1<<2) // draws the particle additively
#define PARTICLE_FIRE (1<<3) // draws it as a fire particle
#define PARTICLE_HITSOLID (1<<4) // collision detect solid objects
#define PARTICLE_HITENTS (1<<5) // collision detect entities
#define PARTICLE_HITREMOVE (1<<6) // remove the particle when it hits something
#endif
// entity_state_t->renderfx flags
@ -1795,7 +1838,20 @@ typedef enum
TE_TELEPORT_EFFECT,
TE_BULLET_SPRAY,
TE_SCALED_EXPLOSION,
TE_PULSE_EXPLOSION
TE_PULSE_EXPLOSION,
// 2015 code
TE_FLAMETHROWER, // flames for the flamethrower
TE_FLAMETHROWERROW, // row of flames for the flamethrower
TE_FLAMETHROWERHIT, // hit flames for the flamethrower
TE_FLAME, // a puff or row of flames (multipurpose)
TE_NUKE_EXPLOSION, // fire explosion entity for the nuke
TE_BOW_EXPLOSION, // explosion entity for the bow
TE_HOVERBOOSTER, // vertical booster effect for the hoverbike
TE_SIZED_PARTICLES,
TE_RANDOM_SIZED_PARTICLES,
TE_PARTICLES_FULL,
TE_RANDOM_PARTICLES_FULL,
TE_TRACER // bullet tracer
#endif
} temp_event_t;
@ -1934,6 +1990,11 @@ typedef enum
#define STAT_SELECTED_NAME 30
#define STAT_EXITSIGN 31 // cleared each frame
// 2015 code
#define STAT_LASTLAP 12 // this is set to the client's last lap time * 10
#define STAT_CURRENTLAP 13 // this is set to the client's current lap time * 10
#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 P_SHIELDS 1
#define P_ADRENALINE 2
@ -1967,6 +2028,9 @@ typedef enum
#ifdef SIN
#define NUM_AMMO_TYPES 8
// 2015 code
// added new ammo types
#define NUM_2015_AMMO_TYPES 4 // number of additional 2015 ammo types
#define STAT_AMMO_BASE (STAT_AMMO_BULLET357)
#define NUM_ARMOR_TYPES 3
#define STAT_ARMOR_BASE (STAT_ARMOR_HEAD)
@ -2003,6 +2067,17 @@ typedef enum
#define DF_INFINITE_AMMO (1<<14)
#define DF_FIXED_FOV (1<<15)
#define DF_NO_DROP_WEAPONS (1<<16)
// 2015 code
#define DF_BBOX_BULLETS (1<<17)
#define DF_AUTO_INFORMER (1<<18)
#define DF_INFORMER_LOCK (1<<19)
#define DF_MIDNIGHT (1<<20) // wasn't able to get implimented
#define DF_FLASHLIGHT (1<<21)
#define DF_FLASHLIGHTON (1<<22)
#define DF_GOGGLES (1<<23)
#define DF_GOGGLESON (1<<24)
#else
// dmflags->value flags
@ -2056,7 +2131,12 @@ typedef enum
#define CS_ITEMS (CS_LIGHTS+MAX_LIGHTSTYLES)
#define CS_PLAYERSKINS (CS_ITEMS+MAX_ITEMS)
#define CS_SOUNDTRACK (CS_PLAYERSKINS+MAX_CLIENTS)
#define MAX_CONFIGSTRINGS (CS_SOUNDTRACK + 1)
// 2015 code
#define CS_CHECKPOINTS (CS_SOUNDTRACK + 1)
#define CS_BIKESKINS (CS_CHECKPOINTS + 1)
#define MAX_CONFIGSTRINGS (CS_BIKESKINS + MAX_CLIENTS) // # of config strings with 2015 stuff
#define MAX_NORMCONFIGSTRINGS (CS_SOUNDTRACK + 1) // # of config strings in original Sin
#else
@ -2399,6 +2479,13 @@ TransformFromTriangle
=================
*/
void TransformFromTriangle( const float tri[3][3], float trans[3][3], vec3_t pos );
// 2015 code
/*
=================
TransformFromTriangle_2015
=================
*/
void TransformFromTriangle_2015(const float tri[3][3], float trans[3][3], vec3_t pos);
/*
=================
OriginFromTriangle

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/scriptmaster.cpp $
// $Revision:: 155 $
// $Revision:: 156 $
// $Author:: Jimdose $
// $Date:: 12/18/98 11:03p $
// $Date:: 2/16/99 8:38p $
//
// Copyright (C) 1997 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,9 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/scriptmaster.cpp $
//
// 156 2/16/99 8:38p Jimdose
// moved sin arcade comm stuff to client
//
// 155 12/18/98 11:03p Jimdose
// removed include of qcommon.h
//
@ -533,9 +536,6 @@
#include "specialfx.h"
#include "worldspawn.h"
#include "player.h"
#ifdef SIN_ARCADE
#include "arcade_comm.h"
#endif
ScriptVariableList gameVars;
ScriptVariableList levelVars;
@ -3861,7 +3861,8 @@ void ScriptThread::EndGame
{
#ifdef SIN_ARCADE
if ( !ARCADE_ComWriteByte( 0x06 ) )
gi.error( "Could not send end of game to communications port" );
gi.WriteByte( svc_stufftext );
gi.WriteString( "gameover" );
gi.multicast( NULL, MULTICAST_ALL );
#endif
}

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/vehicle.cpp $
// $Revision:: 50 $
// $Author:: Jimdose $
// $Date:: 11/16/98 8:26p $
// $Revision:: 51 $
// $Author:: Markd $
// $Date:: 2/19/99 7:49p $
//
// Copyright (C) 1997 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,9 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/vehicle.cpp $
//
// 51 2/19/99 7:49p Markd
// implemented turret for CTF
//
// 50 11/16/98 8:26p Jimdose
// made vehicles check for water and lava
//
@ -1120,6 +1123,14 @@ void Vehicle::SetTurnRate
maxturnrate = ev->GetFloat( 1 );
}
float Vehicle::SetDriverPitch
(
float pitch
)
{
return 0;
}
CLASS_DECLARATION( Vehicle, DrivableVehicle, "script_drivablevehicle" );

View file

@ -1,9 +1,9 @@
//-----------------------------------------------------------------------------
//
// $Logfile:: /Quake 2 Engine/Sin/code/game/vehicle.h $
// $Revision:: 28 $
// $Author:: Jimdose $
// $Date:: 11/16/98 8:26p $
// $Revision:: 29 $
// $Author:: Markd $
// $Date:: 2/19/99 7:49p $
//
// Copyright (C) 1997 by Ritual Entertainment, Inc.
// All rights reserved.
@ -13,6 +13,9 @@
//
// $Log:: /Quake 2 Engine/Sin/code/game/vehicle.h $
//
// 29 2/19/99 7:49p Markd
// implemented turret for CTF
//
// 28 11/16/98 8:26p Jimdose
// made vehicles check for water and lava
//
@ -232,6 +235,7 @@ class EXPORT_FROM_DLL Vehicle : public VehicleBase
virtual qboolean IsDrivable( void );
virtual void Archive( Archiver &arc );
virtual void Unarchive( Archiver &arc );
virtual float SetDriverPitch( float pitch );
};
inline EXPORT_FROM_DLL void Vehicle::Archive