aboutsummaryrefslogtreecommitdiffstats
path: root/code/renderer
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-07-05 23:50:38 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-07-05 23:50:38 +0000
commit37d631212417d0e40f71fcad2c2a1df907165aa0 (patch)
tree294e302c0f6878125981ddd569608339548fc63b /code/renderer
parent30a59a88ffc64710e1974fb3c93461a6f40a10e7 (diff)
downloadioquake3-aero-37d631212417d0e40f71fcad2c2a1df907165aa0.tar.gz
ioquake3-aero-37d631212417d0e40f71fcad2c2a1df907165aa0.zip
* (bug 3610) Server sending unnecessary newline with SV_ConSay_F (Tyler Schwend
<TylerSchwend@gmail.com>) * (bug 3623) COMMAND is mapped to the ALT key (Matthias <Kapffer@macbay.de>) * (bug 3665) Typo error in FS_FOpenFileByMode function (TsT <tst2006@gmail.com>) * (bug 3669) Some files left out of Solaris Packages (Vincent Cojot <vincent@cojot.name>) * (bug 3680) server quit messages (Ben Millwood) * (bug 3682) Maps with >1024 models cause a segfault (misantropia <bnoordhuis@gmail.com>) * (bug 3683) R_FindShader(): negative lightmap indexes cause stray pointers (misantropia <bnoordhuis@gmail.com>) * (bug 3688) q3asm potential segfault fix and other changes (TsT <tst2006@gmail.com>) * (bug 3695) Not allowing to write file with lib extention (.dll/.so/...) (TsT <tst2006@gmail.com>) * (bug 3696) make-macosx-ub.sh outdated by revision 1340; test for Tiger not working (Matthias <Kapffer@macbay.de>) * (bug 3698) #error reported as warning in q3cpp (and no #warning support) (Ben Millwood) * (bug 3703) restoring the valued pre-SDL window behaviour (/dev/humancontroller <devhc97@gmail.com>) git-svn-id: svn://svn.icculus.org/quake3/trunk@1405 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/renderer')
-rw-r--r--code/renderer/tr_bsp.c3
-rw-r--r--code/renderer/tr_local.h10
-rw-r--r--code/renderer/tr_shader.c7
3 files changed, 14 insertions, 6 deletions
diff --git a/code/renderer/tr_bsp.c b/code/renderer/tr_bsp.c
index c340e13..72e88f3 100644
--- a/code/renderer/tr_bsp.c
+++ b/code/renderer/tr_bsp.c
@@ -1321,6 +1321,9 @@ static void R_LoadSubmodels( lump_t *l ) {
model = R_AllocModel();
assert( model != NULL ); // this should never happen
+ if ( model == NULL ) {
+ ri.Error(ERR_DROP, "R_LoadSubmodels: R_AllocModel() failed");
+ }
model->type = MOD_BRUSH;
model->bmodel = out;
diff --git a/code/renderer/tr_local.h b/code/renderer/tr_local.h
index 52a9e37..0da894e 100644
--- a/code/renderer/tr_local.h
+++ b/code/renderer/tr_local.h
@@ -322,10 +322,12 @@ typedef struct {
struct shaderCommands_s;
-#define LIGHTMAP_2D -4 // shader is for 2D rendering
-#define LIGHTMAP_BY_VERTEX -3 // pre-lit triangle models
-#define LIGHTMAP_WHITEIMAGE -2
-#define LIGHTMAP_NONE -1
+// any change in the LIGHTMAP_* defines here MUST be reflected in
+// R_FindShader() in tr_bsp.c
+#define LIGHTMAP_2D -4 // shader is for 2D rendering
+#define LIGHTMAP_BY_VERTEX -3 // pre-lit triangle models
+#define LIGHTMAP_WHITEIMAGE -2
+#define LIGHTMAP_NONE -1
typedef enum {
CT_FRONT_SIDED,
diff --git a/code/renderer/tr_shader.c b/code/renderer/tr_shader.c
index a714873..7a44d35 100644
--- a/code/renderer/tr_shader.c
+++ b/code/renderer/tr_shader.c
@@ -1432,7 +1432,6 @@ static qboolean ParseShader( char **text )
// stage definition
else if ( token[0] == '{' )
{
- // 20051019 misantropia -- fix buffer overrun.
if ( s >= MAX_SHADER_STAGES ) {
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s\n", shader.name );
return qfalse;
@@ -2447,6 +2446,10 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
// lightmaps
if ( lightmapIndex >= 0 && lightmapIndex >= tr.numLightmaps ) {
lightmapIndex = LIGHTMAP_BY_VERTEX;
+ } else if ( lightmapIndex < LIGHTMAP_2D ) {
+ // negative lightmap indexes cause stray pointers (think tr.lightmaps[lightmapIndex])
+ ri.Printf( PRINT_WARNING, "WARNING: shader '%s' has invalid lightmap index of %d\n", name, lightmapIndex );
+ lightmapIndex = LIGHTMAP_BY_VERTEX;
}
COM_StripExtension(name, strippedName, sizeof(strippedName));
@@ -2581,7 +2584,7 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_
hash = generateHashValue(name, FILE_HASH_SIZE);
- // 20051020 misantropia -- probably not necessary since this function
+ // probably not necessary since this function
// only gets called from tr_font.c with lightmapIndex == LIGHTMAP_2D
// but better safe than sorry.
if ( lightmapIndex >= tr.numLightmaps ) {