void SP_misc_beam(gentity_t *self) { char *str; G_SpawnString("target2", "", &str); if (*str) { self->message = G_NewString(str); } G_SpawnString("shader", "lightningBolt", &str); if (*str) { self->s.modelindex2 = G_ShaderIndex(str); } G_SpawnInt("scale", "1", &self->s.torsoAnim); G_SpawnVector("color", "1 1 1", self->s.angles2); // let everything else get spawned before we start firing self->accuracy = 0; self->think = misc_beam_start; self->nextthink = level.time + FRAMETIME; }
/*QUAKED script_mover (0.5 0.25 1.0) ? TRIGGERSPAWN SOLID EXPLOSIVEDAMAGEONLY Scripted brush entity. A simplified means of moving brushes around based on events. "modelscale" - Scale multiplier (defaults to 1, and scales uniformly) "modelscale_vec" - Set scale per-axis. Overrides "modelscale", so if you have both the "modelscale" is ignored "model2" optional md3 to draw over the solid clip brush "scriptname" name used for scripting purposes (like aiName in AI scripting) "health" optionally make this entity damagable */ void SP_script_mover( gentity_t *ent ) { float scale[3] = {1,1,1}; vec3_t scalevec; if ( !ent->model ) { G_Error( "script_model_med must have a \"model\"\n" ); } if ( !ent->scriptName ) { G_Error( "script_model_med must have a \"scriptname\"\n" ); } ent->blocked = script_mover_blocked; // first position at start VectorCopy( ent->s.origin, ent->pos1 ); // VectorCopy( ent->r.currentOrigin, ent->pos1 ); VectorCopy( ent->pos1, ent->pos2 ); // don't go anywhere just yet trap_SetBrushModel( ent, ent->model ); InitMover( ent ); ent->reached = NULL; if ( ent->spawnflags & 1 ) { ent->use = script_mover_use; trap_UnlinkEntity( ent ); // make sure it's not visible return; } G_SetAngle( ent, ent->s.angles ); G_SpawnInt( "health", "0", &ent->health ); if ( ent->health ) { ent->takedamage = qtrue; } ent->die = script_mover_die; ent->pain = script_mover_pain; // look for general scaling if ( G_SpawnFloat( "modelscale", "1", &scale[0] ) ) { scale[2] = scale[1] = scale[0]; } // look for axis specific scaling if ( G_SpawnVector( "modelscale_vec", "1 1 1", &scalevec[0] ) ) { VectorCopy( scalevec, scale ); } if ( scale[0] != 1 || scale[1] != 1 || scale[2] != 1 ) { // ent->s.eType = ET_MOVERSCALED; ent->s.density = ET_MOVERSCALED; // scale is stored in 'angles2' VectorCopy( scale, ent->s.angles2 ); } script_mover_spawn( ent ); }
static void InitBBrush ( gentity_t *ent ) { float light; vec3_t color; qboolean lightSet, colorSet; VectorCopy( ent->s.origin, ent->pos1 ); gi.SetBrushModel( ent, ent->model ); ent->e_DieFunc = dieF_funcBBrushDie; ent->svFlags |= SVF_BBRUSH; // 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 "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 ); } if(ent->spawnflags & 128) {//Can be used by the player's BUTTON_USE ent->svFlags |= SVF_PLAYER_USABLE; } ent->s.eType = ET_MOVER; gi.linkentity (ent); ent->s.pos.trType = TR_STATIONARY; VectorCopy( ent->pos1, ent->s.pos.trBase ); }
/*QUAKED script_mover (0.5 0.25 1.0) ? TRIGGERSPAWN SOLID EXPLOSIVEDAMAGEONLY RESURECTABLE COMPASS ALLIED AXIS MOUNTED_GUN Scripted brush entity. A simplified means of moving brushes around based on events. "modelscale" - Scale multiplier (defaults to 1, and scales uniformly) "modelscale_vec" - Set scale per-axis. Overrides "modelscale", so if you have both the "modelscale" is ignored "model2" optional md3 to draw over the solid clip brush "scriptname" name used for scripting purposes (like aiName in AI scripting) "health" optionally make this entity damagable "description" used with health, if the entity is damagable, it draws a healthbar with this description above it. */ void SP_script_mover(gentity_t *ent) { float scale[3] = { 1, 1, 1 }; vec3_t scalevec; char *modelname; char *tagent; char *s; if (!ent->model) { G_Error("script_mover must have a \"model\"\n"); } if (!ent->scriptName) { G_Error("script_mover must have a \"scriptname\"\n"); } ent->blocked = script_mover_blocked; // first position at start VectorCopy(ent->s.origin, ent->pos1); VectorCopy(ent->pos1, ent->pos2); // don't go anywhere just yet trap_SetBrushModel(ent, ent->model); InitMover(ent); ent->reached = NULL; ent->s.animMovetype = 0; ent->s.density = 0; if (ent->spawnflags & 256) { ent->s.density |= 2; } if (ent->spawnflags & 8) { ent->use = script_mover_use; } if (ent->spawnflags & 16) { ent->s.time2 = 1; } else { ent->s.time2 = 0; } if (ent->spawnflags & 32) { ent->s.teamNum = TEAM_ALLIES; } else if (ent->spawnflags & 64) { ent->s.teamNum = TEAM_AXIS; } else { ent->s.teamNum = TEAM_FREE; } if (ent->spawnflags & 1) { ent->use = script_mover_use; trap_UnlinkEntity(ent); // make sure it's not visible return; } G_SetAngle(ent, ent->s.angles); G_SpawnInt("health", "0", &ent->health); if (ent->health) { ent->takedamage = qtrue; ent->count = ent->health; // client needs to know about it as well ent->s.effect1Time = ent->count; ent->s.dl_intensity = 255; if (G_SpawnString("description", "", &s)) { char cs[MAX_INFO_STRING]; trap_GetConfigstring(CS_SCRIPT_MOVER_NAMES, cs, sizeof (cs)); Info_SetValueForKey(cs, va("%d", (int)(ent - g_entities)), s); trap_SetConfigstring(CS_SCRIPT_MOVER_NAMES, cs); } } else { ent->count = 0; } ent->die = script_mover_die; // look for general scaling if (G_SpawnFloat("modelscale", "1", &scale[0])) { scale[2] = scale[1] = scale[0]; } if (G_SpawnString("model2", "", &modelname)) { char tagname[MAX_QPATH]; COM_StripExtension(modelname, tagname); Q_strcat(tagname, MAX_QPATH, ".tag"); ent->tagNumber = trap_LoadTag(tagname); } // look for axis specific scaling if (G_SpawnVector("modelscale_vec", "1 1 1", &scalevec[0])) { VectorCopy(scalevec, scale); } if (scale[0] != 1 || scale[1] != 1 || scale[2] != 1) { ent->s.density |= 1; // scale is stored in 'angles2' VectorCopy(scale, ent->s.angles2); } if (ent->spawnflags & 128) { ent->s.density |= 4; ent->waterlevel = 0; if (G_SpawnString("gun", "", &modelname) && !Q_stricmp(modelname, "browning")) { ent->s.density |= 8; } G_SpawnString("tagent", "", &tagent); Q_strncpyz(ent->tagBuffer, tagent, 16); ent->s.powerups = -1; } ent->think = script_mover_spawn; ent->nextthink = level.time + FRAMETIME; }
/* ================ 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; } }
void SP_CreateRain( gentity_t *ent ) { // Different Types Of Rain //------------------------- if (ent->spawnflags & 1) { G_FindConfigstringIndex("lightrain", CS_WORLD_FX, MAX_WORLD_FX, qtrue); } else if (ent->spawnflags & 2) { G_FindConfigstringIndex("rain", CS_WORLD_FX, MAX_WORLD_FX, qtrue); } else if (ent->spawnflags & 4) { G_FindConfigstringIndex("heavyrain", CS_WORLD_FX, MAX_WORLD_FX, qtrue); // Automatically Get Heavy Fog //----------------------------- G_FindConfigstringIndex("heavyrainfog", CS_WORLD_FX, MAX_WORLD_FX, qtrue ); // Automatically Get Lightning & Thunder //--------------------------------------- ent->spawnflags |= 64; } else if (ent->spawnflags & 8) { G_EffectIndex( "world/acid_fizz" ); G_FindConfigstringIndex("acidrain", CS_WORLD_FX, MAX_WORLD_FX, qtrue); } // OUTSIDE SHAKE //=============== if (ent->spawnflags & 16) { G_FindConfigstringIndex("outsideShake", CS_WORLD_FX, MAX_WORLD_FX, qtrue); } // MISTY FOG //=========== if (ent->spawnflags & 32) { G_FindConfigstringIndex("fog", CS_WORLD_FX, MAX_WORLD_FX, qtrue ); } // LIGHTNING //=========== if (ent->spawnflags & 64) { G_SoundIndex("sound/ambience/thunder1"); G_SoundIndex("sound/ambience/thunder2"); G_SoundIndex("sound/ambience/thunder3"); G_SoundIndex("sound/ambience/thunder4"); G_SoundIndex("sound/ambience/thunder_close1"); G_SoundIndex("sound/ambience/thunder_close2"); G_EffectIndex( "env/huge_lightning" ); ent->e_ThinkFunc = thinkF_fx_rain_think; ent->nextthink = level.time + Q_irand(4000, 8000); if (!G_SpawnVector( "flashcolor", "200 200 200", ent->pos3)) { VectorSet(ent->pos3, 200, 200, 200); } VectorClear(ent->pos2); // the "off" color G_SpawnInt("flashdelay", "12000", &ent->delay); G_SpawnInt("chanceflicker", "2", &ent->attackDebounceTime); G_SpawnInt("chancesound", "3", &ent->pushDebounceTime); G_SpawnInt("chanceeffect", "4", &ent->aimDebounceTime); } }
/*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 ); } //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); } // Scale up the tie-bomber bbox a little. if ( ent->model && Q_stricmp( "models/map_objects/ships/tie_bomber.md3", ent->model ) == 0 ) { VectorSet (ent->mins, -80, -80, -80); VectorSet (ent->maxs, 80, 80, 80); //ent->s.modelScale[ 0 ] = ent->s.modelScale[ 1 ] = ent->s.modelScale[ 2 ] *= 2.0f; //bHasScale = qtrue; } if (bHasScale) { //scale the x axis of the bbox up. ent->maxs[0] *= ent->s.modelScale[0];//*scaleFactor; ent->mins[0] *= ent->s.modelScale[0];//*scaleFactor; //scale the y axis of the bbox up. ent->maxs[1] *= ent->s.modelScale[1];//*scaleFactor; ent->mins[1] *= ent->s.modelScale[1];//*scaleFactor; //scale the z axis of the bbox up and adjust origin accordingly ent->maxs[2] *= ent->s.modelScale[2]; float oldMins2 = ent->mins[2]; ent->mins[2] *= ent->s.modelScale[2]; ent->s.origin[2] += (oldMins2-ent->mins[2]); } if ( ent->spawnflags & 2 ) { ent->s.eFlags |= EF_ANIM_ALLFAST; } G_SetOrigin( ent, ent->s.origin ); G_SetAngles( ent, ent->s.angles ); gi.linkentity (ent); if ( ent->spawnflags & 128 ) {//Can be used by the player's BUTTON_USE ent->svFlags |= SVF_PLAYER_USABLE; } if ( ent->team && ent->team[0] ) { ent->noDamageTeam = (team_t)GetIDForString( TeamTable, ent->team ); if ( ent->noDamageTeam == TEAM_FREE ) { G_Error("team name %s not recognized\n", ent->team); } } ent->team = NULL; //HACK if ( ent->model && Q_stricmp( "models/map_objects/ships/x_wing_nogear.md3", ent->model ) == 0 ) { if( ent->splashDamage > 0 && ent->splashRadius > 0 ) { ent->s.loopSound = G_SoundIndex( "sound/vehicles/x-wing/loop.wav" ); ent->s.eFlags |= EF_LESS_ATTEN; } } else if ( ent->model && Q_stricmp( "models/map_objects/ships/tie_fighter.md3", ent->model ) == 0 ) {//run a think G_EffectIndex( "explosions/fighter_explosion2" ); G_SoundIndex( "sound/weapons/tie_fighter/tiepass1.wav" ); /* G_SoundIndex( "sound/weapons/tie_fighter/tiepass2.wav" ); G_SoundIndex( "sound/weapons/tie_fighter/tiepass3.wav" ); G_SoundIndex( "sound/weapons/tie_fighter/tiepass4.wav" ); G_SoundIndex( "sound/weapons/tie_fighter/tiepass5.wav" );*/ G_SoundIndex( "sound/weapons/tie_fighter/tie_fire.wav" ); /* G_SoundIndex( "sound/weapons/tie_fighter/tie_fire2.wav" ); G_SoundIndex( "sound/weapons/tie_fighter/tie_fire3.wav" );*/ G_SoundIndex( "sound/weapons/tie_fighter/TIEexplode.wav" ); RegisterItem( FindItemForWeapon( WP_TIE_FIGHTER )); ent->s.eFlags |= EF_LESS_ATTEN; if( ent->splashDamage > 0 && ent->splashRadius > 0 ) { ent->s.loopSound = G_SoundIndex( "sound/vehicles/tie-bomber/loop.wav" ); //ent->e_ThinkFunc = thinkF_TieFighterThink; //ent->e_UseFunc = thinkF_TieFighterThink; //ent->nextthink = level.time + FRAMETIME; ent->e_UseFunc = useF_TieFighterUse; // Yeah, I could have just made this value changable from the editor, but I // need it immediately! float light; vec3_t color; qboolean lightSet, colorSet; // if the "color" or "light" keys are set, setup constantLight lightSet = qtrue;//G_SpawnFloat( "light", "100", &light ); light = 255; //colorSet = "1 1 1"//G_SpawnVector( "color", "1 1 1", color ); colorSet = qtrue; color[0] = 1; color[1] = 1; color[2] = 1; 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 ); } } } else if ( ent->model && Q_stricmp( "models/map_objects/ships/tie_bomber.md3", ent->model ) == 0 ) { G_EffectIndex( "ships/tiebomber_bomb_falling" ); G_EffectIndex( "ships/tiebomber_explosion2" ); G_EffectIndex( "explosions/fighter_explosion2" ); G_SoundIndex( "sound/weapons/tie_fighter/TIEexplode.wav" ); ent->e_ThinkFunc = thinkF_TieBomberThink; ent->nextthink = level.time + FRAMETIME; ent->attackDebounceTime = level.time + 1000; // We only take damage from a heavy weapon class missiles. ent->flags |= FL_DMG_BY_HEAVY_WEAP_ONLY; ent->s.loopSound = G_SoundIndex( "sound/vehicles/tie-bomber/loop.wav" ); ent->s.eFlags |= EF_LESS_ATTEN; } float grav = 0; G_SpawnFloat( "gravity", "0", &grav ); if ( grav ) {//affected by gravity G_SetAngles( ent, ent->s.angles ); G_SetOrigin( ent, ent->currentOrigin ); G_SpawnString( "throwtarget", NULL, &ent->target4 ); // used to throw itself at something misc_model_breakable_gravity_init( ent, qtrue ); } // Start off. if ( ent->spawnflags & 4096 ) { ent->spawnContents = ent->contents; // It Navs can temporarly turn it "on" ent->s.solid = 0; ent->contents = 0; ent->clipmask = 0; ent->svFlags |= SVF_NOCLIENT; ent->s.eFlags |= EF_NODRAW; ent->count = 0; } int forceVisible = 0; G_SpawnInt( "forcevisible", "0", &forceVisible ); if ( forceVisible ) {//can see these through walls with force sight, so must be broadcast //ent->svFlags |= SVF_BROADCAST; ent->s.eFlags |= EF_FORCE_VISIBLE; } int redCrosshair = 0; G_SpawnInt( "redCrosshair", "0", &redCrosshair ); if ( redCrosshair ) {//can see these through walls with force sight, so must be broadcast ent->flags |= FL_RED_CROSSHAIR; } }
void 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, NULL_HANDLE, NULL_HANDLE, 0, 0); ent->s.radius = 50; G_SetOrigin( ent, ent->s.origin ); G_SetAngles( ent, ent->s.angles ); qboolean bHasScale = G_SpawnVector( "modelscale_vec", "1 1 1", 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; } } if ( bHasScale ) { //scale the x axis of the bbox up. ent->maxs[0] *= ent->s.modelScale[0]; ent->mins[0] *= ent->s.modelScale[0]; //scale the y axis of the bbox up. ent->maxs[1] *= ent->s.modelScale[1]; ent->mins[1] *= ent->s.modelScale[1]; //scale the z axis of the bbox up and adjust origin accordingly ent->maxs[2] *= ent->s.modelScale[2]; float oldMins2 = ent->mins[2]; ent->mins[2] *= ent->s.modelScale[2]; ent->s.origin[2] += (oldMins2 - ent->mins[2]); } gi.linkentity (ent); #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 }