本文整理汇总了C++中Q_strlwr函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_strlwr函数的具体用法?C++ Q_strlwr怎么用?C++ Q_strlwr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_strlwr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setlocale
/*
* Sys_GetPreferredLanguage
*/
const char *Sys_GetPreferredLanguage( void )
{
static char lang[10];
const char *locale;
char *p;
setlocale( LC_ALL, "" );
locale = setlocale( LC_ALL, NULL );
Q_strncpyz( lang, locale, sizeof( lang ) );
setlocale( LC_ALL, "C" );
p = strchr( lang, '.' );
if( p ) { *p = '\0'; }
if( !lang[0] ) {
return APP_DEFAULT_LANGUAGE;
}
if( !Q_stricmp( lang, "C" ) ) {
return APP_DEFAULT_LANGUAGE;
}
return Q_strlwr( lang );
}
开发者ID:ultimatecode7,项目名称:qfusion,代码行数:27,代码来源:unix_sys.c
示例2: M_Menu_TV_ChannelAdd_f
void M_Menu_TV_ChannelAdd_f( void )
{
int num, id;
char *name, *realname, *address, *gametype, *mapname, *matchname;
int numplayers, numspecs;
tv_channel_t *prev, *next, *new_chan;
if( trap_Cmd_Argc() < 5 )
return;
id = atoi( trap_Cmd_Argv( 1 ) );
name = trap_Cmd_Argv( 2 );
realname = trap_Cmd_Argv( 3 );
address = trap_Cmd_Argv( 4 );
numplayers = atoi( trap_Cmd_Argv( 5 ) );
numspecs = atoi( trap_Cmd_Argv( 6 ) );
gametype = trap_Cmd_Argv( 7 );
mapname = trap_Cmd_Argv( 8 );
matchname = trap_Cmd_Argv( 9 );
if( id <= 0 || !name[0] )
return;
num = 0;
prev = NULL;
next = channels;
while( next && next->id < id )
{
prev = next;
next = next->next;
num++;
}
if( next && next->id == id )
{
new_chan = next;
next = new_chan->next;
}
else
{
new_chan = (tv_channel_t *)UI_Malloc( sizeof( tv_channel_t ) );
if( num < scrollbar_curvalue )
scrollbar_curvalue++;
}
if( prev )
{
prev->next = new_chan;
}
else
{
channels = new_chan;
}
new_chan->next = next;
new_chan->id = id;
Q_strncpyz( new_chan->name, name, sizeof( new_chan->name ) );
Q_strncpyz( new_chan->realname, realname, sizeof( new_chan->realname ) );
Q_strncpyz( new_chan->address, address, sizeof( new_chan->address ) );
Q_strncpyz( new_chan->gametype, gametype, sizeof( new_chan->gametype ) );
Q_strncpyz( new_chan->mapname, mapname, sizeof( new_chan->mapname ) );
Q_strncpyz( new_chan->matchname, matchname, sizeof( new_chan->matchname ) );
Q_strlwr( new_chan->gametype );
Q_strlwr( new_chan->mapname );
new_chan->numplayers = numplayers;
new_chan->numspecs = numspecs;
M_RefreshScrollWindowList();
}
开发者ID:Racenet,项目名称:racesow,代码行数:67,代码来源:ui_tv.c
示例3: CL_CheckAndQueueDownload
/*
===============
CL_ParseFileList
Validate a path supplied by a filelist.
===============
*/
static void CL_CheckAndQueueDownload (char *path)
{
size_t length;
char *ext;
qboolean pak;
qboolean gameLocal;
StripHighBits (path, 1);
length = strlen(path);
if (length >= MAX_QPATH)
return;
ext = strrchr (path, '.');
if (!ext)
return;
ext++;
if (!ext[0])
return;
Q_strlwr (ext);
if ( !strcmp (ext, "pak") || !strcmp (ext, "pk3") )
{
Com_Printf ("NOTICE: Filelist is requesting a .pak file (%s)\n", path);
pak = true;
}
else
pak = false;
if (!pak && strcmp (ext, "pcx") && strcmp (ext, "wal") && strcmp (ext, "wav") && strcmp (ext, "md2") &&
strcmp (ext, "sp2") && strcmp (ext, "tga") && strcmp (ext, "png") && strcmp (ext, "jpg") &&
strcmp (ext, "bsp") && strcmp (ext, "ent") && strcmp (ext, "txt") && strcmp (ext, "dm2") &&
strcmp (ext, "loc"))
{
Com_Printf ("WARNING: Illegal file type '%s' in filelist.\n", MakePrintable(path, length));
return;
}
if (path[0] == '@')
{
if (pak)
{
Com_Printf ("WARNING: @ prefix used on a pak file (%s) in filelist.\n", MakePrintable(path, length));
return;
}
gameLocal = true;
path++;
length--;
}
else
gameLocal = false;
if (strstr (path, "..") || !IsValidChar (path[0]) || !IsValidChar (path[length-1]) || strstr(path, "//") ||
strchr (path, '\\') || (!pak && !strchr (path, '/')) || (pak && strchr(path, '/')))
{
Com_Printf ("WARNING: Illegal path '%s' in filelist.\n", MakePrintable(path, length));
return;
}
// by definition paks are game-local
if (gameLocal || pak)
{
qboolean exists;
FILE *f;
char gamePath[MAX_OSPATH];
if (pak)
{
Com_sprintf (gamePath, sizeof(gamePath),"%s/%s",FS_Gamedir(), path);
f = fopen (gamePath, "rb");
if (!f)
{
exists = false;;
}
else
{
exists = true;
fclose (f);
}
}
else
{
// exists = FS_ExistsInGameDir (path);
exists = FS_LocalFileExists (path);
}
if (!exists)
{
//.........这里部分代码省略.........
开发者ID:Kiln707,项目名称:KMQuake2,代码行数:101,代码来源:cl_http.c
示例4: R_LoadMD4
static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) {
int i, j, k, lodindex;
md4Header_t *pinmodel, *md4;
md4Frame_t *frame;
md4LOD_t *lod;
md4Surface_t *surf;
md4Triangle_t *tri;
md4Vertex_t *v;
int version;
int size;
shader_t *sh;
int frameSize;
pinmodel = (md4Header_t *)buffer;
version = LittleLong (pinmodel->version);
if (version != MD4_VERSION) {
ri.Printf( PRINT_WARNING, "R_LoadMD4: %s has wrong version (%i should be %i)\n",
mod_name, version, MD4_VERSION);
return qfalse;
}
mod->type = MOD_MD4;
size = LittleLong(pinmodel->ofsEnd);
mod->dataSize += size;
md4 = mod->md4 = ri.Hunk_Alloc( size, h_low );
memcpy(md4, buffer, size);
LL(md4->ident);
LL(md4->version);
LL(md4->numFrames);
LL(md4->numBones);
LL(md4->numLODs);
LL(md4->ofsFrames);
LL(md4->ofsLODs);
md4->ofsEnd = size;
if ( md4->numFrames < 1 ) {
ri.Printf( PRINT_WARNING, "R_LoadMD4: %s has no frames\n", mod_name );
return qfalse;
}
// we don't need to swap tags in the renderer, they aren't used
// swap all the frames
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ md4->numBones ] );
for ( i = 0 ; i < md4->numFrames ; i++, frame++) {
frame = (md4Frame_t *) ( (byte *)md4 + md4->ofsFrames + i * frameSize );
frame->radius = LittleFloat( frame->radius );
for ( j = 0 ; j < 3 ; j++ ) {
frame->bounds[0][j] = LittleFloat( frame->bounds[0][j] );
frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] );
frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] );
}
for ( j = 0 ; j < md4->numBones * sizeof( md4Bone_t ) / 4 ; j++ ) {
((float *)frame->bones)[j] = LittleFloat( ((float *)frame->bones)[j] );
}
}
// swap all the LOD's
lod = (md4LOD_t *) ( (byte *)md4 + md4->ofsLODs );
for ( lodindex = 0 ; lodindex < md4->numLODs ; lodindex++ ) {
// swap all the surfaces
surf = (md4Surface_t *) ( (byte *)lod + lod->ofsSurfaces );
for ( i = 0 ; i < lod->numSurfaces ; i++) {
LL(surf->ident);
LL(surf->numTriangles);
LL(surf->ofsTriangles);
LL(surf->numVerts);
LL(surf->ofsVerts);
LL(surf->ofsEnd);
if ( surf->numVerts > SHADER_MAX_VERTEXES ) {
ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i verts on a surface (%i)",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts );
}
if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) {
ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i triangles on a surface (%i)",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles );
}
// change to surface identifier
surf->ident = SF_MD4;
// lowercase the surface name so skin compares are faster
Q_strlwr( surf->name );
// register the shaders
sh = R_FindShader( surf->shader, LIGHTMAP_NONE, qtrue );
if ( sh->defaultShader ) {
surf->shaderIndex = 0;
} else {
surf->shaderIndex = sh->index;
}
// swap all the triangles
tri = (md4Triangle_t *) ( (byte *)surf + surf->ofsTriangles );
for ( j = 0 ; j < surf->numTriangles ; j++, tri++ ) {
//.........这里部分代码省略.........
开发者ID:luaman,项目名称:zq,代码行数:101,代码来源:tr_model.c
示例5: R_LoadMD3
//.........这里部分代码省略.........
frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] );
frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] );
}
}
// swap all the tags
tag = (md3Tag_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsTags );
for ( i = 0 ; i < mod->md3[lod]->numTags * mod->md3[lod]->numFrames ; i++, tag++) {
for ( j = 0 ; j < 3 ; j++ ) {
tag->origin[j] = LittleFloat( tag->origin[j] );
tag->axis[0][j] = LittleFloat( tag->axis[0][j] );
tag->axis[1][j] = LittleFloat( tag->axis[1][j] );
tag->axis[2][j] = LittleFloat( tag->axis[2][j] );
}
}
// swap all the surfaces
surf = (md3Surface_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsSurfaces );
for ( i = 0 ; i < mod->md3[lod]->numSurfaces ; i++) {
LL(surf->ident);
LL(surf->flags);
LL(surf->numFrames);
LL(surf->numShaders);
LL(surf->numTriangles);
LL(surf->ofsTriangles);
LL(surf->numVerts);
LL(surf->ofsShaders);
LL(surf->ofsSt);
LL(surf->ofsXyzNormals);
LL(surf->ofsEnd);
if ( surf->numVerts > SHADER_MAX_VERTEXES ) {
ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i verts on a surface (%i)",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts );
}
if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) {
ri.Error (ERR_DROP, "R_LoadMD3: %s has more than %i triangles on a surface (%i)",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles );
}
// change to surface identifier
surf->ident = SF_MD3;
// lowercase the surface name so skin compares are faster
Q_strlwr( surf->name );
// strip off a trailing _1 or _2
// this is a crutch for q3data being a mess
j = strlen( surf->name );
if ( j > 2 && surf->name[j-2] == '_' ) {
surf->name[j-2] = 0;
}
// register the shaders
shader = (md3Shader_t *) ( (byte *)surf + surf->ofsShaders );
for ( j = 0 ; j < surf->numShaders ; j++, shader++ ) {
shader_t *sh;
sh = R_FindShader( shader->name, LIGHTMAP_NONE, qtrue );
if ( sh->defaultShader ) {
shader->shaderIndex = 0;
} else {
shader->shaderIndex = sh->index;
}
}
// swap all the triangles
tri = (md3Triangle_t *) ( (byte *)surf + surf->ofsTriangles );
for ( j = 0 ; j < surf->numTriangles ; j++, tri++ ) {
LL(tri->indexes[0]);
LL(tri->indexes[1]);
LL(tri->indexes[2]);
}
// swap all the ST
st = (md3St_t *) ( (byte *)surf + surf->ofsSt );
for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
st->st[0] = LittleFloat( st->st[0] );
st->st[1] = LittleFloat( st->st[1] );
}
// swap all the XyzNormals
xyz = (md3XyzNormal_t *) ( (byte *)surf + surf->ofsXyzNormals );
for ( j = 0 ; j < surf->numVerts * surf->numFrames ; j++, xyz++ )
{
xyz->xyz[0] = LittleShort( xyz->xyz[0] );
xyz->xyz[1] = LittleShort( xyz->xyz[1] );
xyz->xyz[2] = LittleShort( xyz->xyz[2] );
xyz->normal = LittleShort( xyz->normal );
}
// find the next surface
surf = (md3Surface_t *)( (byte *)surf + surf->ofsEnd );
}
return qtrue;
}
开发者ID:luaman,项目名称:zq,代码行数:101,代码来源:tr_model.c
示例6: R_LoadMDC
//.........这里部分代码省略.........
LL(mdcSurf->ofsTriangles);
LL(mdcSurf->numVerts);
LL(mdcSurf->ofsShaders);
LL(mdcSurf->ofsSt);
LL(mdcSurf->ofsXyzNormals);
LL(mdcSurf->ofsXyzNormals);
LL(mdcSurf->ofsXyzCompressed);
LL(mdcSurf->ofsFrameBaseFrames);
LL(mdcSurf->ofsFrameCompFrames);
LL(mdcSurf->ofsEnd);
if (mdcSurf->numVerts > SHADER_MAX_VERTEXES)
{
Ren_Drop("R_LoadMDC: %s has more than %i verts on a surface (%i)",
modName, SHADER_MAX_VERTEXES, mdcSurf->numVerts);
}
if (mdcSurf->numTriangles > SHADER_MAX_TRIANGLES)
{
Ren_Drop("R_LoadMDC: %s has more than %i triangles on a surface (%i)",
modName, SHADER_MAX_TRIANGLES, mdcSurf->numTriangles);
}
// change to surface identifier
surf->surfaceType = SF_MDV;
// give pointer to model for Tess_SurfaceMDX
surf->model = mdvModel;
// copy surface name
Q_strncpyz(surf->name, mdcSurf->name, sizeof(surf->name));
// lowercase the surface name so skin compares are faster
Q_strlwr(surf->name);
// strip off a trailing _1 or _2
// this is a crutch for q3data being a mess
j = strlen(surf->name);
if (j > 2 && surf->name[j - 2] == '_')
{
surf->name[j - 2] = 0;
}
// register the shaders
/*
surf->numShaders = md3Surf->numShaders;
surf->shaders = shader = ri.Hunk_Alloc(sizeof(*shader) * md3Surf->numShaders, h_low);
md3Shader = (md3Shader_t *) ((byte *) md3Surf + md3Surf->ofsShaders);
for(j = 0; j < md3Surf->numShaders; j++, shader++, md3Shader++)
{
shader_t *sh;
sh = R_FindShader(md3Shader->name, SHADER_3D_DYNAMIC, RSF_DEFAULT);
if(sh->defaultShader)
{
shader->shaderIndex = 0;
}
else
{
shader->shaderIndex = sh->index;
}
}
*/
开发者ID:Ododo,项目名称:etlegacy,代码行数:67,代码来源:tr_model_mdc.c
示例7: AnimParseAnimConfig
//.........这里部分代码省略.........
}
if ( animModelInfo->version < 2 ) {
// if it is a number, start parsing animations
if ( Q_isnumeric( token[0] ) ) {
text_p -= strlen( token ); // unget the token
break;
}
}
// STARTANIMS marks the start of the animations
if ( !Q_stricmp( token, "STARTANIMS" ) ) {
break;
}
// BG_AnimParseError( "unknown token '%s'", token );
}
// read information for each frame
for ( i = 0 ; ( animModelInfo->version > 1 ) || ( i < MAX_ANIMATIONS ) ; i++ ) {
token = COM_Parse( &text_p );
if ( !token ) {
break;
}
if ( animModelInfo->version > 1 ) { // includes animation names at start of each line
if ( !Q_stricmp( token, "ENDANIMS" ) ) { // end of animations
break;
}
Q_strncpyz( animations[i].name, token, sizeof( animations[i].name ) );
// convert to all lower case
Q_strlwr( animations[i].name );
//
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
// BG_AnimParseError( "end of file without ENDANIMS" );
break;
}
} else {
// just set it to the equivalent animStrings[]
Q_strncpyz( animations[i].name, animStrings[i], sizeof( animations[i].name ) );
// convert to all lower case
Q_strlwr( animations[i].name );
}
animations[i].firstFrame = atoi( token );
if ( !animModelInfo->isSkeletal ) { // skeletal models dont require adjustment
// leg only frames are adjusted to not count the upper body only frames
if ( i == LEGS_WALKCR ) {
skip = animations[LEGS_WALKCR].firstFrame - animations[TORSO_GESTURE].firstFrame;
}
if ( i >= LEGS_WALKCR ) {
animations[i].firstFrame -= skip;
}
}
token = COM_ParseExt( &text_p, qfalse );
if ( !token || !token[0] ) {
// BG_AnimParseError( "end of file without ENDANIMS" );
break;
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:67,代码来源:ui_players.c
示例8: assert
// Unfortunately the dedicated server also hates shader loading. So we need an alternate of this func.
//
void *RE_RegisterServerModels_Malloc(int iSize, void *pvDiskBufferIfJustLoaded, const char *psModelFileName, qboolean *pqbAlreadyFound, memtag_t eTag)
{
char sModelName[MAX_QPATH];
assert(CachedModels);
Q_strncpyz(sModelName,psModelFileName,sizeof(sModelName));
Q_strlwr (sModelName);
CachedEndianedModelBinary_t &ModelBin = (*CachedModels)[sModelName];
if (ModelBin.pModelDiskImage == NULL)
{
// new, instead of doing a Z_Malloc and assigning that we just morph the disk buffer alloc
// then don't thrown it away on return - cuts down on mem overhead
//
// ... groan, but not if doing a limb hierarchy creation (some VV stuff?), in which case it's NULL
//
if ( pvDiskBufferIfJustLoaded )
{
Z_MorphMallocTag( pvDiskBufferIfJustLoaded, eTag );
}
else
{
pvDiskBufferIfJustLoaded = Z_Malloc(iSize,eTag, qfalse );
}
ModelBin.pModelDiskImage = pvDiskBufferIfJustLoaded;
ModelBin.iAllocSize = iSize;
int iCheckSum;
if (ri->FS_FileIsInPAK(sModelName, &iCheckSum) == 1)
{
ModelBin.iPAKFileCheckSum = iCheckSum; // else ModelBin's constructor will leave it as -1
}
*pqbAlreadyFound = qfalse;
}
else
{
// if we already had this model entry, then re-register all the shaders it wanted...
//
/*
int iEntries = ModelBin.ShaderRegisterData.size();
for (int i=0; i<iEntries; i++)
{
int iShaderNameOffset = ModelBin.ShaderRegisterData[i].first;
int iShaderPokeOffset = ModelBin.ShaderRegisterData[i].second;
char *psShaderName = &((char*)ModelBin.pModelDiskImage)[iShaderNameOffset];
int *piShaderPokePtr = (int *) &((char*)ModelBin.pModelDiskImage)[iShaderPokeOffset];
shader_t *sh = R_FindShader( psShaderName, lightmapsNone, stylesDefault, qtrue );
if ( sh->defaultShader )
{
*piShaderPokePtr = 0;
} else {
*piShaderPokePtr = sh->index;
}
}
*/
//No. Bad.
*pqbAlreadyFound = qtrue; // tell caller not to re-Endian or re-Shader this binary
}
ModelBin.iLastLevelUsedOn = RE_RegisterMedia_GetLevel();
return ModelBin.pModelDiskImage;
}
开发者ID:adnanfzafar,项目名称:OpenJK,代码行数:72,代码来源:tr_model.cpp
示例9: SV_AntiCheat_ParseHashLine
static void SV_AntiCheat_ParseHashLine (char *line, int line_number, const char *filename)
{
filehash_t *hashes;
int i;
int flags;
char *p, *hash;
if (line[0] == '!')
{
strncpy (anticheat_hashlist_name, line + 1, sizeof(anticheat_hashlist_name)-1);
ExpandNewLines (anticheat_hashlist_name);
return;
}
p = strchr (line, '\t');
if (!p)
{
Com_Printf ("ANTICHEAT WARNING: Malformed line %d '%s' in %s\n", LOG_WARNING|LOG_ANTICHEAT|LOG_SERVER, line_number, line, filename);
return;
}
p[0] = 0;
p++;
hash = p;
p = strchr (hash, '\t');
if (p)
{
p[0] = 0;
p++;
}
if (strlen (hash) != 40)
{
Com_Printf ("ANTICHEAT WARNING: Malformed hash '%s' in %s on line %d\n", LOG_WARNING|LOG_ANTICHEAT|LOG_SERVER, hash, filename, line_number);
return;
}
for (i = 0; i < 40; i++)
{
if (!isxdigit (hash[i]))
{
Com_Printf ("ANTICHEAT WARNING: Malformed hash '%s' in %s on line %d\n", LOG_WARNING|LOG_ANTICHEAT|LOG_SERVER, hash, filename, line_number);
return;
}
}
if (strlen (line) >= MAX_QPATH || strchr (line, '\\') || !isalnum(line[0]))
{
Com_Printf ("ANTICHEAT WARNING: Malformed quake path '%s' in %s on line %d\n", LOG_WARNING|LOG_ANTICHEAT|LOG_SERVER, line, filename, line_number);
return;
}
Q_strlwr (line);
flags = 0;
if (p && p[0])
{
if (strstr (p, "required"))
flags |= ACH_REQUIRED;
if (strstr (p, "negative"))
flags |= ACH_NEGATIVE;
}
hashes = &fileHashes;
while (hashes->next)
hashes = hashes->next;
hashes->next = Z_TagMalloc (sizeof(*hashes), TAGMALLOC_ANTICHEAT);
hashes = hashes->next;
hashes->next = NULL;
for (i = 0; i < 20; i++)
hashes->hash[i] = HexToRaw (hash + i*2);
hashes->flags = flags;
strcpy (hashes->quakePath, line);
antiCheatNumFileHashes++;
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:83,代码来源:sv_anticheat.c
示例10: check_and_queue_download
// Validate a path supplied by a filelist.
static void check_and_queue_download(char *path)
{
size_t len;
char *ext;
dltype_t type;
unsigned flags;
int valid;
len = strlen(path);
if (len >= MAX_QPATH)
return;
ext = strrchr(path, '.');
if (!ext)
return;
ext++;
if (!ext[0])
return;
Q_strlwr(ext);
if (!strcmp(ext, "pak") || !strcmp(ext, "pkz")) {
Com_Printf("[HTTP] Filelist is requesting a .%s file '%s'\n", ext, path);
type = DL_PAK;
} else {
type = DL_OTHER;
if (!CL_CheckDownloadExtension(ext)) {
Com_WPrintf("[HTTP] Illegal file type '%s' in filelist.\n", path);
return;
}
}
if (path[0] == '@') {
if (type == DL_PAK) {
Com_WPrintf("[HTTP] '@' prefix used on a pak file '%s' in filelist.\n", path);
return;
}
flags = FS_PATH_GAME;
path++;
len--;
} else if (type == DL_PAK) {
//by definition paks are game-local
flags = FS_PATH_GAME | FS_TYPE_REAL;
} else {
flags = 0;
}
len = FS_NormalizePath(path, path);
if (len == 0)
return;
valid = FS_ValidatePath(path);
if (valid == PATH_INVALID ||
!Q_ispath(path[0]) ||
!Q_ispath(path[len - 1]) ||
strstr(path, "..") ||
(type == DL_OTHER && !strchr(path, '/')) ||
(type == DL_PAK && strchr(path, '/'))) {
Com_WPrintf("[HTTP] Illegal path '%s' in filelist.\n", path);
return;
}
if (FS_FileExistsEx(path, flags))
return;
if (valid == PATH_MIXED_CASE)
Q_strlwr(path);
if (CL_IgnoreDownload(path))
return;
CL_QueueDownload(path, type);
}
开发者ID:jayschwa,项目名称:q2pro,代码行数:76,代码来源:http.c
示例11: BG_LoadTraceMap
qboolean BG_LoadTraceMap(char *rawmapname, vec2_t world_mins, vec2_t world_maxs)
{
int i, j;
fileHandle_t f;
byte data, datablock[TRACEMAP_SIZE][4];
int sky_min, sky_max;
int ground_min, ground_max;
int skyground_min, skyground_max;
float scalefactor;
//int startTime = trap_Milliseconds();
ground_min = ground_max = MIN_WORLD_HEIGHT;
skyground_min = skyground_max = MAX_WORLD_HEIGHT;
sky_min = sky_max = MAX_WORLD_HEIGHT;
if (trap_FS_FOpenFile(va("maps/%s_tracemap.tga", Q_strlwr(rawmapname)), &f, FS_READ) >= 0)
{
// skip over header
for (i = 0; i < 18; i++)
{
trap_FS_Read(&data, 1, f);
}
for (i = 0; i < TRACEMAP_SIZE; i++)
{
trap_FS_Read(&datablock, sizeof(datablock), f); // TRACEMAP_SIZE * { b g r a }
for (j = 0; j < TRACEMAP_SIZE; j++)
{
if (i == 0 && j < 6)
{
// abuse first six pixels for our extended data
switch (j)
{
case 0: ground_min = datablock[j][0] | (datablock[j][1] << 8) | (datablock[j][2] << 16) | (datablock[j][3] << 24); break;
case 1: ground_max = datablock[j][0] | (datablock[j][1] << 8) | (datablock[j][2] << 16) | (datablock[j][3] << 24); break;
case 2: skyground_min = datablock[j][0] | (datablock[j][1] << 8) | (datablock[j][2] << 16) | (datablock[j][3] << 24); break;
case 3: skyground_max = datablock[j][0] | (datablock[j][1] << 8) | (datablock[j][2] << 16) | (datablock[j][3] << 24); break;
case 4: sky_min = datablock[j][0] | (datablock[j][1] << 8) | (datablock[j][2] << 16) | (datablock[j][3] << 24); break;
case 5: sky_max = datablock[j][0] | (datablock[j][1] << 8) | (datablock[j][2] << 16) | (datablock[j][3] << 24); break;
}
tracemap.sky[TRACEMAP_SIZE - 1 - i][j] = MAX_WORLD_HEIGHT;
tracemap.skyground[TRACEMAP_SIZE - 1 - i][j] = MAX_WORLD_HEIGHT;
tracemap.ground[TRACEMAP_SIZE - 1 - i][j] = MIN_WORLD_HEIGHT;
continue;
}
tracemap.sky[TRACEMAP_SIZE - 1 - i][j] = (float)datablock[j][0]; // FIXME: swap
if (tracemap.sky[TRACEMAP_SIZE - 1 - i][j] == 0)
{
tracemap.sky[TRACEMAP_SIZE - 1 - i][j] = MAX_WORLD_HEIGHT;
}
tracemap.skyground[TRACEMAP_SIZE - 1 - i][j] = (float)datablock[j][1]; // FIXME: swap
if (tracemap.skyground[TRACEMAP_SIZE - 1 - i][j] == 0)
{
tracemap.skyground[TRACEMAP_SIZE - 1 - i][j] = MAX_WORLD_HEIGHT;
}
tracemap.ground[TRACEMAP_SIZE - 1 - i][j] = (float)datablock[j][2]; // FIXME: swap
if (tracemap.ground[TRACEMAP_SIZE - 1 - i][j] == 0)
{
tracemap.ground[TRACEMAP_SIZE - 1 - i][j] = MIN_WORLD_HEIGHT;
}
if (datablock[j][3] == 0)
{
// just in case
tracemap.skyground[TRACEMAP_SIZE - 1 - i][j] = MAX_WORLD_HEIGHT;
tracemap.ground[TRACEMAP_SIZE - 1 - i][j] = MIN_WORLD_HEIGHT;
}
}
}
trap_FS_FCloseFile(f);
// Ground
// calculate scalefactor
if (ground_max - ground_min == 0)
{
scalefactor = 1.f;
}
else
{
// rain - scalefactor 254 to compensate for broken etmain behavior
scalefactor = 254.f / (ground_max - ground_min);
}
// scale properly
for (i = 0; i < TRACEMAP_SIZE; i++)
{
for (j = 0; j < TRACEMAP_SIZE; j++)
{
if (tracemap.ground[i][j] != MIN_WORLD_HEIGHT)
{
tracemap.ground[i][j] = ground_min + (tracemap.ground[i][j] / scalefactor);
}
}
}
//.........这里部分代码省略.........
开发者ID:BulldogDrummond,项目名称:etmod,代码行数:101,代码来源:bg_tracemap.c
示例12: R_LoadMD3
//.........这里部分代码省略.........
//
// optimisation, we don't bother doing this for standard intel case since our data's already in that format...
//
// swap all the frames
frame = (md3Frame_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsFrames );
for ( i = 0 ; i < mod->md3[lod]->numFrames ; i++, frame++) {
frame->radius = LittleFloat( frame->radius );
for ( j = 0 ; j < 3 ; j++ ) {
frame->bounds[0][j] = LittleFloat( frame->bounds[0][j] );
frame->bounds[1][j] = LittleFloat( frame->bounds[1][j] );
frame->localOrigin[j] = LittleFloat( frame->localOrigin[j] );
}
}
// swap all the tags
tag = (md3Tag_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsTags );
for ( i = 0 ; i < mod->md3[lod]->numTags * mod->md3[lod]->numFrames ; i++, tag++) {
for ( j = 0 ; j < 3 ; j++ ) {
tag->origin[j] = LittleFloat( tag->origin[j] );
tag->axis[0][j] = LittleFloat( tag->axis[0][j] );
tag->axis[1][j] = LittleFloat( tag->axis[1][j] );
tag->axis[2][j] = LittleFloat( tag->axis[2][j] );
}
}
#endif
// swap all the surfaces
surf = (md3Surface_t *) ( (byte *)mod->md3[lod] + mod->md3[lod]->ofsSurfaces );
for ( i = 0 ; i < mod->md3[lod]->numSurfaces ; i++) {
LL(surf->flags);
LL(surf->numFrames);
LL(surf->numShaders);
LL(surf->numTriangles);
LL(surf->ofsTriangles);
LL(surf->numVerts);
LL(surf->ofsShaders);
LL(surf->ofsSt);
LL(surf->ofsXyzNormals);
LL(surf->ofsEnd);
if ( surf->numVerts > SHADER_MAX_VERTEXES ) {
Com_Error (ERR_DROP, "R_LoadMD3: %s has more than %i verts on a surface (%i)",
mod_name, SHADER_MAX_VERTEXES, surf->numVerts );
}
if ( surf->numTriangles*3 > SHADER_MAX_INDEXES ) {
Com_Error (ERR_DROP, "R_LoadMD3: %s has more than %i triangles on a surface (%i)",
mod_name, SHADER_MAX_INDEXES / 3, surf->numTriangles );
}
// change to surface identifier
surf->ident = SF_MD3;
// lowercase the surface name so skin compares are faster
Q_strlwr( surf->name );
// strip off a trailing _1 or _2
// this is a crutch for q3data being a mess
j = strlen( surf->name );
if ( j > 2 && surf->name[j-2] == '_' ) {
surf->name[j-2] = 0;
}
#if 0 //#ifndef _M_IX86
//
// optimisation, we don't bother doing this for standard intel case since our data's already in that format...
//
// swap all the triangles
tri = (md3Triangle_t *) ( (byte *)surf + surf->ofsTriangles );
for ( j = 0 ; j < surf->numTriangles ; j++, tri++ ) {
LL(tri->indexes[0]);
LL(tri->indexes[1]);
LL(tri->indexes[2]);
}
// swap all the ST
st = (md3St_t *) ( (byte *)surf + surf->ofsSt );
for ( j = 0 ; j < surf->numVerts ; j++, st++ ) {
st->st[0] = LittleFloat( st->st[0] );
st->st[1] = LittleFloat( st->st[1] );
}
// swap all the XyzNormals
xyz = (md3XyzNormal_t *) ( (byte *)surf + surf->ofsXyzNormals );
for ( j = 0 ; j < surf->numVerts * surf->numFrames ; j++, xyz++ )
{
xyz->xyz[0] = LittleShort( xyz->xyz[0] );
xyz->xyz[1] = LittleShort( xyz->xyz[1] );
xyz->xyz[2] = LittleShort( xyz->xyz[2] );
xyz->normal = LittleShort( xyz->normal );
}
#endif
// find the next surface
surf = (md3Surface_t *)( (byte *)surf + surf->ofsEnd );
}
return qtrue;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:101,代码来源:tr_model.cpp
示例13: G_SpawnGEntityFromSpawnVars
/*
===================
G_SpawnGEntityFromSpawnVars
Spawn an entity and fill in all of the level fields from
level.spawnVars[], then call the class specfic spawn function
===================
*/
void G_SpawnGEntityFromSpawnVars(void)
{
int i;
gentity_t *ent;
char *str;
// get the next free entity
ent = G_Spawn();
for(i = 0; i < level.numSpawnVars; i++)
{
G_ParseField(level.spawnVars[i][0], level.spawnVars[i][1], ent);
}
// check for "notteam" / "notfree" flags
G_SpawnInt("notteam", "0", &i);
if(i)
{
G_FreeEntity(ent);
return;
}
// allowteams handling
G_SpawnString("allowteams", "", &str);
if(str[0])
{
str = Q_strlwr(str);
if(strstr(str, "axis"))
{
ent->allowteams |= ALLOW_AXIS_TEAM;
}
if(strstr(str, "allies"))
{
ent->allowteams |= ALLOW_ALLIED_TEAM;
}
if(strstr(str, "cvops"))
{
ent->allowteams |= ALLOW_DISGUISED_CVOPS;
}
}
if(ent->targetname && *ent->targetname)
{
ent->targetnamehash = BG_StringHashValue(ent->targetname);
}
else
{
ent->targetnamehash = -1;
}
// move editor origin to pos
VectorCopy(ent->s.origin, ent->s.pos.trBase);
VectorCopy(ent->s.origin, ent->r.currentOrigin);
// if we didn't get a classname, don't bother spawning anything
if(!G_CallSpawn(ent))
{
G_FreeEntity(ent);
}
// RF, try and move it into the bot entities if possible
// BotCheckBotGameEntity( ent );
}
开发者ID:ethr,项目名称:ETXreaLPro_etmain,代码行数:71,代码来源:g_spawn.c
示例14: R_LoadMDC
//.........这里部分代码省略.........
LL( mdcSurf->ofsTriangles );
LL( mdcSurf->numVerts );
LL( mdcSurf->ofsShaders );
LL( mdcSurf->ofsSt );
LL( mdcSurf->ofsXyzNormals );
LL( mdcSurf->ofsXyzNormals );
LL( mdcSurf->ofsXyzCompressed );
LL( mdcSurf->ofsFrameBaseFrames );
LL( mdcSurf->ofsFrameCompFrames );
LL( mdcSurf->ofsEnd );
if ( mdcSurf->numVerts > SHADER_MAX_VERTEXES )
{
ri.Error( ERR_DROP, "R_LoadMDC: %s has more than %i verts on a surface (%i)",
modName, SHADER_MAX_VERTEXES, mdcSurf->numVerts );
}
if ( mdcSurf->numTriangles > SHADER_MAX_TRIANGLES )
{
ri.Error( ERR_DROP, "R_LoadMDC: %s has more than %i triangles on a surface (%i)",
modName, SHADER_MAX_TRIANGLES, mdcSurf->numTriangles );
}
// change to surface identifier
surf->surfaceType = SF_MDV;
// give pointer to model for Tess_SurfaceMDV
surf->model = mdvModel;
// copy surface name
Q_strncpyz( surf->name, mdcSurf->name, sizeof( surf->name ) );
// lowercase the surface name so skin compares are faster
Q_strlwr( surf->name );
// strip off a trailing _1 or _2
// this is a crutch for q3data being a mess
j = strlen( surf->name );
if ( j > 2 && surf->name[ j - 2 ] == '_' )
{
surf->name[ j - 2 ] = 0;
}
// register the shaders
/*
surf->numShaders = md3Surf->numShaders;
surf->shaders = shader = ri.Hunk_Alloc(sizeof(*shader) * md3Surf->numShaders, h_low);
md3Shader = (md3Shader_t *) ((byte *) md3Surf + md3Surf->ofsShaders);
for(j = 0; j < md3Surf->numShaders; j++, shader++, md3Shader++)
{
shader_t *sh;
sh = R_FindShader(md3Shader->name, SHADER_3D_DYNAMIC, RSF_DEFAULT);
if(sh->defaultShader)
{
shader->shaderIndex = 0;
}
else
{
shader->shaderIndex = sh->index;
}
}
*/
开发者ID:Gireen,项目名称:Unvanquished,代码行数:67,代码来源:tr_model_mdc.cpp
示例15: GL_ResolveHardwareType
/*
==================
GL_ResolveHardwareType
Chipset specific configuration
==================
*/
void GL_ResolveHardwareType( void )
{
char buf[ 1024 ];
cvar_t *lastValidRenderer = ri.Cvar_Get(
"r_lastValidRenderer", "(uninitialized)", CVAR_ARCHIVE );
Q_strncpyz( buf, glConfig.renderer_string, sizeof( buf ) );
Q_strlwr( buf );
// NOTE: if changing cvars, do it within this block. This allows them
// to be overridden when testing driver fixes, etc. but only sets
// them to their default state when the hardware is first installed/run.
if( Q_stricmp( lastValidRenderer->string, glConfig.renderer_string ) )
{
glConfig.hardwareType = GLHW_GENERIC;
ri.Cvar_Set( "r_textureMode", GENERIC_HW_R_TEXTUREMODE_DEFAULT );
// VOODOO GRAPHICS w/ 2MB
if ( strstr( buf, "voodoo graphics/1 tmu/2 mb" ) )
{
ri.Cvar_Set( "r_picmip", "2" );
ri.Cvar_Get( "r_picmip", "1", CVAR_ARCHIVE | CVAR_LATCH );
}
else
{
ri.Cvar_Set( "r_picmip", GENERIC_HW_R_PICMIP_DEFAULT );
if ( strstr( buf, "rage 128" ) || strstr( buf, "rage128" ) )
{
ri.Cvar_Set( "r_finish", "0" );
}
// Savage3D and Savage4 should always have trilinear enabled
else if ( strstr( buf, "savage3d" ) || strstr( buf, "s3 savage4" ) )
{
ri.Cvar_Set( "r_texturemode", "GL_LINEAR_MIPMAP_LINEAR" );
}
}
}
//
// this is where hardware specific workarounds that should be
// detected/initialized every startup should go.
//
if ( strstr( buf, "banshee" ) || strstr( buf, "voodoo3" ) )
{
glConfig.hardwareType = GLHW_3DFX_2D3D;
}
// VOODOO GRAPHICS w/ 2MB
else if ( strstr( buf, "voodoo graphics/1 tmu/2 mb" ) )
{
}
else if ( strstr( buf, "glzicd" ) )
{
}
else if ( strstr( buf, "rage pro" ) ||
strstr( buf, "Rage Pro" ) ||
strstr( buf, "ragepro" ) )
{
glConfig.hardwareType = GLHW_RAGEPRO;
}
else if ( strstr( buf, "rage 128" ) )
{
}
else if ( strstr( buf, "permedia2" ) )
{
glConfig.hardwareType = GLHW_PERMEDIA2;
}
else if ( strstr( buf, "riva 128" ) )
{
glConfig.hardwareType = GLHW_RIVA128;
}
else if ( strstr( buf, "riva tnt " ) )
{
}
}
开发者ID:wtfbbqhax,项目名称:thz,代码行数:83,代码来源:tr_init.c
示例16: RE_RegisterSkin
/*
===============
RE_RegisterSkin
===============
*/
qhandle_t RE_RegisterSkin(const char *name)
{
qhandle_t hSkin;
skin_t *skin;
skinSurface_t *surf;
skinModel_t *model; //----(SA) added
char *text, *text_p;
char *token;
char surfName[MAX_QPATH];
if(!name || !name[0])
{
Com_Printf("Empty name passed to RE_RegisterSkin\n");
return 0;
}
if(strlen(name) >= MAX_QPATH)
{
Com_Printf("Skin name exceeds MAX_QPATH\n");
return 0;
}
// see if the skin is already loaded
for(hSkin = 1; hSkin < tr.numSkins; hSkin++)
{
skin = tr.skins[hSkin];
if(!Q_stricmp(skin->name, name))
{
if(skin->numSurfaces == 0)
{
return 0; // default skin
}
return hSkin;
}
}
// allocate a new skin
if(tr.numSkins == MAX_SKINS)
{
ri.Printf(PRINT_WARNING, "WARNING: RE_RegisterSkin( '%s' ) MAX_SKINS hit\n", name);
return 0;
}
//----(SA) moved things around slightly to fix the problem where you restart
// a map that has ai characters who had invalid skin names entered
// in thier "skin" or "head" field
// make sure the render thread is stopped
R_SyncRenderThread();
#if 0
// If not a .skin file, load as a single shader
if(strcmp(name + strlen(name) - 5, ".skin"))
{
skin->numSurfaces = 1;
skin->surfaces[0] = ri.Hunk_Alloc(sizeof(skin->surfaces[0]), h_low);
skin->surfaces[0]->shader = R_FindShader(name, SHADER_3D_DYNAMIC, true);
return hSkin;
}
#endif
// load and parse the skin file
ri.FS_ReadFile(name, (void **)&text);
if(!text)
{
return 0;
}
tr.numSkins++;
skin = (skin_t*)ri.Hunk_Alloc(sizeof(skin_t), h_low);
tr.skins[hSkin] = skin;
Q_strncpyz(skin->name, name, sizeof(skin->name));
skin->numSurfaces = 0;
skin->numModels = 0; //----(SA) added
//----(SA) end
text_p = text;
while(text_p && *text_p)
{
// get surface name
token = CommaParse(&text_p);
Q_strncpyz(surfName, token, sizeof(surfName));
if(!token[0])
{
break;
}
// lowercase the surface name so skin compares are faster
Q_strlwr(surfName);
if(*text_p == ',')
{
//.........这里部分代码省略.........
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:101,代码来源:tr_skin.cpp
示例17: RE_RegisterIndividualSkin
// given a name, go get the skin we want and return
qhandle_t RE_RegisterIndividualSkin( const char *name , qhandle_t hSkin)
{
skin_t *skin;
skinSurface_t *surf;
char *text, *text_p;
char *token;
char surfName[MAX_QPATH];
// load and parse the skin file
ri->FS_ReadFile( name, (void **)&text );
if ( !text ) {
#ifndef FINAL_BUILD
Com_Printf( "WARNING: RE_RegisterSkin( '%s' ) failed to load!\n", name );
#endif
return 0;
}
assert (tr.skins[hSkin]); //should already be setup, but might be an 3part append
skin = tr.skins[hSkin];
text_p = text;
while ( text_p && *text_p ) {
// get surface name
token = CommaParse( &text_p );
Q_strncpyz( surfName, token, sizeof( surfName ) );
if ( !token[0] ) {
break;
}
// lowercase the surface name so skin compares are faster
Q_strlwr( surfName );
if ( *text_p == ',' ) {
text_p++;
}
if ( !strncmp( token, "tag_", 4 ) ) { //these aren't in there, but just in case you load an id style one...
continue;
}
// parse the shader name
token = CommaParse( &text_p );
if ( !strcmp( &surfName[strlen(surfName)-4], "_off") )
{
if ( !strcmp( token ,"*off" ) )
{
continue; //don't need these double offs
}
surfName[strlen(surfName)-4] = 0; //remove the "_off"
}
if ( (unsigned)skin->numSurfaces >= ARRAY_LEN( skin->surfaces ) )
{
assert( ARRAY_LEN( skin->surfaces ) > (unsigned)skin->numSurfaces );
Com_Printf( "WARNING: RE_RegisterSkin( '%s' ) more than %d surfaces!\n", name, ARRAY_LEN( skin->surfaces ) );
break;
}
surf = (skinSurface_t *) Hunk_Alloc( sizeof( *skin->surfaces[0] ), h_low );
skin->surfaces[skin->numSurfaces] = (_skinSurface_t *)surf;
Q_strncpyz( surf->name, surfName, sizeof( surf->name ) );
if (gServerSkinHack) surf->shader = R_FindServerShader( token, lightmapsNone, stylesDefault, qtrue );
else surf->shader = R_FindShader( token, lightmapsNone, stylesDefault, qtrue );
skin->numSurfaces++;
}
ri->FS_FreeFile( text );
// never let a skin have 0 shaders
if ( skin->numSurfaces == 0 ) {
return 0; // use default skin
}
return hSkin;
}
开发者ID:Razish,项目名称:CompJA,代码行数:79,代码来源:tr_skin.cpp
示例18: BG_RAG_ParseAnimFile
|
请发表评论