示例#1
0
//Sets all skins to one specific one
void Skin_AllSkins_f (void) {
	if (Cmd_Argc() == 1) {
		Com_Printf("allskins set to \"%s\"\n", allskins);
		return;
	}
	if (Cmd_Argc() != 2) {
		Com_Printf("Usage: %s [skin]\n", Cmd_Argv(0));
		return;
	}
	strlcpy (allskins, Cmd_Argv(1), sizeof(allskins));
	Skin_Skins_f();
}
示例#2
0
文件: skin.c 项目: luaman/qforge-old
/*
================
Skin_Find

  Determines the best skin for the given scoreboard
  slot, and sets scoreboard->skin

================
*/
void
Skin_Find ( player_info_t *sc )
{
	skin_t		*skin;
	int			i;
	char		name[128], *s;

	if (allskins[0])
		strcpy (name, allskins);
	else
	{
		s = Info_ValueForKey (sc->userinfo, "skin");
		if (s && s[0])
			strcpy (name, s);
		else
			strcpy (name, baseskin->string);
	}

	if (strstr (name, "..") || *name == '.')
		strcpy (name, "base");

	COM_StripExtension (name, name);

	for (i=0 ; i<numskins ; i++)
	{
		if (!strcmp (name, skins[i].name))
		{
			sc->skin = &skins[i];
			Skin_Cache (sc->skin);
			return;
		}
	}

	if (numskins == MAX_CACHED_SKINS)
	{	// ran out of spots, so flush everything
		Skin_Skins_f ();
		return;
	}

	skin = &skins[numskins];
	sc->skin = skin;
	numskins++;

	memset (skin, 0, sizeof(*skin));
	strncpy(skin->name, name, sizeof(skin->name) - 1);
}
示例#3
0
static void VID_Restart_f(void)
{
	extern void GFX_Init(void);
	extern void ReloadPaletteAndColormap(void);
	qbool old_con_suppress;

	if (!host_initialized) { // sanity
		Com_Printf("Can't do %s yet\n", Cmd_Argv(0));
		return;
	}

	VID_Shutdown();

	ReloadPaletteAndColormap();

	// keys can get stuck because SDL2 doesn't send keyup event when the video system is down
	Key_ClearStates();

	VID_Init(host_basepal);

	// force models to reload (just flush, no actual loading code here)
	Cache_Flush();

	// shut up warnings during GFX_Init();
	old_con_suppress = con_suppress;
	con_suppress = (developer.value ? false : true);
	// reload 2D textures, particles textures, some other textures and gfx.wad
	GFX_Init();

	// reload skins
	Skin_Skins_f();

	con_suppress = old_con_suppress;

	// we need done something like for map reloading, for example reload textures for brush models
	R_NewMap(true);

	// force all cached models to be loaded, so no short HDD lag then u walk over level and discover new model
	Mod_TouchModels();

	// window may be re-created, so caption need to be forced to update
	CL_UpdateCaption(true);
}
示例#4
0
//Determines the best skin for the given scoreboard slot, and sets scoreboard->skin
void Skin_Find_Ex (player_info_t *sc, char *skin_name) {
	skin_t *skin;
	int i;
	char name[MAX_OSPATH];

	if (!skin_name || !skin_name[0])
	{
		skin_name = baseskin.string;

		if (!skin_name[0])
			skin_name = "base";
	}

	strlcpy(name, skin_name, sizeof(name));
	COM_StripExtension(name, name, sizeof(name));

	for (i = 0; i < numskins; i++)
	{
		if (!strcmp(name, skins[i].name))
		{
			if (sc)
				sc->skin = &skins[i];

			return;
		}
	}

	if (numskins == MAX_CACHED_SKINS)
	{	// ran out of spots, so flush everything
		Com_Printf ("MAX_CACHED_SKINS reached, flushing skins\n");
		Skin_Skins_f(); // this must set numskins to 0
	}

	skin = &skins[numskins];
	if (sc)
		sc->skin = skin;
	numskins++;

	memset (skin, 0, sizeof(*skin));
	strlcpy(skin->name, name, sizeof(skin->name));
}
示例#5
0
文件: skin.c 项目: RetroPie/tyrquake
/*
================
Skin_Find

  Determines the best skin for the given scoreboard
  slot, and sets scoreboard->skin

================
*/
void
Skin_Find(player_info_t *player)
{
    skin_t *skin;
    int i;
    char name[MAX_QPATH];
    const char *skinname;

    skinname = allskins;
    if (!skinname[0]) {
	skinname = Info_ValueForKey(player->userinfo, "skin");
	if (!skinname || !skinname[0])
	    skinname = baseskin.string;
    }
    if (strstr(skinname, "..") || skinname[0] == '.')
	skinname = "base";

    COM_StripExtension(skinname, name, sizeof(name));

    for (i = 0; i < numskins; i++) {
	if (!strcmp(name, skins[i].name)) {
	    player->skin = &skins[i];
	    Skin_Cache(player->skin);
	    return;
	}
    }

    if (numskins == MAX_CACHED_SKINS) {	// ran out of spots, so flush everything
	Skin_Skins_f();
	return;
    }

    skin = &skins[numskins];
    player->skin = skin;
    numskins++;

    memset(skin, 0, sizeof(*skin));
    snprintf(skin->name, sizeof(skin->name), "%s", name);
}
示例#6
0
文件: skin.c 项目: luaman/qforge-old
/*
==========
Skin_AllSkins_f

Sets all skins to one specific one
==========
*/
void
Skin_AllSkins_f ( void )
{
	strcpy (allskins, Cmd_Argv(1));
	Skin_Skins_f ();
}