Esempio n. 1
0
/*
-----------------------------------------------------------------------------
 Function: R_BeginRegistration -Start the rendering registration sequence. 
 
 Parameters: map -[in] The name of the map to load.
 
 Returns: Nothing.
 
 Notes: 

-----------------------------------------------------------------------------
*/
PUBLIC void R_BeginRegistration( const char *map )
{
	char	fullname[ MAX_GAMEPATH ];

	if( ! map || ! *map )
	{
		return;
	}	

	++texture_registration_sequence;


	//my_snprintf( fullname, sizeof( fullname ), "maps/%s.map", map );
	if ( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 10)  //add if/else... gsh
		my_snprintf( fullname, sizeof( fullname ), "%s.map", map );
	else if (currentMap.episode >= 10)
		my_snprintf( fullname, sizeof( fullname ), "%s.map", map );
	else
		my_snprintf( fullname, sizeof( fullname ), "maps/%s.map", map );
	

//	Door_ResetDoors( &r_world->Doors );
	Powerup_Reset();
	Sprite_Reset();
	Areas_InitAreas( Player.areanumber );
	PushWall_Reset();

	memset( &levelstate, 0, sizeof( levelstate ) ); // Reset gamestate
	ResetGuards();

	r_world = Level_LoadMap( fullname );

	if( r_world == NULL )
	{
		Com_Printf( "Could not load map (%s) in R_BeginRegistration\n", map );
		return;
	}	

	levelstate.floornum = floornumber;

	if( g_version->value == SPEAROFDESTINY && currentMap.episode >= 6 && currentMap.episode < 9)  //added the episode check... gsh)
	{
		if( strlen( map ) >= 2 )
		{
			levelstate.floornum = atoi( map+1 );

			if( levelstate.floornum == 20 )
			{
				levelstate.floornum = 17;
			}
		}
	}
	
}
/**
 * \brief Initialize game
 */
PUBLIC void Game_Init( void )
{
	Com_Printf( "\n------ Game Init ------\n" );


	// noset vars
//	dedicated = Cvar_Get( "dedicated", "0", CVAR_ROM );

	// latched vars
//	sv_cheats = Cvar_Get( "cheats", "0", CVAR_SERVERINFO |CVAR_LATCH );

	skill = Cvar_Get( "skill", "1", CVAR_LATCH );
	g_version = Cvar_Get( "g_version", "0", CVAR_ARCHIVE | CVAR_LATCH ); 
	g_fov = Cvar_Get( "g_fov", "68", CVAR_ARCHIVE | CVAR_LATCH ); 
	g_autoaim = Cvar_Get( "g_autoaim", "1", CVAR_ARCHIVE | CVAR_LATCH ); 
//	maxentities = Cvar_Get( "maxentities", "1024", CVAR_LATCH );
    mapScale = Cvar_Get( "mapScale", "10", CVAR_ARCHIVE );


	// dm map list
	Cmd_AddCommand( "map", Map_f );
	Cmd_AddCommand( "load", Load_f );
	Cmd_AddCommand( "save", Save_f );

    Cmd_AddCommand( "toggleautomap", Con_ToggleAutomap_f );


	WM_BuildTables();
	CorrectBossDeathTimeouts();

	Powerup_Reset();
	Sprite_Reset();

	Game_Reset();
	PL_Init();

	Com_Printf( "\n-----------------------\n" );
	
}