mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- use the original palette loader from RR.
This commit is contained in:
parent
22e4141395
commit
4b743b4063
5 changed files with 102 additions and 146 deletions
|
@ -34,17 +34,17 @@ enum Games_t {
|
|||
GAMECOUNT
|
||||
};
|
||||
|
||||
typedef enum basepal_ {
|
||||
enum basepal_t {
|
||||
BASEPAL = 0,
|
||||
WATERPAL,
|
||||
SLIMEPAL,
|
||||
DREALMSPAL,
|
||||
TITLEPAL,
|
||||
DREALMSPAL,
|
||||
ENDINGPAL, // 5
|
||||
ANIMPAL,
|
||||
ANIMPAL, // not used anymore
|
||||
DRUGPAL,
|
||||
BASEPALCOUNT
|
||||
} basepal_t;
|
||||
};
|
||||
|
||||
#include "v_text.h"
|
||||
|
||||
|
@ -58,7 +58,7 @@ extern void G_SetupGlobalPsky(void);
|
|||
|
||||
//////////
|
||||
|
||||
extern void G_LoadLookups(void);
|
||||
extern void genspriteremaps(void);
|
||||
|
||||
//////////
|
||||
|
||||
|
|
|
@ -67,5 +67,101 @@ void checkcommandline()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void genspriteremaps(void)
|
||||
{
|
||||
int j;
|
||||
|
||||
auto fr = fileSystem.OpenFileReader("lookup.dat");
|
||||
if (!fr.isOpen())
|
||||
return;
|
||||
|
||||
j = lookups.loadTable(fr);
|
||||
|
||||
if (j < 0)
|
||||
{
|
||||
if (j == -1)
|
||||
Printf("ERROR loading \"lookup.dat\": failed reading enough data.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t paldata[768];
|
||||
|
||||
for (j=1; j<=5; j++)
|
||||
{
|
||||
if (fr.Read(paldata, 768) != 768)
|
||||
return;
|
||||
|
||||
for (int k = 0; k < 768; k++) // Build uses 6 bit VGA palettes.
|
||||
paldata[k] = (paldata[k] << 2) | (paldata[k] >> 6);
|
||||
|
||||
paletteSetColorTable(j, paldata, j == DREALMSPAL || j == ENDINGPAL, j < DREALMSPAL);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
// swap red and blue channels.
|
||||
paldata[i * 3] = GPalette.BaseColors[i].b;
|
||||
paldata[i * 3+1] = GPalette.BaseColors[i].g;
|
||||
paldata[i * 3+2] = GPalette.BaseColors[i].r;
|
||||
}
|
||||
paletteSetColorTable(DRUGPAL, paldata, false, false); // todo: implement this as a shader effect (swap R and B in postprocessing.)
|
||||
|
||||
if (isRR())
|
||||
{
|
||||
uint8_t table[256];
|
||||
for (j = 0; j < 768; j++)
|
||||
table[j] = j;
|
||||
for (j = 0; j < 32; j++)
|
||||
table[j] = j + 32;
|
||||
|
||||
lookups.makeTable(7, table, 0, 0, 0, 0);
|
||||
|
||||
for (j = 0; j < 768; j++)
|
||||
table[j] = j;
|
||||
lookups.makeTable(30, table, 0, 0, 0, 0);
|
||||
lookups.makeTable(31, table, 0, 0, 0, 0);
|
||||
lookups.makeTable(32, table, 0, 0, 0, 0);
|
||||
lookups.makeTable(33, table, 0, 0, 0, 0);
|
||||
if (isRRRA())
|
||||
lookups.makeTable(105, table, 0, 0, 0, 0);
|
||||
|
||||
int unk = 63;
|
||||
for (j = 64; j < 80; j++)
|
||||
{
|
||||
unk--;
|
||||
table[j] = unk;
|
||||
table[j + 16] = j - 24;
|
||||
}
|
||||
table[80] = 80;
|
||||
table[81] = 81;
|
||||
for (j = 0; j < 32; j++)
|
||||
{
|
||||
table[j] = j + 32;
|
||||
}
|
||||
lookups.makeTable(34, table, 0, 0, 0, 0);
|
||||
for (j = 0; j < 768; j++)
|
||||
table[j] = j;
|
||||
for (j = 0; j < 16; j++)
|
||||
table[j] = j + 129;
|
||||
for (j = 16; j < 32; j++)
|
||||
table[j] = j + 192;
|
||||
lookups.makeTable(35, table, 0, 0, 0, 0);
|
||||
if (isRRRA())
|
||||
{
|
||||
lookups.makeTable(50, nullptr, 12 * 4, 12 * 4, 12 * 4, 0);
|
||||
lookups.makeTable(51, nullptr, 12 * 4, 12 * 4, 12 * 4, 0);
|
||||
lookups.makeTable(54, lookups.getTable(8), 32 * 4, 32 * 4, 32 * 4, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
||||
|
|
|
@ -99,97 +99,5 @@ void G_SetupGlobalPsky(void)
|
|||
g_pskyidx = skyIdx;
|
||||
}
|
||||
|
||||
//////////
|
||||
|
||||
void G_LoadLookups(void)
|
||||
{
|
||||
int32_t j;
|
||||
|
||||
auto fr = fileSystem.OpenFileReader("lookup.dat");
|
||||
if (!fr.isOpen())
|
||||
return;
|
||||
|
||||
j = lookups.loadTable(fr);
|
||||
|
||||
if (j < 0)
|
||||
{
|
||||
if (j == -1)
|
||||
Printf("ERROR loading \"lookup.dat\": failed reading enough data.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t paldata[768];
|
||||
|
||||
for (j=1; j<=5; j++)
|
||||
{
|
||||
// Account for TILE_TITLE and REALMS swap between basepal number and on-disk order.
|
||||
int32_t basepalnum = (j == 3 || j == 4) ? 4+3-j : j;
|
||||
|
||||
if (fr.Read(paldata, 768) != 768)
|
||||
return;
|
||||
|
||||
for (bssize_t k = 0; k < 768; k++)
|
||||
paldata[k] <<= 2;
|
||||
|
||||
paletteSetColorTable(basepalnum, paldata, basepalnum == DREALMSPAL || basepalnum == ENDINGPAL, basepalnum < DREALMSPAL);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
// swap red and blue channels.
|
||||
paldata[i * 3] = GPalette.BaseColors[i].b;
|
||||
paldata[i * 3+1] = GPalette.BaseColors[i].g;
|
||||
paldata[i * 3+2] = GPalette.BaseColors[i].r;
|
||||
}
|
||||
paletteSetColorTable(DRUGPAL, paldata, false, false); // todo: implement this as a shader effect (swap R and B in postprocessing.)
|
||||
|
||||
if (RR)
|
||||
{
|
||||
uint8_t table[256];
|
||||
for (bssize_t i = 0; i < 256; i++)
|
||||
table[i] = i;
|
||||
for (bssize_t i = 0; i < 32; i++)
|
||||
table[i] = i+32;
|
||||
|
||||
lookups.makeTable(7, table, 0, 0, 0, 0);
|
||||
|
||||
for (bssize_t i = 0; i < 256; i++)
|
||||
table[i] = i;
|
||||
lookups.makeTable(30, table, 0, 0, 0, 0);
|
||||
lookups.makeTable(31, table, 0, 0, 0, 0);
|
||||
lookups.makeTable(32, table, 0, 0, 0, 0);
|
||||
lookups.makeTable(33, table, 0, 0, 0, 0);
|
||||
if (RRRA)
|
||||
lookups.makeTable(105, table, 0, 0, 0, 0);
|
||||
|
||||
j = 63;
|
||||
for (bssize_t i = 64; i < 80; i++)
|
||||
{
|
||||
j--;
|
||||
table[i] = j;
|
||||
table[i+16] = i-24;
|
||||
}
|
||||
table[80] = 80;
|
||||
table[81] = 81;
|
||||
for (bssize_t i = 0; i < 32; i++)
|
||||
table[i] = i+32;
|
||||
lookups.makeTable(34, table, 0, 0, 0, 0);
|
||||
for (bssize_t i = 0; i < 256; i++)
|
||||
table[i] = i;
|
||||
for (bssize_t i = 0; i < 16; i++)
|
||||
table[i] = i+129;
|
||||
for (bssize_t i = 16; i < 32; i++)
|
||||
table[i] = i+192;
|
||||
lookups.makeTable(35, table, 0, 0, 0, 0);
|
||||
if (RRRA)
|
||||
{
|
||||
lookups.makeTable(50, NULL, 12 * 4, 12 * 4, 12 * 4, 0);
|
||||
lookups.makeTable(51, NULL, 12 * 4, 12 * 4, 12 * 4, 0);
|
||||
lookups.makeTable(54, lookups.getTable(8), 32 * 4, 32 * 4, 32 * 4, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -2133,7 +2133,7 @@ static void G_Startup(void)
|
|||
picanm[TILE_LOADSCREEN].sf |= PICANM_NOFULLBRIGHT_BIT;
|
||||
|
||||
// Printf("Loading palette/lookups...\n");
|
||||
G_LoadLookups();
|
||||
genspriteremaps();
|
||||
TileFiles.PostLoadSetup();
|
||||
|
||||
screenpeek = myconnectindex;
|
||||
|
|
|
@ -130,50 +130,6 @@ foundone:
|
|||
}
|
||||
|
||||
|
||||
// demo <demonum or demofn> [<prof>]
|
||||
//
|
||||
// To profile a demo ("timedemo mode"), <prof> can be given in the range 0-8,
|
||||
// which will start to replay it as fast as possible, rendering <prof> frames
|
||||
// for each gametic.
|
||||
//
|
||||
// Notes:
|
||||
// * The demos should be recorded with demorec_diffs set to 0, so that the
|
||||
// game state updates are actually computed.
|
||||
// * Currently, the profiling can only be aborted on SDL 1.2 builds by
|
||||
// pressing any key.
|
||||
// * With <prof> greater than 1, interpolation should be calculated properly,
|
||||
// though this has not been verified by looking at the frames.
|
||||
// * When testing whether a change in the source has an effect on performance,
|
||||
// the variance of the run times MUST be taken into account (that is, the
|
||||
// replaying must be performed multiple times for the old and new versions,
|
||||
// etc.)
|
||||
static int osdcmd_demo(CCmdFuncPtr parm)
|
||||
{
|
||||
if (numplayers > 1)
|
||||
{
|
||||
Printf("Command not allowed in multiplayer\n");
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
if (g_player[myconnectindex].ps->gm & MODE_GAME)
|
||||
{
|
||||
Printf("demo: Must not be in a game.\n");
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
if (parm->numparms != 1 && parm->numparms != 2)
|
||||
return OSDCMD_SHOWHELP;
|
||||
|
||||
{
|
||||
int32_t prof = parm->numparms==2 ? Batoi(parm->parms[1]) : -1;
|
||||
|
||||
Demo_SetFirst(parm->parms[0]);
|
||||
Demo_PlayFirst(clamp(prof, -1, 8)+1, 0);
|
||||
}
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int osdcmd_activatecheat(CCmdFuncPtr parm)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
|
@ -377,10 +333,6 @@ int32_t registerosdcommands(void)
|
|||
{
|
||||
|
||||
C_RegisterFunction("map","map <mapname>: loads the given map", osdcmd_map);
|
||||
if (!VOLUMEONE)
|
||||
{
|
||||
C_RegisterFunction("demo","demo <demofile or demonum>: starts the given demo", osdcmd_demo);
|
||||
}
|
||||
C_RegisterFunction("levelwarp","levelwarp <e> <m>: warp to episode 'e' and map 'm'", osdcmd_levelwarp);
|
||||
|
||||
C_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give);
|
||||
|
|
Loading…
Reference in a new issue