raze-gles/source/blood/src/screen.cpp

110 lines
2.7 KiB
C++
Raw Normal View History

2019-09-19 22:42:45 +00:00
//-------------------------------------------------------------------------
/*
Copyright (C) 2010-2019 EDuke32 developers and contributors
Copyright (C) 2019 Nuke.YKT
This file is part of NBlood.
NBlood is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else!
2019-09-19 22:42:45 +00:00
#include <string.h>
#include "build.h"
#include "common_game.h"
#include "globals.h"
#include "v_video.h"
#include "view.h"
2019-09-19 22:42:45 +00:00
BEGIN_BLD_NS
2020-05-23 12:40:54 +00:00
const char * PLU[15] = {
"NORMAL.PLU",
"SATURATE.PLU",
"BEAST.PLU",
"TOMMY.PLU",
"SPIDER3.PLU",
"GRAY.PLU",
"GRAYISH.PLU",
"SPIDER1.PLU",
"SPIDER2.PLU",
"FLAME.PLU",
"COLD.PLU",
"P1.PLU",
"P2.PLU",
"P3.PLU",
"P4.PLU"
2019-09-19 22:42:45 +00:00
};
const char *PAL[5] = {
"BLOOD.PAL",
"WATER.PAL",
"BEAST.PAL",
"SEWER.PAL",
"INVULN1.PAL"
2019-09-19 22:42:45 +00:00
};
static void scrLoadPLUs(void)
2019-09-19 22:42:45 +00:00
{
2020-05-23 12:40:54 +00:00
// load lookup tables
for (int i = 0; i < MAXPALOOKUPS; i++)
{
2020-05-23 16:58:57 +00:00
int lump = i < 15 ? fileSystem.FindFile(PLU[i]) : fileSystem.FindResource(i, "PLU");
2020-05-23 12:40:54 +00:00
if (lump < 0)
{
2020-05-23 16:58:57 +00:00
if (i < 15) I_FatalError("%s.PLU not found", PLU[i]);
2020-05-23 12:40:54 +00:00
else continue;
}
auto data = fileSystem.GetFileData(lump);
if (data.Size() != 64 * 256)
I_FatalError("Incorrect PLU size");
2020-05-27 20:19:02 +00:00
lookups.setTable(i, data.Data());
2019-09-19 22:42:45 +00:00
}
2020-05-27 20:19:02 +00:00
lookups.setFadeColor(1, 255, 255, 255);
2019-09-19 22:42:45 +00:00
}
glblend_t const bloodglblend =
{
{
2020-05-23 12:40:54 +00:00
{ 1.f/3.f, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 },
{ 2.f/3.f, STYLEALPHA_Src, STYLEALPHA_InvSrc, 0 },
2019-09-19 22:42:45 +00:00
},
};
void scrLoadPalette(void)
{
for (auto& x : glblend)
x = bloodglblend;
2019-09-19 22:42:45 +00:00
paletteloaded = 0;
Printf("Loading palettes\n");
2019-09-19 22:42:45 +00:00
for (int i = 0; i < 5; i++)
{
auto pal = fileSystem.LoadFile(PAL[i]);
if (pal.Size() < 768) I_FatalError("%s: file too small", PAL[i]);
2020-05-23 12:40:54 +00:00
paletteSetColorTable(i, pal.Data(), false, false);
2019-09-19 22:42:45 +00:00
}
numshades = 64;
paletteloaded |= PALETTE_MAIN;
scrLoadPLUs();
2020-06-11 07:15:44 +00:00
paletteloaded |= PALETTE_SHADE | PALETTE_TRANSLUC;
2019-09-19 22:42:45 +00:00
}
END_BLD_NS