mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +00:00
- 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:
parent
499fefec07
commit
5dfc81af36
8 changed files with 199 additions and 102 deletions
|
@ -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
|
||||
- Added preloading of fonts to reduce the chance that characters from a single
|
||||
font will require more than one hardware texture to display.
|
||||
|
|
|
@ -238,7 +238,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
|
|||
DTA_CleanNoMove, true, TAG_DONE);
|
||||
|
||||
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)
|
||||
y += SCREENWIDTH / 32;
|
||||
|
|
|
@ -1964,10 +1964,10 @@ void M_QuitGame (int choice)
|
|||
// or one at random, between 1 and maximum number.
|
||||
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
|
||||
{
|
||||
int quitmsg = gametic % (gameinfo.gametype == GAME_Doom ? NUM_QUITDOOMMESSAGES : NUM_QUITSTRIFEMESSAGES);
|
||||
if (quitmsg != 0)
|
||||
int quitmsg = gametic % (gameinfo.gametype == GAME_Doom ? NUM_QUITDOOMMESSAGES : NUM_QUITSTRIFEMESSAGES - 1);
|
||||
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"));
|
||||
}
|
||||
else
|
||||
|
|
182
src/r_data.cpp
182
src/r_data.cpp
|
@ -1,61 +1,50 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id:$
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
//
|
||||
// This source is available for distribution and/or modification
|
||||
// only under the terms of the DOOM Source Code License as
|
||||
// published by id Software. All rights reserved.
|
||||
//
|
||||
// The source is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||
// for more details.
|
||||
//
|
||||
// $Log:$
|
||||
//
|
||||
// Revision 1.3 1997/01/29 20:10
|
||||
// DESCRIPTION:
|
||||
// Preparation of data for rendering,
|
||||
// generation of lookups, caching, retrieval by name.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <stddef.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
/*
|
||||
** r_data.cpp
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 1998-2008 Randy Heit
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** 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,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (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 "m_alloc.h"
|
||||
|
||||
#include "m_swap.h"
|
||||
#include "m_png.h"
|
||||
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "r_local.h"
|
||||
#include "p_local.h"
|
||||
|
||||
#include "doomstat.h"
|
||||
#include "r_sky.h"
|
||||
|
||||
#include "c_dispatch.h"
|
||||
#include "c_console.h"
|
||||
#include "r_data.h"
|
||||
#include "sc_man.h"
|
||||
|
||||
#include "v_palette.h"
|
||||
#include "v_video.h"
|
||||
#include "v_text.h"
|
||||
#include "gi.h"
|
||||
#include "cmdlib.h"
|
||||
#include "templates.h"
|
||||
#include "st_start.h"
|
||||
|
||||
static void R_InitPatches ();
|
||||
|
||||
static int R_CountGroup (const char *start, const char *end);
|
||||
static int R_CountTexturesX ();
|
||||
static int R_CountLumpTextures (int lumpnum);
|
||||
|
@ -63,30 +52,21 @@ static int R_CountLumpTextures (int lumpnum);
|
|||
extern void R_DeinitBuildTiles();
|
||||
extern int R_CountBuildTiles();
|
||||
|
||||
|
||||
|
||||
//
|
||||
// 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 {
|
||||
static struct FakeCmap
|
||||
{
|
||||
char name[8];
|
||||
PalEntry blend;
|
||||
} *fakecmaps;
|
||||
|
||||
size_t numfakecmaps;
|
||||
int firstfakecmap;
|
||||
BYTE *realcolormaps;
|
||||
int lastusedcolormap;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_SetDefaultColormap
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void R_SetDefaultColormap (const char *name)
|
||||
{
|
||||
|
@ -144,9 +124,12 @@ void R_SetDefaultColormap (const char *name)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_InitColormaps
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void R_InitColormaps ()
|
||||
{
|
||||
// [RH] Try and convert BOOM colormaps into blending values.
|
||||
|
@ -213,6 +196,12 @@ void R_InitColormaps ()
|
|||
NormalLight.Maps = realcolormaps;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_DeinitColormaps
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void R_DeinitColormaps ()
|
||||
{
|
||||
if (fakecmaps != NULL)
|
||||
|
@ -227,9 +216,14 @@ void R_DeinitColormaps ()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// [RH] Returns an index into realcolormaps. Multiply it by
|
||||
// 256*NUMCOLORMAPS to find the start of the colormap to use.
|
||||
// WATERMAP is an exception and returns a blending value instead.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
DWORD R_ColormapNumForName (const char *name)
|
||||
{
|
||||
int lump;
|
||||
|
@ -246,17 +240,26 @@ DWORD R_ColormapNumForName (const char *name)
|
|||
return blend;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_BlendForColormap
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
DWORD R_BlendForColormap (DWORD map)
|
||||
{
|
||||
return APART(map) ? map :
|
||||
map < numfakecmaps ? DWORD(fakecmaps[map].blend) : 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_InitData
|
||||
// Locates all the lumps that will be used by all views
|
||||
// Must be called after W_Init.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void R_InitData ()
|
||||
{
|
||||
FTexture::InitGrayMap();
|
||||
|
@ -322,33 +325,30 @@ static int R_CountGroup (const char *start, const char *end)
|
|||
|
||||
static int R_CountTexturesX ()
|
||||
{
|
||||
int lastlump = 0, lump;
|
||||
int texlump1 = -1, texlump2 = -1, texlump1a, texlump2a;
|
||||
int count = 0;
|
||||
int pfile = -1;
|
||||
|
||||
while ((lump = Wads.FindLump ("PNAMES", &lastlump)) != -1)
|
||||
int wadcount = Wads.GetNumWads();
|
||||
for (int wadnum = 0; wadnum < wadcount; wadnum++)
|
||||
{
|
||||
pfile = Wads.GetLumpFile (lump);
|
||||
count += R_CountLumpTextures (lump);
|
||||
texlump1 = Wads.CheckNumForName ("TEXTURE1", ns_global, pfile);
|
||||
texlump2 = Wads.CheckNumForName ("TEXTURE2", ns_global, pfile);
|
||||
// Use the most recent PNAMES for this WAD.
|
||||
// Multiple PNAMES in a WAD will be ignored.
|
||||
int pnames = Wads.CheckNumForName("PNAMES", ns_global, wadnum, false);
|
||||
|
||||
// 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 (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;
|
||||
}
|
||||
|
||||
|
@ -502,12 +502,24 @@ void R_PrecacheLevel (void)
|
|||
delete[] hitlist;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_GetColumn
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
const BYTE *R_GetColumn (FTexture *tex, int col)
|
||||
{
|
||||
return tex->GetColumn (col, NULL);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Debug stuff
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Prints the spans generated for a texture. Only needed for debugging.
|
||||
CCMD (printspans)
|
||||
|
|
|
@ -764,11 +764,7 @@ public:
|
|||
int texnum = GetTexture (texname, FTexture::TEX_MiscPatch);
|
||||
return Textures[texnum].Texture;
|
||||
}
|
||||
FTexture *FindTexture(const char *texname, int usetype = FTexture::TEX_MiscPatch, BITFIELD flags = TEXMAN_TryAny)
|
||||
{
|
||||
int texnum = GetTexture (texname, usetype, flags);
|
||||
return Textures[texnum].Texture;
|
||||
}
|
||||
FTexture *FindTexture(const char *texname, int usetype = FTexture::TEX_MiscPatch, BITFIELD flags = TEXMAN_TryAny);
|
||||
|
||||
// Get texture with translation
|
||||
FTexture *operator() (int texnum)
|
||||
|
|
|
@ -53,6 +53,12 @@
|
|||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: FMultiPatchTexture
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchlookup, int maxpatchnum, bool strife)
|
||||
: Pixels (0), Spans(0), Parts(0), bRedirect(false)
|
||||
{
|
||||
|
@ -155,6 +161,12 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: ~FMultiPatchTexture
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FMultiPatchTexture::~FMultiPatchTexture ()
|
||||
{
|
||||
Unload ();
|
||||
|
@ -170,6 +182,12 @@ FMultiPatchTexture::~FMultiPatchTexture ()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: SetFrontSkyLayer
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FMultiPatchTexture::SetFrontSkyLayer ()
|
||||
{
|
||||
for (int i = 0; i < NumParts; ++i)
|
||||
|
@ -179,6 +197,12 @@ void FMultiPatchTexture::SetFrontSkyLayer ()
|
|||
bNoRemap0 = true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: Unload
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FMultiPatchTexture::Unload ()
|
||||
{
|
||||
if (Pixels != NULL)
|
||||
|
@ -188,6 +212,12 @@ void FMultiPatchTexture::Unload ()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: GetPixels
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
const BYTE *FMultiPatchTexture::GetPixels ()
|
||||
{
|
||||
if (bRedirect)
|
||||
|
@ -201,6 +231,12 @@ const BYTE *FMultiPatchTexture::GetPixels ()
|
|||
return Pixels;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: GetColumn
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
const BYTE *FMultiPatchTexture::GetColumn (unsigned int column, const Span **spans_out)
|
||||
{
|
||||
if (bRedirect)
|
||||
|
@ -229,6 +265,12 @@ const BYTE *FMultiPatchTexture::GetColumn (unsigned int column, const Span **spa
|
|||
return Pixels + column*Height;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: MakeTexture
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FMultiPatchTexture::MakeTexture ()
|
||||
{
|
||||
// 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 ()
|
||||
{
|
||||
if (NumParts <= 0)
|
||||
|
@ -393,6 +441,14 @@ int FMultiPatchTexture::CopyTrueColorPixels(BYTE *buffer, int buf_pitch, int buf
|
|||
return retv;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: GetFormat
|
||||
//
|
||||
// only returns 'paletted' if all patches use the base palette.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureFormat FMultiPatchTexture::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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
int firstdup = (int)Textures.Size();
|
||||
|
|
|
@ -220,6 +220,18 @@ int FTextureManager::GetTexture (const char *name, int usetype, BITFIELD flags)
|
|||
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
|
||||
|
@ -627,7 +639,8 @@ void FTextureManager::AddPatches (int lumpnum)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_InitTextures
|
||||
// FTextureManager :: LoadTexturesX
|
||||
//
|
||||
// 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 texlump2 = Wads.CheckNumForName ("TEXTURE2", ns_global, wadnum);
|
||||
TexMan.AddTexturesLumps (texlump1, texlump2, pnames);
|
||||
AddTexturesLumps (texlump1, texlump2, pnames);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -779,4 +792,4 @@ void FTextureManager::Init()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.";
|
||||
|
||||
// Quit Strife messages
|
||||
QUITMSG15 = "where are you going?! what about the rebellion?";
|
||||
QUITMSG16 = "carnage interrupted... what a tease!";
|
||||
QUITMSG17 = "but you're the hope -- my only chance!!";
|
||||
QUITMSG15 = "where are you going?!\nwhat about the rebellion?";
|
||||
QUITMSG16 = "carnage interrupted...\nwhat a tease!";
|
||||
QUITMSG17 = "but you're the hope\n-- my only chance!!";
|
||||
QUITMSG18 = "nobody walks out on blackbird.";
|
||||
QUITMSG19 = "i thought you were different...";
|
||||
QUITMSG20 = "fine! just kill and run!";
|
||||
QUITMSG21 = "you can quit...but you can't hide...";
|
||||
QUITMSG22 = "whaaa, what's the matter? mommy says dinnertime?";
|
||||
QUITMSG21 = "you can quit...\nbut you can't hide...";
|
||||
QUITMSG22 = "whaaa, what's the matter?\nmommy says dinnertime?";
|
||||
|
||||
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.";
|
||||
|
|
Loading…
Reference in a new issue