fix compilation in Linux (Q_stricmp was function before and was implicitly linked w/o direct inclusion)
remove platform dependent branching in q3data
This commit is contained in:
parent
7492d3d8c5
commit
bc8cc6e213
|
|
@ -20,15 +20,8 @@
|
|||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include "md3lib.h"
|
||||
|
||||
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
||||
#define filelength Q_filelength
|
||||
#endif
|
||||
|
||||
/*
|
||||
** MD3_ComputeTagFromTri
|
||||
*/
|
||||
|
|
@ -142,15 +135,15 @@ void MD3_Dump( const char *filename ){
|
|||
FILE *fp;
|
||||
void *_buffer;
|
||||
void *buffer;
|
||||
long fileSize;
|
||||
int fileSize;
|
||||
int i;
|
||||
|
||||
if ( ( fp = fopen( filename, "rb" ) ) == 0 ) {
|
||||
Error( "Unable to open '%s'\n", filename );
|
||||
}
|
||||
|
||||
fileSize = filelength( fileno( fp ) );
|
||||
_buffer = malloc( filelength( fileno( fp ) ) );
|
||||
fileSize = Q_filelength( fp );
|
||||
_buffer = malloc( fileSize );
|
||||
fread( _buffer, fileSize, 1, fp );
|
||||
fclose( fp );
|
||||
|
||||
|
|
|
|||
|
|
@ -21,18 +21,15 @@
|
|||
|
||||
#include "p3dlib.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/cmdlib.h"
|
||||
|
||||
#define MAX_POLYSETS 64
|
||||
|
||||
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
||||
#define _strcmpi Q_stricmp
|
||||
#define filelength Q_filelength
|
||||
#define strlwr strlower
|
||||
#endif
|
||||
typedef struct
|
||||
|
|
@ -67,7 +64,7 @@ int P3DLoad( const char *filename ){
|
|||
|
||||
memset( &p3d, 0, sizeof( p3d ) );
|
||||
|
||||
p3d.len = filelength( fileno( fp ) );
|
||||
p3d.len = Q_filelength( fp );
|
||||
|
||||
p3d.curpos = p3d.buffer = malloc( p3d.len );
|
||||
|
||||
|
|
@ -102,7 +99,7 @@ int CharIsTokenDelimiter( int ch ){
|
|||
int P3DSkipToToken( const char *name ){
|
||||
while ( P3DGetToken( 0 ) )
|
||||
{
|
||||
if ( !_strcmpi( s_token, name ) ) {
|
||||
if ( !Q_stricmp( s_token, name ) ) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -167,14 +164,14 @@ int P3DSkipToTokenInBlock( const char *name ){
|
|||
|
||||
while ( P3DGetToken( 0 ) )
|
||||
{
|
||||
if ( !_strcmpi( s_token, "}" ) ) {
|
||||
if ( !Q_stricmp( s_token, "}" ) ) {
|
||||
iLevel--;
|
||||
}
|
||||
else if ( !_strcmpi( s_token, "{" ) ) {
|
||||
else if ( !Q_stricmp( s_token, "{" ) ) {
|
||||
iLevel++;
|
||||
}
|
||||
|
||||
if ( !_strcmpi( s_token, name ) ) {
|
||||
if ( !Q_stricmp( s_token, name ) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -201,7 +198,7 @@ int P3DProcess(){
|
|||
// skip to the first Obj declaration
|
||||
while ( P3DGetToken( 0 ) )
|
||||
{
|
||||
if ( !_strcmpi( s_token, "Obj" ) ) {
|
||||
if ( !Q_stricmp( s_token, "Obj" ) ) {
|
||||
int j = 0, k = 0;
|
||||
|
||||
if ( P3DSkipToToken( "Text" ) ) {
|
||||
|
|
@ -310,7 +307,7 @@ void SkinFromP3D( const char *file ){
|
|||
// corresponds to and append the shader to it
|
||||
for ( i = 0; i < g_data.model.numSurfaces; i++ )
|
||||
{
|
||||
if ( !_strcmpi( g_data.surfData[i].header.name, psetName ) ) {
|
||||
if ( !Q_stricmp( g_data.surfData[i].header.name, psetName ) ) {
|
||||
char *p;
|
||||
|
||||
if ( strstr( associatedShader, gamedir + 1 ) ) {
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@
|
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include "q3data.h"
|
||||
#include "md3lib.h"
|
||||
|
||||
|
|
@ -40,10 +37,6 @@ char *moddir = NULL;
|
|||
// some old defined that was in cmdlib lost during merge
|
||||
char writedir[1024];
|
||||
|
||||
#if defined ( __linux__ ) || defined ( __APPLE__ )
|
||||
#define strlwr strlower
|
||||
#endif
|
||||
|
||||
/*
|
||||
=======================================================
|
||||
|
||||
|
|
@ -170,7 +163,7 @@ void FindShaderFiles( char *filename ){
|
|||
}
|
||||
linebuffer[i] = 0;
|
||||
|
||||
strlwr( linebuffer );
|
||||
strlower( linebuffer );
|
||||
|
||||
// see if the line specifies an opaque map or blendmap
|
||||
if ( strstr( linebuffer, "opaquemap" ) == linebuffer ||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user