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);
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");
while (i)
while (symb && symb != lastmatch)
{
OSD_Printf(" %s\n", i->name);
lastmatch = i;
i=findsymbol(osdedittmp, lastmatch->next);
OSD_Printf(" %s\n", symb->name);
lastmatch = symb;
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
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)/anim.$o: $(SRC)/anim.c $(duke3d_h) $(SRC)/jmact/animlib.h
$(OBJ)/gamedef.$o: $(SRC)/gamedef.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)/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)/namesdyn.$o: $(SRC)/namesdyn.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);
check_player_color((int *)&ud.color,-1);
ps[0].palookup = ud.pcolor[0] = ud.color;
SCRIPT_GetNumber(scripthandle, "Misc", "Team",&ud.team);
if (ud.team > 1) ud.team = 0;
SCRIPT_GetNumber(scripthandle, "Misc", "Team",&dummy);
ud.team = 0;
if (dummy < 4 && dummy > -1) ud.team = dummy;
ud.pteam[0] = ud.team;
SCRIPT_GetNumber(scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
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 checkspriteflagsp(int iPicnum, int iType);
extern int getteampal(int team);
#endif // __funct_h__

View File

@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef _WIN32
#include <shellapi.h>
extern int getversionfromwebsite(char *buffer);
#define BUILDDATE 20061220
#define BUILDDATE 20070125
#define UPDATEINTERVAL 86400 // 24h
#endif
@ -8238,7 +8238,7 @@ static void setup_rancid_net(char *fn)
{
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);
Bstrcpy(tmp,strtok(tempbuf,"."));
@ -9600,6 +9600,8 @@ void app_main(int argc,char **argv)
{
int i, j;
char cwd[BMAX_PATH];
extern char datetimestring[];
#ifdef RENDERTYPEWIN
if (win_checkinstance())
{
@ -9617,7 +9619,7 @@ void app_main(int argc,char **argv)
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) 2006 EDuke32 team\n");
@ -10063,20 +10065,7 @@ MAIN_LOOP_RESTART:
ud.pteam[myconnectindex] = ud.team;
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{
j = 0;
switch (ud.pteam[myconnectindex])
{
case 0:
j = 3;
break;
case 1:
j = 21;
break;
}
ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = j;
}
ps[myconnectindex].palookup = ud.pcolor[myconnectindex] = getteampal(ud.pteam[myconnectindex]);
else
{
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)
{
j = 0;
switch (ps[i].team)
{
case 0:
j = 3;
break;
case 1:
j = 21;
break;
}
ps[i].palookup = ud.pcolor[i] = j;
}
ps[i].palookup = ud.pcolor[i] = getteampal(ps[i].team);
if (sprite[ps[i].i].pal != 1)
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 setupfilename[BMAX_PATH]= "duke3d.cfg";
char datetimestring[] = ""__DATE__" "__TIME__"";

View File

@ -549,7 +549,7 @@ void sendquit(void)
else
{
int i;
tempbuf[0] = 254;
tempbuf[1] = myconnectindex;
@ -600,7 +600,7 @@ void menus(void)
x = 0;
sh = 4-(sintable[(totalclock<<4)&2047]>>11);
if (bpp > 8)
{
long x,y,y1=0,y2=ydim;
@ -608,7 +608,7 @@ void menus(void)
for (x=0;x<xdim;x+=tilesizx[BIGHOLE])
rotatesprite(x<<16,y<<16,65536L,0,BIGHOLE,80,0,1+8+16,0,0,xdim-1,ydim-1);
}
if (!(current_menu >= 1000 && current_menu <= 2999 && current_menu >= 300 && current_menu <= 369))
vscrn();
@ -631,7 +631,7 @@ void menus(void)
case 501:
case 502:
case 603:
case 10001:
case 10001:
case 20003:
case 20005:
break;
@ -645,7 +645,7 @@ void menus(void)
break;
}
}
switch (current_menu)
{
case 25000:
@ -704,152 +704,257 @@ void menus(void)
case 20003:
rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(160,24,0,0,"PLAYER SETUP");
if (probey == 2)
c = (320>>1)-120;
{
switch (ud.team)
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)
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++)
{
case 0:
x = 3;
break;
case 1:
x = 21;
break;
}
}
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)
{
x = probe(40,50,16,7);
switch (x)
{
case -1:
cmenu(202);
probey = 3;
break;
case 0:
strcpy(buf, myname);
inputloc = strlen(buf);
current_menu = 20003;
KB_ClearKeyDown(sc_Enter);
KB_ClearKeyDown(sc_kpad_Enter);
KB_FlushKeyboardQueue();
break;
case 1:
ud.color++;
if (ud.color > 23)
ud.color = 0;
check_player_color((int *)&ud.color,-1);
updateplayer();
break;
case 2:
ud.team = 1-ud.team;
updateplayer();
break;
case 3:
AutoAim = (AutoAim == 2) ? 0 : AutoAim+1;
updateplayer();
break;
case 4:
ud.weaponswitch = (ud.weaponswitch == 3) ? 0 : ud.weaponswitch+1;
updateplayer();
break;
case 5:
ud.mouseaiming = !ud.mouseaiming;
updateplayer();
break;
case 6:
cmenu(20004);
break;
}
}
else
{
x = strget(200,50-9,buf,30,0);
while (Bstrlen(stripcolorcodes(buf)) > 10)
{
buf[Bstrlen(buf)-1] = '\0';
inputloc--;
}
if (x)
{
if (x == 1)
if (opts[ii][0] == '-' && !opts[ii][1])
{
if (buf[0])
{
Bstrcpy(myname,buf);
}
// send name update
if (io <= probey) yy += 4;
continue;
}
KB_ClearKeyDown(sc_Enter);
KB_ClearKeyDown(sc_kpad_Enter);
KB_FlushKeyboardQueue();
current_menu = 20002;
updateplayer();
if (io < probey) yy += 8;
io++;
}
}
menutext(40,50,MENUHIGHLIGHT(0),0,"NAME");
menutext(40,50+16,MENUHIGHLIGHT(1),0,"COLOR");
if (current_menu == 20002)
{
x = probesm(c,yy+5,0,io);
{
int ud_color = -1, aaim = -1, ud_weaponswitch = -1, ud_maim = -1, ud_team = -1;
if (x == -1)
{
cmenu(202);
probey = 3;
break;
}
ud_color = ud.color;
aaim = AutoAim;
ud_weaponswitch = ud.weaponswitch;
ud_maim = ud.mouseaiming;
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");
menutext(40,50+16+16+16,MENUHIGHLIGHT(3),0,"AUTO AIM");
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");
menutext(40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),0,"TAUNT MACRO SETUP");
for (ii=io=0; opts[ii]; ii++)
{
if (opts[ii][0] == '-' && !opts[ii][1])
continue;
enabled = 1;
switch (io)
{
case 0:
if (x == io)
{
strcpy(buf, myname);
inputloc = strlen(buf);
current_menu = 20003;
if (current_menu == 20002)
{
gametext(200,50-9,myname,MENUHIGHLIGHT(0),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);
KB_ClearKeyDown(sc_Enter);
KB_ClearKeyDown(sc_kpad_Enter);
KB_FlushKeyboardQueue();
}
break;
break;
case 1:
i = ud.color;
if (x == io)
{
ud.color++;
if (ud.color > 23)
ud.color = 0;
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();
break;
case 2:
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();
break;
case 3:
i = AutoAim;
if (x == io)
AutoAim = (AutoAim == 2) ? 0 : AutoAim+1;
modval(0,2,(int *)&AutoAim,1,probey==3);
if (AutoAim != i)
updateplayer();
break;
case 4:
i = ud.mouseaiming;
if (x == io)
ud.mouseaiming = !ud.mouseaiming;
modval(0,1,(int *)&ud.mouseaiming,1,probey==4);
if (ud.mouseaiming != i)
updateplayer();
break;
case 5:
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();
}
break;
case 6:
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;
case 7:
if (x == io)
{
cmenu(20004);
}
break;
default:
break;
}
io++;
}
}
else
{
x = strget(d,37,buf,30,0);
while (Bstrlen(stripcolorcodes(buf)) > 10)
{
buf[Bstrlen(buf)-1] = '\0';
inputloc--;
}
if (x)
{
if (x == 1)
{
if (buf[0] && Bstrcmp(myname,buf))
{
Bstrcpy(myname,buf);
updateplayer();
}
// send name update
}
KB_ClearKeyDown(sc_Enter);
KB_ClearKeyDown(sc_kpad_Enter);
KB_FlushKeyboardQueue();
current_menu = 20002;
}
}
yy = 37;
{
for (ii=io=0; opts[ii]; ii++)
{
if (opts[ii][0] == '-' && !opts[ii][1])
{
yy += 4;
continue;
}
enabled = 1;
switch (io)
{
case 0:
if (current_menu == 20002)
{
gametext(d-50,yy,myname,MENUHIGHLIGHT(io),2+8+16);
}
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 20005:
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)
{
cmenu(20002);
probey = 6;
probey = 7;
}
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+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;
@ -3031,21 +3136,21 @@ cheat_for_port_credits:
#if defined(POLYMOST) && defined(USE_OPENGL)
case 5:
if (bpp==8) break;
/* switch (gltexfiltermode)
{
case 0:
gltexfiltermode = 3;
break;
case 3:
gltexfiltermode = 5;
break;
case 5:
gltexfiltermode = 0;
break;
default:
gltexfiltermode = 3;
break;
}*/
/* switch (gltexfiltermode)
{
case 0:
gltexfiltermode = 3;
break;
case 3:
gltexfiltermode = 5;
break;
case 5:
gltexfiltermode = 0;
break;
default:
gltexfiltermode = 3;
break;
}*/
gltexfiltermode++;
if (gltexfiltermode > 5)
gltexfiltermode = 0;

View File

@ -926,7 +926,7 @@ int registerosdcommands(void)
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("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)
{
short i, j, nexti,circ;
@ -1382,15 +1398,7 @@ static void resetpspritevars(char g)
if (gametype_flags[ud.coop] & GAMETYPE_FLAG_TDM)
{
switch (ud.pteam[j])
{
case 0:
k = 3;
break;
case 1:
k = 21;
break;
}
k = getteampal(ud.pteam[j]);
ps[j].team = ud.pteam[j];
}
s->pal = ps[j].palookup = k;