void ReadyThink () { float i1; char *txt, *gr; gedict_t *p=NULL, *p2=NULL; p2 = PROG_TO_EDICT( self->s.v.owner ); if( ( p2->ct == ctPlayer && !( p2->ready ) ) // forcestart breaked via break command || ( p2->ct == ctSpec && !k_force ) // forcestart breaked via forcebreak command (spectator admin) ) { k_force = 0; G_bprint(2, "%s interrupts countdown\n", p2->netname ); ent_remove ( self ); return; } k_attendees = CountPlayers(); if ( !isCanStart(NULL, true) ) { k_force = 0; G_bprint(2, "Forcestart canceled\n"); ent_remove ( self ); return; } self->attack_finished--; i1 = self->attack_finished; if( i1 <= 0 ) { k_force = 0; AdminMatchStart(); ent_remove ( self ); return; } txt = va( "%s second%s left before game starts", dig3( i1 ), ( i1 == 1 ? "" : "s") ); gr = va( "\n%s!", redtext("Get ready") ); for( p = world; (p = find_client( p )); ) if ( p->ct == ctPlayer ) G_centerprint(p, "%s%s", txt, (p->ready ? "" : gr)); else G_centerprint(p, "%s", txt); self->s.v.nextthink = g_globalvars.time + 1; }
/* =================== G_SpawnGEntityFromSpawnVars Spawn an entity and fill in all of the level fields from level.spawnVars[], then call the class specfic spawn function =================== */ void G_SpawnGEntityFromSpawnVars( void ) { int i; gedict_t *ent; // get the next free entity ent = spawn(); for ( i = 0; i < numSpawnVars; i++ ) { G_ParseField( spawnVars[i][0], spawnVars[i][1], ent ); } if ( ( ( int ) ent->s.v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH ) ) { ent_remove( ent ); return; } // if we didn't get a classname, don't bother spawning anything if ( !G_CallSpawn( ent ) ) { ent_remove( ent ); return; } // if(!ent->s.v.classname)ent->s.v.classname=""; }
void eff_expl_flash() { int i; set(me, BRIGHT | TRANSLUCENT | LIGHT | ZNEAR | PASSABLE); my.alpha = 50; my.roll = random(360); while(my.alpha < 100) { my.alpha += time_step * (random(20)+20); my.roll += time_step * sign(ang(my.roll)); vec_fill ( my.scale_x, my.alpha/13 ); wait(1); } for(i=0; i<4; i++) { ent_create("explFlash01.tga", my.x, eff_expl_flash_2); you = ent_create("explFlash02.tga", my.x, eff_expl_flash_2); if (i == 0) set(you, LIGHT); } for(i=0; i<5; i++) { ent_create ("explSmoke01.tga", my.x, eff_expl_smoke2); } effect(p_eff_expl_particle, 200, my.x, NULL); vec_add(my.scale_x, vector(3,3,3)); ent_create("explSmoke02.tga", my.x, eff_expl_smoke); while(my.alpha > 0) { my.alpha -= time_step * 25; my.roll += time_step * sign(ang(my.roll)); wait(1); } ent_remove(me); }
void eff_expl_flash_2() { set(me, BRIGHT | TRANSLUCENT | ZNEAR | PASSABLE); my.blue = 150; my.green = 235; my.red = 255; my.alpha = 0; my.roll = random(360); vec_fill(my.scale_x, 3); vec_for_angle(vecEffectsTemp, vector( my.roll, 0, 0)); vec_rotate(vecEffectsTemp, vector(camera.pan, camera.tilt+90, 0)); vec_normalize(vecEffectsTemp, 40); vec_add(vecEffectsTemp, my.x); vec_set(my.x, vecEffectsTemp); while(my.alpha < 100) { if (my.lightrange < 1000 ) my.lightrange += 2000 * time_step; my.alpha += time_step * (random(20)+20); my.roll += time_step * sign(ang(my.roll)); vec_normalize ( my.blue, 150 + random(105) ); wait(1); } ent_create("explSmoke02.tga", my.x, eff_expl_smoke); while(my.alpha > 0) { if (my.lightrange > 0) my.lightrange -= 500 * time_step; my.alpha -= time_step * 20; my.roll += time_step * sign(ang(my.roll))*5; wait(1); } while (my.lightrange > 0) { my.lightrange -= 500 * time_step; wait(1); } ent_remove(me); }
void Laser_Touch( ) { vec3_t org; if ( other == PROG_TO_EDICT( self->s.v.owner ) ) return; // don't explode on owner if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY ) { ent_remove( self ); return; } sound( self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC ); normalize( self->s.v.velocity, org ); VectorScale( org, 8, org ); VectorSubtract( self->s.v.origin, org, org ); //org = self->s.v.origin - 8*normalize(self->s.v.velocity); if ( other->s.v.health ) { SpawnBlood( org, 15 ); TF_T_Damage( other, self, PROG_TO_EDICT( self->s.v.owner ), 15, 0, TF_TD_ELECTRICITY ); } else { TempEffectCount( org, TE_GUNSHOT, 5); } dremove( self ); }
void trigger_onlyregistered_touch( ) { gedict_t *te; if ( strneq( other->s.v.classname, "player" ) ) return; if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } if ( self->attack_finished > g_globalvars.time ) return; self->attack_finished = g_globalvars.time + 2; if ( trap_cvar( "registered" ) ) { self->s.v.message = ""; activator = other; SUB_UseTargets( ); ent_remove( self ); } else { if ( self->s.v.message && strneq( self->s.v.message, "" ) ) { G_centerprint( other, "%s", self->s.v.message ); sound( other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM ); } } }
void RemoveMarker (gedict_t* marker) { int i, j; if (!streq (marker->classname, "marker")) { G_sprint (self, 2, "Cannot remove non-marker\n"); return; } for (i = 0; i < NUMBER_MARKERS; ++i) { if (!markers[i]) continue; // Remove from linked paths for (j = 0; j < NUMBER_PATHS; ++j) { if (markers[i]->fb.paths[j].next_marker == marker) { markers[i]->fb.paths[j].next_marker = NULL; } } // Remove marker if (markers[i] == marker) { ent_remove (markers[i]); markers[i] = NULL; } } }
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 eff_expl_smoke2 () { set(me, TRANSLUCENT | ZNEAR | PASSABLE | LIGHT); my.roll = random(360); my.alpha = 100; my.scale_x = 0.2; my.scale_y = 0.7; my.skill1 = random(3)+2; vec_fill(my.blue, 30); while(my.alpha > 0) { if(my.alpha > 93 ) { vec_for_angle(vecEffectsTemp, vector( my.roll,0,0)); vec_rotate(vecEffectsTemp, vector(camera.pan, camera.tilt+90, 0)); vec_normalize(vecEffectsTemp, time_step * (my.alpha/my.skill1) * 0.4); vec_add(my.x, vecEffectsTemp); my.scale_y += vec_length(vecEffectsTemp)/46; my.alpha -= time_step * 3; } else { vec_for_angle(vecEffectsTemp, vector(my.roll, 0, 0)); vec_rotate(vecEffectsTemp, vector(camera.pan, camera.tilt+90, 0)); vec_normalize(vecEffectsTemp, time_step * (my.alpha/(my.skill1*2))); vec_add(my.x, vecEffectsTemp); my.scale_y += vec_length(vecEffectsTemp) / 5000; my.alpha -= time_step * 9; } wait(1); } ent_remove(me); return; }
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 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; } }
void SUB_Remove() { // if (self && self->s.v.classname ) // G_bprint(2, "rm: %s\n", self->s.v.classname); 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 ); } }
void trigger_push_touch() { if ( streq( other->s.v.classname, "grenade" ) ) { other->s.v.velocity[0] = self->speed * self->s.v.movedir[0] * 10; other->s.v.velocity[1] = self->speed * self->s.v.movedir[1] * 10; other->s.v.velocity[2] = self->speed * self->s.v.movedir[2] * 10; } else if ( other->s.v.health > 0 ) { // other->s.v.velocity = self->speed * self->s.v.movedir * 10; other->s.v.velocity[0] = self->speed * self->s.v.movedir[0] * 10; other->s.v.velocity[1] = self->speed * self->s.v.movedir[1] * 10; other->s.v.velocity[2] = self->speed * self->s.v.movedir[2] * 10; if ( streq( other->s.v.classname, "player" ) ) { if ( other->fly_sound < g_globalvars.time ) { other->fly_sound = g_globalvars.time + 1.5; sound( other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM ); } } } if ( ( int ) ( self->s.v.spawnflags ) & PUSH_ONCE ) ent_remove( self ); }
//////////////// // GlobalParams: // self /////////////// void SpectatorDisconnect() { gedict_t *p; if ( self->k_accepted ) { for ( p = world; (p = ( match_in_progress == 2 && !cvar("k_ann") ) ? find_spc( p ) : find_client( p )); ) G_sprint( p, PRINT_HIGH, "Spectator %s left the game\n", self->s.v.netname ); } // s: added conditional function call here if( self->v.elect_type != etNone ) { if ( match_in_progress != 2 ) G_bprint(2, "Election aborted\n"); AbortElect(); } if ( self->wizard ) { ent_remove( self->wizard ); self->wizard = NULL; } if( self->k_kicking ) ExitKick( self ); self->s.v.classname = ""; // Cenobite, so we clear out any specs as they leave self->k_accepted = 0; self->ct = ctNone; }
void DelayThink() { activator = PROG_TO_EDICT( self->s.v.enemy ); SUB_UseTargets(); ent_remove( self ); }
void bubble_remove( ) { if ( streq( other->s.v.classname, self->s.v.classname ) ) { // dprint ("bump"); return; } ent_remove( self ); }
/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8) testing air bubbles */ void SP_air_bubbles( ) { if ( !CheckExistence( ) ) { dremove( self ); return; } ent_remove( self ); }
void spike_touch() { //float rand; if ( other == PROG_TO_EDICT( self->s.v.owner ) ) return; if ( self->voided ) { return; } self->voided = 1; if ( other->s.v.solid == SOLID_TRIGGER ) return; // trigger field, do nothing if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY ) { ent_remove( self ); return; } // hit something that bleeds if ( other->s.v.takedamage ) { spawn_touchblood( 9 ); other->deathtype = "nail"; T_Damage( other, self, PROG_TO_EDICT( self->s.v.owner ), 9 ); } else { trap_WriteByte( MSG_MULTICAST, SVC_TEMPENTITY ); if ( !strcmp( self->s.v.classname, "wizspike" ) ) trap_WriteByte( MSG_MULTICAST, TE_WIZSPIKE ); else if ( !strcmp( self->s.v.classname, "knightspike" ) ) trap_WriteByte( MSG_MULTICAST, TE_KNIGHTSPIKE ); else trap_WriteByte( MSG_MULTICAST, TE_SPIKE ); trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[0] ); trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[1] ); trap_WriteCoord( MSG_MULTICAST, self->s.v.origin[2] ); trap_multicast( PASSVEC3( self->s.v.origin ), MULTICAST_PHS ); } ent_remove( self ); }
void remove_specs_wizards () { gedict_t *p; for( p = world; (p = find_spc( p )); ) if ( p->wizard ) { ent_remove( p->wizard ); p->wizard = NULL; } }
void fire_touch() { // Yawnmode: no damage from fireall if ( !k_yawnmode ) { other->deathtype = dtFIREBALL; T_Damage( other, self, self, 20 ); } ent_remove( self ); }
action update_Earth() // Actions for earth.mdl { wait(1) ; while ( me ) // As long as I exist, continue to do this: { if ( key_space ) ent_remove ( me ) ; // If Spacebar is detected, I M toast wait (1) ; } }
/* * void render_rain_free() * * Frees the rain state singleton. */ void render_rain_free() { int i = 0; render_rain_stop(); mtl_remove(RainState_singleton->rain); for(; i < RainState_singleton->depth; i++) ent_remove((RainState_singleton->rain_levels)[i]); sys_free(RainState_singleton); }
void Laser_Touch() { vec3_t org; if ( other == PROG_TO_EDICT( self->s.v.owner ) ) return; // don't explode on owner if ( trap_pointcontents( PASSVEC3( self->s.v.origin ) ) == CONTENT_SKY ) { ent_remove( self ); return; } sound( self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC ); normalize( self->s.v.velocity, org ); VectorScale( org, 8, org ); VectorSubtract( self->s.v.origin, org, org ); //org = self->s.v.origin - 8*normalize(self->s.v.velocity); if ( ISLIVE( other ) ) { SpawnBlood( org, 15 ); other->deathtype = dtLASER; T_Damage( other, self, PROG_TO_EDICT( self->s.v.owner ), 15 ); } else { WriteByte( MSG_MULTICAST, SVC_TEMPENTITY ); WriteByte( MSG_MULTICAST, TE_GUNSHOT ); WriteByte( MSG_MULTICAST, 5 ); WriteCoord( MSG_MULTICAST, org[0] ); WriteCoord( MSG_MULTICAST, org[1] ); WriteCoord( MSG_MULTICAST, org[2] ); trap_multicast( PASSVEC3( org ), MULTICAST_PVS ); } ent_remove( self ); }
void barrel_explode( ) { vec3_t v; self->s.v.takedamage = DAMAGE_NO; self->s.v.classname = "explo_box"; // did say self.owner T_RadiusDamage( self, self, 160, world ); VectorCopy( self->s.v.origin, v); v[2] += 32; TempEffectCoord( v, TE_EXPLOSION ); ent_remove( self ); }
/* =================== G_SpawnGEntityFromSpawnVars Spawn an entity and fill in all of the level fields from level.spawnVars[], then call the class specfic spawn function =================== */ void G_SpawnGEntityFromSpawnVars( void ) { int i; gedict_t *ent; // get the next free entity ent = spawn(); for ( i = 0; i < numSpawnVars; i++ ) { G_ParseField( spawnVars[i][0], spawnVars[i][1], ent ); } if ( deathmatch ) { if ( ( ( int ) ent->s.v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH ) ) { // G_cprint( "%s removed because of SPAWNFLAG_NOT_DEATHMATCH\n", ent->s.v.classname ); ent_remove( ent ); return; } } else if ( ( skill == 0 && ((int)ent->s.v.spawnflags & SPAWNFLAG_NOT_EASY) ) || ( skill == 1 && ((int)ent->s.v.spawnflags & SPAWNFLAG_NOT_MEDIUM) ) || ( skill >= 2 && ((int)ent->s.v.spawnflags & SPAWNFLAG_NOT_HARD) ) ) { // G_cprint( "%s removed because of SPAWNFLAG_NOT_XXX\n", ent->s.v.classname ); ent_remove( ent ); return; } // if we didn't get a classname, don't bother spawning anything if ( !G_CallSpawn( ent ) ) { ent_remove( ent ); return; } }
// Stone rain action ebHandStone () { set(me, PASSABLE); var randomFallSpeed = random(20); while(my.z > -100) { my.z -=(20+randomFallSpeed) * time_step; my.pan +=randomFallSpeed * time_step; my.tilt +=randomFallSpeed * time_step; my.roll +=randomFallSpeed * time_step; // Give player 2 seconds to recover from last hit if (g_playerJustBeenHit == 0) { // Stone hits player? if (vec_dist(player.x, my.x) < 30) { // Play sounds if (!snd_playing(vPlayerSndHandle)) vPlayerSndHandle = snd_play(g_sndHitByStone, 100, 0); snd_play(g_sndStoneImpact, 100, 0); player.PL_HEALTH -=1; ent_remove(me); g_playerJustBeenHit = 2; // Wait 2 seconds while(g_playerJustBeenHit > 0) { g_playerJustBeenHit -=1; wait(-1); } return; } } wait(1); } ent_remove(me); }
void eff_expl_wave() { set(me, TRANSLUCENT | DECAL | PASSABLE); my.alpha = 70; vec_fill(my.scale_x, 0.1); my.tilt = 90; my.pan = random(360); vec_fill(my.blue, 0); while(my.alpha > 0) { vec_fill(vecEffectsTemp, time_step * 2); vec_add(my.scale_x, vecEffectsTemp); my.alpha -= time_step * 7; wait (1); } ent_remove(me); }
void eff_expl_smoke() { set(me, TRANSLUCENT | LIGHT | ZNEAR | PASSABLE); vec_set(my.blue, vector(200,255,255)); my.alpha = 40; my.roll = random(360); vec_fill(my.scale_x, 0.4); while(my.alpha > 0) { my.alpha -= time_step * 2; my.roll += time_step * sign(ang(my.roll))*1; vec_fill(vecEffectsTemp, time_step *0.01); vec_add(my.scale_x, vecEffectsTemp); wait(1); } ent_remove ( me ); }
void SP_info_player_teamspawn( ) { if (self->team_no == TF_TEAM_RED) { self->s.v.classname = "info_player_team1"; } else if (self->team_no == TF_TEAM_BLUE) { self->s.v.classname = "info_player_team2"; } else { G_Printf( "SP_info_player_teamspawn: team_no %d unsupported\n", self->team_no); ent_remove( self ); return; } }