mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 11:10:39 +00:00
Fix saving and loading crosshaircolor, and fix fps counter color when using a palette that doesn't correspond to Duke3D's color indexes.
git-svn-id: https://svn.eduke32.com/eduke32@5387 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
49bc51a56d
commit
470449a963
6 changed files with 43 additions and 49 deletions
|
@ -700,6 +700,7 @@ EXTERN char *palookup[MAXPALOOKUPS];
|
||||||
extern uint8_t *basepaltable[MAXBASEPALS];
|
extern uint8_t *basepaltable[MAXBASEPALS];
|
||||||
EXTERN uint8_t paletteloaded;
|
EXTERN uint8_t paletteloaded;
|
||||||
EXTERN char *blendtable[MAXBLENDTABS];
|
EXTERN char *blendtable[MAXBLENDTABS];
|
||||||
|
EXTERN uint8_t whitecol;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PALETTE_MAIN = 1<<0,
|
PALETTE_MAIN = 1<<0,
|
||||||
|
|
|
@ -265,7 +265,7 @@ extern void showspritedata(int16_t spritenum, int16_t small);
|
||||||
|
|
||||||
extern void drawsmallabel(const char *text, char col, char backcol, char border, int32_t dax, int32_t day, int32_t daz);
|
extern void drawsmallabel(const char *text, char col, char backcol, char border, int32_t dax, int32_t day, int32_t daz);
|
||||||
|
|
||||||
extern int32_t whitecol, blackcol;
|
extern uint8_t blackcol;
|
||||||
extern int32_t circlewall;
|
extern int32_t circlewall;
|
||||||
extern int32_t searchlock;
|
extern int32_t searchlock;
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ int32_t showfirstwall=0;
|
||||||
int32_t showheightindicators=1;
|
int32_t showheightindicators=1;
|
||||||
int32_t circlewall=-1;
|
int32_t circlewall=-1;
|
||||||
|
|
||||||
int32_t whitecol, blackcol;
|
uint8_t blackcol;
|
||||||
|
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
static int16_t maphacklightcnt=0;
|
static int16_t maphacklightcnt=0;
|
||||||
|
|
|
@ -703,26 +703,6 @@ int32_t CONFIG_ReadSetup(void)
|
||||||
tempbuf[0] = 0;
|
tempbuf[0] = 0;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SCRIPT_GetString(ud.config.scripthandle, "Misc", "CrosshairColor",&tempbuf[0]);
|
|
||||||
if (tempbuf[0])
|
|
||||||
{
|
|
||||||
char *ptr = strtok(tempbuf,",");
|
|
||||||
palette_t temppal;
|
|
||||||
char *palptr = (char *)&temppal;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (ptr != NULL && i < 3)
|
|
||||||
{
|
|
||||||
palptr[i++] = Batoi(ptr);
|
|
||||||
ptr = strtok(NULL,",");
|
|
||||||
}
|
|
||||||
if (i == 3)
|
|
||||||
{
|
|
||||||
Bmemcpy(&CrosshairColors,&temppal,sizeof(palette_t));
|
|
||||||
DefaultCrosshairColors.f = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -746,7 +726,7 @@ int32_t CONFIG_ReadSetup(void)
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void CONFIG_WriteBinds(void) // save binds and aliases to <cfgname>_settings.cfg
|
void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.cfg
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
BFILE *fp;
|
BFILE *fp;
|
||||||
|
@ -778,6 +758,10 @@ void CONFIG_WriteBinds(void) // save binds and aliases to <cfgname>_settings.cfg
|
||||||
CONTROL_MouseBinds[i].repeat?"":" norepeat",CONTROL_MouseBinds[i].cmdstr);
|
CONTROL_MouseBinds[i].repeat?"":" norepeat",CONTROL_MouseBinds[i].cmdstr);
|
||||||
|
|
||||||
OSD_WriteAliases(fp);
|
OSD_WriteAliases(fp);
|
||||||
|
|
||||||
|
if (g_crosshairSum && g_crosshairSum != DefaultCrosshairColors.r+(DefaultCrosshairColors.g<<1)+(DefaultCrosshairColors.b<<2))
|
||||||
|
Bfprintf(fp, "crosshaircolor %d %d %d\n", CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
|
||||||
|
|
||||||
OSD_WriteCvars(fp);
|
OSD_WriteCvars(fp);
|
||||||
|
|
||||||
Bfclose(fp);
|
Bfclose(fp);
|
||||||
|
@ -979,7 +963,7 @@ void CONFIG_WriteSetup(uint32_t flags)
|
||||||
SCRIPT_Free(ud.config.scripthandle);
|
SCRIPT_Free(ud.config.scripthandle);
|
||||||
|
|
||||||
OSD_Printf("Wrote %s\n",setupfilename);
|
OSD_Printf("Wrote %s\n",setupfilename);
|
||||||
CONFIG_WriteBinds();
|
CONFIG_WriteSettings();
|
||||||
Bfflush(NULL);
|
Bfflush(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2421,7 +2421,7 @@ static void G_DrawStatusBar(int32_t snum)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define COLOR_RED 248
|
#define COLOR_RED 248
|
||||||
#define COLOR_WHITE 31
|
#define COLOR_WHITE whitecol
|
||||||
#define LOW_FPS 30
|
#define LOW_FPS 30
|
||||||
|
|
||||||
#if defined GEKKO
|
#if defined GEKKO
|
||||||
|
@ -3364,16 +3364,20 @@ void G_GetCrosshairColor(void)
|
||||||
|
|
||||||
void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
|
void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
|
||||||
{
|
{
|
||||||
char *ptr = (char *)waloff[CROSSHAIR];
|
|
||||||
int32_t i, ii;
|
int32_t i, ii;
|
||||||
|
|
||||||
if (DefaultCrosshairColors.f == 0 || g_crosshairSum == r+(g<<8)+(b<<16)) return;
|
if (g_crosshairSum == r+(g<<8)+(b<<16)) return;
|
||||||
|
|
||||||
|
if (!DefaultCrosshairColors.f)
|
||||||
|
G_GetCrosshairColor();
|
||||||
|
|
||||||
g_crosshairSum = r+(g<<8)+(b<<16);
|
g_crosshairSum = r+(g<<8)+(b<<16);
|
||||||
CrosshairColors.r = r;
|
CrosshairColors.r = r;
|
||||||
CrosshairColors.g = g;
|
CrosshairColors.g = g;
|
||||||
CrosshairColors.b = b;
|
CrosshairColors.b = b;
|
||||||
|
|
||||||
|
char *ptr = (char *) waloff[CROSSHAIR];
|
||||||
|
|
||||||
if (waloff[CROSSHAIR] == 0)
|
if (waloff[CROSSHAIR] == 0)
|
||||||
{
|
{
|
||||||
loadtile(CROSSHAIR);
|
loadtile(CROSSHAIR);
|
||||||
|
@ -4028,14 +4032,6 @@ void G_DrawBackground(void)
|
||||||
|
|
||||||
flushperms();
|
flushperms();
|
||||||
|
|
||||||
// XXX: if dapicnum is not available, this might leave the menu background
|
|
||||||
// not drawn, leading to "HOM".
|
|
||||||
if (tilesiz[dapicnum].x == 0 || tilesiz[dapicnum].y == 0)
|
|
||||||
{
|
|
||||||
pus = pub = NUMPAGES;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t y1=0, y2=ydim;
|
int32_t y1=0, y2=ydim;
|
||||||
|
|
||||||
if ((g_player[myconnectindex].ps->gm&MODE_GAME) || ud.recstat == 2)
|
if ((g_player[myconnectindex].ps->gm&MODE_GAME) || ud.recstat == 2)
|
||||||
|
@ -4074,6 +4070,14 @@ void G_DrawBackground(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: if dapicnum is not available, this might leave the menu background
|
||||||
|
// not drawn, leading to "HOM".
|
||||||
|
if (tilesiz[dapicnum].x == 0 || tilesiz[dapicnum].y == 0)
|
||||||
|
{
|
||||||
|
pus = pub = NUMPAGES;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
y2 = scale(ydim,200-sbarsc(tilesiz[BOTTOMSTATUSBAR].y),200);
|
y2 = scale(ydim,200-sbarsc(tilesiz[BOTTOMSTATUSBAR].y),200);
|
||||||
|
|
||||||
if (ud.screen_size > 8)
|
if (ud.screen_size > 8)
|
||||||
|
@ -7248,8 +7252,7 @@ static inline void G_DoEventAnimSprites(int32_t j)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spriteext[ow].tspr = &tsprite[j];
|
spriteext[ow].tspr = &tsprite[j];
|
||||||
// XXX: wouldn't screenpeek be more meaningful as current player?
|
VM_OnEvent_(EVENT_ANIMATESPRITES, ow, screenpeek);
|
||||||
VM_OnEvent_(EVENT_ANIMATESPRITES, ow, myconnectindex);
|
|
||||||
spriteext[ow].tspr = NULL;
|
spriteext[ow].tspr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11783,15 +11786,6 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
|
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
char *ptr = Xstrdup(setupfilename), *p = strtok(ptr,".");
|
|
||||||
if (!Bstrcmp(setupfilename, SETUPFILENAME))
|
|
||||||
Bsprintf(tempbuf, "settings.cfg");
|
|
||||||
else Bsprintf(tempbuf,"%s_settings.cfg",p);
|
|
||||||
OSD_Exec(tempbuf);
|
|
||||||
Bfree(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||||
if ((i = clipmapinfo_load()) > 0)
|
if ((i = clipmapinfo_load()) > 0)
|
||||||
initprintf("There was an error loading the sprite clipping map (status %d).\n", i);
|
initprintf("There was an error loading the sprite clipping map (status %d).\n", i);
|
||||||
|
@ -11808,8 +11802,6 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
for (i = MINIFONT + ('a'-'!'); minitext_lowercase && i < MINIFONT + ('z'-'!') + 1; ++i)
|
for (i = MINIFONT + ('a'-'!'); minitext_lowercase && i < MINIFONT + ('z'-'!') + 1; ++i)
|
||||||
minitext_lowercase &= tile_exists(i);
|
minitext_lowercase &= tile_exists(i);
|
||||||
|
|
||||||
OSD_Exec("autoexec.cfg");
|
|
||||||
|
|
||||||
system_getcvars();
|
system_getcvars();
|
||||||
|
|
||||||
if (g_networkMode != NET_DEDICATED_SERVER)
|
if (g_networkMode != NET_DEDICATED_SERVER)
|
||||||
|
@ -11858,6 +11850,18 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
}
|
}
|
||||||
// loadtmb();
|
// loadtmb();
|
||||||
|
|
||||||
|
char *ptr = Xstrdup(setupfilename), *p = strtok(ptr, ".");
|
||||||
|
|
||||||
|
if (!Bstrcmp(setupfilename, SETUPFILENAME))
|
||||||
|
Bsprintf(tempbuf, "settings.cfg");
|
||||||
|
else
|
||||||
|
Bsprintf(tempbuf, "%s_settings.cfg", p);
|
||||||
|
|
||||||
|
OSD_Exec(tempbuf);
|
||||||
|
Bfree(ptr);
|
||||||
|
|
||||||
|
OSD_Exec("autoexec.cfg");
|
||||||
|
|
||||||
M_Init();
|
M_Init();
|
||||||
|
|
||||||
if (ud.warp_on > 1 && (!g_netServer && ud.multimode < 2))
|
if (ud.warp_on > 1 && (!g_netServer && ud.multimode < 2))
|
||||||
|
|
|
@ -752,7 +752,10 @@ static int32_t osdcmd_crosshaircolor(const osdfuncparm_t *parm)
|
||||||
g = Batol(parm->parms[1]);
|
g = Batol(parm->parms[1]);
|
||||||
b = Batol(parm->parms[2]);
|
b = Batol(parm->parms[2]);
|
||||||
G_SetCrosshairColor(r,g,b);
|
G_SetCrosshairColor(r,g,b);
|
||||||
|
|
||||||
|
if (!OSD_ParsingScript())
|
||||||
OSD_Printf("%s\n", parm->raw);
|
OSD_Printf("%s\n", parm->raw);
|
||||||
|
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1077,6 +1080,8 @@ static int32_t osdcmd_bind(const osdfuncparm_t *parm)
|
||||||
if (CONTROL_KeyIsBound(ConsoleKeys[i].id))
|
if (CONTROL_KeyIsBound(ConsoleKeys[i].id))
|
||||||
OSD_Printf("%-9s %s\"%s\"\n", ConsoleKeys[i].name, CONTROL_KeyBinds[ConsoleKeys[i].id].repeat?"":"norepeat ",
|
OSD_Printf("%-9s %s\"%s\"\n", ConsoleKeys[i].name, CONTROL_KeyBinds[ConsoleKeys[i].id].repeat?"":"norepeat ",
|
||||||
CONTROL_KeyBinds[ConsoleKeys[i].id].cmdstr);
|
CONTROL_KeyBinds[ConsoleKeys[i].id].cmdstr);
|
||||||
|
else OSD_Printf("%s is unbound\n", ConsoleKeys[i].name);
|
||||||
|
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue