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
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])
{
- 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] == ':')
value[i] = 0;
strcpy(wadname, "textures/");
strcat(wadname, &value[j]);
- W_LoadTextureWadFile (wadname, FALSE);
+ W_LoadTextureWadFile (wadname, false);
j = i+1;
if (!k)
break;
heventChildSend = heventChild;
// so we'll know when to go away.
- heventDone = CreateEvent (NULL, FALSE, FALSE, NULL);
+ heventDone = CreateEvent (NULL, false, false, NULL);
if (!heventDone)
{
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)
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);
1,
&dwWritten);
- rec.Event.KeyEvent.bKeyDown = FALSE;
+ rec.Event.KeyEvent.bKeyDown = false;
WriteConsoleInput(
hStdin,
sz++;
}
- return TRUE;
+ return true;
}
cx = coordMax.X;
if (!GetConsoleScreenBufferInfo(hStdout, &info))
- return FALSE;
+ return false;
// height
info.srWindow.Left = 0;
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))
- return FALSE;
+ return false;
}
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))
- return FALSE;
+ return false;
// width
info.srWindow.Left = 0;
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))
- return FALSE;
+ return false;
}
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;
}
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"};
// 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);
}
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 (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]);
- 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;
{
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++)
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 (!mouseshowtoggle)
{
- ShowCursor (TRUE);
+ ShowCursor (true);
mouseshowtoggle = 1;
}
}
if (mouseshowtoggle)
{
- ShowCursor (FALSE);
+ ShowCursor (false);
mouseshowtoggle = 0;
}
}
// 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);
}
tx->height = mt->height;
for (j=0 ; j<MIPLEVELS ; j++)
tx->offsets[j] = 0;
- freeimage = TRUE;
+ freeimage = true;
+ transparent = true;
+ fullbrights = false;
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
{
- 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;
- 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];
if (mt->name[0] == '{' && p == 255)
{
out[0] = out[1] = out[2] = out[3] = 0;
- transparent = TRUE;
+ transparent = true;
}
else
{
}
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
{
- fullbrights = TRUE;
+ fullbrights = true;
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
{
- tx->transparent = FALSE;
+ tx->transparent = false;
R_InitSky (data, bytesperpixel);
}
else
{
out->texture = r_notexture_mip; // checkerboard texture
out->flags = 0;
- out->texture->transparent = FALSE;
+ out->texture->transparent = false;
}
else
{
{
out->texture = r_notexture_mip; // texture not found
out->flags = 0;
- out->texture->transparent = FALSE;
+ out->texture->transparent = false;
}
}
}
if ((Sys_FloatTime() - blocktime) > 2.0)
{
WSACancelBlockingCall();
- return FALSE;
+ return false;
}
/* get the next message, if any */
DispatchMessage(&msg);
}
- /* TRUE if we got a message */
+ /* true if we got a message */
return ret;
}
if (!*e)
break;
if (!strncasecmp(e, name, len))
- return TRUE;
+ return true;
while (*e && *e != ' ')
e++;
}
- return FALSE;
+ return false;
}
/*
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)
{
// 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
void SleepUntilInput (int time)
{
- MsgWaitForMultipleObjects(1, &tevent, FALSE, time, QS_ALLINPUT);
+ MsgWaitForMultipleObjects(1, &tevent, false, time, QS_ALLINPUT);
}
// 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");
}
/* return success of application */
- return TRUE;
+ return true;
}
ExWindowStyle = 0;
rect = WindowRect;
- AdjustWindowRectEx(&rect, WindowStyle, FALSE, 0);
+ AdjustWindowRectEx(&rect, WindowStyle, false, 0);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
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;
}
ExWindowStyle = 0;
rect = WindowRect;
- AdjustWindowRectEx(&rect, WindowStyle, FALSE, 0);
+ AdjustWindowRectEx(&rect, WindowStyle, false, 0);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
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;
}
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);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
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);
// leaves the file open
}
-
+/*
byte hlpalette[768] =
{
0x00,0x00,0x00,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x2F,0x2F,0x2F,0x3F,0x3F,0x3F,0x4B,
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])
{
- 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))
- {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)
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)))
- {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))
- {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)
- {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))
- {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)
- {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);
// 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);
outdata += 4;
}
return data;
+ */
}
}
else
// 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