void G_RemapTeamShaders( void ) { #ifdef MISSIONPACK char string[1024]; float f = level.time * 0.001; Com_sprintf( string, sizeof(string), "team_icon/%s_red", g_redteam.string ); AddRemap("textures/ctf2/redteam01", string, f); AddRemap("textures/ctf2/redteam02", string, f); Com_sprintf( string, sizeof(string), "team_icon/%s_blue", g_blueteam.string ); AddRemap("textures/ctf2/blueteam01", string, f); AddRemap("textures/ctf2/blueteam02", string, f); trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig()); #endif }
/* ============================== G_UseTargets "activator" should be set to the entity that initiated the firing. Search for (string)targetname in all entities that match (string)self.target and call their .use function ============================== */ void G_UseTargets( gentity_t *ent, gentity_t *activator ) { gentity_t *t; if ( !ent ) { return; } if (ent->targetShaderName && ent->targetShaderNewName) { float f = level.time * 0.001; AddRemap(ent->targetShaderName, ent->targetShaderNewName, f); trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig()); } if ( !ent->target ) { return; } t = NULL; while ( (t = G_Find (t, FOFS(targetname), ent->target)) != NULL ) { if ( t == ent ) { G_Printf ("WARNING: Entity used itself.\n"); } else { if ( t->use ) { t->use (t, ent, activator); } } if ( !ent->inuse ) { G_Printf("entity was removed while using targets\n"); return; } } }
static int GLua_Sys_RemapShader(lua_State *L) { int supressupdate = lua_toboolean(L,3); AddRemap(luaL_checkstring(L,1), luaL_checkstring(L,2), level.time); if (!supressupdate) { trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig()); } return 0; }
/* ============================== G_UseTargets "activator" should be set to the entity that initiated the firing. Search for (string)targetname in all entities that match (string)self.target and call their .use function ============================== */ void G_UseTargets( gentity_t *ent, gentity_t *activator ) { gentity_t *t; if ( !ent ) { return; } if ( ent->targetShaderName && ent->targetShaderNewName ) { float f = level.time * 0.001; AddRemap( ent->targetShaderName, ent->targetShaderNewName, f ); trap_SetConfigstring( CS_SHADERSTATE, BuildShaderStateConfig() ); } if ( !ent->target ) { return; } t = NULL; while ( ( t = G_Find( t, FOFS( targetname ), ent->target ) ) != NULL ) { if ( t == ent ) { G_Printf( "WARNING: Entity used itself.\n" ); } else { if ( t->use ) { //G_Printf ("ent->classname %s ent->targetname %s t->targetname %s t->s.number %d\n", ent->classname, ent->targetname, t->targetname, t->s.number); t->flags |= ( ent->flags & FL_KICKACTIVATE ); // (SA) If 'ent' was kicked to activate, pass this along to it's targets. // It may become handy to put a "KICKABLE" flag in ents so that it knows whether to pass this along or not // Right now, the only situation where it would be weird would be an invisible_user that is a 'button' near // a rotating door that it triggers. Kick the switch and the door next to it flies open. t->flags |= ( ent->flags & FL_SOFTACTIVATE ); // (SA) likewise for soft activation if ( activator && ( ( Q_stricmp( t->classname, "func_door" ) == 0 ) || ( Q_stricmp( t->classname, "func_door_rotating" ) == 0 ) ) ) { // check door usage rules before allowing any entity to trigger a door open G_TryDoor( t, ent, activator ); // (door,other,activator) } else { t->use( t, ent, activator ); } } } if ( !ent->inuse ) { G_Printf( "entity was removed while using targets\n" ); return; } } }
/* ============================== G_ToggleTargetsEnabled "activator" should be set to the entity that initiated the firing. Search for (string)targetname in all entities that match (string)self.target and toggle their FL_DISABLED flag ============================== */ void G_ToggleTargetsEnabled( gentity_t *ent, gentity_t *activator ) { gentity_t *t; if ( !ent ) { return; } if (ent->targetShaderName && ent->targetShaderNewName) { float f = level.time * 0.001; AddRemap(ent->targetShaderName, ent->targetShaderNewName, f); trap_SetConfigstring(CS_SHADERSTATE, BuildShaderStateConfig()); } if ( !ent->target ) { return; } t = NULL; while ( (t = G_Find (t, FOFS(targetname), ent->target)) != NULL ) { if ( t == ent ) { G_Printf ("WARNING: Entity targets itself.\n"); } else { G_Printf("entity found\n"); if ( ( ent->spawnflags & 4 ) ) t->flags |= FL_DISABLED; //always_disable spawnflag is set, so set the disabled bit else if ( ( ent->spawnflags & 8 ) ) t->flags &= ~FL_DISABLED; //always_enable spawnflag is set, so clear the disabled bit else t->flags ^= FL_DISABLED; //no spawnflag is set, so toggle } if ( !ent->inuse ) { G_Printf("entity was removed while using targets\n"); return; } } }