( *pp )->points[0][0], ( *pp )->points[0][1], ( *pp )->points[0][2],
( *pp )->points[1][0], ( *pp )->points[1][1], ( *pp )->points[1][2],
( *pp )->points[2][0], ( *pp )->points[2][1], ( *pp )->points[2][2],
- ( *pp )->texInfo.m_TextureName,
- ( *pp )->texInfo.m_fShift[0], ( *pp )->texInfo.m_fShift[1],
- ( *pp )->texInfo.m_fScale[0], ( *pp )->texInfo.m_fScale[0],
- ( *pp )->texInfo.m_fRotate );
+ ( *pp )->m_shader.c_str(),
+ ( *pp )->texInfo.m_texdef.shift[0], ( *pp )->texInfo.m_texdef.shift[1],
+ ( *pp )->texInfo.m_texdef.scale[0], ( *pp )->texInfo.m_texdef.scale[0],
+ ( *pp )->texInfo.m_texdef.rotate );
- fprintf( pFile, buffer );
+ fprintf( pFile, "%s", buffer );
}
fprintf( pFile, "}\n" );
char *ExpandPath( const char *path ){
static char full[1024];
- if ( !*qdir || path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
- if ( !qdir[0] ) {
++ if ( !qdir ) {
+ Error( "ExpandPath called without qdir set" );
+ }
+ if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
strcpy( full, path );
return full;
}
char *ExpandGamePath( const char *path ){
static char full[1024];
- if ( !*gamedir ) {
- if ( !qdir[0] ) {
- Error( "ExpandGamePath called without qdir set" );
++ if ( !gamedir[0] ) {
+ Error( "ExpandGamePath called without gamedir set" );
}
if ( path[0] == '/' || path[0] == '\\' || path[1] == ':' ) {
strcpy( full, path );
#endif
- #define MAX_OS_PATH 1024
+#ifdef PATH_MAX
+#define MAX_OS_PATH PATH_MAX
+#else
+ #define MAX_OS_PATH 4096
+#endif
#define MEM_BLOCKSIZE 4096
// the dec offsetof macro doesnt work very well...
#ifndef Q_UNIX
return NULL;
#else
+ static char buf[ 4096 ];
+ struct passwd pw, *pwp;
char *home;
- uid_t id;
- struct passwd *pwd;
+ static char homeBuf[MAX_OS_PATH];
/* get the home environment variable */
home = getenv( "HOME" );
- if ( home == NULL ) {
- /* do some more digging */
- id = getuid();
- setpwent();
- while ( ( pwd = getpwent() ) != NULL )
- {
- if ( pwd->pw_uid == id ) {
- home = pwd->pw_dir;
- break;
- }
- if ( home ) {
- return Q_strncpyz( buf, home, sizeof( buf ) );
- }
+
+ /* look up home dir in password database */
- if ( getpwuid_r( getuid(), &pw, buf, sizeof( buf ), &pwp ) == 0 ) {
- return pw.pw_dir;
++ if(!home)
++ {
++ if ( getpwuid_r( getuid(), &pw, buf, sizeof( buf ), &pwp ) == 0 ) {
++ return pw.pw_dir;
+ }
- endpwent();
}
- return NULL;
+ snprintf( homeBuf, sizeof( homeBuf ), "%s/.", home );
+
+ /* return it */
+ return homeBuf;
#endif
}
qboolean found;
- /* get home dir */
- home = LokiGetHomeDir();
- if ( home == NULL ) {
- home = ".";
- }
-
+ path = getenv( "PATH" );
+
/* do some path divining */
- strcpy( temp, argv0 );
- if ( strrchr( argv0, '/' ) ) {
+ Q_strncpyz( temp, argv0, sizeof( temp ) );
+ if ( strrchr( temp, '/' ) ) {
argv0 = strrchr( argv0, '/' ) + 1;
}
- else
- {
- /* get path environment variable */
- path = getenv( "PATH" );
-
- /* minor setup */
- last = last0;
- last[ 0 ] = path[ 0 ];
- last[ 1 ] = '\0';
+ else if ( path ) {
found = qfalse;
+ last = path;
/* go through each : segment of path */
while ( last[ 0 ] != '\0' && found == qfalse )
#include "inout.h"
#include "vfs.h"
#include "png.h"
-
+#include "md4.h"
#include <stdlib.h>
+ #define MIN(a, b) ((a) < (b) ? (a) : (b))
+ #define MAX(a, b) ((a) > (b) ? (a) : (b))
/* -------------------------------------------------------------------------------