| 1629 | } |
| 1630 | |
| 1631 | void G_SpawnEntitiesFromString( const char *entityString ) { |
| 1632 | const char *entities; |
| 1633 | |
| 1634 | entities = entityString; |
| 1635 | |
| 1636 | // allow calls to G_Spawn*() |
| 1637 | spawning = qtrue; |
| 1638 | NPCsPrecached = qfalse; |
| 1639 | numSpawnVars = 0; |
| 1640 | |
| 1641 | // the worldspawn is not an actual entity, but it still |
| 1642 | // has a "spawn" function to perform any global setup |
| 1643 | // needed by a level (setting configstrings or cvars, etc) |
| 1644 | if ( !G_ParseSpawnVars( &entities ) ) { |
| 1645 | G_Error( "SpawnEntities: no entities" ); |
| 1646 | } |
| 1647 | |
| 1648 | SP_worldspawn(); |
| 1649 | |
| 1650 | // parse ents |
| 1651 | while( G_ParseSpawnVars( &entities ) ) |
| 1652 | { |
| 1653 | G_SpawnGEntityFromSpawnVars(); |
| 1654 | } |
| 1655 | |
| 1656 | //Search the entities for precache information |
| 1657 | G_ParsePrecaches(); |
| 1658 | |
| 1659 | |
| 1660 | if( g_entities[ENTITYNUM_WORLD].behaviorSet[BSET_SPAWN] && g_entities[ENTITYNUM_WORLD].behaviorSet[BSET_SPAWN][0] ) |
| 1661 | {//World has a spawn script, but we don't want the world in ICARUS and running scripts, |
| 1662 | //so make a scriptrunner and start it going. |
| 1663 | gentity_t *script_runner = G_Spawn(); |
| 1664 | if ( script_runner ) |
| 1665 | { |
| 1666 | script_runner->behaviorSet[BSET_USE] = g_entities[ENTITYNUM_WORLD].behaviorSet[BSET_SPAWN]; |
| 1667 | script_runner->count = 1; |
| 1668 | script_runner->e_ThinkFunc = thinkF_scriptrunner_run; |
| 1669 | script_runner->nextthink = level.time + 100; |
| 1670 | |
| 1671 | if ( Quake3Game()->ValidEntity( script_runner ) ) |
| 1672 | { |
| 1673 | Quake3Game()->InitEntity( script_runner ); //ICARUS_InitEnt( script_runner ); |
| 1674 | } |
| 1675 | } |
| 1676 | } |
| 1677 | |
| 1678 | //gi.Printf(S_COLOR_YELLOW"Total waypoints: %d\n", num_waypoints); |
| 1679 | //Automatically run routegen |
| 1680 | //RG_RouteGen(); |
| 1681 | |
| 1682 | spawning = qfalse; // any future calls to G_Spawn*() will be errors |
| 1683 | |
| 1684 | if ( g_delayedShutdown->integer && delayedShutDown ) |
| 1685 | { |
| 1686 | assert(0); |
| 1687 | G_Error( "Errors loading map, check the console for them." ); |
| 1688 | } |
no test coverage detected