mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@941 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
31b05a433c
commit
2030a42763
5 changed files with 85 additions and 44 deletions
|
@ -592,6 +592,8 @@ void CONFIG_SetupJoystick(void)
|
|||
*/
|
||||
extern char *duke3dgrp;
|
||||
extern void check_valid_color(int *color,int prev_color);
|
||||
extern palette_t crosshair_colors;
|
||||
extern palette_t default_crosshair_colors;
|
||||
|
||||
int32 CONFIG_ReadSetup(void)
|
||||
{
|
||||
|
@ -727,6 +729,7 @@ int32 CONFIG_ReadSetup(void)
|
|||
SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup",&ud.config.ForceSetup);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Crosshairs",&ud.crosshair);
|
||||
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "CrosshairScale",&ud.crosshairscale);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale);
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",&ud.levelstats);
|
||||
|
@ -807,6 +810,30 @@ int32 CONFIG_ReadSetup(void)
|
|||
windowy = -1;
|
||||
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32 *)&windowy);
|
||||
#endif
|
||||
tempbuf[0] = 0;
|
||||
SCRIPT_GetString(ud.config.scripthandle, "Misc", "CrosshairColor",&tempbuf[0]);
|
||||
if (tempbuf[0])
|
||||
{
|
||||
char *ptr = strtok(tempbuf,",");
|
||||
palette_t temppal;
|
||||
if (ptr != NULL)
|
||||
{
|
||||
temppal.r = atoi(ptr);
|
||||
ptr = strtok(NULL,",");
|
||||
if (ptr != NULL)
|
||||
{
|
||||
temppal.g = atoi(ptr);
|
||||
ptr = strtok(NULL,",");
|
||||
if (ptr != NULL)
|
||||
{
|
||||
temppal.b = atoi(ptr);
|
||||
ptr = strtok(NULL,",");
|
||||
Bmemcpy(&crosshair_colors,&temppal,sizeof(palette_t));
|
||||
default_crosshair_colors.f = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CONFIG_ReadKeys();
|
||||
|
@ -986,6 +1013,9 @@ void CONFIG_WriteSetup(void)
|
|||
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, false, false);
|
||||
#endif
|
||||
|
||||
Bsprintf(tempbuf,"%d,%d,%d",crosshair_colors.r,crosshair_colors.g,crosshair_colors.b);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Misc", "CrosshairColor",tempbuf);
|
||||
|
||||
// JBF 20031211
|
||||
for (dummy=0;dummy<NUMGAMEFUNCTIONS;dummy++)
|
||||
{
|
||||
|
|
|
@ -255,4 +255,7 @@ extern void se40code(int x,int y,int z,int a,int h, int smoothratio);
|
|||
extern void FreeMapState(int mapnum);
|
||||
extern void getlevelfromfilename(const char *fn, char *volume, char *level);
|
||||
|
||||
extern void GetCrosshairColor(void);
|
||||
extern void SetCrosshairColor(int r, int g, int b);
|
||||
|
||||
#endif // __funct_h__
|
||||
|
|
|
@ -2048,7 +2048,7 @@ static void coolgaugetext(int snum)
|
|||
else i = p->curr_weapon;
|
||||
altdigitalnumber(-20,-(200-22),p->ammo_amount[i],-16,10+16);
|
||||
|
||||
o = 100;
|
||||
o = 102;
|
||||
permbit = 0;
|
||||
|
||||
if (p->inven_icon)
|
||||
|
@ -3363,39 +3363,29 @@ static void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
|
|||
}
|
||||
}
|
||||
|
||||
extern int getclosestcol(int r, int g, int b);
|
||||
int crosshair_red = 255;
|
||||
int crosshair_green = 255;
|
||||
int crosshair_blue = 0;
|
||||
static int crosshair_red_default = -1;
|
||||
static int crosshair_green_default = -1;
|
||||
static int crosshair_blue_default = -1;
|
||||
#define CROSSHAIR_PAL (MAXPALOOKUPS>>1)
|
||||
|
||||
void SetCrosshairColor(int r, int g, int b)
|
||||
extern int getclosestcol(int r, int g, int b);
|
||||
palette_t crosshair_colors = { 255, 255, 255, 0 };
|
||||
palette_t default_crosshair_colors = { 0, 0, 0, 0 };
|
||||
|
||||
void GetCrosshairColor(void)
|
||||
{
|
||||
/* TODO: turn this into something useful */
|
||||
char *ptr = (char *)waloff[CROSSHAIR];
|
||||
int i, ii;
|
||||
static int sum;
|
||||
|
||||
if (sum == r+(g<<1)+(b<<2)) return;
|
||||
sum = r+(g<<1)+(b<<2);
|
||||
crosshair_red = r;
|
||||
crosshair_green = g;
|
||||
crosshair_blue = b;
|
||||
|
||||
if (waloff[CROSSHAIR] == 0)
|
||||
{
|
||||
loadtile(CROSSHAIR);
|
||||
ptr = (char *)waloff[CROSSHAIR];
|
||||
}
|
||||
|
||||
if (crosshair_red_default == -1)
|
||||
if (default_crosshair_colors.f == 0)
|
||||
{
|
||||
// use the brightest color in the original 8-bit tile
|
||||
int bri = 0, j = 0;
|
||||
int bri = 0, j = 0, i;
|
||||
int ii;
|
||||
char *ptr = (char *)waloff[CROSSHAIR];
|
||||
|
||||
if (waloff[CROSSHAIR] == 0)
|
||||
{
|
||||
loadtile(CROSSHAIR);
|
||||
ptr = (char *)waloff[CROSSHAIR];
|
||||
}
|
||||
|
||||
ii = tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR];
|
||||
|
||||
while (ii > 0)
|
||||
{
|
||||
if (*ptr != 255)
|
||||
|
@ -3406,12 +3396,33 @@ void SetCrosshairColor(int r, int g, int b)
|
|||
ptr++;
|
||||
ii--;
|
||||
}
|
||||
crosshair_red_default = crosshair_red = curpalette[bri].r;
|
||||
crosshair_green_default = crosshair_green = curpalette[bri].g;
|
||||
crosshair_blue_default = crosshair_blue = curpalette[bri].b;
|
||||
|
||||
default_crosshair_colors.r = crosshair_colors.r = curpalette[bri].r;
|
||||
default_crosshair_colors.g = crosshair_colors.g = curpalette[bri].g;
|
||||
default_crosshair_colors.b = crosshair_colors.b = curpalette[bri].b;
|
||||
default_crosshair_colors.f = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void SetCrosshairColor(int r, int g, int b)
|
||||
{
|
||||
char *ptr = (char *)waloff[CROSSHAIR];
|
||||
int i, ii;
|
||||
static int sum;
|
||||
|
||||
if (default_crosshair_colors.f == 0 || sum == r+(g<<1)+(b<<2)) return;
|
||||
sum = r+(g<<1)+(b<<2);
|
||||
crosshair_colors.r = r;
|
||||
crosshair_colors.g = g;
|
||||
crosshair_colors.b = b;
|
||||
|
||||
if (waloff[CROSSHAIR] == 0)
|
||||
{
|
||||
loadtile(CROSSHAIR);
|
||||
ptr = (char *)waloff[CROSSHAIR];
|
||||
}
|
||||
|
||||
i = getclosestcol(crosshair_red>>2, crosshair_green>>2, crosshair_blue>>2);
|
||||
i = getclosestcol(crosshair_colors.r>>2, crosshair_colors.g>>2, crosshair_colors.b>>2);
|
||||
ii = tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR];
|
||||
while (ii > 0)
|
||||
{
|
||||
|
@ -3422,11 +3433,11 @@ void SetCrosshairColor(int r, int g, int b)
|
|||
}
|
||||
for (i = 0; i < 256; i++)
|
||||
tempbuf[i] = i;
|
||||
makepalookup(CROSSHAIR_PAL,tempbuf,crosshair_red>>2, crosshair_green>>2, crosshair_blue>>2,1);
|
||||
makepalookup(CROSSHAIR_PAL,tempbuf,crosshair_colors.r>>2, crosshair_colors.g>>2, crosshair_colors.b>>2,1);
|
||||
|
||||
hictinting[CROSSHAIR_PAL].r = crosshair_red;
|
||||
hictinting[CROSSHAIR_PAL].g = crosshair_green;
|
||||
hictinting[CROSSHAIR_PAL].b = crosshair_blue;
|
||||
hictinting[CROSSHAIR_PAL].r = crosshair_colors.r;
|
||||
hictinting[CROSSHAIR_PAL].g = crosshair_colors.g;
|
||||
hictinting[CROSSHAIR_PAL].b = crosshair_colors.b;
|
||||
hictinting[CROSSHAIR_PAL].f = 1;
|
||||
invalidatetile(CROSSHAIR, -1, -1);
|
||||
}
|
||||
|
|
|
@ -1321,9 +1321,7 @@ static int osdcmd_setcrosshairscale(const osdfuncparm_t *parm)
|
|||
}
|
||||
|
||||
extern void SetCrosshairColor(int r, int g, int b);
|
||||
extern int crosshair_red;
|
||||
extern int crosshair_green;
|
||||
extern int crosshair_blue;
|
||||
extern palette_t crosshair_colors;
|
||||
|
||||
static int osdcmd_crosshaircolor(const osdfuncparm_t *parm)
|
||||
{
|
||||
|
@ -1331,7 +1329,7 @@ static int osdcmd_crosshaircolor(const osdfuncparm_t *parm)
|
|||
|
||||
if (parm->numparms != 3)
|
||||
{
|
||||
OSD_Printf("\"crosshaircolor\" : r:%d g:%d b:%d\n",crosshair_red,crosshair_green,crosshair_blue);
|
||||
OSD_Printf("\"crosshaircolor\" : r:%d g:%d b:%d\n",crosshair_colors.r,crosshair_colors.g,crosshair_colors.b);
|
||||
return OSDCMD_SHOWHELP;
|
||||
}
|
||||
r = atol(parm->parms[0]);
|
||||
|
|
|
@ -400,9 +400,7 @@ static void dofrontscreens(char *statustext)
|
|||
}
|
||||
|
||||
extern void SetCrosshairColor(int r, int g, int b);
|
||||
extern int crosshair_red;
|
||||
extern int crosshair_green;
|
||||
extern int crosshair_blue;
|
||||
extern palette_t crosshair_colors;
|
||||
|
||||
void cacheit(void)
|
||||
{
|
||||
|
@ -559,7 +557,8 @@ void vscrn(void)
|
|||
|
||||
setview(x1,y1,x2-1,y2-1);
|
||||
|
||||
SetCrosshairColor(crosshair_red, crosshair_green, crosshair_blue);
|
||||
GetCrosshairColor();
|
||||
SetCrosshairColor(crosshair_colors.r, crosshair_colors.g, crosshair_colors.b);
|
||||
|
||||
pub = NUMPAGES;
|
||||
pus = NUMPAGES;
|
||||
|
|
Loading…
Reference in a new issue