Merge branch 'master' into newrenderer2

# Conflicts:
#	source/build/include/build.h
#	source/build/src/polymost.cpp
#	source/build/src/voxmodel.cpp
#	source/core/gamecontrol.cpp
#	source/core/gamestruct.h
#	source/games/blood/src/animatesprite.cpp
#	source/games/blood/src/misc.h
#	source/games/blood/src/view.cpp
#	source/games/duke/src/render.cpp
#	source/games/sw/src/draw.cpp
#	source/games/sw/src/game.h
#	source/games/sw/src/jsector.cpp
#	source/glbackend/glbackend.cpp
This commit is contained in:
Christoph Oelckers 2021-04-11 13:56:10 +02:00
commit 42d02834b1
58 changed files with 962 additions and 912 deletions

View file

@ -1046,6 +1046,7 @@ set (PCH_SOURCES
core/gameconfigfile.cpp core/gameconfigfile.cpp
core/gamecvars.cpp core/gamecvars.cpp
core/gamecontrol.cpp core/gamecontrol.cpp
core/gamehud.cpp
core/gamefuncs.cpp core/gamefuncs.cpp
core/gameinput.cpp core/gameinput.cpp
core/interpolate.cpp core/interpolate.cpp
@ -1060,6 +1061,7 @@ set (PCH_SOURCES
core/secrets.cpp core/secrets.cpp
core/compositesavegame.cpp core/compositesavegame.cpp
core/savegamehelp.cpp core/savegamehelp.cpp
core/precache.cpp
core/quotes.cpp core/quotes.cpp
core/screenshot.cpp core/screenshot.cpp
core/sectorgeometry.cpp core/sectorgeometry.cpp

View file

@ -557,7 +557,6 @@ inline int32_t spriteheightofs(int16_t i, int32_t *height, int32_t alsotileyofs)
int videoCaptureScreen(); int videoCaptureScreen();
void PrecacheHardwareTextures(int nTile);
void Polymost_Startup(); void Polymost_Startup();
EXTERN_CVAR(Bool, hw_animsmoothing) EXTERN_CVAR(Bool, hw_animsmoothing)
@ -706,9 +705,6 @@ extern int32_t rintersect(int32_t x1, int32_t y1, int32_t z1,
int32_t x3, int32_t y3, int32_t x4, int32_t y4, int32_t x3, int32_t y3, int32_t x4, int32_t y4,
int32_t *intx, int32_t *inty, int32_t *intz); int32_t *intx, int32_t *inty, int32_t *intz);
void markTileForPrecache(int tilenum, int palnum);
void precacheMarkedTiles();
extern int32_t(*animateoffs_replace)(int const tilenum, int fakevar); extern int32_t(*animateoffs_replace)(int const tilenum, int fakevar);
extern void(*initspritelists_replace)(void); extern void(*initspritelists_replace)(void);
extern int32_t(*insertsprite_replace)(int16_t sectnum, int16_t statnum); extern int32_t(*insertsprite_replace)(int16_t sectnum, int16_t statnum);

View file

@ -27,7 +27,6 @@ void polymost_initosdfuncs(void);
void polymost_drawrooms(void); void polymost_drawrooms(void);
void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang, fixed_t dahoriz, int16_t mirrorWall); void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang, fixed_t dahoriz, int16_t mirrorWall);
void polymost_completeMirror(); void polymost_completeMirror();
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);
void polymost_deletesprite(int num); void polymost_deletesprite(int num);
int32_t polymost_maskWallHasTranslucency(walltype const * const wall); int32_t polymost_maskWallHasTranslucency(walltype const * const wall);

View file

@ -132,7 +132,6 @@ static int32_t r_parallaxskyclamping = 1;
#define Bfabsf fabsf #define Bfabsf fabsf
static int32_t drawingskybox = 0; static int32_t drawingskybox = 0;
static int32_t hicprecaching = 0;
static hitdata_t polymost_hitdata; static hitdata_t polymost_hitdata;
@ -1921,7 +1920,7 @@ void polymost_scansector(int32_t sectnum)
{ {
if ((spr->cstat&(64+48))!=(64+16) || if ((spr->cstat&(64+48))!=(64+16) ||
(r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) || (r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) ||
(r_voxels && gi->Voxelize(spr->picnum)) || (r_voxels && gi->Voxelize(spr->picnum) > -1) ||
DMulScale(bcos(spr->ang), -s.x, bsin(spr->ang), -s.y, 6) > 0) DMulScale(bcos(spr->ang), -s.x, bsin(spr->ang), -s.y, 6) > 0)
if (renderAddTsprite(pm_tsprite, pm_spritesortcnt, z, sectnum)) if (renderAddTsprite(pm_tsprite, pm_spritesortcnt, z, sectnum))
break; break;
@ -3262,39 +3261,6 @@ _drawsprite_return:
static_assert((int)RS_YFLIP == (int)HUDFLAG_FLIPPED); static_assert((int)RS_YFLIP == (int)HUDFLAG_FLIPPED);
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
{
// dapicnum and dapalnum are like you'd expect
// datype is 0 for a wall/floor/ceiling and 1 for a sprite
// basically this just means walls are repeating
// while sprites are clamped
if ((dapalnum < (MAXPALOOKUPS - RESERVEDPALS)) && (!lookups.checkTable(dapalnum))) return;//dapalnum = 0;
//Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);
hicprecaching = 1;
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
auto tex = tileGetTexture(dapicnum);
if (tex->isValid())
GLInterface.SetTexture(tex, palid, CLAMP_NONE);
hicprecaching = 0;
if (datype == 0 || !hw_models) return;
int const mid = md_tilehasmodel(dapicnum, dapalnum);
if (mid < 0 || models[mid]->mdnum < 2) return;
int const surfaces = (models[mid]->mdnum == 3) ? ((md3model_t*)models[mid])->head.numsurfs : 0;
for (int i = 0; i <= surfaces; i++)
{
auto tex = mdloadskin((md2model_t*)models[mid], 0, dapalnum, i, nullptr);
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
if (tex) GLInterface.SetTexture(tex, palid, CLAMP_NONE);
}
}
} }
@ -3787,15 +3753,6 @@ void renderDrawMasks(void)
} }
void PrecacheHardwareTextures(int nTile)
{
// PRECACHE
// This really *really* needs improvement on the game side - the entire precaching logic has no clue about the different needs of a hardware renderer.
Polymost::polymost_precache(nTile, 0, 1);
}
// //
// setrollangle // setrollangle
// //

View file

@ -728,9 +728,6 @@ static TArray<GrpEntry> SetupGame()
if (groupno == -1) return TArray<GrpEntry>(); if (groupno == -1) return TArray<GrpEntry>();
auto& group = groups[groupno]; auto& group = groups[groupno];
if (GameStartupInfo.Name.IsNotEmpty()) I_SetWindowTitle(GameStartupInfo.Name);
else I_SetWindowTitle(group.FileInfo.name);
// Now filter out the data we actually need and delete the rest. // Now filter out the data we actually need and delete the rest.
usedgroups.Push(group); usedgroups.Push(group);
@ -829,6 +826,8 @@ void CreateStatusBar()
int RunGame() int RunGame()
{ {
GameStartupInfo.FgColor = 0xffffff;
// Set up the console before anything else so that it can receive text. // Set up the console before anything else so that it can receive text.
C_InitConsole(1024, 768, true); C_InitConsole(1024, 768, true);
@ -847,6 +846,19 @@ int RunGame()
G_LoadConfig(); G_LoadConfig();
auto usedgroups = SetupGame(); auto usedgroups = SetupGame();
for (auto& grp : usedgroups)
{
if (grp.FileInfo.name.IsNotEmpty())
{
if (GameStartupInfo.Name.IsEmpty()) GameStartupInfo.Name = grp.FileInfo.name;
if (grp.FileInfo.FgColor != grp.FileInfo.BgColor && (GameStartupInfo.FgColor != 0 || GameStartupInfo.BkColor != 0))
{
GameStartupInfo.FgColor = grp.FileInfo.FgColor;
GameStartupInfo.BkColor = grp.FileInfo.BgColor;
}
}
}
I_SetIWADInfo();
InitFileSystem(usedgroups); InitFileSystem(usedgroups);
if (usedgroups.Size() == 0) return 0; if (usedgroups.Size() == 0) return 0;
@ -880,7 +892,8 @@ int RunGame()
V_InitScreenSize(); V_InitScreenSize();
V_InitScreen(); V_InitScreen();
StartScreen = FStartupScreen::CreateInstance(100); StartScreen = FStartupScreen::CreateInstance(8);
StartScreen->Progress();
TArray<FString> addArt; TArray<FString> addArt;
for (auto& grp : usedgroups) for (auto& grp : usedgroups)
@ -910,15 +923,20 @@ int RunGame()
GameTicRate = 30; GameTicRate = 30;
CheckUserMap(); CheckUserMap();
GPalette.Init(MAXPALOOKUPS + 2); // one slot for each translation, plus a separate one for the base palettes and the internal one GPalette.Init(MAXPALOOKUPS + 2); // one slot for each translation, plus a separate one for the base palettes and the internal one
StartScreen->Progress();
TexMan.Init([]() {}, [](BuildInfo &) {}); TexMan.Init([]() {}, [](BuildInfo &) {});
V_InitFonts(); V_InitFonts();
StartScreen->Progress();
TileFiles.Init(); TileFiles.Init();
StartScreen->Progress();
I_InitSound(); I_InitSound();
StartScreen->Progress();
Mus_InitMusic(); Mus_InitMusic();
S_ParseSndInfo(); S_ParseSndInfo();
S_ParseReverbDef(); S_ParseReverbDef();
InitStatistics(); InitStatistics();
LoadScripts(); LoadScripts();
StartScreen->Progress();
SetDefaultStrings(); SetDefaultStrings();
if (Args->CheckParm("-sounddebug")) if (Args->CheckParm("-sounddebug"))
C_DoCommand("stat sounddebug"); C_DoCommand("stat sounddebug");
@ -926,6 +944,7 @@ int RunGame()
enginePreInit(); enginePreInit();
SetupGameButtons(); SetupGameButtons();
gameinfo.mBackButton = "engine/graphics/m_back.png"; gameinfo.mBackButton = "engine/graphics/m_back.png";
StartScreen->Progress();
GPalette.Init(MAXPALOOKUPS + 1); // one slot for each translation, plus a separate one for the base palettes. GPalette.Init(MAXPALOOKUPS + 1); // one slot for each translation, plus a separate one for the base palettes.
gi->loadPalette(); gi->loadPalette();
@ -933,10 +952,12 @@ int RunGame()
TileFiles.LoadArtSet("tiles%03d.art"); // it's the same for all games. TileFiles.LoadArtSet("tiles%03d.art"); // it's the same for all games.
engineInit(); engineInit();
gi->app_init(); gi->app_init();
StartScreen->Progress();
CreateStatusBar(); CreateStatusBar();
SetDefaultMenuColors(); SetDefaultMenuColors();
M_Init(); M_Init();
BuildGameMenus(); BuildGameMenus();
StartScreen->Progress();
if (!(paletteloaded & PALETTE_MAIN)) if (!(paletteloaded & PALETTE_MAIN))
I_FatalError("No palette found."); I_FatalError("No palette found.");
@ -945,6 +966,7 @@ int RunGame()
PostLoadSetup(); PostLoadSetup();
lookups.postLoadLookups(); lookups.postLoadLookups();
FMaterial::SetLayerCallback(setpalettelayer); FMaterial::SetLayerCallback(setpalettelayer);
if (GameStartupInfo.Name.IsNotEmpty()) I_SetWindowTitle(GameStartupInfo.Name);
V_Init2(); V_Init2();
twod->Begin(screen->GetWidth(), screen->GetHeight()); twod->Begin(screen->GetWidth(), screen->GetHeight());

View file

@ -150,6 +150,7 @@ struct GrpInfo
TArray<FString> tobedeleted; TArray<FString> tobedeleted;
TArray<FString> loadfiles; TArray<FString> loadfiles;
TArray<FString> loadart; TArray<FString> loadart;
uint32_t FgColor = 0, BgColor = 0;
}; };

140
source/core/gamehud.cpp Normal file
View file

@ -0,0 +1,140 @@
/*
** gamehud.cpp
**
** Management of HUD elements
**
**---------------------------------------------------------------------------
** Copyright 2019-2021 Christoph Oelckers
** 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 <memory>
#include <assert.h>
#include "gamehud.h"
#include "textures.h"
#include "palette.h"
#include "gamecontrol.h"
#include "v_2ddrawer.h"
#include "v_video.h"
#include "build.h"
#include "v_draw.h"
#include "v_font.h"
#include "gamestruct.h"
#include "gamefuncs.h"
F2DDrawer twodpsp;
void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha)
{
double dz = z / 65536.;
alpha *= (dastat & RS_TRANS1)? glblend[0].def[!!(dastat & RS_TRANS2)].alpha : 1.;
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
if (picanm[picnum].sf & PICANM_ANIMTYPE_MASK)
picnum += animateoffs(picnum, 0);
auto tex = tileGetTexture(picnum);
DrawTexture(&twodpsp, tex, sx, sy,
DTA_ScaleX, dz, DTA_ScaleY, dz,
DTA_Color, shadeToLight(dashade),
DTA_TranslationIndex, palid,
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y,
DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1,
DTA_FullscreenScale, (dastat & RS_STRETCH)? FSMode_ScaleToScreen: FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffsetRel, !(dastat & (RS_TOPLEFT | RS_CENTER)),
DTA_TopLeft, !!(dastat & RS_TOPLEFT),
DTA_CenterOffset, !!(dastat & RS_CENTER),
DTA_FlipX, !!(dastat & RS_XFLIPHUD),
DTA_FlipY, !!(dastat & RS_YFLIPHUD),
DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0,
DTA_Rotate, a * -BAngToDegree,
DTA_FlipOffsets, !(dastat & (/*RS_TOPLEFT |*/ RS_CENTER)),
DTA_Alpha, alpha,
TAG_DONE);
}
//==========================================================================
//
// DFrameBuffer :: DrawRateStuff
//
// Draws the fps counter, dot ticker, and palette debug.
//
//==========================================================================
CVAR(Bool, vid_fps, false, 0)
static FString statFPS()
{
static int32_t frameCount;
static double lastFrameTime;
static double cumulativeFrameDelay;
static double lastFPS;
FString output;
double frameTime = I_msTimeF();
double frameDelay = frameTime - lastFrameTime;
cumulativeFrameDelay += frameDelay;
frameCount++;
if (frameDelay >= 0)
{
output.AppendFormat("%5.1f fps (%.1f ms)\n", lastFPS, frameDelay);
if (cumulativeFrameDelay >= 1000.0)
{
lastFPS = 1000. * frameCount / cumulativeFrameDelay;
frameCount = 0;
cumulativeFrameDelay = 0.0;
}
}
lastFrameTime = frameTime;
return output;
}
void DrawRateStuff()
{
// Draws frame time and cumulative fps
if (vid_fps)
{
FString fpsbuff = statFPS();
int textScale = active_con_scale(twod);
int rate_x = screen->GetWidth() / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]);
twod->AddColorOnlyQuad(rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, MAKEARGB(255, 0, 0, 0));
DrawText(twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char*)&fpsbuff[0],
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}

8
source/core/gamehud.h Normal file
View file

@ -0,0 +1,8 @@
#pragma once
#include "v_2ddrawer.h"
extern F2DDrawer twodpsp;
void DrawRateStuff();
void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha = 1);

View file

@ -121,7 +121,7 @@ struct GameInterface
virtual void EnterPortal(spritetype* viewer, int type) {} virtual void EnterPortal(spritetype* viewer, int type) {}
virtual void LeavePortal(spritetype* viewer, int type) {} virtual void LeavePortal(spritetype* viewer, int type) {}
virtual bool GetGeoEffect(GeoEffect* eff, int viewsector) { return false; } virtual bool GetGeoEffect(GeoEffect* eff, int viewsector) { return false; }
virtual bool Voxelize(int sprnum) { return false; } virtual int Voxelize(int sprnum) { return -1; }
virtual FString statFPS() virtual FString statFPS()
{ {

View file

@ -88,6 +88,7 @@
#include "gamestruct.h" #include "gamestruct.h"
#include "savegamehelp.h" #include "savegamehelp.h"
#include "v_draw.h" #include "v_draw.h"
#include "gamehud.h"
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, r_ticstability, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, r_ticstability, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)

View file

@ -268,16 +268,13 @@ void LookupTableInfo::postLoadLookups()
{ {
const uint8_t* lookup = (uint8_t*)tables[l].Shades.GetChars(); const uint8_t* lookup = (uint8_t*)tables[l].Shades.GetChars();
FRemapTable remap; FRemapTable remap;
if (i == 0 || (palette != basepalette && !palette->TwodOnly)) memcpy(remap.Remap, lookup, 256);
for (int j = 0; j < 256; j++)
{ {
memcpy(remap.Remap, lookup, 256); remap.Palette[j] = palette->Palette[remap.Remap[j]];
for (int j = 0; j < 256; j++)
{
remap.Palette[j] = palette->Palette[remap.Remap[j]];
}
remap.NumEntries = 256;
GPalette.UpdateTranslation(TRANSLATION(i + Translation_Remap, l), &remap);
} }
remap.NumEntries = 256;
GPalette.UpdateTranslation(TRANSLATION(i + Translation_Remap, l), &remap);
} }
} }
} }

134
source/core/precache.cpp Normal file
View file

@ -0,0 +1,134 @@
/*
** precache.cpp
**
**
**
**---------------------------------------------------------------------------
** Copyright 2019-2021 Christoph Oelckers
** 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 "ns.h"
#include "build.h"
#include "palette.h"
#include "v_video.h"
#include "hw_material.h"
#include "gamestruct.h"
#include "gamecontrol.h"
#include "hw_models.h"
#include "hw_voxels.h"
BEGIN_BLD_NS
extern short voxelIndex[MAXTILES];
END_BLD_NS
static void PrecacheTex(FGameTexture* tex, int palid)
{
if (!tex || !tex->isValid()) return;
int scaleflags = 0;
if (shouldUpscale(tex, UF_Texture)) scaleflags |= CTF_Upscale;
auto mat = FMaterial::ValidateTexture(tex, scaleflags);
screen->PrecacheMaterial(mat, palid);
}
static void doprecache(int picnum, int palette)
{
if ((palette < (MAXPALOOKUPS - RESERVEDPALS)) && (!lookups.checkTable(palette))) return;
int palid = TRANSLATION(Translation_Remap + curbasepal, palette);
auto tex = tileGetTexture(picnum);
PrecacheTex(tex, palid);
if (!hw_models) return;
int const mid = md_tilehasmodel(picnum, palette);
if (mid < 0 || models[mid]->mdnum < 2)
{
if (r_voxels)
{
int vox = tiletovox[picnum];
if (vox == -1) vox = gi->Voxelize(picnum);
if (vox == -1 && isBlood()) vox = Blood::voxelIndex[picnum];
if (vox >= 0 && vox < MAXVOXELS && voxmodels[vox] && voxmodels[vox]->model)
{
FHWModelRenderer mr(*screen->RenderState(), 0);
voxmodels[vox]->model->BuildVertexBuffer(&mr);
}
}
return;
}
int const surfaces = (models[mid]->mdnum == 3) ? ((md3model_t *)models[mid])->head.numsurfs : 0;
for (int i = 0; i <= surfaces; i++)
{
auto tex = mdloadskin((md2model_t *)models[mid], 0, palette, i, nullptr);
int palid = TRANSLATION(Translation_Remap + curbasepal, palette);
if (tex) PrecacheTex(tex, palid);
}
}
TMap<int64_t, bool> cachemap;
void markTileForPrecache(int tilenum, int palnum)
{
int i, j;
if ((picanm[tilenum].sf & PICANM_ANIMTYPE_MASK) == PICANM_ANIMTYPE_BACK)
{
i = tilenum - picanm[tilenum].num;
j = tilenum;
}
else
{
i = tilenum;
j = tilenum + picanm[tilenum].num;
}
for (; i <= j; i++)
{
int64_t val = i + (int64_t(palnum) << 32);
cachemap.Insert(val, true);
}
}
void precacheMarkedTiles()
{
screen->StartPrecaching();
decltype(cachemap)::Iterator it(cachemap);
decltype(cachemap)::Pair* pair;
while (it.NextPair(pair))
{
int dapicnum = pair->Key & 0x7fffffff;
int dapalnum = pair->Key >> 32;
doprecache(dapicnum, dapalnum);
}
cachemap.Clear();
}

6
source/core/precache.h Normal file
View file

@ -0,0 +1,6 @@
#pragma once
void PrecacheHardwareTextures(int nTile);
void markTileForPrecache(int tilenum, int palnum);
void markVoxelForPrecache(int voxnum);
void precacheMarkedTiles();

View file

@ -464,7 +464,7 @@ void BunchDrawer::ProcessSector(int sectnum, bool portal)
{ {
if ((spr->cstat & (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_ALIGNMENT_MASK)) != (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_ALIGNMENT_WALL) || if ((spr->cstat & (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_ALIGNMENT_MASK)) != (CSTAT_SPRITE_ONE_SIDED | CSTAT_SPRITE_ALIGNMENT_WALL) ||
(r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) || (r_voxels && tiletovox[spr->picnum] >= 0 && voxmodels[tiletovox[spr->picnum]]) ||
(r_voxels && gi->Voxelize(spr->picnum)) || (r_voxels && gi->Voxelize(spr->picnum) > -1) ||
DMulScale(bcos(spr->ang), -sx, bsin(spr->ang), -sy, 6) > 0) DMulScale(bcos(spr->ang), -sx, bsin(spr->ang), -sy, 6) > 0)
if (renderAddTsprite(di->tsprite, di->spritesortcnt, z, sectnum)) if (renderAddTsprite(di->tsprite, di->spritesortcnt, z, sectnum))
break; break;

View file

@ -460,6 +460,16 @@ static TArray<GrpInfo> ParseGrpInfo(const char *fn, FileReader &fr, TMap<FString
sc.MustGetToken(TK_StringConst); sc.MustGetToken(TK_StringConst);
grp.gamefilter = sc.String; grp.gamefilter = sc.String;
} }
else if (sc.Compare("fgcolor"))
{
sc.MustGetToken(TK_IntConst);
grp.FgColor = sc.Number;
}
else if (sc.Compare("bkcolor"))
{
sc.MustGetToken(TK_IntConst);
grp.BgColor = sc.Number;
}
else if (sc.Compare("crc")) else if (sc.Compare("crc"))
{ {
sc.MustGetAnyToken(); sc.MustGetAnyToken();

View file

@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "SmackerDecoder.h" #include "SmackerDecoder.h"
#include "blood.h" #include "blood.h"
#include "animtexture.h" #include "animtexture.h"
#include "../glbackend/glbackend.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "screenjob.h" #include "screenjob.h"

View file

@ -69,7 +69,7 @@ CGameMenuItemQAV::CGameMenuItemQAV(int a3, int a4, const char* name, bool widesc
data->nSprite = -1; data->nSprite = -1;
data->x = m_nX; data->x = m_nX;
data->y = m_nY; data->y = m_nY;
data->Preload(); //data->Preload();
duration = data->duration; duration = data->duration;
lastTick = I_GetBuildTime(); lastTick = I_GetBuildTime();
} }

View file

@ -345,13 +345,13 @@ void fxSpawnEjectingShell(spritetype *pSprite, int z, int a3, int a4)
} }
} }
void fxPrecache(HitList &hits) void fxPrecache()
{ {
for (int i = 0; i < kFXMax; i++) for (int i = 0; i < kFXMax; i++)
{ {
tilePrecacheTile(gFXData[i].at12, 0, hits); tilePrecacheTile(gFXData[i].at12, 0, 0);
if (gFXData[i].at2) if (gFXData[i].at2)
seqPrecacheId(gFXData[i].at2, hits); seqPrecacheId(gFXData[i].at2, 0);
} }
} }

View file

@ -501,7 +501,7 @@ void GibWall(int nWall, GIBTYPE nGibType, CGibVelocity *pVel)
} }
} }
void gibPrecache(HitList &hits) void gibPrecache()
{ {
for (int i = 0; i < kGibMax; i++) for (int i = 0; i < kGibMax; i++)
{ {
@ -511,7 +511,7 @@ void gibPrecache(HitList &hits)
for (int j = 0; j < gibList[i].atc; j++) for (int j = 0; j < gibList[i].atc; j++)
{ {
if (pThing[j].Kills >= 0) if (pThing[j].Kills >= 0)
tilePrecacheTile(pThing[j].Kills, -1, hits); tilePrecacheTile(pThing[j].Kills, -1, 0);
} }
} }
} }

View file

@ -37,7 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gstrings.h" #include "gstrings.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "v_video.h" #include "v_video.h"
#include "glbackend/glbackend.h" #include "gamehud.h"
BEGIN_BLD_NS BEGIN_BLD_NS

View file

@ -27,8 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
using HitList = FixedBitArray<MAXTILES>;
void playlogos(); void playlogos();
unsigned int qrand(void); unsigned int qrand(void);
int wrand(void); int wrand(void);
@ -55,7 +53,7 @@ char WeaponUpgrade(PLAYER *pPlayer, char newWeapon);
void WeaponProcess(PLAYER *pPlayer); void WeaponProcess(PLAYER *pPlayer);
void WeaponUpdateState(PLAYER* pPlayer); void WeaponUpdateState(PLAYER* pPlayer);
void teslaHit(spritetype *pMissile, int a2); void teslaHit(spritetype *pMissile, int a2);
void WeaponPrecache(HitList &hits); void WeaponPrecache();
struct ZONE { struct ZONE {
int x, y, z; int x, y, z;
@ -122,8 +120,7 @@ extern short voxelIndex[MAXTILES];
extern int nPrecacheCount; extern int nPrecacheCount;
int tileInit(char a1, const char *a2); int tileInit(char a1, const char *a2);
void tilePreloadTile(int nTile); void tilePrecacheTile(int nTile, int nType, int palette);
void tilePrecacheTile(int nTile, int nType, HitList& hits);
char tileGetSurfType(int hit); char tileGetSurfType(int hit);

View file

@ -1325,7 +1325,7 @@ void trPlayerCtrlStartScene(XSPRITE* pXSource, PLAYER* pPlayer, bool force) {
pCtrl->qavScene.qavResrc = pQav; pCtrl->qavScene.qavResrc = pQav;
pCtrl->qavScene.dummy = -1; pCtrl->qavScene.dummy = -1;
pCtrl->qavScene.qavResrc->Preload(); //pCtrl->qavScene.qavResrc->Preload();
pPlayer->sceneQav = pXSource->data2; pPlayer->sceneQav = pXSource->data2;
pPlayer->weaponTimer = pCtrl->qavScene.qavResrc->duration; pPlayer->weaponTimer = pCtrl->qavScene.qavResrc->duration;

View file

@ -2319,7 +2319,7 @@ void SerializePlayers(FSerializer& arc)
if (pQav) if (pQav)
{ {
gPlayerCtrl[i].qavScene.qavResrc = pQav; gPlayerCtrl[i].qavScene.qavResrc = pQav;
gPlayerCtrl[i].qavScene.qavResrc->Preload(); //gPlayerCtrl[i].qavScene.qavResrc->Preload();
} }
else else
{ {

View file

@ -38,7 +38,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "v_video.h" #include "v_video.h"
#include "v_font.h" #include "v_font.h"
#include "glbackend/glbackend.h"
BEGIN_BLD_NS BEGIN_BLD_NS

View file

@ -26,62 +26,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "blood.h" #include "blood.h"
#include "view.h" #include "view.h"
#include "g_input.h" #include "g_input.h"
#include "precache.h"
BEGIN_BLD_NS BEGIN_BLD_NS
int nPrecacheCount; int nPrecacheCount;
void fxPrecache(HitList &hits); void fxPrecache();
void gibPrecache(HitList &hits); void gibPrecache();
void tilePreloadTile(int nTile) void tilePrecacheTile(int nTile, int nType, int palette)
{
if (!r_precache) return;
int n = 1;
switch (picanm[nTile].extra & 7)
{
case 0:
n = 1;
break;
case 1:
n = 5;
break;
case 2:
n = 8;
break;
case 3:
n = 2;
break;
case 6:
case 7:
if (voxelIndex[nTile] < 0 || voxelIndex[nTile] >= kMaxVoxels)
{
voxelIndex[nTile] = -1;
picanm[nTile].extra &= ~7;
}
break;
}
while (n--)
{
if (picanm[nTile].sf & PICANM_ANIMTYPE_MASK)
{
for (int frame = picanm[nTile].num; frame >= 0; frame--)
{
if ((picanm[nTile].sf & PICANM_ANIMTYPE_MASK) == PICANM_ANIMTYPE_BACK)
PrecacheHardwareTextures(nTile - frame);
else
PrecacheHardwareTextures(nTile + frame);
}
}
else
PrecacheHardwareTextures(nTile);
nTile += 1 + picanm[nTile].num;
}
}
void tilePrecacheTile(int nTile, int nType, HitList &hits)
{ {
int n = 1; int n = 1;
switch (picanm[nTile].extra & 7) switch (picanm[nTile].extra & 7)
@ -110,20 +65,13 @@ void tilePrecacheTile(int nTile, int nType, HitList &hits)
tile = nTile - frame; tile = nTile - frame;
else else
tile = nTile + frame; tile = nTile + frame;
if (!hits[tile])
{ markTileForPrecache(tile, palette);
nPrecacheCount++;
hits.Set(tile);
}
} }
} }
else else
{ {
if (!hits[nTile]) markTileForPrecache(nTile, palette);
{
nPrecacheCount++;
hits.Set(nTile);
}
} }
nTile += 1 + picanm[nTile].num; nTile += 1 + picanm[nTile].num;
} }
@ -132,34 +80,34 @@ void tilePrecacheTile(int nTile, int nType, HitList &hits)
// To do: This needs to handle the sprite palettes as well to properly precache the needed content. // To do: This needs to handle the sprite palettes as well to properly precache the needed content.
void viewPrecacheTiles(HitList &hits) void viewPrecacheTiles()
{ {
tilePrecacheTile(2173, 0, hits); tilePrecacheTile(2173, 0, 0);
tilePrecacheTile(2200, 0, hits); tilePrecacheTile(2200, 0, 0);
tilePrecacheTile(2201, 0, hits); tilePrecacheTile(2201, 0, 0);
tilePrecacheTile(2202, 0, hits); tilePrecacheTile(2202, 0, 0);
tilePrecacheTile(2207, 0, hits); tilePrecacheTile(2207, 0, 0);
tilePrecacheTile(2208, 0, hits); tilePrecacheTile(2208, 0, 0);
tilePrecacheTile(2209, 0, hits); tilePrecacheTile(2209, 0, 0);
tilePrecacheTile(2229, 0, hits); tilePrecacheTile(2229, 0, 0);
tilePrecacheTile(2260, 0, hits); tilePrecacheTile(2260, 0, 0);
tilePrecacheTile(2559, 0, hits); tilePrecacheTile(2559, 0, 0);
tilePrecacheTile(2169, 0, hits); tilePrecacheTile(2169, 0, 0);
tilePrecacheTile(2578, 0, hits); tilePrecacheTile(2578, 0, 0);
tilePrecacheTile(2586, 0, hits); tilePrecacheTile(2586, 0, 0);
tilePrecacheTile(2602, 0, hits); tilePrecacheTile(2602, 0, 0);
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
tilePrecacheTile(2190 + i, 0, hits); tilePrecacheTile(2190 + i, 0, 0);
tilePrecacheTile(2230 + i, 0, hits); tilePrecacheTile(2230 + i, 0, 0);
tilePrecacheTile(2240 + i, 0, hits); tilePrecacheTile(2240 + i, 0, 0);
tilePrecacheTile(2250 + i, 0, hits); tilePrecacheTile(2250 + i, 0, 0);
tilePrecacheTile(kSBarNumberHealth + i, 0, hits); tilePrecacheTile(kSBarNumberHealth + i, 0, 0);
tilePrecacheTile(kSBarNumberAmmo + i, 0, hits); tilePrecacheTile(kSBarNumberAmmo + i, 0, 0);
tilePrecacheTile(kSBarNumberInv + i, 0, hits); tilePrecacheTile(kSBarNumberInv + i, 0, 0);
tilePrecacheTile(kSBarNumberArmor1 + i, 0, hits); tilePrecacheTile(kSBarNumberArmor1 + i, 0, 0);
tilePrecacheTile(kSBarNumberArmor2 + i, 0, hits); tilePrecacheTile(kSBarNumberArmor2 + i, 0, 0);
tilePrecacheTile(kSBarNumberArmor3 + i, 0, hits); tilePrecacheTile(kSBarNumberArmor3 + i, 0, 0);
} }
/* /*
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
@ -170,54 +118,55 @@ void viewPrecacheTiles(HitList &hits)
*/ */
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
tilePrecacheTile(2220 + i, 0, hits); tilePrecacheTile(2220 + i, 0, 0);
tilePrecacheTile(2552 + i, 0, hits); tilePrecacheTile(2552 + i, 0, 0);
} }
} }
void PrecacheDude(spritetype *pSprite, HitList &hits) void PrecacheDude(spritetype *pSprite)
{ {
int palette = pSprite->pal;
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
seqPrecacheId(pDudeInfo->seqStartID , hits); seqPrecacheId(pDudeInfo->seqStartID , palette);
seqPrecacheId(pDudeInfo->seqStartID+5, hits); seqPrecacheId(pDudeInfo->seqStartID+5, palette);
seqPrecacheId(pDudeInfo->seqStartID+1, hits); seqPrecacheId(pDudeInfo->seqStartID+1, palette);
seqPrecacheId(pDudeInfo->seqStartID+2, hits); seqPrecacheId(pDudeInfo->seqStartID+2, palette);
switch (pSprite->type) switch (pSprite->type)
{ {
case kDudeCultistTommy: case kDudeCultistTommy:
case kDudeCultistShotgun: case kDudeCultistShotgun:
case kDudeCultistTesla: case kDudeCultistTesla:
case kDudeCultistTNT: case kDudeCultistTNT:
seqPrecacheId(pDudeInfo->seqStartID+6 , hits); seqPrecacheId(pDudeInfo->seqStartID+6 , palette);
seqPrecacheId(pDudeInfo->seqStartID+7 , hits); seqPrecacheId(pDudeInfo->seqStartID+7 , palette);
seqPrecacheId(pDudeInfo->seqStartID+8 , hits); seqPrecacheId(pDudeInfo->seqStartID+8 , palette);
seqPrecacheId(pDudeInfo->seqStartID+9 , hits); seqPrecacheId(pDudeInfo->seqStartID+9 , palette);
seqPrecacheId(pDudeInfo->seqStartID+13, hits); seqPrecacheId(pDudeInfo->seqStartID+13, palette);
seqPrecacheId(pDudeInfo->seqStartID+14, hits); seqPrecacheId(pDudeInfo->seqStartID+14, palette);
seqPrecacheId(pDudeInfo->seqStartID+15, hits); seqPrecacheId(pDudeInfo->seqStartID+15, palette);
break; break;
case kDudeZombieButcher: case kDudeZombieButcher:
case kDudeGillBeast: case kDudeGillBeast:
seqPrecacheId(pDudeInfo->seqStartID+6, hits); seqPrecacheId(pDudeInfo->seqStartID+6, palette);
seqPrecacheId(pDudeInfo->seqStartID+7, hits); seqPrecacheId(pDudeInfo->seqStartID+7, palette);
seqPrecacheId(pDudeInfo->seqStartID+8, hits); seqPrecacheId(pDudeInfo->seqStartID+8, palette);
seqPrecacheId(pDudeInfo->seqStartID+9, hits); seqPrecacheId(pDudeInfo->seqStartID+9, palette);
seqPrecacheId(pDudeInfo->seqStartID+10, hits); seqPrecacheId(pDudeInfo->seqStartID+10, palette);
seqPrecacheId(pDudeInfo->seqStartID+11, hits); seqPrecacheId(pDudeInfo->seqStartID+11, palette);
break; break;
case kDudeGargoyleStatueFlesh: case kDudeGargoyleStatueFlesh:
case kDudeGargoyleStatueStone: case kDudeGargoyleStatueStone:
seqPrecacheId(pDudeInfo->seqStartID+6, hits); seqPrecacheId(pDudeInfo->seqStartID+6, palette);
seqPrecacheId(pDudeInfo->seqStartID+6, hits); //??? seqPrecacheId(pDudeInfo->seqStartID+6, palette); //???
fallthrough__; fallthrough__;
case kDudeGargoyleFlesh: case kDudeGargoyleFlesh:
case kDudeGargoyleStone: case kDudeGargoyleStone:
seqPrecacheId(pDudeInfo->seqStartID+6, hits); seqPrecacheId(pDudeInfo->seqStartID+6, palette);
seqPrecacheId(pDudeInfo->seqStartID+7, hits); seqPrecacheId(pDudeInfo->seqStartID+7, palette);
seqPrecacheId(pDudeInfo->seqStartID+8, hits); seqPrecacheId(pDudeInfo->seqStartID+8, palette);
seqPrecacheId(pDudeInfo->seqStartID+9, hits); seqPrecacheId(pDudeInfo->seqStartID+9, palette);
break; break;
case kDudePhantasm: case kDudePhantasm:
case kDudeHellHound: case kDudeHellHound:
@ -226,88 +175,89 @@ void PrecacheDude(spritetype *pSprite, HitList &hits)
case kDudeSpiderBlack: case kDudeSpiderBlack:
case kDudeSpiderMother: case kDudeSpiderMother:
case kDudeTchernobog: case kDudeTchernobog:
seqPrecacheId(pDudeInfo->seqStartID+6, hits); seqPrecacheId(pDudeInfo->seqStartID+6, palette);
seqPrecacheId(pDudeInfo->seqStartID+7, hits); seqPrecacheId(pDudeInfo->seqStartID+7, palette);
seqPrecacheId(pDudeInfo->seqStartID+8, hits); seqPrecacheId(pDudeInfo->seqStartID+8, palette);
break; break;
case kDudeCerberusTwoHead: case kDudeCerberusTwoHead:
seqPrecacheId(pDudeInfo->seqStartID+6, hits); seqPrecacheId(pDudeInfo->seqStartID+6, palette);
seqPrecacheId(pDudeInfo->seqStartID+7, hits); seqPrecacheId(pDudeInfo->seqStartID+7, palette);
fallthrough__; fallthrough__;
case kDudeHand: case kDudeHand:
case kDudeBoneEel: case kDudeBoneEel:
case kDudeBat: case kDudeBat:
case kDudeRat: case kDudeRat:
seqPrecacheId(pDudeInfo->seqStartID+6, hits); seqPrecacheId(pDudeInfo->seqStartID+6, palette);
seqPrecacheId(pDudeInfo->seqStartID+7, hits); seqPrecacheId(pDudeInfo->seqStartID+7, palette);
break; break;
case kDudeCultistBeast: case kDudeCultistBeast:
seqPrecacheId(pDudeInfo->seqStartID+6, hits); seqPrecacheId(pDudeInfo->seqStartID+6, palette);
break; break;
case kDudeZombieAxeBuried: case kDudeZombieAxeBuried:
seqPrecacheId(pDudeInfo->seqStartID+12, hits); seqPrecacheId(pDudeInfo->seqStartID+12, palette);
seqPrecacheId(pDudeInfo->seqStartID+9, hits); seqPrecacheId(pDudeInfo->seqStartID+9, palette);
fallthrough__; fallthrough__;
case kDudeZombieAxeLaying: case kDudeZombieAxeLaying:
seqPrecacheId(pDudeInfo->seqStartID+10, hits); seqPrecacheId(pDudeInfo->seqStartID+10, palette);
fallthrough__; fallthrough__;
case kDudeZombieAxeNormal: case kDudeZombieAxeNormal:
seqPrecacheId(pDudeInfo->seqStartID+6, hits); seqPrecacheId(pDudeInfo->seqStartID+6, palette);
seqPrecacheId(pDudeInfo->seqStartID+7, hits); seqPrecacheId(pDudeInfo->seqStartID+7, palette);
seqPrecacheId(pDudeInfo->seqStartID+8, hits); seqPrecacheId(pDudeInfo->seqStartID+8, palette);
seqPrecacheId(pDudeInfo->seqStartID+11, hits); seqPrecacheId(pDudeInfo->seqStartID+11, palette);
seqPrecacheId(pDudeInfo->seqStartID+13, hits); seqPrecacheId(pDudeInfo->seqStartID+13, palette);
seqPrecacheId(pDudeInfo->seqStartID+14, hits); seqPrecacheId(pDudeInfo->seqStartID+14, palette);
break; break;
} }
} }
void PrecacheThing(spritetype *pSprite, HitList &hits) { void PrecacheThing(spritetype *pSprite)
{
int palette = pSprite->pal;
switch (pSprite->type) { switch (pSprite->type) {
case kThingGlassWindow: // worthless... case kThingGlassWindow: // worthless...
case kThingFluorescent: case kThingFluorescent:
seqPrecacheId(12, hits); seqPrecacheId(12, palette);
break; break;
case kThingSpiderWeb: case kThingSpiderWeb:
seqPrecacheId(15, hits); seqPrecacheId(15, palette);
break; break;
case kThingMetalGrate: case kThingMetalGrate:
seqPrecacheId(21, hits); seqPrecacheId(21, palette);
break; break;
case kThingFlammableTree: case kThingFlammableTree:
seqPrecacheId(25, hits); seqPrecacheId(25, palette);
seqPrecacheId(26, hits); seqPrecacheId(26, palette);
break; break;
case kTrapMachinegun: case kTrapMachinegun:
seqPrecacheId(38, hits); seqPrecacheId(38, palette);
seqPrecacheId(40, hits); seqPrecacheId(40, palette);
seqPrecacheId(28, hits); seqPrecacheId(28, palette);
break; break;
case kThingObjectGib: case kThingObjectGib:
//case kThingObjectExplode: weird that only gib object is precached and this one is not //case kThingObjectExplode: weird that only gib object is precached and this one is not
break; break;
} }
tilePrecacheTile(pSprite->picnum, -1, hits); tilePrecacheTile(pSprite->picnum, -1, palette);
} }
void PreloadTiles(HitList & hits) void PreloadCache()
{ {
nPrecacheCount = 0; if (!r_precache) return;
int skyTile = -1; int skyTile = -1;
hits.Zero();
// Fonts // Fonts
for (int i = 0; i < numsectors; i++) for (int i = 0; i < numsectors; i++)
{ {
tilePrecacheTile(sector[i].floorpicnum, 0, hits); tilePrecacheTile(sector[i].floorpicnum, 0, sector[i].floorpal);
tilePrecacheTile(sector[i].ceilingpicnum, 0, hits); tilePrecacheTile(sector[i].ceilingpicnum, 0, sector[i].ceilingpal);
if ((sector[i].ceilingstat&1) != 0 && skyTile == -1) if ((sector[i].ceilingstat&1) != 0 && skyTile == -1)
skyTile = sector[i].ceilingpicnum; skyTile = sector[i].ceilingpicnum;
} }
for (int i = 0; i < numwalls; i++) for (int i = 0; i < numwalls; i++)
{ {
tilePrecacheTile(wall[i].picnum, 0, hits); tilePrecacheTile(wall[i].picnum, 0, wall[i].pal);
if (wall[i].overpicnum >= 0) if (wall[i].overpicnum >= 0)
tilePrecacheTile(wall[i].overpicnum, 0, hits); tilePrecacheTile(wall[i].overpicnum, 0, wall[i].pal);
} }
for (int i = 0; i < kMaxSprites; i++) for (int i = 0; i < kMaxSprites; i++)
{ {
@ -317,13 +267,13 @@ void PreloadTiles(HitList & hits)
switch (pSprite->statnum) switch (pSprite->statnum)
{ {
case kStatDude: case kStatDude:
PrecacheDude(pSprite, hits); PrecacheDude(pSprite);
break; break;
case kStatThing: case kStatThing:
PrecacheThing(pSprite, hits); PrecacheThing(pSprite);
break; break;
default: default:
tilePrecacheTile(pSprite->picnum, -1, hits); tilePrecacheTile(pSprite->picnum, -1, pSprite->pal);
break; break;
} }
} }
@ -332,57 +282,38 @@ void PreloadTiles(HitList & hits)
// Precache common SEQs // Precache common SEQs
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {
seqPrecacheId(i, hits); seqPrecacheId(i, 0);
} }
tilePrecacheTile(1147, -1, hits); // water drip tilePrecacheTile(1147, -1, 0); // water drip
tilePrecacheTile(1160, -1, hits); // blood drip tilePrecacheTile(1160, -1, 0); // blood drip
// Player SEQs // Player SEQs
seqPrecacheId(dudeInfo[31].seqStartID+6, hits); seqPrecacheId(dudeInfo[31].seqStartID+6, 0);
seqPrecacheId(dudeInfo[31].seqStartID+7, hits); seqPrecacheId(dudeInfo[31].seqStartID+7, 0);
seqPrecacheId(dudeInfo[31].seqStartID+8, hits); seqPrecacheId(dudeInfo[31].seqStartID+8, 0);
seqPrecacheId(dudeInfo[31].seqStartID+9, hits); seqPrecacheId(dudeInfo[31].seqStartID+9, 0);
seqPrecacheId(dudeInfo[31].seqStartID+10, hits); seqPrecacheId(dudeInfo[31].seqStartID+10, 0);
seqPrecacheId(dudeInfo[31].seqStartID+14, hits); seqPrecacheId(dudeInfo[31].seqStartID+14, 0);
seqPrecacheId(dudeInfo[31].seqStartID+15, hits); seqPrecacheId(dudeInfo[31].seqStartID+15, 0);
seqPrecacheId(dudeInfo[31].seqStartID+12, hits); seqPrecacheId(dudeInfo[31].seqStartID+12, 0);
seqPrecacheId(dudeInfo[31].seqStartID+16, hits); seqPrecacheId(dudeInfo[31].seqStartID+16, 0);
seqPrecacheId(dudeInfo[31].seqStartID+17, hits); seqPrecacheId(dudeInfo[31].seqStartID+17, 0);
seqPrecacheId(dudeInfo[31].seqStartID+18, hits); seqPrecacheId(dudeInfo[31].seqStartID+18, 0);
if (skyTile > -1 && skyTile < kMaxTiles) if (skyTile > -1 && skyTile < kMaxTiles)
{ {
for (int i = 1; i < gSkyCount; i++) for (int i = 1; i < gSkyCount; i++)
tilePrecacheTile(skyTile+i, 0, hits); tilePrecacheTile(skyTile+i, 0, 0);
} }
WeaponPrecache(hits); WeaponPrecache();
viewPrecacheTiles(hits); viewPrecacheTiles();
fxPrecache(hits); fxPrecache();
gibPrecache(hits); gibPrecache();
I_GetEvent(); I_GetEvent();
} precacheMarkedTiles();
void PreloadCache()
{
if (!r_precache) return;
HitList hits;
PreloadTiles(hits);
int cnt = 0;
int percentDisplayed = -1;
for (int i = 0; i < kMaxTiles; i++)
{
if (hits[i])
{
PrecacheHardwareTextures(i);
if ((++cnt & 7) == 0)
I_GetEvent();
}
}
} }
END_BLD_NS END_BLD_NS

View file

@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "compat.h" #include "compat.h"
#include "common_game.h" #include "common_game.h"
#include "v_draw.h" #include "v_draw.h"
#include "glbackend/glbackend.h"
#include "blood.h" #include "blood.h"
BEGIN_BLD_NS BEGIN_BLD_NS
@ -147,26 +146,14 @@ void QAV::Play(int start, int end, int nCallback, void *pData)
} }
} }
void QAV::Preload(void) void QAV::Precache(int palette)
{ {
for (int i = 0; i < nFrames; i++) for (int i = 0; i < nFrames; i++)
{ {
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
{ {
if (frames[i].tiles[j].picnum >= 0) if (frames[i].tiles[j].picnum >= 0)
tilePreloadTile(frames[i].tiles[j].picnum); tilePrecacheTile(frames[i].tiles[j].picnum, 0, palette);
}
}
}
void QAV::Precache(HitList &hits)
{
for (int i = 0; i < nFrames; i++)
{
for (int j = 0; j < 8; j++)
{
if (frames[i].tiles[j].picnum >= 0)
tilePrecacheTile(frames[i].tiles[j].picnum, 0, hits);
} }
} }
} }

View file

@ -82,8 +82,7 @@ struct QAV
void Draw(int ticks, int stat, int shade, int palnum, bool in3dscene); void Draw(int ticks, int stat, int shade, int palnum, bool in3dscene);
void Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool in3dscene); void Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool in3dscene);
void Play(int, int, int, void *); void Play(int, int, int, void *);
void Preload(void); void Precache(int palette = 0);
void Precache(HitList &hits);
}; };
#pragma pack(pop) #pragma pack(pop)

View file

@ -37,7 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "v_video.h" #include "v_video.h"
#include "v_font.h" #include "v_font.h"
#include "glbackend/glbackend.h"
#include "statusbar.h" #include "statusbar.h"
#include "automap.h" #include "automap.h"
#include "v_draw.h" #include "v_draw.h"

View file

@ -102,30 +102,20 @@ static void (*seqClientCallback[])(int, DBloodActor*) = {
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Seq::Preload(void) void Seq::Precache(int palette)
{ {
if (memcmp(signature, "SEQ\x1a", 4) != 0) if (memcmp(signature, "SEQ\x1a", 4) != 0)
I_Error("Invalid sequence"); I_Error("Invalid sequence");
if ((version & 0xff00) != 0x300) if ((version & 0xff00) != 0x300)
I_Error("Obsolete sequence version"); I_Error("Obsolete sequence version");
for (int i = 0; i < nFrames; i++) for (int i = 0; i < nFrames; i++)
tilePreloadTile(seqGetTile(&frames[i])); tilePrecacheTile(seqGetTile(&frames[i]), -1, palette);
} }
void Seq::Precache(HitList& hits) void seqPrecacheId(int id, int palette)
{
if (memcmp(signature, "SEQ\x1a", 4) != 0)
I_Error("Invalid sequence");
if ((version & 0xff00) != 0x300)
I_Error("Obsolete sequence version");
for (int i = 0; i < nFrames; i++)
tilePrecacheTile(seqGetTile(&frames[i]), -1, hits);
}
void seqPrecacheId(int id, HitList& hits)
{ {
auto pSeq = getSequence(id); auto pSeq = getSequence(id);
if (pSeq) pSeq->Precache(hits); if (pSeq) pSeq->Precache(palette);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View file

@ -59,8 +59,7 @@ struct Seq {
short soundId; short soundId;
int flags; int flags;
SEQFRAME frames[1]; SEQFRAME frames[1];
void Preload(void); void Precache(int palette);
void Precache(HitList&);
bool isLooping() bool isLooping()
{ {
@ -97,7 +96,7 @@ inline int seqGetTile(SEQFRAME* pFrame)
} }
int seqRegisterClient(void(*pClient)(int, int)); int seqRegisterClient(void(*pClient)(int, int));
void seqPrecacheId(int id, HitList& hits); void seqPrecacheId(int id, int palette);
SEQINST* GetInstance(int a1, int a2); SEQINST* GetInstance(int a1, int a2);
void UnlockInstance(SEQINST* pInst); void UnlockInstance(SEQINST* pInst);
void seqSpawn(int a1, int a2, int a3, int a4 = -1); void seqSpawn(int a1, int a2, int a3, int a4 = -1);

View file

@ -42,8 +42,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "automap.h" #include "automap.h"
#include "gamefuncs.h" #include "gamefuncs.h"
#include "v_draw.h" #include "v_draw.h"
#include "precache.h"
#include "render.h" #include "render.h"
#include "glbackend/glbackend.h"
EXTERN_CVAR(Bool, testnewrenderer) EXTERN_CVAR(Bool, testnewrenderer)
BEGIN_BLD_NS BEGIN_BLD_NS
@ -134,10 +135,6 @@ void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int
} }
void InitStatusBar(void)
{
if (r_precache) PrecacheHardwareTextures(2200);
}
GameStats GameInterface::getStats() GameStats GameInterface::getStats()
{ {
return { gKillMgr.Kills, gKillMgr.TotalKills, gSecretMgr.Founds, gSecretMgr.Total, gFrameCount / kTicsPerSec, gPlayer[myconnectindex].fragCount }; return { gKillMgr.Kills, gKillMgr.TotalKills, gSecretMgr.Founds, gSecretMgr.Total, gFrameCount / kTicsPerSec, gPlayer[myconnectindex].fragCount };
@ -170,7 +167,6 @@ extern int dword_172CE0[16][3];
void viewInit(void) void viewInit(void)
{ {
Printf("Initializing status bar\n"); Printf("Initializing status bar\n");
InitStatusBar();
FontSet(0, 4096, 0); FontSet(0, 4096, 0);
FontSet(1, 4192, 1); FontSet(1, 4192, 1);
FontSet(2, 4288, 1); FontSet(2, 4288, 1);

View file

@ -237,12 +237,12 @@ void WeaponInit(void)
} }
} }
void WeaponPrecache(HitList &hits) void WeaponPrecache()
{ {
for (int i = 0; i < kQAVEnd; i++) for (int i = 0; i < kQAVEnd; i++)
{ {
if (weaponQAV[i]) if (weaponQAV[i])
weaponQAV[i]->Precache(hits); weaponQAV[i]->Precache();
} }
} }
@ -302,7 +302,7 @@ static void StartQAV(PLAYER *pPlayer, int nWeaponQAV, int callback, bool looped
pPlayer->weaponTimer = weaponQAV[nWeaponQAV]->duration; pPlayer->weaponTimer = weaponQAV[nWeaponQAV]->duration;
pPlayer->qavCallback = callback; pPlayer->qavCallback = callback;
pPlayer->qavLoop = looped; pPlayer->qavLoop = looped;
weaponQAV[nWeaponQAV]->Preload(); //weaponQAV[nWeaponQAV]->Preload();
WeaponPlay(pPlayer); WeaponPlay(pPlayer);
pPlayer->weaponTimer -= 4; pPlayer->weaponTimer -= 4;
} }

View file

@ -42,7 +42,6 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "mapinfo.h" #include "mapinfo.h"
#include "gamestate.h" #include "gamestate.h"
#include "dukeactor.h" #include "dukeactor.h"
#include "../../glbackend/glbackend.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -38,7 +38,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "st_start.h" #include "st_start.h"
#include "i_interface.h" #include "i_interface.h"
#include "prediction.h" #include "prediction.h"
#include "glbackend/glbackend.h"
#include "gamestate.h" #include "gamestate.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -41,7 +41,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "i_interface.h" #include "i_interface.h"
#include "prediction.h" #include "prediction.h"
#include "sbar.h" #include "sbar.h"
#include "glbackend/glbackend.h"
#include "gamestate.h" #include "gamestate.h"
#include "dukeactor.h" #include "dukeactor.h"
#include "interpolate.h" #include "interpolate.h"

View file

@ -35,7 +35,6 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "mapinfo.h" #include "mapinfo.h"
#include "texturemanager.h" #include "texturemanager.h"
#include "interpolate.h" #include "interpolate.h"
#include "glbackend/glbackend.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "mathutil.h" #include "mathutil.h"
#include "glbackend/glbackend.h" #include "gamehud.h"
#include "global.h" #include "global.h"
// all inline functions. // all inline functions.

View file

@ -37,6 +37,7 @@ source as it is released.
#include "build.h" #include "build.h"
#include "names_d.h" #include "names_d.h"
#include "dukeactor.h" #include "dukeactor.h"
#include "precache.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -31,6 +31,7 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
#include "names_r.h" #include "names_r.h"
#include "mapinfo.h" #include "mapinfo.h"
#include "dukeactor.h" #include "dukeactor.h"
#include "precache.h"
BEGIN_DUKE_NS BEGIN_DUKE_NS

View file

@ -34,6 +34,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
#include "dukeactor.h" #include "dukeactor.h"
#include "interpolate.h" #include "interpolate.h"
#include "render.h" #include "render.h"
#include "glbackend/glbackend.h"
#include "_polymost.cpp" #include "_polymost.cpp"

View file

@ -34,7 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "vm.h" #include "vm.h"
#include "razemenu.h" #include "razemenu.h"
#include "../../glbackend/glbackend.h"
BEGIN_PS_NS BEGIN_PS_NS

View file

@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "ns.h" #include "ns.h"
#include "engine.h" #include "engine.h"
#include "precache.h"
//#include <io.h> //#include <io.h>
//#include <fcntl.h> //#include <fcntl.h>
@ -33,11 +34,6 @@ void resettiming()
lastTic = -1; lastTic = -1;
} }
void doTileLoad(int i)
{
if (r_precache) PrecacheHardwareTextures(i);
}
void precache() void precache()
{ {
int i; int i;
@ -45,15 +41,15 @@ void precache()
for (i = 0; i < numsectors; i++) for (i = 0; i < numsectors; i++)
{ {
short j = sector[i].ceilingpicnum; short j = sector[i].ceilingpicnum;
doTileLoad(j); markTileForPrecache(j, sector[i].ceilingpal);
j = sector[i].floorpicnum; j = sector[i].floorpicnum;
doTileLoad(j); markTileForPrecache(j, sector[i].floorpal);
} }
for (i = 0; i < numwalls; i++) for (i = 0; i < numwalls; i++)
{ {
short j = wall[i].picnum; short j = wall[i].picnum;
doTileLoad(j); markTileForPrecache(j, wall[i].pal);
} }
for (i = 0; i < kMaxSprites; i++) for (i = 0; i < kMaxSprites; i++)
@ -61,8 +57,9 @@ void precache()
if (sprite[i].statnum < kMaxStatus) if (sprite[i].statnum < kMaxStatus)
{ {
short j = sprite[i].picnum; short j = sprite[i].picnum;
doTileLoad(j); markTileForPrecache(j, sprite[i].pal);
} }
} }
precacheMarkedTiles();
} }
END_PS_NS END_PS_NS

View file

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "exhumed.h" #include "exhumed.h"
#include "view.h" #include "view.h"
#include "aistuff.h" #include "aistuff.h"
#include "../glbackend/glbackend.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View file

@ -16,7 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "ns.h" #include "ns.h"
#include "glbackend/glbackend.h" #include "gamehud.h"
#include "sequence.h" #include "sequence.h"
#include "engine.h" #include "engine.h"
#include "exhumed.h" #include "exhumed.h"

View file

@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "mapinfo.h" #include "mapinfo.h"
#include "v_video.h" #include "v_video.h"
#include "interpolate.h" #include "interpolate.h"
#include "glbackend/glbackend.h"
#include "v_draw.h" #include "v_draw.h"
#include "render.h" #include "render.h"
#include <string.h> #include <string.h>

View file

@ -40,6 +40,7 @@ not load" error messages.
#include "misc.h" #include "misc.h"
#include "sounds.h" #include "sounds.h"
#include "network.h" #include "network.h"
#include "precache.h"
BEGIN_SW_NS BEGIN_SW_NS
@ -47,488 +48,444 @@ BEGIN_SW_NS
// It will save out the tile and sound number every time one caches. // It will save out the tile and sound number every time one caches.
// //
// sw -map $bullet -cacheprint > foofile // sw -map $bullet -cacheprint > foofile
extern bool PreCaching;
void PreCacheTable(short table[], int num); void PreCacheRange(int start_pic, int end_pic, int pal = 0)
void PreCacheGhost(void);
void
SetupPreCache(void)
{ {
if (PreCaching) for (int j = start_pic; j <= end_pic; j++)
{ {
precache(); markTileForPrecache(j, pal);
}
// actors cache ranges are called from SpriteSetup
// only caches the actor if its on the level
// weapons
PreCacheRange(2000, 2227);
PreCacheRange(4090, 4093);
// Explosions
PreCacheRange(3072, 3225);
// ninja player character
PreCacheRange(1024, 1175);
// console
PreCacheRange(2380, 2409);
PreCacheRange(3600, 3645);
PreCacheRange(2434, 2435);
// common
PreCacheRange(204, 208);
// message font
PreCacheRange(4608, 4701);
// gibs
PreCacheRange(1150,1568);
PreCacheRange(1685,1690);
PreCacheRange(900,944);
PreCacheRange(1670,1681);
// blood
PreCacheRange(1710,1715);
PreCacheRange(2410,2425);
PreCacheRange(389,389); // blood puddle by itself in art file
PreCacheRange(2500,2503);
// shrap
PreCacheRange(3840,3911);
PreCacheRange(3924,3947);
PreCacheRange(1397,1398);
// water *** animated tiles, can be deleted now ***
// PreCacheRange(780,794);
// switches
PreCacheRange(561,584);
PreCacheRange(551,552);
PreCacheRange(1846,1847);
PreCacheRange(1850,1859);
// bullet smoke
PreCacheRange(1748,1753);
// small blue font
PreCacheRange(2930,3023);
// gas can
PreCacheRange(3038,3042);
// lava *** animated tiles, can be deleted now ***
// PreCacheRange(175,182);
// gas clouds & teleport effect
PreCacheRange(3240,3277);
// nuke mushroom cloud
PreCacheRange(3280,3300);
// blood drops
PreCacheRange(1718,1721);
// smoke
PreCacheRange(3948,3968);
// footprints
PreCacheRange(2490,2492);
// player fists
PreCacheRange(4070,4077);
PreCacheRange(4050,4051);
PreCacheRange(4090,4093);
// fish actor
PreCacheRange(3760,3771);
PreCacheRange(3780,3795);
// coins
PreCacheRange(2531,2533);
// respawn markers & console keys
PreCacheRange(2440,2467);
// light/torch sprites
PreCacheRange(537,548);
PreCacheRange(521,528);
PreCacheRange(512,515);
PreCacheRange(396,399);
PreCacheRange(443,446);
// bubbles
PreCacheRange(716,720);
// bullet splashes
PreCacheRange(772,776);
}
}
void PreCacheRipper(void)
{
PreCacheRange(1580, 1644);
}
void PreCacheRipper2(void)
{
PreCacheRange(4320, 4427);
}
void PreCacheCoolie(void)
{
PreCacheGhost();
PreCacheRange(1400, 1440);
PreCacheRange(4260, 4276); // coolie explode
}
void PreCacheGhost(void)
{
PreCacheRange(4277, 4312);
}
void PreCacheSerpent(void)
{
PreCacheRange(960, 1016);
PreCacheRange(1300, 1314);
}
void PreCacheGuardian(void)
{
PreCacheRange(1469,1497);
}
void PreCacheNinja(void)
{
PreCacheRange(4096, 4239);
}
void PreCacheNinjaGirl(void)
{
PreCacheRange(5162, 5260);
}
void PreCacheSumo(void)
{
PreCacheRange(4490, 4544);
}
void PreCacheZilla(void)
{
PreCacheRange(4490, 4544);
}
void PreCacheEel(void)
{
PreCacheRange(4430, 4479);
}
void PreCacheToiletGirl(void)
{
PreCacheRange(5023, 5027);
}
void PreCacheWashGirl(void)
{
PreCacheRange(5032, 5035);
}
void PreCacheCarGirl(void)
{
PreCacheRange(4594,4597);
}
void PreCacheMechanicGirl(void)
{
PreCacheRange(4590,4593);
}
void PreCacheSailorGirl(void)
{
PreCacheRange(4600,4602);
}
void PreCachePruneGirl(void)
{
PreCacheRange(4604,4604);
}
void PreCacheTrash(void)
{
PreCacheRange(2540, 2546);
}
void PreCacheBunny(void)
{
PreCacheRange(4550, 4584);
}
void PreCacheSkel(void)
{
PreCacheRange(1320, 1396);
}
void PreCacheHornet(void)
{
PreCacheRange(800, 811);
}
void PreCacheSkull(void)
{
PreCacheRange(820, 854);
}
void PreCacheBetty(void)
{
PreCacheRange(817, 819);
}
void PreCachePachinko(void)
{
PreCacheRange(618,623);
PreCacheRange(618,623);
PreCacheRange(4768,4790);
PreCacheRange(4792,4814);
PreCacheRange(4816,4838);
PreCacheRange(4840,4863);
}
void
PreCacheTable(short table[], int num)
{
short j;
for (j = 0; j < num; j++)
{
SET(gotpic[table[j]>>3], 1<<(table[j]&7));
}
}
void
PreCacheRange(short start_pic, short end_pic)
{
short j;
for (j = start_pic; j <= end_pic; j++)
{
SET(gotpic[j>>3], 1<<(j&7));
}
} }
void PreCacheOverride(void) void PreCacheOverride(void)
{ {
int i; int i;
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while ((i = it.NextIndex()) >= 0)
{
int j = SPRITE_TAG2(i);
if(j >= 0 && j <= MAXTILES)
markTileForPrecache(j, 0);
}
}
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE); void precacheMap(void)
while ((i = it.NextIndex()) >= 0) {
{ int i;
ASSERT(SPRITE_TAG2(i) >= 0 && SPRITE_TAG2(i) <= MAXTILES); int j;
SET_GOTPIC(SPRITE_TAG2(i)); SECTORp sectp;
} WALLp wp;
SPRITEp sp;
for (sectp = sector; sectp < &sector[numsectors]; sectp++)
{
j = sectp->ceilingpicnum;
markTileForPrecache(j, sectp->ceilingpal);
if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT)
{
for (i = 1; i <= picanm[j].num; i++)
{
markTileForPrecache(j + i, sectp->ceilingpal);
}
}
j = sectp->floorpicnum;
markTileForPrecache(j, sectp->floorpal);
if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT)
{
for (i = 1; i <= picanm[j].num; i++)
{
markTileForPrecache(j + i, sectp->floorpal);
}
}
}
for (wp = wall; wp < &wall[numwalls]; wp++)
{
j = wp->picnum;
markTileForPrecache(j, wp->pal);
if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT)
{
for (i = 1; i <= picanm[j].num; i++)
{
markTileForPrecache(j + i, wp->pal);
}
}
if (wp->overpicnum > 0 && wp->overpicnum < MAXTILES)
{
j = wp->overpicnum;
markTileForPrecache(j, wp->pal);
if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT)
{
for (i = 1; i <= picanm[j].num; i++)
{
markTileForPrecache(j + i, wp->pal);
}
}
}
}
}
void SetupPreCache(void)
{
precacheMap();
// actors cache ranges are called from SpriteSetup
// only caches the actor if its on the level
// weapons
PreCacheRange(2000, 2227);
PreCacheRange(4090, 4093);
// Explosions
PreCacheRange(3072, 3225);
// ninja player character
PreCacheRange(1024, 1175);
// console
PreCacheRange(2380, 2409);
PreCacheRange(3600, 3645);
PreCacheRange(2434, 2435);
// common
PreCacheRange(204, 208);
// message font
PreCacheRange(4608, 4701);
// gibs
PreCacheRange(1150,1568);
PreCacheRange(1685,1690);
PreCacheRange(900,944);
PreCacheRange(1670,1681);
// blood
PreCacheRange(1710,1715);
PreCacheRange(2410,2425);
PreCacheRange(389,389); // blood puddle by itself in art file
PreCacheRange(2500,2503);
// shrap
PreCacheRange(3840,3911);
PreCacheRange(3924,3947);
PreCacheRange(1397,1398);
// water *** animated tiles, can be deleted now ***
// PreCacheRange(780,794);
// switches
PreCacheRange(561,584);
PreCacheRange(551,552);
PreCacheRange(1846,1847);
PreCacheRange(1850,1859);
// bullet smoke
PreCacheRange(1748,1753);
// gas can
PreCacheRange(3038,3042);
// lava *** animated tiles, can be deleted now ***
// PreCacheRange(175,182);
// gas clouds & teleport effect
PreCacheRange(3240,3277);
// nuke mushroom cloud
PreCacheRange(3280,3300);
// blood drops
PreCacheRange(1718,1721);
// smoke
PreCacheRange(3948,3968);
// footprints
PreCacheRange(2490,2492);
// player fists
PreCacheRange(4070,4077);
PreCacheRange(4050,4051);
PreCacheRange(4090,4093);
// fish actor
PreCacheRange(3760,3771);
PreCacheRange(3780,3795);
// coins
PreCacheRange(2531,2533);
// respawn markers & console keys
PreCacheRange(2440,2467);
// light/torch sprites
PreCacheRange(537,548);
PreCacheRange(521,528);
PreCacheRange(512,515);
PreCacheRange(396,399);
PreCacheRange(443,446);
// bubbles
PreCacheRange(716,720);
// bullet splashes
PreCacheRange(772,776);
}
void PreCacheRipper(int pal)
{
PreCacheRange(1580, 1644, pal);
}
void PreCacheRipper2(int pal)
{
PreCacheRange(4320, 4427, pal);
}
void PreCacheGhost(int pal)
{
PreCacheRange(4277, 4312, pal);
}
void PreCacheCoolie(int pal)
{
PreCacheGhost(pal);
PreCacheRange(1400, 1440, pal);
PreCacheRange(4260, 4276, pal); // coolie explode
}
void PreCacheSerpent(int pal)
{
PreCacheRange(960, 1016, pal);
PreCacheRange(1300, 1314, pal);
}
void PreCacheGuardian(int pal)
{
PreCacheRange(1469,1497, pal);
}
void PreCacheNinja(int pal)
{
PreCacheRange(4096, 4239, pal);
}
void PreCacheNinjaGirl(int pal)
{
PreCacheRange(5162, 5260, pal);
}
void PreCacheSumo(int pal)
{
PreCacheRange(4490, 4544, pal);
}
void PreCacheZilla(int pal)
{
PreCacheRange(4490, 4544, pal);
}
void PreCacheEel(int pal)
{
PreCacheRange(4430, 4479, pal);
}
void PreCacheToiletGirl(int pal)
{
PreCacheRange(5023, 5027, pal);
}
void PreCacheWashGirl(int pal)
{
PreCacheRange(5032, 5035, pal);
}
void PreCacheCarGirl(int pal)
{
PreCacheRange(4594,4597, pal);
}
void PreCacheMechanicGirl(int pal)
{
PreCacheRange(4590,4593, pal);
}
void PreCacheSailorGirl(int pal)
{
PreCacheRange(4600,4602, pal);
}
void PreCachePruneGirl(int pal)
{
PreCacheRange(4604,4604, pal);
}
void PreCacheTrash(int pal)
{
PreCacheRange(2540, 2546, pal);
}
void PreCacheBunny(int pal)
{
PreCacheRange(4550, 4584, pal);
}
void PreCacheSkel(int pal)
{
PreCacheRange(1320, 1396, pal);
}
void PreCacheHornet(int pal)
{
PreCacheRange(800, 811, pal);
}
void PreCacheSkull(int pal)
{
PreCacheRange(820, 854, pal);
}
void PreCacheBetty(int pal)
{
PreCacheRange(817, 819, pal);
}
void PreCachePachinko(int pal)
{
PreCacheRange(618,623, pal);
PreCacheRange(618,623, pal);
PreCacheRange(4768,4790, pal);
PreCacheRange(4792,4814, pal);
PreCacheRange(4816,4838, pal);
PreCacheRange(4840,4863, pal);
} }
void void
PreCacheActor(void) PreCacheActor(void)
{ {
int i; int i;
short pic; int pic;
for (i=0; i < MAXSPRITES; i++) for (i=0; i < MAXSPRITES; i++)
{ {
if (sprite[i].statnum >= MAXSTATUS) if (sprite[i].statnum >= MAXSTATUS)
continue; continue;
if (User[i]) if (User[i])
pic = User[i]->ID; pic = User[i]->ID;
else else
pic = sprite[i].picnum; pic = sprite[i].picnum;
switch (pic) switch (pic)
{ {
case COOLIE_RUN_R0: case COOLIE_RUN_R0:
PreCacheCoolie(); PreCacheCoolie(sprite[i].pal);
break; break;
case NINJA_RUN_R0: case NINJA_RUN_R0:
case NINJA_CRAWL_R0: case NINJA_CRAWL_R0:
PreCacheNinja(); PreCacheNinja(sprite[i].pal);
break; break;
case GORO_RUN_R0: case GORO_RUN_R0:
PreCacheGuardian(); PreCacheGuardian(sprite[i].pal);
break; break;
case 1441: case 1441:
case COOLG_RUN_R0: case COOLG_RUN_R0:
PreCacheGhost(); PreCacheGhost(sprite[i].pal);
break; break;
case EEL_RUN_R0: case EEL_RUN_R0:
PreCacheEel(); PreCacheEel(sprite[i].pal);
break; break;
case SUMO_RUN_R0: case SUMO_RUN_R0:
PreCacheZilla(); PreCacheZilla(sprite[i].pal);
break; break;
case ZILLA_RUN_R0: case ZILLA_RUN_R0:
PreCacheSumo(); PreCacheSumo(sprite[i].pal);
break; break;
case TOILETGIRL_R0: case TOILETGIRL_R0:
PreCacheToiletGirl(); PreCacheToiletGirl(sprite[i].pal);
break; break;
case WASHGIRL_R0: case WASHGIRL_R0:
PreCacheWashGirl(); PreCacheWashGirl(sprite[i].pal);
break; break;
case CARGIRL_R0: case CARGIRL_R0:
PreCacheCarGirl(); PreCacheCarGirl(sprite[i].pal);
break; break;
case MECHANICGIRL_R0: case MECHANICGIRL_R0:
PreCacheMechanicGirl(); PreCacheMechanicGirl(sprite[i].pal);
break; break;
case SAILORGIRL_R0: case SAILORGIRL_R0:
PreCacheSailorGirl(); PreCacheSailorGirl(sprite[i].pal);
break; break;
case PRUNEGIRL_R0: case PRUNEGIRL_R0:
PreCachePruneGirl(); PreCachePruneGirl(sprite[i].pal);
break; break;
case TRASHCAN: case TRASHCAN:
PreCacheTrash(); PreCacheTrash(sprite[i].pal);
break; break;
case BUNNY_RUN_R0: case BUNNY_RUN_R0:
PreCacheBunny(); PreCacheBunny(sprite[i].pal);
break; break;
case RIPPER_RUN_R0: case RIPPER_RUN_R0:
PreCacheRipper(); PreCacheRipper(sprite[i].pal);
break; break;
case RIPPER2_RUN_R0: case RIPPER2_RUN_R0:
PreCacheRipper2(); PreCacheRipper2(sprite[i].pal);
break; break;
case SERP_RUN_R0: case SERP_RUN_R0:
PreCacheSerpent(); PreCacheSerpent(sprite[i].pal);
break; break;
case LAVA_RUN_R0: case LAVA_RUN_R0:
break; break;
case SKEL_RUN_R0: case SKEL_RUN_R0:
PreCacheSkel(); PreCacheSkel(sprite[i].pal);
break; break;
case HORNET_RUN_R0: case HORNET_RUN_R0:
PreCacheHornet(); PreCacheHornet(sprite[i].pal);
break; break;
case SKULL_R0: case SKULL_R0:
PreCacheSkull(); PreCacheSkull(sprite[i].pal);
break; break;
case BETTY_R0: case BETTY_R0:
PreCacheBetty(); PreCacheBetty(sprite[i].pal);
break; break;
case GIRLNINJA_RUN_R0: case GIRLNINJA_RUN_R0:
PreCacheNinjaGirl(); PreCacheNinjaGirl(sprite[i].pal);
break; break;
case 623: // Pachinko win light case 623: // Pachinko win light
case PACHINKO1: case PACHINKO1:
case PACHINKO2: case PACHINKO2:
case PACHINKO3: case PACHINKO3:
case PACHINKO4: case PACHINKO4:
PreCachePachinko(); PreCachePachinko(sprite[i].pal);
break; break;
}
} default:
markTileForPrecache(pic, sprite[i].pal);
}
}
} }
void DoTheCache(void) void DoTheCache(void)
{ {
int i, cnt=0; if (r_precache)
{
PreCacheActor(); SetupPreCache();
PreCacheOverride(); PreCacheActor();
PreCacheOverride();
for (i = 0; i < MAXTILES; i++) precacheMarkedTiles();
{ }
if ((TEST(gotpic[i>>3], 1<<(i&7))) && (!tilePtr(i)))
{
// Without palettes this is rather useless...
if (r_precache) PrecacheHardwareTextures(i);
cnt++;
}
}
memset(gotpic,0,sizeof(gotpic));
} }
void
precache(void)
{
int i;
short j;
SECTORp sectp;
WALLp wp;
SPRITEp sp;
memset(gotpic,0,sizeof(gotpic));
for (sectp = sector; sectp < &sector[numsectors]; sectp++)
{
j = sectp->ceilingpicnum;
SET(gotpic[j>>3], 1<<(j&7));
if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT)
{
for (i = 1; i <= picanm[j].num; i++)
{
SET(gotpic[(j+i)>>3], 1<<((j+i)&7));
}
}
j = sectp->floorpicnum;
SET(gotpic[j>>3], 1<<(j&7));
if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT)
{
for (i = 1; i <= picanm[j].num; i++)
{
SET(gotpic[(j+i)>>3], 1<<((j+i)&7));
}
}
}
for (wp = wall; wp < &wall[numwalls]; wp++)
{
j = wp->picnum;
SET(gotpic[j>>3], 1<<(j&7));
if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT)
{
for (i = 1; i <= picanm[j].num; i++)
{
SET(gotpic[(j+i)>>3], 1<<((j+i)&7));
}
}
if (wp->overpicnum > 0 && wp->overpicnum < MAXTILES)
{
j = wp->overpicnum;
SET(gotpic[j>>3], 1<<(j&7));
if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT)
{
for (i = 1; i <= picanm[j].num; i++)
{
SET(gotpic[(j+i)>>3], 1<<((j+i)&7));
}
}
}
}
for (sp = sprite; sp < &sprite[MAXSPRITES]; sp++)
{
if (sp->statnum < MAXSTATUS)
{
j = sp->picnum;
SET(gotpic[j>>3], 1<<(j&7));
}
}
}
END_SW_NS END_SW_NS

View file

@ -51,9 +51,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "v_draw.h" #include "v_draw.h"
#include "vm.h" #include "vm.h"
#include "../../glbackend/glbackend.h"
BEGIN_SW_NS BEGIN_SW_NS
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View file

@ -56,8 +56,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "v_video.h" #include "v_video.h"
#include "v_draw.h" #include "v_draw.h"
#include "render.h" #include "render.h"
#include "glbackend/glbackend.h"
EXTERN_CVAR(Bool, testnewrenderer) EXTERN_CVAR(Bool, testnewrenderer)
BEGIN_SW_NS BEGIN_SW_NS

View file

@ -106,7 +106,6 @@ bool NewGame = false;
bool FinishedLevel = false; bool FinishedLevel = false;
short screenpeek = 0; short screenpeek = 0;
bool PreCaching = true;
int GodMode = false; int GodMode = false;
short Skill = 2; short Skill = 2;
short TotalKillable; short TotalKillable;
@ -365,8 +364,6 @@ void InitLevel(MapRecord *maprec)
STAT_NewLevel(currentLevel->fileName); STAT_NewLevel(currentLevel->fileName);
Player[0].angle.ang = buildang(ang); Player[0].angle.ang = buildang(ang);
SetupPreCache();
if (sector[0].extra != -1) if (sector[0].extra != -1)
{ {
NormalVisibility = g_visibility = sector[0].extra; NormalVisibility = g_visibility = sector[0].extra;
@ -804,9 +801,9 @@ void GameInterface::FreeLevelData()
::GameInterface::FreeLevelData(); ::GameInterface::FreeLevelData();
} }
bool GameInterface::Voxelize(int sprnum) int GameInterface::Voxelize(int sprnum)
{ {
return (aVoxelArray[sprnum].Voxel >= 0); return (aVoxelArray[sprnum].Voxel);
} }
END_SW_NS END_SW_NS

View file

@ -2239,14 +2239,14 @@ struct GameInterface : ::GameInterface
void WarpToCoords(int x, int y, int z, int a, int h) override; void WarpToCoords(int x, int y, int z, int a, int h) override;
void ToggleThirdPerson() override; void ToggleThirdPerson() override;
void SwitchCoopView() override; void SwitchCoopView() override;
int chaseCamX(binangle ang) { return -ang.bcos(-3); } int chaseCamX(binangle ang) override { return -ang.bcos(-3); }
int chaseCamY(binangle ang) { return -ang.bsin(-3); } int chaseCamY(binangle ang) override { return -ang.bsin(-3); }
int chaseCamZ(fixedhoriz horiz) { return horiz.asq16() >> 8; } int chaseCamZ(fixedhoriz horiz) override { return horiz.asq16() >> 8; }
void processSprites(spritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override; void processSprites(spritetype* tsprite, int& spritesortcnt, int viewx, int viewy, int viewz, binangle viewang, double smoothRatio) override;
void UpdateCameras(double smoothratio) override; void UpdateCameras(double smoothratio) override;
void EnterPortal(spritetype* viewer, int type) override; void EnterPortal(spritetype* viewer, int type) override;
void LeavePortal(spritetype* viewer, int type) override; void LeavePortal(spritetype* viewer, int type) override;
bool Voxelize(int sprnum); int Voxelize(int sprnum);
GameStats getStats() override; GameStats getStats() override;

View file

@ -45,7 +45,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "parent.h" #include "parent.h"
#include "v_video.h" #include "v_video.h"
#include "render.h" #include "render.h"
#include "glbackend/glbackend.h"
EXTERN_CVAR(Bool, testnewrenderer) EXTERN_CVAR(Bool, testnewrenderer)

View file

@ -11,10 +11,7 @@ enum
CACHE_SOUND_PLAY =1 CACHE_SOUND_PLAY =1
}; };
void SetupPreCache(void);
void PreCacheRange(short start_pic, short end_pic);
void DoTheCache(void); void DoTheCache(void);
void precache(void);
void InitCheats(); void InitCheats();

View file

@ -37,11 +37,11 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "pal.h" #include "pal.h"
#include "player.h" #include "player.h"
#include "v_2ddrawer.h" #include "v_2ddrawer.h"
#include "gamehud.h"
#include "weapon.h" #include "weapon.h"
#include "razemenu.h" #include "razemenu.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "glbackend/glbackend.h"
BEGIN_SW_NS BEGIN_SW_NS

View file

@ -990,7 +990,6 @@ bool GameInterface::LoadGame()
} }
#endif #endif
SetupPreCache();
DoTheCache(); DoTheCache();
// this is ok - just duplicating sector list with pointers // this is ok - just duplicating sector list with pointers

View file

@ -1187,9 +1187,6 @@ ActorSpawn(SPRITEp sp)
case 1441: case 1441:
case COOLG_RUN_R0: case COOLG_RUN_R0:
{ {
//PreCacheGhost();
if (!ActorTestSpawn(sp)) if (!ActorTestSpawn(sp))
{ {
KillSprite(SpriteNum); KillSprite(SpriteNum);

View file

@ -51,6 +51,7 @@
#include "gamestruct.h" #include "gamestruct.h"
#include "hw_models.h" #include "hw_models.h"
#include "gamefuncs.h" #include "gamefuncs.h"
#include "gamehud.h"
CVARD(Bool, hw_hightile, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable hightile texture rendering") CVARD(Bool, hw_hightile, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "enable/disable hightile texture rendering")
bool hw_int_useindexedcolortextures; bool hw_int_useindexedcolortextures;
@ -61,7 +62,6 @@ CUSTOM_CVARD(Bool, hw_useindexedcolortextures, false, CVAR_ARCHIVE | CVAR_GLOBAL
EXTERN_CVAR(Bool, gl_texture) EXTERN_CVAR(Bool, gl_texture)
F2DDrawer twodpsp;
static int BufferLock = 0; static int BufferLock = 0;
TArray<VSMatrix> matrixArray; TArray<VSMatrix> matrixArray;
@ -403,62 +403,6 @@ void renderFinishScene()
} }
} }
//==========================================================================
//
// DFrameBuffer :: DrawRateStuff
//
// Draws the fps counter, dot ticker, and palette debug.
//
//==========================================================================
CVAR(Bool, vid_fps, false, 0)
static FString statFPS()
{
static int32_t frameCount;
static double lastFrameTime;
static double cumulativeFrameDelay;
static double lastFPS;
FString output;
double frameTime = I_msTimeF();
double frameDelay = frameTime - lastFrameTime;
cumulativeFrameDelay += frameDelay;
frameCount++;
if (frameDelay >= 0)
{
output.AppendFormat("%5.1f fps (%.1f ms)\n", lastFPS, frameDelay);
if (cumulativeFrameDelay >= 1000.0)
{
lastFPS = 1000. * frameCount / cumulativeFrameDelay;
frameCount = 0;
cumulativeFrameDelay = 0.0;
}
}
lastFrameTime = frameTime;
return output;
}
void DrawRateStuff()
{
// Draws frame time and cumulative fps
if (vid_fps)
{
FString fpsbuff = statFPS();
int textScale = active_con_scale(twod);
int rate_x = screen->GetWidth() / textScale - NewConsoleFont->StringWidth(&fpsbuff[0]);
twod->AddColorOnlyQuad(rate_x * textScale, 0, screen->GetWidth(), NewConsoleFont->GetHeight() * textScale, MAKEARGB(255, 0, 0, 0));
DrawText(twod, NewConsoleFont, CR_WHITE, rate_x, 0, (char*)&fpsbuff[0],
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
int32_t r_scenebrightness = 0; int32_t r_scenebrightness = 0;
@ -493,69 +437,3 @@ void videoShowFrame(int32_t w)
twod->Clear(); twod->Clear();
} }
} }
TMap<int64_t, bool> cachemap;
void markTileForPrecache(int tilenum, int palnum)
{
int i, j;
if ((picanm[tilenum].sf & PICANM_ANIMTYPE_MASK) == PICANM_ANIMTYPE_BACK)
{
i = tilenum - picanm[tilenum].num;
j = tilenum;
}
else
{
i = tilenum;
j = tilenum + picanm[tilenum].num;
}
for (; i <= j; i++)
{
int64_t val = i + (int64_t(palnum) << 32);
cachemap.Insert(val, true);
}
}
void precacheMarkedTiles()
{
decltype(cachemap)::Iterator it(cachemap);
decltype(cachemap)::Pair* pair;
while (it.NextPair(pair))
{
int dapicnum = pair->Key & 0x7fffffff;
int dapalnum = pair->Key >> 32;
Polymost::polymost_precache(dapicnum, dapalnum, 0);
}
}
void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha)
{
double dz = z / 65536.;
alpha *= (dastat & RS_TRANS1)? glblend[0].def[!!(dastat & RS_TRANS2)].alpha : 1.;
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
if (picanm[picnum].sf & PICANM_ANIMTYPE_MASK)
picnum += animateoffs(picnum, 0);
auto tex = tileGetTexture(picnum);
DrawTexture(&twodpsp, tex, sx, sy,
DTA_ScaleX, dz, DTA_ScaleY, dz,
DTA_Color, shadeToLight(dashade),
DTA_TranslationIndex, palid,
DTA_ViewportX, windowxy1.x, DTA_ViewportY, windowxy1.y,
DTA_ViewportWidth, windowxy2.x - windowxy1.x + 1, DTA_ViewportHeight, windowxy2.y - windowxy1.y + 1,
DTA_FullscreenScale, (dastat & RS_STRETCH)? FSMode_ScaleToScreen: FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
DTA_CenterOffsetRel, !(dastat & (RS_TOPLEFT | RS_CENTER)),
DTA_TopLeft, !!(dastat & RS_TOPLEFT),
DTA_CenterOffset, !!(dastat & RS_CENTER),
DTA_FlipX, !!(dastat & RS_XFLIPHUD),
DTA_FlipY, !!(dastat & RS_YFLIPHUD),
DTA_Pin, (dastat & RS_ALIGN_R) ? 1 : (dastat & RS_ALIGN_L) ? -1 : 0,
DTA_Rotate, a * -BAngToDegree,
DTA_FlipOffsets, !(dastat & (/*RS_TOPLEFT |*/ RS_CENTER)),
DTA_Alpha, alpha,
TAG_DONE);
}

View file

@ -306,7 +306,6 @@ public:
}; };
extern GLInstance GLInterface; extern GLInstance GLInterface;
extern F2DDrawer twodpsp;
void renderSetProjectionMatrix(const float* p); void renderSetProjectionMatrix(const float* p);
void renderSetViewMatrix(const float* p); void renderSetViewMatrix(const float* p);
@ -314,6 +313,4 @@ void renderSetVisibility(float v);
void renderSetViewpoint(float x, float y, float z); void renderSetViewpoint(float x, float y, float z);
void renderBeginScene(); void renderBeginScene();
void renderFinishScene(); void renderFinishScene();
void DrawRateStuff();
void videoShowFrame(int32_t); void videoShowFrame(int32_t);
void hud_drawsprite(double sx, double sy, int z, double a, int picnum, int dashade, int dapalnum, int dastat, double alpha = 1);

View file

@ -52,6 +52,8 @@ grpinfo
flags GAMEFLAG_DUKE flags GAMEFLAG_DUKE
gamefilter "Duke.Duke" gamefilter "Duke.Duke"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -62,6 +64,8 @@ grpinfo
flags GAMEFLAG_DUKE flags GAMEFLAG_DUKE
gamefilter "Duke.Duke" gamefilter "Duke.Duke"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -72,6 +76,8 @@ grpinfo
flags GAMEFLAG_DUKE flags GAMEFLAG_DUKE
gamefilter "Duke.Duke" gamefilter "Duke.Duke"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -82,6 +88,8 @@ grpinfo
flags GAMEFLAG_DUKE flags GAMEFLAG_DUKE
gamefilter "Duke.Duke" gamefilter "Duke.Duke"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo // another variant? I got this one, dated 2016-10-12 grpinfo // another variant? I got this one, dated 2016-10-12
@ -92,6 +100,8 @@ grpinfo // another variant? I got this one, dated 2016-10-12
flags GAMEFLAG_DUKE flags GAMEFLAG_DUKE
gamefilter "Duke.Duke" gamefilter "Duke.Duke"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -102,6 +112,8 @@ grpinfo
flags GAMEFLAG_DUKE flags GAMEFLAG_DUKE
gamefilter "Duke.Duke" gamefilter "Duke.Duke"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -112,6 +124,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_DUKEBETA flags GAMEFLAG_DUKE|GAMEFLAG_DUKEBETA
gamefilter "Duke.Shareware" gamefilter "Duke.Shareware"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -122,6 +136,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE
gamefilter "Duke.Shareware" gamefilter "Duke.Shareware"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -132,6 +148,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE
gamefilter "Duke.Shareware" gamefilter "Duke.Shareware"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -142,6 +160,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE
gamefilter "Duke.Shareware" gamefilter "Duke.Shareware"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -152,6 +172,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE
gamefilter "Duke.Shareware" gamefilter "Duke.Shareware"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -162,6 +184,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE flags GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE
gamefilter "Duke.Shareware" gamefilter "Duke.Shareware"
dependency 0 dependency 0
FgColor 0xffff00
BkColor 0xff6f00
} }
grpinfo grpinfo
@ -218,6 +242,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_ADDON flags GAMEFLAG_DUKE|GAMEFLAG_ADDON
dependency DUKE15_CRC dependency DUKE15_CRC
gamefilter "Duke.Vacation" gamefilter "Duke.Vacation"
FgColor 0x00004f
BkColor 0x8f8fff
} }
grpinfo grpinfo
@ -229,6 +255,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_ADDON flags GAMEFLAG_DUKE|GAMEFLAG_ADDON
dependency DUKE15_CRC dependency DUKE15_CRC
gamefilter "Duke.Vacation" gamefilter "Duke.Vacation"
FgColor 0x00004f
BkColor 0x8f8fff
} }
grpinfo grpinfo
@ -240,6 +268,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_ADDON flags GAMEFLAG_DUKE|GAMEFLAG_ADDON
dependency DUKE15_CRC dependency DUKE15_CRC
gamefilter "Duke.NWinter" gamefilter "Duke.NWinter"
FgColor 0
BkColor 0x8f8f8f
} }
grpinfo grpinfo
@ -251,6 +281,8 @@ grpinfo
flags GAMEFLAG_DUKE|GAMEFLAG_ADDON flags GAMEFLAG_DUKE|GAMEFLAG_ADDON
dependency DUKE15_CRC dependency DUKE15_CRC
gamefilter "Duke.NWinter" gamefilter "Duke.NWinter"
FgColor 0
BkColor 0x8f8f8f
} }
grpinfo grpinfo
@ -297,6 +329,8 @@ grpinfo
dependency 0 dependency 0
loadgrp "SOUNDS.RFF", "GUI.RFF" loadgrp "SOUNDS.RFF", "GUI.RFF"
gamefilter "Blood.Blood" gamefilter "Blood.Blood"
FgColor 0
BkColor 0x7f003f
} }
grpinfo grpinfo
@ -310,6 +344,8 @@ grpinfo
dependency 0 dependency 0
loadgrp "SOUNDS.RFF", "GUI.RFF" loadgrp "SOUNDS.RFF", "GUI.RFF"
gamefilter "Blood.Blood" gamefilter "Blood.Blood"
FgColor 0
BkColor 0xaf0024
} }
grpinfo grpinfo
@ -323,6 +359,8 @@ grpinfo
dependency 0 dependency 0
loadgrp "SOUNDS.RFF", "GUI.RFF" loadgrp "SOUNDS.RFF", "GUI.RFF"
gamefilter "Blood.Blood" gamefilter "Blood.Blood"
FgColor 0
BkColor 0xaf0024
} }
grpinfo grpinfo
@ -336,6 +374,8 @@ grpinfo
dependency 0 dependency 0
loadgrp "SOUNDS.RFF", "GUI.RFF" loadgrp "SOUNDS.RFF", "GUI.RFF"
gamefilter "Blood.Blood" gamefilter "Blood.Blood"
FgColor 0
BkColor 0x7f002f
} }
/* this doesn't work with the current setup. /* this doesn't work with the current setup.
@ -410,6 +450,8 @@ grpinfo
size 47536148 size 47536148
defname "sw.def" defname "sw.def"
gamefilter "ShadowWarrior.ShadowWarrior" gamefilter "ShadowWarrior.ShadowWarrior"
FgColor 0
BkColor 0xaf0000
} }
grpinfo grpinfo
@ -420,6 +462,8 @@ grpinfo
size 47536148 size 47536148
defname "sw.def" defname "sw.def"
gamefilter "ShadowWarrior.ShadowWarrior" gamefilter "ShadowWarrior.ShadowWarrior"
FgColor 0
BkColor 0xaf0000
} }
grpinfo grpinfo
@ -430,6 +474,8 @@ grpinfo
size 47536148 size 47536148
defname "sw.def" defname "sw.def"
gamefilter "ShadowWarrior.ShadowWarrior" gamefilter "ShadowWarrior.ShadowWarrior"
FgColor 0
BkColor 0xaf0000
} }
grpinfo grpinfo
@ -440,6 +486,8 @@ grpinfo
size 47537951 size 47537951
defname "sw.def" defname "sw.def"
gamefilter "ShadowWarrior.ShadowWarrior" gamefilter "ShadowWarrior.ShadowWarrior"
FgColor 0
BkColor 0xaf0000
} }
grpinfo grpinfo
@ -450,6 +498,8 @@ grpinfo
size 25702245 size 25702245
defname "sw.def" defname "sw.def"
gamefilter "ShadowWarrior.Shareware" gamefilter "ShadowWarrior.Shareware"
FgColor 0
BkColor 0xaf0000
} }
grpinfo grpinfo
@ -460,6 +510,8 @@ grpinfo
size 25833456 size 25833456
defname "sw.def" defname "sw.def"
gamefilter "ShadowWarrior.Shareware" gamefilter "ShadowWarrior.Shareware"
FgColor 0
BkColor 0xaf0000
} }
grpinfo grpinfo
@ -470,6 +522,8 @@ grpinfo
size 26056769 size 26056769
defname "sw.def" defname "sw.def"
gamefilter "ShadowWarrior.Shareware" gamefilter "ShadowWarrior.Shareware"
FgColor 0
BkColor 0xaf0000
} }
grpinfo grpinfo
@ -480,6 +534,8 @@ grpinfo
size 26056769 size 26056769
defname "sw.def" defname "sw.def"
gamefilter "ShadowWarrior.Shareware" gamefilter "ShadowWarrior.Shareware"
FgColor 0
BkColor 0xaf0000
} }
grpinfo grpinfo
@ -559,6 +615,8 @@ grpinfo
flags GAMEFLAG_RR flags GAMEFLAG_RR
dependency 0 dependency 0
gamefilter "Redneck.Redneck" gamefilter "Redneck.Redneck"
FgColor 0xbc9e89
BkColor 0x7f3300
} }
grpinfo grpinfo
@ -570,6 +628,8 @@ grpinfo
flags GAMEFLAG_RRRA flags GAMEFLAG_RRRA
dependency 0 dependency 0
gamefilter "Redneck.RidesAgain" gamefilter "Redneck.RidesAgain"
FgColor 0xbc9e89
BkColor 0x7f3300
} }
grpinfo grpinfo
@ -606,6 +666,8 @@ grpinfo
flags GAMEFLAG_NAM flags GAMEFLAG_NAM
dependency 0 dependency 0
gamefilter "Nam.Nam" gamefilter "Nam.Nam"
FgColor 0
BkColor 0x78720d
} }
grpinfo grpinfo
@ -616,6 +678,8 @@ grpinfo
flags GAMEFLAG_NAM|GAMEFLAG_NAPALM flags GAMEFLAG_NAM|GAMEFLAG_NAPALM
dependency 0 dependency 0
gamefilter "Nam.Napalm" gamefilter "Nam.Napalm"
FgColor 0
BkColor 0x78720d
} }
grpinfo grpinfo
@ -626,6 +690,8 @@ grpinfo
flags GAMEFLAG_WW2GI flags GAMEFLAG_WW2GI
dependency 0 dependency 0
gamefilter "WW2GI.WW2GI" gamefilter "WW2GI.WW2GI"
FgColor 0
BkColor 0x78720d
} }
grpinfo grpinfo
@ -647,6 +713,8 @@ grpinfo
size 27020745 size 27020745
defname "exhumed.def" defname "exhumed.def"
gamefilter "Exhumed.Powerslave" gamefilter "Exhumed.Powerslave"
FgColor 0xff0000
BkColor 0xffff33
} }
grpinfo grpinfo
@ -657,6 +725,8 @@ grpinfo
size 27108170 size 27108170
defname "exhumed.def" defname "exhumed.def"
gamefilter "Exhumed.Exhumed" gamefilter "Exhumed.Exhumed"
FgColor 0xff0000
BkColor 0xffff33
} }
grpinfo grpinfo
@ -667,6 +737,8 @@ grpinfo
size 27020745 size 27020745
defname "exhumed.def" defname "exhumed.def"
gamefilter "Exhumed.Powerslave" gamefilter "Exhumed.Powerslave"
FgColor 0xff0000
BkColor 0xffff33
} }