Esempio n. 1
0
/*
=================
SCR_Sky_f

Set a specific sky and rotation speed
=================
*/
void SCR_Sky_f (void)
{
	float	rotate;
	vec3_t	axis;

	if (Cmd_Argc() < 2)
	{
		Com_Printf ("Usage: sky <basename> <rotate> <axis x y z>\n");
		return;
	}
	if (Cmd_Argc() > 2)
		rotate = atof(Cmd_Argv(2));
	else
		rotate = 0;
	if (Cmd_Argc() == 6)
	{
		axis[0] = atof(Cmd_Argv(3));
		axis[1] = atof(Cmd_Argv(4));
		axis[2] = atof(Cmd_Argv(5));
	}
	else
	{
		axis[0] = 0;
		axis[1] = 0;
		axis[2] = 1;
	}

	R_SetSky (Cmd_Argv(1), rotate, axis);
}
Esempio n. 2
0
qbool OnChange_r_skyname (cvar_t *v, char *skyname) {
    if (!skyname[0]) {
        r_skyboxloaded = false;
        return false;
    }

    return R_SetSky(skyname);
}
Esempio n. 3
0
/*
 * @brief
 */
void R_Sky_f(void) {

	if (Cmd_Argc() != 2) {
		Com_Print("Usage: %s <basename>\n", Cmd_Argv(0));
		return;
	}

	R_SetSky(Cmd_Argv(1));
}
Esempio n. 4
0
/*
 * R_SetSky
 */
void R_SetSky(char *name) {
	int i;
	char pathname[MAX_QPATH];

	for (i = 0; i < 6; i++) {

		snprintf(pathname, sizeof(pathname), "env/%s%s", name, suf[i]);
		sky.images[i] = R_LoadImage(pathname, it_sky);

		if (!sky.images[i] || sky.images[i] == r_null_image) { // try unit1_
			if (strcmp(name, "unit1_")) {
				R_SetSky("unit1_");
				return;
			}
		}

		sky.stmin = 1.0 / (float) sky.images[i]->width;
		sky.stmax = (sky.images[i]->width - 1.0) / (float) sky.images[i]->width;
	}
}
Esempio n. 5
0
/*
 * @brief Loads all media for the renderer subsystem.
 */
void R_LoadMedia(void) {
	extern cl_client_t cl;
	uint32_t i;

	if (!cl.config_strings[CS_MODELS][0]) {
		return; // no map specified
	}

	R_InitView();

	R_BeginLoading();

	Cl_LoadProgress(1);

	R_LoadModel(cl.config_strings[CS_MODELS]); // load the world
	Cl_LoadProgress(60);

	// load all other models
	for (i = 1; i < MAX_MODELS && cl.config_strings[CS_MODELS + i][0]; i++) {

		cl.model_precache[i] = R_LoadModel(cl.config_strings[CS_MODELS + i]);

		if (i <= 30) // bump loading progress
			Cl_LoadProgress(60 + (i / 3));
	}
	Cl_LoadProgress(70);

	// load all known images
	for (i = 0; i < MAX_IMAGES && cl.config_strings[CS_IMAGES + i][0]; i++) {
		cl.image_precache[i] = R_LoadImage(cl.config_strings[CS_IMAGES + i], IT_PIC);
	}
	Cl_LoadProgress(75);

	// sky environment map
	R_SetSky(cl.config_strings[CS_SKY]);
	Cl_LoadProgress(77);

	r_view.update = true;
}
Esempio n. 6
0
/*
 * @brief Sets the sky to the specified environment map.
 */
void R_SetSky(const char *name) {
	const char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" };
	uint32_t i;

	for (i = 0; i < lengthof(suf); i++) {
		char path[MAX_QPATH];

		g_snprintf(path, sizeof(path), "env/%s%s", name, suf[i]);
		r_sky.images[i] = R_LoadImage(path, IT_SKY);

		if (r_sky.images[i]->type == IT_NULL) { // try unit1_
			if (g_strcmp0(name, "unit1_")) {
				R_SetSky("unit1_");
				return;
			}
		}
	}

	// assume all sky components are the same size
	r_sky.st_min = 1.0 / (vec_t) r_sky.images[0]->width;
	r_sky.st_max = (r_sky.images[0]->width - 1.0) / (vec_t) r_sky.images[0]->width;
}
Esempio n. 7
0
/*
 * Set a specific sky and rotation speed
 */
void
SCR_Sky_f(void)
{
	float rotate;
	vec3_t axis;

	if (Cmd_Argc() < 2)
	{
		Com_Printf("Usage: sky <basename> <rotate> <axis x y z>\n");
		return;
	}

	if (Cmd_Argc() > 2)
	{
		rotate = (float)strtod(Cmd_Argv(2), (char **)NULL);
	}

	else
	{
		rotate = 0;
	}

	if (Cmd_Argc() == 6)
	{
		axis[0] = (float)strtod(Cmd_Argv(3), (char **)NULL);
		axis[1] = (float)strtod(Cmd_Argv(4), (char **)NULL);
		axis[2] = (float)strtod(Cmd_Argv(5), (char **)NULL);
	}
	else
	{
		axis[0] = 0;
		axis[1] = 0;
		axis[2] = 1;
	}

	R_SetSky(Cmd_Argv(1), rotate, axis);
}
Esempio n. 8
0
//	Call before entering a new level, or after changing dlls
void CLQ2_PrepRefresh() {
	if ( !cl.q2_configstrings[ Q2CS_MODELS + 1 ][ 0 ] ) {
		return;		// no map loaded

	}
	// let the render dll load the map
	char mapname[ 32 ];
	String::Cpy( mapname, cl.q2_configstrings[ Q2CS_MODELS + 1 ] + 5 );		// skip "maps/"
	mapname[ String::Length( mapname ) - 4 ] = 0;		// cut off ".bsp"

	// register models, pics, and skins
	common->Printf( "Map: %s\r", mapname );
	SCR_UpdateScreen();
	R_BeginRegistrationAndLoadWorld( mapname );
	common->Printf( "                                     \r" );

	// precache status bar pics
	common->Printf( "pics\r" );
	SCR_UpdateScreen();
	SCRQ2_InitHudShaders();
	SCR_TouchPics();
	common->Printf( "                                     \r" );

	CLQ2_RegisterTEntModels();

	clq2_num_weaponmodels = 1;
	String::Cpy( clq2_weaponmodels[ 0 ], "weapon.md2" );

	for ( int i = 1; i < MAX_MODELS_Q2 && cl.q2_configstrings[ Q2CS_MODELS + i ][ 0 ]; i++ ) {
		char name[ MAX_QPATH ];
		String::Cpy( name, cl.q2_configstrings[ Q2CS_MODELS + i ] );
		name[ 37 ] = 0;		// never go beyond one line
		if ( name[ 0 ] != '*' ) {
			common->Printf( "%s\r", name );
		}
		SCR_UpdateScreen();
		if ( name[ 0 ] == '#' ) {
			// special player weapon model
			if ( clq2_num_weaponmodels < MAX_CLIENTWEAPONMODELS_Q2 ) {
				String::NCpy( clq2_weaponmodels[ clq2_num_weaponmodels ], cl.q2_configstrings[ Q2CS_MODELS + i ] + 1,
					sizeof ( clq2_weaponmodels[ clq2_num_weaponmodels ] ) - 1 );
				clq2_num_weaponmodels++;
			}
		} else {
			cl.model_draw[ i ] = R_RegisterModel( cl.q2_configstrings[ Q2CS_MODELS + i ] );
			if ( name[ 0 ] == '*' ) {
				cl.model_clip[ i ] = CM_InlineModel( String::Atoi( cl.q2_configstrings[ Q2CS_MODELS + i ] + 1 ) );
			} else {
				cl.model_clip[ i ] = 0;
			}
		}
		if ( name[ 0 ] != '*' ) {
			common->Printf( "                                     \r" );
		}
	}

	common->Printf( "images\r" );
	SCR_UpdateScreen();
	for ( int i = 1; i < MAX_IMAGES_Q2 && cl.q2_configstrings[ Q2CS_IMAGES + i ][ 0 ]; i++ ) {
		cl.q2_image_precache[ i ] = CLQ2_RegisterPicShader( cl.q2_configstrings[ Q2CS_IMAGES + i ] );
	}

	common->Printf( "                                     \r" );
	for ( int i = 0; i < MAX_CLIENTS_Q2; i++ ) {
		if ( !cl.q2_configstrings[ Q2CS_PLAYERSKINS + i ][ 0 ] ) {
			continue;
		}
		common->Printf( "client %i\r", i );
		SCR_UpdateScreen();
		CLQ2_ParseClientinfo( i );
		common->Printf( "                                     \r" );
	}

	CLQ2_LoadClientinfo( &cl.q2_baseclientinfo, "unnamed\\male/grunt" );

	// set sky textures and speed
	common->Printf( "sky\r" );
	SCR_UpdateScreen();
	float rotate = String::Atof( cl.q2_configstrings[ Q2CS_SKYROTATE ] );
	vec3_t axis;
	sscanf( cl.q2_configstrings[ Q2CS_SKYAXIS ], "%f %f %f",
		&axis[ 0 ], &axis[ 1 ], &axis[ 2 ] );
	R_SetSky( cl.q2_configstrings[ Q2CS_SKY ], rotate, axis );
	common->Printf( "                                     \r" );

	R_EndRegistration();

	// clear any lines of console text
	Con_ClearNotify();

	SCR_UpdateScreen();
	cl.q2_refresh_prepped = true;

	// start the cd track
	CDAudio_Play( String::Atoi( cl.q2_configstrings[ Q2CS_CDTRACK ] ), true );
}