Rework palette related code. This fixes black screen issue with polymost

This commit is contained in:
nukeykt 2019-10-13 06:09:55 +09:00 committed by Christoph Oelckers
parent 89552466d3
commit 2ef835fcb8
11 changed files with 296 additions and 277 deletions

View file

@ -1796,7 +1796,7 @@ int app_main(int argc, char const* const* argv)
ResetPassword(); ResetPassword();
nCDTracks = initcdaudio(); nCDTracks = initcdaudio();
GetCurPal(NULL); // GetCurPal(NULL);
CONFIG_WriteSetup(1); CONFIG_WriteSetup(1);
CONFIG_ReadSetup(); CONFIG_ReadSetup();
@ -2499,7 +2499,7 @@ void DoGameOverScene()
return; return;
} }
SetOverscan(cinemapal); SetOverscan(ANIMPAL);
NoClip(); NoClip();
overwritesprite(0, 0, kTile3591, 0, 2, kPalNormal); overwritesprite(0, 0, kTile3591, 0, 2, kPalNormal);
Clip(); Clip();
@ -2508,7 +2508,7 @@ void DoGameOverScene()
PlayGameOverSound(); PlayGameOverSound();
WaitAnyKey(3); WaitAnyKey(3);
FadeOut(0); FadeOut(0);
SetOverscan(kenpal); SetOverscan(BASEPAL);
} }
// TODO - missing some values? // TODO - missing some values?
@ -2536,7 +2536,7 @@ void DoTitle()
FadeOut(0); FadeOut(0);
SetOverscan(kenpal); SetOverscan(BASEPAL);
int nScreenTile = seq_GetSeqPicnum(kSeqScreens, 0, 0); int nScreenTile = seq_GetSeqPicnum(kSeqScreens, 0, 0);
@ -2555,7 +2555,7 @@ void DoTitle()
FadeOut(0); FadeOut(0);
SetOverscan(kenpal); SetOverscan(BASEPAL);
GrabPalette(); GrabPalette();
SetLocalChan(1); SetLocalChan(1);
@ -3265,7 +3265,7 @@ int DoSpiritHead()
128); 128);
nHeadStage = 3; nHeadStage = 3;
TintPalette(63, 63, 63); TintPalette(255, 255, 255);
CopyHeadToWorkTile(kTileRamsesNormal); CopyHeadToWorkTile(kTileRamsesNormal);
} }
@ -3719,7 +3719,7 @@ int DoSpiritHead()
128); 128);
nHeadStage = 3; nHeadStage = 3;
TintPalette(63, 63, 63); TintPalette(255, 255, 255);
CopyHeadToWorkTile(kTileRamsesNormal); CopyHeadToWorkTile(kTileRamsesNormal);
} }

View file

@ -29,6 +29,12 @@ void handleevents();
#define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT #define OSD_ERROR OSDTEXT_DARKRED OSDTEXT_BRIGHT
enum basepal_t {
BASEPAL = 0,
ANIMPAL,
BASEPALCOUNT
};
void ShutDown(void); void ShutDown(void);
void DebugOut(const char *fmt, ...); void DebugOut(const char *fmt, ...);
void bail2dos(const char *fmt, ...); void bail2dos(const char *fmt, ...);
@ -47,8 +53,8 @@ int Query(short n, short l, ...);
extern unsigned char curpal[]; extern unsigned char curpal[];
void TintPalette(int a, int b, int c); void TintPalette(int a, int b, int c);
void MySetPalette(unsigned char *palette); //void MySetPalette(unsigned char *palette);
void GetCurPal(unsigned char *palette); //void GetCurPal(unsigned char *palette);
void EraseScreen(int eax); void EraseScreen(int eax);

View file

@ -411,12 +411,7 @@ uint8_t LoadLevel(int nMap)
void ResetEngine() void ResetEngine()
{ {
uint8_t blankPal[768]; SetOverscan(BASEPAL);
memset(blankPal, 0, sizeof(blankPal));
MySetPalette(blankPal);
SetOverscan(kenpal);
EraseScreen(-1); EraseScreen(-1);
@ -508,7 +503,6 @@ void InstallEngine()
} }
LoadPaletteLookups(); LoadPaletteLookups();
MyLoadPalette();
enginecompatibility_mode = ENGINECOMPATIBILITY_19950829; enginecompatibility_mode = ENGINECOMPATIBILITY_19950829;
} }

View file

@ -132,7 +132,7 @@ void DestroyItemAnim(short nSprite)
void ItemFlash() void ItemFlash()
{ {
TintPalette(4, 4, 4); TintPalette(16, 16, 16);
} }
void FillItems(short nPlayer) void FillItems(short nPlayer)

View file

@ -29,10 +29,10 @@ int rtint = 0;
int gtint = 0; int gtint = 0;
int btint = 0; int btint = 0;
char *origpalookup[kMaxPalookups]; char *origpalookup[kMaxPalookups];
unsigned char curpal[768]; //unsigned char curpal[768];
unsigned char kenpal[768]; //unsigned char kenpal[768];
unsigned char *fadedestpal; palette_t *fadedestpal;
unsigned char *fadecurpal; palette_t *fadecurpal;
short nPalDelay; short nPalDelay;
short nPalDiff; short nPalDiff;
short overscanindex; short overscanindex;
@ -43,17 +43,17 @@ uint8_t vgaPalette[768];
void MyLoadPalette() void MyLoadPalette()
{ {
int hFile = kopen4load("PALETTE.DAT", 1); //int hFile = kopen4load("PALETTE.DAT", 1);
if (hFile == -1) //if (hFile == -1)
{ //{
initprintf("Error reading palette 'PALETTE.DAT'\n"); // initprintf("Error reading palette 'PALETTE.DAT'\n");
return; // return;
} //}
//
kread(hFile, kenpal, sizeof(kenpal)); //kread(hFile, kenpal, sizeof(kenpal));
kclose(hFile); //kclose(hFile);
videoSetPalette(0, BASEPAL, 0);
SetOverscan(kenpal); SetOverscan(BASEPAL);
} }
int LoadPaletteLookups() int LoadPaletteLookups()
@ -108,65 +108,32 @@ void WaitVBL()
#endif #endif
} }
void MySetPalette(unsigned char *palette) //void MySetPalette(unsigned char *palette)
{ //{
WaitVBL(); // WaitVBL();
//
// // TODO
// kensetpalette(palette);
//
// memcpy(vgaPalette, palette, sizeof(vgaPalette));
//}
#ifdef __WATCOMC__ //void GetCurPal(unsigned char *palette)
outp(0x3C8, 0); //{
// if (!palette) {
int i; // memcpy(curpal, vgaPalette, sizeof(curpal));
for (i = 0; i < 768; i++) // }
{ // else {
outp(0x3C9, *palette); // memcpy(palette, vgaPalette, sizeof(curpal));
palette++; // }
} //}
#else
// TODO
kensetpalette(palette);
memcpy(vgaPalette, palette, sizeof(vgaPalette));
#endif
}
void GetCurPal(unsigned char *palette)
{
#ifdef __WATCOMC__
if (!palette) {
palette = curpal;
}
outp(0x3C7, 0);
int i;
for (i = 0; i < 256; i++)
{
*palette = inp(0x3C9);
palette++;
*palette = inp(0x3C9);
palette++;
*palette = inp(0x3C9);
palette++;
}
#else
if (!palette) {
memcpy(curpal, vgaPalette, sizeof(curpal));
}
else {
memcpy(palette, vgaPalette, sizeof(curpal));
}
#endif
}
void GrabPalette() void GrabPalette()
{ {
SetOverscan(kenpal); SetOverscan(BASEPAL);
memcpy(curpal, kenpal, sizeof(curpal)); memcpy(curpalettefaded, curpalette, sizeof(curpalette));
videoUpdatePalette(0, 256);
MySetPalette(kenpal);
nPalDiff = 0; nPalDiff = 0;
nPalDelay = 0; nPalDelay = 0;
@ -178,14 +145,19 @@ void GrabPalette()
void BlackOut() void BlackOut()
{ {
memset(curpal, 0, sizeof(curpal)); for (int i = 0; i < 256; i++)
MySetPalette(curpal); {
curpalettefaded[i].r = 0;
curpalettefaded[i].g = 0;
curpalettefaded[i].b = 0;
}
videoUpdatePalette(0, 256);
} }
void RestorePalette() void RestorePalette()
{ {
memcpy(curpal, kenpal, sizeof(curpal)); memcpy(curpalettefaded, curpalette, sizeof(curpalette));
MySetPalette(curpal); videoUpdatePalette(0, 256);
} }
void WaitTicks(int nTicks) void WaitTicks(int nTicks)
@ -207,46 +179,63 @@ void WaitTicks(int nTicks)
// unused // unused
void DoFadeToRed() void DoFadeToRed()
{ {
for (int i = 0; i < 256; i += 3) for (int i = 0; i < 256; i++)
{ {
if (curpal[i + 1] > 0) if (curpalettefaded[i].g > 0)
{ {
curpal[i + 1]--; curpalettefaded[i].g -= 4;
if (curpalettefaded[i].g < 0)
curpalettefaded[i].g = 0;
} }
if (curpal[i + 2] > 0) if (curpalettefaded[i].b > 0)
{ {
curpal[i + 1]--; curpalettefaded[i].b -= 4;
if (curpalettefaded[i].b < 0)
curpalettefaded[i].b = 0;
} }
} }
MySetPalette(curpal); videoUpdatePalette(0, 256);
} }
void FadeToWhite() void FadeToWhite()
{ {
int ebx = 0; int ebx = 0;
int const palstep = (videoGetRenderMode() >= REND_POLYMOST) ? 255 : 4;
int const fadestep = (videoGetRenderMode() >= REND_POLYMOST) ? 1 : 64;
for (int i = 0; i < 64; i++) for (int i = 0; i < fadestep; i++)
{ {
uint8_t *pPal = curpal; palette_t *pPal = curpalettefaded;
for (int j = 0; j < 256; j++) for (int j = 0; j < 256; j++)
{ {
for (int k = 0; k < 3; k++) if (pPal->r < 255)
{ {
if (*pPal < 63) pPal->r += palstep;
{ if (pPal->r > 255)
(*pPal)++; pPal->r = 255;
ebx++;
ebx++;
}
pPal++;
} }
if (pPal->g < 255)
{
pPal->g += palstep;
if (pPal->g > 255)
pPal->g = 255;
ebx++;
}
if (pPal->b < 255)
{
pPal->b += palstep;
if (pPal->b > 255)
pPal->b = 255;
ebx++;
}
pPal++;
} }
MySetPalette(curpal); videoUpdatePalette(0, 256);
WaitTicks(2); WaitTicks(2);
// need to page flip in each iteration of the loop for non DOS version // need to page flip in each iteration of the loop for non DOS version
@ -260,24 +249,44 @@ void FadeToWhite()
void FadeOut(int bFadeMusic) void FadeOut(int bFadeMusic)
{ {
int const palstep = (videoGetRenderMode() >= REND_POLYMOST) ? 255 : 4;
int const fadestep = (videoGetRenderMode() >= REND_POLYMOST) ? 1 : 64;
if (bFadeMusic) { if (bFadeMusic) {
StartfadeCDaudio(); StartfadeCDaudio();
} }
for (int i = 64; i > 0; i--) for (int i = fadestep; i > 0; i--)
{ {
int v4 = 0; int v4 = 0;
palette_t *pPal = curpalettefaded;
for (int j = 0; j < 768; j++) for (int j = 0; j < 256; j++)
{ {
if (curpal[j] > 0) if (pPal->r > 0)
{ {
curpal[j]--; pPal->r -= palstep;
if (pPal->r < 0)
pPal->r = 0;
v4++; v4++;
} }
if (pPal->g > 0)
{
pPal->g -= palstep;
if (pPal->g < 0)
pPal->g = 0;
v4++;
}
if (pPal->b > 0)
{
pPal->b -= palstep;
if (pPal->b < 0)
pPal->b = 0;
v4++;
}
pPal++;
} }
MySetPalette(curpal); videoUpdatePalette(0, 256);
WaitTicks(2); WaitTicks(2);
// need to page flip in each iteration of the loop for non DOS version // need to page flip in each iteration of the loop for non DOS version
@ -301,56 +310,71 @@ void FadeOut(int bFadeMusic)
void StartFadeIn() void StartFadeIn()
{ {
fadedestpal = kenpal; //fadedestpal = curpalette;
fadecurpal = curpal; //fadecurpal = curpal;
} }
int DoFadeIn() int DoFadeIn()
{ {
int v2 = 0; int v2 = 0;
for (int i = 0; i < 768; i++) for (int i = 0; i < 256; i++)
{ {
v2++; if (curpalettefaded[i].r != curpalette[i].r)
if (fadecurpal[i] < fadedestpal[i])
{ {
fadecurpal[i]++; v2++;
int diff = curpalette[i].r - curpalettefaded[i].r;
if (klabs(diff) < 4)
curpalettefaded[i].r = curpalette[i].r;
else
curpalettefaded[i].r += 4 * ksgn(diff);
} }
if (curpalettefaded[i].g != curpalette[i].g)
else
{ {
if (fadecurpal[i] == fadedestpal[i]) v2++;
{ int diff = curpalette[i].g - curpalettefaded[i].g;
v2--; if (klabs(diff) < 4)
} curpalettefaded[i].g = curpalette[i].g;
else { else
fadecurpal[i]--; curpalettefaded[i].g += 4 * ksgn(diff);
} }
if (curpalettefaded[i].b != curpalette[i].b)
{
v2++;
int diff = curpalette[i].b - curpalettefaded[i].b;
if (klabs(diff) < 4)
curpalettefaded[i].b = curpalette[i].b;
else
curpalettefaded[i].b += 4 * ksgn(diff);
} }
} }
MySetPalette(fadecurpal); videoUpdatePalette(0, 256);
return v2; return v2;
} }
void FadeIn() void FadeIn()
{ {
if (videoGetRenderMode() >= REND_POLYMOST)
{
Bmemcpy(curpalettefaded, curpalette, sizeof(curpalette));
videoUpdatePalette(0, 256);
videoNextPage();
return;
}
StartFadeIn(); StartFadeIn();
while (1) int val;
do
{ {
int val = DoFadeIn(); val = DoFadeIn();
WaitTicks(2); WaitTicks(2);
// need to page flip in each iteration of the loop for non DOS version // need to page flip in each iteration of the loop for non DOS version
videoNextPage(); videoNextPage();
} while (val);
if (!val) {
break;
}
}
} }
void FixPalette() void FixPalette()
@ -367,25 +391,53 @@ void FixPalette()
nPalDelay = 5; nPalDelay = 5;
for (int i = 0; i < 768; i++) for (int i = 0; i < 256; i++)
{ {
short nVal = curpal[i] - kenpal[i]; short nVal;
nVal = curpalettefaded[i].r - curpalette[i].r;
if (nVal > 0) if (nVal > 0)
{ {
if (nVal > 5) if (nVal > 20)
{ {
curpal[i] -= 5; curpalettefaded[i].r -= 20;
} }
else else
{ {
curpal[i] = kenpal[i]; curpalettefaded[i].r = curpalette[i].r;
}
}
nVal = curpalettefaded[i].g - curpalette[i].g;
if (nVal > 0)
{
if (nVal > 20)
{
curpalettefaded[i].g -= 20;
}
else
{
curpalettefaded[i].g = curpalette[i].g;
}
}
nVal = curpalettefaded[i].b - curpalette[i].b;
if (nVal > 0)
{
if (nVal > 20)
{
curpalettefaded[i].b -= 20;
}
else
{
curpalettefaded[i].b = curpalette[i].b;
} }
} }
} }
nPalDiff -= 5; nPalDiff -= 20;
gtint -= 5; gtint -= 20;
rtint -= 5; rtint -= 20;
if (gtint < 0) { if (gtint < 0) {
gtint = 0; gtint = 0;
@ -399,7 +451,7 @@ void FixPalette()
nPalDiff = 0; nPalDiff = 0;
} }
MySetPalette(curpal); videoUpdatePalette(0, 256);
} }
void TintPalette(int r, int g, int b) void TintPalette(int r, int g, int b)
@ -408,123 +460,94 @@ void TintPalette(int r, int g, int b)
int g2 = g; int g2 = g;
int b2 = b; int b2 = b;
uint8_t *pPal = curpal; palette_t *pPal = curpalettefaded;
if (bCamera) { if (bCamera) {
return; return;
} }
// range limit R between 5 and 63 if positive // range limit R between 20 and 255 if positive
if (r > 63) if (r > 255)
{ {
r = 63; r = 255;
} }
else else
{ {
if (r && r < 5) { if (r && r < 20) {
r = 5; r = 20;
} }
} }
// range limit G between 5 and 63 if positive // range limit G between 20 and 255 if positive
if (g > 63) if (g > 255)
{ {
g = 63; g = 255;
} }
else else
{ {
if (g && g < 5) { if (g && g < 20) {
g = 5; g = 20;
} }
} }
// range limit B between 5 and 63 if positive // range limit B between 20 and 255 if positive
if (b > 63) if (b > 255)
{ {
b = 63; b = 255;
} }
else else
{ {
if (b && b < 5) { if (b && b < 20) {
b = 5; b = 20;
} }
} }
// loc_17EFA // loc_17EFA
if (g && gtint > 8) { if (g && gtint > 32) {
return; return;
} }
gtint += g; gtint += g;
if (r && rtint > 64) { if (r && rtint > 256) {
return; return;
} }
rtint += r; rtint += r;
// do not modify r, g or b variables from this point on // do not modify r, g or b variables from this point on
r2 = r;
g2 = g;
b2 = b; b2 = b;
if (r2 < 0) {
r2 = -r2;
}
// loc_17F3A
if (g2 < 0) {
g2 = -g2;
}
int nVal; int nVal;
// loc_17F49 // loc_17F49
if (r2 > g2) { if (klabs(r) > klabs(g)) {
nVal = r; nVal = klabs(r);
} }
else { else {
nVal = g; nVal = klabs(g);
} }
if (nVal < 0) { if (nVal < klabs(b)) {
nVal = -nVal; nVal = klabs(b);
}
if (b2 < 0) {
b2 = -b2;
}
if (nVal > b2) {
nVal = b2;
}
else {
if (b < 0) {
nVal = -b;
}
} }
nPalDiff += nVal; nPalDiff += nVal;
for (int i = 0; i < 256; i++) for (int i = 0; i < 256; i++)
{ {
*pPal += r; pPal->r += r;
if (*pPal > 63) { if (pPal->r > 255) {
*pPal = 63; pPal->r = 255;
} }
pPal++; pPal->g += g;
if (pPal->g > 255) {
*pPal += g; pPal->g = 255;
if (*pPal > 63) {
*pPal = 63;
} }
pPal++; pPal->b += b;
if (pPal->b > 255) {
*pPal += b; pPal->b = 255;
if (*pPal > 63) {
*pPal = 63;
} }
pPal++; pPal++;
@ -553,8 +576,11 @@ void SetWhiteOverscan()
} }
void SetOverscan(unsigned char *palette) void SetOverscan(int id)
{ {
if (basepaltable[id] == NULL)
return;
uint8_t *palette = basepaltable[id];
int edi = 1000; int edi = 1000;
overscanindex = 0; overscanindex = 0;

View file

@ -11,9 +11,9 @@ void FixPalette();
void FadeToWhite(); void FadeToWhite();
extern void DoOverscanSet(short someval); extern void DoOverscanSet(short someval);
void SetOverscan(unsigned char *palette); void SetOverscan(int id);
extern unsigned char kenpal[]; //extern unsigned char kenpal[];
extern short overscanindex; extern short overscanindex;
extern char *origpalookup[]; extern char *origpalookup[];

View file

@ -1774,45 +1774,47 @@ int LoadCinemaPalette(int nPal)
return nPal; return nPal;
} }
int IncrementCinemaFadeIn() //int IncrementCinemaFadeIn()
{ //{
dest = cinemapal; // dest = cinemapal;
cur = curpal; // cur = curpal;
//
int ebx = 0; // int ebx = 0;
//
for (int i = 0; i < 768; i++) // for (int i = 0; i < 768; i++)
{ // {
ebx++; // ebx++;
//
if (*cur < *dest) // if (*cur < *dest)
{ // {
(*cur)++; // (*cur)++;
} // }
else if (*cur == *dest) // else if (*cur == *dest)
{ // {
ebx--; // ebx--;
} // }
else // else
{ // {
(*cur)--; // (*cur)--;
} // }
//
cur++; // cur++;
dest++; // dest++;
} // }
//
MySetPalette(curpal); // MySetPalette(curpal);
return ebx; // return ebx;
} //}
void CinemaFadeIn() void CinemaFadeIn()
{ {
BlackOut(); BlackOut();
videoSetPalette(0, ANIMPAL, 0);
while (1) while (1)
{ {
int val = IncrementCinemaFadeIn(); int val = DoFadeIn();
WaitTicks(2); WaitTicks(2);
if (val <= 0) { if (val <= 0) {
@ -2069,7 +2071,7 @@ void GoToTheCinema(int nVal)
overwritesprite(0, 0, 764, 100, 2, kPalNormal); overwritesprite(0, 0, 764, 100, 2, kPalNormal);
videoNextPage(); videoNextPage();
MySetPalette(kenpal); videoSetPalette(0, BASEPAL, 0);
GrabPalette(); GrabPalette();
Clip(); Clip();
} }

View file

@ -34,6 +34,8 @@ int serve_sample()
return 0; return 0;
} }
palette_t moviepal[256];
int ReadFrame(FILE *fp) int ReadFrame(FILE *fp)
{ {
static int nFrame = 0; static int nFrame = 0;
@ -68,7 +70,8 @@ int ReadFrame(FILE *fp)
fread(palette, sizeof(palette[0]), sizeof(palette) / sizeof(palette[0]), fp); fread(palette, sizeof(palette[0]), sizeof(palette) / sizeof(palette[0]), fp);
fread(&var_1C, sizeof(var_1C), 1, fp); fread(&var_1C, sizeof(var_1C), 1, fp);
MySetPalette(palette); paletteSetColorTable(ANIMPAL, palette);
videoSetPalette(0, ANIMPAL, 0);
memset(CurFrame, overscanindex, 4); //sizeof(CurFrame)); memset(CurFrame, overscanindex, 4); //sizeof(CurFrame));
continue; continue;
@ -172,6 +175,8 @@ void PlayMovie(const char *fileName)
int angle = 1536; int angle = 1536;
int z = 0; int z = 0;
videoSetPalette(0, ANIMPAL, 0);
if (ReadFrame(fp)) if (ReadFrame(fp))
{ {
while (!KB_KeyWaiting()) while (!KB_KeyWaiting())

View file

@ -1686,7 +1686,7 @@ void ExplodeEnergyBlock(int nSprite)
BuildSpark(nSprite, 1); BuildSpark(nSprite, 1);
} }
TintPalette(16, 16, 16); TintPalette(64, 64, 64);
if (nEnergyTowers == 1) if (nEnergyTowers == 1)
{ {

View file

@ -943,7 +943,7 @@ void FuncPlayer(int pA, int nDamage, int nRun)
PlayerList[nPlayer].nHealth -= nDamage; PlayerList[nPlayer].nHealth -= nDamage;
if (nPlayer == nLocalPlayer) if (nPlayer == nLocalPlayer)
{ {
TintPalette(nDamage >> 2, 0, 0); TintPalette(nDamage, 0, 0);
SetHealthFrame(-1); SetHealthFrame(-1);
} }
} }
@ -1694,7 +1694,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -1759,7 +1759,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -1851,7 +1851,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -1926,7 +1926,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2000,7 +2000,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2169,7 +2169,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2229,7 +2229,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2289,7 +2289,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2349,7 +2349,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2409,7 +2409,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2469,7 +2469,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2543,7 +2543,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2598,7 +2598,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2654,7 +2654,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {
@ -2710,7 +2710,7 @@ do_default_b:
StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]);
} }
TintPalette(var_44, var_8C, 0); TintPalette(var_44*4, var_8C*4, 0);
if (var_88 > -1) if (var_88 > -1)
{ {

View file

@ -160,25 +160,11 @@ static void analyzesprites()
void ResetView() void ResetView()
{ {
uint8_t blankPal[768];
memset(blankPal, 0, sizeof(blankPal));
MySetPalette(blankPal);
EraseScreen(0);
// FIXME
#ifdef __WATCOMC__
setgamemode(2, 320, 200);
#else
videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, 0); videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, 0);
#endif
MySetPalette(blankPal);
DoOverscanSet(overscanindex); DoOverscanSet(overscanindex);
EraseScreen(overscanindex); EraseScreen(overscanindex);
memcpy(curpalettefaded, curpalette, sizeof(curpalette));
MySetPalette(kenpal); videoUpdatePalette(0, 256);
LoadStatus(); LoadStatus();
} }