Autovote option for the menu

git-svn-id: https://svn.eduke32.com/eduke32@148 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-05-04 04:18:55 +00:00
parent 1230ad3914
commit d059a59772
7 changed files with 55 additions and 50 deletions

View file

@ -235,6 +235,7 @@ void CONFIG_SetDefaults( void )
ud.msgdisptime = 640;
ud.brightness = 16;
ud.statusbarmode = 0;
ud.autovote = 0;
ShowOpponentWeapons = 0;
Bstrcpy(ud.rtsname, "DUKE.RTS");
@ -611,9 +612,11 @@ void CONFIG_ReadSetup( void )
SCRIPT_GetNumber( scripthandle, "Misc", "DemoCams",&ud.democams);
SCRIPT_GetNumber( scripthandle, "Misc", "ShowFPS",&ud.tickrate);
SCRIPT_GetNumber( scripthandle, "Misc", "Color",&ud.color);
ps[0].palookup = ud.pcolor[0] = ud.color;
SCRIPT_GetNumber( scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
SCRIPT_GetNumber( scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode);
ps[0].palookup = ud.pcolor[0] = ud.color;
SCRIPT_GetNumber( scripthandle, "Misc", "AutoVote",&ud.autovote);
dummy = useprecache; SCRIPT_GetNumber( scripthandle, "Misc", "UsePrecache",&dummy); useprecache = dummy != 0;
// weapon choices are defaulted in checkcommandline, which may override them
@ -739,6 +742,7 @@ void CONFIG_WriteSetup( void )
SCRIPT_PutNumber( scripthandle, "Misc", "Color",ud.color,false,false);
SCRIPT_PutNumber( scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,false,false);
SCRIPT_PutNumber( scripthandle, "Misc", "StatusBarMode",ud.statusbarmode,false,false);
SCRIPT_PutNumber( scripthandle, "Misc", "AutoVote",ud.autovote,false,false);
SCRIPT_PutNumber( scripthandle, "Controls", "MouseAimingFlipped",ud.mouseflip,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","MouseAiming",ud.mouseaiming,false,false);
//SCRIPT_PutNumber( scripthandle, "Controls","GameMouseAiming",(int32) ps[myconnectindex].aim_mode,false,false);

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//-------------------------------------------------------------------------
#include "compat.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -301,11 +301,12 @@ int length, num;
} SAMPLE;
struct animwalltype {
short wallnum;
long tag;
short wallnum;
long tag;
};
extern struct animwalltype animwall[MAXANIMWALLS];
extern short numanimwalls,probey,lastprobey;
extern char typebuflen,typebuf[141];
@ -338,8 +339,8 @@ struct user_defs {
long reccnt;
int32 runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon; // JBF 20031125
int32 brightskins,democams,color,pcolor[MAXPLAYERS],msgdisptime,statusbarmode;
int32 m_noexits,noexits;
int32 brightskins,democams,color,pcolor[MAXPLAYERS],msgdisptime,statusbarmode;
int32 m_noexits,noexits,autovote;
int32 entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
int32 coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;

View file

@ -448,7 +448,7 @@ if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); }
case 1: // call map vote
voting = packbuf[2];
Bsprintf(tempbuf,"%s HAS CALLED A VOTE FOR MAP %s",ud.user_name[packbuf[2]],level_names[packbuf[3]*11 + packbuf[4]]);
Bsprintf(tempbuf,"%s HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)",ud.user_name[packbuf[2]],level_names[packbuf[3]*11 + packbuf[4]],packbuf[3]+1,packbuf[4]+1);
adduserquote(tempbuf);
Bsprintf(tempbuf,"PRESS F1 TO VOTE YES, F2 TO VOTE NO");
adduserquote(tempbuf);
@ -7023,6 +7023,29 @@ void nonsharedkeys(void)
CONTROL_GetInput( &noshareinfo );
}
if(gotvote[myconnectindex] == 0 && voting != -1)
{
gametext(160,60,"PRESS F1 TO VOTE YES, F2 TO VOTE NO",0,2);
if(KB_KeyPressed(sc_F1) || KB_KeyPressed(sc_F2) || ud.autovote)
{
tempbuf[0] = 18;
tempbuf[1] = 0;
tempbuf[2] = myconnectindex;
tempbuf[3] = (KB_KeyPressed(sc_F1) || ud.autovote-1);
for(i=connecthead;i >= 0;i=connectpoint2[i])
{
if (i != myconnectindex) sendpacket(i,tempbuf,4);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
adduserquote("VOTE CAST");
gotvote[myconnectindex] = 1;
KB_ClearKeyDown(sc_F1);
KB_ClearKeyDown(sc_F2);
}
}
if( KB_KeyPressed( sc_F12 ) )
{
KB_ClearKeyDown( sc_F12 );
@ -7186,42 +7209,6 @@ void nonsharedkeys(void)
inputloc = 0;
}
if(gotvote[myconnectindex] == 0 && voting != -1)
{
gametext(160,60,"PRESS F1 TO VOTE YES, F2 TO VOTE NO",0,2);
if(KB_KeyPressed(sc_F1))
{
KB_ClearKeyDown(sc_F1);
tempbuf[0] = 18;
tempbuf[1] = 0;
tempbuf[2] = myconnectindex;
tempbuf[3] = 1;
for(i=connecthead;i >= 0;i=connectpoint2[i])
{
if (i != myconnectindex) sendpacket(i,tempbuf,4);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
adduserquote("VOTE CAST");
gotvote[myconnectindex] = 1;
}
else if(KB_KeyPressed(sc_F2))
{
KB_ClearKeyDown(sc_F2);
tempbuf[0] = 18;
tempbuf[1] = 0;
tempbuf[2] = myconnectindex;
tempbuf[3] = 0;
for(i=connecthead;i >= 0;i=connectpoint2[i])
{
if (i != myconnectindex) sendpacket(i,tempbuf,4);
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
adduserquote("VOTE CAST");
gotvote[myconnectindex] = 1;
}
}
if( KB_KeyPressed(sc_F1) || ( ud.show_help && ( KB_KeyPressed(sc_Space) || KB_KeyPressed(sc_Enter) || KB_KeyPressed(sc_kpad_Enter) ) ) )
{
KB_ClearKeyDown(sc_F1);

View file

@ -805,6 +805,7 @@ LABELS userdefslabels[]= {
{ "statusbarmode", USERDEFS_STATUSBARMODE, 0, 0 },
{ "m_noexits", USERDEFS_M_NOEXITS, 0, 0 },
{ "noexits", USERDEFS_NOEXITS, 0, 0 },
{ "autovote", USERDEFS_AUTOVOTE, 0, 0 },
{ "", -1, 0, 0 } // END OF LIST
};

View file

@ -287,7 +287,8 @@ enum userdefslabels {
USERDEFS_MSGDISPTIME,
USERDEFS_STATUSBARMODE,
USERDEFS_M_NOEXITS,
USERDEFS_NOEXITS
USERDEFS_NOEXITS,
USERDEFS_AUTOVOTE
};
enum sectorlabels {

View file

@ -638,6 +638,13 @@ void DoUserDef(char bSet, long lLabelID, long lVar2, short sActor, short sPlayer
SetGameVarID((int)lVar2, ud.noexits, sActor, sPlayer);
break;
case USERDEFS_AUTOVOTE:
if(bSet)
ud.autovote = lValue;
else
SetGameVarID((int)lVar2, ud.autovote, sActor, sPlayer);
break;
default:
break;
}

View file

@ -2303,8 +2303,7 @@ cheat_for_port_credits:
"HUD weapon",
"FPS counter",
"-",
"-",
"-",
"Automatic voting",
"-",
"-",
"-",
@ -2358,7 +2357,11 @@ cheat_for_port_credits:
case 2: if (x==io) ud.tickrate = 1-ud.tickrate;
modval(0,1,(int *)&ud.tickrate,1,probey==io);
gametextpal(d,yy, ud.tickrate ? "On" : "Off", MENUHIGHLIGHT(io), 0); break;
case 3: if (x==io) cmenu(200); break;
case 3: if (x==io) { ud.autovote = (ud.autovote == 2) ? 0 : ud.autovote+1; }
modval(0,2,(int *)&ud.autovote,1,probey==io);
{ char *s[] = { "Off", "Vote No", "Vote Yes" };
gametextpal(d,yy, s[ud.autovote], MENUHIGHLIGHT(io), 0); break; }
case 4: if (x==io) cmenu(200); break;
default: break;
}
gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2);
@ -4058,11 +4061,12 @@ VOLUME_ALL_40x:
if ((!networkmode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master
}
voting = -1;
adduserquote("VOTE FAILED");
cmenu(0);
Bsprintf(fta_quotes[116],"VOTE FAILED");
FTA(116,&ps[myconnectindex]);
ps[myconnectindex].gm &= ~MODE_MENU;
}
} else {
gametext(160,60,"WAITING FOR VOTES",0,2);
gametext(160,90,"WAITING FOR VOTES",0,2);
}
break;
}