|
|
1.1 ! root 1: ! 2: #include "g_local.h" ! 3: ! 4: typedef struct ! 5: { ! 6: char *name; ! 7: void (*spawn)(edict_t *ent); ! 8: } spawn_t; ! 9: ! 10: ! 11: void SP_item_health (edict_t *self); ! 12: void SP_item_health_small (edict_t *self); ! 13: void SP_item_health_large (edict_t *self); ! 14: void SP_item_health_mega (edict_t *self); ! 15: ! 16: void SP_info_player_start (edict_t *ent); ! 17: void SP_info_player_deathmatch (edict_t *ent); ! 18: void SP_info_player_coop (edict_t *ent); ! 19: void SP_info_player_intermission (edict_t *ent); ! 20: ! 21: void SP_func_plat (edict_t *ent); ! 22: void SP_func_rotating (edict_t *ent); ! 23: void SP_func_button (edict_t *ent); ! 24: void SP_func_door (edict_t *ent); ! 25: void SP_func_door_secret (edict_t *ent); ! 26: void SP_func_door_rotating (edict_t *ent); ! 27: void SP_func_water (edict_t *ent); ! 28: void SP_func_train (edict_t *ent); ! 29: void SP_func_conveyor (edict_t *self); ! 30: void SP_func_wall (edict_t *self); ! 31: void SP_func_object (edict_t *self); ! 32: void SP_func_explosive (edict_t *self); ! 33: void SP_func_timer (edict_t *self); ! 34: void SP_func_areaportal (edict_t *ent); ! 35: void SP_func_clock (edict_t *ent); ! 36: void SP_func_killbox (edict_t *ent); ! 37: ! 38: void SP_trigger_always (edict_t *ent); ! 39: void SP_trigger_once (edict_t *ent); ! 40: void SP_trigger_multiple (edict_t *ent); ! 41: void SP_trigger_relay (edict_t *ent); ! 42: void SP_trigger_push (edict_t *ent); ! 43: void SP_trigger_hurt (edict_t *ent); ! 44: void SP_trigger_key (edict_t *ent); ! 45: void SP_trigger_counter (edict_t *ent); ! 46: void SP_trigger_elevator (edict_t *ent); ! 47: void SP_trigger_gravity (edict_t *ent); ! 48: void SP_trigger_monsterjump (edict_t *ent); ! 49: ! 50: void SP_target_temp_entity (edict_t *ent); ! 51: void SP_target_speaker (edict_t *ent); ! 52: void SP_target_explosion (edict_t *ent); ! 53: void SP_target_changelevel (edict_t *ent); ! 54: void SP_target_secret (edict_t *ent); ! 55: void SP_target_goal (edict_t *ent); ! 56: void SP_target_splash (edict_t *ent); ! 57: void SP_target_spawner (edict_t *ent); ! 58: void SP_target_blaster (edict_t *ent); ! 59: void SP_target_crosslevel_trigger (edict_t *ent); ! 60: void SP_target_crosslevel_target (edict_t *ent); ! 61: void SP_target_laser (edict_t *self); ! 62: void SP_target_help (edict_t *ent); ! 63: void SP_target_actor (edict_t *ent); ! 64: void SP_target_lightramp (edict_t *self); ! 65: void SP_target_earthquake (edict_t *ent); ! 66: void SP_target_character (edict_t *ent); ! 67: void SP_target_string (edict_t *ent); ! 68: ! 69: void SP_worldspawn (edict_t *ent); ! 70: void SP_viewthing (edict_t *ent); ! 71: ! 72: void SP_light (edict_t *self); ! 73: void SP_light_mine1 (edict_t *ent); ! 74: void SP_light_mine2 (edict_t *ent); ! 75: void SP_info_null (edict_t *self); ! 76: void SP_info_notnull (edict_t *self); ! 77: void SP_path_corner (edict_t *self); ! 78: void SP_point_combat (edict_t *self); ! 79: ! 80: void SP_misc_explobox (edict_t *self); ! 81: void SP_misc_banner (edict_t *self); ! 82: void SP_misc_satellite_dish (edict_t *self); ! 83: void SP_misc_actor (edict_t *self); ! 84: void SP_misc_gib_arm (edict_t *self); ! 85: void SP_misc_gib_leg (edict_t *self); ! 86: void SP_misc_gib_head (edict_t *self); ! 87: void SP_misc_insane (edict_t *self); ! 88: void SP_misc_deadsoldier (edict_t *self); ! 89: void SP_misc_viper (edict_t *self); ! 90: void SP_misc_viper_bomb (edict_t *self); ! 91: void SP_misc_bigviper (edict_t *self); ! 92: void SP_misc_strogg_ship (edict_t *self); ! 93: void SP_misc_teleporter (edict_t *self); ! 94: void SP_misc_teleporter_dest (edict_t *self); ! 95: void SP_misc_blackhole (edict_t *self); ! 96: void SP_misc_eastertank (edict_t *self); ! 97: void SP_misc_easterchick (edict_t *self); ! 98: void SP_misc_easterchick2 (edict_t *self); ! 99: ! 100: void SP_monster_berserk (edict_t *self); ! 101: void SP_monster_gladiator (edict_t *self); ! 102: void SP_monster_gunner (edict_t *self); ! 103: void SP_monster_infantry (edict_t *self); ! 104: void SP_monster_soldier_light (edict_t *self); ! 105: void SP_monster_soldier (edict_t *self); ! 106: void SP_monster_soldier_ss (edict_t *self); ! 107: void SP_monster_tank (edict_t *self); ! 108: void SP_monster_medic (edict_t *self); ! 109: void SP_monster_flipper (edict_t *self); ! 110: void SP_monster_chick (edict_t *self); ! 111: void SP_monster_parasite (edict_t *self); ! 112: void SP_monster_flyer (edict_t *self); ! 113: void SP_monster_brain (edict_t *self); ! 114: void SP_monster_floater (edict_t *self); ! 115: void SP_monster_hover (edict_t *self); ! 116: void SP_monster_mutant (edict_t *self); ! 117: void SP_monster_supertank (edict_t *self); ! 118: void SP_monster_boss2 (edict_t *self); ! 119: void SP_monster_jorg (edict_t *self); ! 120: void SP_monster_boss3_stand (edict_t *self); ! 121: ! 122: void SP_monster_commander_body (edict_t *self); ! 123: ! 124: void SP_turret_breach (edict_t *self); ! 125: void SP_turret_base (edict_t *self); ! 126: void SP_turret_driver (edict_t *self); ! 127: ! 128: ! 129: spawn_t spawns[] = { ! 130: {"item_health", SP_item_health}, ! 131: {"item_health_small", SP_item_health_small}, ! 132: {"item_health_large", SP_item_health_large}, ! 133: {"item_health_mega", SP_item_health_mega}, ! 134: ! 135: {"info_player_start", SP_info_player_start}, ! 136: {"info_player_deathmatch", SP_info_player_deathmatch}, ! 137: {"info_player_coop", SP_info_player_coop}, ! 138: {"info_player_intermission", SP_info_player_intermission}, ! 139: //ZOID ! 140: {"info_player_team1", SP_info_player_team1}, ! 141: {"info_player_team2", SP_info_player_team2}, ! 142: //ZOID ! 143: ! 144: {"func_plat", SP_func_plat}, ! 145: {"func_button", SP_func_button}, ! 146: {"func_door", SP_func_door}, ! 147: {"func_door_secret", SP_func_door_secret}, ! 148: {"func_door_rotating", SP_func_door_rotating}, ! 149: {"func_rotating", SP_func_rotating}, ! 150: {"func_train", SP_func_train}, ! 151: {"func_water", SP_func_water}, ! 152: {"func_conveyor", SP_func_conveyor}, ! 153: {"func_areaportal", SP_func_areaportal}, ! 154: {"func_clock", SP_func_clock}, ! 155: {"func_wall", SP_func_wall}, ! 156: {"func_object", SP_func_object}, ! 157: {"func_timer", SP_func_timer}, ! 158: {"func_explosive", SP_func_explosive}, ! 159: {"func_killbox", SP_func_killbox}, ! 160: ! 161: {"trigger_always", SP_trigger_always}, ! 162: {"trigger_once", SP_trigger_once}, ! 163: {"trigger_multiple", SP_trigger_multiple}, ! 164: {"trigger_relay", SP_trigger_relay}, ! 165: {"trigger_push", SP_trigger_push}, ! 166: {"trigger_hurt", SP_trigger_hurt}, ! 167: {"trigger_key", SP_trigger_key}, ! 168: {"trigger_counter", SP_trigger_counter}, ! 169: {"trigger_elevator", SP_trigger_elevator}, ! 170: {"trigger_gravity", SP_trigger_gravity}, ! 171: {"trigger_monsterjump", SP_trigger_monsterjump}, ! 172: ! 173: {"target_temp_entity", SP_target_temp_entity}, ! 174: {"target_speaker", SP_target_speaker}, ! 175: {"target_explosion", SP_target_explosion}, ! 176: {"target_changelevel", SP_target_changelevel}, ! 177: {"target_secret", SP_target_secret}, ! 178: {"target_goal", SP_target_goal}, ! 179: {"target_splash", SP_target_splash}, ! 180: {"target_spawner", SP_target_spawner}, ! 181: {"target_blaster", SP_target_blaster}, ! 182: {"target_crosslevel_trigger", SP_target_crosslevel_trigger}, ! 183: {"target_crosslevel_target", SP_target_crosslevel_target}, ! 184: {"target_laser", SP_target_laser}, ! 185: {"target_help", SP_target_help}, ! 186: #if 0 // remove monster code ! 187: {"target_actor", SP_target_actor}, ! 188: #endif ! 189: {"target_lightramp", SP_target_lightramp}, ! 190: {"target_earthquake", SP_target_earthquake}, ! 191: {"target_character", SP_target_character}, ! 192: {"target_string", SP_target_string}, ! 193: ! 194: {"worldspawn", SP_worldspawn}, ! 195: {"viewthing", SP_viewthing}, ! 196: ! 197: {"light", SP_light}, ! 198: {"light_mine1", SP_light_mine1}, ! 199: {"light_mine2", SP_light_mine2}, ! 200: {"info_null", SP_info_null}, ! 201: {"func_group", SP_info_null}, ! 202: {"info_notnull", SP_info_notnull}, ! 203: {"path_corner", SP_path_corner}, ! 204: {"point_combat", SP_point_combat}, ! 205: ! 206: {"misc_explobox", SP_misc_explobox}, ! 207: {"misc_banner", SP_misc_banner}, ! 208: //ZOID ! 209: {"misc_ctf_banner", SP_misc_ctf_banner}, ! 210: {"misc_ctf_small_banner", SP_misc_ctf_small_banner}, ! 211: //ZOID ! 212: {"misc_satellite_dish", SP_misc_satellite_dish}, ! 213: #if 0 // remove monster code ! 214: {"misc_actor", SP_misc_actor}, ! 215: #endif ! 216: {"misc_gib_arm", SP_misc_gib_arm}, ! 217: {"misc_gib_leg", SP_misc_gib_leg}, ! 218: {"misc_gib_head", SP_misc_gib_head}, ! 219: #if 0 // remove monster code ! 220: {"misc_insane", SP_misc_insane}, ! 221: #endif ! 222: {"misc_deadsoldier", SP_misc_deadsoldier}, ! 223: {"misc_viper", SP_misc_viper}, ! 224: {"misc_viper_bomb", SP_misc_viper_bomb}, ! 225: {"misc_bigviper", SP_misc_bigviper}, ! 226: {"misc_strogg_ship", SP_misc_strogg_ship}, ! 227: {"misc_teleporter", SP_misc_teleporter}, ! 228: {"misc_teleporter_dest", SP_misc_teleporter_dest}, ! 229: //ZOID ! 230: {"trigger_teleport", SP_trigger_teleport}, ! 231: {"info_teleport_destination", SP_info_teleport_destination}, ! 232: //ZOID ! 233: {"misc_blackhole", SP_misc_blackhole}, ! 234: {"misc_eastertank", SP_misc_eastertank}, ! 235: {"misc_easterchick", SP_misc_easterchick}, ! 236: {"misc_easterchick2", SP_misc_easterchick2}, ! 237: ! 238: #if 0 // remove monster code ! 239: {"monster_berserk", SP_monster_berserk}, ! 240: {"monster_gladiator", SP_monster_gladiator}, ! 241: {"monster_gunner", SP_monster_gunner}, ! 242: {"monster_infantry", SP_monster_infantry}, ! 243: {"monster_soldier_light", SP_monster_soldier_light}, ! 244: {"monster_soldier", SP_monster_soldier}, ! 245: {"monster_soldier_ss", SP_monster_soldier_ss}, ! 246: {"monster_tank", SP_monster_tank}, ! 247: {"monster_tank_commander", SP_monster_tank}, ! 248: {"monster_medic", SP_monster_medic}, ! 249: {"monster_flipper", SP_monster_flipper}, ! 250: {"monster_chick", SP_monster_chick}, ! 251: {"monster_parasite", SP_monster_parasite}, ! 252: {"monster_flyer", SP_monster_flyer}, ! 253: {"monster_brain", SP_monster_brain}, ! 254: {"monster_floater", SP_monster_floater}, ! 255: {"monster_hover", SP_monster_hover}, ! 256: {"monster_mutant", SP_monster_mutant}, ! 257: {"monster_supertank", SP_monster_supertank}, ! 258: {"monster_boss2", SP_monster_boss2}, ! 259: {"monster_boss3_stand", SP_monster_boss3_stand}, ! 260: {"monster_jorg", SP_monster_jorg}, ! 261: ! 262: {"monster_commander_body", SP_monster_commander_body}, ! 263: ! 264: {"turret_breach", SP_turret_breach}, ! 265: {"turret_base", SP_turret_base}, ! 266: {"turret_driver", SP_turret_driver}, ! 267: #endif ! 268: ! 269: {NULL, NULL} ! 270: }; ! 271: ! 272: /* ! 273: =============== ! 274: ED_CallSpawn ! 275: ! 276: Finds the spawn function for the entity and calls it ! 277: =============== ! 278: */ ! 279: void ED_CallSpawn (edict_t *ent) ! 280: { ! 281: spawn_t *s; ! 282: gitem_t *item; ! 283: int i; ! 284: ! 285: if (!ent->classname) ! 286: { ! 287: gi.dprintf ("ED_CallSpawn: NULL classname\n"); ! 288: return; ! 289: } ! 290: ! 291: // check item spawn functions ! 292: for (i=0,item=itemlist ; i<game.num_items ; i++,item++) ! 293: { ! 294: if (!item->classname) ! 295: continue; ! 296: if (!strcmp(item->classname, ent->classname)) ! 297: { // found it ! 298: SpawnItem (ent, item); ! 299: return; ! 300: } ! 301: } ! 302: ! 303: // check normal spawn functions ! 304: for (s=spawns ; s->name ; s++) ! 305: { ! 306: if (!strcmp(s->name, ent->classname)) ! 307: { // found it ! 308: s->spawn (ent); ! 309: return; ! 310: } ! 311: } ! 312: gi.dprintf ("%s doesn't have a spawn function\n", ent->classname); ! 313: } ! 314: ! 315: /* ! 316: ============= ! 317: ED_NewString ! 318: ============= ! 319: */ ! 320: char *ED_NewString (char *string) ! 321: { ! 322: char *newb, *new_p; ! 323: int i,l; ! 324: ! 325: l = strlen(string) + 1; ! 326: ! 327: newb = gi.TagMalloc (l, TAG_LEVEL); ! 328: ! 329: new_p = newb; ! 330: ! 331: for (i=0 ; i< l ; i++) ! 332: { ! 333: if (string[i] == '\\' && i < l-1) ! 334: { ! 335: i++; ! 336: if (string[i] == 'n') ! 337: *new_p++ = '\n'; ! 338: else ! 339: *new_p++ = '\\'; ! 340: } ! 341: else ! 342: *new_p++ = string[i]; ! 343: } ! 344: ! 345: return newb; ! 346: } ! 347: ! 348: ! 349: ! 350: ! 351: /* ! 352: =============== ! 353: ED_ParseField ! 354: ! 355: Takes a key/value pair and sets the binary values ! 356: in an edict ! 357: =============== ! 358: */ ! 359: void ED_ParseField (char *key, char *value, edict_t *ent) ! 360: { ! 361: field_t *f; ! 362: byte *b; ! 363: float v; ! 364: vec3_t vec; ! 365: ! 366: for (f=fields ; f->name ; f++) ! 367: { ! 368: if (!Q_stricmp(f->name, key)) ! 369: { // found it ! 370: if (f->flags & FFL_SPAWNTEMP) ! 371: b = (byte *)&st; ! 372: else ! 373: b = (byte *)ent; ! 374: ! 375: switch (f->type) ! 376: { ! 377: case F_LSTRING: ! 378: *(char **)(b+f->ofs) = ED_NewString (value); ! 379: break; ! 380: case F_VECTOR: ! 381: sscanf (value, "%f %f %f", &vec[0], &vec[1], &vec[2]); ! 382: ((float *)(b+f->ofs))[0] = vec[0]; ! 383: ((float *)(b+f->ofs))[1] = vec[1]; ! 384: ((float *)(b+f->ofs))[2] = vec[2]; ! 385: break; ! 386: case F_INT: ! 387: *(int *)(b+f->ofs) = atoi(value); ! 388: break; ! 389: case F_FLOAT: ! 390: *(float *)(b+f->ofs) = atof(value); ! 391: break; ! 392: case F_ANGLEHACK: ! 393: v = atof(value); ! 394: ((float *)(b+f->ofs))[0] = 0; ! 395: ((float *)(b+f->ofs))[1] = v; ! 396: ((float *)(b+f->ofs))[2] = 0; ! 397: break; ! 398: case F_IGNORE: ! 399: break; ! 400: } ! 401: return; ! 402: } ! 403: } ! 404: gi.dprintf ("%s is not a field\n", key); ! 405: } ! 406: ! 407: /* ! 408: ==================== ! 409: ED_ParseEdict ! 410: ! 411: Parses an edict out of the given string, returning the new position ! 412: ed should be a properly initialized empty edict. ! 413: ==================== ! 414: */ ! 415: char *ED_ParseEdict (char *data, edict_t *ent) ! 416: { ! 417: qboolean init; ! 418: char keyname[256]; ! 419: char *com_token; ! 420: ! 421: init = false; ! 422: memset (&st, 0, sizeof(st)); ! 423: ! 424: // go through all the dictionary pairs ! 425: while (1) ! 426: { ! 427: // parse key ! 428: com_token = COM_Parse (&data); ! 429: if (com_token[0] == '}') ! 430: break; ! 431: if (!data) ! 432: gi.error ("ED_ParseEntity: EOF without closing brace"); ! 433: ! 434: strncpy (keyname, com_token, sizeof(keyname)-1); ! 435: ! 436: // parse value ! 437: com_token = COM_Parse (&data); ! 438: if (!data) ! 439: gi.error ("ED_ParseEntity: EOF without closing brace"); ! 440: ! 441: if (com_token[0] == '}') ! 442: gi.error ("ED_ParseEntity: closing brace without data"); ! 443: ! 444: init = true; ! 445: ! 446: // keynames with a leading underscore are used for utility comments, ! 447: // and are immediately discarded by quake ! 448: if (keyname[0] == '_') ! 449: continue; ! 450: ! 451: ED_ParseField (keyname, com_token, ent); ! 452: } ! 453: ! 454: if (!init) ! 455: memset (ent, 0, sizeof(*ent)); ! 456: ! 457: return data; ! 458: } ! 459: ! 460: ! 461: /* ! 462: ================ ! 463: G_FindTeams ! 464: ! 465: Chain together all entities with a matching team field. ! 466: ! 467: All but the first will have the FL_TEAMSLAVE flag set. ! 468: All but the last will have the teamchain field set to the next one ! 469: ================ ! 470: */ ! 471: void G_FindTeams (void) ! 472: { ! 473: edict_t *e, *e2, *chain; ! 474: int i, j; ! 475: int c, c2; ! 476: ! 477: c = 0; ! 478: c2 = 0; ! 479: for (i=1, e=g_edicts+i ; i < globals.num_edicts ; i++,e++) ! 480: { ! 481: if (!e->inuse) ! 482: continue; ! 483: if (!e->team) ! 484: continue; ! 485: if (e->flags & FL_TEAMSLAVE) ! 486: continue; ! 487: chain = e; ! 488: e->teammaster = e; ! 489: c++; ! 490: c2++; ! 491: for (j=i+1, e2=e+1 ; j < globals.num_edicts ; j++,e2++) ! 492: { ! 493: if (!e2->inuse) ! 494: continue; ! 495: if (!e2->team) ! 496: continue; ! 497: if (e2->flags & FL_TEAMSLAVE) ! 498: continue; ! 499: if (!strcmp(e->team, e2->team)) ! 500: { ! 501: c2++; ! 502: chain->teamchain = e2; ! 503: e2->teammaster = e; ! 504: chain = e2; ! 505: e2->flags |= FL_TEAMSLAVE; ! 506: } ! 507: } ! 508: } ! 509: ! 510: gi.dprintf ("%i teams with %i entities\n", c, c2); ! 511: } ! 512: ! 513: /* ! 514: ============== ! 515: SpawnEntities ! 516: ! 517: Creates a server's entity / program execution context by ! 518: parsing textual entity definitions out of an ent file. ! 519: ============== ! 520: */ ! 521: void SpawnEntities (char *mapname, char *entities, char *spawnpoint) ! 522: { ! 523: edict_t *ent; ! 524: int inhibit; ! 525: char *com_token; ! 526: int i; ! 527: float skill_level; ! 528: ! 529: skill_level = floor (skill->value); ! 530: if (skill_level < 0) ! 531: skill_level = 0; ! 532: if (skill_level > 3) ! 533: skill_level = 3; ! 534: if (skill->value != skill_level) ! 535: gi.cvar_forceset("skill", va("%f", skill_level)); ! 536: ! 537: SaveClientData (); ! 538: ! 539: gi.FreeTags (TAG_LEVEL); ! 540: ! 541: memset (&level, 0, sizeof(level)); ! 542: memset (g_edicts, 0, game.maxentities * sizeof (g_edicts[0])); ! 543: ! 544: strncpy (level.mapname, mapname, sizeof(level.mapname)-1); ! 545: strncpy (game.spawnpoint, spawnpoint, sizeof(game.spawnpoint)-1); ! 546: ! 547: // set client fields on player ents ! 548: for (i=0 ; i<game.maxclients ; i++) ! 549: g_edicts[i+1].client = game.clients + i; ! 550: ! 551: ent = NULL; ! 552: inhibit = 0; ! 553: ! 554: // parse ents ! 555: while (1) ! 556: { ! 557: // parse the opening brace ! 558: com_token = COM_Parse (&entities); ! 559: if (!entities) ! 560: break; ! 561: if (com_token[0] != '{') ! 562: gi.error ("ED_LoadFromFile: found %s when expecting {",com_token); ! 563: ! 564: if (!ent) ! 565: ent = g_edicts; ! 566: else ! 567: ent = G_Spawn (); ! 568: entities = ED_ParseEdict (entities, ent); ! 569: ! 570: // yet another map hack ! 571: if (!stricmp(level.mapname, "command") && !stricmp(ent->classname, "trigger_once") && !stricmp(ent->model, "*27")) ! 572: ent->spawnflags &= ~SPAWNFLAG_NOT_HARD; ! 573: ! 574: // remove things (except the world) from different skill levels or deathmatch ! 575: if (ent != g_edicts) ! 576: { ! 577: if (deathmatch->value) ! 578: { ! 579: if ( ent->spawnflags & SPAWNFLAG_NOT_DEATHMATCH ) ! 580: { ! 581: G_FreeEdict (ent); ! 582: inhibit++; ! 583: continue; ! 584: } ! 585: } ! 586: else ! 587: { ! 588: if ( /* ((coop->value) && (ent->spawnflags & SPAWNFLAG_NOT_COOP)) || */ ! 589: ((skill->value == 0) && (ent->spawnflags & SPAWNFLAG_NOT_EASY)) || ! 590: ((skill->value == 1) && (ent->spawnflags & SPAWNFLAG_NOT_MEDIUM)) || ! 591: (((skill->value == 2) || (skill->value == 3)) && (ent->spawnflags & SPAWNFLAG_NOT_HARD)) ! 592: ) ! 593: { ! 594: G_FreeEdict (ent); ! 595: inhibit++; ! 596: continue; ! 597: } ! 598: } ! 599: ! 600: ent->spawnflags &= ~(SPAWNFLAG_NOT_EASY|SPAWNFLAG_NOT_MEDIUM|SPAWNFLAG_NOT_HARD|SPAWNFLAG_NOT_COOP|SPAWNFLAG_NOT_DEATHMATCH); ! 601: } ! 602: ! 603: ED_CallSpawn (ent); ! 604: } ! 605: ! 606: gi.dprintf ("%i entities inhibited\n", inhibit); ! 607: ! 608: G_FindTeams (); ! 609: ! 610: PlayerTrail_Init (); ! 611: ! 612: //ZOID ! 613: CTFSpawn(); ! 614: //ZOID ! 615: } ! 616: ! 617: ! 618: //=================================================================== ! 619: ! 620: #if 0 ! 621: // cursor positioning ! 622: xl <value> ! 623: xr <value> ! 624: yb <value> ! 625: yt <value> ! 626: xv <value> ! 627: yv <value> ! 628: ! 629: // drawing ! 630: statpic <name> ! 631: pic <stat> ! 632: num <fieldwidth> <stat> ! 633: string <stat> ! 634: ! 635: // control ! 636: if <stat> ! 637: ifeq <stat> <value> ! 638: ifbit <stat> <value> ! 639: endif ! 640: ! 641: #endif ! 642: ! 643: char *single_statusbar = ! 644: "yb -24 " ! 645: ! 646: // health ! 647: "xv 0 " ! 648: "hnum " ! 649: "xv 50 " ! 650: "pic 0 " ! 651: ! 652: // ammo ! 653: "if 2 " ! 654: " xv 100 " ! 655: " anum " ! 656: " xv 150 " ! 657: " pic 2 " ! 658: "endif " ! 659: ! 660: // armor ! 661: "if 4 " ! 662: " xv 200 " ! 663: " rnum " ! 664: " xv 250 " ! 665: " pic 4 " ! 666: "endif " ! 667: ! 668: // selected item ! 669: "if 6 " ! 670: " xv 296 " ! 671: " pic 6 " ! 672: "endif " ! 673: ! 674: "yb -50 " ! 675: ! 676: // picked up item ! 677: "if 7 " ! 678: " xv 0 " ! 679: " pic 7 " ! 680: " xv 26 " ! 681: " yb -42 " ! 682: " stat_string 8 " ! 683: " yb -50 " ! 684: "endif " ! 685: ! 686: // timer ! 687: "if 9 " ! 688: " xv 262 " ! 689: " num 2 10 " ! 690: " xv 296 " ! 691: " pic 9 " ! 692: "endif " ! 693: ! 694: // help / weapon icon ! 695: "if 11 " ! 696: " xv 148 " ! 697: " pic 11 " ! 698: "endif " ! 699: ; ! 700: ! 701: char *dm_statusbar = ! 702: "yb -24 " ! 703: ! 704: // health ! 705: "xv 0 " ! 706: "hnum " ! 707: "xv 50 " ! 708: "pic 0 " ! 709: ! 710: // ammo ! 711: "if 2 " ! 712: " xv 100 " ! 713: " anum " ! 714: " xv 150 " ! 715: " pic 2 " ! 716: "endif " ! 717: ! 718: // armor ! 719: "if 4 " ! 720: " xv 200 " ! 721: " rnum " ! 722: " xv 250 " ! 723: " pic 4 " ! 724: "endif " ! 725: ! 726: // selected item ! 727: "if 6 " ! 728: " xv 296 " ! 729: " pic 6 " ! 730: "endif " ! 731: ! 732: "yb -50 " ! 733: ! 734: // picked up item ! 735: "if 7 " ! 736: " xv 0 " ! 737: " pic 7 " ! 738: " xv 26 " ! 739: " yb -42 " ! 740: " stat_string 8 " ! 741: " yb -50 " ! 742: "endif " ! 743: ! 744: // timer ! 745: "if 9 " ! 746: " xv 246 " ! 747: " num 2 10 " ! 748: " xv 296 " ! 749: " pic 9 " ! 750: "endif " ! 751: ! 752: // help / weapon icon ! 753: "if 11 " ! 754: " xv 148 " ! 755: " pic 11 " ! 756: "endif " ! 757: ! 758: // frags ! 759: "xr -50 " ! 760: "yt 2 " ! 761: "num 3 14" ! 762: ; ! 763: ! 764: ! 765: /*QUAKED worldspawn (0 0 0) ? ! 766: ! 767: Only used for the world. ! 768: "sky" environment map name ! 769: "skyaxis" vector axis for rotating sky ! 770: "skyrotate" speed of rotation in degrees/second ! 771: "sounds" music cd track number ! 772: "gravity" 800 is default gravity ! 773: "message" text to print at user logon ! 774: */ ! 775: void SP_worldspawn (edict_t *ent) ! 776: { ! 777: ent->movetype = MOVETYPE_PUSH; ! 778: ent->solid = SOLID_BSP; ! 779: ent->inuse = true; // since the world doesn't use G_Spawn() ! 780: ent->s.modelindex = 1; // world model is always index 1 ! 781: ! 782: //--------------- ! 783: ! 784: // reserve some spots for dead player bodies for coop / deathmatch ! 785: InitBodyQue (); ! 786: ! 787: // set configstrings for items ! 788: SetItemNames (); ! 789: ! 790: if (st.nextmap) ! 791: strcpy (level.nextmap, st.nextmap); ! 792: ! 793: // make some data visible to the server ! 794: ! 795: if (ent->message && ent->message[0]) ! 796: { ! 797: gi.configstring (CS_NAME, ent->message); ! 798: strncpy (level.level_name, ent->message, sizeof(level.level_name)); ! 799: } ! 800: else ! 801: strncpy (level.level_name, level.mapname, sizeof(level.level_name)); ! 802: ! 803: if (st.sky && st.sky[0]) ! 804: gi.configstring (CS_SKY, st.sky); ! 805: else ! 806: gi.configstring (CS_SKY, "unit1_"); ! 807: ! 808: gi.configstring (CS_SKYROTATE, va("%f", st.skyrotate) ); ! 809: ! 810: gi.configstring (CS_SKYAXIS, va("%f %f %f", ! 811: st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]) ); ! 812: ! 813: gi.configstring (CS_CDTRACK, va("%i", ent->sounds) ); ! 814: ! 815: gi.configstring (CS_MAXCLIENTS, va("%i", (int)(maxclients->value) ) ); ! 816: ! 817: // status bar program ! 818: if (deathmatch->value) ! 819: //ZOID ! 820: if (ctf->value) { ! 821: gi.configstring (CS_STATUSBAR, ctf_statusbar); ! 822: //precaches ! 823: gi.imageindex("i_ctf1"); ! 824: gi.imageindex("i_ctf2"); ! 825: gi.imageindex("i_ctf1d"); ! 826: gi.imageindex("i_ctf2d"); ! 827: gi.imageindex("i_ctf1t"); ! 828: gi.imageindex("i_ctf2t"); ! 829: gi.imageindex("i_ctfj"); ! 830: } else ! 831: //ZOID ! 832: gi.configstring (CS_STATUSBAR, dm_statusbar); ! 833: else ! 834: gi.configstring (CS_STATUSBAR, single_statusbar); ! 835: ! 836: //--------------- ! 837: ! 838: ! 839: // help icon for statusbar ! 840: gi.imageindex ("i_help"); ! 841: level.pic_health = gi.imageindex ("i_health"); ! 842: gi.imageindex ("help"); ! 843: gi.imageindex ("field_3"); ! 844: ! 845: if (!st.gravity) ! 846: gi.cvar_set("sv_gravity", "800"); ! 847: else ! 848: gi.cvar_set("sv_gravity", st.gravity); ! 849: ! 850: snd_fry = gi.soundindex ("player/fry.wav"); // standing in lava / slime ! 851: ! 852: PrecacheItem (FindItem ("Blaster")); ! 853: ! 854: gi.soundindex ("player/lava1.wav"); ! 855: gi.soundindex ("player/lava2.wav"); ! 856: ! 857: gi.soundindex ("misc/pc_up.wav"); ! 858: gi.soundindex ("misc/talk1.wav"); ! 859: ! 860: gi.soundindex ("misc/udeath.wav"); ! 861: ! 862: // gibs ! 863: gi.soundindex ("items/respawn1.wav"); ! 864: ! 865: // sexed sounds ! 866: gi.soundindex ("*death1.wav"); ! 867: gi.soundindex ("*death2.wav"); ! 868: gi.soundindex ("*death3.wav"); ! 869: gi.soundindex ("*death4.wav"); ! 870: gi.soundindex ("*fall1.wav"); ! 871: gi.soundindex ("*fall2.wav"); ! 872: gi.soundindex ("*gurp1.wav"); // drowning damage ! 873: gi.soundindex ("*gurp2.wav"); ! 874: gi.soundindex ("*jump1.wav"); // player jump ! 875: gi.soundindex ("*pain25_1.wav"); ! 876: gi.soundindex ("*pain25_2.wav"); ! 877: gi.soundindex ("*pain50_1.wav"); ! 878: gi.soundindex ("*pain50_2.wav"); ! 879: gi.soundindex ("*pain75_1.wav"); ! 880: gi.soundindex ("*pain75_2.wav"); ! 881: gi.soundindex ("*pain100_1.wav"); ! 882: gi.soundindex ("*pain100_2.wav"); ! 883: ! 884: #if 0 //DISABLED ! 885: // sexed models ! 886: // THIS ORDER MUST MATCH THE DEFINES IN g_local.h ! 887: // you can add more, max 15 ! 888: gi.modelindex ("#w_blaster.md2"); ! 889: gi.modelindex ("#w_shotgun.md2"); ! 890: gi.modelindex ("#w_sshotgun.md2"); ! 891: gi.modelindex ("#w_machinegun.md2"); ! 892: gi.modelindex ("#w_chaingun.md2"); ! 893: gi.modelindex ("#a_grenades.md2"); ! 894: gi.modelindex ("#w_glauncher.md2"); ! 895: gi.modelindex ("#w_rlauncher.md2"); ! 896: gi.modelindex ("#w_hyperblaster.md2"); ! 897: gi.modelindex ("#w_railgun.md2"); ! 898: gi.modelindex ("#w_bfg.md2"); ! 899: gi.modelindex ("#w_grapple.md2"); ! 900: #endif ! 901: ! 902: //------------------- ! 903: ! 904: gi.soundindex ("player/gasp1.wav"); // gasping for air ! 905: gi.soundindex ("player/gasp2.wav"); // head breaking surface, not gasping ! 906: ! 907: gi.soundindex ("player/watr_in.wav"); // feet hitting water ! 908: gi.soundindex ("player/watr_out.wav"); // feet leaving water ! 909: ! 910: gi.soundindex ("player/watr_un.wav"); // head going underwater ! 911: ! 912: gi.soundindex ("player/u_breath1.wav"); ! 913: gi.soundindex ("player/u_breath2.wav"); ! 914: ! 915: gi.soundindex ("items/pkup.wav"); // bonus item pickup ! 916: gi.soundindex ("world/land.wav"); // landing thud ! 917: gi.soundindex ("misc/h2ohit1.wav"); // landing splash ! 918: ! 919: gi.soundindex ("items/damage.wav"); ! 920: gi.soundindex ("items/protect.wav"); ! 921: gi.soundindex ("items/protect4.wav"); ! 922: gi.soundindex ("weapons/noammo.wav"); ! 923: ! 924: gi.soundindex ("infantry/inflies1.wav"); ! 925: ! 926: sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2"); ! 927: gi.modelindex ("models/objects/gibs/arm/tris.md2"); ! 928: gi.modelindex ("models/objects/gibs/bone/tris.md2"); ! 929: gi.modelindex ("models/objects/gibs/bone2/tris.md2"); ! 930: gi.modelindex ("models/objects/gibs/chest/tris.md2"); ! 931: gi.modelindex ("models/objects/gibs/skull/tris.md2"); ! 932: gi.modelindex ("models/objects/gibs/head2/tris.md2"); ! 933: ! 934: // ! 935: // Setup light animation tables. 'a' is total darkness, 'z' is doublebright. ! 936: // ! 937: ! 938: // 0 normal ! 939: gi.configstring(CS_LIGHTS+0, "m"); ! 940: ! 941: // 1 FLICKER (first variety) ! 942: gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo"); ! 943: ! 944: // 2 SLOW STRONG PULSE ! 945: gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); ! 946: ! 947: // 3 CANDLE (first variety) ! 948: gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); ! 949: ! 950: // 4 FAST STROBE ! 951: gi.configstring(CS_LIGHTS+4, "mamamamamama"); ! 952: ! 953: // 5 GENTLE PULSE 1 ! 954: gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj"); ! 955: ! 956: // 6 FLICKER (second variety) ! 957: gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno"); ! 958: ! 959: // 7 CANDLE (second variety) ! 960: gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm"); ! 961: ! 962: // 8 CANDLE (third variety) ! 963: gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); ! 964: ! 965: // 9 SLOW STROBE (fourth variety) ! 966: gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz"); ! 967: ! 968: // 10 FLUORESCENT FLICKER ! 969: gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma"); ! 970: ! 971: // 11 SLOW PULSE NOT FADE TO BLACK ! 972: gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); ! 973: ! 974: // styles 32-62 are assigned by the light program for switchable lights ! 975: ! 976: // 63 testing ! 977: gi.configstring(CS_LIGHTS+63, "a"); ! 978: } ! 979:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.