mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-15 12:10:53 +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;
|
||||
scrSetDac();
|
||||
PreloadCache();
|
||||
InitMirrors();
|
||||
gFrameClock = 0;
|
||||
|
@ -1170,7 +1169,6 @@ int GameInterface::app_main()
|
|||
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
|
||||
if (!bQuickStart)
|
||||
credLogosDos();
|
||||
scrSetDac();
|
||||
|
||||
registerosdcommands();
|
||||
|
||||
|
@ -1304,7 +1302,6 @@ RESTART:
|
|||
}
|
||||
videoNextPage();
|
||||
}
|
||||
//scrNextPage();
|
||||
if (TestBitString(gotpic, 2342))
|
||||
{
|
||||
FireProcess();
|
||||
|
@ -1354,7 +1351,6 @@ RESTART:
|
|||
videoSetViewableArea(0,0,xdim-1,ydim-1);
|
||||
if (!bQuickStart)
|
||||
credLogosDos();
|
||||
scrSetDac();
|
||||
}
|
||||
goto RESTART;
|
||||
}
|
||||
|
|
|
@ -61,39 +61,11 @@ char Wait(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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -116,7 +88,7 @@ void credLogosDos(void)
|
|||
{
|
||||
rotatesprite(160<<16, 100<<16, 65536, 0, 2050, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
|
||||
sndStartSample("THUNDER2", 128, -1);
|
||||
scrNextPage();
|
||||
videoNextPage();
|
||||
if (!Wait(360))
|
||||
return;
|
||||
if (!DoFade(0, 0, 0, 60))
|
||||
|
@ -130,7 +102,7 @@ void credLogosDos(void)
|
|||
{
|
||||
videoClearScreen(0);
|
||||
rotatesprite(160<<16, 100<<16, 65536, 0, 2052, 0, 0, 0x0a, 0, 0, xdim-1, ydim-1);
|
||||
scrNextPage();
|
||||
videoNextPage();
|
||||
DoUnFade(1);
|
||||
sndStartSample("THUNDER2", 128, -1);
|
||||
if (!Wait(360))
|
||||
|
@ -142,12 +114,12 @@ void credLogosDos(void)
|
|||
if (!DoFade(0, 0, 0, 60))
|
||||
return;
|
||||
videoClearScreen(0);
|
||||
scrNextPage();
|
||||
videoNextPage();
|
||||
if (!DoUnFade(1))
|
||||
return;
|
||||
videoClearScreen(0);
|
||||
rotatesprite(160<<16, 100<<16, 65536, 0, 2518, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
|
||||
scrNextPage();
|
||||
videoNextPage();
|
||||
Wait(360);
|
||||
//Mus_Fade(4000);
|
||||
}
|
||||
|
@ -155,9 +127,8 @@ void credLogosDos(void)
|
|||
void credReset(void)
|
||||
{
|
||||
videoClearScreen(0);
|
||||
scrNextPage();
|
||||
videoNextPage();
|
||||
DoFade(0,0,0,1);
|
||||
scrSetupUnfade();
|
||||
DoUnFade(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,10 +95,8 @@ void levelPlayIntroScene(int nEpisode)
|
|||
seqKillAll();
|
||||
EPISODEINFO *pEpisode = &gEpisodeInfo[nEpisode];
|
||||
credPlaySmk(pEpisode->at8f08, pEpisode->at9030, pEpisode->at9028);
|
||||
scrSetDac();
|
||||
viewResizeView(gViewSize);
|
||||
credReset();
|
||||
scrSetDac();
|
||||
Mus_SetPaused(false);
|
||||
}
|
||||
|
||||
|
@ -112,10 +110,8 @@ void levelPlayEndScene(int nEpisode)
|
|||
seqKillAll();
|
||||
EPISODEINFO *pEpisode = &gEpisodeInfo[nEpisode];
|
||||
credPlaySmk(pEpisode->at8f98, pEpisode->at90c0, pEpisode->at902c);
|
||||
scrSetDac();
|
||||
viewResizeView(gViewSize);
|
||||
credReset();
|
||||
scrSetDac();
|
||||
}
|
||||
|
||||
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 *palTable[5];
|
||||
static int curPalette;
|
||||
static int curGamma;
|
||||
int gGammaLevels;
|
||||
bool gFogMode = false;
|
||||
|
||||
void scrResetPalette(void)
|
||||
|
@ -78,17 +71,6 @@ void scrResetPalette(void)
|
|||
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)
|
||||
{
|
||||
if (gFogMode)
|
||||
|
@ -173,68 +155,13 @@ void scrLoadPalette(void)
|
|||
void scrSetPalette(int 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)
|
||||
{
|
||||
Printf("Initializing engine\n");
|
||||
#ifdef USE_OPENGL
|
||||
glrendmode = REND_POLYMOST;
|
||||
#endif
|
||||
engineInit();
|
||||
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)
|
||||
|
@ -247,13 +174,8 @@ void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits)
|
|||
{
|
||||
V_Init2();
|
||||
videoClearViewableArea(0);
|
||||
scrNextPage();
|
||||
videoNextPage();
|
||||
scrSetPalette(curPalette);
|
||||
}
|
||||
|
||||
void scrNextPage(void)
|
||||
{
|
||||
videoNextPage();
|
||||
}
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -35,25 +35,15 @@ struct RGB {
|
|||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
extern bool DacInvalid;
|
||||
extern RGB curDAC[256];
|
||||
extern RGB baseDAC[256];
|
||||
extern int gGammaLevels;
|
||||
extern bool gFogMode;
|
||||
void scrCreateStdColors(void);
|
||||
void scrResetPalette(void);
|
||||
void gSetDacRange(int start, int end, RGB *pPal);
|
||||
void scrLoadPLUs(void);
|
||||
void scrLoadPalette(void);
|
||||
void scrSetPalette(int palId);
|
||||
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 scrUnInit(void);
|
||||
void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits);
|
||||
void scrNextPage(void);
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -2902,7 +2902,6 @@ void UpdateDacs(int nPalette, bool bNoTint)
|
|||
oldPalette = nPalette;
|
||||
}
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (videoGetRenderMode() >= REND_POLYMOST)
|
||||
{
|
||||
gLastPal = 0;
|
||||
|
@ -2965,48 +2964,6 @@ void UpdateDacs(int nPalette, bool bNoTint)
|
|||
videoSetPalette(0, nPalette, 0);
|
||||
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];
|
||||
|
|
Loading…
Reference in a new issue