SW: Fix 3D Realms and ANM palettes

git-svn-id: https://svn.eduke32.com/eduke32@8272 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/duke3d/src/astub.cpp
#	source/sw/src/anim.cpp
#	source/sw/src/colormap.cpp
#	source/sw/src/common_game.h
#	source/sw/src/game.cpp
This commit is contained in:
hendricks266 2019-10-30 05:51:58 +00:00 committed by Christoph Oelckers
parent d679603cab
commit d410694e40
4 changed files with 30 additions and 43 deletions

View file

@ -47,6 +47,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "animlib.h"
#include "anim.h"
#include "common_game.h"
BEGIN_SW_NS
#define MAX_ANMS 10
@ -262,12 +264,9 @@ unsigned char *LoadAnm(short anim_num)
void
playanm(short anim_num)
{
unsigned char *animbuf, *palptr;
unsigned char *animbuf;
int i, j, k, length = 0, numframes = 0;
int32_t handle = -1;
unsigned char ANIMvesapal[4*256];
char tempbuf[256];
char *palook_bak = palookup[0];
UserInput uinfo = { FALSE, FALSE, dir_None };
ANIMnum = anim_num;
@ -292,21 +291,15 @@ playanm(short anim_num)
DSPRINTF(ds,"PlayAnm - Palette Stuff");
MONO_PRINT(ds);
for (i = 0; i < 256; i++)
tempbuf[i] = i;
palookup[0] = tempbuf;
ANIM_LoadAnim(animbuf, length);
ANIMnumframes = ANIM_NumFrames();
numframes = ANIMnumframes;
palptr = ANIM_GetPalette();
videoClearViewableArea(0L);
paletteSetColorTable(0, ANIMvesapal, true);
videoSetPalette(0,0,2);
paletteSetColorTable(ANIMPAL, ANIM_GetPalette());
videoSetPalette(0, ANIMPAL, 2);
if (ANIMnum == 1)
{
// draw the first frame
@ -375,10 +368,8 @@ ENDOFANIMLOOP:
videoClearViewableArea(0L);
videoNextPage();
palookup[0] = palook_bak;
paletteSetColorTable(0, (unsigned char *)palette_data);
videoSetPalette(0, 0, 2);
videoSetPalette(0, BASEPAL, 2);
KB_FlushKeyboardQueue();
KB_ClearKeysDown();

View file

@ -31,6 +31,8 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "pal.h"
#include "game.h"
#include "common_game.h"
BEGIN_SW_NS
short f_c = 3;
@ -435,8 +437,8 @@ void SetPaletteToVESA(unsigned char *pal)
VBE_setPalette(0, 256, pal_buff);
*/
paletteSetColorTable(0, pal);
videoSetPalette(0,0,4|2);
paletteSetColorTable(BASEPAL, pal);
videoSetPalette(0, BASEPAL, 4|2);
// fprintf(stderr,"SetPaletteToVESA() called\n");
}

View file

@ -148,5 +148,15 @@ void SW_ExtInit(void);
typedef enum basepal_ {
BASEPAL = 0,
DREALMSPAL,
TITLEPAL,
TENPAL,
ANIMPAL,
BASEPALCOUNT
} basepal_t;
END_SW_NS
#endif

View file

@ -854,8 +854,8 @@ void AnimateCacheCursor(void)
void COVERsetbrightness(int bright, unsigned char *pal)
{
paletteSetColorTable(0, pal);
videoSetPalette(bright, 0, 0);
paletteSetColorTable(BASEPAL, pal);
videoSetPalette(bright, BASEPAL, 0);
}
@ -1678,37 +1678,25 @@ LogoLevel(void)
{
char called;
int fin;
unsigned char backup_pal[256*3];
char tempbuf[256];
char *palook_bak = palookup[0];
UserInput uinfo = { FALSE, FALSE, dir_None };
int i;
DSPRINTF(ds,"LogoLevel...");
MONO_PRINT(ds);
for (i = 0; i < 256; i++)
tempbuf[i] = i;
palookup[0] = tempbuf;
DSPRINTF(ds,"Created palookup...");
MONO_PRINT(ds);
//GetPaletteFromVESA(pal);
//memcpy(backup_pal, pal, PAL_SIZE);
DSPRINTF(ds,"Got Palette from VESA...");
MONO_PRINT(ds);
// PreCache Anim
LoadAnm(0);
auto pal = kloadfile("3drealms.pal", 0);
if (pal.Size() >= 768)
{
paletteSetColorTable(1, pal.Data());
videoSetPalette(0, 1, 2);
for (auto & c : pal)
c <<= 2;
paletteSetColorTable(DREALMSPAL, pal);
videoSetPalette(0, DREALMSPAL, 2);
}
DSPRINTF(ds,"Just read in 3drealms.pal...");
MONO_PRINT(ds);
@ -1747,13 +1735,9 @@ LogoLevel(void)
}
}
palookup[0] = palook_bak;
videoClearViewableArea(0L);
videoNextPage();
//SetPaletteToVESA(backup_pal);
paletteSetColorTable(0, &palette_data[0][0]);
videoSetPalette(0, 0, 2);
videoSetPalette(0, BASEPAL, 2);
// put up a blank screen while loading