[qfusion-cvs-commits] SF.net SVN: l33t: [805] trunk/qfusion/source
Brought to you by:
digiman
|
From: qfusion s. c. <l33...@li...> - 2008-02-17 20:30:53
|
Revision: 805
http://l33t.svn.sourceforge.net/l33t/?rev=805&view=rev
Author: digiman
Date: 2008-02-17 12:30:30 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
Sync to Warsow
Modified Paths:
--------------
trunk/qfusion/source/cgame/cg_ents.c
trunk/qfusion/source/cgame/cg_public.h
trunk/qfusion/source/cgame/cg_screen.c
trunk/qfusion/source/cgame/cg_syscalls.h
trunk/qfusion/source/cgame/cg_view.c
trunk/qfusion/source/cgame/ref.h
trunk/qfusion/source/client/cl_game.c
trunk/qfusion/source/client/cl_vid.c
trunk/qfusion/source/client/snd_dma.c
trunk/qfusion/source/client/vid.h
trunk/qfusion/source/game/g_misc.c
trunk/qfusion/source/game/g_public.h
trunk/qfusion/source/game/g_spawn.c
trunk/qfusion/source/game/q_shared.c
trunk/qfusion/source/game/q_shared.h
trunk/qfusion/source/linux/vid_linux.c
trunk/qfusion/source/null/vid_null.c
trunk/qfusion/source/qcommon/common.c
trunk/qfusion/source/qcommon/cvar.c
trunk/qfusion/source/qcommon/files.c
trunk/qfusion/source/qcommon/qcommon.h
trunk/qfusion/source/qcommon/qfiles.h
trunk/qfusion/source/ref_gl/qgl.h
trunk/qfusion/source/ref_gl/r_alias.c
trunk/qfusion/source/ref_gl/r_backend.c
trunk/qfusion/source/ref_gl/r_backend.h
trunk/qfusion/source/ref_gl/r_bloom.c
trunk/qfusion/source/ref_gl/r_cin.c
trunk/qfusion/source/ref_gl/r_cull.c
trunk/qfusion/source/ref_gl/r_glimp.h
trunk/qfusion/source/ref_gl/r_image.c
trunk/qfusion/source/ref_gl/r_light.c
trunk/qfusion/source/ref_gl/r_local.h
trunk/qfusion/source/ref_gl/r_main.c
trunk/qfusion/source/ref_gl/r_math.c
trunk/qfusion/source/ref_gl/r_math.h
trunk/qfusion/source/ref_gl/r_mesh.c
trunk/qfusion/source/ref_gl/r_mesh.h
trunk/qfusion/source/ref_gl/r_model.c
trunk/qfusion/source/ref_gl/r_model.h
trunk/qfusion/source/ref_gl/r_poly.c
trunk/qfusion/source/ref_gl/r_program.c
trunk/qfusion/source/ref_gl/r_public.h
trunk/qfusion/source/ref_gl/r_register.c
trunk/qfusion/source/ref_gl/r_shader.c
trunk/qfusion/source/ref_gl/r_shader.h
trunk/qfusion/source/ref_gl/r_shadow.c
trunk/qfusion/source/ref_gl/r_shadow.h
trunk/qfusion/source/ref_gl/r_skin.c
trunk/qfusion/source/ref_gl/r_skm.c
trunk/qfusion/source/ref_gl/r_sky.c
trunk/qfusion/source/ref_gl/r_surf.c
trunk/qfusion/source/server/sv_ents.c
trunk/qfusion/source/ui/ui_public.h
trunk/qfusion/source/win32/vid_win.c
Modified: trunk/qfusion/source/cgame/cg_ents.c
===================================================================
--- trunk/qfusion/source/cgame/cg_ents.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_ents.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -192,25 +192,17 @@
Matrix_Identity( ent.axis );
// when origin and origin2 are the same, it's drawn as a mirror, otherwise as portal
- if( !VectorCompare( ent.origin, ent.origin2 ) ) {
- vec3_t dir;
-
+ if( !VectorCompare( ent.origin, ent.origin2 ) )
+ {
cg.portalInView = qtrue;
- ByteToDir( state->skinnum, dir );
- NormalVectorToAxis( dir, ent.axis );
+ ent.frame = state->skinnum;
+ if( state->modelindex3 )
+ {
+ float phase = cent->current.frame / 256.0f;
+ float speed = cent->current.modelindex2 ? cent->current.modelindex2 : 50;
+ Matrix_Rotate( ent.axis, 5 * sin( ( phase + cg.time * 0.001 * speed * 0.01 ) * M_TWOPI ), 1, 0, 0 );
- if( state->modelindex3 ) {
- float phase = (float)state->frame / 256.0f;
- float speed = (float)(state->modelindex2 ? state->modelindex2 : 50);
- vec3_t tmp[3], tmp2[3];
-
- // FIXME: this is embarrassing...
- Matrix_Identity( tmp );
- Matrix_Rotate( tmp, 5 * sin( (phase + cg.time * 0.001 * speed * 0.01) * M_TWOPI ), 1, 0, 0 );
- Matrix_Transpose( tmp, tmp2 );
- Matrix_Multiply( tmp2, ent.axis, tmp );
- Matrix_Copy( tmp, ent.axis );
}
}
@@ -427,6 +419,7 @@
ent.flags = renderfx & RF_MINLIGHT; // renderfx go on color shell entity
else
ent.flags = renderfx;
+ ent.flags |= RF_PLANARSHADOW;
// respawning items
if( cent->respawnTime )
Modified: trunk/qfusion/source/cgame/cg_public.h
===================================================================
--- trunk/qfusion/source/cgame/cg_public.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_public.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -20,7 +20,7 @@
// cg_public.h -- client game dll information visible to engine
-#define CGAME_API_VERSION 5
+#define CGAME_API_VERSION 6
//
// structs and variables shared with the main engine
@@ -57,12 +57,12 @@
void (*Print)( char *msg );
// console variable interaction
- cvar_t *(*Cvar_Get)( char *name, char *value, int flags );
- cvar_t *(*Cvar_Set)( char *name, char *value );
- void (*Cvar_SetValue)( char *name, float value );
- cvar_t *(*Cvar_ForceSet)( char *name, char *value ); // will return 0 0 if not found
- float (*Cvar_VariableValue)( char *name );
- char *(*Cvar_VariableString)( char *name );
+ cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags );
+ cvar_t *(*Cvar_Set)( const char *name, const char *value );
+ void (*Cvar_SetValue)( const char *name, float value );
+ cvar_t *(*Cvar_ForceSet)( const char *name, const char *value ); // will return 0 0 if not found
+ float (*Cvar_VariableValue)( const char *name );
+ char *(*Cvar_VariableString)( const char *name );
int (*Cmd_Argc)( void );
char *(*Cmd_Argv)( int arg );
@@ -109,6 +109,7 @@
void (*R_AddPolyToScene)( poly_t *poly );
void (*R_AddLightStyleToScene)( int style, float r, float g, float b );
void (*R_RenderScene)( refdef_t *fd );
+ const char *(*R_SpeedsMessage)( char *out, size_t size );
void (*R_RegisterWorldModel)( char *name );
void (*R_ModelBounds)( struct model_s *mod, vec3_t mins, vec3_t maxs );
struct model_s *(*R_RegisterModel)( char *name );
@@ -119,7 +120,7 @@
void (*R_DrawStretchPic)( int x, int y, int w, int h, float s1, float t1, float s2, float t2, vec4_t color, struct shader_s *shader );
void (*R_TransformVectorToScreen)( refdef_t *rd, vec3_t in, vec2_t out );
int (*R_SkeletalGetNumBones)( struct model_s *mod, int *numFrames );
- int (*R_SkeletalGetBoneInfo)( struct model_s *mod, int bone, char *name, int size, int *flags );
+ int (*R_SkeletalGetBoneInfo)( struct model_s *mod, int bone, char *name, size_t name_size, int *flags );
void (*R_SkeletalGetBonePose)( struct model_s *mod, int bone, int frame, bonepose_t *bonepose );
void (*R_SetCustomColor)( int num, int r, int g, int b );
void (*R_LightForOrigin)( vec3_t origin, vec3_t dir, vec4_t ambient, vec4_t diffuse, float radius );
Modified: trunk/qfusion/source/cgame/cg_screen.c
===================================================================
--- trunk/qfusion/source/cgame/cg_screen.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_screen.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -299,6 +299,48 @@
}
/*
+================
+SCR_DrawRSpeeds
+================
+*/
+void SCR_DrawRSpeeds( void )
+{
+ char msg[1024];
+ int x, y;
+ vec4_t color;
+
+ x = 5;
+ y = cgs.vidHeight / 2;
+ Vector4Copy( colorWhite, color );
+
+ trap_R_SpeedsMessage( msg, sizeof( msg ) );
+
+ if( msg[0] )
+ {
+ int height;
+ char *p, *start, *end;
+
+ height = SMALL_CHAR_HEIGHT;
+
+ p = start = msg;
+ do
+ {
+ end = strchr( p, '\n' );
+ if( end )
+ msg[end-start] = '\0';
+
+ CG_DrawString( x, y, p, FONT_SMALL, color );
+ y += height;
+
+ if( end )
+ p = end + 1;
+ else
+ break;
+ } while( 1 );
+ }
+}
+
+/*
=================
SCR_DrawCrosshair
=================
@@ -860,6 +902,8 @@
*/
void SCR_Draw2D( void )
{
+ SCR_DrawRSpeeds ();
+
SCR_DrawCrosshair ();
SCR_DrawStats ();
Modified: trunk/qfusion/source/cgame/cg_syscalls.h
===================================================================
--- trunk/qfusion/source/cgame/cg_syscalls.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_syscalls.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -184,6 +184,10 @@
CGAME_IMPORT.R_RenderScene( fd );
}
+static inline const char *trap_R_SpeedsMessage( char *out, size_t size ) {
+ return CGAME_IMPORT.R_SpeedsMessage( out, size );
+}
+
static inline void trap_R_RegisterWorldModel( char *name ) {
CGAME_IMPORT.R_RegisterWorldModel( name );
}
Modified: trunk/qfusion/source/cgame/cg_view.c
===================================================================
--- trunk/qfusion/source/cgame/cg_view.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/cg_view.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -208,15 +208,20 @@
*/
int CG_SkyPortal( void )
{
- float fov;
- vec3_t origin;
+ float fov = 0;
+ float scale = 0;
+ float yawspeed = 0;
+ skyportal_t *sp = &cg.refdef.skyportal;
- if( cgs.configStrings[CS_SKYBOXORG][0] == '\0' )
+ if( cgs.configStrings[CS_SKYBOX][0] == '\0' )
return 0;
- if( sscanf( cgs.configStrings[CS_SKYBOXORG], "%f %f %f %f", &origin[0], &origin[1], &origin[2], &fov ) == 4 ) {
- cg.refdef.skyportal.fov = fov;
- VectorCopy( origin, cg.refdef.skyportal.origin );
+ if( sscanf( cgs.configStrings[CS_SKYBOX], "%f %f %f %f %f %f",
+ &sp->vieworg[0], &sp->vieworg[1], &sp->vieworg[2], &fov, &scale, &yawspeed ) >= 3 )
+ {
+ sp->fov = fov;
+ sp->scale = scale ? 1.0f / scale : 0;
+ VectorSet( sp->viewanglesOffset, 0, cg.refdef.time * 0.001f * yawspeed, 0 );
return RDF_SKYPORTALINVIEW;
}
Modified: trunk/qfusion/source/cgame/ref.h
===================================================================
--- trunk/qfusion/source/cgame/ref.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/cgame/ref.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -21,10 +21,10 @@
#define __REF_H
// FIXME: move these to r_local.h?
-#define MAX_DLIGHTS 32
-#define MAX_ENTITIES 2048
-#define MAX_POLY_VERTS 3000
-#define MAX_POLYS 2048
+#define MAX_DLIGHTS 32
+#define MAX_ENTITIES 2048
+#define MAX_POLY_VERTS 3000
+#define MAX_POLYS 2048
// refdef flags
#define RDF_UNDERWATER 1 // warp the screen as apropriate
@@ -34,6 +34,7 @@
#define RDF_PORTALINVIEW 16 // cull entities using vis too because pvs\areabits are merged serverside
#define RDF_SKYPORTALINVIEW 32 // draw skyportal instead of regular sky
#define RDF_NOFOVADJUSTMENT 64 // do not adjust fov for widescreen
+#define RDF_WORLDOUTLINES 128 // draw cell outlines for world surfaces
// skm flags
#define SKM_ATTACHMENT_BONE 1
@@ -79,7 +80,9 @@
typedef struct
{
float fov;
- vec3_t origin;
+ float scale;
+ vec3_t vieworg;
+ vec3_t viewanglesOffset;
} skyportal_t;
typedef enum
@@ -89,11 +92,11 @@
RT_PORTALSURFACE,
NUM_RTYPES
-} entity_rtype_t;
+} refEntityType_t;
typedef struct entity_s
{
- entity_rtype_t rtype;
+ refEntityType_t rtype;
union
{
int flags;
@@ -138,6 +141,15 @@
float scale;
float radius; // used as RT_SPRITE's radius
float rotation;
+
+#ifdef HARDWARE_OUTLINES
+ float outlineHeight;
+ union
+ {
+ byte_vec4_t outlineColor;
+ qbyte outlineRGBA[4];
+ };
+#endif
} entity_t;
typedef struct
Modified: trunk/qfusion/source/client/cl_game.c
===================================================================
--- trunk/qfusion/source/client/cl_game.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/client/cl_game.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -179,6 +179,7 @@
import.R_AddPolyToScene = R_AddPolyToScene;
import.R_AddLightStyleToScene = R_AddLightStyleToScene;
import.R_RenderScene = R_RenderScene;
+ import.R_SpeedsMessage = R_SpeedsMessage;
import.R_RegisterWorldModel = CL_GameModule_R_RegisterWorldModel;
import.R_ModelBounds = R_ModelBounds;
import.R_RegisterModel = R_RegisterModel;
Modified: trunk/qfusion/source/client/cl_vid.c
===================================================================
--- trunk/qfusion/source/client/cl_vid.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/client/cl_vid.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -37,11 +37,12 @@
#define VID_NUM_MODES (int)( sizeof( vid_modes ) / sizeof( vid_modes[0] ) )
-qboolean vid_ref_modified;
-qboolean vid_ref_active;
+static qboolean vid_ref_modified;
+static qboolean vid_ref_verbose;
+static qboolean vid_ref_active;
// These are system specific functions
-int VID_Sys_Init( void ); // wrapper around R_Init
+int VID_Sys_Init( qboolean verbose ); // wrapper around R_Init
void VID_Front_f( void );
void VID_UpdateWindowPosAndSize( int x, int y );
void VID_EnableAltTab( qboolean enable );
@@ -55,14 +56,15 @@
cause the entire video mode and refresh DLL to be reset on the next frame.
============
*/
-void VID_Restart (void)
+void VID_Restart( qboolean verbose )
{
vid_ref_modified = qtrue;
+ vid_ref_verbose = verbose;
}
void VID_Restart_f (void)
{
- VID_Restart ();
+ VID_Restart( (Cmd_Argc() >= 2 ? qtrue : qfalse) );
}
/*
@@ -175,11 +177,11 @@
CL_ShutdownMedia ();
if( vid_ref_active ) {
- R_Shutdown ();
+ R_Shutdown( qfalse );
vid_ref_active = qfalse;
}
- if( VID_Sys_Init () == -1 )
+ if( VID_Sys_Init( vid_ref_verbose ) == -1 )
Com_Error ( ERR_FATAL, "Failed to load %s", (gl_driver && gl_driver->name) ? gl_driver->string : "" );
CL_InitMedia ();
@@ -198,6 +200,7 @@
vid_ref_active = qtrue;
vid_ref_modified = qfalse;
+ vid_ref_verbose = qtrue;
}
/*
@@ -238,6 +241,7 @@
/* Start the graphics mode and load refresh DLL */
vid_ref_modified = qtrue;
vid_ref_active = qfalse;
+ vid_ref_verbose = qtrue;
vid_fullscreen->modified = qtrue;
VID_CheckChanges ();
}
@@ -250,7 +254,7 @@
void VID_Shutdown (void)
{
if( vid_ref_active ) {
- R_Shutdown();
+ R_Shutdown( qtrue );
vid_ref_active = qfalse;
}
Modified: trunk/qfusion/source/client/snd_dma.c
===================================================================
--- trunk/qfusion/source/client/snd_dma.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/client/snd_dma.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -246,11 +246,13 @@
*/
void S_Restart( qboolean noVideo )
{
+ qboolean verbose = (Cmd_Argc() >= 2 ? qtrue : qfalse);
+
S_Shutdown ();
S_Init ();
if( !noVideo )
- VID_Restart ();
+ VID_Restart( verbose );
}
// =======================================================================
Modified: trunk/qfusion/source/client/vid.h
===================================================================
--- trunk/qfusion/source/client/vid.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/client/vid.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -29,5 +29,5 @@
// Video module initialisation etc
void VID_Init (void);
void VID_Shutdown (void);
-void VID_Restart (void);
+void VID_Restart( qboolean verbose );
void VID_CheckChanges (void);
Modified: trunk/qfusion/source/game/g_misc.c
===================================================================
--- trunk/qfusion/source/game/g_misc.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/g_misc.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -1918,5 +1918,5 @@
// st.fov = 90;
ent->r.svflags |= SVF_NOCLIENT;
- trap_ConfigString( CS_SKYBOXORG, va("%.3f %.3f %.3f %.1f", ent->s.origin[0], ent->s.origin[1], ent->s.origin[2], st.fov ) );
+ trap_ConfigString( CS_SKYBOX, va("%.3f %.3f %.3f %.1f", ent->s.origin[0], ent->s.origin[1], ent->s.origin[2], st.fov ) );
}
Modified: trunk/qfusion/source/game/g_public.h
===================================================================
--- trunk/qfusion/source/game/g_public.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/g_public.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -20,7 +20,7 @@
// g_public.h -- game dll information visible to server
-#define GAME_API_VERSION 3
+#define GAME_API_VERSION 4
// edict->svflags
#define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects
@@ -149,9 +149,9 @@
void (*Mem_Free)( void *data, const char *filename, int fileline );
// console variable interaction
- cvar_t *(*Cvar_Get)( char *name, char *value, int flags );
- cvar_t *(*Cvar_Set)( char *name, char *value );
- cvar_t *(*Cvar_ForceSet)( char *name, char *value ); // will return 0 0 if not found
+ cvar_t *(*Cvar_Get)( const char *name, const char *value, int flags );
+ cvar_t *(*Cvar_Set)( const char *name, const char *value );
+ cvar_t *(*Cvar_ForceSet)( const char *name, const char *value ); // will return 0 0 if not found
// ClientCommand and ServerCommand parameter access
int (*Cmd_Argc)( void );
Modified: trunk/qfusion/source/game/g_spawn.c
===================================================================
--- trunk/qfusion/source/game/g_spawn.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/g_spawn.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -710,7 +710,7 @@
trap_ConfigString (CS_MAPNAME, level.mapname);
trap_ConfigString (CS_MAXCLIENTS, va("%i", sv_maxclients->integer ) );
trap_ConfigString (CS_AIRACCEL, va("%g", sv_airaccelerate->integer) );
- trap_ConfigString (CS_SKYBOXORG, "");
+ trap_ConfigString (CS_SKYBOX, "");
// status bar program
if (deathmatch->integer)
Modified: trunk/qfusion/source/game/q_shared.c
===================================================================
--- trunk/qfusion/source/game/q_shared.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/q_shared.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -167,6 +167,18 @@
}
/*
+==================
+COM_DefaultExtension
+==================
+*/
+char *COM_ReplaceExtension( char *path, const char *extension )
+{
+ COM_StripExtension( path, path );
+ strcat( path, extension );
+ return path;
+}
+
+/*
============================================================================
BYTE ORDER FUNCTIONS
@@ -349,7 +361,105 @@
return string[str_index];
}
+/*
+==============
+COM_Compress
+Parse a token out of a string
+==============
+*/
+int COM_Compress( char *data_p )
+{
+ char *in, *out;
+ int c;
+ qboolean newline = qfalse, whitespace = qfalse;
+
+ in = out = data_p;
+ if( in )
+ {
+ while( ( c = *in ) != 0 )
+ {
+ // skip double slash comments
+ if( c == '/' && in[1] == '/' )
+ {
+ while( *in && *in != '\n' )
+ {
+ in++;
+ }
+ // skip /* */ comments
+ }
+ else if( c == '/' && in[1] == '*' )
+ {
+ while( *in && ( *in != '*' || in[1] != '/' ) )
+ in++;
+ if( *in )
+ in += 2;
+ // record when we hit a newline
+ }
+ else if( c == '\n' || c == '\r' )
+ {
+ newline = qtrue;
+ in++;
+ // record when we hit whitespace
+ }
+ else if( c == ' ' || c == '\t' )
+ {
+ whitespace = qtrue;
+ in++;
+ // an actual token
+ }
+ else
+ {
+ // if we have a pending newline, emit it (and it counts as whitespace)
+ if( newline )
+ {
+ *out++ = '\n';
+ newline = qfalse;
+ whitespace = qfalse;
+ }
+ if( whitespace )
+ {
+ *out++ = ' ';
+ whitespace = qfalse;
+ }
+
+ // copy quoted strings unmolested
+ if( c == '"' )
+ {
+ *out++ = c;
+ in++;
+ while( 1 )
+ {
+ c = *in;
+ if( c && c != '"' )
+ {
+ *out++ = c;
+ in++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ if( c == '"' )
+ {
+ *out++ = c;
+ in++;
+ }
+ }
+ else
+ {
+ *out = c;
+ out++;
+ in++;
+ }
+ }
+ }
+ }
+ *out = 0;
+ return out - data_p;
+}
+
char com_token[MAX_TOKEN_CHARS];
/*
@@ -359,11 +469,11 @@
Parse a token out of a string
==============
*/
-char *COM_ParseExt (char **data_p, qboolean nl)
+char *COM_ParseExt (const char **data_p, qboolean nl)
{
int c;
int len;
- char *data;
+ const char *data;
qboolean newlines = qfalse;
data = *data_p;
@@ -561,7 +671,7 @@
Q_isdigit
==============
*/
-qboolean Q_isdigit( char *str )
+qboolean Q_isdigit( const char *str )
{
if( str && *str ) {
while( isdigit( *str ) ) str++;
@@ -572,6 +682,25 @@
}
/*
+==============
+Q_strrstr
+==============
+*/
+const char *Q_strrstr( const char *s, const char *substr )
+{
+ const char *p;
+
+ s = p = strstr( s, substr );
+ while( s != NULL )
+ {
+ p = s;
+ s = strstr( s + 1, substr );
+ }
+
+ return p;
+}
+
+/*
============================================================================
WILDCARD COMPARES FUNCTIONS
Modified: trunk/qfusion/source/game/q_shared.h
===================================================================
--- trunk/qfusion/source/game/q_shared.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/game/q_shared.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -259,6 +259,7 @@
#define MAX_MODELS 256 // these are sent over the net as bytes
#define MAX_SOUNDS 256 // so they cannot be blindly increased
#define MAX_IMAGES 256
+#define MAX_SKINFILES 256
#define MAX_ITEMS 256
#define MAX_GENERAL (MAX_CLIENTS*2) // general config strings
@@ -473,9 +474,12 @@
char *COM_FileBase( const char *in, char *out );
char *COM_FilePath( const char *in, char *out );
char *COM_DefaultExtension( char *path, const char *extension );
+char *COM_ReplaceExtension( char *path, const char *extension );
+int COM_Compress( char *data_p );
+
// data is an in/out parm, returns a parsed out token
-char *COM_ParseExt (char **data_p, qboolean nl);
+char *COM_ParseExt (const char **data_p, qboolean nl);
#define COM_Parse(data_p) COM_ParseExt(data_p,qtrue)
//=============================================
@@ -530,7 +534,8 @@
void Q_snprintfz( char *dest, size_t size, const char *fmt, ... );
char *Q_strlwr( char *s );
qboolean Q_WildCmp( const char *pattern, const char *text );
-qboolean Q_isdigit( char *str );
+qboolean Q_isdigit( const char *str );
+const char *Q_strrstr( const char *s, const char *substr );
//=============================================
#if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)
@@ -924,7 +929,7 @@
#define CS_AUDIOTRACK 2
#define CS_STATUSBAR 3 // display program string
#define CS_GAMETYPE 4
-#define CS_SKYBOXORG 5 // sky portal origin
+#define CS_SKYBOX 5 // sky portal origin
#define CS_AIRACCEL 29 // air acceleration control
#define CS_MAXCLIENTS 30
Modified: trunk/qfusion/source/linux/vid_linux.c
===================================================================
--- trunk/qfusion/source/linux/vid_linux.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/linux/vid_linux.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -25,8 +25,8 @@
VID_Sys_Init
============
*/
-int VID_Sys_Init( void ) {
- return R_Init( NULL, NULL );
+int VID_Sys_Init( qboolean verbose ) {
+ return R_Init( NULL, NULL, verbose );
}
/*
Modified: trunk/qfusion/source/null/vid_null.c
===================================================================
--- trunk/qfusion/source/null/vid_null.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/null/vid_null.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -27,8 +27,8 @@
VID_Sys_Init
============
*/
-int VID_Sys_Init( void ) {
- return R_Init( NULL, NULL );
+int VID_Sys_Init( qboolean verbose ) {
+ return R_Init( NULL, NULL, verbose );
}
/*
Modified: trunk/qfusion/source/qcommon/common.c
===================================================================
--- trunk/qfusion/source/qcommon/common.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/common.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -303,7 +303,7 @@
Returns hash key for a string
==========
*/
-unsigned int Com_HashKey (char *name, int hashsize)
+unsigned int Com_HashKey (const char *name, int hashsize)
{
int i;
unsigned int v;
Modified: trunk/qfusion/source/qcommon/cvar.c
===================================================================
--- trunk/qfusion/source/qcommon/cvar.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/cvar.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -31,7 +31,7 @@
Cvar_InfoValidate
============
*/
-static qboolean Cvar_InfoValidate (char *s, qboolean name)
+static qboolean Cvar_InfoValidate (const char *s, qboolean name)
{
if (strstr (s, "\\"))
return qfalse;
@@ -49,7 +49,7 @@
Cvar_FindVar
============
*/
-static cvar_t *Cvar_FindVar (char *var_name)
+static cvar_t *Cvar_FindVar (const char *var_name)
{
unsigned hash;
cvar_t *var;
@@ -67,7 +67,7 @@
Cvar_VariableValue
============
*/
-float Cvar_VariableValue (char *var_name)
+float Cvar_VariableValue (const char *var_name)
{
cvar_t *var;
@@ -83,7 +83,7 @@
Cvar_VariableString
============
*/
-char *Cvar_VariableString (char *var_name)
+char *Cvar_VariableString (const char *var_name)
{
cvar_t *var;
@@ -99,7 +99,7 @@
Cvar_CompleteVariable
============
*/
-char *Cvar_CompleteVariable (char *partial)
+char *Cvar_CompleteVariable (const char *partial)
{
cvar_t *cvar;
int len;
@@ -131,7 +131,7 @@
The flags will be or'ed and default value overwritten in if the variable exists.
============
*/
-cvar_t *Cvar_Get (char *var_name, char *var_value, int flags)
+cvar_t *Cvar_Get (const char *var_name, const char *var_value, int flags)
{
unsigned hash;
cvar_t *var;
@@ -204,7 +204,7 @@
Cvar_Set2
============
*/
-cvar_t *Cvar_Set2 (char *var_name, char *value, qboolean force)
+cvar_t *Cvar_Set2 (const char *var_name, const char *value, qboolean force)
{
cvar_t *var;
@@ -317,7 +317,7 @@
Cvar_ForceSet
============
*/
-cvar_t *Cvar_ForceSet (char *var_name, char *value)
+cvar_t *Cvar_ForceSet (const char *var_name, const char *value)
{
return Cvar_Set2 (var_name, value, qtrue);
}
@@ -327,7 +327,7 @@
Cvar_Set
============
*/
-cvar_t *Cvar_Set (char *var_name, char *value)
+cvar_t *Cvar_Set (const char *var_name, const char *value)
{
return Cvar_Set2 (var_name, value, qfalse);
}
@@ -337,7 +337,7 @@
Cvar_FullSet
============
*/
-cvar_t *Cvar_FullSet (char *var_name, char *value, int flags, qboolean overwriteFlags)
+cvar_t *Cvar_FullSet (const char *var_name, const char *value, int flags, qboolean overwriteFlags)
{
cvar_t *var;
@@ -369,7 +369,7 @@
Cvar_SetValue
============
*/
-void Cvar_SetValue (char *var_name, float value)
+void Cvar_SetValue (const char *var_name, float value)
{
char val[32];
@@ -671,7 +671,7 @@
*/
int
-Cvar_CompleteCountPossible (char *partial)
+Cvar_CompleteCountPossible (const char *partial)
{
cvar_t *v;
int len, h = 0;
@@ -698,7 +698,7 @@
Thanks to taniwha
*/
-char **Cvar_CompleteBuildList (char *partial)
+char **Cvar_CompleteBuildList (const char *partial)
{
cvar_t *v;
int len;
Modified: trunk/qfusion/source/qcommon/files.c
===================================================================
--- trunk/qfusion/source/qcommon/files.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/files.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -1477,7 +1477,7 @@
*/
void FS_ExecAutoexec( void )
{
- char *dir;
+ const char *dir;
char name[MAX_OSPATH];
dir = Cvar_VariableString( "fs_gamedir" );
@@ -1519,7 +1519,7 @@
// flush all data, so it will be forced to reload
if( dedicated && !dedicated->integer )
- Cbuf_AddText( "snd_restart\nin_restart\n" );
+ Cbuf_AddText( "snd_restart 1\nin_restart\n" );
Q_snprintfz( fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basepath->string, dir );
Modified: trunk/qfusion/source/qcommon/qcommon.h
===================================================================
--- trunk/qfusion/source/qcommon/qcommon.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/qcommon.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -455,36 +455,36 @@
extern cvar_t *cvar_vars;
-cvar_t *Cvar_Get (char *var_name, char *value, int flags);
+cvar_t *Cvar_Get (const char *var_name, const char *value, int flags);
// creates the variable if it doesn't exist, or returns the existing one
// if it exists, the value will not be changed, but flags will be ORed in
// that allows variables to be unarchived without needing bitflags
-cvar_t *Cvar_Set (char *var_name, char *value);
+cvar_t *Cvar_Set (const char *var_name, const char *value);
// will create the variable if it doesn't exist
-cvar_t *Cvar_ForceSet (char *var_name, char *value);
+cvar_t *Cvar_ForceSet (const char *var_name, const char *value);
// will set the variable even if NOSET or LATCH
-cvar_t *Cvar_FullSet (char *var_name, char *value, int flags, qboolean overwrite_flags);
+cvar_t *Cvar_FullSet (const char *var_name, const char *value, int flags, qboolean overwrite_flags);
-void Cvar_SetValue (char *var_name, float value);
+void Cvar_SetValue (const char *var_name, float value);
// expands value to a string and calls Cvar_Set
-float Cvar_VariableValue (char *var_name);
+float Cvar_VariableValue (const char *var_name);
// returns 0 if not defined or non numeric
-char *Cvar_VariableString (char *var_name);
+char *Cvar_VariableString (const char *var_name);
// returns an empty string if not defined
-char *Cvar_CompleteVariable (char *partial);
+char *Cvar_CompleteVariable (const char *partial);
// attempts to match a partial variable name for command line completion
// returns NULL if nothing fits
void Cmd_WriteAliases (FILE *f);
-int Cvar_CompleteCountPossible (char *partial);
-char **Cvar_CompleteBuildList (char *partial);
+int Cvar_CompleteCountPossible (const char *partial);
+char **Cvar_CompleteBuildList (const char *partial);
char *Cvar_TabComplete (const char *partial);
void Cvar_GetLatchedVars (int flags);
@@ -692,7 +692,7 @@
void Com_PageInMemory (qbyte *buffer, int size);
-unsigned int Com_HashKey (char *name, int hashsize);
+unsigned int Com_HashKey (const char *name, int hashsize);
extern cvar_t *developer;
extern cvar_t *dedicated;
Modified: trunk/qfusion/source/qcommon/qfiles.h
===================================================================
--- trunk/qfusion/source/qcommon/qfiles.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/qcommon/qfiles.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -187,7 +187,7 @@
int num_verts;
int num_tris;
- int ofs_indexes;
+ int ofs_elems;
int ofs_skins;
int ofs_tcs;
int ofs_verts;
@@ -433,7 +433,7 @@
#define LUMP_BRUSHES 8
#define LUMP_BRUSHSIDES 9
#define LUMP_VERTEXES 10
-#define LUMP_INDEXES 11
+#define LUMP_ELEMENTS 11
#define LUMP_FOGS 12
#define LUMP_FACES 13
#define LUMP_LIGHTING 14
@@ -573,8 +573,8 @@
int firstvert;
int numverts;
- unsigned firstindex;
- int numindexes;
+ unsigned firstelem;
+ int numelems;
int lm_texnum; // lightmap info
int lm_offset[2];
@@ -597,8 +597,8 @@
int firstvert;
int numverts;
- unsigned firstindex;
- int numindexes;
+ unsigned firstelem;
+ int numelems;
unsigned char lightmapStyles[MAX_LIGHTMAPS];
unsigned char vertexStyles[MAX_LIGHTMAPS];
Modified: trunk/qfusion/source/ref_gl/qgl.h
===================================================================
--- trunk/qfusion/source/ref_gl/qgl.h 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/ref_gl/qgl.h 2008-02-17 20:30:30 UTC (rev 805)
@@ -56,8 +56,8 @@
/*
** QGL.H
*/
-#ifndef QGL_H
-#define QGL_H
+#ifndef __QGL_H__
+#define __QGL_H__
#define GL_GLEXT_LEGACY
#define GLX_GLXEXT_LEGACY
@@ -84,12 +84,6 @@
QGL_EXTERN void *qglGetProcAddress( const GLubyte * );
QGL_EXTERN const char *(*qglGetGLWExtensionsString)( void );
-#endif
-
-#ifndef APIENTRY
-# define APIENTRY
-#endif
-
/*
** extension constants
*/
@@ -105,6 +99,7 @@
#define GL_POLYGON_OFFSET 0x8037
#endif
+/* GL_ARB_texture_env_combine */
#ifndef GL_ARB_texture_env_combine
#define GL_ARB_texture_env_combine
@@ -129,7 +124,6 @@
#define GL_OPERAND0_ALPHA_ARB 0x8598
#define GL_OPERAND1_ALPHA_ARB 0x8599
#define GL_OPERAND2_ALPHA_ARB 0x859A
-
#endif /* GL_ARB_texture_env_combine */
/* GL_ARB_texture_compression */
@@ -147,7 +141,6 @@
#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
-
#endif /* GL_ARB_texture_compression */
/* GL_EXT_texture_filter_anisotropic */
@@ -156,7 +149,6 @@
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-
#endif /* GL_EXT_texture_filter_anisotropic */
/* GL_EXT_texture_edge_clamp */
@@ -164,7 +156,6 @@
#define GL_EXT_texture_edge_clamp
#define GL_CLAMP_TO_EDGE 0x812F
-
#endif /* GL_EXT_texture_edge_clamp */
/* GL_ARB_vertex_buffer_object */
@@ -205,7 +196,6 @@
#define GL_BUFFER_ACCESS_ARB 0x88BB
#define GL_BUFFER_MAPPED_ARB 0x88BC
#define GL_BUFFER_MAP_POINTER_ARB 0x88BD
-
#endif /* GL_ARB_vertex_buffer_object */
/* GL_ARB_texture_cube_map */
@@ -224,7 +214,6 @@
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
-
#endif /* GL_ARB_texture_cube_map */
/* GL_EXT_bgra */
@@ -233,10 +222,9 @@
#define GL_BGR_EXT 0x80E0
#define GL_BGRA_EXT 0x80E1
-
#endif /* GL_EXT_bgra */
-/* GL_EXT_texture3D */
+/* gl_ext_texture3D */
#ifndef GL_EXT_texture3D
#define GL_EXT_texture3D
@@ -250,7 +238,6 @@
#define GL_TEXTURE_WRAP_R 0x8072
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
#define GL_TEXTURE_BINDING_3D 0x806A
-
#endif /* GL_EXT_texture3D */
/* GL_ARB_shader_objects */
@@ -260,7 +247,6 @@
typedef char GLcharARB;
typedef unsigned int GLhandleARB;
-#ifndef GL_PROGRAM_OBJECT_ARB
#define GL_PROGRAM_OBJECT_ARB 0x8B40
#define GL_OBJECT_TYPE_ARB 0x8B4E
#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
@@ -297,15 +283,12 @@
#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
#define GL_SAMPLER_2D_RECT_ARB 0x8B63
#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
-#endif
-
#endif /* GL_ARB_shader_objects */
/* GL_ARB_vertex_shader */
#ifndef GL_ARB_vertex_shader
#define GL_ARB_vertex_shader
-#ifndef GL_VERTEX_SHADER_ARB
#define GL_VERTEX_SHADER_ARB 0x8B31
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
@@ -332,68 +315,46 @@
#define GL_FLOAT_MAT2_ARB 0x8B5A
#define GL_FLOAT_MAT3_ARB 0x8B5B
#define GL_FLOAT_MAT4_ARB 0x8B5C
-#endif
-
#endif /* GL_ARB_vertex_shader */
/* GL_ARB_fragment_shader */
#ifndef GL_ARB_fragment_shader
#define GL_ARB_fragment_shader
-#ifndef GL_FRAGMENT_SHADER_ARB
#define GL_FRAGMENT_SHADER_ARB 0x8B30
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
-#endif
-
#endif /* GL_ARB_fragment_shader */
/* GL_ARB_shading_language_100 */
#ifndef GL_ARB_shading_language_100
#define GL_ARB_shading_language_100
-#ifndef GL_SHADING_LANGUAGE_VERSION_ARB
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
-#endif
-
#endif /* GL_ARB_shading_language_100 */
/* ARB_depth_texture */
#ifndef ARB_depth_texture
#define ARB_depth_texture
-#ifndef GL_DEPTH_COMPONENT16
#define GL_DEPTH_COMPONENT16 0x81A5
-#endif
-#ifndef GL_DEPTH_COMPONENT24
#define GL_DEPTH_COMPONENT24 0x81A6
-#endif
-#ifndef GL_DEPTH_COMPONENT32
#define GL_DEPTH_COMPONENT32 0x81A7
-#endif
-#ifndef GL_TEXTURE_DEPTH_SIZE
#define GL_TEXTURE_DEPTH_SIZE 0x884A
-#endif
-#ifndef GL_DEPTH_TEXTURE_MODE
-#define GL_DEPTH_TEXTURE_MODE 0x884B
-#endif /* GL_DEPTH_TEXTURE_MODE */
+#define GL_DEPTH_TEXTURE_MODE 0x884B
+#endif /* ARB_depth_texture */
-#endif
-
/* GL_ARB_shadow */
#ifndef GL_ARB_shadow
#define GL_ARB_shadow
-#ifndef GL_DEPTH_TEXTURE_MODE_ARB
#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
-#endif
-
#endif /* GL_ARB_shadow */
/* GL_ARB_occlusion_query */
@@ -405,7 +366,6 @@
#define GL_QUERY_RESULT_ARB 0x8866
#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
#define GL_SAMPLES_PASSED_ARB 0x8914
-
#endif /* GL_ARB_occlusion_query */
/* GL_SGIS_generate_mipmap */
@@ -414,9 +374,18 @@
#define GL_GENERATE_MIPMAP_SGIS 0x8191
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
-
#endif /* GL_SGIS_generate_mipmap */
+#endif /*__QGL_H__*/
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+
+#ifndef QGL_FUNC
+#define QGL_FUNC
+#endif
+
// WGL Functions
QGL_WGL(PROC, wglGetProcAddress, (LPCSTR));
QGL_WGL(int, wglChoosePixelFormat, (HDC, CONST PIXELFORMATDESCRIPTOR *));
@@ -577,3 +546,5 @@
QGL_WGL_EXT(const char *, wglGetExtensionsStringEXT, (void));
QGL_WGL_EXT(BOOL, wglGetDeviceGammaRamp3DFX, (HDC, WORD *));
QGL_WGL_EXT(BOOL, wglSetDeviceGammaRamp3DFX, (HDC, WORD *));
+
+// GLX_EXT Functions
Modified: trunk/qfusion/source/ref_gl/r_alias.c
===================================================================
--- trunk/qfusion/source/ref_gl/r_alias.c 2007-12-19 00:45:57 UTC (rev 804)
+++ trunk/qfusion/source/ref_gl/r_alias.c 2008-02-17 20:30:30 UTC (rev 805)
@@ -8,7 +8,7 @@
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
@@ -17,15 +17,16 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
// r_alias.c: Quake 2 .md2 and Quake III Arena .md3 model formats support
#include "r_local.h"
-static mesh_t alias_mesh;
+static mesh_t alias_mesh;
-static vec3_t alias_mins;
-static vec3_t alias_maxs;
-static float alias_radius;
+static vec3_t alias_mins;
+static vec3_t alias_maxs;
+static float alias_radius;
/*
=================
@@ -40,20 +41,22 @@
maliasmodel_t *aliasmodel = ( maliasmodel_t * )mod->extradata;
frame = &aliasmodel->frames[0];
- for( k = 0; k < aliasmodel->nummeshes; k++ ) {
+ for( k = 0; k < aliasmodel->nummeshes; k++ )
+ {
maliasmesh_t *mesh = &aliasmodel->meshes[k];
- size = sizeof( vec4_t ) + sizeof( vec4_t ); // xyz and normals
+ size = sizeof( vec4_t ) + sizeof( vec4_t ); // xyz and normals
if( glConfig.ext.GLSL )
- size += sizeof( vec4_t ); // s-vectors
+ size += sizeof( vec4_t ); // s-vectors
size *= mesh->numverts;
mesh->xyzArray = ( vec4_t * )Mod_Malloc( mod, size );
- mesh->normalsArray = ( vec4_t * )(( qbyte * )mesh->xyzArray + mesh->numverts * sizeof( vec4_t ));
+ mesh->normalsArray = ( vec4_t * )( ( qbyte * )mesh->xyzArray + mesh->numverts * sizeof( vec4_t ) );
if( glConfig.ext.GLSL )
- mesh->sVectorsArray = ( vec4_t * )(( qbyte * )mesh->normalsArray + mesh->numverts * sizeof( vec4_t ));
+ mesh->sVectorsArray = ( vec4_t * )( ( qbyte * )mesh->normalsArray + mesh->numverts * sizeof( vec4_t ) );
- for( i = 0; i < mesh->numverts; i++ ) {
+ for( i = 0; i < mesh->numverts; i++ )
+ {
for( j = 0; j < 3; j++ )
mesh->xyzArray[i][j] = frame->translate[j] + frame->scale[j] * mesh->vertexes[i].point[j];
mesh->xyzArray[i][3] = 1;
@@ -62,7 +65,7 @@
}
if( glConfig.ext.GLSL )
- R_BuildTangentVectors( mesh->numverts, mesh->xyzArray, mesh->normalsArray, mesh->stArray, mesh->numtris, mesh->indexes, mesh->sVectorsArray );
+ R_BuildTangentVectors( mesh->numverts, mesh->xyzArray, mesh->normalsArray, mesh->stArray, mesh->numtris, mesh->elems, mesh->sVectorsArray );
}
}
@@ -82,7 +85,7 @@
Mod_AliasCalculateVertexNormals
=================
*/
-static void Mod_AliasCalculateVertexNormals( int numIndexes, index_t *indexes, int numVerts, maliasvertex_t *v )
+static void Mod_AliasCalculateVertexNormals( int numElems, elem_t *elems, int numVerts, maliasvertex_t *v )
{
int i, j, k, vertRemap[MD2_MAX_VERTS];
vec3_t dir1, dir2, normal, trnormals[MD2_MAX_TRIANGLES];
@@ -90,24 +93,29 @@
qbyte latlongs[MD2_MAX_VERTS][2];
// count unique verts
- for( i = 0, numUniqueVerts = 0; i < numVerts; i++ ) {
- for( j = 0; j < numUniqueVerts; j++ ) {
- if( VectorCompare( v[uniqueVerts[j]].point, v[i].point ) ) {
+ for( i = 0, numUniqueVerts = 0; i < numVerts; i++ )
+ {
+ for( j = 0; j < numUniqueVerts; j++ )
+ {
+ if( VectorCompare( v[uniqueVerts[j]].point, v[i].point ) )
+ {
vertRemap[i] = j;
break;
}
}
- if( j == numUniqueVerts ) {
+ if( j == numUniqueVerts )
+ {
vertRemap[i] = numUniqueVerts;
uniqueVerts[numUniqueVerts++] = i;
}
}
- for( i = 0, j = 0; i < numIndexes; i += 3, j++ ) {
+ for( i = 0, j = 0; i < numElems; i += 3, j++ )
+ {
// calculate two mostly perpendicular edge directions
- VectorSubtract( v[indexes[i+0]].point, v[indexes[i+1]].point, dir1 );
- VectorSubtract( v[indexes[i+2]].point, v[indexes[i+1]].point, dir2 );
+ VectorSubtract( v[elems[i+0]].point, v[elems[i+1]].point, dir1 );
+ VectorSubtract( v[elems[i+2]].point, v[elems[i+1]].point, dir2 );
// we have two edge directions, we can calculate a third vector from
// them, which is the direction of the surface normal
@@ -116,11 +124,13 @@
}
// sum all triangle normals
- for( i = 0; i < numUniqueVerts; i++ ) {
+ for( i = 0; i < numUniqueVerts; i++ )
+ {
VectorClear( normal );
- for( j = 0, k = 0; j < numIndexes; j += 3, k++ ) {
- if( vertRemap[indexes[j+0]] == i || vertRemap[indexes[j+1]] == i || vertRemap[indexes[j+2]] == i )
+ for( j = 0, k = 0; j < numElems; j += 3, k++ )
+ {
+ if( vertRemap[elems[j+0]] == i || vertRemap[elems[j+1]] == i || vertRemap[elems[j+2]] == i )
VectorAdd( normal, trnormals[k], normal );
}
@@ -140,23 +150,23 @@
*/
void Mod_LoadAliasMD2Model( model_t *mod, model_t *parent, void *buffer )
{
- int i, j, k;
- int version, framesize;
- float skinwidth, skinheight;
- int numverts, numindexes;
- int indremap[MD2_MAX_TRIANGLES*3];
- index_t ptempindex[MD2_MAX_TRIANGLES*3], ptempstindex[MD2_MAX_TRIANGLES*3];
- dmd2_t *pinmodel;
- dstvert_t *pinst;
- dtriangle_t *pintri;
- daliasframe_t *pinframe;
- index_t *poutindex;
- maliasmodel_t *poutmodel;
- maliasmesh_t *poutmesh;
- vec2_t *poutcoord;
- maliasframe_t *poutframe;
- maliasvertex_t *poutvertex;
- maliasskin_t *poutskin;
+ int i, j, k;
+ int version, framesize;
+ float skinwidth, skinheight;
+ int numverts, numelems;
+ int indremap[MD2_MAX_TRIANGLES*3];
+ elem_t ptempelem[MD2_MAX_TRIANGLES*3], ptempstelem[MD2_MAX_TRIANGLES*3];
+ dmd2_t *pinmodel;
+ dstvert_t *pinst;
+ dtriangle_t *pintri;
+ daliasframe_t *pinframe;
+ elem_t *poutelem;
+ maliasmodel_t *poutmodel;
+ maliasmesh_t *poutmesh;
+ vec2_t *poutcoord;
+ maliasframe_t *poutframe;
+ maliasvertex_t *poutvertex;
+ maliasskin_t *poutskin;
pinmodel = ( dmd2_t * )buffer;
version = LittleLong( pinmodel->version );
@@ -164,10 +174,10 @@
if( version != MD2_ALIAS_VERSION )
Com_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
- mod->name, version, MD2_ALIAS_VERSION );
+ mod->name, version, MD2_ALIAS_VERSION );
mod->type = mod_alias;
- mod->aliasmodel = poutmodel = Mod_Malloc( mod, sizeof(maliasmodel_t) );
+ mod->aliasmodel = poutmodel = Mod_Malloc( mod, sizeof( maliasmodel_t ) );
mod->radius = 0;
ClearBounds( mod->mins, mod->maxs );
@@ -196,7 +206,7 @@
poutmodel->tags = NULL;
poutmodel->nummeshes = 1;
- poutmesh = poutmodel->meshes = Mod_Malloc( mod, sizeof(maliasmesh_t) );
+ poutmesh = poutmodel->meshes = Mod_Malloc( mod, sizeof( maliasmesh_t ) );
Q_strncpyz( poutmesh->name, "default", MD3_MAX_PATH );
poutmesh->numverts = LittleLong( pinmodel->num_xyz );
@@ -211,86 +221,97 @@
else if( poutmesh->numtris <= 0 )
Com_Error( ERR_DROP, "model %s has no triangles", mod->name );
- numindexes = poutmesh->numtris * 3;
- poutindex = poutmesh->indexes = Mod_Malloc( mod, numindexes * sizeof(index_t) );
+ numelems = poutmesh->numtris * 3;
+ poutelem = poutmesh->elems = Mod_Malloc( mod, numelems * sizeof( elem_t ) );
-//
-// load triangle lists
-//
+ //
+ // load triangle lists
+ //
pintri = ( dtriangle_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_tris ) );
pinst = ( dstvert_t * ) ( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_st ) );
- for( i = 0, k = 0; i < poutmesh->numtris; i++, k += 3 ) {
- for( j = 0; j < 3; j++ ) {
- ptempindex[k+j] = ( index_t )LittleShort( pintri[i].index_xyz[j] );
- ptempstindex[k+j] = ( index_t )LittleShort( pintri[i].index_st[j] );
+ for( i = 0, k = 0; i < poutmesh->numtris; i++, k += 3 )
+ {
+ for( j = 0; j < 3; j++ )
+ {
+ ptempelem[k+j] = ( elem_t )LittleShort( pintri[i].index_xyz[j] );
+ ptempstelem[k+j] = ( elem_t )LittleShort( pintri[i].index_st[j] );
}
}
-//
-// build list of unique vertexes
-//
+ //
+ // build list of unique vertexes
+ //
numverts = 0;
- memset( indremap, -1, MD2_MAX_TRIANGLES * 3 * sizeof(int) );
+ memset( indremap, -1, MD2_MAX_TRIANGLES * 3 * sizeof( int ) );
- for( i = 0; i < numindexes; i++ ) {
+ for( i = 0; i < numelems; i++ )
+ {
if( indremap[i] != -1 )
continue;
// remap duplicates
- for( j = i + 1; j < numindexes; j++ ) {
- if( (ptempindex[j] == ptempindex[i])
- && (pinst[ptempstindex[j]].s == pinst[ptempstindex[i]].s)
- && (pinst[ptempstindex[j]].t == pinst[ptempstindex[i]].t) ) {
+ for( j = i + 1; j < numelems; j++ )
+ {
+ if( ( ptempelem[j] == ptempelem[i] )
+ && ( pinst[ptempstelem[j]].s == pinst[ptempstelem[i]].s )
+ && ( pinst[ptempstelem[j]].t == pinst[ptempstelem[i]].t ) )
+ {
indremap[j] = i;
- poutindex[j] = numverts;
+ poutelem[j] = numverts;
}
}
// add unique vertex
indremap[i] = i;
- poutindex[i] = numverts++;
+ poutelem[i] = numverts++;
}
Com_DPrintf( "%s: remapped %i verts to %i (%i tris)\n", mod->name, poutmesh->numverts, numverts, poutmesh->numtris );
poutmesh->numverts = numverts;
-//
-// load base s and t vertices
-//
- poutcoord = poutmesh->stArray = Mod_Malloc( mod, numverts * sizeof(vec2_t) );
+ //
+ // load base s and t vertices
+ //
+ poutcoord = poutmesh->stArray = Mod_Malloc( mod, numverts * sizeof( vec2_t ) );
- for( i = 0; i < numindexes; i++ ) {
- if( indremap[i] == i ) {
- poutcoord[poutindex[i]][0] = ((float)LittleShort( pinst[ptempstindex[i]].s ) + 0.5) / skinwidth;
- poutcoord[poutindex[i]][1] = ((float)LittleShort( pinst[ptempstindex[i]].t ) + 0.5) / skinheight;
+ for( i = 0; i < numelems; i++ )
+ {
+ if( indremap[i] == i )
+ {
+ poutcoord[poutelem[i]][0] = ( (float)LittleShort( pinst[ptempstelem[i]].s ) + 0.5 ) / skinwidth;
+ poutcoord[poutelem[i]][1] = ( (float)LittleShort( pinst[ptempstelem[i]].t ) + 0.5 ) / skinheight;
}
}
-//
-// load the frames
-//
- poutframe = poutmodel->frames = Mod_Malloc( mod, poutmodel->numframes * (sizeof(maliasframe_t) + numverts * sizeof(maliasvertex_t)) );
- poutvertex = poutmesh->vertexes = ( maliasvertex_t *)(( qbyte * )poutframe + poutmodel->numframes * sizeof(maliasframe_t));
+ //
+ // load the frames
+ //
+ poutframe = poutmodel->frames = Mod_Malloc( mod, poutmodel->numframes * ( sizeof( maliasframe_t ) + numverts * sizeof( maliasvertex_t ) ) );
+ poutvertex = poutmesh->vertexes = ( maliasvertex_t *)( ( qbyte * )poutframe + poutmodel->numframes * sizeof( maliasframe_t ) );
- for( i = 0; i < poutmodel->numframes; i++, poutframe++, poutvertex += numverts ) {
+ for( i = 0; i < poutmodel->numframes; i++, poutframe++, poutvertex += numverts )
+ {
pinframe = ( daliasframe_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_frames ) + i * framesize );
- for( j = 0; j < 3; j++ ) {
+ for( j = 0; j < 3; j++ )
+ {
poutframe->scale[j] = LittleFloat( pinframe->scale[j] );
poutframe->translate[j] = LittleFloat( pinframe->translate[j] );
}
- for( j = 0; j < numindexes; j++ ) { // verts are all 8 bit, so no swapping needed
- if( indremap[j] == j ) {
- poutvertex[poutindex[j]].point[0] = (short)pinframe->verts[ptempindex[j]].v[0];
- poutvertex[poutindex[j]].point[1] = (short)pinframe->verts[ptempindex[j]].v[1];
- poutvertex[poutindex[j]].point[2] = (short)pinframe->verts[ptempindex[j]].v[2];
+ for( j = 0; j < numelems; j++ )
+ { // verts are all 8 bit, so no swapping needed
+ if( indremap[j] == j )
+ {
+ poutvertex[poutelem[j]].point[0] = (short)pinframe->verts[ptempelem[j]].v[0];
+ poutvertex[poutelem[j]].point[1] = (short)pinframe->verts[ptempelem[j]].v[1];
+ poutvertex[poutelem[j]].point[2] = (short)pinframe->verts[ptempelem[j]].v[2];
}
}
- Mod_AliasCalculateVertexNormals( numindexes, poutindex, numverts, poutvertex );
+ Mod_AliasCalculateVertexNormals( numelems, poutelem, numverts, poutvertex );
VectorCopy( poutframe->translate, poutframe->mins );
VectorMA( poutframe->translate, 255, poutframe->scale, poutframe->maxs );
@@ -301,16 +322,17 @@
AddPointToBounds( poutframe->maxs, mod->mins, mod->maxs );
}
-//
-// build S and T vectors for frame 0
-//
+ //
+ // build S and T vectors for frame 0
+ //
Mod_AliasBuildMeshesForFrame0( mod );
// register all skins
- poutskin = poutmodel->skins = Mod_Malloc( mod, poutmodel->numskins * sizeof(maliasskin_t) );
+ poutskin = poutmodel->skins = Mod_Malloc( mod, poutmodel->numskins * sizeof( maliasskin_t ) );
- for( i = 0; i < poutmodel->numskins; i++, poutskin++ ) {
+ for( i = 0; i < poutmodel->numskins; i++, poutskin++ )
+ {
if( LittleLong( pinmodel->ofs_skins ) == -1 )
continue;
poutskin->shader = R_RegisterSkin( ( char * )pinmodel + LittleLong( pinmodel->ofs_skins ) + i*MD2_MAX_SKINNAME );
@@ -334,35 +356,35 @@
*/
void Mod_LoadAliasMD3Model( model_t *mod, model_t *parent, void *buffer )
{
- int version, i, j, l;
- int bufsize, numverts;
- qbyte *buf;
- dmd3header_t *pinmodel;
- dmd3frame_t *pinframe;
- dmd3tag_t *pintag;
- dmd3mesh_t *pinmesh;
- dmd3skin_t *pinskin;
- dmd3coord_t *pincoord;
- dmd3vertex_t *pinvert;
- index_t *pinindex, *poutindex;
- maliasvertex_t *poutvert;
- vec2_t *poutcoord;
- maliasskin_t *poutskin;
- maliasmesh_t *poutmesh;
- maliastag_t *pouttag;
- maliasframe_t *poutframe;
- maliasmodel_t *poutmodel;
- vec3_t ebbox = { 0, 0, 0 };
+ int version, i, j, l;
+ int bufsize, numverts;
+ qbyte *buf;
+ dmd3header_t *pinmodel;
+ dmd3frame_t *pinframe;
+ dmd3tag_t *pintag;
+ dmd3mesh_t *pinmesh;
+ dmd3skin_t *pinskin;
+ dmd3coord_t *pincoord;
+ dmd3vertex_t *pinvert;
+ elem_t *pinelem, *poutelem;
+ maliasvertex_t *poutvert;
+ vec2_t *poutcoord;
+ maliasskin_t *poutskin;
+ maliasmesh_t *poutmesh;
+ maliastag_t *pouttag;
+ maliasframe_t *poutframe;
+ maliasmodel_t *poutmodel;
+ vec3_t ebbox = { 0, 0, 0 };
pinmodel = ( dmd3header_t * )buffer;
version = LittleLong( pinmodel->version );
- if ( version != MD3_ALIAS_VERSION )
+ if( version != MD3_ALIAS_VERSION )
Com_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
- mod->name, version, MD3_ALIAS_VERSION );
+ mod->name, version, MD3_ALIAS_VERSION );
mod->type = mod_alias;
- mod->extradata = poutmodel = Mod_Malloc( mod, sizeof(maliasmodel_t) );
+ mod->extradata = poutmodel = Mod_Malloc( mod, sizeof( maliasmodel_t ) );
mod->radius = 0;
ClearBounds( mod->mins, mod->maxs );
@@ -374,8 +396,8 @@
if( poutmodel->numframes <= 0 )
Com_Error( ERR_DROP, "model %s has no frames", mod->name );
-// else if( poutmodel->numframes > MD3_MAX_FRAMES )
-// Com_Error( ERR_DROP, "model %s has too many frames", mod->name );
+ // else if( poutmodel->numframes > MD3_MAX_FRAMES )
+ // Com_Error( ERR_DROP, "model %s has too many frames", mod->name );
if( poutmodel->numtags > MD3_MAX_TAGS )
Com_Error( ERR_DROP, "model %s has too many tags", mod->name );
@@ -386,20 +408,22 @@
Com_Error( ERR_DROP, "model %s has invalid number of meshes", mod->name );
else if( !poutmodel->nummeshes && !poutmodel->numtags )
Com_Error( ERR_DROP, "model %s has no meshes and no tags", mod->name );
-// else if( poutmodel->nummeshes > MD3_MAX_MESHES )
-// Com_Error( ERR_DROP, "model %s has too many meshes", mod->name );
+ // else if( poutmodel->nummeshes > MD3_MAX_MESHES )
+ // Com_Error( ERR_DROP, "model %s has too many meshes", mod->name );
- bufsize = poutmodel->numframes * (sizeof( maliasframe_t ) + sizeof( maliastag_t ) * poutmodel->numtags) +
+ bufsize = poutmodel->numframes * ( sizeof( maliasframe_t ) + sizeof( maliastag_t ) * poutmodel->numtags ) +
poutmodel->nummeshes * sizeof( maliasmesh_t );
buf = Mod_Malloc( mod, bufsize );
-//
-// load the frames
-//
+ //
+ // load the frames
+ //
pinframe = ( dmd3frame_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_frames ) );
poutframe = poutmodel->frames = ( maliasframe_t * )buf; buf += sizeof( maliasframe_t ) * poutmodel->numframes;
- for( i = 0; i < poutmodel->numframes; i++, pinframe++, poutframe++ ) {
- for( j = 0; j < 3; j++ ) {
+ for( i = 0; i < poutmodel->numframes; i++, pinframe++, poutframe++ )
+ {
+ for( j = 0; j < 3; j++ )
+ {
poutframe->scale[j] = MD3_XYZ_SCALE;
poutframe->translate[j] = LittleFloat( pinframe->translate[j] );
}
@@ -407,17 +431,20 @@
// never trust the modeler utility and recalculate bbox and radius
ClearBounds( poutframe->mins, poutframe->maxs );
}
-
-//
-// load the tags
-//
+
+ //
+ // load the tags
+ //
pintag = ( dmd3tag_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_tags ) );
pouttag = poutmodel->tags = ( maliastag_t * )buf; buf += sizeof( maliastag_t ) * poutmodel->numframes * poutmodel->numtags;
- for( i = 0; i < poutmodel->numframes; i++ ) {
- for( l = 0; l < poutmodel->numtags; l++, pintag++, pouttag++ ) {
+ for( i = 0; i < poutmodel->numframes; i++ )
+ {
+ for( l = 0; l < poutmodel->numtags; l++, pintag++, pouttag++ )
+ {
vec3_t axis[3];
- for ( j = 0; j < 3; j++ ) {
+ for( j = 0; j < 3; j++ )
+ {
axis[0][j] = LittleFloat( pintag->axis[0][j] );
axis[1][j] = LittleFloat( pintag->axis[1][j] );
axis[2][j] = LittleFloat( pintag->axis[2][j] );
@@ -431,15 +458,16 @@
}
}
-//
-// load the meshes
-//
+ //
+ // load the meshes
+ //
pinmesh = ( dmd3mesh_t * )( ( qbyte * )pinmodel + LittleLong( pinmodel->ofs_meshes ) );
poutmesh = poutmodel->meshes = ( maliasmesh_t * )buf;
- for( i = 0; i < poutmodel->nummeshes; i++, poutmesh++ ) {
- if( strncmp( (const char *)pinmesh->id, IDMD3HEADER, 4) )
+ for( i = 0; i < poutmodel->nummeshes; i++, poutmesh++ )
+ {
+ if( strncmp( (const char *)pinmesh->id, IDMD3HEADER, 4 ) )
Com_Error( ERR_DROP, "mesh %s in model %s has wrong id (%s should be %s)",
- pinmesh->name, mod->name, pinmesh->id, IDMD3HEADER );
+ pinmesh->name, mod->name, pinmesh->id, IDMD3HEADER );
Q_strncpyz( poutmesh->name, pinmesh->name, MD3_MAX_PATH );
@@ -449,8 +477,8 @@
poutmesh->numskins = LittleLong( pinmesh->num_skins );
poutmesh->numverts = numverts = LittleLong( pinmesh->num_verts );
-/* if( poutmesh->numskins <= 0 )
- Com_Error( ERR_DROP, "mesh %i in model %s has no skins", i, mod->name );
+ /* if( poutmesh->numskins <= 0 )
+ Com_Error( ERR_DROP, "mesh %i in model %s has no skins", i, mod->name );
else*/ if( poutmesh->numskins > MD3_MAX_SHADERS )
Com_Error( ERR_DROP, "mesh %i in model %s has too many skins", i, mod->name );
if( poutmesh->numtris <= 0 )
@@ -462,50 +490,55 @@
else if( poutmesh->numverts > MD3_MAX_VERTS )
Com_Error( ERR_DROP, "mesh %i in model %s has too many vertices", i, mod->name );
- bufsize = sizeof(maliasskin_t) * poutmesh->numskins + poutmesh->numtris * sizeof(index_t) * 3 +
- numverts * (sizeof(vec2_t) + sizeof(maliasvertex_t) * poutmodel->numframes);
+ bufsize = sizeof( maliasskin_t ) * poutmesh->numskins + poutmesh->numtris * sizeof( elem_t ) * 3 +
+ numverts * ( sizeof( vec2_t ) + sizeof( maliasvertex_t ) * poutmodel->numframes );
buf = Mod_Malloc( mod, bufsize );
- //
- // load the skins
- //
+ //
+ // load the skins
+ //
pinskin = ( dmd3skin_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_skins ) );
- poutskin = poutmesh->skins = ( maliasskin_t * )buf; buf += sizeof(maliasskin_t) * poutmesh->numskins;
- for( j = 0; j < poutmesh->numskins; j++, pinskin++, poutskin++ ) {
+ poutskin = poutmesh->skins = ( maliasskin_t * )buf; buf += sizeof( maliasskin_t ) * poutmesh->numskins;
+ for( j = 0; j < poutmesh->numskins; j++, pinskin++, poutskin++ )
+ {
poutskin->shader = R_RegisterSkin( pinskin->name );
R_DeformvBBoxForShader( poutskin->shader, ebbox );
}
- //
- // load the indexes
- //
- pinindex = ( index_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_indexes ) );
- poutindex = poutmesh->indexes = ( index_t * )buf; buf += poutmesh->numtris * sizeof(index_t) * 3;
- for( j = 0; j < poutmesh->numtris; j++, pinindex += 3, poutindex += 3 ) {
- poutindex[0] = (index_t)LittleLong( pinindex[0] );
- poutindex[1] = (index_t)LittleLong( pinindex[1] );
- poutindex[2] = (index_t)LittleLong( pinindex[2] );
+ //
+ // load the elems
+ //
+ pinelem = ( elem_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_elems ) );
+ poutelem = poutmesh->elems = ( elem_t * )buf; buf += poutmesh->numtris * sizeof( elem_t ) * 3;
+ for( j = 0; j < poutmesh->numtris; j++, pinelem += 3, poutelem += 3 )
+ {
+ poutelem[0] = (elem_t)LittleLong( pinelem[0] );
+ poutelem[1] = (elem_t)LittleLong( pinelem[1] );
+ poutelem[2] = (elem_t)LittleLong( pinelem[2] );
}
- //
- // load the texture coordinates
- //
+ //
+ // load the texture coordinates
+ //
pincoord = ( dmd3coord_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_tcs ) );
- poutcoord = poutmesh->stArray = ( vec2_t * )buf; buf += poutmesh->numverts * sizeof(vec2_t);
- for( j = 0; j < poutmesh->numverts; j++, pincoord++ ) {
+ poutcoord = poutmesh->stArray = ( vec2_t * )buf; buf += poutmesh->numverts * sizeof( vec2_t );
+ for( j = 0; j < poutmesh->numverts; j++, pincoord++ )
+ {
poutcoord[j][0] = LittleFloat( pincoord->st[0] );
poutcoord[j][1] = LittleFloat( pincoord->st[1] );
}
- //
- // load the vertexes and normals
- //
+ //
+ // load the vertexes and normals
+ //
pinvert = ( dmd3vertex_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->ofs_verts ) );
poutvert = poutmesh->vertexes = ( maliasvertex_t * )buf;
- for( l = 0, poutframe = poutmodel->frames; l < poutmodel->numframes; l++, poutframe++, pinvert += poutmesh->numverts, poutvert += poutmesh->numverts ) {
+ for( l = 0, poutframe = poutmodel->frames; l < poutmodel->numframes; l++, poutframe++, pinvert += poutmesh->numverts, poutvert += poutmesh->numverts )
+ {
vec3_t v;
- for( j = 0; j < poutmesh->numverts; j++ ) {
+ for( j = 0; j < poutmesh->numverts; j++ )
+ {
poutvert[j].point[0] = LittleShort( pinvert[j].point[0] );
poutvert[j].point[1] = LittleShort( pinvert[j].point[1] );
poutvert[j].point[2] = LittleShort( pinvert[j].point[2] );
@@ -521,16 +554,17 @@
pinmesh = ( dmd3mesh_t * )( ( qbyte * )pinmesh + LittleLong( pinmesh->meshsize ) );
}
-//
-// build S and T vectors for frame 0
-//
+ //
+ // build S and T vectors for frame 0
+ //
Mod_AliasBuildMeshesForFrame0( mod );
-//
-// calculate model bounds
-//
+ //
+ // calculate model bounds
+ //
poutframe = poutmodel->frames;
- for( i = 0; i < poutmodel->numframes; i++, poutframe++ ) {
+ for( i = 0; i < poutmodel->numframes; i++, poutframe++ )
+ {
VectorMA( poutframe->translate, MD3_XYZ_SCALE, poutframe->mins, poutframe->mins );
VectorMA( poutframe->translate, MD3_XYZ_SCALE, poutframe->maxs, poutframe->maxs );
VectorSubtract( poutframe->mins, ebbox, poutframe->mins );
@@ -553,20 +587,20 @@
int lod;
float dist;
- if( !e->model->numlods || (e->flags & RF_FORCENOLOD) )
+ if( !e->model->numlods || ( e->flags & RF_FORCENOLOD ) )
return e->model;
dist = DistanceFast( e->origin, ri.viewOrigin );
dist *= ri.lod_dist_scale_for_fov;
- lod = (int)(dist / e->model->radius);
- if (r_lodscale->integer)
+ lod = (int)( dist / e->model->radius );
+ if( r_lodscale->integer )
lod /= r_lodscale->integer;
lod += r_lodbias->integer;
if( lod < 1 )
return e->model;
- return e->model->lods[min(lod, e->model->numlods)-1];
+ return e->model->lods[min( lod, e->model->numlods )-1];
}
/*
@@ -576,25 +610,30 @@
*/
static void R_AliasModelLerpBBox( entity_t *e, model_t *mod )
{
- int i;
- maliasmodel_t *aliasmodel = ( maliasmodel_t * )mod->extradata;
- maliasframe_t *pframe, *poldframe;
- float *thismins, *oldmins, *thismaxs, *oldmaxs;
+ int...
[truncated message content] |