这篇教程C++ G_ModelIndex函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中G_ModelIndex函数的典型用法代码示例。如果您正苦于以下问题:C++ G_ModelIndex函数的具体用法?C++ G_ModelIndex怎么用?C++ G_ModelIndex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了G_ModelIndex函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DropPortalSourcevoid 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,
示例2: VectorSetgentity_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,
示例3: is/*QUAKED alarm_box (1 0 1) START_ONYou need to have an origin brush as part of this entitycurrent 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 boxesteamed 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 alarmmodel: 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,
示例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,
示例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,
示例6: SP_misc_anim_model/*===============SP_misc_anim_modelSpawn 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,
示例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,
示例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,
示例9: JMSaberThinkvoid 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,
示例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,
示例11: DropPortalDestinationvoid 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,
示例12: SP_gfx_animated_modelvoid 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,
示例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,
示例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,
示例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,
示例16: Spawn_Scenario_Flag_Autovoid 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,
示例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_EXPLOSIONSOLID - Movement is blocked by it, if not set, can still be broken by explosions and shots if it has healthAUTOANIMATE - Will cycle it's animDEADSOLID - 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 existsUSE_MODEL - When used, will toggle to it's usemodel (model name + "_u1.md3")... this obviously does nothing if USE_NOT_BREAK is not checkedUSE_NOT_BREAK - Using it, doesn't make it break, still can be destroyed by damagePLAYER_USE - Player can use it with the use buttonNO_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 chunksDamage: 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,
示例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_OFFSOLID - Movement is blocked by it, if not set, can still be broken by explosions and shots if it has healthAUTOANIMATE - Will cycle it's animDEADSOLID - 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 existsUSE_MODEL - When used, will toggle to it's usemodel (model + "_u1.md3")... this obviously does nothing if USE_NOT_BREAK is not checkedUSE_NOT_BREAK - Using it, doesn't make it break, still can be destroyed by damagePLAYER_USE - Player can use it with the use buttonNO_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,
示例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 (strrchr(token, ' ')) { // need to wrap this param in quotes since it has more than one word Q_strcat(params, sizeof (params), "/""); } token = COM_ParseExt(&pScript, qfalse); } } if (strlen(params)) { // copy the params into the event curEvent->stack.items[curEvent->stack.numItems].params = G_Alloc(strlen(params) + 1); Q_strncpyz(curEvent->stack.items[curEvent->stack.numItems].params, params, strlen(params) + 1); } curEvent->stack.numItems++; if (curEvent->stack.numItems >= G_MAX_SCRIPT_STACK_ITEMS) { G_Error("G_Script_ScriptParse(): script exceeded G_MAX_SCRIPT_STACK_ITEMS (%d), line %d/n", G_MAX_SCRIPT_STACK_ITEMS, COM_GetCurrentParseLine()); } } numEventItems++; } else { // skip this character completely // TTimo gcc: suggest parentheses around assignment used as truth value while ((token = COM_Parse(&pScript)) != NULL) { if (!token[0]) { G_Error("G_Script_ScriptParse(), Error (line %d): '}' expected, end of script found./n", COM_GetCurrentParseLine()); } else if (token[0] == '{') { bracketLevel++; } else if (token[0] == '}' && !--bracketLevel) { break; } } } } // alloc and copy the events into the gentity_t for this cast if (numEventItems > 0) { ent->scriptEvents = G_Alloc(sizeof (g_script_event_t) * numEventItems); memcpy(ent->scriptEvents, events, sizeof (g_script_event_t) * numEventItems); ent->numScriptEvents = numEventItems; }}
开发者ID:ETrun,项目名称:ETrun,代码行数:101,
示例20: spawn_rack_goods//.........这里部分代码省略......... //---------Ammo types if ( am_blaster ) { itemList[ct++] = am_blaster; } if ( am_metal_bolts ) { itemList[ct++] = am_metal_bolts; } if ( am_pwr_cell ) { itemList[ct++] = am_pwr_cell; } if ( am_rockets ) { itemList[ct++] = am_rockets; } if ( !(ent->spawnflags & RACK_NO_FILL) && ct ) //double negative..should always have at least one item on there, but just being safe { for ( ; ct < 3 ; ct++ ) { itemList[ct] = itemList[0]; // first item ALWAYS propagates to fill up the shelf } } // now actually add the items to the shelf...validate that we have a list to add if ( ct ) { for ( int i = 0; i < ct; i++ ) { GunRackAddItem( itemList[i], ent->s.origin, ent->s.angles, crandom() * 0.5f, (i-1)* 8, 7.0f ); } } // -----Weapon option if ( ent->spawnflags & RACK_WEAPONS ) { if ( !(ent->spawnflags & ( RACK_BLASTER | RACK_METAL_BOLTS | RACK_ROCKETS | RACK_PWR_CELL ))) { // nothing was selected, so we assume blaster pack it = blaster; } else { // if weapon is checked...and so are one or more ammo types, then pick a random weapon to display..always give weaker weapons first if ( blaster ) { it = blaster; v_off = 25.5f; } else if ( metal_bolts ) { it = metal_bolts; v_off = 27.0f; } else if ( rockets ) { it = rockets; v_off = 28.0f; } } if ( it ) { // since we may have to put up a health pack on the shelf, we should know where we randomly put // the gun so we don't put the pack on the same spot..so pick either the left or right side pos = ( random() > .5 ) ? -1 : 1; GunRackAddItem( it, ent->s.origin, ent->s.angles, crandom() * 2, ( random() * 6 + 4 ) * pos, v_off ); } } // ------Medpack if (( ent->spawnflags & RACK_HEALTH ) && health ) { if ( !pos ) { // we haven't picked a side already... pos = ( random() > .5 ) ? -1 : 1; } else { // switch to the opposite side pos *= -1; } GunRackAddItem( health, ent->s.origin, ent->s.angles, crandom() * 0.5f, ( random() * 4 + 4 ) * pos, 24 ); } ent->s.modelindex = G_ModelIndex( "models/map_objects/kejim/weaponsrung.md3" ); G_SetOrigin( ent, ent->s.origin ); G_SetAngles( ent, ent->s.angles ); gi.linkentity( ent );}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:101,
示例21: SP_misc_model_ghoulvoid SP_misc_model_ghoul( gentity_t *ent ){#if 1 ent->s.modelindex = G_ModelIndex( ent->model ); gi.G2API_InitGhoul2Model(ent->ghoul2, ent->model, ent->s.modelindex); ent->s.radius = 50;#else char name1[200] = "models/players/kyle/model.glm"; ent->s.modelindex = G_ModelIndex( name1 ); gi.G2API_InitGhoul2Model(ent->ghoul2, name1, ent->s.modelindex); ent->s.radius = 150; // we found the model ok - load it's animation config temp_animFileIndex = G_ParseAnimFileSet("_humanoid", "kyle"); if ( temp_animFileIndex<0 ) { Com_Printf( S_COLOR_RED"Failed to load animation file set models/players/jedi/animation.cfg/n"); } ent->s.angles[0] = 0; ent->s.angles[1] = 90; ent->s.angles[2] = 0; ent->s.origin[2] = 20; ent->s.origin[1] = 80;// ent->s.modelScale[0] = ent->s.modelScale[1] = ent->s.modelScale[2] = 0.8f; VectorSet (ent->mins, -16, -16, -37); VectorSet (ent->maxs, 16, 16, 32);//#if _DEBUG//loadsavecrash// VectorCopy(ent->mins, ent->s.mins);// VectorCopy(ent->maxs, ent->s.maxs);//#endif ent->contents = CONTENTS_BODY; ent->clipmask = MASK_NPCSOLID; G_SetOrigin( ent, ent->s.origin ); VectorCopy( ent->s.angles, ent->s.apos.trBase ); ent->health = 1000;// ent->s.modelindex = G_ModelIndex( "models/weapons2/blaster_r/g2blaster_w.glm" );// gi.G2API_InitGhoul2Model(ent->ghoul2, "models/weapons2/blaster_r/g2blaster_w.glm", ent->s.modelindex);// gi.G2API_AddBolt(&ent->ghoul2[0], "*weapon");// gi.G2API_AttachG2Model(&ent->ghoul2[1],&ent->ghoul2[0], 0, 0); gi.linkentity (ent); animation_t *animations = level.knownAnimFileSets[temp_animFileIndex].animations; int anim = BOTH_STAND3; float animSpeed = 50.0f / animations[anim].frameLerp; gi.G2API_SetBoneAnim(&ent->ghoul2[0], "model_root", animations[anim].firstFrame, (animations[anim].numFrames -1 )+ animations[anim].firstFrame, BONE_ANIM_OVERRIDE_FREEZE , animSpeed, cg.time);// int test = gi.G2API_GetSurfaceRenderStatus(&ent->ghoul2[0], "l_hand");// gi.G2API_SetSurfaceOnOff(&ent->ghoul2[0], "l_arm",0x00000100);// test = gi.G2API_GetSurfaceRenderStatus(&ent->ghoul2[0], "l_hand");// gi.G2API_SetNewOrigin(&ent->ghoul2[0], gi.G2API_AddBolt(&ent->ghoul2[0], "rhang_tag_bone"));// ent->s.apos.trDelta[1] = 10;// ent->s.apos.trType = TR_LINEAR; ent->nextthink = level.time + 1000; ent->e_ThinkFunc = thinkF_set_MiscAnim;#endif}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:70,
示例22: G_CallSpawn/*===============G_CallSpawnFinds the spawn function for the entity and calls it,returning qfalse if not found===============*/qboolean G_CallSpawn( gentity_t *ent ) { spawn_t *s; tiki_t *tiki; if ( !ent->classname ) { G_Printf ("G_CallSpawn: NULL classname/n"); return qfalse; } // check normal spawn functions for ( s=spawns ; s->name ; s++ ) { if ( !strcmp(s->name, ent->classname) ) { // found it s->spawn(ent); return qtrue; } } // try to spawn a tiki model if(ent->model && ent->model[0] /*&& ent->model[0] != '*'*/) { if(ent->model[0] != '*') { char *ptr1, *ptr2; ptr1 = ent->model; ptr2 = ent->model; // su44: fix double '/' in TIKI paths from entities lump. // The same issue is also in R_LoadStaticModels. while(*ptr1) { if(ptr1[0] == '/' && ptr1[1] == '/') { ptr1++; } *ptr2 = *ptr1; ptr1++; ptr2++; } *ptr2 = 0; }#if 0 tiki = trap_TIKI_RegisterModel(ent->model); if(!tiki) { tiki = trap_TIKI_RegisterModel(va("models/%s",ent->model)); } if(tiki) { float dummy; ent->s.modelindex = G_ModelIndex(tiki->name); ent->s.eType = ET_MODELANIM; trap_TIKI_AppendFrameBoundsAndRadius(tiki,0,0,&dummy,ent->r.mins); ent->s.frameInfo[0].weight = 1.f; G_SetOrigin( ent, ent->s.origin ); VectorCopy( ent->s.angles, ent->s.angles ); trap_LinkEntity (ent); return qtrue; }#else ent->s.modelindex = G_ModelIndex(G_FixTIKIPath(ent->model)); ent->s.eType = ET_MODELANIM; //if(ent->model[0]=='*') { // trap_SetBrushModel(ent, ent->model); //} else { VectorSet (ent->r.mins, -128, -128, -128); VectorSet (ent->r.maxs, 128, 128, 128); } ent->s.frameInfo[0].weight = 1.f; G_SetOrigin( ent, ent->s.origin ); trap_LinkEntity (ent); return qtrue;#endif } G_Printf ("%s doesn't have a spawn function/n", ent->classname); return qfalse;}
开发者ID:kingtiger01,项目名称:OpenMOHAA,代码行数:80,
示例23: FinishSpawningItemvoid FinishSpawningItem( gentity_t *ent ) { trace_t tr; vec3_t dest; gitem_t *item; int itemNum; itemNum=1; for ( item = bg_itemlist + 1 ; item->classname ; item++,itemNum++) { if (!strcmp(item->classname,ent->classname)) { break; } } // Set bounding box for item VectorSet( ent->mins, item->mins[0],item->mins[1] ,item->mins[2]); VectorSet( ent->maxs, item->maxs[0],item->maxs[1] ,item->maxs[2]); if ((!ent->mins[0] && !ent->mins[1] && !ent->mins[2]) && (!ent->maxs[0] && !ent->maxs[1] && !ent->maxs[2])) { VectorSet (ent->mins, -ITEM_RADIUS, -ITEM_RADIUS, -2);//to match the comments in the items.dat file! VectorSet (ent->maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS); } if ((item->quantity) && (item->giType == IT_AMMO)) { ent->count = item->quantity; } if ((item->quantity) && (item->giType == IT_BATTERY)) { ent->count = item->quantity; }// if ( item->giType == IT_WEAPON ) // NOTE: james thought it was ok to just always do this? { ent->s.radius = 20; VectorSet( ent->s.modelScale, 1.0f, 1.0f, 1.0f ); gi.G2API_InitGhoul2Model( ent->ghoul2, ent->item->world_model, G_ModelIndex( ent->item->world_model ), NULL_HANDLE, NULL_HANDLE, 0, 0); } // Set crystal ammo amount based on skill level/* if ((itemNum == ITM_AMMO_CRYSTAL_BORG) || (itemNum == ITM_AMMO_CRYSTAL_DN) || (itemNum == ITM_AMMO_CRYSTAL_FORGE) || (itemNum == ITM_AMMO_CRYSTAL_SCAVENGER) || (itemNum == ITM_AMMO_CRYSTAL_STASIS)) { CrystalAmmoSettings(ent); }*/ ent->s.eType = ET_ITEM; ent->s.modelindex = ent->item - bg_itemlist; // store item number in modelindex ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item ent->contents = CONTENTS_TRIGGER|CONTENTS_ITEM;//CONTENTS_BODY;//CONTENTS_TRIGGER| ent->e_TouchFunc = touchF_Touch_Item; // useing an item causes it to respawn ent->e_UseFunc = useF_Use_Item; ent->svFlags |= SVF_PLAYER_USABLE;//so player can pick it up // Hang in air? ent->s.origin[2] += 1;//just to get it off the damn ground because coplanar = insolid if ( ent->spawnflags & ITMSF_SUSPEND) { // suspended G_SetOrigin( ent, ent->s.origin ); } else { // drop to floor VectorSet( dest, ent->s.origin[0], ent->s.origin[1], MIN_WORLD_COORD ); gi.trace( &tr, ent->s.origin, ent->mins, ent->maxs, dest, ent->s.number, MASK_SOLID|CONTENTS_PLAYERCLIP, G2_NOCOLLIDE, 0 ); if ( tr.startsolid ) { if ( &g_entities[tr.entityNum] != NULL ) { gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)/n", ent->classname, vtos(ent->s.origin), g_entities[tr.entityNum].classname ); } else { gi.Printf (S_COLOR_RED"FinishSpawningItem: removing %s startsolid at %s (in a %s)/n", ent->classname, vtos(ent->s.origin) ); } assert( 0 && "item starting in solid");#ifndef FINAL_BUILD if (!g_entities[ENTITYNUM_WORLD].s.radius){ //not a region delayedShutDown = level.time + 100; }#endif G_FreeEntity( ent ); return; } // allow to ride movers ent->s.groundEntityNum = tr.entityNum; G_SetOrigin( ent, tr.endpos );//.........这里部分代码省略.........
开发者ID:AlexXT,项目名称:OpenJK,代码行数:101,
示例24: turretG2_set_modelsvoid turretG2_set_models( gentity_t *self, qboolean dying ){ if ( dying ) { if ( !(self->spawnflags&SPF_TURRETG2_TURBO) ) { self->s.modelindex = G_ModelIndex( name2 ); self->s.modelindex2 = G_ModelIndex( name ); } trap_G2API_RemoveGhoul2Model( &self->ghoul2, 0 ); G_KillG2Queue( self->s.number ); self->s.modelGhoul2 = 0; /* trap_G2API_InitGhoul2Model( &self->ghoul2, name2, 0, //base->s.modelindex, //note, this is not the same kind of index - this one's referring to the actual //index of the model in the g2 instance, whereas modelindex is the index of a //configstring -rww 0, 0, 0, 0); */ } else { if ( !(self->spawnflags&SPF_TURRETG2_TURBO) ) { self->s.modelindex = G_ModelIndex( name ); self->s.modelindex2 = G_ModelIndex( name2 ); //set the new onw trap_G2API_InitGhoul2Model( &self->ghoul2, name, 0, //base->s.modelindex, //note, this is not the same kind of index - this one's referring to the actual //index of the model in the g2 instance, whereas modelindex is the index of a //configstring -rww 0, 0, 0, 0); } else { self->s.modelindex = G_ModelIndex( name3 ); //set the new onw trap_G2API_InitGhoul2Model( &self->ghoul2, name3, 0, //base->s.modelindex, //note, this is not the same kind of index - this one's referring to the actual //index of the model in the g2 instance, whereas modelindex is the index of a //configstring -rww 0, 0, 0, 0); } self->s.modelGhoul2 = 1; if ( (self->spawnflags&SPF_TURRETG2_TURBO) ) { //larger self->s.g2radius = 128; } else { self->s.g2radius = 80; } if ( (self->spawnflags&SPF_TURRETG2_TURBO) ) { //different pitch bone and muzzle flash points G2Tur_SetBoneAngles(self, "pitch", vec3_origin); self->genericValue11 = trap_G2API_AddBolt( self->ghoul2, 0, "*muzzle1" ); self->genericValue12 = trap_G2API_AddBolt( self->ghoul2, 0, "*muzzle2" ); } else { G2Tur_SetBoneAngles(self, "Bone_body", vec3_origin); self->genericValue11 = trap_G2API_AddBolt( self->ghoul2, 0, "*flash03" ); } }}
开发者ID:Atlas-zz,项目名称:SDK-JKA-ACADEMIE-HCF,代码行数:83,
示例25: SP_misc_model_gun_rack//---------------------------------------------void SP_misc_model_gun_rack( gentity_t *ent ){ gitem_t *blaster = NULL, *repeater = NULL, *rocket = NULL; int ct = 0; float ofz[3]; gitem_t *itemList[3]; // If BLASTER is checked...or nothing is checked then we'll do blasters if (( ent->spawnflags & RACK_BLASTER ) || !(ent->spawnflags & ( RACK_BLASTER | RACK_REPEATER | RACK_ROCKET ))) { blaster = FindItemForWeapon( WP_BLASTER ); } if (( ent->spawnflags & RACK_REPEATER )) { repeater = FindItemForWeapon( WP_REPEATER ); } if (( ent->spawnflags & RACK_ROCKET )) { rocket = FindItemForWeapon( WP_ROCKET_LAUNCHER ); } //---------weapon types if ( blaster ) { ofz[ct] = 23.0f; itemList[ct++] = blaster; } if ( repeater ) { ofz[ct] = 24.5f; itemList[ct++] = repeater; } if ( rocket ) { ofz[ct] = 25.5f; itemList[ct++] = rocket; } if ( ct ) //..should always have at least one item on their, but just being safe { for ( ; ct < 3 ; ct++ ) { ofz[ct] = ofz[0]; itemList[ct] = itemList[0]; // first weapon ALWAYS propagates to fill up the shelf } } // now actually add the items to the shelf...validate that we have a list to add if ( ct ) { for ( int i = 0; i < ct; i++ ) { GunRackAddItem( itemList[i], ent->s.origin, ent->s.angles, crandom() * 2, ( i - 1 ) * 9 + crandom() * 2, ofz[i] ); } } ent->s.modelindex = G_ModelIndex( "models/map_objects/kejim/weaponsrack.md3" ); G_SetOrigin( ent, ent->s.origin ); G_SetAngles( ent, ent->s.angles ); ent->contents = CONTENTS_SOLID; gi.linkentity( ent );}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:70,
示例26: FinishSpawningItem/*================FinishSpawningItemTraces down to find where an item should rest, instead of letting themfree fall from their spawn points================*/void FinishSpawningItem( gentity_t *ent ) { trace_t tr; vec3_t dest; vec3_t maxs; if ( ent->spawnflags & 1 ) { // suspended VectorSet( ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, -ITEM_RADIUS ); VectorSet( ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS ); VectorCopy( ent->r.maxs, maxs ); } else { // Rafael // had to modify this so that items would spawn in shelves VectorSet( ent->r.mins, -ITEM_RADIUS, -ITEM_RADIUS, 0 ); VectorSet( ent->r.maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS ); VectorCopy( ent->r.maxs, maxs ); maxs[2] /= 2; } ent->r.contents = CONTENTS_TRIGGER | CONTENTS_ITEM; ent->touch = Touch_Item_Auto; ent->s.eType = ET_ITEM; ent->s.modelindex = ent->item - bg_itemlist; // store item number in modelindex ent->s.otherEntityNum2 = 0; // DHM - Nerve :: takes modelindex2's place in signaling a dropped item//----(SA) we don't use this (yet, anyway) so I'm taking it so you can specify a model for treasure items and clipboards// ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item if ( ent->model ) { ent->s.modelindex2 = G_ModelIndex( ent->model ); } // if clipboard, add the menu name string to the client's configstrings if ( ent->item->giType == IT_CLIPBOARD ) { if ( !ent->message ) { ent->s.density = G_FindConfigstringIndex( "clip_test", CS_CLIPBOARDS, MAX_CLIPBOARD_CONFIGSTRINGS, qtrue ); } else { ent->s.density = G_FindConfigstringIndex( ent->message, CS_CLIPBOARDS, MAX_CLIPBOARD_CONFIGSTRINGS, qtrue ); } ent->touch = Touch_Item; // no auto-pickup, only activate } else if ( ent->item->giType == IT_HOLDABLE ) { if ( ent->item->giTag >= HI_BOOK1 && ent->item->giTag <= HI_BOOK3 ) { G_FindConfigstringIndex( va( "hbook%d", ent->item->giTag - HI_BOOK1 ), CS_CLIPBOARDS, MAX_CLIPBOARD_CONFIGSTRINGS, qtrue ); } ent->touch = Touch_Item; // no auto-pickup, only activate }//----(SA) added if ( ent->item->giType == IT_TREASURE ) { ent->touch = Touch_Item; // no auto-pickup, only activate }//----(SA) end // using an item causes it to respawn ent->use = Use_Item;//----(SA) moved this up so it happens for suspended items too (and made it a function) G_SetAngle( ent, ent->s.angles ); if ( ent->spawnflags & 1 ) { // suspended G_SetOrigin( ent, ent->s.origin ); } else { VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 ); trap_Trace( &tr, ent->s.origin, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID ); if ( tr.startsolid ) { vec3_t temp; VectorCopy( ent->s.origin, temp ); temp[2] -= ITEM_RADIUS; VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 ); trap_Trace( &tr, temp, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID ); }#if 0 // drop to floor VectorSet( dest, ent->s.origin[0], ent->s.origin[1], ent->s.origin[2] - 4096 ); trap_Trace( &tr, ent->s.origin, ent->r.mins, maxs, dest, ent->s.number, MASK_SOLID );#endif if ( tr.startsolid ) { G_Printf( "FinishSpawningItem: %s startsolid at %s/n", ent->classname, vtos( ent->s.origin ) ); G_FreeEntity( ent ); return; } // allow to ride movers ent->s.groundEntityNum = tr.entityNum;//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,
示例27: SP_emplaced_eweb//----------------------------------------------------------void SP_emplaced_eweb( gentity_t *ent ){ char name[] = "models/map_objects/hoth/eweb_model.glm"; ent->svFlags |= SVF_PLAYER_USABLE; ent->contents = CONTENTS_BODY; if ( ent->spawnflags & EMPLACED_INACTIVE ) { ent->svFlags |= SVF_INACTIVE; } VectorSet( ent->mins, -12, -12, -24 ); VectorSet( ent->maxs, 12, 12, 24 ); ent->takedamage = qtrue; if ( ( ent->spawnflags & EWEB_INVULNERABLE )) { ent->flags |= FL_GODMODE; } ent->s.radius = 80; ent->spawnflags |= 4; // deadsolid //ent->e_ThinkFunc = thinkF_NULL; ent->e_PainFunc = painF_eweb_pain; ent->e_DieFunc = dieF_eweb_die; G_EffectIndex( "emplaced/explode" ); G_EffectIndex( "emplaced/dead_smoke" ); G_SoundIndex( "sound/weapons/eweb/eweb_aim.wav" ); G_SoundIndex( "sound/weapons/eweb/eweb_dismount.mp3" ); //G_SoundIndex( "sound/weapons/eweb/eweb_empty.wav" ); G_SoundIndex( "sound/weapons/eweb/eweb_fire.wav" ); G_SoundIndex( "sound/weapons/eweb/eweb_hitplayer.wav" ); G_SoundIndex( "sound/weapons/eweb/eweb_hitsurface.wav" ); //G_SoundIndex( "sound/weapons/eweb/eweb_load.wav" ); G_SoundIndex( "sound/weapons/eweb/eweb_mount.mp3" ); // Set up our defaults and override with custom amounts as necessary G_SpawnInt( "count", "999", &ent->count ); G_SpawnInt( "health", "250", &ent->health ); G_SpawnInt( "splashDamage", "40", &ent->splashDamage ); G_SpawnInt( "splashRadius", "100", &ent->splashRadius ); G_SpawnFloat( "delay", "200", &ent->random ); // NOTE: spawning into a different field!! G_SpawnFloat( "wait", "800", &ent->wait ); ent->max_health = ent->health; ent->dflags |= DAMAGE_CUSTOM_HUD; // dumb, but we draw a custom hud ent->s.modelindex = G_ModelIndex( name ); ent->playerModel = gi.G2API_InitGhoul2Model( ent->ghoul2, name, ent->s.modelindex, NULL, NULL, 0, 0 ); // Activate our tags and bones ent->handLBolt = gi.G2API_AddBolt( &ent->ghoul2[ent->playerModel], "*cannonflash" ); //muzzle bolt ent->headBolt = gi.G2API_AddBolt( &ent->ghoul2[ent->playerModel], "cannon_Xrot" ); //for placing the owner relative to rotation ent->rootBone = gi.G2API_GetBoneIndex( &ent->ghoul2[ent->playerModel], "model_root", qtrue ); ent->lowerLumbarBone = gi.G2API_GetBoneIndex( &ent->ghoul2[ent->playerModel], "cannon_Yrot", qtrue ); ent->upperLumbarBone = gi.G2API_GetBoneIndex( &ent->ghoul2[ent->playerModel], "cannon_Xrot", qtrue ); gi.G2API_SetBoneAnglesIndex( &ent->ghoul2[ent->playerModel], ent->lowerLumbarBone, vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Z, NEGATIVE_X, NEGATIVE_Y, NULL, 0, 0); gi.G2API_SetBoneAnglesIndex( &ent->ghoul2[ent->playerModel], ent->upperLumbarBone, vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Z, NEGATIVE_X, NEGATIVE_Y, NULL, 0, 0); //gi.G2API_SetBoneAngles( &ent->ghoul2[0], "cannon_Yrot", vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL); //set the constraints for this guy as an emplaced weapon, and his constraint angles //ent->s.origin2[0] = 60.0f; //60 degrees in either direction RegisterItem( FindItemForWeapon( WP_EMPLACED_GUN )); ent->s.weapon = WP_EMPLACED_GUN; G_SetOrigin( ent, ent->s.origin ); G_SetAngles( ent, ent->s.angles ); VectorCopy( ent->s.angles, ent->lastAngles ); // store base angles for later VectorClear( ent->pos1 ); ent->e_UseFunc = useF_eweb_use; ent->bounceCount = 1;//to distinguish it from the emplaced gun gi.linkentity (ent);}
开发者ID:kikili,项目名称:OpenJK,代码行数:83,
示例28: SP_emplaced_gun//----------------------------------------------------------void SP_emplaced_gun( gentity_t *ent ){ char name[] = "models/map_objects/imp_mine/turret_chair.glm"; ent->svFlags |= SVF_PLAYER_USABLE; ent->contents = CONTENTS_BODY;//CONTENTS_SHOTCLIP|CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP;//CONTENTS_SOLID; if ( ent->spawnflags & EMPLACED_INACTIVE ) { ent->svFlags |= SVF_INACTIVE; } VectorSet( ent->mins, -30, -30, -5 ); VectorSet( ent->maxs, 30, 30, 60 ); ent->takedamage = qtrue; if ( !( ent->spawnflags & EMPLACED_VULNERABLE )) { ent->flags |= FL_GODMODE; } ent->s.radius = 110; ent->spawnflags |= 4; // deadsolid //ent->e_ThinkFunc = thinkF_NULL; ent->e_PainFunc = painF_emplaced_gun_pain; ent->e_DieFunc = dieF_emplaced_gun_die; G_EffectIndex( "emplaced/explode" ); G_EffectIndex( "emplaced/dead_smoke" ); G_SoundIndex( "sound/weapons/emplaced/emplaced_mount.mp3" ); G_SoundIndex( "sound/weapons/emplaced/emplaced_dismount.mp3" ); G_SoundIndex( "sound/weapons/emplaced/emplaced_move_lp.wav" ); // Set up our defaults and override with custom amounts as necessary G_SpawnInt( "count", "999", &ent->count ); G_SpawnInt( "health", "250", &ent->health ); G_SpawnInt( "splashDamage", "80", &ent->splashDamage ); G_SpawnInt( "splashRadius", "128", &ent->splashRadius ); G_SpawnFloat( "delay", "200", &ent->random ); // NOTE: spawning into a different field!! G_SpawnFloat( "wait", "800", &ent->wait ); ent->max_health = ent->health; ent->dflags |= DAMAGE_CUSTOM_HUD; // dumb, but we draw a custom hud ent->s.modelindex = G_ModelIndex( name ); ent->playerModel = gi.G2API_InitGhoul2Model( ent->ghoul2, name, ent->s.modelindex, NULL, NULL, 0, 0 ); // Activate our tags and bones ent->headBolt = gi.G2API_AddBolt( &ent->ghoul2[ent->playerModel], "*seat" ); ent->handLBolt = gi.G2API_AddBolt( &ent->ghoul2[ent->playerModel], "*flash01" ); ent->handRBolt = gi.G2API_AddBolt( &ent->ghoul2[ent->playerModel], "*flash02" ); ent->rootBone = gi.G2API_GetBoneIndex( &ent->ghoul2[ent->playerModel], "base_bone", qtrue ); ent->lowerLumbarBone = gi.G2API_GetBoneIndex( &ent->ghoul2[ent->playerModel], "swivel_bone", qtrue ); gi.G2API_SetBoneAnglesIndex( &ent->ghoul2[ent->playerModel], ent->lowerLumbarBone, vec3_origin, BONE_ANGLES_POSTMULT, POSITIVE_Y, POSITIVE_Z, POSITIVE_X, NULL, 0, 0); RegisterItem( FindItemForWeapon( WP_EMPLACED_GUN )); ent->s.weapon = WP_EMPLACED_GUN; G_SetOrigin( ent, ent->s.origin ); G_SetAngles( ent, ent->s.angles ); VectorCopy( ent->s.angles, ent->lastAngles ); // store base angles for later VectorCopy( ent->s.angles, ent->pos1 ); ent->e_UseFunc = useF_emplaced_gun_use; ent->bounceCount = 0;//to distinguish it from the eweb gi.linkentity (ent);}
开发者ID:kikili,项目名称:OpenJK,代码行数:74,
示例29: FinishSpawningItemvoid FinishSpawningItem( gentity_t *ent ) { trace_t tr; vec3_t dest; gitem_t *item; int itemNum; itemNum=1; for ( item = bg_itemlist + 1 ; item->classname ; item++,itemNum++) { if (!strcmp(item->classname,ent->classname)) { break; } } // Set bounding box for item VectorSet( ent->mins, item->mins[0],item->mins[1] ,item->mins[2]); VectorSet( ent->maxs, item->maxs[0],item->maxs[1] ,item->maxs[2]); if ((!ent->mins[0] && !ent->mins[1] && !ent->mins[2]) && (!ent->maxs[0] && !ent->maxs[1] && !ent->maxs[2])) { VectorSet (ent->mins, -ITEM_RADIUS, -ITEM_RADIUS, -2);//to match the comments in the items.dat file! VectorSet (ent->maxs, ITEM_RADIUS, ITEM_RADIUS, ITEM_RADIUS); } if ((item->quantity) && (item->giType == IT_AMMO)) { ent->count = item->quantity; } if ((item->quantity) && (item->giType == IT_BATTERY)) { ent->count = item->quantity; } ent->s.radius = 20; VectorSet( ent->s.modelScale, 1.0f, 1.0f, 1.0f ); if ( ent->item->giType == IT_WEAPON && ent->item->giTag == WP_SABER && ent->NPC_type && ent->NPC_type[0] ) { saberInfo_t itemSaber; if ( Q_stricmp( "player", ent->NPC_type ) == 0 && g_saber->string && g_saber->string[0] && Q_stricmp( "none", g_saber->string ) && Q_stricmp( "NULL", g_saber->string ) ) {//player's saber WP_SaberParseParms( g_saber->string, &itemSaber ); } else {//specific saber WP_SaberParseParms( ent->NPC_type, &itemSaber ); } //NOTE: should I keep this string around for any reason? Will I ever need it later? //ent->??? = G_NewString( itemSaber.model ); gi.G2API_InitGhoul2Model( ent->ghoul2, itemSaber.model, G_ModelIndex( itemSaber.model ), NULL_HANDLE, NULL_HANDLE, 0, 0); WP_SaberFreeStrings(itemSaber); } else { gi.G2API_InitGhoul2Model( ent->ghoul2, ent->item->world_model, G_ModelIndex( ent->item->world_model ), NULL_HANDLE, NULL_HANDLE, 0, 0); } // Set crystal ammo amount based on skill level/* if ((itemNum == ITM_AMMO_CRYSTAL_BORG) || (itemNum == ITM_AMMO_CRYSTAL_DN) || (itemNum == ITM_AMMO_CRYSTAL_FORGE) || (itemNum == ITM_AMMO_CRYSTAL_SCAVENGER) || (itemNum == ITM_AMMO_CRYSTAL_STASIS)) { CrystalAmmoSettings(ent); }*/ ent->s.eType = ET_ITEM; ent->s.modelindex = ent->item - bg_itemlist; // store item number in modelindex ent->s.modelindex2 = 0; // zero indicates this isn't a dropped item ent->contents = CONTENTS_TRIGGER|CONTENTS_ITEM;//CONTENTS_BODY;//CONTENTS_TRIGGER| ent->e_TouchFunc = touchF_Touch_Item; // useing an item causes it to respawn ent->e_UseFunc = useF_Use_Item; ent->svFlags |= SVF_PLAYER_USABLE;//so player can pick it up // Hang in air? ent->s.origin[2] += 1;//just to get it off the damn ground because coplanar = insolid if ( (ent->spawnflags&ITMSF_SUSPEND) || (ent->flags&FL_DROPPED_ITEM) ) { // suspended G_SetOrigin( ent, ent->s.origin ); } else { // drop to floor VectorSet( dest, ent->s.origin[0], ent->s.origin[1], MIN_WORLD_COORD ); gi.trace( &tr, ent->s.origin, ent->mins, ent->maxs, dest, ent->s.number, MASK_SOLID|CONTENTS_PLAYERCLIP, (EG2_Collision)0, 0 );//.........这里部分代码省略.........
开发者ID:Almightygir,项目名称:OpenJK,代码行数:101,
示例30: misc_model_breakable_init//initization for misc_model_breakablevoid misc_model_breakable_init( gentity_t *ent ){ int type; type = MDL_OTHER; if (!ent->model) { G_Error("no model set on %s at (%.1f %.1f %.1f)/n", ent->classname, ent->s.origin[0],ent->s.origin[1],ent->s.origin[2]); } //Main model ent->s.modelindex = ent->sound2to1 = G_ModelIndex( ent->model ); if ( ent->spawnflags & 1 ) {//Blocks movement ent->r.contents = CONTENTS_SOLID|CONTENTS_OPAQUE|CONTENTS_BODY|CONTENTS_MONSTERCLIP|CONTENTS_BOTCLIP;//Was CONTENTS_SOLID, but only architecture should be this ent->s.solid = 2; //SOLID_BBOX ent->clipmask = MASK_PLAYERSOLID; } else if ( ent->health ) {//Can only be shot ent->r.contents = CONTENTS_SHOTCLIP; } if (type == MDL_OTHER) { ent->use = misc_model_use; } else if ( type == MDL_ARMOR_HEALTH ) {// G_SoundIndex("sound/player/suithealth.wav"); ent->use = health_use; if (!ent->count) { ent->count = 100; } ent->health = 60; } else if ( type == MDL_AMMO ) {// G_SoundIndex("sound/player/suitenergy.wav"); //RAFIXME: add this use function ent->use = ammo_use; if (!ent->count) { ent->count = 100; } ent->health = 60; } if ( ent->health ) { G_SoundIndex("sound/weapons/explosions/cargoexplode.wav"); ent->maxHealth = ent->health; G_ScaleNetHealth(ent); ent->takedamage = qtrue; ent->pain = misc_model_breakable_pain; //RACC - I think should be ->die ent->die = misc_model_breakable_die; //ent->think = misc_model_breakable_die; } ent->touch = misc_model_breakable_touch;}
开发者ID:ForcePush,项目名称:OJPRPFZ,代码行数:66,
注:本文中的G_ModelIndex函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ G_N_ELEMENTS函数代码示例 C++ G_MOUNT函数代码示例 |