mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 20:20:54 +00:00
- cleaned out some software rendering-only palette code from Blood.
This commit is contained in:
parent
29f95e2000
commit
ee11fba4e7
6 changed files with 6 additions and 174 deletions
|
@ -644,7 +644,6 @@ void StartLevel(GAMEOPTIONS *gameOptions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gameOptions->uGameFlags &= ~3;
|
gameOptions->uGameFlags &= ~3;
|
||||||
scrSetDac();
|
|
||||||
PreloadCache();
|
PreloadCache();
|
||||||
InitMirrors();
|
InitMirrors();
|
||||||
gFrameClock = 0;
|
gFrameClock = 0;
|
||||||
|
@ -1170,7 +1169,6 @@ int GameInterface::app_main()
|
||||||
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
|
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
|
||||||
if (!bQuickStart)
|
if (!bQuickStart)
|
||||||
credLogosDos();
|
credLogosDos();
|
||||||
scrSetDac();
|
|
||||||
|
|
||||||
registerosdcommands();
|
registerosdcommands();
|
||||||
|
|
||||||
|
@ -1304,7 +1302,6 @@ RESTART:
|
||||||
}
|
}
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
}
|
}
|
||||||
//scrNextPage();
|
|
||||||
if (TestBitString(gotpic, 2342))
|
if (TestBitString(gotpic, 2342))
|
||||||
{
|
{
|
||||||
FireProcess();
|
FireProcess();
|
||||||
|
@ -1354,7 +1351,6 @@ RESTART:
|
||||||
videoSetViewableArea(0,0,xdim-1,ydim-1);
|
videoSetViewableArea(0,0,xdim-1,ydim-1);
|
||||||
if (!bQuickStart)
|
if (!bQuickStart)
|
||||||
credLogosDos();
|
credLogosDos();
|
||||||
scrSetDac();
|
|
||||||
}
|
}
|
||||||
goto RESTART;
|
goto RESTART;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,39 +61,11 @@ char Wait(int nTicks)
|
||||||
|
|
||||||
char DoFade(char r, char g, char b, int nTicks)
|
char DoFade(char r, char g, char b, int nTicks)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
dassert(nTicks > 0);
|
|
||||||
scrSetupFade(r, g, b);
|
|
||||||
totalclock = gFrameClock = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (totalclock < gFrameClock) { gameHandleEvents();};
|
|
||||||
gFrameClock += 2;
|
|
||||||
scrNextPage();
|
|
||||||
scrFadeAmount(divscale16(ClipHigh((int)totalclock, nTicks), nTicks));
|
|
||||||
if (inputState.keyGetScan())
|
|
||||||
return 0;
|
|
||||||
} while (totalclock <= nTicks);
|
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char DoUnFade(int nTicks)
|
char DoUnFade(int nTicks)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
dassert(nTicks > 0);
|
|
||||||
scrSetupUnfade();
|
|
||||||
totalclock = gFrameClock = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
while (totalclock < gFrameClock) { gameHandleEvents(); };
|
|
||||||
gFrameClock += 2;
|
|
||||||
scrNextPage();
|
|
||||||
scrFadeAmount(0x10000-divscale16(ClipHigh((int)totalclock, nTicks), nTicks));
|
|
||||||
if (inputState.keyGetScan())
|
|
||||||
return 0;
|
|
||||||
} while (totalclock <= nTicks);
|
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +88,7 @@ void credLogosDos(void)
|
||||||
{
|
{
|
||||||
rotatesprite(160<<16, 100<<16, 65536, 0, 2050, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
|
rotatesprite(160<<16, 100<<16, 65536, 0, 2050, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
|
||||||
sndStartSample("THUNDER2", 128, -1);
|
sndStartSample("THUNDER2", 128, -1);
|
||||||
scrNextPage();
|
videoNextPage();
|
||||||
if (!Wait(360))
|
if (!Wait(360))
|
||||||
return;
|
return;
|
||||||
if (!DoFade(0, 0, 0, 60))
|
if (!DoFade(0, 0, 0, 60))
|
||||||
|
@ -130,7 +102,7 @@ void credLogosDos(void)
|
||||||
{
|
{
|
||||||
videoClearScreen(0);
|
videoClearScreen(0);
|
||||||
rotatesprite(160<<16, 100<<16, 65536, 0, 2052, 0, 0, 0x0a, 0, 0, xdim-1, ydim-1);
|
rotatesprite(160<<16, 100<<16, 65536, 0, 2052, 0, 0, 0x0a, 0, 0, xdim-1, ydim-1);
|
||||||
scrNextPage();
|
videoNextPage();
|
||||||
DoUnFade(1);
|
DoUnFade(1);
|
||||||
sndStartSample("THUNDER2", 128, -1);
|
sndStartSample("THUNDER2", 128, -1);
|
||||||
if (!Wait(360))
|
if (!Wait(360))
|
||||||
|
@ -142,12 +114,12 @@ void credLogosDos(void)
|
||||||
if (!DoFade(0, 0, 0, 60))
|
if (!DoFade(0, 0, 0, 60))
|
||||||
return;
|
return;
|
||||||
videoClearScreen(0);
|
videoClearScreen(0);
|
||||||
scrNextPage();
|
videoNextPage();
|
||||||
if (!DoUnFade(1))
|
if (!DoUnFade(1))
|
||||||
return;
|
return;
|
||||||
videoClearScreen(0);
|
videoClearScreen(0);
|
||||||
rotatesprite(160<<16, 100<<16, 65536, 0, 2518, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
|
rotatesprite(160<<16, 100<<16, 65536, 0, 2518, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
|
||||||
scrNextPage();
|
videoNextPage();
|
||||||
Wait(360);
|
Wait(360);
|
||||||
//Mus_Fade(4000);
|
//Mus_Fade(4000);
|
||||||
}
|
}
|
||||||
|
@ -155,9 +127,8 @@ void credLogosDos(void)
|
||||||
void credReset(void)
|
void credReset(void)
|
||||||
{
|
{
|
||||||
videoClearScreen(0);
|
videoClearScreen(0);
|
||||||
scrNextPage();
|
videoNextPage();
|
||||||
DoFade(0,0,0,1);
|
DoFade(0,0,0,1);
|
||||||
scrSetupUnfade();
|
|
||||||
DoUnFade(1);
|
DoUnFade(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,10 +95,8 @@ void levelPlayIntroScene(int nEpisode)
|
||||||
seqKillAll();
|
seqKillAll();
|
||||||
EPISODEINFO *pEpisode = &gEpisodeInfo[nEpisode];
|
EPISODEINFO *pEpisode = &gEpisodeInfo[nEpisode];
|
||||||
credPlaySmk(pEpisode->at8f08, pEpisode->at9030, pEpisode->at9028);
|
credPlaySmk(pEpisode->at8f08, pEpisode->at9030, pEpisode->at9028);
|
||||||
scrSetDac();
|
|
||||||
viewResizeView(gViewSize);
|
viewResizeView(gViewSize);
|
||||||
credReset();
|
credReset();
|
||||||
scrSetDac();
|
|
||||||
Mus_SetPaused(false);
|
Mus_SetPaused(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,10 +110,8 @@ void levelPlayEndScene(int nEpisode)
|
||||||
seqKillAll();
|
seqKillAll();
|
||||||
EPISODEINFO *pEpisode = &gEpisodeInfo[nEpisode];
|
EPISODEINFO *pEpisode = &gEpisodeInfo[nEpisode];
|
||||||
credPlaySmk(pEpisode->at8f98, pEpisode->at90c0, pEpisode->at902c);
|
credPlaySmk(pEpisode->at8f98, pEpisode->at90c0, pEpisode->at902c);
|
||||||
scrSetDac();
|
|
||||||
viewResizeView(gViewSize);
|
viewResizeView(gViewSize);
|
||||||
credReset();
|
credReset();
|
||||||
scrSetDac();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void levelClearSecrets(void)
|
void levelClearSecrets(void)
|
||||||
|
|
|
@ -61,16 +61,9 @@ LOADITEM PAL[5] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool DacInvalid = true;
|
|
||||||
static char(*gammaTable)[256];
|
|
||||||
RGB curDAC[256];
|
|
||||||
RGB baseDAC[256];
|
|
||||||
static RGB fromDAC[256];
|
|
||||||
static RGB toRGB;
|
static RGB toRGB;
|
||||||
static RGB *palTable[5];
|
static RGB *palTable[5];
|
||||||
static int curPalette;
|
static int curPalette;
|
||||||
static int curGamma;
|
|
||||||
int gGammaLevels;
|
|
||||||
bool gFogMode = false;
|
bool gFogMode = false;
|
||||||
|
|
||||||
void scrResetPalette(void)
|
void scrResetPalette(void)
|
||||||
|
@ -78,17 +71,6 @@ void scrResetPalette(void)
|
||||||
paletteSetColorTable(0, (uint8_t*)palTable[0]);
|
paletteSetColorTable(0, (uint8_t*)palTable[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gSetDacRange(int start, int end, RGB *pPal)
|
|
||||||
{
|
|
||||||
UNREFERENCED_PARAMETER(start);
|
|
||||||
UNREFERENCED_PARAMETER(end);
|
|
||||||
if (videoGetRenderMode() == REND_CLASSIC)
|
|
||||||
{
|
|
||||||
memcpy(palette, pPal, sizeof(palette));
|
|
||||||
videoSetPalette(0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void scrLoadPLUs(void)
|
void scrLoadPLUs(void)
|
||||||
{
|
{
|
||||||
if (gFogMode)
|
if (gFogMode)
|
||||||
|
@ -173,68 +155,13 @@ void scrLoadPalette(void)
|
||||||
void scrSetPalette(int palId)
|
void scrSetPalette(int palId)
|
||||||
{
|
{
|
||||||
curPalette = palId;
|
curPalette = palId;
|
||||||
scrSetGamma(0/*curGamma*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
void scrSetGamma(int nGamma)
|
|
||||||
{
|
|
||||||
dassert(nGamma < gGammaLevels);
|
|
||||||
curGamma = nGamma;
|
|
||||||
for (int i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
baseDAC[i].red = gammaTable[curGamma][palTable[curPalette][i].red];
|
|
||||||
baseDAC[i].green = gammaTable[curGamma][palTable[curPalette][i].green];
|
|
||||||
baseDAC[i].blue = gammaTable[curGamma][palTable[curPalette][i].blue];
|
|
||||||
}
|
|
||||||
DacInvalid = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void scrSetupFade(char red, char green, char blue)
|
|
||||||
{
|
|
||||||
memcpy(fromDAC, curDAC, sizeof(fromDAC));
|
|
||||||
toRGB.red = red;
|
|
||||||
toRGB.green = green;
|
|
||||||
toRGB.blue = blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void scrSetupUnfade(void)
|
|
||||||
{
|
|
||||||
memcpy(fromDAC, baseDAC, sizeof(fromDAC));
|
|
||||||
}
|
|
||||||
|
|
||||||
void scrFadeAmount(int amount)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
curDAC[i].red = interpolate(fromDAC[i].red, toRGB.red, amount);
|
|
||||||
curDAC[i].green = interpolate(fromDAC[i].green, toRGB.green, amount);
|
|
||||||
curDAC[i].blue = interpolate(fromDAC[i].blue, toRGB.blue, amount);
|
|
||||||
}
|
|
||||||
gSetDacRange(0, 256, curDAC);
|
|
||||||
}
|
|
||||||
|
|
||||||
void scrSetDac(void)
|
|
||||||
{
|
|
||||||
if (DacInvalid)
|
|
||||||
gSetDacRange(0, 256, baseDAC);
|
|
||||||
DacInvalid = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrInit(void)
|
void scrInit(void)
|
||||||
{
|
{
|
||||||
Printf("Initializing engine\n");
|
|
||||||
#ifdef USE_OPENGL
|
|
||||||
glrendmode = REND_POLYMOST;
|
glrendmode = REND_POLYMOST;
|
||||||
#endif
|
|
||||||
engineInit();
|
engineInit();
|
||||||
curPalette = 0;
|
curPalette = 0;
|
||||||
curGamma = 0;
|
|
||||||
Printf("Loading gamma correction table\n");
|
|
||||||
DICTNODE *pGamma = gSysRes.Lookup("gamma", "DAT");
|
|
||||||
if (!pGamma)
|
|
||||||
ThrowError("Gamma table not found");
|
|
||||||
gGammaLevels = pGamma->Size() / 256;
|
|
||||||
gammaTable = (char(*)[256])gSysRes.Lock(pGamma);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrUnInit(void)
|
void scrUnInit(void)
|
||||||
|
@ -247,13 +174,8 @@ void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits)
|
||||||
{
|
{
|
||||||
V_Init2();
|
V_Init2();
|
||||||
videoClearViewableArea(0);
|
videoClearViewableArea(0);
|
||||||
scrNextPage();
|
videoNextPage();
|
||||||
scrSetPalette(curPalette);
|
scrSetPalette(curPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrNextPage(void)
|
|
||||||
{
|
|
||||||
videoNextPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
END_BLD_NS
|
END_BLD_NS
|
||||||
|
|
|
@ -35,25 +35,15 @@ struct RGB {
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
extern bool DacInvalid;
|
|
||||||
extern RGB curDAC[256];
|
|
||||||
extern RGB baseDAC[256];
|
|
||||||
extern int gGammaLevels;
|
|
||||||
extern bool gFogMode;
|
extern bool gFogMode;
|
||||||
void scrCreateStdColors(void);
|
void scrCreateStdColors(void);
|
||||||
void scrResetPalette(void);
|
void scrResetPalette(void);
|
||||||
void gSetDacRange(int start, int end, RGB *pPal);
|
|
||||||
void scrLoadPLUs(void);
|
void scrLoadPLUs(void);
|
||||||
void scrLoadPalette(void);
|
void scrLoadPalette(void);
|
||||||
void scrSetPalette(int palId);
|
void scrSetPalette(int palId);
|
||||||
void scrSetGamma(int nGamma);
|
void scrSetGamma(int nGamma);
|
||||||
void scrSetupFade(char red, char green, char blue);
|
|
||||||
void scrSetupUnfade(void);
|
|
||||||
void scrFadeAmount(int amount);
|
|
||||||
void scrSetDac(void);
|
|
||||||
void scrInit(void);
|
void scrInit(void);
|
||||||
void scrUnInit(void);
|
void scrUnInit(void);
|
||||||
void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits);
|
void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits);
|
||||||
void scrNextPage(void);
|
|
||||||
|
|
||||||
END_BLD_NS
|
END_BLD_NS
|
||||||
|
|
|
@ -2902,7 +2902,6 @@ void UpdateDacs(int nPalette, bool bNoTint)
|
||||||
oldPalette = nPalette;
|
oldPalette = nPalette;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
|
||||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||||
{
|
{
|
||||||
gLastPal = 0;
|
gLastPal = 0;
|
||||||
|
@ -2965,48 +2964,6 @@ void UpdateDacs(int nPalette, bool bNoTint)
|
||||||
videoSetPalette(0, nPalette, 0);
|
videoSetPalette(0, nPalette, 0);
|
||||||
videoTintBlood(nRed, nGreen, nBlue);
|
videoTintBlood(nRed, nGreen, nBlue);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
gLastPal = nPalette;
|
|
||||||
if (bNoTint)
|
|
||||||
{
|
|
||||||
memcpy(newDAC, baseDAC, sizeof(newDAC));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
int nRed = baseDAC[i].red;
|
|
||||||
int nGreen = baseDAC[i].green;
|
|
||||||
int nBlue = baseDAC[i].blue;
|
|
||||||
nRed += gView->pickupEffect;
|
|
||||||
nGreen += gView->pickupEffect;
|
|
||||||
nBlue -= gView->pickupEffect;
|
|
||||||
|
|
||||||
nRed += ClipHigh(gView->painEffect, 85)*2;
|
|
||||||
nGreen -= ClipHigh(gView->painEffect, 85)*3;
|
|
||||||
nBlue -= ClipHigh(gView->painEffect, 85)*3;
|
|
||||||
|
|
||||||
nRed -= gView->blindEffect;
|
|
||||||
nGreen -= gView->blindEffect;
|
|
||||||
nBlue -= gView->blindEffect;
|
|
||||||
|
|
||||||
nRed -= gView->chokeEffect>>6;
|
|
||||||
nGreen -= gView->chokeEffect>>5;
|
|
||||||
nBlue -= gView->chokeEffect>>6;
|
|
||||||
|
|
||||||
newDAC[i].red = ClipRange(nRed, 0, 255);
|
|
||||||
newDAC[i].green = ClipRange(nGreen, 0, 255);
|
|
||||||
newDAC[i].blue = ClipRange(nBlue, 0, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (memcmp(newDAC, curDAC, 768) != 0)
|
|
||||||
{
|
|
||||||
memcpy(curDAC, newDAC, 768);
|
|
||||||
gSetDacRange(0, 256, curDAC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char otherMirrorGotpic[2];
|
char otherMirrorGotpic[2];
|
||||||
|
|
Loading…
Reference in a new issue