diff options
Diffstat (limited to 'src/baseq2/g_spawn.c')
-rw-r--r-- | src/baseq2/g_spawn.c | 709 |
1 files changed, 344 insertions, 365 deletions
diff --git a/src/baseq2/g_spawn.c b/src/baseq2/g_spawn.c index 6ebf279..2979095 100644 --- a/src/baseq2/g_spawn.c +++ b/src/baseq2/g_spawn.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { char *name; - void (*spawn)(edict_t *ent); + void (*spawn)(edict_t *ent); } spawn_func_t; typedef struct { @@ -31,122 +31,122 @@ typedef struct { fieldtype_t type; } spawn_field_t; -void SP_item_health (edict_t *self); -void SP_item_health_small (edict_t *self); -void SP_item_health_large (edict_t *self); -void SP_item_health_mega (edict_t *self); - -void SP_info_player_start (edict_t *ent); -void SP_info_player_deathmatch (edict_t *ent); -void SP_info_player_coop (edict_t *ent); -void SP_info_player_intermission (edict_t *ent); - -void SP_func_plat (edict_t *ent); -void SP_func_rotating (edict_t *ent); -void SP_func_button (edict_t *ent); -void SP_func_door (edict_t *ent); -void SP_func_door_secret (edict_t *ent); -void SP_func_door_rotating (edict_t *ent); -void SP_func_water (edict_t *ent); -void SP_func_train (edict_t *ent); -void SP_func_conveyor (edict_t *self); -void SP_func_wall (edict_t *self); -void SP_func_object (edict_t *self); -void SP_func_explosive (edict_t *self); -void SP_func_timer (edict_t *self); -void SP_func_areaportal (edict_t *ent); -void SP_func_clock (edict_t *ent); -void SP_func_killbox (edict_t *ent); - -void SP_trigger_always (edict_t *ent); -void SP_trigger_once (edict_t *ent); -void SP_trigger_multiple (edict_t *ent); -void SP_trigger_relay (edict_t *ent); -void SP_trigger_push (edict_t *ent); -void SP_trigger_hurt (edict_t *ent); -void SP_trigger_key (edict_t *ent); -void SP_trigger_counter (edict_t *ent); -void SP_trigger_elevator (edict_t *ent); -void SP_trigger_gravity (edict_t *ent); -void SP_trigger_monsterjump (edict_t *ent); - -void SP_target_temp_entity (edict_t *ent); -void SP_target_speaker (edict_t *ent); -void SP_target_explosion (edict_t *ent); -void SP_target_changelevel (edict_t *ent); -void SP_target_secret (edict_t *ent); -void SP_target_goal (edict_t *ent); -void SP_target_splash (edict_t *ent); -void SP_target_spawner (edict_t *ent); -void SP_target_blaster (edict_t *ent); -void SP_target_crosslevel_trigger (edict_t *ent); -void SP_target_crosslevel_target (edict_t *ent); -void SP_target_laser (edict_t *self); -void SP_target_help (edict_t *ent); -void SP_target_actor (edict_t *ent); -void SP_target_lightramp (edict_t *self); -void SP_target_earthquake (edict_t *ent); -void SP_target_character (edict_t *ent); -void SP_target_string (edict_t *ent); - -void SP_worldspawn (edict_t *ent); -void SP_viewthing (edict_t *ent); - -void SP_light (edict_t *self); -void SP_light_mine1 (edict_t *ent); -void SP_light_mine2 (edict_t *ent); -void SP_info_null (edict_t *self); -void SP_info_notnull (edict_t *self); -void SP_path_corner (edict_t *self); -void SP_point_combat (edict_t *self); - -void SP_misc_explobox (edict_t *self); -void SP_misc_banner (edict_t *self); -void SP_misc_satellite_dish (edict_t *self); -void SP_misc_actor (edict_t *self); -void SP_misc_gib_arm (edict_t *self); -void SP_misc_gib_leg (edict_t *self); -void SP_misc_gib_head (edict_t *self); -void SP_misc_insane (edict_t *self); -void SP_misc_deadsoldier (edict_t *self); -void SP_misc_viper (edict_t *self); -void SP_misc_viper_bomb (edict_t *self); -void SP_misc_bigviper (edict_t *self); -void SP_misc_strogg_ship (edict_t *self); -void SP_misc_teleporter (edict_t *self); -void SP_misc_teleporter_dest (edict_t *self); -void SP_misc_blackhole (edict_t *self); -void SP_misc_eastertank (edict_t *self); -void SP_misc_easterchick (edict_t *self); -void SP_misc_easterchick2 (edict_t *self); - -void SP_monster_berserk (edict_t *self); -void SP_monster_gladiator (edict_t *self); -void SP_monster_gunner (edict_t *self); -void SP_monster_infantry (edict_t *self); -void SP_monster_soldier_light (edict_t *self); -void SP_monster_soldier (edict_t *self); -void SP_monster_soldier_ss (edict_t *self); -void SP_monster_tank (edict_t *self); -void SP_monster_medic (edict_t *self); -void SP_monster_flipper (edict_t *self); -void SP_monster_chick (edict_t *self); -void SP_monster_parasite (edict_t *self); -void SP_monster_flyer (edict_t *self); -void SP_monster_brain (edict_t *self); -void SP_monster_floater (edict_t *self); -void SP_monster_hover (edict_t *self); -void SP_monster_mutant (edict_t *self); -void SP_monster_supertank (edict_t *self); -void SP_monster_boss2 (edict_t *self); -void SP_monster_jorg (edict_t *self); -void SP_monster_boss3_stand (edict_t *self); - -void SP_monster_commander_body (edict_t *self); - -void SP_turret_breach (edict_t *self); -void SP_turret_base (edict_t *self); -void SP_turret_driver (edict_t *self); +void SP_item_health(edict_t *self); +void SP_item_health_small(edict_t *self); +void SP_item_health_large(edict_t *self); +void SP_item_health_mega(edict_t *self); + +void SP_info_player_start(edict_t *ent); +void SP_info_player_deathmatch(edict_t *ent); +void SP_info_player_coop(edict_t *ent); +void SP_info_player_intermission(edict_t *ent); + +void SP_func_plat(edict_t *ent); +void SP_func_rotating(edict_t *ent); +void SP_func_button(edict_t *ent); +void SP_func_door(edict_t *ent); +void SP_func_door_secret(edict_t *ent); +void SP_func_door_rotating(edict_t *ent); +void SP_func_water(edict_t *ent); +void SP_func_train(edict_t *ent); +void SP_func_conveyor(edict_t *self); +void SP_func_wall(edict_t *self); +void SP_func_object(edict_t *self); +void SP_func_explosive(edict_t *self); +void SP_func_timer(edict_t *self); +void SP_func_areaportal(edict_t *ent); +void SP_func_clock(edict_t *ent); +void SP_func_killbox(edict_t *ent); + +void SP_trigger_always(edict_t *ent); +void SP_trigger_once(edict_t *ent); +void SP_trigger_multiple(edict_t *ent); +void SP_trigger_relay(edict_t *ent); +void SP_trigger_push(edict_t *ent); +void SP_trigger_hurt(edict_t *ent); +void SP_trigger_key(edict_t *ent); +void SP_trigger_counter(edict_t *ent); +void SP_trigger_elevator(edict_t *ent); +void SP_trigger_gravity(edict_t *ent); +void SP_trigger_monsterjump(edict_t *ent); + +void SP_target_temp_entity(edict_t *ent); +void SP_target_speaker(edict_t *ent); +void SP_target_explosion(edict_t *ent); +void SP_target_changelevel(edict_t *ent); +void SP_target_secret(edict_t *ent); +void SP_target_goal(edict_t *ent); +void SP_target_splash(edict_t *ent); +void SP_target_spawner(edict_t *ent); +void SP_target_blaster(edict_t *ent); +void SP_target_crosslevel_trigger(edict_t *ent); +void SP_target_crosslevel_target(edict_t *ent); +void SP_target_laser(edict_t *self); +void SP_target_help(edict_t *ent); +void SP_target_actor(edict_t *ent); +void SP_target_lightramp(edict_t *self); +void SP_target_earthquake(edict_t *ent); +void SP_target_character(edict_t *ent); +void SP_target_string(edict_t *ent); + +void SP_worldspawn(edict_t *ent); +void SP_viewthing(edict_t *ent); + +void SP_light(edict_t *self); +void SP_light_mine1(edict_t *ent); +void SP_light_mine2(edict_t *ent); +void SP_info_null(edict_t *self); +void SP_info_notnull(edict_t *self); +void SP_path_corner(edict_t *self); +void SP_point_combat(edict_t *self); + +void SP_misc_explobox(edict_t *self); +void SP_misc_banner(edict_t *self); +void SP_misc_satellite_dish(edict_t *self); +void SP_misc_actor(edict_t *self); +void SP_misc_gib_arm(edict_t *self); +void SP_misc_gib_leg(edict_t *self); +void SP_misc_gib_head(edict_t *self); +void SP_misc_insane(edict_t *self); +void SP_misc_deadsoldier(edict_t *self); +void SP_misc_viper(edict_t *self); +void SP_misc_viper_bomb(edict_t *self); +void SP_misc_bigviper(edict_t *self); +void SP_misc_strogg_ship(edict_t *self); +void SP_misc_teleporter(edict_t *self); +void SP_misc_teleporter_dest(edict_t *self); +void SP_misc_blackhole(edict_t *self); +void SP_misc_eastertank(edict_t *self); +void SP_misc_easterchick(edict_t *self); +void SP_misc_easterchick2(edict_t *self); + +void SP_monster_berserk(edict_t *self); +void SP_monster_gladiator(edict_t *self); +void SP_monster_gunner(edict_t *self); +void SP_monster_infantry(edict_t *self); +void SP_monster_soldier_light(edict_t *self); +void SP_monster_soldier(edict_t *self); +void SP_monster_soldier_ss(edict_t *self); +void SP_monster_tank(edict_t *self); +void SP_monster_medic(edict_t *self); +void SP_monster_flipper(edict_t *self); +void SP_monster_chick(edict_t *self); +void SP_monster_parasite(edict_t *self); +void SP_monster_flyer(edict_t *self); +void SP_monster_brain(edict_t *self); +void SP_monster_floater(edict_t *self); +void SP_monster_hover(edict_t *self); +void SP_monster_mutant(edict_t *self); +void SP_monster_supertank(edict_t *self); +void SP_monster_boss2(edict_t *self); +void SP_monster_jorg(edict_t *self); +void SP_monster_boss3_stand(edict_t *self); + +void SP_monster_commander_body(edict_t *self); + +void SP_turret_breach(edict_t *self); +void SP_turret_base(edict_t *self); +void SP_turret_driver(edict_t *self); static const spawn_func_t spawn_funcs[] = { {"item_health", SP_item_health}, @@ -338,40 +338,37 @@ ED_CallSpawn Finds the spawn function for the entity and calls it =============== */ -void ED_CallSpawn (edict_t *ent) +void ED_CallSpawn(edict_t *ent) { const spawn_func_t *s; gitem_t *item; int i; - if (!ent->classname) - { - gi.dprintf ("ED_CallSpawn: NULL classname\n"); + if (!ent->classname) { + gi.dprintf("ED_CallSpawn: NULL classname\n"); return; } // check item spawn functions - for (i=0,item=itemlist ; i<game.num_items ; i++,item++) - { + for (i = 0, item = itemlist ; i < game.num_items ; i++, item++) { if (!item->classname) continue; - if (!strcmp(item->classname, ent->classname)) - { // found it - SpawnItem (ent, item); + if (!strcmp(item->classname, ent->classname)) { + // found it + SpawnItem(ent, item); return; } } // check normal spawn functions - for (s=spawn_funcs ; s->name ; s++) - { - if (!strcmp(s->name, ent->classname)) - { // found it - s->spawn (ent); + for (s = spawn_funcs ; s->name ; s++) { + if (!strcmp(s->name, ent->classname)) { + // found it + s->spawn(ent); return; } } - gi.dprintf ("%s doesn't have a spawn function\n", ent->classname); + gi.dprintf("%s doesn't have a spawn function\n", ent->classname); } /* @@ -379,31 +376,28 @@ void ED_CallSpawn (edict_t *ent) ED_NewString ============= */ -static char *ED_NewString (const char *string) +static char *ED_NewString(const char *string) { char *newb, *new_p; - int i,l; - + int i, l; + l = strlen(string) + 1; - newb = gi.TagMalloc (l, TAG_LEVEL); + newb = gi.TagMalloc(l, TAG_LEVEL); new_p = newb; - for (i=0 ; i< l ; i++) - { - if (string[i] == '\\' && i < l-1) - { + for (i = 0 ; i < l ; i++) { + if (string[i] == '\\' && i < l - 1) { i++; if (string[i] == 'n') *new_p++ = '\n'; else *new_p++ = '\\'; - } - else + } else *new_p++ = string[i]; } - + return newb; } @@ -418,41 +412,39 @@ Takes a key/value pair and sets the binary values in an edict =============== */ -static qboolean ED_ParseField (const spawn_field_t *fields, const char *key, const char *value, byte *b) +static qboolean ED_ParseField(const spawn_field_t *fields, const char *key, const char *value, byte *b) { const spawn_field_t *f; float v; vec3_t vec; - for (f=fields ; f->name ; f++) - { - if (!Q_stricmp(f->name, key)) - { // found it - switch (f->type) - { + for (f = fields ; f->name ; f++) { + if (!Q_stricmp(f->name, key)) { + // found it + switch (f->type) { case F_LSTRING: - *(char **)(b+f->ofs) = ED_NewString (value); + *(char **)(b + f->ofs) = ED_NewString(value); break; case F_VECTOR: - if( sscanf (value, "%f %f %f", &vec[0], &vec[1], &vec[2]) != 3 ) { - gi.dprintf( "%s: couldn't parse '%s'\n", __func__, key ); - VectorClear( vec ); + if (sscanf(value, "%f %f %f", &vec[0], &vec[1], &vec[2]) != 3) { + gi.dprintf("%s: couldn't parse '%s'\n", __func__, key); + VectorClear(vec); } - ((float *)(b+f->ofs))[0] = vec[0]; - ((float *)(b+f->ofs))[1] = vec[1]; - ((float *)(b+f->ofs))[2] = vec[2]; + ((float *)(b + f->ofs))[0] = vec[0]; + ((float *)(b + f->ofs))[1] = vec[1]; + ((float *)(b + f->ofs))[2] = vec[2]; break; case F_INT: - *(int *)(b+f->ofs) = atoi(value); + *(int *)(b + f->ofs) = atoi(value); break; case F_FLOAT: - *(float *)(b+f->ofs) = atof(value); + *(float *)(b + f->ofs) = atof(value); break; case F_ANGLEHACK: v = atof(value); - ((float *)(b+f->ofs))[0] = 0; - ((float *)(b+f->ofs))[1] = v; - ((float *)(b+f->ofs))[2] = 0; + ((float *)(b + f->ofs))[0] = 0; + ((float *)(b + f->ofs))[1] = v; + ((float *)(b + f->ofs))[2] = 0; break; case F_IGNORE: break; @@ -473,48 +465,47 @@ Parses an edict out of the given string, returning the new position ed should be a properly initialized empty edict. ==================== */ -void ED_ParseEdict (const char **data, edict_t *ent) +void ED_ParseEdict(const char **data, edict_t *ent) { qboolean init; char *key, *value; init = qfalse; - memset (&st, 0, sizeof(st)); + memset(&st, 0, sizeof(st)); // go through all the dictionary pairs - while (1) - { - // parse key - key = COM_Parse (data); + while (1) { + // parse key + key = COM_Parse(data); if (key[0] == '}') break; if (!*data) - gi.error ("%s: EOF without closing brace", __func__); + gi.error("%s: EOF without closing brace", __func__); - // parse value - value = COM_Parse (data); + // parse value + value = COM_Parse(data); if (!*data) - gi.error ("%s: EOF without closing brace", __func__); + gi.error("%s: EOF without closing brace", __func__); if (value[0] == '}') - gi.error ("%s: closing brace without data", __func__); + gi.error("%s: closing brace without data", __func__); - init = qtrue; + init = qtrue; - // keynames with a leading underscore are used for utility comments, - // and are immediately discarded by quake + // keynames with a leading underscore are used for utility comments, + // and are immediately discarded by quake if (key[0] == '_') continue; - if( !ED_ParseField( spawn_fields, key, value, ( byte * )ent ) ) { - if( !ED_ParseField( temp_fields, key, value, ( byte * )&st ) ) { - gi.dprintf ("%s: %s is not a field\n", __func__, key); + if (!ED_ParseField(spawn_fields, key, value, (byte *)ent)) { + if (!ED_ParseField(temp_fields, key, value, (byte *)&st)) { + gi.dprintf("%s: %s is not a field\n", __func__, key); } } } if (!init) - memset (ent, 0, sizeof(*ent)); + memset(ent, 0, sizeof(*ent)); } @@ -528,7 +519,7 @@ All but the first will have the FL_TEAMSLAVE flag set. All but the last will have the teamchain field set to the next one ================ */ -void G_FindTeams (void) +void G_FindTeams(void) { edict_t *e, *e2, *chain; int i, j; @@ -536,8 +527,7 @@ void G_FindTeams (void) c = 0; c2 = 0; - for (i=1, e=g_edicts+i ; i < globals.num_edicts ; i++,e++) - { + for (i = 1, e = g_edicts + i ; i < globals.num_edicts ; i++, e++) { if (!e->inuse) continue; if (!e->team) @@ -548,16 +538,14 @@ void G_FindTeams (void) e->teammaster = e; c++; c2++; - for (j=i+1, e2=e+1 ; j < globals.num_edicts ; j++,e2++) - { + for (j = i + 1, e2 = e + 1 ; j < globals.num_edicts ; j++, e2++) { if (!e2->inuse) continue; if (!e2->team) continue; if (e2->flags & FL_TEAMSLAVE) continue; - if (!strcmp(e->team, e2->team)) - { + if (!strcmp(e->team, e2->team)) { c2++; chain->teamchain = e2; e2->teammaster = e; @@ -567,7 +555,7 @@ void G_FindTeams (void) } } - gi.dprintf ("%i teams with %i entities\n", c, c2); + gi.dprintf("%i teams with %i entities\n", c, c2); } /* @@ -578,7 +566,7 @@ Creates a server's entity / program execution context by parsing textual entity definitions out of an ent file. ============== */ -void SpawnEntities (const char *mapname, const char *entities, const char *spawnpoint) +void SpawnEntities(const char *mapname, const char *entities, const char *spawnpoint) { edict_t *ent; int inhibit; @@ -586,7 +574,7 @@ void SpawnEntities (const char *mapname, const char *entities, const char *spawn int i; float skill_level; - skill_level = floor (skill->value); + skill_level = floor(skill->value); if (skill_level < 0) skill_level = 0; if (skill_level > 3) @@ -594,76 +582,69 @@ void SpawnEntities (const char *mapname, const char *entities, const char *spawn if (skill->value != skill_level) gi.cvar_forceset("skill", va("%f", skill_level)); - SaveClientData (); + SaveClientData(); - gi.FreeTags (TAG_LEVEL); + gi.FreeTags(TAG_LEVEL); - memset (&level, 0, sizeof(level)); - memset (g_edicts, 0, game.maxentities * sizeof (g_edicts[0])); + memset(&level, 0, sizeof(level)); + memset(g_edicts, 0, game.maxentities * sizeof(g_edicts[0])); - strncpy (level.mapname, mapname, sizeof(level.mapname)-1); - strncpy (game.spawnpoint, spawnpoint, sizeof(game.spawnpoint)-1); + strncpy(level.mapname, mapname, sizeof(level.mapname) - 1); + strncpy(game.spawnpoint, spawnpoint, sizeof(game.spawnpoint) - 1); // set client fields on player ents - for (i=0 ; i<game.maxclients ; i++) - g_edicts[i+1].client = game.clients + i; + for (i = 0 ; i < game.maxclients ; i++) + g_edicts[i + 1].client = game.clients + i; ent = NULL; inhibit = 0; // parse ents - while (1) - { - // parse the opening brace - com_token = COM_Parse (&entities); + while (1) { + // parse the opening brace + com_token = COM_Parse(&entities); if (!entities) break; if (com_token[0] != '{') - gi.error ("ED_LoadFromFile: found %s when expecting {",com_token); + gi.error("ED_LoadFromFile: found %s when expecting {", com_token); if (!ent) ent = g_edicts; else - ent = G_Spawn (); - ED_ParseEdict (&entities, ent); + ent = G_Spawn(); + ED_ParseEdict(&entities, ent); // yet another map hack if (!Q_stricmp(level.mapname, "command") && !Q_stricmp(ent->classname, "trigger_once") && !Q_stricmp(ent->model, "*27")) ent->spawnflags &= ~SPAWNFLAG_NOT_HARD; // remove things (except the world) from different skill levels or deathmatch - if (ent != g_edicts) - { - if (deathmatch->value) - { - if ( ent->spawnflags & SPAWNFLAG_NOT_DEATHMATCH ) - { - G_FreeEdict (ent); + if (ent != g_edicts) { + if (deathmatch->value) { + if (ent->spawnflags & SPAWNFLAG_NOT_DEATHMATCH) { + G_FreeEdict(ent); inhibit++; continue; } - } - else - { + } else { if ( /* ((coop->value) && (ent->spawnflags & SPAWNFLAG_NOT_COOP)) || */ ((skill->value == 0) && (ent->spawnflags & SPAWNFLAG_NOT_EASY)) || ((skill->value == 1) && (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM)) || (((skill->value == 2) || (skill->value == 3)) && (ent->spawnflags & SPAWNFLAG_NOT_HARD)) - ) - { - G_FreeEdict (ent); - inhibit++; - continue; - } + ) { + G_FreeEdict(ent); + inhibit++; + continue; + } } - ent->spawnflags &= ~(SPAWNFLAG_NOT_EASY|SPAWNFLAG_NOT_MEDIUM|SPAWNFLAG_NOT_HARD|SPAWNFLAG_NOT_COOP|SPAWNFLAG_NOT_DEATHMATCH); + ent->spawnflags &= ~(SPAWNFLAG_NOT_EASY | SPAWNFLAG_NOT_MEDIUM | SPAWNFLAG_NOT_HARD | SPAWNFLAG_NOT_COOP | SPAWNFLAG_NOT_DEATHMATCH); } - ED_CallSpawn (ent); - } + ED_CallSpawn(ent); + } - gi.dprintf ("%i entities inhibited\n", inhibit); + gi.dprintf("%i entities inhibited\n", inhibit); #ifdef DEBUG i = 1; @@ -675,38 +656,38 @@ void SpawnEntities (const char *mapname, const char *entities, const char *spawn } #endif - G_FindTeams (); + G_FindTeams(); - PlayerTrail_Init (); + PlayerTrail_Init(); } //=================================================================== #if 0 - // cursor positioning - xl <value> - xr <value> - yb <value> - yt <value> - xv <value> - yv <value> - - // drawing - statpic <name> - pic <stat> - num <fieldwidth> <stat> - string <stat> - - // control - if <stat> - ifeq <stat> <value> - ifbit <stat> <value> - endif +// cursor positioning +xl <value> +xr <value> +yb <value> +yt <value> +xv <value> +yv <value> + +// drawing +statpic <name> +pic <stat> +num <fieldwidth> <stat> +string <stat> + +// control +if <stat> +ifeq <stat> <value> +ifbit <stat> <value> +endif #endif -static const char single_statusbar[] = +static const char single_statusbar[] = "yb -24 " // health @@ -757,7 +738,7 @@ static const char single_statusbar[] = " pic 9 " "endif " -// help / weapon icon +// help / weapon icon "if 11 " " xv 148 " " pic 11 " @@ -815,7 +796,7 @@ static const char dm_statusbar[] = " pic 9 " "endif " -// help / weapon icon +// help / weapon icon "if 11 " " xv 148 " " pic 11 " @@ -828,18 +809,18 @@ static const char dm_statusbar[] = // spectator "if 17 " - "xv 0 " - "yb -58 " - "string2 \"SPECTATOR MODE\" " +"xv 0 " +"yb -58 " +"string2 \"SPECTATOR MODE\" " "endif " // chase camera "if 16 " - "xv 0 " - "yb -68 " - "string \"Chasing\" " - "xv 64 " - "stat_string 16 " +"xv 0 " +"yb -68 " +"string \"Chasing\" " +"xv 64 " +"stat_string 16 " "endif " ; @@ -854,7 +835,7 @@ Only used for the world. "gravity" 800 is default gravity "message" text to print at user logon */ -void SP_worldspawn (edict_t *ent) +void SP_worldspawn(edict_t *ent) { ent->movetype = MOVETYPE_PUSH; ent->solid = SOLID_BSP; @@ -864,182 +845,180 @@ void SP_worldspawn (edict_t *ent) //--------------- // reserve some spots for dead player bodies for coop / deathmatch - InitBodyQue (); + InitBodyQue(); // set configstrings for items - SetItemNames (); + SetItemNames(); if (st.nextmap) - strcpy (level.nextmap, st.nextmap); + strcpy(level.nextmap, st.nextmap); // make some data visible to the server - if (ent->message && ent->message[0]) - { - gi.configstring (CS_NAME, ent->message); - strncpy (level.level_name, ent->message, sizeof(level.level_name)); - } - else - strncpy (level.level_name, level.mapname, sizeof(level.level_name)); + if (ent->message && ent->message[0]) { + gi.configstring(CS_NAME, ent->message); + strncpy(level.level_name, ent->message, sizeof(level.level_name)); + } else + strncpy(level.level_name, level.mapname, sizeof(level.level_name)); if (st.sky && st.sky[0]) - gi.configstring (CS_SKY, st.sky); + gi.configstring(CS_SKY, st.sky); else - gi.configstring (CS_SKY, "unit1_"); + gi.configstring(CS_SKY, "unit1_"); - gi.configstring (CS_SKYROTATE, va("%f", st.skyrotate) ); + gi.configstring(CS_SKYROTATE, va("%f", st.skyrotate)); - gi.configstring (CS_SKYAXIS, va("%f %f %f", - st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]) ); + gi.configstring(CS_SKYAXIS, va("%f %f %f", + st.skyaxis[0], st.skyaxis[1], st.skyaxis[2])); - gi.configstring (CS_CDTRACK, va("%i", ent->sounds) ); + gi.configstring(CS_CDTRACK, va("%i", ent->sounds)); - gi.configstring (CS_MAXCLIENTS, va("%i", (int)(maxclients->value) ) ); + gi.configstring(CS_MAXCLIENTS, va("%i", (int)(maxclients->value))); // status bar program if (deathmatch->value) - gi.configstring (CS_STATUSBAR, dm_statusbar); + gi.configstring(CS_STATUSBAR, dm_statusbar); else - gi.configstring (CS_STATUSBAR, single_statusbar); + gi.configstring(CS_STATUSBAR, single_statusbar); //--------------- // help icon for statusbar - gi.imageindex ("i_help"); - level.pic_health = gi.imageindex ("i_health"); - gi.imageindex ("help"); - gi.imageindex ("field_3"); + gi.imageindex("i_help"); + level.pic_health = gi.imageindex("i_health"); + gi.imageindex("help"); + gi.imageindex("field_3"); if (!st.gravity) gi.cvar_set("sv_gravity", "800"); else gi.cvar_set("sv_gravity", st.gravity); - snd_fry = gi.soundindex ("player/fry.wav"); // standing in lava / slime + snd_fry = gi.soundindex("player/fry.wav"); // standing in lava / slime - PrecacheItem (FindItem ("Blaster")); + PrecacheItem(FindItem("Blaster")); - gi.soundindex ("player/lava1.wav"); - gi.soundindex ("player/lava2.wav"); + gi.soundindex("player/lava1.wav"); + gi.soundindex("player/lava2.wav"); - gi.soundindex ("misc/pc_up.wav"); - gi.soundindex ("misc/talk1.wav"); + gi.soundindex("misc/pc_up.wav"); + gi.soundindex("misc/talk1.wav"); - gi.soundindex ("misc/udeath.wav"); + gi.soundindex("misc/udeath.wav"); // gibs - gi.soundindex ("items/respawn1.wav"); + gi.soundindex("items/respawn1.wav"); // sexed sounds - gi.soundindex ("*death1.wav"); - gi.soundindex ("*death2.wav"); - gi.soundindex ("*death3.wav"); - gi.soundindex ("*death4.wav"); - gi.soundindex ("*fall1.wav"); - gi.soundindex ("*fall2.wav"); - gi.soundindex ("*gurp1.wav"); // drowning damage - gi.soundindex ("*gurp2.wav"); - gi.soundindex ("*jump1.wav"); // player jump - gi.soundindex ("*pain25_1.wav"); - gi.soundindex ("*pain25_2.wav"); - gi.soundindex ("*pain50_1.wav"); - gi.soundindex ("*pain50_2.wav"); - gi.soundindex ("*pain75_1.wav"); - gi.soundindex ("*pain75_2.wav"); - gi.soundindex ("*pain100_1.wav"); - gi.soundindex ("*pain100_2.wav"); + gi.soundindex("*death1.wav"); + gi.soundindex("*death2.wav"); + gi.soundindex("*death3.wav"); + gi.soundindex("*death4.wav"); + gi.soundindex("*fall1.wav"); + gi.soundindex("*fall2.wav"); + gi.soundindex("*gurp1.wav"); // drowning damage + gi.soundindex("*gurp2.wav"); + gi.soundindex("*jump1.wav"); // player jump + gi.soundindex("*pain25_1.wav"); + gi.soundindex("*pain25_2.wav"); + gi.soundindex("*pain50_1.wav"); + gi.soundindex("*pain50_2.wav"); + gi.soundindex("*pain75_1.wav"); + gi.soundindex("*pain75_2.wav"); + gi.soundindex("*pain100_1.wav"); + gi.soundindex("*pain100_2.wav"); // sexed models // THIS ORDER MUST MATCH THE DEFINES IN g_local.h // you can add more, max 15 - gi.modelindex ("#w_blaster.md2"); - gi.modelindex ("#w_shotgun.md2"); - gi.modelindex ("#w_sshotgun.md2"); - gi.modelindex ("#w_machinegun.md2"); - gi.modelindex ("#w_chaingun.md2"); - gi.modelindex ("#a_grenades.md2"); - gi.modelindex ("#w_glauncher.md2"); - gi.modelindex ("#w_rlauncher.md2"); - gi.modelindex ("#w_hyperblaster.md2"); - gi.modelindex ("#w_railgun.md2"); - gi.modelindex ("#w_bfg.md2"); + gi.modelindex("#w_blaster.md2"); + gi.modelindex("#w_shotgun.md2"); + gi.modelindex("#w_sshotgun.md2"); + gi.modelindex("#w_machinegun.md2"); + gi.modelindex("#w_chaingun.md2"); + gi.modelindex("#a_grenades.md2"); + gi.modelindex("#w_glauncher.md2"); + gi.modelindex("#w_rlauncher.md2"); + gi.modelindex("#w_hyperblaster.md2"); + gi.modelindex("#w_railgun.md2"); + gi.modelindex("#w_bfg.md2"); //------------------- - gi.soundindex ("player/gasp1.wav"); // gasping for air - gi.soundindex ("player/gasp2.wav"); // head breaking surface, not gasping + gi.soundindex("player/gasp1.wav"); // gasping for air + gi.soundindex("player/gasp2.wav"); // head breaking surface, not gasping + + gi.soundindex("player/watr_in.wav"); // feet hitting water + gi.soundindex("player/watr_out.wav"); // feet leaving water - gi.soundindex ("player/watr_in.wav"); // feet hitting water - gi.soundindex ("player/watr_out.wav"); // feet leaving water + gi.soundindex("player/watr_un.wav"); // head going underwater - gi.soundindex ("player/watr_un.wav"); // head going underwater - - gi.soundindex ("player/u_breath1.wav"); - gi.soundindex ("player/u_breath2.wav"); + gi.soundindex("player/u_breath1.wav"); + gi.soundindex("player/u_breath2.wav"); - gi.soundindex ("items/pkup.wav"); // bonus item pickup - gi.soundindex ("world/land.wav"); // landing thud - gi.soundindex ("misc/h2ohit1.wav"); // landing splash + gi.soundindex("items/pkup.wav"); // bonus item pickup + gi.soundindex("world/land.wav"); // landing thud + gi.soundindex("misc/h2ohit1.wav"); // landing splash - gi.soundindex ("items/damage.wav"); - gi.soundindex ("items/protect.wav"); - gi.soundindex ("items/protect4.wav"); - gi.soundindex ("weapons/noammo.wav"); + gi.soundindex("items/damage.wav"); + gi.soundindex("items/protect.wav"); + gi.soundindex("items/protect4.wav"); + gi.soundindex("weapons/noammo.wav"); - gi.soundindex ("infantry/inflies1.wav"); + gi.soundindex("infantry/inflies1.wav"); - sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2"); - gi.modelindex ("models/objects/gibs/arm/tris.md2"); - gi.modelindex ("models/objects/gibs/bone/tris.md2"); - gi.modelindex ("models/objects/gibs/bone2/tris.md2"); - gi.modelindex ("models/objects/gibs/chest/tris.md2"); - gi.modelindex ("models/objects/gibs/skull/tris.md2"); - gi.modelindex ("models/objects/gibs/head2/tris.md2"); + sm_meat_index = gi.modelindex("models/objects/gibs/sm_meat/tris.md2"); + gi.modelindex("models/objects/gibs/arm/tris.md2"); + gi.modelindex("models/objects/gibs/bone/tris.md2"); + gi.modelindex("models/objects/gibs/bone2/tris.md2"); + gi.modelindex("models/objects/gibs/chest/tris.md2"); + gi.modelindex("models/objects/gibs/skull/tris.md2"); + gi.modelindex("models/objects/gibs/head2/tris.md2"); // // Setup light animation tables. 'a' is total darkness, 'z' is doublebright. // // 0 normal - gi.configstring(CS_LIGHTS+0, "m"); - + gi.configstring(CS_LIGHTS + 0, "m"); + // 1 FLICKER (first variety) - gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo"); - + gi.configstring(CS_LIGHTS + 1, "mmnmmommommnonmmonqnmmo"); + // 2 SLOW STRONG PULSE - gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); - + gi.configstring(CS_LIGHTS + 2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); + // 3 CANDLE (first variety) - gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); - + gi.configstring(CS_LIGHTS + 3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); + // 4 FAST STROBE - gi.configstring(CS_LIGHTS+4, "mamamamamama"); - + gi.configstring(CS_LIGHTS + 4, "mamamamamama"); + // 5 GENTLE PULSE 1 - gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj"); - + gi.configstring(CS_LIGHTS + 5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj"); + // 6 FLICKER (second variety) - gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno"); - + gi.configstring(CS_LIGHTS + 6, "nmonqnmomnmomomno"); + // 7 CANDLE (second variety) - gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm"); - + gi.configstring(CS_LIGHTS + 7, "mmmaaaabcdefgmmmmaaaammmaamm"); + // 8 CANDLE (third variety) - gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); - + gi.configstring(CS_LIGHTS + 8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); + // 9 SLOW STROBE (fourth variety) - gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz"); - + gi.configstring(CS_LIGHTS + 9, "aaaaaaaazzzzzzzz"); + // 10 FLUORESCENT FLICKER - gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma"); + gi.configstring(CS_LIGHTS + 10, "mmamammmmammamamaaamammma"); // 11 SLOW PULSE NOT FADE TO BLACK - gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); - + gi.configstring(CS_LIGHTS + 11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); + // styles 32-62 are assigned by the light program for switchable lights // 63 testing - gi.configstring(CS_LIGHTS+63, "a"); + gi.configstring(CS_LIGHTS + 63, "a"); } |