本文整理汇总了C++中G_ModelIndex函数的典型用法代码示例。如果您正苦于以下问题:C++ G_ModelIndex函数的具体用法?C++ G_ModelIndex怎么用?C++ G_ModelIndex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_ModelIndex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DropPortalSource
void DropPortalSource( gentity_t *player ) {
gentity_t *ent;
gentity_t *destination;
vec3_t snapped;
// create the portal source
ent = G_Spawn();
ent->s.modelindex = G_ModelIndex( "models/powerups/teleporter/tele_enter.md3" );
VectorCopy( player->s.pos.trBase, snapped );
SnapVector( snapped );
G_SetOrigin( ent, snapped );
VectorCopy( player->r.mins, ent->r.mins );
VectorCopy( player->r.maxs, ent->r.maxs );
ent->classname = "hi_portal source";
ent->s.pos.trType = TR_STATIONARY;
ent->r.contents = CONTENTS_CORPSE | CONTENTS_TRIGGER;
ent->takedamage = qtrue;
ent->health = 200;
ent->die = PortalDie;
trap_LinkEntity( ent );
ent->count = player->client->portalID;
player->client->portalID = 0;
// ent->spawnflags = player->client->ps.persistant[PERS_TEAM];
ent->nextthink = level.time + 1000;
ent->think = PortalEnable;
// find the destination
destination = NULL;
while( (destination = G_Find(destination, FOFS(classname), "hi_portal destination")) != NULL ) {
if( destination->count == ent->count ) {
VectorCopy( destination->s.pos.trBase, ent->pos1 );
break;
}
}
}
开发者ID:AbandonedCart,项目名称:XperiaPlayNative,代码行数:43,代码来源:g_misc.c
示例2: VectorSet
gentity_t *fire_fern( vec3_t origin, vec3_t angles, int lifespan )
{
gentity_t *self;
vec3_t normal, end;
trace_t tr;
if( lifespan < FERN_CLEAN_DELAY )
lifespan = FERN_LIFE_SPAN;
VectorSet( normal, 0.0, 0.0, -1.0 );
VectorMA( origin, 256.0, normal, end );
trap_Trace( &tr, origin, NULL, NULL, end, -1, MASK_SOLID );
if( !( tr.fraction < 1.0f ) )
return NULL;
self = G_Spawn( );
self->classname = "fern";
self->s.eType = ET_GENERAL;
self->s.modelindex = G_ModelIndex( "models/mapobjects/plant_life/ferns.md3" );
self->s.time = level.time;
self->s.pos.trType = TR_STATIONARY;
self->s.pos.trTime = level.time;
self->think = fern_grow;
self->nextthink = level.time + FERN_GROW_SPEED;
self->suicideTime = level.time + lifespan;
VectorCopy( origin, self->s.origin );
VectorCopy( origin, self->r.currentOrigin );
VectorCopy( tr.endpos, self->pos1 );
VectorCopy( self->pos1, self->s.pos.trBase );
self->s.pos.trBase[ 2 ] -= FERN_GROW_HEIGHT;
self->s.apos.trBase[ YAW ] = angles[ YAW ];
trap_LinkEntity( self );
return self;
}
开发者ID:redrumrobot,项目名称:r-unlimited-cz,代码行数:42,代码来源:g_missile.c
示例3: is
/*QUAKED alarm_box (1 0 1) START_ON
You need to have an origin brush as part of this entity
current alarm box model is (8 x 16 x 28)
"health" defaults to 10
"noise" the sound to play over the system (this would be the siren sound)
START_ON means the button is pushed in, any dlights are cycling, and alarms are sounding
"team" key/value is valid for teamed alarm boxes
teamed alarm_boxes work in tandem (switches/lights syncronize)
target a box to dlights to have them activate/deactivate with the system (use a stylestring that matches the cycletime for the alarmbox sound)
alarm sound locations are also placed in the dlights, so wherever you place an attached dlight, you will hear the alarm
model: the model used is "models/mapobjects/electronics/alarmbox.md3"
place the origin at the center of your trigger box
*/
void SP_alarm_box(gentity_t *ent)
{
char *s;
if (!ent->model) {
G_Printf( S_COLOR_RED "alarm_box with NULL model\n" );
return;
}
// model
trap_SetBrushModel( ent, ent->model );
ent->s.modelindex2 = G_ModelIndex( "models/mapobjects/electronics/alarmbox.md3" );
// sound
if ( G_SpawnString( "noise", "0", &s ) ) {
ent->soundLoop = G_SoundIndex( s );
}
ent->soundPos3 = G_SoundIndex("sound/world/alarmswitch.wav");
G_SetOrigin (ent, ent->s.origin);
G_SetAngle (ent, ent->s.angles);
if (!ent->health)
ent->health = 10;
if(ent->spawnflags & 1)
ent->s.frame = 1;
else
ent->s.frame = 0;
ent->active = qtrue;
ent->s.eType = ET_ALARMBOX;
ent->takedamage = qtrue;
ent->die = alarmbox_die;
ent->use = alarmbox_use;
ent->think = alarmbox_finishspawning;
ent->nextthink = level.time + FRAMETIME;
trap_LinkEntity (ent);
}
开发者ID:nobowned,项目名称:rtcw,代码行数:58,代码来源:g_alarm.c
示例4: SP_info_jedimaster_start
/*QUAKED info_jedimaster_start (1 0 0) (-16 -16 -24) (16 16 32)
"jedi master" saber spawn point
*/
void SP_info_jedimaster_start(gentity_t *ent)
{
if (g_gametype.integer != GT_JEDIMASTER)
{
gJMSaberEnt = NULL;
G_FreeEntity(ent);
return;
}
ent->enemy = NULL;
ent->s.eFlags = EF_BOUNCE_HALF;
ent->s.modelindex = G_ModelIndex("models/weapons2/saber/saber_w.glm");
ent->s.modelGhoul2 = 1;
ent->s.g2radius = 20;
//ent->s.eType = ET_GENERAL;
ent->s.eType = ET_MISSILE;
ent->s.weapon = WP_SABER;
ent->s.pos.trType = TR_GRAVITY;
ent->s.pos.trTime = level.time;
VectorSet( ent->r.maxs, 3, 3, 3 );
VectorSet( ent->r.mins, -3, -3, -3 );
ent->r.contents = CONTENTS_TRIGGER;
ent->clipmask = MASK_SOLID;
ent->isSaberEntity = qtrue;
ent->bounceCount = -5;
ent->physicsObject = qtrue;
VectorCopy(ent->s.pos.trBase, ent->s.origin2); //remember the spawn spot
ent->touch = JMSaberTouch;
trap_LinkEntity(ent);
ent->think = JMSaberThink;
ent->nextthink = level.time + 50;
}
开发者ID:Boothand,项目名称:SaberShenanigans,代码行数:44,代码来源:g_client.c
示例5: SP_fx_explosion_trail
//----------------------------------------------------------
void SP_fx_explosion_trail( gentity_t *ent )
{
// We have to be useable, otherwise we won't spawn in
if ( !ent->targetname )
{
gi.Printf( S_COLOR_RED"ERROR: fx_explosion_trail at %s has no targetname specified\n", vtos( ent->s.origin ));
G_FreeEntity( ent );
return;
}
// Get our defaults
G_SpawnString( "fxFile", "env/exp_trail_comp", &ent->fxFile );
G_SpawnInt( "damage", "128", &ent->damage );
G_SpawnFloat( "radius", "128", &ent->radius );
G_SpawnFloat( "speed", "350", &ent->speed );
// Try and associate an effect file, unfortunately we won't know if this worked or not until the CGAME trys to register it...
ent->fxID = G_EffectIndex( ent->fxFile );
if ( ent->fullName )
{
G_EffectIndex( ent->fullName );
}
if ( ent->model )
{
ent->s.modelindex2 = G_ModelIndex( ent->model );
}
// Give us a bit of time to spawn in the other entities, since we may have to target one of 'em
ent->e_ThinkFunc = thinkF_fx_explosion_trail_link;
ent->nextthink = level.time + 500;
// Save our position and link us up!
G_SetOrigin( ent, ent->s.origin );
VectorSet( ent->maxs, FX_ENT_RADIUS, FX_ENT_RADIUS, FX_ENT_RADIUS );
VectorScale( ent->maxs, -1, ent->mins );
gi.linkentity( ent );
}
开发者ID:LTolosa,项目名称:Jedi-Outcast,代码行数:42,代码来源:g_fx.cpp
示例6: SP_misc_anim_model
/*
===============
SP_misc_anim_model
Spawn function for anim model
===============
*/
void SP_misc_anim_model(gentity_t *self) {
self->s.powerups = (int) self->animation[ 0 ];
self->s.weapon = (int) self->animation[ 1 ];
self->s.torsoAnim = (int) self->animation[ 2 ];
self->s.legsAnim = (int) self->animation[ 3 ];
self->s.angles2[ 0 ] = self->pos2[ 0 ];
//add the model to the client precache list
self->s.modelindex = G_ModelIndex(self->model);
self->use = SP_use_anim_model;
self->s.eType = ET_ANIMMAPOBJ;
// spawn with animation stopped
if (self->spawnflags & 2)
self->s.eFlags |= EF_MOVER_STOP;
trap_LinkEntity(self);
}
开发者ID:AlienHoboken,项目名称:Tremulous-Z-Server,代码行数:28,代码来源:g_misc.c
示例7: Spawn_Flag_Base
//===========================================================================
// Routine : Spawn_Flag_Base
// Description : Spawn a base to sit the flagpole on. We might not need this! May be useful for moveable bases on tanks/etc???
void Spawn_Flag_Base ( vec3_t origin )
{// Blue Flag...
gentity_t* ent = G_Spawn();
VectorCopy(origin, ent->s.origin);
G_SetOrigin( ent, origin );
ent->model = "models/map_objects/mp/flag_base.md3";
ent->s.modelindex = G_ModelIndex( ent->model );
ent->targetname = NULL;
ent->classname = "flag_base";
ent->s.eType = ET_GENERAL;
ent->setTime = 0;
// trap_R_ModelBounds(trap_R_RegisterModel( "models/map_objects/mp/flag_base.md3" ), ent->r.mins, ent->r.maxs);
VectorSet( ent->r.mins, -16, -16, 0 );
VectorSet( ent->r.maxs, 16, 16, 16 );
//Drop to floor
if ( 1 )
{
trace_t tr;
vec3_t bottom, saveOrg;
VectorCopy( ent->s.origin, saveOrg );
VectorCopy( ent->s.origin, bottom );
bottom[2] = MIN_WORLD_COORD;
trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, bottom, ent->s.number, MASK_NPCSOLID );
if ( !tr.allsolid && !tr.startsolid && tr.fraction < 1.0 )
{
VectorCopy(tr.endpos, ent->s.origin);
G_SetOrigin( ent, tr.endpos );
}
}
ent->r.contents = CONTENTS_SOLID|CONTENTS_OPAQUE|CONTENTS_BODY|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP;//CONTENTS_SOLID;
trap_LinkEntity (ent);
}
开发者ID:jwginge,项目名称:ojpa,代码行数:43,代码来源:dom_flagsys.c
示例8: CreateLaserTrap
//---------------------------------------------------------
void CreateLaserTrap( gentity_t *laserTrap, vec3_t start, gentity_t *owner )
//---------------------------------------------------------
{
if ( !VALIDSTRING( laserTrap->classname ))
{
// since we may be coming from a map placed trip mine, we don't want to override that class name....
// That would be bad because the player drop code tries to limit number of placed items...so it would have removed map placed ones as well.
laserTrap->classname = "tripmine";
}
laserTrap->splashDamage = weaponData[WP_TRIP_MINE].splashDamage;
laserTrap->splashRadius = weaponData[WP_TRIP_MINE].splashRadius;
laserTrap->damage = weaponData[WP_TRIP_MINE].damage;
laserTrap->methodOfDeath = MOD_LASERTRIP;
laserTrap->splashMethodOfDeath = MOD_LASERTRIP;//? SPLASH;
laserTrap->s.eType = ET_MISSILE;
laserTrap->svFlags = SVF_USE_CURRENT_ORIGIN;
laserTrap->s.weapon = WP_TRIP_MINE;
laserTrap->owner = owner;
// VectorSet( laserTrap->mins, -LT_SIZE, -LT_SIZE, -LT_SIZE );
// VectorSet( laserTrap->maxs, LT_SIZE, LT_SIZE, LT_SIZE );
laserTrap->clipmask = (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_SHOTCLIP);//MASK_SHOT;
laserTrap->s.pos.trTime = level.time; // move a bit on the very first frame
VectorCopy( start, laserTrap->s.pos.trBase );
VectorCopy( start, laserTrap->currentOrigin);
VectorCopy( start, laserTrap->pos2 ); // ?? wtf ?
laserTrap->fxID = G_EffectIndex( "tripMine/explosion" );
laserTrap->e_TouchFunc = touchF_touchLaserTrap;
laserTrap->s.radius = 60;
VectorSet( laserTrap->s.modelScale, 1.0f, 1.0f, 1.0f );
gi.G2API_InitGhoul2Model( laserTrap->ghoul2, weaponData[WP_TRIP_MINE].missileMdl, G_ModelIndex( weaponData[WP_TRIP_MINE].missileMdl ), NULL_HANDLE, NULL_HANDLE, 0, 0);
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:40,代码来源:wp_trip_mine.cpp
示例9: JMSaberThink
void JMSaberThink(gentity_t *ent)
{
gJMSaberEnt = ent;
if (ent->enemy)
{
if (!ent->enemy->client || !ent->enemy->inuse)
{ //disconnected?
VectorCopy(ent->enemy->s.pos.trBase, ent->s.pos.trBase);
VectorCopy(ent->enemy->s.pos.trBase, ent->s.origin);
VectorCopy(ent->enemy->s.pos.trBase, ent->r.currentOrigin);
ent->s.modelindex = G_ModelIndex("models/weapons2/saber/saber_w.glm");
ent->s.eFlags &= ~(EF_NODRAW);
ent->s.modelGhoul2 = 1;
ent->s.eType = ET_MISSILE;
ent->enemy = NULL;
ent->pos2[0] = 1;
ent->pos2[1] = 0; //respawn next think
trap_LinkEntity(ent);
}
else
{
ent->pos2[1] = level.time + JMSABER_RESPAWN_TIME;
}
}
else if (ent->pos2[0] && ent->pos2[1] < level.time)
{
VectorCopy(ent->s.origin2, ent->s.pos.trBase);
VectorCopy(ent->s.origin2, ent->s.origin);
VectorCopy(ent->s.origin2, ent->r.currentOrigin);
ent->pos2[0] = 0;
trap_LinkEntity(ent);
}
ent->nextthink = level.time + 50;
G_RunObject(ent);
}
开发者ID:Boothand,项目名称:SaberShenanigans,代码行数:38,代码来源:g_client.c
示例10: SP_misc_model_cargo_small
//---------------------------------------------
void SP_misc_model_cargo_small( gentity_t *ent )
{
G_SpawnInt( "splashRadius", "96", &ent->splashRadius );
G_SpawnInt( "splashDamage", "1", &ent->splashDamage );
if (( ent->spawnflags & DROP_MEDPACK ))
{
RegisterItem( FindItem( "item_medpak_instant" ));
}
if (( ent->spawnflags & DROP_SHIELDS ))
{
RegisterItem( FindItem( "item_shield_sm_instant" ));
}
if (( ent->spawnflags & DROP_BACTA ))
{
// RegisterItem( FindItem( "item_bacta" ));
}
if (( ent->spawnflags & DROP_BATTERIES ))
{
RegisterItem( FindItem( "item_battery" ));
}
G_SpawnInt( "health", "25", &ent->health );
SetMiscModelDefaults( ent, useF_NULL, "11", CONTENTS_SOLID|CONTENTS_OPAQUE|CONTENTS_BODY|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP, NULL, qtrue, NULL );
ent->s.modelindex2 = G_ModelIndex("/models/map_objects/kejim/cargo_small.md3"); // Precache model
// we only take damage from a heavy weapon class missile
ent->flags |= FL_DMG_BY_HEAVY_WEAP_ONLY;
ent->e_DieFunc = dieF_misc_model_cargo_die;
ent->radius = 1.5f; // scale number of chunks spawned
}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:38,代码来源:g_misc_model.cpp
示例11: DropPortalDestination
void DropPortalDestination(gentity_t * player)
{
gentity_t *ent;
vec3_t snapped;
// create the portal destination
ent = G_Spawn();
ent->s.modelindex = G_ModelIndex("models/powerups/teleporter/tele_exit.md3");
VectorCopy(player->s.pos.trBase, snapped);
SnapVector(snapped);
G_SetOrigin(ent, snapped);
VectorCopy(player->r.mins, ent->r.mins);
VectorCopy(player->r.maxs, ent->r.maxs);
ent->classname = "hi_portal destination";
ent->s.pos.trType = TR_STATIONARY;
ent->r.contents = CONTENTS_CORPSE;
ent->takedamage = qtrue;
ent->health = 200;
ent->die = PortalDie;
VectorCopy(player->s.apos.trBase, ent->s.angles);
ent->think = G_FreeEntity;
ent->nextthink = level.time + 2 * 60 * 1000;
trap_LinkEntity(ent);
player->client->portalID = ++level.portalSequence;
ent->count = player->client->portalID;
// give the item back so they can drop the source now
player->client->ps.stats[STAT_HOLDABLE_ITEM] = BG_FindItem("Portal") - bg_itemlist;
}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:36,代码来源:g_misc.c
示例12: SP_gfx_animated_model
void SP_gfx_animated_model( gentity_t *self )
{
self->s.misc = ( int ) self->animation[ 0 ];
self->s.weapon = ( int ) self->animation[ 1 ];
self->s.torsoAnim = ( int ) self->animation[ 2 ];
self->s.legsAnim = ( int ) self->animation[ 3 ];
self->s.angles2[ 0 ] = self->activatedPosition[ 0 ];
//add the model to the client precache list
self->s.modelindex = G_ModelIndex( self->model );
self->act = gfx_animated_model_act;
self->s.eType = ET_ANIMMAPOBJ;
// spawn with animation stopped
if ( self->spawnflags & 2 )
{
self->s.eFlags |= EF_MOVER_STOP;
}
trap_LinkEntity( self );
}
开发者ID:JacksonTech,项目名称:Unvanquished,代码行数:24,代码来源:sg_spawn_gfx.cpp
示例13: InitMover
/*
================
InitMover
"pos1", "pos2", and "speed" should be set before calling,
so the movement delta can be calculated
================
*/
void InitMover( gentity_t *ent ) {
vec3_t move;
float distance;
float light;
vec3_t color;
qboolean lightSet, colorSet;
char *sound;
// if the "model2" key is set, use a seperate model
// for drawing, but clip against the brushes
if ( ent->model2 ) {
ent->s.modelindex2 = G_ModelIndex( ent->model2 );
}
// if the "loopsound" key is set, use a constant looping sound when moving
if ( G_SpawnString( "noise", "100", &sound ) ) {
ent->s.loopSound = G_SoundIndex( sound );
}
// if the "color" or "light" keys are set, setup constantLight
lightSet = G_SpawnFloat( "light", "100", &light );
colorSet = G_SpawnVector( "color", "1 1 1", color );
if ( lightSet || colorSet ) {
int r, g, b, i;
r = color[0] * 255;
if ( r > 255 ) {
r = 255;
}
g = color[1] * 255;
if ( g > 255 ) {
g = 255;
}
b = color[2] * 255;
if ( b > 255 ) {
b = 255;
}
i = light / 4;
if ( i > 255 ) {
i = 255;
}
ent->s.constantLight = r | ( g << 8 ) | ( b << 16 ) | ( i << 24 );
}
ent->use = Use_BinaryMover;
ent->reached = Reached_BinaryMover;
ent->moverState = MOVER_POS1;
ent->r.svFlags = SVF_USE_CURRENT_ORIGIN;
ent->s.eType = ET_MOVER;
VectorCopy (ent->pos1, ent->r.currentOrigin);
trap_LinkEntity (ent);
ent->s.pos.trType = TR_STATIONARY;
VectorCopy( ent->pos1, ent->s.pos.trBase );
// calculate time to reach second position from speed
VectorSubtract( ent->pos2, ent->pos1, move );
distance = VectorLength( move );
if ( ! ent->speed ) {
ent->speed = 100;
}
VectorScale( move, ent->speed, ent->s.pos.trDelta );
ent->s.pos.trDuration = distance * 1000 / ent->speed;
if ( ent->s.pos.trDuration <= 0 ) {
ent->s.pos.trDuration = 1;
}
}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:77,代码来源:g_mover.c
示例14: G_InitGame
/*
============
G_InitGame
============
*/
void G_InitGame( int levelTime, int randomSeed, int restart ) {
int i;
G_Printf ("------- Game Initialization -------\n");
G_Printf ("gamename: %s\n", GAMEVERSION);
G_Printf ("gamedate: %s\n", __DATE__);
srand( randomSeed );
G_RegisterCvars();
G_ProcessIPBans();
G_InitMemory();
// set some level globals
memset( &level, 0, sizeof( level ) );
level.time = levelTime;
level.startTime = levelTime;
level.snd_fry = G_SoundIndex("sound/player/fry.wav"); // FIXME standing in lava / slime
if ( g_gametype.integer != GT_SINGLE_PLAYER && g_logfile.string[0] ) {
if ( g_logfileSync.integer ) {
trap_FS_FOpenFile( g_logfile.string, &level.logFile, FS_APPEND_SYNC );
} else {
trap_FS_FOpenFile( g_logfile.string, &level.logFile, FS_APPEND );
}
if ( !level.logFile ) {
G_Printf( "WARNING: Couldn't open logfile: %s\n", g_logfile.string );
} else {
char serverinfo[MAX_INFO_STRING];
trap_GetServerinfo( serverinfo, sizeof( serverinfo ) );
G_LogPrintf("------------------------------------------------------------\n" );
G_LogPrintf("InitGame: %s\n", serverinfo );
}
} else {
G_Printf( "Not logging to disk.\n" );
}
G_InitWorldSession();
// initialize all entities for this game
memset( g_entities, 0, MAX_GENTITIES * sizeof(g_entities[0]) );
level.gentities = g_entities;
// initialize all clients for this game
level.maxclients = g_maxclients.integer;
memset( g_clients, 0, MAX_CLIENTS * sizeof(g_clients[0]) );
level.clients = g_clients;
// set client fields on player ents
for ( i=0 ; i<level.maxclients ; i++ ) {
g_entities[i].client = level.clients + i;
}
// always leave room for the max number of clients,
// even if they aren't all used, so numbers inside that
// range are NEVER anything but clients
level.num_entities = MAX_CLIENTS;
for ( i=0 ; i<MAX_CLIENTS ; i++ ) {
g_entities[i].classname = "clientslot";
}
// let the server system know where the entites are
trap_LocateGameData( level.gentities, level.num_entities, sizeof( gentity_t ),
&level.clients[0].ps, sizeof( level.clients[0] ) );
// reserve some spots for dead player bodies
InitBodyQue();
ClearRegisteredItems();
// parse the key/value pairs and spawn gentities
G_SpawnEntitiesFromString();
// general initialization
G_FindTeams();
// make sure we have flags for CTF, etc
if( g_gametype.integer >= GT_TEAM ) {
G_CheckTeamItems();
}
SaveRegisteredItems();
G_Printf ("-----------------------------------\n");
if( g_gametype.integer == GT_SINGLE_PLAYER || trap_Cvar_VariableIntegerValue( "com_buildScript" ) ) {
G_ModelIndex( SP_PODIUM_MODEL );
}
//.........这里部分代码省略.........
开发者ID:CarlGammaSagan,项目名称:Quake-3-Android-Port-QIII4A,代码行数:101,代码来源:g_main.c
示例15: turret_base_spawn_top
//-----------------------------------------------------
qboolean turret_base_spawn_top( gentity_t *base )
{
vec3_t org;
int t;
gentity_t *top = G_Spawn();
if ( !top )
{
return qfalse;
}
top->s.modelindex = G_ModelIndex( "models/map_objects/hoth/turret_top_new.md3" );
top->s.modelindex2 = G_ModelIndex( "models/map_objects/hoth/turret_top.md3" );
G_SetAngles( top, base->s.angles );
VectorCopy( base->s.origin, org );
org[2] += 128;
G_SetOrigin( top, org );
base->r.ownerNum = top->s.number;
top->r.ownerNum = base->s.number;
if ( base->team && base->team[0] && //g_gametype.integer == GT_SIEGE &&
!base->teamnodmg)
{
base->teamnodmg = atoi(base->team);
}
base->team = NULL;
top->teamnodmg = base->teamnodmg;
top->alliedTeam = base->alliedTeam;
base->s.eType = ET_GENERAL;
// Set up our explosion effect for the ExplodeDeath code....
G_EffectIndex( "turret/explode" );
G_EffectIndex( "sparks/spark_exp_nosnd" );
G_EffectIndex( "turret/hoth_muzzle_flash" );
// this is really the pitch angle.....
top->speed = 0;
// this is a random time offset for the no-enemy-search-around-mode
top->count = random() * 9000;
if ( !base->health )
{
base->health = 3000;
}
top->health = base->health;
G_SpawnInt( "showhealth", "0", &t );
if (t)
{ //a non-0 maxhealth value will mean we want to show the health on the hud
top->maxHealth = base->health; //acts as "maxhealth"
G_ScaleNetHealth(top);
base->maxHealth = base->health;
G_ScaleNetHealth(base);
}
base->takedamage = qtrue;
base->pain = TurretBasePain;
base->die = bottom_die;
//design specified shot speed
G_SpawnFloat( "shotspeed", "1100", &base->mass );
top->mass = base->mass;
//even if we don't want to show health, let's at least light the crosshair up properly over ourself
if ( !top->s.teamowner )
{
top->s.teamowner = top->alliedTeam;
}
base->alliedTeam = top->alliedTeam;
base->s.teamowner = top->s.teamowner;
base->s.shouldtarget = qtrue;
top->s.shouldtarget = qtrue;
//link them to each other
base->target_ent = top;
top->target_ent = base;
//top->s.owner = MAX_CLIENTS; //not owned by any client
// search radius
if ( !base->radius )
{
base->radius = 1024;
}
top->radius = base->radius;
// How quickly to fire
if ( !base->wait )
{
base->wait = 300 + random() * 55;
}
top->wait = base->wait;
//.........这里部分代码省略.........
开发者ID:jwginge,项目名称:ojpa,代码行数:101,代码来源:g_turret.c
示例16: Spawn_Scenario_Flag_Auto
void Spawn_Scenario_Flag_Auto ( vec3_t origin, int teamowner )
{// Red Flag...
gentity_t* ent = G_Spawn();
int radius = 0;//, teamowner = TEAM_NONE;
int flagnum = 0;
char *model, *model2, *fullname;
G_SpawnString("model", "models/flags/r_flag.md3", &model); // Custom red model..
G_SpawnString("model2", "models/flags/b_flag.md3", &model2); // Custom blue model..
G_SpawnString("fullname", "models/flags/n_flag.md3", &fullname); // Custom neutral model.
G_SpawnInt("radius", "500", &radius); // Point's capture radius..
//G_SpawnInt("teamowner", "0", &teamowner); // Point's capture radius..
G_SpawnInt("teamuser", "-1", &flagnum); // Map's flag number.. For linking things to this flag based on team...
if (!radius)
{// Default radius...
ent->s.otherEntityNum2 = 500; // Set capture radius...
}
else
{
ent->s.otherEntityNum2 = radius; // Set capture radius...
}
if (flagnum < 0)
{// We dont have a flag number.. Generate them for this map...
flagnum = number_of_flags;
//number_of_flags++;
}
ent->s.otherEntityNum = flagnum; // Flag number...
// if (model != "")
// {// Red flag model..
ent->model = model;
//RegisterAsModel(model);
ent->s.modelindex = G_ModelIndex( ent->model );
// }
// else
// ent->s.modelindex = -1;
// if (model2 != "")
// {// Blue flag model..
ent->model2 = model2;
//RegisterAsModel(model2);
ent->s.modelindex2 = G_ModelIndex( ent->model2 );
// }
// else
// ent->s.modelindex2 = -1;
// if (fullname != "")
// {// Neutral flag model..
ent->fullName = fullname;
//RegisterAsModel(fullname);
ent->s.activeForcePass = G_ModelIndex( ent->fullName );
// }
// else
// ent->s.activeForcePass = -1;
VectorSet( ent->r.mins, -8, -8, 0 );
VectorSet( ent->r.maxs, 8, 8, 96 );
VectorCopy(origin, ent->s.origin);
ent->s.origin[2]+=64;
G_SetOrigin( ent, ent->s.origin );
if (model == "models/flags/r_flag.md3")
Spawn_Flag_Base(ent->s.origin);
//Drop to floor
if ( 1 )
{
trace_t tr;
vec3_t bottom, saveOrg;
VectorCopy( ent->s.origin, saveOrg );
VectorCopy( ent->s.origin, bottom );
bottom[2] = MIN_WORLD_COORD;
trap_Trace( &tr, ent->s.origin, ent->r.mins, ent->r.maxs, bottom, ent->s.number, MASK_NPCSOLID );
if ( !tr.allsolid && !tr.startsolid && tr.fraction < 1.0 )
{
VectorCopy(tr.endpos, ent->s.origin);
G_SetOrigin( ent, tr.endpos );
}
}
ent->s.teamowner = teamowner;
if (teamowner == TEAM_RED)
{
ent->s.time2 = 100;
G_Printf("^4*** ^5Flag at ^7%f %f %f^5 is ^1TEAM_RED^5! Radius is ^3%i^5.\n", ent->s.origin[0], ent->s.origin[1], ent->s.origin[2], radius);
}
else if (teamowner == TEAM_BLUE)
{
ent->s.time2 = 100;
G_Printf("^4*** ^5Flag at ^7%f %f %f^5 is ^4TEAM_BLUE^5! Radius is ^3%i^5.\n", ent->s.origin[0], ent->s.origin[1], ent->s.origin[2], radius);
}
else
{
ent->s.time2 = 0;
//.........这里部分代码省略.........
开发者ID:jwginge,项目名称:ojpa,代码行数:101,代码来源:dom_flagsys.c
示例17: destroyed
/*QUAKED misc_model_breakable (1 0 0) (-16 -16 -16) (16 16 16) SOLID AUTOANIMATE DEADSOLID NO_DMODEL NO_SMOKE USE_MODEL USE_NOT_BREAK PLAYER_USE NO_EXPLOSION
SOLID - Movement is blocked by it, if not set, can still be broken by explosions and shots if it has health
AUTOANIMATE - Will cycle it's anim
DEADSOLID - Stay solid even when destroyed (in case damage model is rather large).
NO_DMODEL - Makes it NOT display a damage model when destroyed, even if one exists
USE_MODEL - When used, will toggle to it's usemodel (model name + "_u1.md3")... this obviously does nothing if USE_NOT_BREAK is not checked
USE_NOT_BREAK - Using it, doesn't make it break, still can be destroyed by damage
PLAYER_USE - Player can use it with the use button
NO_EXPLOSION - By default, will explode when it dies...this is your override.
"model" arbitrary .md3 file to display
"health" how much health to have - default is zero (not breakable) If you don't set the SOLID flag, but give it health, it can be shot but will not block NPCs or players from moving
"targetname" when used, dies and displays damagemodel, if any (if not, removes itself)
"target" What to use when it dies
"target2" What to use when it's repaired
"target3" What to use when it's used while it's broken
"paintarget" target to fire when hit (but not destroyed)
"count" the amount of armor/health/ammo given (default 50)
"gravity" if set to 1, this will be affected by gravity
"radius" Chunk code tries to pick a good volume of chunks, but you can alter this to scale the number of spawned chunks. (default 1) (.5) is half as many chunks, (2) is twice as many chunks
Damage: default is none
"splashDamage" - damage to do (will make it explode on death)
"splashRadius" - radius for above damage
"team" - This cannot take damage from members of this team:
"player"
"neutral"
"enemy"
"material" - default is "8 - MAT_NONE" - choose from this list:
0 = MAT_METAL (grey metal)
1 = MAT_GLASS
2 = MAT_ELECTRICAL (sparks only)
3 = MAT_ELEC_METAL (METAL chunks and sparks)
4 = MAT_DRK_STONE (brown stone chunks)
5 = MAT_LT_STONE (tan stone chunks)
6 = MAT_GLASS_METAL (glass and METAL chunks)
7 = MAT_METAL2 (blue/grey metal)
8 = MAT_NONE (no chunks-DEFAULT)
9 = MAT_GREY_STONE (grey colored stone)
10 = MAT_METAL3 (METAL and METAL2 chunk combo)
11 = MAT_CRATE1 (yellow multi-colored crate chunks)
12 = MAT_GRATE1 (grate chunks--looks horrible right now)
13 = MAT_ROPE (for yavin_trial, no chunks, just wispy bits )
14 = MAT_CRATE2 (red multi-colored crate chunks)
15 = MAT_WHITE_METAL (white angular chunks for Stu, NS_hideout )
FIXME/TODO:
set size better?
multiple damage models?
custom explosion effect/sound?
*/
void SP_misc_model_breakable( gentity_t *ent )
{
char damageModel[MAX_QPATH];
char chunkModel[MAX_QPATH];
char useModel[MAX_QPATH];
int len;
// Chris F. requested default for misc_model_breakable to be NONE...so don't arbitrarily change this.
G_SpawnInt( "material", "8", (int*)&ent->material );
G_SpawnFloat( "radius", "1", &ent->radius ); // used to scale chunk code if desired by a designer
CacheChunkEffects( ent->material );
misc_model_breakable_init( ent );
len = strlen( ent->model ) - 4;
strncpy( damageModel, ent->model, len );
damageModel[len] = 0; //chop extension
strncpy( chunkModel, damageModel, sizeof(chunkModel));
strncpy( useModel, damageModel, sizeof(useModel));
if (ent->takedamage) {
//Dead/damaged model
if( !(ent->spawnflags & 8) ) { //no dmodel
strcat( damageModel, "_d1.md3" );
ent->s.modelindex2 = G_ModelIndex( damageModel );
}
//Chunk model
strcat( chunkModel, "_c1.md3" );
ent->s.modelindex3 = G_ModelIndex( chunkModel );
}
//Use model
if( ent->spawnflags & 32 ) { //has umodel
strcat( useModel, "_u1.md3" );
ent->sound1to2 = G_ModelIndex( useModel );
}
if ( !ent->mins[0] && !ent->mins[1] && !ent->mins[2] )
{
VectorSet (ent->mins, -16, -16, -16);
}
if ( !ent->maxs[0] && !ent->maxs[1] && !ent->maxs[2] )
{
VectorSet (ent->maxs, 16, 16, 16);
}
if ( ent->spawnflags & 2 )
{
//.........这里部分代码省略.........
开发者ID:Hasimir,项目名称:jedi-outcast-1,代码行数:101,代码来源:g_breakable.cpp
示例18: destroyed
/*QUAKED misc_model_breakable (1 0 0) (-16 -16 -16) (16 16 16) SOLID AUTOANIMATE DEADSOLID NO_DMODEL NO_SMOKE USE_MODEL USE_NOT_BREAK PLAYER_USE NO_EXPLOSION START_OFF
SOLID - Movement is blocked by it, if not set, can still be broken by explosions and shots if it has health
AUTOANIMATE - Will cycle it's anim
DEADSOLID - Stay solid even when destroyed (in case damage model is rather large).
NO_DMODEL - Makes it NOT display a damage model when destroyed, even if one exists
USE_MODEL - When used, will toggle to it's usemodel (model + "_u1.md3")... this obviously does nothing if USE_NOT_BREAK is not checked
USE_NOT_BREAK - Using it, doesn't make it break, still can be destroyed by damage
PLAYER_USE - Player can use it with the use button
NO_EXPLOSION - By default, will explode when it dies...this is your override.
START_OFF - Will start off and will not appear until used.
"model" arbitrary .md3 file to display
"modelscale" "x" uniform scale
"modelscale_vec" "x y z" scale model in each axis - height, width and length - bbox will scale with it
"health" how much health to have - default is zero (not breakable) If you don't set the SOLID flag, but give it health, it can be shot but will not block NPCs or players from moving
"targetname" when used, dies and displays damagemodel (model + "_d1.md3"), if any (if not, removes itself)
"target" What to use when it dies
"target2" What to use when it's repaired
"target3" What to use when it's used while it's broken
"paintarget" target to fire when hit (but not destroyed)
"count" the amount of armor/health/ammo given (default 50)
"radius" Chunk code tries to pick a good volume of chunks, but you can alter this to scale the number of spawned chunks. (default 1) (.5) is half as many chunks, (2) is twice as many chunks
"NPC_targetname" - Only the NPC with this name can damage this
"forcevisible" - When you turn on force sight (any level), you can see these draw through the entire level...
"redCrosshair" - crosshair turns red when you look at this
"gravity" if set to 1, this will be affected by gravity
"throwtarget" if set (along with gravity), this thing, when used, will throw itself at the entity whose targetname matches this string
"mass" if gravity is on, this determines how much damage this thing does when it hits someone. Default is the size of the object from one corner to the other, that works very well. Only override if this is an object whose mass should be very high or low for it's size (density)
Damage: default is none
"splashDamage" - damage to do (will make it explode on death)
"splashRadius" - radius for above damage
"team" - This cannot take damage from members of this team:
"player"
"neutral"
"enemy"
"material" - default is "8 - MAT_NONE" - choose from this list:
0 = MAT_METAL (grey metal)
1 = MAT_GLASS
2 = MAT_ELECTRICAL (sparks only)
3 = MAT_ELEC_METAL (METAL chunks and sparks)
4 = MAT_DRK_STONE (brown stone chunks)
5 = MAT_LT_STONE (tan stone chunks)
6 = MAT_GLASS_METAL (glass and METAL chunks)
7 = MAT_METAL2 (blue/grey metal)
8 = MAT_NONE (no chunks-DEFAULT)
9 = MAT_GREY_STONE (grey colored stone)
10 = MAT_METAL3 (METAL and METAL2 chunk combo)
11 = MAT_CRATE1 (yellow multi-colored crate chunks)
12 = MAT_GRATE1 (grate chunks--looks horrible right now)
13 = MAT_ROPE (for yavin_trial, no chunks, just wispy bits )
14 = MAT_CRATE2 (red multi-colored crate chunks)
15 = MAT_WHITE_METAL (white angular chunks for Stu, NS_hideout )
*/
void SP_misc_model_breakable( gentity_t *ent )
{
char damageModel[MAX_QPATH];
char chunkModel[MAX_QPATH];
char useModel[MAX_QPATH];
int len;
// Chris F. requested default for misc_model_breakable to be NONE...so don't arbitrarily change this.
G_SpawnInt( "material", "8", (int*)&ent->material );
G_SpawnFloat( "radius", "1", &ent->radius ); // used to scale chunk code if desired by a designer
qboolean bHasScale = G_SpawnVector("modelscale_vec", "0 0 0", ent->s.modelScale);
if (!bHasScale)
{
float temp;
G_SpawnFloat( "modelscale", "0", &temp);
if (temp != 0.0f)
{
ent->s.modelScale[ 0 ] = ent->s.modelScale[ 1 ] = ent->s.modelScale[ 2 ] = temp;
bHasScale = qtrue;
}
}
CacheChunkEffects( ent->material );
misc_model_breakable_init( ent );
len = strlen( ent->model ) - 4;
assert(ent->model[len]=='.');//we're expecting ".md3"
strncpy( damageModel, ent->model, sizeof(damageModel) );
damageModel[len] = 0; //chop extension
strncpy( chunkModel, damageModel, sizeof(chunkModel));
strncpy( useModel, damageModel, sizeof(useModel));
if (ent->takedamage) {
//Dead/damaged model
if( !(ent->spawnflags & 8) ) { //no dmodel
strcat( damageModel, "_d1.md3" );
ent->s.modelindex2 = G_ModelIndex( damageModel );
}
//Chunk model
strcat( chunkModel, "_c1.md3" );
ent->s.modelindex3 = G_ModelIndex( chunkModel );
}
//.........这里部分代码省略.........
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:101,代码来源:g_breakable.cpp
示例19: G_Script_ScriptParse
//.........这里部分代码省略.........
token = COM_Parse(&pScript);
if (token[0] != '{') {
COM_ParseError("'{' expected, found: %s.\n", token);
}
while ((token = COM_Parse(&pScript)) != NULL && (token[0] != '}')) {
if (strlen(params)) { // add a space between each param
Q_strcat(params, sizeof (params), " ");
}
if (strrchr(token, ' ')) { // need to wrap this param in quotes since it has more than one word
Q_strcat(params, sizeof (params), "\"");
}
Q_strcat(params, sizeof (params), token);
if (strrchr(token, ' ')) { // need to wrap this param in quotes since it has mor
Q_strcat(params, sizeof (params), "\"");
}
}
} else
// hackly precaching of custom characters
if (!Q_stricmp(token, "spawnbot")) {
// this is fairly indepth, so I'll move it to a separate function for readability
G_Script_ParseSpawnbot(&pScript, params, MAX_INFO_STRING);
} else {
token = COM_ParseExt(&pScript, qfalse);
for (i = 0; token[0]; ++i) {
if (strlen(params)) { // add a space between each param
Q_strcat(params, sizeof (params), " ");
}
if (i == 0) {
// Special case: playsound's need to be cached on startup to prevent in-game pauses
if (!Q_stricmp(action->actionString, "playsound")) {
G_SoundIndex(token);
} else if (!Q_stricmp(action->actionString, "changemodel")) {
G_ModelIndex(token);
} else if (buildScript &&
(!Q_stricmp(action->actionString, "mu_start") ||
!Q_stricmp(action->actionString, "mu_play") ||
!Q_stricmp(action->actionString, "mu_queue") ||
!Q_stricmp(action->actionString, "startcam")) &&
strlen(token)) {
trap_SendServerCommand(-1, va("addToBuild %s\n", token));
}
}
if ((i == 0 || i == 1) && !Q_stricmp(action->actionString, "remapshader")) {
G_ShaderIndex(token);
}
if (strrchr(token, ' ')) { // need to wrap this param in quotes since it has more than one word
Q_strcat(params, sizeof (params), "\"");
}
Q_strcat(params, sizeof (params), token);
if (strr
|
请发表评论