//-----------------------------------------------------------------------------
//
//  $Logfile:: /game/PlayerStart.cpp                                          $
// $Revision:: 2                                                              $
//   $Author:: Burgermac                                                      $
//     $Date:: 12/27/00 7:29 PM                                               $
//
// 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.
//
// DESCRIPTION:
// Player start location entity declarations
//

#include "g_local.h"
#include "entity.h"
#include "trigger.h"
#include "playerstart.h"

/*****************************************************************************/
/*SINED info_player_start (1 0 0) (-16 -16 0) (16 16 64)

   The normal starting point for a level.

 *****************************************************************************/

CLASS_DECLARATION( Entity, PlayerStart, "info_player_start" );

ResponseDef PlayerStart::Responses[] =
{
	{ NULL, NULL }
};

PlayerStart::PlayerStart()
{
	float angle;

	angle = G_GetFloatArg( "angle", 0 );
	angles = Vector( 0, angle, 0 );
}

/*****************************************************************************/
/*SINED info_player_progressivestart (1 0 0) (-16 -16 0) (16 16 64)

   Starting point for a level.  When triggered, sets next spawnpoint to itself.
   Used for respawn point in Sin Arcade.  This must have a targetname for it to work.

   "starthere" set to 1 to make this the default spawnpoint.  (Note: multiple progressive
   starts with starthere set will override each other).

 *****************************************************************************/

CLASS_DECLARATION( PlayerStart, ProgressiveStart, "info_player_progressivestart" );

ResponseDef ProgressiveStart::Responses[] =
{
	{ &EV_Activate, ( Response )& ProgressiveStart::SetSpawnpoint },
	{ NULL, NULL }
};

ProgressiveStart::ProgressiveStart()
{
	if( !targetname.length() )
	{
		gi.error( "ProgressiveStart without targetname at (%f,%f,%f)\n", origin.x, origin.y, origin.z );
	}

	if( G_GetIntArg( "starthere" ) )
	{
		game.spawnpoint = targetname;
	}
}

void ProgressiveStart::SetSpawnpoint( Event* ev )
{
	game.spawnpoint = targetname;
}

/*****************************************************************************/
/*  saved out by quaked in region mode

 *****************************************************************************/

CLASS_DECLARATION( PlayerStart, TestPlayerStart, "testplayerstart" );

ResponseDef TestPlayerStart::Responses[] =
{
	{ NULL, NULL }
};

/*****************************************************************************/
/*SINED info_player_deathmatch (1 0 1) (-16 -16 0) (16 16 64)

   potential spawning position for deathmatch games

 *****************************************************************************/

CLASS_DECLARATION( PlayerStart, PlayerDeathmatchStart, "info_player_deathmatch" );

ResponseDef PlayerDeathmatchStart::Responses[] =
{
	{ NULL, NULL }
};

/*****************************************************************************/
/*SINED info_player_coop (1 0 1) (-16 -16 0) (16 16 64)

   potential spawning position for coop games

 *****************************************************************************/

CLASS_DECLARATION( PlayerStart, PlayerCoopStart, "info_player_coop" );

ResponseDef PlayerCoopStart::Responses[] =
{
	{ NULL, NULL }
};

/*****************************************************************************/
/*SINED info_player_intermission (1 0 1) (-16 -16 0) (16 16 64)

   viewing point in between deathmatch levels

 *****************************************************************************/

CLASS_DECLARATION( Camera, PlayerIntermission, "info_player_intermission" );

ResponseDef PlayerIntermission::Responses[] =
{
	{ NULL, NULL }
};

PlayerIntermission::PlayerIntermission()
{
	currentstate.watch.splineangles = false;
	newstate.watch.splineangles = false;
}
