CON access to hittype[].flags, better crosshair coloring code

git-svn-id: https://svn.eduke32.com/eduke32@939 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-08-07 23:32:18 +00:00
parent abc0aeb07c
commit b9895ca078
6 changed files with 47 additions and 11 deletions

View file

@ -246,7 +246,7 @@ void CONFIG_SetDefaults(void)
ud.screen_tilting = 1;
ud.shadows = 1;
ud.statusbarmode = 0;
ud.statusbarscale = 100;
ud.statusbarscale = 50;
ud.team = 0;
ud.viewbob = 1;
ud.weaponsway = 1;

View file

@ -2019,8 +2019,8 @@ static void coolgaugetext(int snum)
// rotatesprite(sbarx(5+1),sbary(200-25+1),sbarsc(49152L),0,SIXPAK,0,4,10+16+1+32,0,0,xdim-1,ydim-1);
// rotatesprite(sbarx(5),sbary(200-25),sbarsc(49152L),0,SIXPAK,0,0,10+16,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(2+1),sbary(200-22+1),sbarsc(49152L),0,COLA,0,4,10+16+1+32,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(2),sbary(200-22),sbarsc(49152L),0,COLA,0,0,10+16,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(2+1),sbary(200-21+1),sbarsc(49152L),0,COLA,0,4,10+16+1+32,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(2),sbary(200-21),sbarsc(49152L),0,COLA,0,0,10+16,0,0,xdim-1,ydim-1);
if (sprite[p->i].pal == 1 && p->last_extra < 2)
altdigitalnumber(40,-(200-22),1,-16,10+16);
@ -3363,6 +3363,7 @@ 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;
@ -3373,24 +3374,47 @@ void SetCrosshairColor(int r, int g, int b)
/* TODO: turn this into something useful */
char *ptr = (char *)waloff[CROSSHAIR];
int i, ii;
extern int getclosestcol(int r, int g, int b);
static int crosshair_red_default = -1;
static int crosshair_green_default = -1;
static int crosshair_blue_default = -1;
hictinting[CROSSHAIR_PAL].r = crosshair_red = r;
hictinting[CROSSHAIR_PAL].g = crosshair_green = g;
hictinting[CROSSHAIR_PAL].b = crosshair_blue = b;
hictinting[CROSSHAIR_PAL].f = 0;
hictinting[CROSSHAIR_PAL].f = 1;
invalidatetile(CROSSHAIR, -1, -1);
if (waloff[CROSSHAIR] == 0) return;
ii = 0;
if (crosshair_red_default == -1)
{
// use the brightest color in the original 8-bit tile
int bri = 0, j = 0;
ii = tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR];
while (ii > 0)
{
if (*ptr != 255)
{
i = curpalette[(int)*ptr].r+curpalette[(int)*ptr].g+curpalette[(int)*ptr].b;
if (i > j) { j = i; bri = *ptr; }
}
ptr++;
ii--;
}
OSD_Printf("brightest color index: %d\n",bri);
crosshair_red_default = crosshair_red = curpalette[bri].r;
crosshair_green_default = crosshair_green = curpalette[bri].g;
crosshair_blue_default = crosshair_blue = curpalette[bri].b;
}
i = getclosestcol(crosshair_red>>2, crosshair_green>>2, crosshair_blue>>2);
while (ii < tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR])
ii = tilesizx[CROSSHAIR]*tilesizy[CROSSHAIR];
while (ii > 0)
{
if (*ptr != 255)
*ptr = i;
ptr++;
ii++;
ii--;
}
for (i = 0; i < 256; i++)
tempbuf[i] = i;

View file

@ -576,6 +576,8 @@ const memberlabel_t actorlabels[]=
{ "xpanning", ACTOR_XPANNING, 0, 0 },
{ "ypanning", ACTOR_YPANNING, 0, 0 },
{ "htflags", ACTOR_HTFLAGS, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST
};

View file

@ -446,6 +446,7 @@ enum actorlabels
ACTOR_MDFLAGS,
ACTOR_XPANNING,
ACTOR_YPANNING,
ACTOR_HTFLAGS,
};
enum tsprlabels

View file

@ -3480,6 +3480,15 @@ static void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
SetGameVarID(lVar2, spriteext[iActor].ypanning,g_i,g_p);
return;
case ACTOR_HTFLAGS:
if (iSet)
{
hittype[iActor].flags=lValue;
return;
}
SetGameVarID(lVar2,hittype[iActor].flags, g_i, g_p);
return;
default:
return;
}

View file

@ -1310,13 +1310,13 @@ static int osdcmd_setcrosshairscale(const osdfuncparm_t *parm)
{
if (parm->numparms == 0)
{
OSD_Printf("\"cl_crosshairscale\" is \"%d\"\n", ud.crosshairscale);
OSD_Printf("\"crosshairscale\" is \"%d\"\n", ud.crosshairscale);
return OSDCMD_SHOWHELP;
}
else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
ud.crosshairscale = min(100,max(10,Batol(parm->parms[0])));
OSD_Printf("cl_statusbarscale %d\n", ud.crosshairscale);
OSD_Printf("statusbarscale %d\n", ud.crosshairscale);
return OSDCMD_OK;
}
@ -1381,7 +1381,7 @@ int registerosdcommands(void)
OSD_RegisterFunction("bind","bind <key> <string>: associates a keypress with a string of console input. Type \"bind showkeys\" for a list of keys and \"listsymbols\" for a list of valid console commands.", osdcmd_bind);
OSD_RegisterFunction("cl_statusbarscale","cl_statusbarscale: changes the status bar scale", osdcmd_setstatusbarscale);
OSD_RegisterFunction("cl_crosshairscale","cl_crosshairscale: changes the crosshair scale", osdcmd_setcrosshairscale);
OSD_RegisterFunction("crosshairscale","crosshairscale: changes the crosshair scale", osdcmd_setcrosshairscale);
OSD_RegisterFunction("crosshaircolor","crosshaircolor: changes crosshair color", osdcmd_crosshaircolor);
OSD_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu);