//---------------------------------------------------------- void SP_CreatePuffSystem( gentity_t *ent ) { char temp[128]; // Initialize the puff system to either 1000 particles or whatever they choose. G_SpawnInt( "count", "1000", &ent->count ); cvar_t *r_weatherScale = gi.cvar( "r_weatherScale", "1", CVAR_ARCHIVE ); // See which puff system to use. int iPuffSystem = 0; int iVal = 0; if ( G_SpawnInt( "whichsystem", "0", &iVal ) ) { iPuffSystem = iVal; if ( iPuffSystem < 0 || iPuffSystem > 1 ) { iPuffSystem = 0; //ri.Error( ERR_DROP, "Weather Effect: Invalid value for whichsystem key" ); Com_Printf( "Weather Effect: Invalid value for whichsystem key\n" ); } } if ( r_weatherScale->value > 0.0f ) { sprintf( temp, "puff%i init %i", iPuffSystem, (int)( ent->count * r_weatherScale->value )); G_FindConfigstringIndex( temp, CS_WORLD_FX, MAX_WORLD_FX, qtrue ); // Should return here??? It didn't originally... } // See whether we should have the saber spark from the puff system. iVal = 0; G_SpawnInt( "sabersparks", "0", &iVal ); if ( iVal == 1 ) level.worldFlags |= WF_PUFFING; else level.worldFlags &= ~WF_PUFFING; // Go through all the fields and assign the values to the created puff system now. for ( int i = 0; i < 20; i++ ) { char *key = NULL; char *value = NULL; // Fetch a field. if ( !G_SpawnField( i, &key, &value ) ) continue; // Make sure we don't get key's that are worthless. if ( Q_stricmp( key, "origin" ) == 0 || Q_stricmp( key, "classname" ) == 0 || Q_stricmp( key, "count" ) == 0 || Q_stricmp( key, "targetname" ) == 0 || Q_stricmp( key, "sabersparks" ) == 0 || Q_stricmp( key, "whichsystem" ) == 0 ) continue; // Send the command. _snprintf( temp, 128, "puff%i %s %s", iPuffSystem, key, value ); G_FindConfigstringIndex( temp, CS_WORLD_FX, MAX_WORLD_FX, qtrue ); } }
static void SP_misc_smokestun (edict_t *ent) { G_SpawnField(ent, "stunsmoke", ET_SMOKESTUN, SOLID_TRIGGER); ent->dmgtype = gi.csi->damStunGas; ent->touch = Touch_HurtTrigger; }
static void SP_misc_fire (edict_t *ent) { G_SpawnField(ent, "fire", ET_FIRE, SOLID_BBOX); ent->dmgtype = gi.csi->damIncendiary; ent->touch = Touch_HurtTrigger; }
static void SP_misc_smoke (edict_t *ent) { G_SpawnField(ent, "smoke", ET_SMOKE, SOLID_NOT); G_CheckVis(NULL); }
void G_SpawnStunSmokeField (const vec3_t vec, const char* particle, int rounds, int damage, vec_t radius) { G_SpawnField(ET_SMOKESTUN, vec, particle, rounds, damage, radius); }
void G_SpawnFireField (const vec3_t vec, const char* particle, int rounds, int damage, vec_t radius) { G_SpawnField(ET_FIRE, vec, particle, rounds, damage, radius); }
/** * @brief Spawns a smoke field that is available for some rounds * @param[in] vec The position in the world that is the center of the smoke field * @param[in] particle The id of the particle (see ptl_*.ufo script files in base/ufos) * @param[in] rounds The number of rounds the particle will last * @todo Does '2 rounds' mean: created in player's turn, last through the aliens turn, vanish before the 2nd player's turn ?? * @param[in] radius The max distance of a cell from the center to get a particle */ void G_SpawnSmokeField (const vec3_t vec, const char* particle, int rounds, vec_t radius) { G_SpawnField(ET_SMOKE, vec, particle, rounds, 0, radius); }
static void SP_misc_smoke (Edict* ent) { G_SpawnField(ent, "smoke", ET_SMOKE, SOLID_NOT); G_CheckVis(nullptr); }