mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 11:50:49 +00:00
- base palette cleanup.
Avoid passing this anywhere in the client code. It should only be set right before rendering the 3D view and the only code using the base palette should be the 3D renderer and hud_drawsprite. Also make the palette override CVARs 3D view only in debug mode.
This commit is contained in:
parent
249c5b5734
commit
3455610031
21 changed files with 42 additions and 78 deletions
|
@ -52,7 +52,7 @@ void CChoke::sub_83ff0(int a1, void(*a2)(PLAYER*))
|
|||
}
|
||||
}
|
||||
|
||||
void CChoke::sub_84110(int x, int y, int basepal)
|
||||
void CChoke::sub_84110(int x, int y)
|
||||
{
|
||||
if (!at8)
|
||||
return;
|
||||
|
@ -69,7 +69,7 @@ void CChoke::sub_84110(int x, int y, int basepal)
|
|||
at8->Play(vdi-vd, vdi, -1, NULL);
|
||||
// This originally overlaid the HUD but that simply doesn't work right with the HUD being a genuine overlay.
|
||||
// It also never adjusted for a reduced 3D view
|
||||
at8->Draw(vdi, 10, 0, 0, basepal, true);
|
||||
at8->Draw(vdi, 10, 0, 0, true);
|
||||
gFrameClock = v4;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
at18 = 0;
|
||||
};
|
||||
void sub_83ff0(int a1, void(*a2)(PLAYER*));
|
||||
void sub_84110(int x, int y, int basepal);
|
||||
void sub_84110(int x, int y);
|
||||
void sub_84218();
|
||||
char *at0;
|
||||
QAV *at8;
|
||||
|
|
|
@ -104,13 +104,13 @@ void CGameMenuItemQAV::Draw(void)
|
|||
int backX = data->x;
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
data->Draw(data->at10 - at2c, 10 + kQavOrientationLeft, 0, 0, 0, false);
|
||||
data->Draw(data->at10 - at2c, 10 + kQavOrientationLeft, 0, 0, false);
|
||||
data->x += 320;
|
||||
}
|
||||
data->x = backX;
|
||||
}
|
||||
else
|
||||
data->Draw(data->at10 - at2c, 10, 0, 0, 0, false);
|
||||
data->Draw(data->at10 - at2c, 10, 0, 0, false);
|
||||
|
||||
gFrameClock = backFC;
|
||||
}
|
||||
|
|
|
@ -129,14 +129,14 @@ void hudDraw(PLAYER *gView, int nSectnum, int defaultHoriz, double bobx, double
|
|||
}
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette, basepal);
|
||||
else if (gView->pXSprite->health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette, basepal);
|
||||
if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette);
|
||||
else if (gView->pXSprite->health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette);
|
||||
else {
|
||||
gView->sceneQav = gView->weaponQav = -1;
|
||||
gView->weaponTimer = gView->curWeapon = 0;
|
||||
}
|
||||
#else
|
||||
WeaponDraw(gView, nShade, cX, cY, nPalette, curbasepal);
|
||||
WeaponDraw(gView, nShade, cX, cY, nPalette);
|
||||
#endif
|
||||
}
|
||||
if (gViewPos == 0 && gView->pXSprite->burnTime > 60)
|
||||
|
|
|
@ -52,7 +52,7 @@ struct PLAYER;
|
|||
extern QAV* weaponQAV[];
|
||||
|
||||
void WeaponInit(void);
|
||||
void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5, int basepal);
|
||||
void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5);
|
||||
void WeaponRaise(PLAYER *pPlayer);
|
||||
void WeaponLower(PLAYER *pPlayer);
|
||||
char WeaponUpgrade(PLAYER *pPlayer, char newWeapon);
|
||||
|
|
|
@ -4793,7 +4793,7 @@ void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene) {
|
|||
}
|
||||
}
|
||||
|
||||
void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, int basepal) {
|
||||
void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5) {
|
||||
if (pPlayer == NULL || pPlayer->sceneQav == -1) return;
|
||||
|
||||
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->nPlayer].qavScene;
|
||||
|
@ -4813,13 +4813,13 @@ void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, i
|
|||
if (!(pSprite->flags & kModernTypeFlag1)) {
|
||||
|
||||
pQAV->x = int(a3); pQAV->y = int(a4);
|
||||
pQAV->Draw(a3, a4, v4, flags, a2, a5, basepal, true);
|
||||
pQAV->Draw(a3, a4, v4, flags, a2, a5, true);
|
||||
|
||||
// draw fullscreen (currently 4:3 only)
|
||||
} else {
|
||||
// What an awful hack. This throws proper ordering out of the window, but there is no way to reproduce this better with strict layering of elements.
|
||||
// From the above commit it seems to be incomplete anyway...
|
||||
pQAV->Draw(v4, flags, a2, a5, basepal, false);
|
||||
pQAV->Draw(v4, flags, a2, a5, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ void playerDeactivateShrooms(PLAYER* pPlayer);
|
|||
QAV* playerQavSceneLoad(int qavId);
|
||||
void playerQavSceneProcess(PLAYER* pPlayer, QAVSCENE* pQavScene);
|
||||
void playerQavScenePlay(PLAYER* pPlayer);
|
||||
void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5, int basepal);
|
||||
void playerQavSceneDraw(PLAYER* pPlayer, int a2, double a3, double a4, int a5);
|
||||
void playerQavSceneReset(PLAYER* pPlayer);
|
||||
// ------------------------------------------------------------------------- //
|
||||
void callbackUniMissileBurst(int nSprite);
|
||||
|
|
|
@ -46,7 +46,7 @@ int qavRegisterClient(void(*pClient)(int, void *))
|
|||
return nClients++;
|
||||
}
|
||||
|
||||
void DrawFrame(double x, double y, TILE_FRAME *pTile, int stat, int shade, int palnum, int basepal, bool to3dview)
|
||||
void DrawFrame(double x, double y, TILE_FRAME *pTile, int stat, int shade, int palnum, bool to3dview)
|
||||
{
|
||||
stat |= pTile->stat;
|
||||
x += pTile->x;
|
||||
|
@ -61,7 +61,7 @@ void DrawFrame(double x, double y, TILE_FRAME *pTile, int stat, int shade, int p
|
|||
double alpha = (stat & RS_TRANS1)? glblend[0].def[!!(stat & RS_TRANS2)].alpha : 1.;
|
||||
int pin = (stat & kQavOrientationLeft)? -1 : (stat & RS_ALIGN_R)? 1:0;
|
||||
if (palnum <= 0) palnum = pTile->palnum;
|
||||
auto translation = TRANSLATION(Translation_Remap + basepal, palnum);
|
||||
auto translation = TRANSLATION(Translation_Remap, palnum);
|
||||
bool topleft = !!(stat & RS_TOPLEFT);
|
||||
|
||||
bool xflip = !!(stat & 0x100); // repurposed flag
|
||||
|
@ -83,7 +83,7 @@ void DrawFrame(double x, double y, TILE_FRAME *pTile, int stat, int shade, int p
|
|||
}
|
||||
}
|
||||
|
||||
void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, int basepal, bool to3dview)
|
||||
void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, bool to3dview)
|
||||
{
|
||||
dassert(ticksPerFrame > 0);
|
||||
int nFrame = ticks / ticksPerFrame;
|
||||
|
@ -92,13 +92,13 @@ void QAV::Draw(double x, double y, int ticks, int stat, int shade, int palnum, i
|
|||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (pFrame->tiles[i].picnum > 0)
|
||||
DrawFrame(x, y, &pFrame->tiles[i], stat, shade, palnum, basepal, to3dview);
|
||||
DrawFrame(x, y, &pFrame->tiles[i], stat, shade, palnum, to3dview);
|
||||
}
|
||||
}
|
||||
|
||||
void QAV::Draw(int ticks, int stat, int shade, int palnum, int basepal, bool to3dview)
|
||||
void QAV::Draw(int ticks, int stat, int shade, int palnum, bool to3dview)
|
||||
{
|
||||
Draw(x, y, ticks, stat, shade, palnum, basepal, to3dview);
|
||||
Draw(x, y, ticks, stat, shade, palnum, to3dview);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ struct QAV
|
|||
//SPRITE *pSprite; // 1c
|
||||
char pad3[4]; // 20
|
||||
FRAMEINFO frames[1]; // 24
|
||||
void Draw(int ticks, int stat, int shade, int palnum, int basepal, bool inviewport);
|
||||
void Draw(double x, double y, int ticks, int stat, int shade, int palnum, int basepal, bool inviewport);
|
||||
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 Play(int, int, int, void *);
|
||||
void Preload(void);
|
||||
void Precache(void);
|
||||
|
|
|
@ -1117,7 +1117,7 @@ void viewDrawScreen(bool sceneonly)
|
|||
if (IsPlayerSprite(gMe->pSprite) && pPSprite->hand == 1)
|
||||
{
|
||||
//static int lastClock;
|
||||
gChoke.sub_84110(160, zn, 0);
|
||||
gChoke.sub_84110(160, zn);
|
||||
//if ((gGameClock % 5) == 0 && gGameClock != lastClock)
|
||||
//{
|
||||
// gChoke.swayV(pPSprite);
|
||||
|
|
|
@ -232,7 +232,7 @@ void WeaponPrecache(void)
|
|||
}
|
||||
}
|
||||
|
||||
void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5, int basepal)
|
||||
void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5)
|
||||
{
|
||||
dassert(pPlayer != NULL);
|
||||
if (pPlayer->weaponQav == -1)
|
||||
|
@ -252,7 +252,7 @@ void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5, int basep
|
|||
a2 = -128;
|
||||
flags |= 1;
|
||||
}
|
||||
pQAV->Draw(a3, a4, v4, flags, a2, a5, basepal, true);
|
||||
pQAV->Draw(a3, a4, v4, flags, a2, a5, true);
|
||||
}
|
||||
|
||||
void WeaponPlay(PLAYER *pPlayer)
|
||||
|
|
|
@ -2053,9 +2053,7 @@ void twod_rotatesprite(F2DDrawer *twod, int32_t sx, int32_t sy, int32_t z, int16
|
|||
// todo: check for hires replacements.
|
||||
|
||||
// The weapon drawer needs to use the global base palette.
|
||||
if (twod == &twodpsp) dg.mTranslationId = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
|
||||
else if (basepal == 0 && dapalnum == 0 && pic) dg.mTranslationId = 0;
|
||||
else dg.mTranslationId = TRANSLATION(Translation_Remap + basepal, dapalnum);
|
||||
dg.mTranslationId = TRANSLATION(Translation_Remap + basepal, dapalnum);
|
||||
|
||||
dg.mVertCount = 4;
|
||||
dg.mVertIndex = (int)twod->mVertices.Reserve(4);
|
||||
|
|
|
@ -993,9 +993,6 @@ void tileCopySection(int tilenum1, int sx1, int sy1, int xsiz, int ysiz, int til
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
// Test CVARs.
|
||||
CVAR(Int, fixpalette, -1, 0)
|
||||
CVAR(Int, fixpalswap, -1, 0)
|
||||
|
||||
bool PickTexture(int picnum, FGameTexture* tex, int paletteid, TexturePick& pick)
|
||||
{
|
||||
|
@ -1004,13 +1001,11 @@ bool PickTexture(int picnum, FGameTexture* tex, int paletteid, TexturePick& pick
|
|||
|
||||
if (!tex->isValid() || tex->GetTexelWidth() <= 0 || tex->GetTexelHeight() <= 0) return false;
|
||||
pick.texture = tex;
|
||||
int curbasepal = GetTranslationType(paletteid) - Translation_Remap;
|
||||
int palette = GetTranslationIndex(paletteid);
|
||||
int usepalette = fixpalette >= 0 ? fixpalette : curbasepal;
|
||||
int usepalswap = fixpalswap >= 0 ? fixpalswap : palette;
|
||||
int usepalette = GetTranslationType(paletteid) - Translation_Remap;
|
||||
int usepalswap = GetTranslationIndex(paletteid);
|
||||
int TextureType = hw_int_useindexedcolortextures && picnum >= 0 ? TT_INDEXED : TT_TRUECOLOR;
|
||||
|
||||
pick.translation = TRANSLATION(usepalette + Translation_Remap, usepalswap);
|
||||
pick.translation = paletteid;
|
||||
pick.basepalTint = 0xffffff;
|
||||
|
||||
auto& h = lookups.tables[usepalswap];
|
||||
|
|
|
@ -2546,7 +2546,6 @@ void DoTitle()
|
|||
if (videoGetRenderMode() == REND_CLASSIC)
|
||||
FadeOut(0);
|
||||
|
||||
SetOverscan(BASEPAL);
|
||||
GrabPalette();
|
||||
|
||||
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
|
||||
|
|
|
@ -184,8 +184,6 @@ uint8_t LoadLevel(int nMap)
|
|||
|
||||
void ResetEngine()
|
||||
{
|
||||
SetOverscan(BASEPAL);
|
||||
|
||||
EraseScreen(-1);
|
||||
|
||||
resettiming();
|
||||
|
|
|
@ -62,22 +62,6 @@ int bGreenPal = 0;
|
|||
// keep a local copy of the palette that would have been sent to the VGA display adapter
|
||||
uint8_t vgaPalette[768];
|
||||
|
||||
|
||||
void MyLoadPalette()
|
||||
{
|
||||
//int hFile = kopen4load("PALETTE.DAT", 1);
|
||||
//if (hFile == -1)
|
||||
//{
|
||||
// Printf("Error reading palette 'PALETTE.DAT'\n");
|
||||
// return;
|
||||
//}
|
||||
//
|
||||
//kread(hFile, kenpal, sizeof(kenpal));
|
||||
//kclose(hFile);
|
||||
videoSetPalette(BASEPAL);
|
||||
SetOverscan(BASEPAL);
|
||||
}
|
||||
|
||||
int LoadPaletteLookups()
|
||||
{
|
||||
uint8_t buffer[256*64];
|
||||
|
@ -163,10 +147,6 @@ void WaitVBL()
|
|||
|
||||
void GrabPalette()
|
||||
{
|
||||
SetOverscan(BASEPAL);
|
||||
|
||||
videoSetPalette(BASEPAL);
|
||||
|
||||
nPalDiff = 0;
|
||||
nPalDelay = 0;
|
||||
|
||||
|
@ -183,7 +163,6 @@ void BlackOut()
|
|||
|
||||
void RestorePalette()
|
||||
{
|
||||
videoSetPalette(BASEPAL);
|
||||
videoTintBlood(0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -368,17 +347,5 @@ void TintPalette(int r, int g, int b)
|
|||
nPalDelay = 0;
|
||||
}
|
||||
|
||||
void DoOverscanSet(short someval)
|
||||
{
|
||||
}
|
||||
|
||||
// unused
|
||||
void SetWhiteOverscan()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SetOverscan(int id)
|
||||
{
|
||||
}
|
||||
END_PS_NS
|
||||
|
|
|
@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
void MyLoadPalette();
|
||||
int LoadPaletteLookups();
|
||||
void WaitVBL();
|
||||
void SetGreenPal();
|
||||
|
@ -33,9 +32,6 @@ void FadeToWhite();
|
|||
int HavePLURemap();
|
||||
uint8_t RemapPLU(uint8_t pal);
|
||||
|
||||
extern void DoOverscanSet(short someval);
|
||||
void SetOverscan(int id);
|
||||
|
||||
//extern unsigned char kenpal[];
|
||||
extern short overscanindex;
|
||||
|
||||
|
|
|
@ -242,7 +242,6 @@ static void analyzesprites()
|
|||
void ResetView()
|
||||
{
|
||||
//videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, 0);
|
||||
DoOverscanSet(overscanindex);
|
||||
EraseScreen(overscanindex);
|
||||
//videoUpdatePalette(0, 256);
|
||||
#ifdef USE_OPENGL
|
||||
|
|
|
@ -430,7 +430,6 @@ int GameInterface::app_main()
|
|||
enginePostInit();
|
||||
videoInit();
|
||||
updateviewport();
|
||||
videoSetPalette(BASEPAL);
|
||||
app_loop();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -50,8 +50,22 @@
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
// Test CVARs.
|
||||
#ifdef _DEBUG
|
||||
CVAR(Int, fixpalette, -1, 0)
|
||||
CVAR(Int, fixpalswap, -1, 0)
|
||||
#endif
|
||||
|
||||
bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sampler)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
int basepal = GetTranslationType(paletteid) - Translation_Remap;
|
||||
int translation = GetTranslationIndex(paletteid);
|
||||
int usepalette = fixpalette >= 0 ? fixpalette : basepal;
|
||||
int usepalswap = fixpalswap >= 0 ? fixpalswap : translation;
|
||||
paletteid = TRANSLATION(Translation_Remap + usepalette, usepalswap);
|
||||
#endif
|
||||
|
||||
TexturePick texpick;
|
||||
if (!PickTexture(picnum, tex, paletteid, texpick)) return false;
|
||||
|
||||
|
|
|
@ -1207,7 +1207,6 @@ void LogoLevel(void)
|
|||
|
||||
twod->ClearScreen();
|
||||
videoNextPage();
|
||||
videoSetPalette(BASEPAL);
|
||||
|
||||
// put up a blank screen while loading
|
||||
|
||||
|
|
Loading…
Reference in a new issue