]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
rewrite of map texture loading (mainly to do with HL textures and wads)
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 4 Mar 2001 01:04:38 +0000 (01:04 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 4 Mar 2001 01:04:38 +0000 (01:04 +0000)
and all FALSE and TRUE changed to false and true

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@177 d7cf8633-e32d-0410-b094-e92efae38249

16 files changed:
cl_parse.c
conproc.c
gl_rmain.c
gl_rmisc.c
gl_warp.c
image.c
in_win.c
model_brush.c
net_wins.c
pr_cmds.c
r_part.c
sv_main.c
sys_win.c
vid_wgl.c
wad.c
wad.h

index c086496fec8679466df8a67a18e5fcf39191c8a6..0d776abff948e84593a95c23b6ee3daa19e4a44a 100644 (file)
@@ -226,7 +226,7 @@ extern cvar_t r_farclip;
 void CL_ParseEntityLump(char *entdata)
 {
        char *data;
 void CL_ParseEntityLump(char *entdata)
 {
        char *data;
-       char key[128], value[1024];
+       char key[128], value[4096];
        char wadname[128];
        int i, j, k;
        FOG_clear(); // LordHavoc: no fog until set
        char wadname[128];
        int i, j, k;
        FOG_clear(); // LordHavoc: no fog until set
@@ -282,12 +282,12 @@ void CL_ParseEntityLump(char *entdata)
                else if (!strcmp("wad", key)) // for HalfLife maps
                {
                        j = 0;
                else if (!strcmp("wad", key)) // for HalfLife maps
                {
                        j = 0;
-                       for (i = 0;i < 128;i++)
+                       for (i = 0;i < 4096;i++)
                                if (value[i] != ';' && value[i] != '\\' && value[i] != '/' && value[i] != ':')
                                        break;
                        if (value[i])
                        {
                                if (value[i] != ';' && value[i] != '\\' && value[i] != '/' && value[i] != ':')
                                        break;
                        if (value[i])
                        {
-                               for (;i < 128;i++)
+                               for (;i < 4096;i++)
                                {
                                        // ignore path - the \\ check is for HalfLife... stupid windoze 'programmers'...
                                        if (value[i] == '\\' || value[i] == '/' || value[i] == ':')
                                {
                                        // ignore path - the \\ check is for HalfLife... stupid windoze 'programmers'...
                                        if (value[i] == '\\' || value[i] == '/' || value[i] == ':')
@@ -298,7 +298,7 @@ void CL_ParseEntityLump(char *entdata)
                                                value[i] = 0;
                                                strcpy(wadname, "textures/");
                                                strcat(wadname, &value[j]);
                                                value[i] = 0;
                                                strcpy(wadname, "textures/");
                                                strcat(wadname, &value[j]);
-                                               W_LoadTextureWadFile (wadname, FALSE);
+                                               W_LoadTextureWadFile (wadname, false);
                                                j = i+1;
                                                if (!k)
                                                        break;
                                                j = i+1;
                                                if (!k)
                                                        break;
index 38e031bd7b68333cd66d31fe050765cd91abe8c6..560be1f12f1b7e42b831f318bfd20e75f9c12a17 100644 (file)
--- a/conproc.c
+++ b/conproc.c
@@ -54,7 +54,7 @@ void InitConProc (HANDLE hFile, HANDLE heventParent, HANDLE heventChild)
        heventChildSend = heventChild;
 
 // so we'll know when to go away.
        heventChildSend = heventChild;
 
 // so we'll know when to go away.
-       heventDone = CreateEvent (NULL, FALSE, FALSE, NULL);
+       heventDone = CreateEvent (NULL, false, false, NULL);
 
        if (!heventDone)
        {
 
        if (!heventDone)
        {
@@ -102,7 +102,7 @@ DWORD RequestProc (DWORD dwNichts)
 
        while (1)
        {
 
        while (1)
        {
-               dwRet = WaitForMultipleObjects (2, heventWait, FALSE, INFINITE);
+               dwRet = WaitForMultipleObjects (2, heventWait, false, INFINITE);
 
        // heventDone fired, so we're exiting.
                if (dwRet == WAIT_OBJECT_0 + 1) 
 
        // heventDone fired, so we're exiting.
                if (dwRet == WAIT_OBJECT_0 + 1) 
@@ -231,7 +231,7 @@ BOOL WriteText (LPCTSTR szText)
                upper = toupper(*sz);
 
                rec.EventType = KEY_EVENT;
                upper = toupper(*sz);
 
                rec.EventType = KEY_EVENT;
-               rec.Event.KeyEvent.bKeyDown = TRUE;
+               rec.Event.KeyEvent.bKeyDown = true;
                rec.Event.KeyEvent.wRepeatCount = 1;
                rec.Event.KeyEvent.wVirtualKeyCode = upper;
                rec.Event.KeyEvent.wVirtualScanCode = CharToCode (*sz);
                rec.Event.KeyEvent.wRepeatCount = 1;
                rec.Event.KeyEvent.wVirtualKeyCode = upper;
                rec.Event.KeyEvent.wVirtualScanCode = CharToCode (*sz);
@@ -245,7 +245,7 @@ BOOL WriteText (LPCTSTR szText)
                        1,
                        &dwWritten);
 
                        1,
                        &dwWritten);
 
-               rec.Event.KeyEvent.bKeyDown = FALSE;
+               rec.Event.KeyEvent.bKeyDown = false;
 
                WriteConsoleInput(
                        hStdin,
 
                WriteConsoleInput(
                        hStdin,
@@ -256,7 +256,7 @@ BOOL WriteText (LPCTSTR szText)
                sz++;
        }
 
                sz++;
        }
 
-       return TRUE;
+       return true;
 }
 
 
 }
 
 
@@ -299,7 +299,7 @@ BOOL SetConsoleCXCY(HANDLE hStdout, int cx, int cy)
                cx = coordMax.X;
  
        if (!GetConsoleScreenBufferInfo(hStdout, &info))
                cx = coordMax.X;
  
        if (!GetConsoleScreenBufferInfo(hStdout, &info))
-               return FALSE;
+               return false;
  
 // height
     info.srWindow.Left = 0;         
  
 // height
     info.srWindow.Left = 0;         
@@ -309,27 +309,27 @@ BOOL SetConsoleCXCY(HANDLE hStdout, int cx, int cy)
  
        if (cy < info.dwSize.Y)
        {
  
        if (cy < info.dwSize.Y)
        {
-               if (!SetConsoleWindowInfo(hStdout, TRUE, &info.srWindow))
-                       return FALSE;
+               if (!SetConsoleWindowInfo(hStdout, true, &info.srWindow))
+                       return false;
  
                info.dwSize.Y = cy;
  
                if (!SetConsoleScreenBufferSize(hStdout, info.dwSize))
  
                info.dwSize.Y = cy;
  
                if (!SetConsoleScreenBufferSize(hStdout, info.dwSize))
-                       return FALSE;
+                       return false;
     }
     else if (cy > info.dwSize.Y)
     {
                info.dwSize.Y = cy;
  
                if (!SetConsoleScreenBufferSize(hStdout, info.dwSize))
     }
     else if (cy > info.dwSize.Y)
     {
                info.dwSize.Y = cy;
  
                if (!SetConsoleScreenBufferSize(hStdout, info.dwSize))
-                       return FALSE;
+                       return false;
  
  
-               if (!SetConsoleWindowInfo(hStdout, TRUE, &info.srWindow))
-                       return FALSE;
+               if (!SetConsoleWindowInfo(hStdout, true, &info.srWindow))
+                       return false;
     }
  
        if (!GetConsoleScreenBufferInfo(hStdout, &info))
     }
  
        if (!GetConsoleScreenBufferInfo(hStdout, &info))
-               return FALSE;
+               return false;
  
 // width
        info.srWindow.Left = 0;         
  
 // width
        info.srWindow.Left = 0;         
@@ -339,25 +339,25 @@ BOOL SetConsoleCXCY(HANDLE hStdout, int cx, int cy)
  
        if (cx < info.dwSize.X)
        {
  
        if (cx < info.dwSize.X)
        {
-               if (!SetConsoleWindowInfo(hStdout, TRUE, &info.srWindow))
-                       return FALSE;
+               if (!SetConsoleWindowInfo(hStdout, true, &info.srWindow))
+                       return false;
  
                info.dwSize.X = cx;
     
                if (!SetConsoleScreenBufferSize(hStdout, info.dwSize))
  
                info.dwSize.X = cx;
     
                if (!SetConsoleScreenBufferSize(hStdout, info.dwSize))
-                       return FALSE;
+                       return false;
        }
        else if (cx > info.dwSize.X)
        {
                info.dwSize.X = cx;
  
                if (!SetConsoleScreenBufferSize(hStdout, info.dwSize))
        }
        else if (cx > info.dwSize.X)
        {
                info.dwSize.X = cx;
  
                if (!SetConsoleScreenBufferSize(hStdout, info.dwSize))
-                       return FALSE;
+                       return false;
  
  
-               if (!SetConsoleWindowInfo(hStdout, TRUE, &info.srWindow))
-                       return FALSE;
+               if (!SetConsoleWindowInfo(hStdout, true, &info.srWindow))
+                       return false;
        }
  
        }
  
-       return TRUE;
+       return true;
 }
      
 }
      
index 24a08cdbaa36c736b1d60aed628bdf83aa12be15..11a1c481cc255973d7946c656d628386afbb506d 100644 (file)
@@ -80,9 +80,9 @@ cvar_t        r_novis = {"r_novis","0"};
 cvar_t r_waterripple = {"r_waterripple","0"};
 cvar_t r_fullbrights = {"r_fullbrights", "1"};
 
 cvar_t r_waterripple = {"r_waterripple","0"};
 cvar_t r_fullbrights = {"r_fullbrights", "1"};
 
-cvar_t contrast = {"contrast", "1.0", TRUE}; // LordHavoc: a method of operating system independent color correction
-cvar_t brightness = {"brightness", "1.0", TRUE}; // LordHavoc: a method of operating system independent color correction
-cvar_t gl_lightmode = {"gl_lightmode", "1", TRUE}; // LordHavoc: overbright lighting
+cvar_t contrast = {"contrast", "1.0", true}; // LordHavoc: a method of operating system independent color correction
+cvar_t brightness = {"brightness", "1.0", true}; // LordHavoc: a method of operating system independent color correction
+cvar_t gl_lightmode = {"gl_lightmode", "1", true}; // LordHavoc: overbright lighting
 //cvar_t       r_dynamicbothsides = {"r_dynamicbothsides", "1"}; // LordHavoc: can disable dynamic lighting of backfaces, but quake maps are weird so it doesn't always work right...
 cvar_t r_farclip = {"r_farclip", "6144"};
 
 //cvar_t       r_dynamicbothsides = {"r_dynamicbothsides", "1"}; // LordHavoc: can disable dynamic lighting of backfaces, but quake maps are weird so it doesn't always work right...
 cvar_t r_farclip = {"r_farclip", "6144"};
 
@@ -413,7 +413,7 @@ void R_DrawViewModel (void)
 
        // hack the depth range to prevent view model from poking into walls
        glDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
 
        // hack the depth range to prevent view model from poking into walls
        glDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
-       R_DrawAliasModel (currententity, FALSE, modelalpha, currententity->model, currententity->frame, currententity->skinnum, currententity->origin, currententity->angles, currententity->effects, currententity->model->flags, currententity->colormap);
+       R_DrawAliasModel (currententity, false, modelalpha, currententity->model, currententity->frame, currententity->skinnum, currententity->origin, currententity->angles, currententity->effects, currententity->model->flags, currententity->colormap);
        glDepthRange (gldepthmin, gldepthmax);
 }
 
        glDepthRange (gldepthmin, gldepthmax);
 }
 
index 2a07083b6fdd72fc7be58420d190345b35491137..c5c367d6a9e602220b9c60ea23fa1dc44748f78e 100644 (file)
@@ -41,7 +41,7 @@ void  R_InitTextures (void)
        r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16*16;
        r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8*8;
        r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4*4;
        r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16*16;
        r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8*8;
        r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4*4;
-       r_notexture_mip->transparent = FALSE;
+       r_notexture_mip->transparent = false;
        
        for (m=0 ; m<4 ; m++)
        {
        
        for (m=0 ; m<4 ; m++)
        {
index 8f35afba4df63e3d9f474ebd6483537d2fca09ac..5b37779c65f60a020fafcc3bac95f7af26213a7d 100644 (file)
--- a/gl_warp.c
+++ b/gl_warp.c
@@ -202,10 +202,10 @@ void R_LoadSkyBox (void)
        for (i=0 ; i<6 ; i++)
        {
                sprintf (name, "env/%s%s", skyname, suf[i]);
        for (i=0 ; i<6 ; i++)
        {
                sprintf (name, "env/%s%s", skyname, suf[i]);
-               if (!(image_rgba = loadimagepixels(name, FALSE, 0, 0)))
+               if (!(image_rgba = loadimagepixels(name, false, 0, 0)))
                {
                        sprintf (name, "gfx/env/%s%s", skyname, suf[i]);
                {
                        sprintf (name, "gfx/env/%s%s", skyname, suf[i]);
-                       if (!(image_rgba = loadimagepixels(name, FALSE, 0, 0)))
+                       if (!(image_rgba = loadimagepixels(name, false, 0, 0)))
                        {
                                Con_Printf ("Couldn't load %s\n", name);
                                continue;
                        {
                                Con_Printf ("Couldn't load %s\n", name);
                                continue;
diff --git a/image.c b/image.c
index d12ed7123b58572197d17e6a757787e95a0180bd..622ff52687276523088be08e3863975d7480a6e1 100644 (file)
--- a/image.c
+++ b/image.c
@@ -428,7 +428,7 @@ byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int ma
 {
        FILE    *f;
        char    basename[256], name[256];
 {
        FILE    *f;
        char    basename[256], name[256];
-       byte    *image_rgba, *c;
+       byte    *c;
        Image_StripImageExtension(filename, basename); // strip .tga, .pcx and .lmp extensions to allow replacement by other types
        // replace *'s with #, so commandline utils don't get confused when dealing with the external files
        for (c = basename;*c;c++)
        Image_StripImageExtension(filename, basename); // strip .tga, .pcx and .lmp extensions to allow replacement by other types
        // replace *'s with #, so commandline utils don't get confused when dealing with the external files
        for (c = basename;*c;c++)
@@ -454,11 +454,6 @@ byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int ma
        COM_FOpenFile (name, &f, true);
        if (f)
                return LoadLMP (f, matchwidth, matchheight);
        COM_FOpenFile (name, &f, true);
        if (f)
                return LoadLMP (f, matchwidth, matchheight);
-       if ((image_rgba = W_GetTexture(basename, matchwidth, matchheight)))
-               return image_rgba;
-       COM_StripExtension(filename, basename); // do it again with a * this time
-       if ((image_rgba = W_GetTexture(basename, matchwidth, matchheight)))
-               return image_rgba;
        if (complain)
                Con_Printf ("Couldn't load %s.tga or .pcx\n", filename);
        return NULL;
        if (complain)
                Con_Printf ("Couldn't load %s.tga or .pcx\n", filename);
        return NULL;
index 139766d3f5e1154a3aea267fafdcaaecf3ed9baf..9b9f4fcb3626cc35543d0691b0f798d4f3a7d262 100644 (file)
--- a/in_win.c
+++ b/in_win.c
@@ -191,7 +191,7 @@ void IN_ShowMouse (void)
 
        if (!mouseshowtoggle)
        {
 
        if (!mouseshowtoggle)
        {
-               ShowCursor (TRUE);
+               ShowCursor (true);
                mouseshowtoggle = 1;
        }
 }
                mouseshowtoggle = 1;
        }
 }
@@ -207,7 +207,7 @@ void IN_HideMouse (void)
 
        if (mouseshowtoggle)
        {
 
        if (mouseshowtoggle)
        {
-               ShowCursor (FALSE);
+               ShowCursor (false);
                mouseshowtoggle = 0;
        }
 }
                mouseshowtoggle = 0;
        }
 }
@@ -319,8 +319,8 @@ void IN_RestoreOriginalMouseState (void)
 
 // try to redraw the cursor so it gets reinitialized, because sometimes it
 // has garbage after the mode switch
 
 // try to redraw the cursor so it gets reinitialized, because sometimes it
 // has garbage after the mode switch
-       ShowCursor (TRUE);
-       ShowCursor (FALSE);
+       ShowCursor (true);
+       ShowCursor (false);
 }
 
 
 }
 
 
index 7dc551efd7f4472c154e30c7e2d610bfeb95770f..a9860d916fecbd121554614124afcd34af5eeef4 100644 (file)
@@ -160,27 +160,31 @@ void Mod_LoadTextures (lump_t *l)
                tx->height = mt->height;
                for (j=0 ; j<MIPLEVELS ; j++)
                        tx->offsets[j] = 0;
                tx->height = mt->height;
                for (j=0 ; j<MIPLEVELS ; j++)
                        tx->offsets[j] = 0;
-               freeimage = TRUE;
+               freeimage = true;
+               transparent = true;
+               fullbrights = false;
                bytesperpixel = 4;
                bytesperpixel = 4;
-               fullbrights = FALSE;
-               transparent = TRUE;
-               data = loadimagepixels(tx->name, FALSE, 0, 0); //tx->width, tx->height);
+               data = loadimagepixels(tx->name, false, 0, 0); //tx->width, tx->height);
                if (!data) // no external texture found
                {
                if (!data) // no external texture found
                {
-                       freeimage = FALSE;
-                       transparent = FALSE;
-                       bytesperpixel = 1;
-                       if (mt->offsets[0]) // texture included
+                       if (hlbsp)
                        {
                        {
-                               data = (byte *)((int) mt + mt->offsets[0]);
-                               if (hlbsp)
+                               if (mt->offsets[0]) // texture included
                                {
                                {
+                                       freeimage = true;
+                                       transparent = true;
+                                       bytesperpixel = 4;
+                                       data = W_ConvertWAD3Texture(mt);
+                                       tx->width = image_width;
+                                       tx->height = image_height;
+                                       /*
                                        byte *in, *out, *pal;
 //                                     int palsize;
                                        int d, p;
                                        bytesperpixel = 4;
                                        byte *in, *out, *pal;
 //                                     int palsize;
                                        int d, p;
                                        bytesperpixel = 4;
-                                       freeimage = TRUE;
-                                       in = data;
+                                       freeimage = true;
+                                       transparent = false;
+                                       in = (byte *)((int) mt + mt->offsets[0]);
                                        data = out = qmalloc(mt->width * mt->height * 4);
                                        pal = in + (((mt->width * mt->height) * 85) >> 6);
 //                                     palsize = pal[1] * 0x100 + pal[0];
                                        data = out = qmalloc(mt->width * mt->height * 4);
                                        pal = in + (((mt->width * mt->height) * 85) >> 6);
 //                                     palsize = pal[1] * 0x100 + pal[0];
@@ -193,7 +197,7 @@ void Mod_LoadTextures (lump_t *l)
                                                if (mt->name[0] == '{' && p == 255)
                                                {
                                                        out[0] = out[1] = out[2] = out[3] = 0;
                                                if (mt->name[0] == '{' && p == 255)
                                                {
                                                        out[0] = out[1] = out[2] = out[3] = 0;
-                                                       transparent = TRUE;
+                                                       transparent = true;
                                                }
                                                else
                                                {
                                                }
                                                else
                                                {
@@ -205,31 +209,61 @@ void Mod_LoadTextures (lump_t *l)
                                                }
                                                out += 4;
                                        }
                                                }
                                                out += 4;
                                        }
+                                       */
                                }
                                }
-                               else
+                               if (!data)
+                               {
+                                       freeimage = true;
+                                       transparent = true;
+                                       bytesperpixel = 4;
+                                       data = W_GetTexture(mt->name);
+                                       tx->width = image_width;
+                                       tx->height = image_height;
+                               }
+                               if (!data)
+                               {
+                                       freeimage = false;
+                                       transparent = false;
+                                       bytesperpixel = 1;
+                                       data = (byte *)((int) r_notexture_mip + r_notexture_mip->offsets[0]);
+                                       tx->width = tx->height = 16;
+                               }
+                       }
+                       else
+                       {
+                               if (mt->offsets[0]) // texture included
                                {
                                {
+                                       freeimage = false;
+                                       transparent = false;
+                                       bytesperpixel = 1;
+                                       data = (byte *)((int) mt + mt->offsets[0]);
+                                       tx->width = mt->width;
+                                       tx->height = mt->height;
                                        if (r_fullbrights.value && tx->name[0] != '*')
                                        {
                                                for (j = 0;j < tx->width*tx->height;j++)
                                                {
                                                        if (data[j] >= 224) // fullbright
                                                        {
                                        if (r_fullbrights.value && tx->name[0] != '*')
                                        {
                                                for (j = 0;j < tx->width*tx->height;j++)
                                                {
                                                        if (data[j] >= 224) // fullbright
                                                        {
-                                                               fullbrights = TRUE;
+                                                               fullbrights = true;
                                                                break;
                                                        }
                                                }
                                        }
                                }
                                                                break;
                                                        }
                                                }
                                        }
                                }
-                       }
-                       else // no texture, and no external replacement texture was found
-                       {
-                               tx->width = tx->height = 16;
-                               data = (byte *)((int) r_notexture_mip + r_notexture_mip->offsets[0]);
+                               else // no texture, and no external replacement texture was found
+                               {
+                                       freeimage = false;
+                                       transparent = false;
+                                       bytesperpixel = 1;
+                                       data = (byte *)((int) r_notexture_mip + r_notexture_mip->offsets[0]);
+                                       tx->width = tx->height = 16;
+                               }
                        }
                }
                if (!hlbsp && !strncmp(tx->name,"sky",3) && tx->width == 256 && tx->height == 128) // LordHavoc: HL sky textures are entirely unrelated
                {
                        }
                }
                if (!hlbsp && !strncmp(tx->name,"sky",3) && tx->width == 256 && tx->height == 128) // LordHavoc: HL sky textures are entirely unrelated
                {
-                       tx->transparent = FALSE;
+                       tx->transparent = false;
                        R_InitSky (data, bytesperpixel);
                }
                else
                        R_InitSky (data, bytesperpixel);
                }
                else
@@ -597,7 +631,7 @@ void Mod_LoadTexinfo (lump_t *l)
                {
                        out->texture = r_notexture_mip; // checkerboard texture
                        out->flags = 0;
                {
                        out->texture = r_notexture_mip; // checkerboard texture
                        out->flags = 0;
-                       out->texture->transparent = FALSE;
+                       out->texture->transparent = false;
                }
                else
                {
                }
                else
                {
@@ -608,7 +642,7 @@ void Mod_LoadTexinfo (lump_t *l)
                        {
                                out->texture = r_notexture_mip; // texture not found
                                out->flags = 0;
                        {
                                out->texture = r_notexture_mip; // texture not found
                                out->flags = 0;
-                               out->texture->transparent = FALSE;
+                               out->texture->transparent = false;
                        }
                }
        }
                        }
                }
        }
index 87a75eed9519609c1c1c616ab72192a8bb152c16..e01a6191ed0abfd7ce8c7bdfb41bf597ac51536f 100644 (file)
@@ -71,7 +71,7 @@ BOOL PASCAL FAR BlockingHook(void)
        if ((Sys_FloatTime() - blocktime) > 2.0)
        {
                WSACancelBlockingCall();
        if ((Sys_FloatTime() - blocktime) > 2.0)
        {
                WSACancelBlockingCall();
-               return FALSE;
+               return false;
        }
 
     /* get the next message, if any */ 
        }
 
     /* get the next message, if any */ 
@@ -83,7 +83,7 @@ BOOL PASCAL FAR BlockingHook(void)
         DispatchMessage(&msg); 
     } 
  
         DispatchMessage(&msg); 
     } 
  
-    /* TRUE if we got a message */ 
+    /* true if we got a message */ 
     return ret; 
 } 
 
     return ret; 
 } 
 
index ac18f05b8539a2aa94798f501f7c6c5f619b7397..e9c3effd649dd5fe565ad19e91860221c1ac6803 100644 (file)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -95,11 +95,11 @@ qboolean checkextension(char *name)
                if (!*e)
                        break;
                if (!strncasecmp(e, name, len))
                if (!*e)
                        break;
                if (!strncasecmp(e, name, len))
-                       return TRUE;
+                       return true;
                while (*e && *e != ' ')
                        e++;
        }
                while (*e && *e != ' ')
                        e++;
        }
-       return FALSE;
+       return false;
 }
 
 /*
 }
 
 /*
index 7c4abfa9e15ff69578fec9b2f8123b263bf6cd44..59d875ee32140db99dcda6f5407bd8b14095f5d6 100644 (file)
--- a/r_part.c
+++ b/r_part.c
@@ -76,7 +76,7 @@ particle_t    **freeparticles; // list used only in compacting particles array
 
 cvar_t r_particles = {"r_particles", "1"};
 cvar_t r_drawparticles = {"r_drawparticles", "1"};
 
 cvar_t r_particles = {"r_particles", "1"};
 cvar_t r_drawparticles = {"r_drawparticles", "1"};
-cvar_t r_dynamicparticles = {"r_dynamicparticles", "1", TRUE};
+cvar_t r_dynamicparticles = {"r_dynamicparticles", "1", true};
 
 byte shadebubble(float dx, float dy, vec3_t light)
 {
 
 byte shadebubble(float dx, float dy, vec3_t light)
 {
index 0d51ed41db7203cb10e75e9a3466db33869081bc..9a3c37ed3b6df8e4ec7c86c6d454839387768106 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -545,7 +545,7 @@ void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg)
 // send an update
                bits = 0;
 
 // send an update
                bits = 0;
 
-               dodelta = FALSE;
+               dodelta = false;
                if ((int)ent->v.effects & EF_DELTA)
                        dodelta = sv.time < client->nextfullupdate[e]; // every half second a full update is forced
 
                if ((int)ent->v.effects & EF_DELTA)
                        dodelta = sv.time < client->nextfullupdate[e]; // every half second a full update is forced
 
index bf7d54a16dc561a838041535106cf135e937fa2f..8c8a595c9e57d7b6818ba073d7cac70496898117 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -612,7 +612,7 @@ WinMain
 void SleepUntilInput (int time)
 {
 
 void SleepUntilInput (int time)
 {
 
-       MsgWaitForMultipleObjects(1, &tevent, FALSE, time, QS_ALLINPUT);
+       MsgWaitForMultipleObjects(1, &tevent, false, time, QS_ALLINPUT);
 }
 
 
 }
 
 
@@ -723,7 +723,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
 
 //     Sys_PageIn (parms.membase, parms.memsize);
 
 
 //     Sys_PageIn (parms.membase, parms.memsize);
 
-       tevent = CreateEvent(NULL, FALSE, FALSE, NULL);
+       tevent = CreateEvent(NULL, false, false, NULL);
 
        if (!tevent)
                Sys_Error ("Couldn't create event");
 
        if (!tevent)
                Sys_Error ("Couldn't create event");
@@ -821,6 +821,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
        }
 
     /* return success of application */
        }
 
     /* return success of application */
-    return TRUE;
+    return true;
 }
 
 }
 
index c30a890d49855ed8e635609c4194397f1201df15..3ef91f208675be55c839b0ee065e9e70d5978c18 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -168,7 +168,7 @@ qboolean VID_SetWindowedMode (int modenum)
        ExWindowStyle = 0;
 
        rect = WindowRect;
        ExWindowStyle = 0;
 
        rect = WindowRect;
-       AdjustWindowRectEx(&rect, WindowStyle, FALSE, 0);
+       AdjustWindowRectEx(&rect, WindowStyle, false, 0);
 
        width = rect.right - rect.left;
        height = rect.bottom - rect.top;
 
        width = rect.right - rect.left;
        height = rect.bottom - rect.top;
@@ -194,8 +194,8 @@ qboolean VID_SetWindowedMode (int modenum)
        vid.width = vid.conwidth;
        vid.height = vid.conheight;
 
        vid.width = vid.conwidth;
        vid.height = vid.conheight;
 
-       SendMessage (mainwindow, WM_SETICON, (WPARAM)TRUE, (LPARAM)hIcon);
-       SendMessage (mainwindow, WM_SETICON, (WPARAM)FALSE, (LPARAM)hIcon);
+       SendMessage (mainwindow, WM_SETICON, (WPARAM)true, (LPARAM)hIcon);
+       SendMessage (mainwindow, WM_SETICON, (WPARAM)false, (LPARAM)hIcon);
 
        return true;
 }
 
        return true;
 }
@@ -234,7 +234,7 @@ qboolean VID_SetFullDIBMode (int modenum)
        ExWindowStyle = 0;
 
        rect = WindowRect;
        ExWindowStyle = 0;
 
        rect = WindowRect;
-       AdjustWindowRectEx(&rect, WindowStyle, FALSE, 0);
+       AdjustWindowRectEx(&rect, WindowStyle, false, 0);
 
        width = rect.right - rect.left;
        height = rect.bottom - rect.top;
 
        width = rect.right - rect.left;
        height = rect.bottom - rect.top;
@@ -259,8 +259,8 @@ qboolean VID_SetFullDIBMode (int modenum)
        window_x = 0;
        window_y = 0;
 
        window_x = 0;
        window_y = 0;
 
-       SendMessage (mainwindow, WM_SETICON, (WPARAM)TRUE, (LPARAM)hIcon);
-       SendMessage (mainwindow, WM_SETICON, (WPARAM)FALSE, (LPARAM)hIcon);
+       SendMessage (mainwindow, WM_SETICON, (WPARAM)true, (LPARAM)hIcon);
+       SendMessage (mainwindow, WM_SETICON, (WPARAM)false, (LPARAM)hIcon);
 
        return true;
 }
 
        return true;
 }
@@ -566,16 +566,16 @@ BOOL bSetupPixelFormat(HDC hDC)
     if ( (pixelformat = ChoosePixelFormat(hDC, &pfd)) == 0 )
     {
         MessageBox(NULL, "ChoosePixelFormat failed", "Error", MB_OK);
     if ( (pixelformat = ChoosePixelFormat(hDC, &pfd)) == 0 )
     {
         MessageBox(NULL, "ChoosePixelFormat failed", "Error", MB_OK);
-        return FALSE;
+        return false;
     }
 
     }
 
-    if (SetPixelFormat(hDC, pixelformat, &pfd) == FALSE)
+    if (SetPixelFormat(hDC, pixelformat, &pfd) == false)
     {
         MessageBox(NULL, "SetPixelFormat failed", "Error", MB_OK);
     {
         MessageBox(NULL, "SetPixelFormat failed", "Error", MB_OK);
-        return FALSE;
+        return false;
     }
 
     }
 
-    return TRUE;
+    return true;
 }
 
 
 }
 
 
diff --git a/wad.c b/wad.c
index 00d7e7efd27a693d32060e141ce5d73b67438c9c..177c7a70b84cbf54d0b937d8cd1d271c796907b3 100644 (file)
--- a/wad.c
+++ b/wad.c
@@ -211,7 +211,7 @@ void W_LoadTextureWadFile (char *filename, int complain)
 
        if (fread(lumps, sizeof(lumpinfo_t), numlumps, file) != numlumps)
        {Con_Printf ("W_LoadTextureWadFile: unable to read lump table");return;}
 
        if (fread(lumps, sizeof(lumpinfo_t), numlumps, file) != numlumps)
        {Con_Printf ("W_LoadTextureWadFile: unable to read lump table");return;}
-       
+
        for (i=0, lump_p = lumps ; i<numlumps ; i++,lump_p++)
        {
                W_CleanupName (lump_p->name, lump_p->name);
        for (i=0, lump_p = lumps ; i<numlumps ; i++,lump_p++)
        {
                W_CleanupName (lump_p->name, lump_p->name);
@@ -236,7 +236,7 @@ void W_LoadTextureWadFile (char *filename, int complain)
        // leaves the file open
 }
 
        // leaves the file open
 }
 
-
+/*
 byte hlpalette[768] =
 {
        0x00,0x00,0x00,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x2F,0x2F,0x2F,0x3F,0x3F,0x3F,0x4B,
 byte hlpalette[768] =
 {
        0x00,0x00,0x00,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x2F,0x2F,0x2F,0x3F,0x3F,0x3F,0x4B,
@@ -288,31 +288,78 @@ byte hlpalette[768] =
        0xE7,0xFF,0xD7,0xFF,0xFF,0x67,0x00,0x00,0x8B,0x00,0x00,0xB3,0x00,0x00,0xD7,0x00,
        0x00,0xFF,0x00,0x00,0xFF,0xF3,0x93,0xFF,0xF7,0xC7,0xFF,0xFF,0xFF,0x9F,0x5B,0x53,
 };
        0xE7,0xFF,0xD7,0xFF,0xFF,0x67,0x00,0x00,0x8B,0x00,0x00,0xB3,0x00,0x00,0xD7,0x00,
        0x00,0xFF,0x00,0x00,0xFF,0xF3,0x93,0xFF,0xF7,0xC7,0xFF,0xFF,0xFF,0x9F,0x5B,0x53,
 };
+*/
 
 
-byte *W_GetTexture(char *name, int matchwidth, int matchheight)
+byte *W_ConvertWAD3Texture(miptex_t *tex)
 {
 {
-       int i, c, datasize;
-       short colorcount;
-       FILE *file;
-       struct
+       byte *in, *data, *out, *pal;
+//     int palsize;
+       int d, p;
+       in = (byte *)((int) tex + tex->offsets[0]);
+       data = out = qmalloc(tex->width * tex->height * 4);
+       if (!data)
+               return NULL;
+       image_width = tex->width;
+       image_height = tex->height;
+       pal = in + (((image_width * image_height) * 85) >> 6);
+//     palsize = pal[1] * 0x100 + pal[0];
+//     if (palsize >= 256)
+//             palsize = 256;
+       pal += 2;
+       for (d = 0;d < image_width * image_height;d++)
        {
        {
-               char name[16];
-               int width;
-               int height;
-               int ofs[4];
-       } t;
-       byte pal[256][3], *indata, *outdata, *data;
+               p = *in++;
+               if (tex->name[0] == '{' && p == 255)
+                       out[0] = out[1] = out[2] = out[3] = 0;
+               else
+               {
+                       p *= 3;
+                       out[0] = pal[p];
+                       out[1] = pal[p+1];
+                       out[2] = pal[p+2];
+                       out[3] = 255;
+               }
+               out += 4;
+       }
+       return data;
+}
+
+byte *W_GetTexture(char *name)
+{
+//     int i, c, datasize;
+//     short colorcount;
+//     byte pal[256][3], *indata, *outdata, *data;
+       char texname[17];
+       int i, j;
+       FILE *file;
+       miptex_t *tex;
+       byte *data;
+       texname[16] = 0;
+       W_CleanupName (name, texname);
        for (i = 0;i < TEXWAD_MAXIMAGES;i++)
        {
                if (texwadlump[i].name[0])
                {
        for (i = 0;i < TEXWAD_MAXIMAGES;i++)
        {
                if (texwadlump[i].name[0])
                {
-                       if (!strcmp(name, texwadlump[i].name)) // found it
+                       if (!strcmp(texname, texwadlump[i].name)) // found it
                        {
                                file = texwadlump[i].file;
                                if (fseek(file, texwadlump[i].position, SEEK_SET))
                        {
                                file = texwadlump[i].file;
                                if (fseek(file, texwadlump[i].position, SEEK_SET))
-                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return FALSE;}
-                               if (fread(&t, sizeof(t), 1, file) != 1)
-                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return FALSE;}
+                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
+
+                               tex = qmalloc(texwadlump[i].size);
+                               if (!tex)
+                                       return NULL;
+                               if (fread(tex, 1, texwadlump[i].size, file) < texwadlump[i].size)
+                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
+
+                               tex->width = LittleLong(tex->width);
+                               tex->height = LittleLong(tex->height);
+                               for (j = 0;j < MIPLEVELS;j++)
+                                       tex->offsets[j] = LittleLong(tex->offsets[j]);
+                               data = W_ConvertWAD3Texture(tex);
+                               qfree(tex);
+                               return data;
+                               /*
                                image_width = LittleLong(t.width);
                                image_height = LittleLong(t.height);
                                if (matchwidth && image_width != matchwidth)
                                image_width = LittleLong(t.width);
                                image_height = LittleLong(t.height);
                                if (matchwidth && image_width != matchwidth)
@@ -320,23 +367,23 @@ byte *W_GetTexture(char *name, int matchwidth, int matchheight)
                                if (matchheight && image_height != matchheight)
                                        continue;
                                if (image_width & 15 || image_height & 15)
                                if (matchheight && image_height != matchheight)
                                        continue;
                                if (image_width & 15 || image_height & 15)
-                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return FALSE;}
+                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
                                // allocate space for expanded image,
                                // and load incoming image into upper area (overwritten as it expands)
                                if (!(data = outdata = qmalloc(image_width*image_height*4)))
                                // allocate space for expanded image,
                                // and load incoming image into upper area (overwritten as it expands)
                                if (!(data = outdata = qmalloc(image_width*image_height*4)))
-                               {Con_Printf("W_GetTexture: out of memory");return FALSE;}
+                               {Con_Printf("W_GetTexture: out of memory");return NULL;}
                                indata = outdata + image_width*image_height*3;
                                datasize = image_width*image_height*85/64;
                                // read the image data
                                if (fseek(file, texwadlump[i].position + sizeof(t), SEEK_SET))
                                indata = outdata + image_width*image_height*3;
                                datasize = image_width*image_height*85/64;
                                // read the image data
                                if (fseek(file, texwadlump[i].position + sizeof(t), SEEK_SET))
-                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return FALSE;}
+                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
                                if (fread(indata, 1, image_width*image_height, file) != image_width*image_height)
                                if (fread(indata, 1, image_width*image_height, file) != image_width*image_height)
-                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return FALSE;}
+                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
                                // read the number of colors used (always 256)
                                if (fseek(file, texwadlump[i].position + sizeof(t) + datasize, SEEK_SET))
                                // read the number of colors used (always 256)
                                if (fseek(file, texwadlump[i].position + sizeof(t) + datasize, SEEK_SET))
-                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return FALSE;}
+                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
                                if (fread(&colorcount, 2, 1, file) != 1)
                                if (fread(&colorcount, 2, 1, file) != 1)
-                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return FALSE;}
+                               {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
                                if (texwadlump[i].size > (datasize + sizeof(t)))
                                {
                                        colorcount = LittleShort(colorcount);
                                if (texwadlump[i].size > (datasize + sizeof(t)))
                                {
                                        colorcount = LittleShort(colorcount);
@@ -346,7 +393,7 @@ byte *W_GetTexture(char *name, int matchwidth, int matchheight)
                                        // read the palette
        //                              fseek(file, texwadlump[i].position + sizeof(t) + datasize + 2, SEEK_SET);
                                        if (fread(&pal, 3, colorcount, file) != colorcount)
                                        // read the palette
        //                              fseek(file, texwadlump[i].position + sizeof(t) + datasize + 2, SEEK_SET);
                                        if (fread(&pal, 3, colorcount, file) != colorcount)
-                                       {Con_Printf("W_GetTexture: corrupt WAD3 file");return FALSE;}
+                                       {Con_Printf("W_GetTexture: corrupt WAD3 file");return NULL;}
                                }
                                else
                                        memcpy(&pal, hlpalette, 768);
                                }
                                else
                                        memcpy(&pal, hlpalette, 768);
@@ -366,6 +413,7 @@ byte *W_GetTexture(char *name, int matchwidth, int matchheight)
                                        outdata += 4;
                                }
                                return data;
                                        outdata += 4;
                                }
                                return data;
+                               */
                        }
                }
                else
                        }
                }
                else
diff --git a/wad.h b/wad.h
index 001e293f99f81acc059a7c6afb8a3da3227fb1f2..9c16b566c7f208244f900f897e420e401d35e8cd 100644 (file)
--- a/wad.h
+++ b/wad.h
@@ -77,4 +77,5 @@ void SwapPic (qpic_t *pic);
 // LordHavoc: added alternate texture WAD2/WAD3 system for easier loading of HalfLife texture wads
 extern int image_width, image_height;
 void   W_LoadTextureWadFile (char *filename, int complain);
 // LordHavoc: added alternate texture WAD2/WAD3 system for easier loading of HalfLife texture wads
 extern int image_width, image_height;
 void   W_LoadTextureWadFile (char *filename, int complain);
-byte   *W_GetTexture (char *name, int matchwidth, int matchheight); // returns malloc'd image data, width and height are in image_width and image_height (yeah yeah so I'm lazy...)
+byte   *W_GetTexture (char *name); // returns malloc'd image data, width and height are in image_width and image_height
+byte   *W_ConvertWAD3Texture(miptex_t *tex); // returns malloc'd image data, width and height are in image_width and image_height