예제 #1
0
/**
 * @sa CL_Init
 */
void SCR_Init (void)
{
	scr_conspeed = Cvar_Get("scr_conspeed", "3", 0, "Console open/close speed");
	scr_consize = Cvar_Get("scr_consize", "1.0", 0, "Console size");
	scr_rspeed = Cvar_Get("r_speeds", "0", CVAR_ARCHIVE, "Show some rendering stats");
	scr_cursor = Cvar_Get("cursor", "1", 0, "Which cursor should be shown - 0-9");
	/** @todo remove me - but this was an archive cvar once */
	scr_cursor->flags = 0;
	scr_showcursor = Cvar_Get("scr_showcursor", "1", 0, "Show/hide mouse cursor- 0-1");

	/* register our commands */
	Cmd_AddCommand("timerefresh", SCR_TimeRefresh_f, "Run a benchmark");

	SCR_TouchPics();

	screenInitialized = qtrue;
}
예제 #2
0
/**
 * @brief Draws the 3D-cursor in battlemode and the icons/info next to it.
 */
static void SCR_DrawCursor (void)
{
	if (scr_showcursor->integer == 0)
		return;

	if (!scr_cursor->integer)
		return;

	if (scr_cursor->modified) {
		scr_cursor->modified = qfalse;
		SCR_TouchPics();
	}

	if (!cursorImage[0])
		return;

	if (!UI_DNDIsDragging()) {
		const char *pic;
		image_t *image;

		if (cls.team != cl.actTeam && CL_BattlescapeRunning())
			pic = "pics/cursors/wait";
		else
			pic = cursorImage;

		image = R_FindImage(pic, it_pic);
		if (image)
			R_DrawImage(mousePosX - image->width / 2, mousePosY - image->height / 2, image);

		if (IN_GetMouseSpace() == MS_WORLD && CL_BattlescapeRunning()) {
			HUD_UpdateCursor();
		}
	} else {
		UI_DrawCursor();
	}
}
예제 #3
0
파일: main.cpp 프로젝트: janisl/jlquake
//	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 );
}
예제 #4
0
파일: cl_view.cpp 프로젝트: RkShaRkz/Quake2
void V_InitRenderer()
{
	guard(V_InitRenderer);

	int		i;

	if (!cl.configstrings[CS_MODELS+1][0]) return;			// no map loaded
	SCR_SetLevelshot();

	// wait a small time to let server complete initialization
	// allow map to be changed before initializing renderer, when loading savegames,
	// saved at point of changing map; this situation is possible because:
	//   - server frame#1:
	//      - loading savegame, will create configstrings + may be insert command string "gamemap <newmap>"
	//      - send configstrings#1
	//   - server frame#2:
	//      - exec "gamemap" command from previous frame, change map etc.
	//      - send configstrings#2
	// in some circumstances, client will receive configstrings#1 after server frame#2 - this will load
	// client map#1 after loading server map#2 (out-of-sync client/server maps -- fatal error)
	static int startTime = 0;
	static int serverCount = 0;
	if (serverCount != cl.servercount)
	{
		serverCount = cl.servercount;
		startTime = cls.realtime;
		return;
	}
	if (cls.realtime < startTime + 300)
		return;

	CL_ClearEffects();		// can use shaders ...
	CL_ClearTEnts();		// temp entities linked to models, which are invalid after vid_restart

	// let the render dll load the map
	char mapname[MAX_QPATH];
	strcpy(mapname, cl.configstrings[CS_MODELS+1] + 5);	// skip "maps/"
	mapname[strlen(mapname)-4] = 0;		// cut off ".bsp"

	// compute total loading weight
	float totalWeight = W_MAP + W_TEXTURES + W_SKY;
	for (i = 1; i < MAX_MODELS && cl.configstrings[CS_MODELS+i][0]; i++) // models
		if (cl.configstrings[CS_MODELS+i][0] != '*')
			totalWeight += W_MODEL;
	for (i = 0; i < MAX_CLIENTS; i++)	// clients
		if (cl.configstrings[CS_PLAYERSKINS+i][0])
			totalWeight += W_CLIENT;

	// register models, pics, and skins
	float loadingFrac = 0;
	SCR_LoadingNotify(va("map: %s", mapname), 0);
	loadingFrac += W_MAP / totalWeight;
	RE_LoadNewWorld();

	// precache status bar pics
	SCR_TouchPics();

	CL_RegisterTEntModels();
	RegisterShaders();

	strcpy(cl_weaponmodels[0], "weapon.md2");	// default weapon model
	num_cl_weaponmodels = 1;

	for (i = 1; i < MAX_MODELS && cl.configstrings[CS_MODELS+i][0]; i++)
	{
		const char *name = cl.configstrings[CS_MODELS+i];
		if (name[0] != '*')
		{
			SCR_LoadingNotify(name, loadingFrac);
			loadingFrac += W_MODEL / totalWeight;
		}
		if (name[0] == '#')
		{
			// special player weapon model
			if (num_cl_weaponmodels < MAX_CLIENTWEAPONMODELS)
				strncpy(cl_weaponmodels[num_cl_weaponmodels++], cl.configstrings[CS_MODELS+i]+1,
					sizeof(cl_weaponmodels[0])-1);
		}
		else
		{
			const char *mdl = cl.configstrings[CS_MODELS + i];
			const char *ext = strrchr(name, '.');
			// load model, but do not reload BSP file:
			cl.model_draw[i] = (!ext || stricmp(ext, ".bsp")) ? RE_RegisterModel(mdl) : NULL;
			cl.model_clip[i] = (name[0] == '*') ? CM_InlineModel(mdl) : NULL;
		}
	}

	SCR_LoadingNotify("textures", loadingFrac);
	loadingFrac += W_TEXTURES / totalWeight;
	for (i = 1; i < MAX_IMAGES && cl.configstrings[CS_IMAGES+i][0]; i++)
		cl.image_precache[i] = RE_RegisterPic(va("pics/%s", cl.configstrings[CS_IMAGES+i]));

	for (i = 0; i < MAX_CLIENTS; i++)
	{
		if (!cl.configstrings[CS_PLAYERSKINS+i][0])
			continue;
		SCR_LoadingNotify(va("client %d: %s", i, cl.configstrings[CS_PLAYERSKINS+i]), loadingFrac);
		loadingFrac += W_CLIENT / totalWeight;
		CL_ParseClientinfo(i);
	}
	if (!cl.configstrings[CS_PLAYERSKINS+cl.playernum][0])
	{
		// in a singleplayer mode, server will not send clientinfo - generate it by
		// ourself for correct third-person view
//		Com_DPrintf("Fixing CI[playernum]\n");
		CL_UpdatePlayerClientInfo();
	}

	// setup sky
	SCR_LoadingNotify("sky", loadingFrac);
	float rotate = atof(cl.configstrings[CS_SKYROTATE]);
	CVec3 axis;
	sscanf(cl.configstrings[CS_SKYAXIS], "%f %f %f", &axis[0], &axis[1], &axis[2]);
	RE_SetSky(cl.configstrings[CS_SKY], rotate, axis);

	// the renderer can now free unneeded stuff
	RE_FinishLoadingWorld();

	Con_ClearNotify();
	SCR_EndLoadingPlaque(true);
	cl.rendererReady  = true;
	cl.forceViewFrame = true;

	// start the cd track
	CDAudio_Play(atoi(cl.configstrings[CS_CDTRACK]), true);

	unguard;
}