New alternate mini-hud

git-svn-id: https://svn.eduke32.com/eduke32@934 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-08-07 07:52:36 +00:00
parent 0caeecaf9a
commit a5f12d9f55
9 changed files with 274 additions and 54 deletions

View file

@ -220,6 +220,7 @@ void CONFIG_SetDefaults(void)
ud.config.ShowOpponentWeapons = 0;
ud.config.SmoothInput = 1;
ud.config.SoundToggle = 1;
ud.althud = 1;
ud.automsg = 0;
ud.autovote = 0;
ud.brightness = 8;
@ -749,6 +750,7 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "IDPlayers",&ud.automsg);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AltHud",&ud.althud);
dummy = ud.config.useprecache;
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "UsePrecache",&dummy);
@ -899,6 +901,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "UsePrecache",ud.config.useprecache,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ViewBobbing",ud.viewbob,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponSway",ud.weaponsway,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AltHud",ud.althud,false,false);
// SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Detail",ud.detail,false,false);

View file

@ -405,7 +405,7 @@ typedef struct {
int runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125
int democams,color,msgdisptime,statusbarmode;
int m_noexits,noexits,autovote,automsg,idplayers;
int team, viewbob, weaponsway;
int team, viewbob, weaponsway, althud;
int entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
int coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;

View file

@ -200,6 +200,12 @@ static inline int sbarx(int x)
return (((320l<<16) - scale(320l<<16,ud.statusbarscale,100)) >> 1) + scale(x<<16,ud.statusbarscale,100);
}
static inline int sbarxr(int x)
{
if (ud.screen_size == 4 /*|| ud.statusbarmode == 1*/) return (320l<<16) - scale(x<<16,ud.statusbarscale,100);
return (((320l<<16) - scale(320l<<16,ud.statusbarscale,100)) >> 1) + scale(x<<16,ud.statusbarscale,100);
}
static inline int sbary(int y)
{
return ((200l<<16) - scale(200l<<16,ud.statusbarscale,100) + scale(y<<16,ud.statusbarscale,100));
@ -1565,9 +1571,19 @@ void myospalx(int x, int y, int tilenum, int shade, int orientation, int p)
static void invennum(int x,int y,char num1,char ha,char sbits)
{
char dabuf[80] = {0};
int shd = (x < 0);
if (shd) x = -x;
Bsprintf(dabuf,"%d",num1);
if (num1 > 99)
{
if (shd)
{
rotatesprite(sbarx(x-4+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,4,1|32|sbits,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(x+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,4,1|32|sbits,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(x+4+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,4,1|32|sbits,0,0,xdim-1,ydim-1);
}
rotatesprite(sbarx(x-4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,sbits,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,sbits,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[2]-'0',ha,0,sbits,0,0,xdim-1,ydim-1);
@ -1575,6 +1591,12 @@ static void invennum(int x,int y,char num1,char ha,char sbits)
}
if (num1 > 9)
{
if (shd)
{
rotatesprite(sbarx(x+1),sbary(y+1),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,4,1|32|sbits,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,1|32|sbits,0,0,xdim-1,ydim-1);
}
rotatesprite(sbarx(x),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[0]-'0',ha,0,sbits,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(x+4),sbary(y),sbarsc(65536L),0,THREEBYFIVE+dabuf[1]-'0',ha,0,sbits,0,0,xdim-1,ydim-1);
return;
@ -1796,6 +1818,50 @@ void txdigitalnumberz(int starttile, int x,int y,int n,int s,int pal,int cs,int
}
}
static void altdigitalnumber(int x,int y,int n,char s,char cs)
{
int i, j = 0, k, p, c;
char b[10];
int rev = (x < 0);
int shd = (y < 0);
if (rev) x = -x;
if (shd) y = -y;
Bsnprintf(b,10,"%d",n);
i = Bstrlen(b);
for (k=0;k<i;k++)
{
p = 2930+*(b+k)-'0';
j += tilesizx[p]+1;
}
c = x-(j>>1);
if (rev)
{
// j = 0;
for (k=0;k<i;k++)
{
p = 2930+*(b+k)-'0';
if (shd)
rotatesprite(sbarxr(c+j-1),sbary(y+1),sbarsc(65536L),0,p,s,4,cs|1|32,0,0,xdim-1,ydim-1);
rotatesprite(sbarxr(c+j),sbary(y),sbarsc(65536L),0,p,s,0,cs,0,0,xdim-1,ydim-1);
j -= tilesizx[p]+1;
}
return;
}
j = 0;
for (k=0;k<i;k++)
{
p = 2930+*(b+k)-'0';
if (shd)
rotatesprite(sbarx(c+j+1),sbary(y+1),sbarsc(65536L),0,p,s,4,cs|1|32,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(c+j),sbary(y),sbarsc(65536L),0,p,s,0,cs,0,0,xdim-1,ydim-1);
j += tilesizx[p]+1;
}
}
static void displayinventory(player_struct *p)
{
int n, j = 0, xoff = 0, y;
@ -1819,17 +1885,17 @@ static void displayinventory(player_struct *p)
j = 0;
if (ud.screen_size > 4)
// if (ud.screen_size > 4)
y = 154;
else y = (ud.drawweapon == 2?150:172);
// else y = (ud.drawweapon == 2?150:172);
if (ud.screen_size == 4 && ud.drawweapon != 2)
/* if (ud.screen_size == 4 && ud.drawweapon != 2)
{
xoff += 65;
if (ud.multimode > 1)
xoff -= 9;
}
*/
while (j <= 9)
{
if (n&(1<<j))
@ -1928,6 +1994,141 @@ static void coolgaugetext(int snum)
if (ss == 4) //DRAW MINI STATUS BAR:
{
if (ud.althud) // althud
{
static int ammo_sprites[MAX_WEAPONS];
if (!ammo_sprites[0])
{
/* this looks stupid but it lets us initialize static memory to dynamic values
these values can be changed from the CONs with dynamic tile remapping
but we don't want to have to recreate the values in memory every time
the HUD is drawn */
int asprites[MAX_WEAPONS] = { BOOTS, AMMO, SHOTGUNAMMO,
BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO,
TRIPBOMBSPRITE, FREEZEAMMO, HBOMBAMMO, GROWAMMO
};
Bmemcpy(ammo_sprites,asprites,sizeof(ammo_sprites));
}
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);
if (sprite[p->i].pal == 1 && p->last_extra < 2)
altdigitalnumber(40,-(200-22),1,-16,10+16);
else altdigitalnumber(40,-(200-22),p->last_extra,-16,10+16);
rotatesprite(sbarx(62+1),sbary(200-25+1),sbarsc(49152L),0,SHIELD,0,4,10+16+1+32,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(62),sbary(200-25),sbarsc(49152L),0,SHIELD,0,0,10+16,0,0,xdim-1,ydim-1);
altdigitalnumber(105,-(200-22),p->shield_amount,-16,10+16);
i = 32768;
if (p->curr_weapon == PISTOL_WEAPON) i = 16384;
rotatesprite(sbarxr(57-1),sbary(200-14+1),sbarsc(i),0,ammo_sprites[p->curr_weapon],0,4,2+1+32,0,0,xdim-1,ydim-1);
rotatesprite(sbarxr(57),sbary(200-14),sbarsc(i),0,ammo_sprites[p->curr_weapon],0,0,2,0,0,xdim-1,ydim-1);
if (p->curr_weapon == HANDREMOTE_WEAPON) i = HANDBOMB_WEAPON;
else i = p->curr_weapon;
altdigitalnumber(-20,-(200-22),p->ammo_amount[i],-16,10+16);
o = 100;
permbit = 0;
if (p->inven_icon)
{
switch (p->inven_icon)
{
case 1:
i = FIRSTAID_ICON;
break;
case 2:
i = STEROIDS_ICON;
break;
case 3:
i = HOLODUKE_ICON;
break;
case 4:
i = JETPACK_ICON;
break;
case 5:
i = HEAT_ICON;
break;
case 6:
i = AIRTANK_ICON;
break;
case 7:
i = BOOT_ICON;
break;
default:
i = -1;
}
if (i >= 0)
{
rotatesprite(sbarx(231-o+1),sbary(200-21-2+1),sbarsc(65536L),0,i,0,4,10+16+permbit+1+32,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(231-o),sbary(200-21-2),sbarsc(65536L),0,i,0,0,10+16+permbit,0,0,xdim-1,ydim-1);
}
minitext(292-30-o+1,190-3+1,"%",4,32+1+10+16+permbit + 256);
minitext(292-30-o,190-3,"%",6,10+16+permbit + 256);
j = 0x80000000;
switch (p->inven_icon)
{
case 1:
i = p->firstaid_amount;
break;
case 2:
i = ((p->steroids_amount+3)>>2);
break;
case 3:
i = ((p->holoduke_amount+15)/24);
j = p->holoduke_on;
break;
case 4:
i = ((p->jetpack_amount+15)>>4);
j = p->jetpack_on;
break;
case 5:
i = p->heat_amount/12;
j = p->heat_on;
break;
case 6:
i = ((p->scuba_amount+63)>>6);
break;
case 7:
i = (p->boot_amount>>1);
break;
}
invennum(-(284-30-o),200-6-3,(char)i,0,10+permbit);
if (j > 0)
{
minitext(288-30-o+1,180-3+1,"ON",4,32+1+10+16+permbit + 256);
minitext(288-30-o,180-3,"ON",0,10+16+permbit + 256);
}
else if ((unsigned int)j != 0x80000000)
{
minitext(284-30-o+1,180-3+1,"OFF",4,32+1+10+16+permbit + 256);
minitext(284-30-o,180-3,"OFF",2,10+16+permbit + 256);
}
if (p->inven_icon >= 6)
{
minitext(284-35-o+1,180-3+1,"AUTO",4,32+1+10+16+permbit + 256);
minitext(284-35-o,180-3,"AUTO",2,10+16+permbit + 256);
}
}
if (p->got_access&1) rotatesprite(sbarxr(39-1),sbary(200-43+1),sbarsc(32768),0,ACCESSCARD,0,4,10+16+32+1,0,0,xdim-1,ydim-1);
if (p->got_access&2) rotatesprite(sbarxr(34-1),sbary(200-41+1),sbarsc(32768),0,ACCESSCARD,0,4,10+16+32+1,0,0,xdim-1,ydim-1);
if (p->got_access&4) rotatesprite(sbarxr(29-1),sbary(200-39+1),sbarsc(32768),0,ACCESSCARD,0,4,10+16+32+1,0,0,xdim-1,ydim-1);
if (p->got_access&1) rotatesprite(sbarxr(39),sbary(200-43),sbarsc(32768),0,ACCESSCARD,0,0,10+16,0,0,xdim-1,ydim-1);
if (p->got_access&2) rotatesprite(sbarxr(34),sbary(200-41),sbarsc(32768),0,ACCESSCARD,0,21,10+16,0,0,xdim-1,ydim-1);
if (p->got_access&4) rotatesprite(sbarxr(29),sbary(200-39),sbarsc(32768),0,ACCESSCARD,0,23,10+16,0,0,xdim-1,ydim-1);
return;
}
rotatesprite(sbarx(5),sbary(200-28),sbarsc(65536L),0,HEALTHBOX,0,21,10+16,0,0,xdim-1,ydim-1);
if (p->inven_icon)
rotatesprite(sbarx(69),sbary(200-30),sbarsc(65536L),0,INVENTORYBOX,0,21,10+16,0,0,xdim-1,ydim-1);

View file

@ -879,6 +879,7 @@ const memberlabel_t userdefslabels[]=
{ "obituaries", USERDEFS_OBITUARIES, 0, 0 },
{ "levelstats", USERDEFS_LEVELSTATS, 0, 0 },
{ "crosshairscale", USERDEFS_CROSSHAIRSCALE, 0, 0 },
{ "althud", USERDEFS_ALTHUD, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST
};

View file

@ -342,7 +342,8 @@ enum userdefslabels
USERDEFS_ANGLEINTERPOLATION,
USERDEFS_OBITUARIES,
USERDEFS_LEVELSTATS,
USERDEFS_CROSSHAIRSCALE
USERDEFS_CROSSHAIRSCALE,
USERDEFS_ALTHUD
};
enum sectorlabels

View file

@ -874,6 +874,15 @@ static void DoUserDef(int iSet, int lLabelID, int lVar2)
SetGameVarID(lVar2, ud.crosshairscale, g_i, g_p);
return;
case USERDEFS_ALTHUD:
if (iSet)
{
ud.althud = lValue;
return;
}
SetGameVarID(lVar2, ud.althud, g_i, g_p);
return;
default:
return;
}

View file

@ -2884,6 +2884,7 @@ cheat_for_port_credits:
"-",
"Show inv & pickup messages",
"HUD weapon display",
"Use alternate HUD",
"Demo playback cameras",
"-",
"DM: Ignore map votes",
@ -2900,8 +2901,6 @@ cheat_for_port_credits:
"-",
"-",
#endif
"-",
"-",
"-",
"Previous page",
NULL
@ -2964,11 +2963,16 @@ cheat_for_port_credits:
break;
}
case 3:
if (x==io) ud.althud = 1-ud.althud;
modval(0,1,(int *)&ud.althud,1,probey==io);
mgametextpal(d,yy, ud.althud ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break;
case 4:
if (x==io) ud.democams = 1-ud.democams;
modval(0,1,(int *)&ud.democams,1,probey==io);
mgametextpal(d,yy, ud.democams ? "On" : "Off", MENUHIGHLIGHT(io), 0);
break;
case 4:
case 5:
if (x==io)
{
ud.autovote = (ud.autovote == 2) ? 0 : ud.autovote+1;
@ -2979,28 +2983,28 @@ cheat_for_port_credits:
mgametextpal(d,yy, s[ud.autovote], MENUHIGHLIGHT(io), 0);
break;
}
case 5:
case 6:
if (x==io) ud.automsg = 1-ud.automsg;
modval(0,1,(int *)&ud.automsg,1,probey==io);
mgametextpal(d,yy, ud.automsg ? "Off" : "On", MENUHIGHLIGHT(io), 0);
break;
case 6:
case 7:
if (x==io) ud.idplayers = 1-ud.idplayers;
modval(0,1,(int *)&ud.idplayers,1,probey==io);
mgametextpal(d,yy, ud.idplayers ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break;
case 7:
case 8:
if (x==io) ud.showweapons = 1-ud.showweapons;
modval(0,1,(int *)&ud.showweapons,1,probey==io);
ud.config.ShowOpponentWeapons = ud.showweapons;
mgametextpal(d,yy, ud.config.ShowOpponentWeapons ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break;
case 8:
case 9:
if (x==io) ud.obituaries = 1-ud.obituaries;
modval(0,1,(int *)&ud.obituaries,1,probey==io);
mgametextpal(d,yy, ud.obituaries ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break;
case 9:
case 10:
{
int osdmode = OSD_GetTextMode();
if (x==io) osdmode = !osdmode;
@ -3011,7 +3015,7 @@ cheat_for_port_credits:
break;
}
#ifdef _WIN32
case 10:
case 11:
i = ud.config.CheckForUpdates;
if (x==io) ud.config.CheckForUpdates = 1-ud.config.CheckForUpdates;
modval(0,1,(int *)&ud.config.CheckForUpdates,1,probey==io);
@ -3019,9 +3023,9 @@ cheat_for_port_credits:
ud.config.LastUpdateCheck = 0;
mgametextpal(d,yy, ud.config.CheckForUpdates ? "Yes" : "No", MENUHIGHLIGHT(io), 0);
break;
case 11:
case 12:
#else
case 10:
case 11:
#endif
if (x==io) cmenu(200);
break;

View file

@ -656,6 +656,7 @@ cvarmappings cvar[] =
{
{ "crosshair", "crosshair: enable/disable crosshair", (void*)&ud.crosshair, CVAR_BOOL, 0, 0, 1 },
{ "cl_althud", "cl_althud: enable/disable alternate mini-hud", (void*)&ud.althud, CVAR_BOOL, 0, 0, 1 },
{ "cl_autoaim", "cl_autoaim: enable/disable weapon autoaim", (void*)&ud.config.AutoAim, CVAR_INT|CVAR_MULTI, 0, 0, 2 },
{ "cl_automsg", "cl_automsg: enable/disable automatically sending messages to all players", (void*)&ud.automsg, CVAR_BOOL, 0, 0, 1 },
{ "cl_autovote", "cl_autovote: enable/disable automatic voting", (void*)&ud.autovote, CVAR_INT|CVAR_MULTI, 0, 0, 2 },