Move the new basepal table one step further so that the engine is now aware of it.

git-svn-id: https://svn.eduke32.com/eduke32@1781 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2011-01-27 06:35:52 +00:00
parent f3bf6b542e
commit b6dce8a559
10 changed files with 61 additions and 25 deletions

View file

@ -447,7 +447,8 @@ int32_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
void makepalookup(int32_t palnum, char *remapbuf, int8_t r, int8_t g, int8_t b, char dastat);
void setvgapalette(void);
void setbrightness(char dabrightness, uint8_t *dapal, char noapply);
void setbasepaltable(uint8_t **basepaltable, uint8_t basepalcount);
void setbrightness(char dabrightness, uint8_t dapalid, char noapply);
void setpalettefade(char r, char g, char b, char offset);
void squarerotatetile(int16_t tilenume);

View file

@ -298,7 +298,7 @@ static int32_t osdcmd_cvar_set_baselayer(const osdfuncparm_t *parm)
if (!Bstrcasecmp(parm->name, "vid_gamma") || !Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast"))
{
setbrightness(GAMMA_CALC,palette,0);
setbrightness(GAMMA_CALC,0,0);
return r;
}

View file

@ -490,7 +490,7 @@ int32_t app_main(int32_t argc, const char **argv)
vid_gamma = vid_contrast = 1.0;
vid_brightness = 0.0;
setbrightness(0,palette,0);
setbrightness(0,0,0);
if (setgamemode(fullscreen, xdim2d, ydim2d, 8) < 0)
{
ExtUnInit();
@ -511,7 +511,7 @@ int32_t app_main(int32_t argc, const char **argv)
vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1;
setbrightness(GAMMA_CALC,palette,0);
setbrightness(GAMMA_CALC,0,0);
}
else
{
@ -526,7 +526,7 @@ int32_t app_main(int32_t argc, const char **argv)
// executed once per init, but after setgamemode so that OSD has the right width
OSD_Exec("m32_autoexec.cfg");
setbrightness(GAMMA_CALC,palette,0);
setbrightness(GAMMA_CALC,0,0);
}
CANCEL:
@ -1209,7 +1209,7 @@ void editinput(void)
vid_gamma = vid_contrast = 1.0;
vid_brightness = 0.0;
setbrightness(0,palette,0);
setbrightness(0,0,0);
keystatus[buildkeys[BK_MODE2D_3D]] = 0;
overheadeditor();
@ -1221,7 +1221,7 @@ void editinput(void)
vid_gamma_3d = vid_contrast_3d = vid_brightness_3d = -1;
setbrightness(GAMMA_CALC,palette,0);
setbrightness(GAMMA_CALC,0,0);
}
}
@ -5049,7 +5049,7 @@ CANCEL:
exit(0);
}
setbrightness(GAMMA_CALC,palette,0);
setbrightness(GAMMA_CALC,0,0);
pos.z = oposz;

View file

@ -1193,6 +1193,11 @@ static int32_t bakrendmode,baktile;
int32_t totalclocklock;
char apptitle[256] = "Build Engine";
uint8_t **basepaltableptr;
uint8_t basepalcount;
uint8_t curbasepal;
palette_t curpalette[256]; // the current palette, unadjusted for brightness or tint
palette_t curpalettefaded[256]; // the current palette, adjusted for brightness and tint (ie. what gets sent to the card)
palette_t palfadergb = { 0,0,0,0 };
@ -8414,7 +8419,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
setview(0L,0L,xdim-1,ydim-1);
clearallviews(0L);
setbrightness(curbrightness,palette,0);
setbrightness(curbrightness,0,0);
if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); }
@ -11119,13 +11124,30 @@ void setvgapalette(void)
setpalette(0,256);
}
//
// setbasepaltable
//
void setbasepaltable(uint8_t **thebasepaltable, uint8_t thebasepalcount)
{
basepaltableptr = thebasepaltable;
basepalcount = thebasepalcount;
}
//
// setbrightness
//
void setbrightness(char dabrightness, uint8_t *dapal, char noapply)
void setbrightness(char dabrightness, uint8_t dapalid, char noapply)
{
int32_t i, k, j;
uint8_t *dapal;
// uint32_t lastbright = curbrightness;
if (dapalid >= basepalcount)
dapalid = 0;
curbasepal = dapalid;
dapal = basepaltableptr[dapalid];
if (!(noapply&4))
{

View file

@ -8,6 +8,10 @@
#define MAXNODESPERLINE 42 //Warning: This depends on MAXYSAVES & MAXYDIM!
#define MAXCLIPDIST 1024
extern uint8_t **basepaltableptr;
extern uint8_t basepalcount;
extern uint8_t curbasepal;
extern char pow2char[8];
extern int32_t pow2int[32];

View file

@ -6196,7 +6196,7 @@ static void Keys3d(void)
brightness &= 15;
vid_gamma = 1.0 + ((float)brightness / 10.0);
setbrightness(brightness, palette, 0);
setbrightness(brightness, 0, 0);
message("Brightness: %d/16", brightness+1);
}
@ -9177,6 +9177,8 @@ int32_t ExtInit(void)
initprintf("There was a problem initializing the engine.\n");
return -1;
}
setbasepaltable(basepaltable, BASEPALCOUNT);
kensplayerheight = 40; //32
zmode = 2;
@ -10149,28 +10151,28 @@ void SetBOSS1Palette(void)
{
if (acurpalette==3) return;
acurpalette=3;
setbrightness(GAMMA_CALC,BOSS1palette,0);
setbrightness(GAMMA_CALC,5,0);
}
void SetSLIMEPalette(void)
{
if (acurpalette==2) return;
acurpalette=2;
setbrightness(GAMMA_CALC,SLIMEpalette,0);
setbrightness(GAMMA_CALC,2,0);
}
void SetWATERPalette(void)
{
if (acurpalette==1) return;
acurpalette=1;
setbrightness(GAMMA_CALC,WATERpalette,0);
setbrightness(GAMMA_CALC,1,0);
}
void SetGAMEPalette(void)
{
if (acurpalette==0) return;
acurpalette=0;
setbrightness(GAMMA_CALC,GAMEpalette,0);
setbrightness(GAMMA_CALC,6,0);
}
static void SearchSectors(int32_t dir) // <0: backwards, >=0: forwards

View file

@ -296,7 +296,7 @@ void P_SetGamePalette(DukePlayer_t *player, uint8_t palid, int32_t set)
player->palette = palid;
setbrightness(ud.brightness>>2, basepaltable[palid], set);
setbrightness(ud.brightness>>2, palid, set);
}
int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const char *t,
@ -9048,6 +9048,8 @@ static void G_Startup(void)
fprintf(stderr, "G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr);
exit(6);
}
setbasepaltable(basepaltable, BASEPALCOUNT);
G_InitDynamicTiles();
@ -9910,7 +9912,7 @@ CLEAN_DIRECTORY:
ud.config.ScreenBPP = bpp[i];
}
setbrightness(ud.brightness>>2,basepaltable[g_player[myconnectindex].ps->palette],0);
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
S_MusicStartup();
S_SoundStartup();

View file

@ -113,9 +113,14 @@ static void EditWallData(int16_t wallnum);
static void EditSectorData(int16_t sectnum);
static void FuncMenu(void);
#define BASEPALCOUNT 7
static uint8_t GAMEpalette[768], WATERpalette[768], SLIMEpalette[768], TITLEpalette[768];
static uint8_t REALMSpalette[768], BOSS1palette[768];
uint8_t *basepaltable[BASEPALCOUNT] = { palette, WATERpalette, SLIMEpalette, TITLEpalette, REALMSpalette, BOSS1palette, GAMEpalette };
static char num_tables;
static int32_t updownunits=1024;

View file

@ -2613,7 +2613,7 @@ cheat_for_port_credits:
vid_gamma = (double)b/40960.f;
ud.brightness = (int32_t)(min(max((double)((vid_gamma-1.0)*10.0),0),15));
ud.brightness <<= 2;
setbrightness(ud.brightness>>2,basepaltable[g_player[myconnectindex].ps->palette],0);
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
}
b = (int32_t)(vid_contrast*40960.f);
@ -2622,7 +2622,7 @@ cheat_for_port_credits:
if (b != (vid_contrast*40960.f))
{
vid_contrast = (double)b/40960.f;
setbrightness(ud.brightness>>2,basepaltable[g_player[myconnectindex].ps->palette],0);
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
}
b = (int32_t)(vid_brightness*40960.f);
@ -2631,7 +2631,7 @@ cheat_for_port_credits:
if (b != (vid_brightness*40960.f))
{
vid_brightness = (double)b/40960.f;
setbrightness(ud.brightness>>2,basepaltable[g_player[myconnectindex].ps->palette],0);
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
}
if (x == 3)
@ -2640,7 +2640,7 @@ cheat_for_port_credits:
vid_contrast = DEFAULT_CONTRAST;
vid_brightness = DEFAULT_BRIGHTNESS;
ud.brightness = 0;
setbrightness(ud.brightness>>2,basepaltable[g_player[myconnectindex].ps->palette],0);
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
}
}

View file

@ -731,7 +731,7 @@ void onvideomodechange(int32_t newmode)
}
#endif
setbrightness(ud.brightness>>2, basepaltable[palid], 0);
setbrightness(ud.brightness>>2, palid, 0);
g_restorePalette = 1;
g_crosshairSum = 0;
}
@ -1304,19 +1304,19 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
{
ud.brightness = GAMMA_CALC;
ud.brightness <<= 2;
setbrightness(ud.brightness>>2,basepaltable[g_player[myconnectindex].ps->palette],0);
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
return r;
}
else if (!Bstrcasecmp(parm->name, "vid_brightness"))
{
setbrightness(ud.brightness>>2,basepaltable[g_player[myconnectindex].ps->palette],0);
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
return r;
}
else if (!Bstrcasecmp(parm->name, "vid_contrast"))
{
setbrightness(ud.brightness>>2,basepaltable[g_player[myconnectindex].ps->palette],0);
setbrightness(ud.brightness>>2,g_player[myconnectindex].ps->palette,0);
return r;
}