Re-done player setup menu, support for 4 teams in multiplayer, and separate menu options for weapon switch on pickup and weapon switch when empty. The string with __DATE__ and __TIME__ in it (which is used in the first line of the log file) was moved to global.c so that we're no longer forcing game.c to be recompiled every time something else is changed.

git-svn-id: https://svn.eduke32.com/eduke32@471 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-01-26 00:28:44 +00:00
parent f1d10f4c8c
commit 50559c7a32
9 changed files with 301 additions and 207 deletions

View file

@ -424,16 +424,16 @@ int OSD_HandleKey(int sc, int press)
{ {
tabc = findsymbol(osdedittmp, NULL); tabc = findsymbol(osdedittmp, NULL);
if (tabc && findsymbol(osdedittmp, tabc->next)) if (tabc->next && findsymbol(osdedittmp, tabc->next))
{ {
symbol_t *i=tabc; symbol_t *symb=tabc;
OSD_Printf("Matching symbols:\n"); OSD_Printf("Matching symbols:\n");
while (i) while (symb && symb != lastmatch)
{ {
OSD_Printf(" %s\n", i->name); OSD_Printf(" %s\n", symb->name);
lastmatch = i; lastmatch = symb;
i=findsymbol(osdedittmp, lastmatch->next); symb=findsymbol(osdedittmp, lastmatch->next);
} }
} }
} }

View file

@ -1,13 +1,13 @@
duke3d_h=$(EINC)/build.h $(EINC)/polymer.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/cache1d.h $(EINC)/baselayer.h $(SRC)/jmact/types.h $(SRC)/jmact/file_lib.h $(SRC)/jmact/util_lib.h $(SRC)/jmact/keyboard.h $(SRC)/jmact/control.h $(INC)/develop.h $(INC)/gamedefs.h $(INC)/function.h $(INC)/config.h $(INC)/sounds.h $(INC)/rts.h $(INC)/_rts.h $(INC)/soundefs.h $(SRC)/jaudiolib/fx_man.h $(SRC)/jaudiolib/music.h $(INC)/namesdyn.h $(INC)/funct.h $(INC)/duke3d.h $(EINC)/mmulti.h duke3d_h=$(EINC)/build.h $(EINC)/polymer.h $(EINC)/pragmas.h $(EINC)/compat.h $(EINC)/cache1d.h $(EINC)/baselayer.h $(SRC)/jmact/types.h $(SRC)/jmact/file_lib.h $(SRC)/jmact/util_lib.h $(SRC)/jmact/keyboard.h $(SRC)/jmact/control.h $(INC)/develop.h $(INC)/gamedefs.h $(INC)/function.h $(INC)/config.h $(INC)/sounds.h $(INC)/rts.h $(INC)/_rts.h $(INC)/soundefs.h $(SRC)/jaudiolib/fx_man.h $(SRC)/jaudiolib/music.h $(INC)/namesdyn.h $(INC)/funct.h $(INC)/duke3d.h $(EINC)/mmulti.h
gamedef_h=$(SRC)/gamedef.h gamedef_h=$(SRC)/gamedef.h
$(OBJ)/game.$o: $(SRC)/*.c $(SRC)/jmact/scriplib.h $(duke3d_h) $(INC)/osdfuncs.h $(INC)/osdcmds.h $(INC)/grpscan.h $(OBJ)/game.$o: $(SRC)/game.c $(SRC)/jmact/scriplib.h $(duke3d_h) $(INC)/osdfuncs.h $(INC)/osdcmds.h $(INC)/grpscan.h
$(OBJ)/actors.$o: $(SRC)/actors.c $(duke3d_h) $(OBJ)/actors.$o: $(SRC)/actors.c $(duke3d_h)
$(OBJ)/anim.$o: $(SRC)/anim.c $(duke3d_h) $(SRC)/jmact/animlib.h $(OBJ)/anim.$o: $(SRC)/anim.c $(duke3d_h) $(SRC)/jmact/animlib.h
$(OBJ)/gamedef.$o: $(SRC)/gamedef.c $(duke3d_h) $(gamedef_h) $(OBJ)/gamedef.$o: $(SRC)/gamedef.c $(duke3d_h) $(gamedef_h)
$(OBJ)/gameexec.$o: $(SRC)/gameexec.c $(duke3d_h) $(gamedef_h) $(OBJ)/gameexec.$o: $(SRC)/gameexec.c $(duke3d_h) $(gamedef_h)
$(OBJ)/gamevars.$o: $(SRC)/gamevars.c $(duke3d_h) $(gamedef_h) $(OBJ)/gamevars.$o: $(SRC)/gamevars.c $(duke3d_h) $(gamedef_h)
$(OBJ)/global.$o: $(SRC)/global.c $(duke3d_h) $(OBJ)/global.$o: $(SRC)/*.c $(SRC)/global.c $(duke3d_h)
$(OBJ)/menus.$o: $(SRC)/menus.c $(duke3d_h) $(SRC)/jmact/mouse.h $(OBJ)/menus.$o: $(SRC)/menus.c $(duke3d_h) $(SRC)/jmact/mouse.h
$(OBJ)/namesdyn.$o: $(SRC)/namesdyn.c $(duke3d_h) $(OBJ)/namesdyn.$o: $(SRC)/namesdyn.c $(duke3d_h)
$(OBJ)/player.$o: $(SRC)/player.c $(duke3d_h) $(OBJ)/player.$o: $(SRC)/player.c $(duke3d_h)

View file

@ -678,8 +678,9 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(scripthandle, "Misc", "Color",&ud.color); SCRIPT_GetNumber(scripthandle, "Misc", "Color",&ud.color);
check_player_color((int *)&ud.color,-1); check_player_color((int *)&ud.color,-1);
ps[0].palookup = ud.pcolor[0] = ud.color; ps[0].palookup = ud.pcolor[0] = ud.color;
SCRIPT_GetNumber(scripthandle, "Misc", "Team",&ud.team); SCRIPT_GetNumber(scripthandle, "Misc", "Team",&dummy);
if (ud.team > 1) ud.team = 0; ud.team = 0;
if (dummy < 4 && dummy > -1) ud.team = dummy;
ud.pteam[0] = ud.team; ud.pteam[0] = ud.team;
SCRIPT_GetNumber(scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime); SCRIPT_GetNumber(scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
SCRIPT_GetNumber(scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode); SCRIPT_GetNumber(scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode);

View file

@ -246,4 +246,6 @@ extern void mpchangemap(char volume, char level);
extern inline int checkspriteflags(int iActor, int iType); extern inline int checkspriteflags(int iActor, int iType);
extern inline int checkspriteflagsp(int iPicnum, int iType); extern inline int checkspriteflagsp(int iPicnum, int iType);
extern int getteampal(int team);
#endif // __funct_h__ #endif // __funct_h__

View file

@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef _WIN32 #ifdef _WIN32
#include <shellapi.h> #include <shellapi.h>
extern int getversionfromwebsite(char *buffer); extern int getversionfromwebsite(char *buffer);
#define BUILDDATE 20061220 #define BUILDDATE 20070125
#define UPDATEINTERVAL 86400 // 24h #define UPDATEINTERVAL 86400 // 24h
#endif #endif
@ -8238,7 +8238,7 @@ static void setup_rancid_net(char *fn)
{ {
for (i=0;i<rancid_players;i++) for (i=0;i<rancid_players;i++)
{ {
if (Bstrcmp(rancid_ip_strings[i],rancid_ip_strings[MAXPLAYERS-1]) != 0) if (Bstrcmp(rancid_ip_strings[i],rancid_ip_strings[MAXPLAYERS-1]))
{ {
Bstrncpy(tempbuf,rancid_ip_strings[i], 8); Bstrncpy(tempbuf,rancid_ip_strings[i], 8);
Bstrcpy(tmp,strtok(tempbuf,".")); Bstrcpy(tmp,strtok(tempbuf,"."));
@ -9600,6 +9600,8 @@ void app_main(int argc,char **argv)
{ {
int i, j; int i, j;
char cwd[BMAX_PATH]; char cwd[BMAX_PATH];
extern char datetimestring[];
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
if (win_checkinstance()) if (win_checkinstance())
{ {
@ -9617,7 +9619,7 @@ void app_main(int argc,char **argv)
wm_setapptitle(HEAD2); wm_setapptitle(HEAD2);
initprintf("%s%s\n",apptitle," ("__DATE__" "__TIME__")"); initprintf("%s (%s)\n",apptitle,datetimestring);
initprintf("Copyright (c) 1996, 2003 3D Realms Entertainment\n"); initprintf("Copyright (c) 1996, 2003 3D Realms Entertainment\n");
initprintf("Copyright (c) 2006 EDuke32 team\n"); initprintf("Copyright (c) 2006 EDuke32 team\n");
@ -10063,20 +10065,7 @@ MAIN_LOOP_RESTART:
ud.pteam[myconnectindex] = ud.team; ud.pteam[myconnectindex] = ud.team;
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{ ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = getteampal(ud.pteam[myconnectindex]);
j = 0;
switch (ud.pteam[myconnectindex])
{
case 0:
j = 3;
break;
case 1:
j = 21;
break;
}
ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = j;
}
else else
{ {
if (ud.color) ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color; if (ud.color) ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = ud.color;
@ -11327,19 +11316,7 @@ static int domovethings(void)
} }
} }
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{ ps[i].palookup = ud.pcolor[i] = getteampal(ps[i].team);
j = 0;
switch (ps[i].team)
{
case 0:
j = 3;
break;
case 1:
j = 21;
break;
}
ps[i].palookup = ud.pcolor[i] = j;
}
if (sprite[ps[i].i].pal != 1) if (sprite[ps[i].i].pal != 1)
sprite[ps[i].i].pal = ud.pcolor[i]; sprite[ps[i].i].pal = ud.pcolor[i];

View file

@ -180,4 +180,5 @@ proj_struct projectile[MAXTILES], thisprojectile[MAXSPRITES], defaultprojectile[
char cheatkey[2] = { sc_D, sc_N }; char cheatkey[2] = { sc_D, sc_N };
char setupfilename[BMAX_PATH]= "duke3d.cfg"; char setupfilename[BMAX_PATH]= "duke3d.cfg";
char datetimestring[] = ""__DATE__" "__TIME__"";

View file

@ -704,32 +704,69 @@ void menus(void)
case 20003: case 20003:
rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(160,24,0,0,"PLAYER SETUP"); menutext(160,24,0,0,"PLAYER SETUP");
c = (320>>1)-120;
{
int io, ii, yy = 37, d=c+140, enabled;
char *opts[] = {
"Name",
"-",
"Color",
"-",
"Team",
"-",
"-",
"Auto aim",
"Mouse aim",
"-",
"-",
"Switch weap on pickup",
"Switch weap when empty",
"-",
"-",
"Taunt macro setup",
NULL
};
x = ud.color;
if (probey == 2) if (probey == 2)
x = getteampal(ud.team);
rotatesprite((260)<<16,(26+(tilesizy[APLAYER]>>1))<<16,49152L,0,1441-((((4-(totalclock>>4)))&3)*5),0,x,10,0,0,xdim-1,ydim-1);
for (ii=io=0; opts[ii]; ii++)
{ {
switch (ud.team) if (opts[ii][0] == '-' && !opts[ii][1])
{ {
case 0: if (io <= probey) yy += 4;
x = 3; continue;
break;
case 1:
x = 21;
break;
} }
if (io < probey) yy += 8;
io++;
} }
else x = ud.color;
rotatesprite((280)<<16,(37+(tilesizy[APLAYER]>>1))<<16,49152L,0,1441-((((4-(totalclock>>4)))&3)*5),0,x,10,0,0,xdim-1,ydim-1);
if (current_menu == 20002) if (current_menu == 20002)
{ {
x = probe(40,50,16,7); x = probesm(c,yy+5,0,io);
switch (x)
if (x == -1)
{ {
case -1:
cmenu(202); cmenu(202);
probey = 3; probey = 3;
break; break;
}
for (ii=io=0; opts[ii]; ii++)
{
if (opts[ii][0] == '-' && !opts[ii][1])
continue;
enabled = 1;
switch (io)
{
case 0: case 0:
if (x == io)
{
strcpy(buf, myname); strcpy(buf, myname);
inputloc = strlen(buf); inputloc = strlen(buf);
current_menu = 20003; current_menu = 20003;
@ -737,42 +774,97 @@ void menus(void)
KB_ClearKeyDown(sc_Enter); KB_ClearKeyDown(sc_Enter);
KB_ClearKeyDown(sc_kpad_Enter); KB_ClearKeyDown(sc_kpad_Enter);
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
}
break; break;
case 1: case 1:
i = ud.color;
if (x == io)
{
ud.color++; ud.color++;
if (ud.color > 23) if (ud.color > 23)
ud.color = 0; ud.color = 0;
check_player_color((int *)&ud.color,-1); check_player_color((int *)&ud.color,-1);
}
modval(0,23,(int *)&ud.color,1,probey==1);
check_player_color((int *)&ud.color,i);
if (ud.color != i)
updateplayer(); updateplayer();
break; break;
case 2: case 2:
ud.team = 1-ud.team; i = ud.team;
if (x == io)
{
ud.team++;
if (ud.team == 4)
ud.team = 0;
}
modval(0,3,(int *)&ud.team,1,probey==2);
if (ud.team != i)
updateplayer(); updateplayer();
break; break;
case 3: case 3:
i = AutoAim;
if (x == io)
AutoAim = (AutoAim == 2) ? 0 : AutoAim+1; AutoAim = (AutoAim == 2) ? 0 : AutoAim+1;
modval(0,2,(int *)&AutoAim,1,probey==3);
if (AutoAim != i)
updateplayer(); updateplayer();
break; break;
case 4: case 4:
ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1; i = ud.mouseaiming;
if (x == io)
ud.mouseaiming = !ud.mouseaiming;
modval(0,1,(int *)&ud.mouseaiming,1,probey==4);
if (ud.mouseaiming != i)
updateplayer(); updateplayer();
break; break;
case 5: case 5:
ud.mouseaiming = !ud.mouseaiming; i = 0;
if (ud.weaponswitch & 1)
i = 1;
if (x == io)
i = 1-i;
modval(0,1,(int *)&i,1,probey==5);
if ((ud.weaponswitch & 1 && !i) || (!(ud.weaponswitch & 1) && i))
{
ud.weaponswitch ^= 1;
updateplayer(); updateplayer();
}
break; break;
case 6: case 6:
cmenu(20004); i = 0;
if (ud.weaponswitch & 2)
i = 1;
if (x == io)
i = 1-i;
modval(0,1,(int *)&i,1,probey==6);
if ((ud.weaponswitch & 2 && !i) || (!(ud.weaponswitch & 2) && i))
{
ud.weaponswitch ^= 2;
updateplayer();
}
break; break;
case 7:
if (x == io)
{
cmenu(20004);
}
break;
default:
break;
}
io++;
} }
} }
else else
{ {
x = strget(200,50-9,buf,30,0); x = strget(d,37,buf,30,0);
while (Bstrlen(stripcolorcodes(buf)) > 10) while (Bstrlen(stripcolorcodes(buf)) > 10)
{ {
@ -784,9 +876,10 @@ void menus(void)
{ {
if (x == 1) if (x == 1)
{ {
if (buf[0]) if (buf[0] && Bstrcmp(myname,buf))
{ {
Bstrcpy(myname,buf); Bstrcpy(myname,buf);
updateplayer();
} }
// send name update // send name update
} }
@ -795,61 +888,73 @@ void menus(void)
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
current_menu = 20002; current_menu = 20002;
updateplayer();
} }
} }
menutext(40,50,MENUHIGHLIGHT(0),0,"NAME"); yy = 37;
menutext(40,50+16,MENUHIGHLIGHT(1),0,"COLOR");
{ {
int ud_color = -1, aaim = -1, ud_weaponswitch = -1, ud_maim = -1, ud_team = -1; for (ii=io=0; opts[ii]; ii++)
{
ud_color = ud.color; if (opts[ii][0] == '-' && !opts[ii][1])
aaim = AutoAim; {
ud_weaponswitch = ud.weaponswitch; yy += 4;
ud_maim = ud.mouseaiming; continue;
ud_team = ud.team;
modval(0,23,(int *)&ud.color,1,probey==1);
modval(0,1,(int *)&ud.team,1,probey==2);
modval(0,2,(int *)&AutoAim,1,probey==3);
modval(0,3,(int *)&ud.weaponswitch,1,probey==4);
modval(0,1,(int *)&ud.mouseaiming,1,probey==5);
check_player_color((int *)&ud.color,ud_color);
if (ud_color != ud.color || aaim != AutoAim || ud_weaponswitch != ud.weaponswitch || ud_maim != ud.mouseaiming || ud_team != ud.team)
updateplayer();
} }
menutext(40,50+16+16,MENUHIGHLIGHT(2),0,"TEAM"); enabled = 1;
menutext(40,50+16+16+16,MENUHIGHLIGHT(3),0,"AUTO AIM"); switch (io)
menutext(40,50+16+16+16+16,MENUHIGHLIGHT(4),0,"WEAPON SWITCH"); {
menutext(40,50+16+16+16+16+16,MENUHIGHLIGHT(5),0,"MOUSE AIM TYPE"); case 0:
menutext(40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),0,"TAUNT MACRO SETUP");
if (current_menu == 20002) if (current_menu == 20002)
{ {
gametext(200,50-9,myname,MENUHIGHLIGHT(0),2+8+16); gametext(d-50,yy,myname,MENUHIGHLIGHT(io),2+8+16);
} }
{
char *s[] = { "Auto","","","","","","","","","Blue","Dk red","Green","Gray","Dk gray","Dk green","Brown",
"Dk blue","","","","","Red","","Yellow","","" };
gametext(200,50+16-9,s[ud.color],MENUHIGHLIGHT(1),2+8+16);
}
{
char *s[] = { "Blue", "Red" };
gametext(200,50+16+16-9,s[ud.team],MENUHIGHLIGHT(2),2+8+16);
}
{
char *s[] = { "Off", "Full", "Hitscan" };
gametext(200,50+16+16+16-9,s[AutoAim],MENUHIGHLIGHT(3),2+8+16);
}
{
char *s[] = { "Off", "On pickup", "When empty", "Both" };
gametext(200,50+16+16+16+16-9,s[ud.weaponswitch],MENUHIGHLIGHT(4),2+8+16);
}
gametext(200,50+16+16+16+16+16-9,ud.mouseaiming?"Hold button":"Toggle on/off",MENUHIGHLIGHT(5),2+8+16);
break; break;
case 1:
{
char *s[] = { "Auto","","","","","","","","","Blue","Red","Green","Gray","Dark gray","Dark green","Brown",
"Dark blue","","","","","Bright red","","Yellow","","" };
gametext(d-50,yy,s[ud.color],MENUHIGHLIGHT(io),2+8+16);
}
break;
case 2:
{
char *s[] = { "Red", "Blue", "Green", "Gray" };
gametext(d-50,yy,s[ud.team],MENUHIGHLIGHT(io),2+8+16);
}
break;
case 3:
{
char *s[] = { "Off", "All weapons", "Hitscan only" };
gametext(d-50,yy,s[AutoAim],MENUHIGHLIGHT(io),2+8+16);
}
break;
case 4:
gametext(d-50,yy,ud.mouseaiming?"Hold button":"Toggle on/off",MENUHIGHLIGHT(io),2+8+16);
break;
case 5:
gametext(d+60,yy,ud.weaponswitch&1?"On":"Off",MENUHIGHLIGHT(io),2+8+16);
break;
case 6:
gametext(d+60,yy,ud.weaponswitch&2?"On":"Off",MENUHIGHLIGHT(io),2+8+16);
break;
default:
break;
}
gametextpal(c,yy, opts[ii], enabled?MENUHIGHLIGHT(io):15, 2);
io++;
yy += 8;
}
}
break;
}
case 20004: case 20004:
case 20005: case 20005:
rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
@ -861,7 +966,7 @@ void menus(void)
if (x == -1) if (x == -1)
{ {
cmenu(20002); cmenu(20002);
probey = 6; probey = 7;
} }
else if (x >= 0 && x <= 9) else if (x >= 0 && x <= 9)
{ {
@ -897,7 +1002,7 @@ void menus(void)
gametext(160,144,"UP/DOWN = SELECT MACRO",0,2+8+16); gametext(160,144,"UP/DOWN = SELECT MACRO",0,2+8+16);
gametext(160,144+9,"ENTER = MODIFY",0,2+8+16); gametext(160,144+9,"ENTER = MODIFY",0,2+8+16);
gametext(160,144+9+9,"ACTIVATE IN GAME WITH SHIFT-F#",0,2+8+16); gametext(160,144+9+9,"ACTIVATE IN-GAME WITH SHIFT-F#",0,2+8+16);
break; break;

View file

@ -926,7 +926,7 @@ int registerosdcommands(void)
OSD_RegisterFunction("quit","quit: exits the game immediately", osdcmd_quit); OSD_RegisterFunction("quit","quit: exits the game immediately", osdcmd_quit);
OSD_RegisterFunction("rate","rate: changes the multiplayer packet send rate",osdcmd_rate); OSD_RegisterFunction("rate","rate: sets the multiplayer packet send rate, in packets/sec",osdcmd_rate);
OSD_RegisterFunction("restartvid","restartvid: reinitialises the video mode",osdcmd_restartvid); OSD_RegisterFunction("restartvid","restartvid: reinitialises the video mode",osdcmd_restartvid);
OSD_RegisterFunction("sensitivity","sensitivity <value>: changes the mouse sensitivity", osdcmd_sensitivity); OSD_RegisterFunction("sensitivity","sensitivity <value>: changes the mouse sensitivity", osdcmd_sensitivity);

View file

@ -1238,6 +1238,22 @@ void newgame(char vn,char ln,char sk)
} }
} }
int getteampal(int team)
{
switch (team)
{
case 0:
return 10;
case 1:
return 3;
case 2:
return 11;
case 3:
return 12;
}
return 0;
}
static void resetpspritevars(char g) static void resetpspritevars(char g)
{ {
short i, j, nexti,circ; short i, j, nexti,circ;
@ -1382,15 +1398,7 @@ static void resetpspritevars(char g)
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM) if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{ {
switch (ud.pteam[j]) k = getteampal(ud.pteam[j]);
{
case 0:
k = 3;
break;
case 1:
k = 21;
break;
}
ps[j].team = ud.pteam[j]; ps[j].team = ud.pteam[j];
} }
s->pal = ps[j].palookup = k; s->pal = ps[j].palookup = k;