MCPcopy Create free account
hub / github.com/JACoders/OpenJK / SP_worldspawn

Function SP_worldspawn

code/game/g_spawn.cpp:1457–1545  ·  view source on GitHub ↗

QUAKED worldspawn (0 0 0) ? Every map should have exactly one worldspawn. "music" path to WAV or MP3 files (e.g. "music\intro.mp3 music\loopfile.mp3") "gravity" 800 is default gravity "message" Text to print during connection "soundSet" Ambient sound set to play "spawnscript" runs this script BSP Options "gridsize" size of lighting grid to "X Y Z". default="64 64 128" "ambient"

Source from the content-addressed store, hash-verified

1455"tier_storyinfo" sets 'tier_storyinfo' cvar
1456*/
1457void SP_worldspawn( void ) {
1458 char *s;
1459 int i;
1460
1461 g_entities[ENTITYNUM_WORLD].max_health = 0;
1462
1463 for ( i = 0 ; i < numSpawnVars ; i++ )
1464 {
1465 if ( Q_stricmp( "spawnscript", spawnVars[i][0] ) == 0 )
1466 {//ONly let them set spawnscript, we don't want them setting an angle or something on the world.
1467 G_ParseField( spawnVars[i][0], spawnVars[i][1], &g_entities[ENTITYNUM_WORLD] );
1468 }
1469 if ( Q_stricmp( "region", spawnVars[i][0] ) == 0 )
1470 {
1471 g_entities[ENTITYNUM_WORLD].s.radius = atoi(spawnVars[i][1]);
1472 }
1473 if ( Q_stricmp( "distancecull", spawnVars[i][0] ) == 0 )
1474 {
1475 g_entities[ENTITYNUM_WORLD].max_health = (int)((float)(atoi(spawnVars[i][1])) * 0.7f);
1476 }
1477 }
1478
1479 G_SpawnString( "classname", "", &s );
1480 if ( Q_stricmp( s, "worldspawn" ) ) {
1481 G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" );
1482 }
1483
1484 // make some data visible to connecting client
1485 G_SpawnString( "music", "", &s );
1486 gi.SetConfigstring( CS_MUSIC, s );
1487
1488 G_SpawnString( "message", "", &s );
1489 gi.SetConfigstring( CS_MESSAGE, s ); // map specific message
1490
1491 G_SpawnString( "gravity", "800", &s );
1492 extern SavedGameJustLoaded_e g_eSavedGameJustLoaded;
1493 if (g_eSavedGameJustLoaded != eFULL)
1494 {
1495 gi.cvar_set( "g_gravity", s );
1496 }
1497
1498 G_SpawnString( "soundSet", "default", &s );
1499 gi.SetConfigstring( CS_AMBIENT_SET, s );
1500
1501 //Lightstyles
1502 gi.SetConfigstring(CS_LIGHT_STYLES+(LS_STYLES_START*3)+0, defaultStyles[0][0]);
1503 gi.SetConfigstring(CS_LIGHT_STYLES+(LS_STYLES_START*3)+1, defaultStyles[0][1]);
1504 gi.SetConfigstring(CS_LIGHT_STYLES+(LS_STYLES_START*3)+2, defaultStyles[0][2]);
1505
1506 for(i=1;i<LS_NUM_STYLES;i++)
1507 {
1508 char temp[32];
1509 int lengthRed, lengthBlue, lengthGreen;
1510 Com_sprintf(temp, sizeof(temp), "ls_%dr", i);
1511 G_SpawnString( temp, defaultStyles[i][0], &s );
1512 lengthRed = strlen(s);
1513 gi.SetConfigstring(CS_LIGHT_STYLES+((i+LS_STYLES_START)*3)+0, s);
1514

Callers 1

Calls 6

Q_stricmpFunction · 0.85
G_ParseFieldFunction · 0.70
G_SpawnStringFunction · 0.70
G_ErrorFunction · 0.70
Com_ErrorFunction · 0.70
Com_sprintfFunction · 0.50

Tested by

no test coverage detected