- Changed license for r_data.cpp because there isn't anything of id's original

code left in that file.
- Cleaned up r_data.cpp.
- Fixed: FTextureManager::FindTexture should not print error messages if it
  doesn't find the texture.
- Added Karate Chris's patch for fixing Strife quit messages.


SVN r718 (trunk)
This commit is contained in:
Christoph Oelckers 2008-01-27 09:38:37 +00:00
parent 499fefec07
commit 5dfc81af36
8 changed files with 199 additions and 102 deletions

View file

@ -1,3 +1,11 @@
January 27, 2008 (Changes by Graf Zahl)
- Changed license for r_data.cpp because there isn't anything of id's original
code left in that file.
- Cleaned up r_data.cpp.
- Fixed: FTextureManager::FindTexture should not print error messages if it
doesn't find the texture.
- Added Karate Chris's patch for fixing Strife quit messages.
January 26, 2008 January 26, 2008
- Added preloading of fonts to reduce the chance that characters from a single - Added preloading of fonts to reduce the chance that characters from a single
font will require more than one hardware texture to display. font will require more than one hardware texture to display.

View file

@ -238,7 +238,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
DTA_CleanNoMove, true, TAG_DONE); DTA_CleanNoMove, true, TAG_DONE);
x = (SCREENWIDTH >> 1) - (((maxwidth + 32 + 32 + 16) * CleanXfac) >> 1); x = (SCREENWIDTH >> 1) - (((maxwidth + 32 + 32 + 16) * CleanXfac) >> 1);
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 3.5 : y = SCREENHEIGHT / 10; gamestate == GS_INTERMISSION ? y = SCREENHEIGHT * 2 / 7 : y = SCREENHEIGHT / 10;
if (teamplay && deathmatch) if (teamplay && deathmatch)
y += SCREENWIDTH / 32; y += SCREENWIDTH / 32;

View file

@ -1964,10 +1964,10 @@ void M_QuitGame (int choice)
// or one at random, between 1 and maximum number. // or one at random, between 1 and maximum number.
if (gameinfo.gametype & (GAME_Doom|GAME_Strife)) if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
{ {
int quitmsg = gametic % (gameinfo.gametype == GAME_Doom ? NUM_QUITDOOMMESSAGES : NUM_QUITSTRIFEMESSAGES); int quitmsg = gametic % (gameinfo.gametype == GAME_Doom ? NUM_QUITDOOMMESSAGES : NUM_QUITSTRIFEMESSAGES - 1);
if (quitmsg != 0) if (quitmsg != 0 || gameinfo.gametype == GAME_Strife)
{ {
EndString.Format("QUITMSG%d", quitmsg + (gameinfo.gametype == GAME_Doom ? 0 : NUM_QUITDOOMMESSAGES)); EndString.Format("QUITMSG%d", quitmsg + (gameinfo.gametype == GAME_Doom ? 0 : NUM_QUITDOOMMESSAGES + 1));
EndString.Format("%s\n\n%s", GStrings(EndString), GStrings("DOSY")); EndString.Format("%s\n\n%s", GStrings(EndString), GStrings("DOSY"));
} }
else else

View file

@ -1,61 +1,50 @@
// Emacs style mode select -*- C++ -*- /*
//----------------------------------------------------------------------------- ** r_data.cpp
// **
// $Id:$ **---------------------------------------------------------------------------
// ** Copyright 1998-2008 Randy Heit
// Copyright (C) 1993-1996 by id Software, Inc. ** All rights reserved.
// **
// This source is available for distribution and/or modification ** Redistribution and use in source and binary forms, with or without
// only under the terms of the DOOM Source Code License as ** modification, are permitted provided that the following conditions
// published by id Software. All rights reserved. ** are met:
// **
// The source is distributed in the hope that it will be useful, ** 1. Redistributions of source code must retain the above copyright
// but WITHOUT ANY WARRANTY; without even the implied warranty of ** notice, this list of conditions and the following disclaimer.
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License ** 2. Redistributions in binary form must reproduce the above copyright
// for more details. ** notice, this list of conditions and the following disclaimer in the
// ** documentation and/or other materials provided with the distribution.
// $Log:$ ** 3. The name of the author may not be used to endorse or promote products
// ** derived from this software without specific prior written permission.
// Revision 1.3 1997/01/29 20:10 **
// DESCRIPTION: ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// Preparation of data for rendering, ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// generation of lookups, caching, retrieval by name. ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
//----------------------------------------------------------------------------- ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
#include <stddef.h> ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
#include <malloc.h> ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
#include <stdio.h> ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
**
*/
#include "i_system.h" #include "i_system.h"
#include "m_alloc.h" #include "m_alloc.h"
#include "m_swap.h"
#include "m_png.h"
#include "w_wad.h" #include "w_wad.h"
#include "doomdef.h" #include "doomdef.h"
#include "r_local.h" #include "r_local.h"
#include "p_local.h"
#include "doomstat.h"
#include "r_sky.h" #include "r_sky.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "c_console.h"
#include "r_data.h" #include "r_data.h"
#include "sc_man.h" #include "sc_man.h"
#include "v_palette.h"
#include "v_video.h"
#include "v_text.h" #include "v_text.h"
#include "gi.h"
#include "cmdlib.h"
#include "templates.h"
#include "st_start.h" #include "st_start.h"
static void R_InitPatches ();
static int R_CountGroup (const char *start, const char *end); static int R_CountGroup (const char *start, const char *end);
static int R_CountTexturesX (); static int R_CountTexturesX ();
static int R_CountLumpTextures (int lumpnum); static int R_CountLumpTextures (int lumpnum);
@ -63,30 +52,21 @@ static int R_CountLumpTextures (int lumpnum);
extern void R_DeinitBuildTiles(); extern void R_DeinitBuildTiles();
extern int R_CountBuildTiles(); extern int R_CountBuildTiles();
static struct FakeCmap
{
//
// Graphics.
// DOOM graphics for walls and sprites
// is stored in vertical runs of opaque pixels (posts).
// A column is composed of zero or more posts,
// a patch or sprite is composed of zero or more columns.
//
// for global animation
bool* flatwarp;
BYTE** warpedflats;
int* flatwarpedwhen;
static struct FakeCmap {
char name[8]; char name[8];
PalEntry blend; PalEntry blend;
} *fakecmaps; } *fakecmaps;
size_t numfakecmaps; size_t numfakecmaps;
int firstfakecmap; int firstfakecmap;
BYTE *realcolormaps; BYTE *realcolormaps;
int lastusedcolormap;
//==========================================================================
//
// R_SetDefaultColormap
//
//==========================================================================
void R_SetDefaultColormap (const char *name) void R_SetDefaultColormap (const char *name)
{ {
@ -144,9 +124,12 @@ void R_SetDefaultColormap (const char *name)
} }
} }
//==========================================================================
// //
// R_InitColormaps // R_InitColormaps
// //
//==========================================================================
void R_InitColormaps () void R_InitColormaps ()
{ {
// [RH] Try and convert BOOM colormaps into blending values. // [RH] Try and convert BOOM colormaps into blending values.
@ -213,6 +196,12 @@ void R_InitColormaps ()
NormalLight.Maps = realcolormaps; NormalLight.Maps = realcolormaps;
} }
//==========================================================================
//
// R_DeinitColormaps
//
//==========================================================================
void R_DeinitColormaps () void R_DeinitColormaps ()
{ {
if (fakecmaps != NULL) if (fakecmaps != NULL)
@ -227,9 +216,14 @@ void R_DeinitColormaps ()
} }
} }
//==========================================================================
//
// [RH] Returns an index into realcolormaps. Multiply it by // [RH] Returns an index into realcolormaps. Multiply it by
// 256*NUMCOLORMAPS to find the start of the colormap to use. // 256*NUMCOLORMAPS to find the start of the colormap to use.
// WATERMAP is an exception and returns a blending value instead. // WATERMAP is an exception and returns a blending value instead.
//
//==========================================================================
DWORD R_ColormapNumForName (const char *name) DWORD R_ColormapNumForName (const char *name)
{ {
int lump; int lump;
@ -246,17 +240,26 @@ DWORD R_ColormapNumForName (const char *name)
return blend; return blend;
} }
//==========================================================================
//
// R_BlendForColormap
//
//==========================================================================
DWORD R_BlendForColormap (DWORD map) DWORD R_BlendForColormap (DWORD map)
{ {
return APART(map) ? map : return APART(map) ? map :
map < numfakecmaps ? DWORD(fakecmaps[map].blend) : 0; map < numfakecmaps ? DWORD(fakecmaps[map].blend) : 0;
} }
//==========================================================================
// //
// R_InitData // R_InitData
// Locates all the lumps that will be used by all views // Locates all the lumps that will be used by all views
// Must be called after W_Init. // Must be called after W_Init.
// //
//==========================================================================
void R_InitData () void R_InitData ()
{ {
FTexture::InitGrayMap(); FTexture::InitGrayMap();
@ -322,33 +325,30 @@ static int R_CountGroup (const char *start, const char *end)
static int R_CountTexturesX () static int R_CountTexturesX ()
{ {
int lastlump = 0, lump;
int texlump1 = -1, texlump2 = -1, texlump1a, texlump2a;
int count = 0; int count = 0;
int pfile = -1; int wadcount = Wads.GetNumWads();
for (int wadnum = 0; wadnum < wadcount; wadnum++)
while ((lump = Wads.FindLump ("PNAMES", &lastlump)) != -1)
{ {
pfile = Wads.GetLumpFile (lump); // Use the most recent PNAMES for this WAD.
count += R_CountLumpTextures (lump); // Multiple PNAMES in a WAD will be ignored.
texlump1 = Wads.CheckNumForName ("TEXTURE1", ns_global, pfile); int pnames = Wads.CheckNumForName("PNAMES", ns_global, wadnum, false);
texlump2 = Wads.CheckNumForName ("TEXTURE2", ns_global, pfile);
// should never happen except for zdoom.pk3
if (pnames < 0) continue;
// Only count the patches if the PNAMES come from the current file
// Otherwise they have already been counted.
if (Wads.GetLumpFile(pnames) == wadnum)
{
count += R_CountLumpTextures (pnames);
}
int texlump1 = Wads.CheckNumForName ("TEXTURE1", ns_global, wadnum);
int texlump2 = Wads.CheckNumForName ("TEXTURE2", ns_global, wadnum);
count += R_CountLumpTextures (texlump1) - 1; count += R_CountLumpTextures (texlump1) - 1;
count += R_CountLumpTextures (texlump2) - 1; count += R_CountLumpTextures (texlump2) - 1;
} }
texlump1a = Wads.CheckNumForName ("TEXTURE1");
texlump2a = Wads.CheckNumForName ("TEXTURE2");
if (texlump1a != -1 && (texlump1a == texlump1 || Wads.GetLumpFile (texlump1a) <= pfile))
{
texlump1a = -1;
}
if (texlump2a != -1 && (texlump2a == texlump2 || Wads.GetLumpFile (texlump2a) <= pfile))
{
texlump2a = -1;
}
count += R_CountLumpTextures (texlump1a) - 1;
count += R_CountLumpTextures (texlump2a) - 1;
return count; return count;
} }
@ -502,12 +502,24 @@ void R_PrecacheLevel (void)
delete[] hitlist; delete[] hitlist;
} }
//==========================================================================
//
// R_GetColumn
//
//==========================================================================
const BYTE *R_GetColumn (FTexture *tex, int col) const BYTE *R_GetColumn (FTexture *tex, int col)
{ {
return tex->GetColumn (col, NULL); return tex->GetColumn (col, NULL);
} }
//==========================================================================
//
// Debug stuff
//
//==========================================================================
#ifdef _DEBUG #ifdef _DEBUG
// Prints the spans generated for a texture. Only needed for debugging. // Prints the spans generated for a texture. Only needed for debugging.
CCMD (printspans) CCMD (printspans)

View file

@ -764,11 +764,7 @@ public:
int texnum = GetTexture (texname, FTexture::TEX_MiscPatch); int texnum = GetTexture (texname, FTexture::TEX_MiscPatch);
return Textures[texnum].Texture; return Textures[texnum].Texture;
} }
FTexture *FindTexture(const char *texname, int usetype = FTexture::TEX_MiscPatch, BITFIELD flags = TEXMAN_TryAny) FTexture *FindTexture(const char *texname, int usetype = FTexture::TEX_MiscPatch, BITFIELD flags = TEXMAN_TryAny);
{
int texnum = GetTexture (texname, usetype, flags);
return Textures[texnum].Texture;
}
// Get texture with translation // Get texture with translation
FTexture *operator() (int texnum) FTexture *operator() (int texnum)

View file

@ -53,6 +53,12 @@
//==========================================================================
//
// FMultiPatchTexture :: FMultiPatchTexture
//
//==========================================================================
FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchlookup, int maxpatchnum, bool strife) FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchlookup, int maxpatchnum, bool strife)
: Pixels (0), Spans(0), Parts(0), bRedirect(false) : Pixels (0), Spans(0), Parts(0), bRedirect(false)
{ {
@ -155,6 +161,12 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl
} }
} }
//==========================================================================
//
// FMultiPatchTexture :: ~FMultiPatchTexture
//
//==========================================================================
FMultiPatchTexture::~FMultiPatchTexture () FMultiPatchTexture::~FMultiPatchTexture ()
{ {
Unload (); Unload ();
@ -170,6 +182,12 @@ FMultiPatchTexture::~FMultiPatchTexture ()
} }
} }
//==========================================================================
//
// FMultiPatchTexture :: SetFrontSkyLayer
//
//==========================================================================
void FMultiPatchTexture::SetFrontSkyLayer () void FMultiPatchTexture::SetFrontSkyLayer ()
{ {
for (int i = 0; i < NumParts; ++i) for (int i = 0; i < NumParts; ++i)
@ -179,6 +197,12 @@ void FMultiPatchTexture::SetFrontSkyLayer ()
bNoRemap0 = true; bNoRemap0 = true;
} }
//==========================================================================
//
// FMultiPatchTexture :: Unload
//
//==========================================================================
void FMultiPatchTexture::Unload () void FMultiPatchTexture::Unload ()
{ {
if (Pixels != NULL) if (Pixels != NULL)
@ -188,6 +212,12 @@ void FMultiPatchTexture::Unload ()
} }
} }
//==========================================================================
//
// FMultiPatchTexture :: GetPixels
//
//==========================================================================
const BYTE *FMultiPatchTexture::GetPixels () const BYTE *FMultiPatchTexture::GetPixels ()
{ {
if (bRedirect) if (bRedirect)
@ -201,6 +231,12 @@ const BYTE *FMultiPatchTexture::GetPixels ()
return Pixels; return Pixels;
} }
//==========================================================================
//
// FMultiPatchTexture :: GetColumn
//
//==========================================================================
const BYTE *FMultiPatchTexture::GetColumn (unsigned int column, const Span **spans_out) const BYTE *FMultiPatchTexture::GetColumn (unsigned int column, const Span **spans_out)
{ {
if (bRedirect) if (bRedirect)
@ -229,6 +265,12 @@ const BYTE *FMultiPatchTexture::GetColumn (unsigned int column, const Span **spa
return Pixels + column*Height; return Pixels + column*Height;
} }
//==========================================================================
//
// FMultiPatchTexture :: MakeTexture
//
//==========================================================================
void FMultiPatchTexture::MakeTexture () void FMultiPatchTexture::MakeTexture ()
{ {
// Add a little extra space at the end if the texture's height is not // Add a little extra space at the end if the texture's height is not
@ -250,6 +292,12 @@ void FMultiPatchTexture::MakeTexture ()
} }
} }
//==========================================================================
//
// FMultiPatchTexture :: CheckForHacks
//
//==========================================================================
void FMultiPatchTexture::CheckForHacks () void FMultiPatchTexture::CheckForHacks ()
{ {
if (NumParts <= 0) if (NumParts <= 0)
@ -393,6 +441,14 @@ int FMultiPatchTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf
return retv; return retv;
} }
//==========================================================================
//
// FMultiPatchTexture :: GetFormat
//
// only returns 'paletted' if all patches use the base palette.
//
//==========================================================================
FTextureFormat FMultiPatchTexture::GetFormat() FTextureFormat FMultiPatchTexture::GetFormat()
{ {
if (NumParts == 1) return Parts[0].Texture->GetFormat(); if (NumParts == 1) return Parts[0].Texture->GetFormat();
@ -405,6 +461,12 @@ FTextureFormat FMultiPatchTexture::GetFormat()
} }
//==========================================================================
//
// FTextureManager :: AddTexturesLump
//
//==========================================================================
void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int patcheslump, int firstdup, bool texture1) void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int patcheslump, int firstdup, bool texture1)
{ {
FPatchLookup *patchlookup; FPatchLookup *patchlookup;
@ -546,6 +608,12 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int p
} }
//==========================================================================
//
// FTextureManager :: AddTexturesLumps
//
//==========================================================================
void FTextureManager::AddTexturesLumps (int lump1, int lump2, int patcheslump) void FTextureManager::AddTexturesLumps (int lump1, int lump2, int patcheslump)
{ {
int firstdup = (int)Textures.Size(); int firstdup = (int)Textures.Size();

View file

@ -220,6 +220,18 @@ int FTextureManager::GetTexture (const char *name, int usetype, BITFIELD flags)
return i; return i;
} }
//==========================================================================
//
// FTextureManager :: FindTexture
//
//==========================================================================
FTexture *FTextureManager::FindTexture(const char *texname, int usetype, BITFIELD flags)
{
int texnum = CheckForTexture (texname, usetype, flags);
return texnum <= 0? NULL : Textures[texnum].Texture;
}
//========================================================================== //==========================================================================
// //
// FTextureManager :: WriteTexture // FTextureManager :: WriteTexture
@ -627,7 +639,8 @@ void FTextureManager::AddPatches (int lumpnum)
//========================================================================== //==========================================================================
// //
// R_InitTextures // FTextureManager :: LoadTexturesX
//
// Initializes the texture list with the textures from the world map. // Initializes the texture list with the textures from the world map.
// //
//========================================================================== //==========================================================================
@ -650,7 +663,7 @@ void FTextureManager::LoadTextureX(int wadnum)
int texlump1 = Wads.CheckNumForName ("TEXTURE1", ns_global, wadnum); int texlump1 = Wads.CheckNumForName ("TEXTURE1", ns_global, wadnum);
int texlump2 = Wads.CheckNumForName ("TEXTURE2", ns_global, wadnum); int texlump2 = Wads.CheckNumForName ("TEXTURE2", ns_global, wadnum);
TexMan.AddTexturesLumps (texlump1, texlump2, pnames); AddTexturesLumps (texlump1, texlump2, pnames);
} }
//========================================================================== //==========================================================================
@ -779,4 +792,4 @@ void FTextureManager::Init()
} }
} }
} }
} }

View file

@ -28,14 +28,14 @@ QUITMSG13 = "just leave. when you come\nback, i'll be waiting with a bat.";
QUITMSG14 = "you're lucky i don't smack\nyou for thinking about leaving."; QUITMSG14 = "you're lucky i don't smack\nyou for thinking about leaving.";
// Quit Strife messages // Quit Strife messages
QUITMSG15 = "where are you going?! what about the rebellion?"; QUITMSG15 = "where are you going?!\nwhat about the rebellion?";
QUITMSG16 = "carnage interrupted... what a tease!"; QUITMSG16 = "carnage interrupted...\nwhat a tease!";
QUITMSG17 = "but you're the hope -- my only chance!!"; QUITMSG17 = "but you're the hope\n-- my only chance!!";
QUITMSG18 = "nobody walks out on blackbird."; QUITMSG18 = "nobody walks out on blackbird.";
QUITMSG19 = "i thought you were different..."; QUITMSG19 = "i thought you were different...";
QUITMSG20 = "fine! just kill and run!"; QUITMSG20 = "fine! just kill and run!";
QUITMSG21 = "you can quit...but you can't hide..."; QUITMSG21 = "you can quit...\nbut you can't hide...";
QUITMSG22 = "whaaa, what's the matter? mommy says dinnertime?"; QUITMSG22 = "whaaa, what's the matter?\nmommy says dinnertime?";
LOADNET = "you can't do load while in a net game!\n\npress a key."; LOADNET = "you can't do load while in a net game!\n\npress a key.";
QLOADNET = "you can't quickload during a netgame!\n\npress a key."; QLOADNET = "you can't quickload during a netgame!\n\npress a key.";