?? misc.cpp
字號:
gi.WriteString( temp );
gi.multicast( vec3_origin, MULTICAST_ALL );
}
/*
================
SendOverlay
================
*/
void SendOverlay
(
Entity *ent,
str overlayname
)
{
if ( ent )
{
gi.WriteByte( svc_console_command );
gi.WriteString( va( "lo %s",overlayname.c_str() ) );
gi.unicast ( ent->edict, true);
}
else
{
gi.WriteByte( svc_console_command );
gi.WriteString( va( "lo %s",overlayname.c_str() ) );
gi.multicast( NULL, MULTICAST_ALL );
}
}
/*
================
SendIntermission
================
*/
void SendIntermission
(
Entity *ent,
str intermissionname
)
{
if ( ent )
{
gi.WriteByte( svc_console_command );
gi.WriteString( va( "imf %s",intermissionname.c_str() ) );
gi.unicast ( ent->edict, true);
}
else
{
gi.WriteByte( svc_console_command );
gi.WriteString( va( "imf %s",intermissionname.c_str() ) );
gi.multicast( NULL, MULTICAST_ALL );
}
}
/*****************************************************************************/
/*SINED func_group (0 0 0) ?
Used to group brushes together just for editor convenience.
/*****************************************************************************/
/*****************************************************************************/
/*SINED func_remove (0 0.5 0) ?
Used for lighting and such
/*****************************************************************************/
CLASS_DECLARATION( Entity, FuncRemove, "func_remove" );
ResponseDef FuncRemove::Responses[] =
{
{ NULL, NULL }
};
FuncRemove::FuncRemove()
{
ProcessEvent( EV_Remove );
}
/*****************************************************************************/
/*SINED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
Used as a positional target for spotlights, etc.
/*****************************************************************************/
CLASS_DECLARATION( Entity, InfoNull, "info_null" );
ResponseDef InfoNull::Responses[] =
{
{ NULL, NULL }
};
InfoNull::InfoNull()
{
ProcessEvent( EV_Remove );
}
/*****************************************************************************/
/*SINED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
Used as a positional target for lightning.
/*****************************************************************************/
CLASS_DECLARATION( Entity, InfoNotNull, "info_notnull" );
ResponseDef InfoNotNull::Responses[] =
{
{ NULL, NULL }
};
/*****************************************************************************/
/*SINED func_electrocute (0 .5 .8) ?
"radius" - range of the effect (Default is 500)
"key" The item needed to activate this. (default nothing)
Electrocutes everything it can see if it is in the water
/*****************************************************************************/
CLASS_DECLARATION( Trigger, Electrocute, "func_electrocute" );
ResponseDef Electrocute::Responses[] =
{
{ &EV_Trigger_Effect, ( Response )Electrocute::KillSight },
{ NULL, NULL }
};
Electrocute::Electrocute()
{
setOrigin( origin );
setSolidType( SOLID_NOT );
setMoveType( MOVETYPE_NONE );
radius = G_GetFloatArg("radius", 500);
}
void Electrocute::KillSight(Event *ev)
{
Entity *other = ev->GetEntity( 1 );
Entity *ent;
ent = findradius( NULL, worldorigin, radius );
while( ent )
{
if ( ( ent != this ) && ( !ent->deadflag ) )
{
if (ent->waterlevel)
{
ent->Damage( this, other, ent->health, ent->worldorigin, vec_zero, vec_zero, 0, DAMAGE_NO_ARMOR, MOD_ELECTRIC, -1, -1, 1.0f );
}
}
ent = findradius( ent, worldorigin, radius );
}
}
/*****************************************************************************/
/*SINED func_spawn(0 .5 .8) (-8 -8 -8) (8 8 8)
"modelname" The name of the .def file you wish to spawn. (Required)
"spawntargetname" This will be the targetname of the spawned model. (default is null)
"key" The item needed to activate this. (default nothing)
"attackmode" Attacking mode of the spawned actor (default 0)
/*****************************************************************************/
CLASS_DECLARATION( Entity, Spawn, "func_spawn" );
ResponseDef Spawn::Responses[] =
{
{ &EV_Activate, ( Response )Spawn::DoSpawn },
{ NULL, NULL }
};
Spawn::Spawn()
{
setSolidType( SOLID_NOT );
setMoveType( MOVETYPE_NONE );
hideModel();
modelname = G_GetStringArg( "modelname", NULL );
angles = Vector( va( "0 %f 0", G_GetFloatArg( "angle", 0 ) ) );
if ( !modelname.length() )
warning("Spawn", "modelname not set" );
spawntargetname = G_GetStringArg( "spawntargetname", NULL );
attackmode = G_GetIntArg( "attackmode", 0 );
}
void Spawn::DoSpawn( Event *ev )
{
char temp[ 128 ];
// Clear the spawn args
G_InitSpawnArguments();
sprintf( temp, "%f %f %f", worldorigin[ 0 ], worldorigin[ 1 ], worldorigin[ 2 ] );
G_SetSpawnArg( "origin", temp );
sprintf( temp, "%f", angles[ 1 ] );
G_SetSpawnArg( "angle", temp );
G_SetSpawnArg( "model", modelname.c_str() );
G_SetSpawnArg( "targetname", spawntargetname.c_str() );
G_SetSpawnArg( "attackmode", va( "%i",attackmode ) );
G_CallSpawn();
// Clear the spawn args
G_InitSpawnArguments();
}
/*****************************************************************************/
/*SINED func_respawn(0 .5 .8) (-8 -8 -8) (8 8 8)
When the thing that is spawned is killed, this func_respawn will get
triggered.
"modelname" The name of the .def file you wish to spawn. (Required)
"spawntargetname" This will be the targetname of the spawned model. (default is null)
"key" The item needed to activate this. (default nothing)
/*****************************************************************************/
CLASS_DECLARATION( Spawn, ReSpawn, "func_respawn" );
ResponseDef ReSpawn::Responses[] =
{
{ NULL, NULL }
};
void ReSpawn::DoSpawn( Event *ev )
{
char temp[ 128 ];
// Clear the spawn args
G_InitSpawnArguments();
sprintf( temp, "%f %f %f", worldorigin[ 0 ], worldorigin[ 1 ], worldorigin[ 2 ] );
G_SetSpawnArg( "origin", temp );
sprintf( temp, "%f", angles[ 1 ] );
G_SetSpawnArg( "angle", temp );
G_SetSpawnArg( "model", modelname.c_str() );
// This will trigger the func_respawn when the thing dies
G_SetSpawnArg( "targetname", TargetName() );
G_SetSpawnArg( "target", TargetName() );
G_CallSpawn();
// Clear the spawn args
G_InitSpawnArguments();
}
/*****************************************************************************/
/*SINED func_spawnoutofsight(0 .5 .8) (-8 -8 -8) (8 8 8)
Will only spawn something out of sight of its targets.
"modelname" The name of the .def file you wish to spawn. (Required)
"spawntargetname" This will be the targetname of the spawned model. (default is null)
"key" The item needed to activate this. (default nothing)
/*****************************************************************************/
CLASS_DECLARATION( Spawn, SpawnOutOfSight, "func_spawnoutofsight" );
ResponseDef SpawnOutOfSight::Responses[] =
{
{ NULL, NULL }
};
void SpawnOutOfSight::DoSpawn
(
Event *ev
)
{
char temp[ 128 ];
int i;
Entity *ent;
edict_t *ed;
trace_t trace;
qboolean seen = false;
// Check to see if I can see any players before spawning
for( i = 0; i < game.maxclients; i++ )
{
ed = &g_edicts[ 1 + i ];
if ( !ed->inuse || !ed->entity )
{
continue;
}
ent = ed->entity;
if ( ( ent->health < 0 ) || ( ent->flags & FL_NOTARGET ) )
{
continue;
}
trace = G_Trace( worldorigin, vec_zero, vec_zero, ent->centroid, this, MASK_OPAQUE, "SpawnOutOfSight::DoSpawn" );
if ( trace.fraction == 1.0 )
{
seen = true;
break;
}
}
if ( seen )
return;
// Clear the spawn args
G_InitSpawnArguments();
sprintf( temp, "%f %f %f", worldorigin[ 0 ], worldorigin[ 1 ], worldorigin[ 2 ] );
G_SetSpawnArg( "origin", temp );
sprintf( temp, "%f", angles[ 1 ] );
G_SetSpawnArg( "angle", temp );
G_SetSpawnArg( "model", modelname.c_str() );
G_SetSpawnArg( "targetname", spawntargetname.c_str() );
G_CallSpawn();
// Clear the spawn args
G_InitSpawnArguments();
}
/*****************************************************************************/
/*SINED func_spawnchain(0 .5 .8) (-8 -8 -8) (8 8 8)
Tries to spawn something out of the sight of players. If it fails, it will
trigger its targets.
"modelname" The name of the .def file you wish to spawn. (Required)
"spawntargetname" This will be the targetname of the spawned model. (default is null)
"key" The item needed to activate this. (default nothing)
/*****************************************************************************/
CLASS_DECLARATION( Spawn, SpawnChain, "func_spawnchain" );
ResponseDef SpawnChain::Responses[] =
{
{ NULL, NULL }
};
void SpawnChain::DoSpawn
(
Event *ev
)
{
char temp[ 128 ];
int i,num;
Entity *ent;
edict_t *ed;
trace_t trace;
qboolean seen = false;
const char *name;
Event *event;
// Check to see if this can see any players before spawning
for( i = 0; i < game.maxclients; i++ )
{
ed = &g_edicts[ 1 + i ];
if ( !ed->inuse || !ed->entity )
{
continue;
}
ent = ed->entity;
if ( ( ent->health < 0 ) || ( ent->flags & FL_NOTARGET ) )
{
continue;
}
trace = G_Trace( worldorigin, vec_zero, vec_zero, ent->centroid, this, MASK_OPAQUE, "SpawnChain::DoSpawn" );
if ( trace.fraction == 1.0 )
{
seen = true;
break;
}
}
// Couldn't spawn anything, so activate targets
if ( seen )
{
name = Target();
if ( name && strcmp( name, "" ) )
{
num = 0;
do
{
num = G_FindTarget( num, name );
if ( !num )
{
break;
}
ent = G_GetEntity( num );
event = new Event( EV_Activate );
event->AddEntity( world );
ent->PostEvent( event, 0 );
} while ( 1 );
}
return;
}
// Can't see the player, so do the spawn
G_InitSpawnArguments();
sprintf( temp, "%f %f %f", worldorigin[ 0 ], worldorigin[ 1 ], worldorigin[ 2 ] );
G_SetSpawnArg( "origin", temp );
sprintf( temp, "%f", angles[ 1 ] );
G_SetSpawnArg( "angle", temp );
G_SetSpawnArg( "model", modelname.c_str() );
G_SetSpawnArg( "targetname", spawntargetname.c_str() );
G_CallSpawn();
G_InitSpawnArguments();
}
/*****************************************************************************/
/*SINED func_wall (0 .5 .8) ?
This is just a solid wall if not inhibitted
/*****************************************************************************/
CLASS_DECLARATION( Entity, Wall, "func_wall" );
ResponseDef Wall::Responses[] =
{
{ NULL, NULL }
};
Wall::Wall()
{
setOrigin( origin );
setSolidType( SOLID_BSP );
setMoveType( MOVETYPE_PUSH );
}
/*****************************************************************************/
/*SINED func_illusionary (0 .5 .8) ?
A simple entity that looks solid but lets you walk through it.
/*****************************************************************************/
CLASS_DECLARATION( Entity, IllusionaryWall, "func_illusionary" );
ResponseDef IllusionaryWall::Responses[] =
{
{ NULL, NULL }
};
IllusionaryWall::IllusionaryWall()
{
setSolidType( SOLID_NOT );
setMoveType( MOVETYPE_NONE );
}
/*****************************************************************************/
/*SINED func_breakawaywall (0 .5 .8) ? x x NOT_PLAYERS MONSTERS PROJECTILES
Special walltype that removes itself when triggered. Will also trigger
any func_areaportals that it targets.
"key" The item needed to activate this. (default nothing)
If NOT_PLAYERS is set, the trigger does not respond to players
If MONSTERS is set, the trigger will respond to monsters
If PROJECTILES is set, the trigger will respond to projectiles (rockets, grenades, etc.)
/*****************************************************************************/
CLASS_DECLARATION( TriggerOnce, BreakawayWall, "func_breakawaywall" );
Event EV_BreakawayWall_Setup( "BreakawayWall_Setup" );
ResponseDef BreakawayWall::Responses[] =
{
{ &EV_Touch, NULL },
{ &EV_Trigger_Effect, ( Response )BreakawayWall::BreakWall },
{ &EV_BreakawayWall_Setup, ( Response )BreakawayWall::Setup },
{ NULL, NULL }
};
void BreakawayWall::BreakWall
(
Event *ev
)
{
SetAreaPortals( Target(), true );
ActivateTargets( ev );
}
void BreakawayWall::Setup
(
Event *ev
)
{
SetAreaPortals( Target(), false );
}
BreakawayWall::BreakawayWall()
{
showModel();
setMoveType( MOVETYPE_PUSH );
setSolidType( SOLID_BSP );
PostEvent( EV_BreakawayWall_Setup, 0.1 );
respondto = spawnflags ^ TRIGGER_PLAYERS;
};
/*****************************************************************************/
/*SINED func_explodingwall (0 .5 .8) ? RANDOMANGLES LANDSHATTER NOT_PLAYERS MONSTERS PROJECTILES INVISIBLE ACCUMALATIVE TWOSTAGE
Blows up on activation or when attacked
"explosions" number of explosions to spawn ( default 1 )
"land_angles" The angles you want this piece to\
orient to when it lands on the ground
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -