// show/hide flag void RegenFlags( qbool yes ) { gedict_t *flag; flag = find( world, FOFCLSN, "item_flag_team1" ); if ( flag ) { if ( !yes ) { flag->s.v.touch = (func_t) SUB_Null; setmodel( flag, "" ); } else RegenFlag( flag ); } flag = find( world, FOFCLSN, "item_flag_team2" ); if ( flag ) { if ( !yes ) { flag->s.v.touch = (func_t) SUB_Null; setmodel( flag, "" ); } else RegenFlag( flag ); } }
void spawn_item_flag() { if ( k_ctf_custom_models ) setmodel( self, "progs/flag.mdl" ); self->s.v.noise = "misc/flagtk.wav"; self->s.v.noise1 = "doors/runetry.wav"; setsize( self, -16, -16, 0, 16, 16, 74); self->mdl = self->s.v.model; self->s.v.flags = FL_ITEM; self->s.v.solid = SOLID_TRIGGER; self->s.v.movetype = MOVETYPE_TOSS; SetVector( self->s.v.velocity, 0, 0, 0 ); self->s.v.origin[2] += 6; self->s.v.think = (func_t) FlagThink; self->s.v.touch = (func_t) FlagTouch; self->s.v.nextthink = g_globalvars.time + 0.1; self->cnt = FLAG_AT_BASE; self->cnt2 = 0.0; VectorCopy( self->s.v.angles, self->mangle ); self->s.v.effects = (int) self->s.v.effects | EF_DIMLIGHT; if ( !droptofloor( self ) ) ent_remove( self ); else VectorCopy( self->s.v.origin, self->s.v.oldorigin ); if ( !isCTF() ) { setmodel( self, "" ); self->s.v.touch = (func_t) SUB_Null; } }
// create a flame of a given type, maintaining the count for each type gedict_t *FlameSpawn( int type, gedict_t * p_owner ) { if ( tf_data.cb_prematch_time > g_globalvars.time ) return world; /* if ( type != 1 && !tf_data.lan_mode ) return world;*/ num_world_flames = num_world_flames + 1; while ( num_world_flames > FLAME_MAXWORLDNUM ) { if ( !RemoveFlameFromQueue( type ) ) return world; } newmis = spawn( ); // to keep track of the number of each type of flames switch ( type ) { case 1: newmis->s.v.movetype = MOVETYPE_FLYMISSILE; newmis->s.v.solid = SOLID_BBOX; newmis->s.v.effects = 8; newmis->flame_id = "1"; setmodel( newmis, "progs/flame2.mdl" ); setsize( newmis, 0, 0, 0, 0, 0, 0 ); break; case 2: newmis->s.v.movetype = MOVETYPE_BOUNCE; newmis->s.v.solid = SOLID_BBOX; newmis->flame_id = "2"; setmodel( newmis, "progs/flame2.mdl" ); newmis->s.v.frame = 1; setsize( newmis, 0, 0, 0, 0, 0, 0 ); break; case 3: newmis->s.v.movetype = MOVETYPE_FLYMISSILE; newmis->s.v.solid = SOLID_BBOX; newmis->flame_id = "3"; setmodel( newmis, "progs/flame2.mdl" ); setsize( newmis, 0, 0, 0, 0, 0, 0 ); break; case 4: newmis->s.v.movetype = MOVETYPE_FLYMISSILE; newmis->flame_id = "4"; newmis->s.v.frame = 1; newmis->s.v.solid = SOLID_BBOX; setmodel( newmis, "progs/flame2.mdl" ); setsize( newmis, 0, 0, 0, 0, 0, 0 ); break; } newmis->s.v.owner = EDICT_TO_PROG( p_owner ); return newmis; }
void SG_Static( ) { if ( self->s.v.health == 0 ) { setmodel( self, "progs/turrgun.mdl" ); self->s.v.health = -1; } else { setmodel( self, "" ); self->s.v.health = 0; } self->s.v.nextthink = g_globalvars.time + 0.5; }
void viewthing() { self->s.v.movetype = MOVETYPE_NONE; self->s.v.solid = SOLID_NOT; trap_precache_model( "progs/player.mdl" ); setmodel( self, "progs/player.mdl" ); }
void fire_fly() { gedict_t *fireball; fireball = spawn(); fireball->s.v.solid = SOLID_TRIGGER; fireball->s.v.movetype = MOVETYPE_TOSS; fireball->isMissile = true; // well, you can really treat fireball as missilie, nothing bad gonna heppen. SetVector( fireball->s.v.velocity, ( g_random() * 100 ) - 50, ( g_random() * 100 ) - 50, self->speed + ( g_random() * 200 ) ); fireball->classname = "fireball"; setmodel( fireball, "progs/lavaball.mdl" ); setsize( fireball, 0, 0, 0, 0, 0, 0 ); setorigin( fireball, PASSVEC3( self->s.v.origin ) ); fireball->s.v.nextthink = g_globalvars.time + 5; fireball->think = ( func_t ) SUB_Remove; fireball->touch = ( func_t ) fire_touch; self->s.v.nextthink = g_globalvars.time + ( g_random() * 5 ) + 3; self->think = ( func_t ) fire_fly; }
/*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF Small white flame ball */ void SP_light_flame_small_white() { trap_precache_model( "progs/flame2.mdl" ); setmodel( self, "progs/flame2.mdl" ); FireAmbient( self ); makestatic( self ); }
/*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20) Short wall torch Default light value is 200 Default style is 0 */ void SP_light_torch_small_walltorch() { trap_precache_model( "progs/flame.mdl" ); setmodel( self, "progs/flame.mdl" ); FireAmbient( self ); makestatic( self ); }
void LaunchLaser( vec3_t org, vec3_t vec ) { if ( !strcmp( self->s.v.classname, "monster_enforcer" ) ) sound( self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM ); normalize( vec, vec ); newmis = spawn( ); g_globalvars.newmis = EDICT_TO_PROG( newmis ); newmis->s.v.owner = EDICT_TO_PROG( self ); newmis->s.v.movetype = MOVETYPE_FLY; newmis->s.v.solid = SOLID_BBOX; newmis->s.v.effects = EF_DIMLIGHT; setmodel( newmis, "progs/laser.mdl" ); setsize( newmis, 0, 0, 0, 0, 0, 0 ); setorigin( newmis, PASSVEC3( org ) ); //newmis->s.v.velocity = vec * 600; VectorScale( vec, 600, newmis->s.v.velocity ); vectoangles( newmis->s.v.velocity, newmis->s.v.angles ); newmis->s.v.nextthink = g_globalvars.time + 5; newmis->s.v.think = ( func_t ) SUB_Remove; newmis->s.v.touch = ( func_t ) Laser_Touch; }
void DeathBubblesSpawn() { gedict_t *bubble; if ( PROG_TO_EDICT( self->s.v.owner )->s.v.waterlevel != 3 ) return; bubble = spawn(); setmodel( bubble, "progs/s_bubble.spr" ); setorigin( bubble, PROG_TO_EDICT( self->s.v.owner )->s.v.origin[0], PROG_TO_EDICT( self->s.v.owner )->s.v.origin[1], PROG_TO_EDICT( self->s.v.owner )->s.v.origin[2] + 24 ); bubble->s.v.movetype = MOVETYPE_NOCLIP; bubble->s.v.solid = SOLID_NOT; SetVector( bubble->s.v.velocity, 0, 0, 15 ); bubble->s.v.nextthink = g_globalvars.time + 0.5; bubble->think = ( func_t ) bubble_bob; bubble->classname = "bubble"; bubble->s.v.frame = 0; bubble->cnt = 0; setsize( bubble, -8, -8, -8, 8, 8, 8 ); self->s.v.nextthink = g_globalvars.time + 0.1; self->think = ( func_t ) DeathBubblesSpawn; self->air_finished = self->air_finished + 1; if ( self->air_finished >= self->bubble_count ) ent_remove( self ); }
void show_specs_wizards () { gedict_t *p; for( p = world; (p = find( p, FOFCLSN, "spectator_wizard" )); ) setmodel (p, "progs/wizard.mdl"); }
// would love to know what a ctf wall is :O! void SP_func_ctf_wall() { SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.movetype = MOVETYPE_PUSH; self->s.v.solid = SOLID_BSP; setmodel( self, self->s.v.model ); }
void fire_fly( ) { gedict_t *fireball; fireball = spawn( ); newmis = fireball; g_globalvars.newmis = EDICT_TO_PROG( newmis ); fireball->s.v.solid = SOLID_TRIGGER; fireball->s.v.movetype = MOVETYPE_TOSS; SetVector( fireball->s.v.velocity, ( g_random( ) * 100 ) - 50, ( g_random( ) * 100 ) - 50, self->speed + ( g_random( ) * 200 ) ); fireball->s.v.classname = "fireball"; setmodel( fireball, "progs/lavaball.mdl" ); setsize( fireball, 0, 0, 0, 0, 0, 0 ); setorigin( fireball, PASSVEC3( self->s.v.origin ) ); fireball->s.v.nextthink = g_globalvars.time + 5; fireball->s.v.think = ( func_t ) SUB_Remove; fireball->s.v.touch = ( func_t ) fire_touch; self->s.v.nextthink = g_globalvars.time + ( g_random( ) * 5 ) + 3; self->s.v.think = ( func_t ) fire_fly; }
void DropRing( float timeleft ) { gedict_t *item; item = spawn(); VectorCopy( self->s.v.origin, item->s.v.origin ); //item.origin = self.origin; item->s.v.velocity[2] = 300; item->s.v.velocity[0] = -100 + ( g_random() * 200 ); item->s.v.velocity[1] = -100 + ( g_random() * 200 ); item->s.v.flags = FL_ITEM; item->s.v.solid = SOLID_TRIGGER; item->s.v.movetype = MOVETYPE_TOSS; item->s.v.noise = "items/inv1.wav"; setmodel( item, "progs/invisibl.mdl" ); setsize( item, -16, -16, -24, 16, 16, 32 ); item->cnt = g_globalvars.time + timeleft; item->s.v.touch = ( func_t ) r_touch; item->s.v.nextthink = g_globalvars.time + timeleft; // remove after 30 seconds item->s.v.think = ( func_t ) SUB_Remove; }
/* ================ SpawnMeatSpray ================ */ void SpawnMeatSpray( vec3_t org, vec3_t vel ) { gedict_t *missile; //vec3_t org; missile = spawn(); missile->s.v.owner = EDICT_TO_PROG( self ); missile->s.v.movetype = MOVETYPE_BOUNCE; missile->s.v.solid = SOLID_NOT; makevectors( self->s.v.angles ); VectorCopy( vel, missile->s.v.velocity ); // missile->s.v.velocity = vel; missile->s.v.velocity[2] = missile->s.v.velocity[2] + 250 + 50 * g_random(); SetVector( missile->s.v.avelocity, 3000, 1000, 2000 ); // missile.avelocity = '3000 1000 2000'; // set missile duration missile->s.v.nextthink = g_globalvars.time + 1; missile->s.v.think = ( func_t ) SUB_Remove; setmodel( missile, "progs/zom_gib.mdl" ); setsize( missile, 0, 0, 0, 0, 0, 0 ); setorigin( missile, PASSVEC3( org ) ); }
void bubble_split( ) { gedict_t *bubble; bubble = spawn( ); setmodel( bubble, "progs/s_bubble.spr" ); setorigin( bubble, PASSVEC3( self->s.v.origin ) ); bubble->s.v.movetype = MOVETYPE_NOCLIP; bubble->s.v.solid = SOLID_NOT; VectorCopy( self->s.v.velocity, bubble->s.v.velocity ); bubble->s.v.nextthink = g_globalvars.time + 0.5; bubble->s.v.think = ( func_t ) bubble_bob; bubble->s.v.touch = ( func_t ) bubble_remove; bubble->s.v.classname = "bubble"; bubble->s.v.frame = 1; bubble->cnt = 10; setsize( bubble, -8, -8, -8, 8, 8, 8 ); self->s.v.frame = 1; self->cnt = 10; if ( self->s.v.waterlevel != 3 ) ent_remove( self ); }
void SP_misc_explobox2( ) { float oldz; if ( !CheckExistence( ) ) { dremove( self ); return; } self->s.v.solid = SOLID_BBOX; self->s.v.movetype = MOVETYPE_NONE; trap_precache_model( "maps/b_exbox2.bsp" ); setmodel( self, "maps/b_exbox2.bsp" ); setsize( self, 0, 0, 0, 32, 32, 32 ); trap_precache_sound( "weapons/r_exp3.wav" ); self->s.v.health = 20; self->th_die = barrel_explode; self->s.v.takedamage = DAMAGE_AIM; self->s.v.origin[2] += 2; oldz = self->s.v.origin[2]; droptofloor( self ); if ( oldz - self->s.v.origin[2] > 250 ) { G_dprintf( "item fell out of level at '%f %f %f'\n", PASSVEC3( self->s.v.origin ) ); ent_remove( self ); } }
/*QUAKED func_illusionary (0 .5 .8) ? A simple entity that looks solid but lets you walk through it. */ void SP_func_illusionary() { SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.movetype = MOVETYPE_NONE; self->s.v.solid = SOLID_NOT; setmodel( self, self->model ); makestatic( self ); }
/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18) Large yellow flame ball */ void SP_light_flame_large_yellow() { trap_precache_model( "progs/flame2.mdl" ); setmodel( self, "progs/flame2.mdl" ); self->s.v.frame = 1; FireAmbient( self ); makestatic( self ); }
/*QUAKED func_wall (0 .5 .8) ? This is just a solid wall if not inhibitted */ void SP_func_wall() { SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self->s.v.solid = SOLID_BSP; self->use = ( func_t ) func_wall_use; setmodel( self, self->model ); }
void SP_func_door_secret() { if ( self->s.v.sounds == 0 ) self->s.v.sounds = 3; if ( self->s.v.sounds == 1 ) { trap_precache_sound( "doors/latch2.wav" ); trap_precache_sound( "doors/winch2.wav" ); trap_precache_sound( "doors/drclos4.wav" ); self->s.v.noise1 = "doors/latch2.wav"; self->s.v.noise2 = "doors/winch2.wav"; self->s.v.noise3 = "doors/drclos4.wav"; } if ( self->s.v.sounds == 2 ) { trap_precache_sound( "doors/airdoor1.wav" ); trap_precache_sound( "doors/airdoor2.wav" ); self->s.v.noise2 = "doors/airdoor1.wav"; self->s.v.noise1 = "doors/airdoor2.wav"; self->s.v.noise3 = "doors/airdoor2.wav"; } if ( self->s.v.sounds == 3 ) { trap_precache_sound( "doors/basesec1.wav" ); trap_precache_sound( "doors/basesec2.wav" ); self->s.v.noise2 = "doors/basesec1.wav"; self->s.v.noise1 = "doors/basesec2.wav"; self->s.v.noise3 = "doors/basesec2.wav"; } if ( self->dmg == 0 ) self->dmg = 2; // Magic formula... VectorCopy( self->s.v.angles, self->mangle ); SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.solid = SOLID_BSP; self->s.v.movetype = MOVETYPE_PUSH; self->s.v.classname = "door"; setmodel( self, self->s.v.model ); setorigin( self, PASSVEC3( self->s.v.origin ) ); self->s.v.touch = ( func_t ) secret_touch; self->s.v.blocked = ( func_t ) secret_blocked; self->speed = 50; self->s.v.use = ( func_t ) fd_secret_use; if ( !self->s.v.targetname || ( int ) ( self->s.v.spawnflags ) & SECRET_YES_SHOOT ) { self->s.v.health = 10000; self->s.v.takedamage = DAMAGE_YES; self->th_pain = fd_secret_use; } VectorCopy( self->s.v.origin, self->oldorigin ); // self.oldorigin = self.origin; if ( self->wait == 0 ) self->wait = 5; // 5 seconds before closing }
// Called from weapons.c void GrappleThrow() { if ( self->hook_out ) // only throw once return; g_globalvars.msg_entity = EDICT_TO_PROG( self ); WriteByte( MSG_ONE, SVC_SMALLKICK ); // chain out sound (loops) sound ( self, CHAN_WEAPON, "weapons/chain1.wav", 1, ATTN_NORM ); newmis = spawn(); g_globalvars.newmis = EDICT_TO_PROG( newmis ); newmis->s.v.movetype = MOVETYPE_FLYMISSILE; newmis->s.v.solid = SOLID_BBOX; newmis->s.v.owner = EDICT_TO_PROG( self ); self->hook = newmis; newmis->s.v.classname = "hook"; trap_makevectors ( self->s.v.v_angle ); // Weapon velocitys should not be based on server maxspeed imo // Removing purectf velocity changes ( 2.5 * self->maxspeed ) if ( self->ctf_flag & CTF_RUNE_HST ) VectorScale( g_globalvars.v_forward, 1000, newmis->s.v.velocity ); else VectorScale( g_globalvars.v_forward, 800, newmis->s.v.velocity ); SetVector( newmis->s.v.avelocity, 0, 0, -500 ); newmis->s.v.touch = (func_t) GrappleAnchor; newmis->s.v.think = (func_t) BuildChain; newmis->s.v.nextthink = g_globalvars.time + 0.1; if ( k_ctf_custom_models ) setmodel ( newmis, "progs/star.mdl" ); else setmodel ( newmis, "progs/v_spike.mdl" ); setorigin(newmis, self->s.v.origin[0] + g_globalvars.v_forward[0] * 16, self->s.v.origin[1] + g_globalvars.v_forward[1] * 16, self->s.v.origin[2] + g_globalvars.v_forward[2] * 16 + 16); setsize( newmis, 0, 0, 0, 0, 0, 0 ); self->hook_out = true; }
void SP_item_armorInv() { self->s.v.touch = ( func_t ) armor_touch; trap_precache_model( "progs/armor.mdl" ); setmodel( self, "progs/armor.mdl" ); self->s.v.skin = 2; setsize( self, -16, -16, 0, 16, 16, 56 ); StartItem( self ); }
/*QUAKED func_bossgate (0 .5 .8) ? This bmodel appears unless players have all of the episode sigils. */ void SP_func_bossgate() { if ( ( ( int ) ( g_globalvars.serverflags ) & 15 ) == 15 ) return; // all episodes completed SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self->s.v.solid = SOLID_BSP; self->use = ( func_t ) func_wall_use; setmodel( self, self->model ); }
/*QUAKED func_episodegate (0 .5 .8) ? E1 E2 E3 E4 This bmodel will appear if the episode has allready been completed, so players can't reenter it. */ void SP_func_episodegate() { if ( !( ( int ) ( g_globalvars.serverflags ) & ( int ) ( self->s.v.spawnflags ) ) ) return; // can still enter episode SetVector( self->s.v.angles, 0, 0, 0 ); self->s.v.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self->s.v.solid = SOLID_BSP; self->use = ( func_t ) func_wall_use; setmodel( self, self->model ); }
/*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8) Sphere globe light. Default light value is 300 Default style is 0 */ void SP_light_globe( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_model( "progs/s_light.spr" ); setmodel( self, "progs/s_light.spr" ); makestatic( self ); }
// // MakeLink - spawns the chain link entities // gedict_t* MakeLink() { newmis = spawn (); g_globalvars.newmis = EDICT_TO_PROG( newmis ); newmis->s.v.movetype = MOVETYPE_FLYMISSILE; newmis->s.v.solid = SOLID_NOT; newmis->s.v.owner = EDICT_TO_PROG( self ); SetVector ( newmis->s.v.avelocity, 200, 200, 200 ); if ( k_ctf_custom_models ) setmodel ( newmis, "progs/bit.mdl" ); else setmodel ( newmis, "progs/spike.mdl" ); setorigin ( newmis, PASSVEC3(self->s.v.origin) ); setsize ( newmis, 0, 0, 0, 0, 0, 0 ); return newmis; }
void PlayerDead() { self->s.v.nextthink = -1; // allow respawn after a certain time self->s.v.deadflag = DEAD_DEAD; // Yawnmode: hide player corpses after animation // - Molgrum if ( k_yawnmode ) setmodel( self, "" ); }
void viewthing( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } self->s.v.movetype = MOVETYPE_NONE; self->s.v.solid = SOLID_NOT; trap_precache_model( "progs/player.mdl" ); setmodel( self, "progs/player.mdl" ); }
/*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF Small white flame ball */ void SP_light_flame_small_white( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } trap_precache_model( "progs/flame2.mdl" ); setmodel( self, "progs/flame2.mdl" ); FireAmbient( ); makestatic( self ); }