From 0df6714942f088606c6eb0577f3e2ba4b44a38ab Mon Sep 17 00:00:00 2001
From: terminx <terminx@1a8010ca-5511-0410-912e-c29ae57300e0>
Date: Sat, 22 Apr 2006 06:10:28 +0000
Subject: [PATCH] More multiplayer text chat tweaks, a new cfg option to
 control the length of time (in tics) that the chat messages are displayed, a
 new macro configuration menu, and some cvar renaming

git-svn-id: https://svn.eduke32.com/eduke32@88 1a8010ca-5511-0410-912e-c29ae57300e0
---
 polymer/eduke32/source/config.c  | 14 ++++++++++
 polymer/eduke32/source/duke3d.h  |  2 +-
 polymer/eduke32/source/game.c    |  4 +--
 polymer/eduke32/source/menus.c   | 48 +++++++++++++++++++++++++++++++-
 polymer/eduke32/source/osdcmds.c | 13 +++++----
 polymer/eduke32/source/player.c  |  1 +
 6 files changed, 72 insertions(+), 10 deletions(-)

diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c
index 6930b8686..2686f8812 100644
--- a/polymer/eduke32/source/config.c
+++ b/polymer/eduke32/source/config.c
@@ -232,6 +232,7 @@ void CONFIG_SetDefaults( void )
     ud.brightskins = 0;
     ud.democams = 1;
     ud.color = 0;
+    ud.msgdisptime = 360;
 
     ShowOpponentWeapons = 0;
     Bstrcpy(ud.rtsname, "DUKE.RTS");
@@ -592,6 +593,7 @@ 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);
+        SCRIPT_GetNumber( scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
         ps[0].palookup = ud.pcolor[0] = ud.color;
         dummy = useprecache; SCRIPT_GetNumber( scripthandle, "Misc", "UsePrecache",&dummy); useprecache = dummy != 0;
         if(ud.wchoice[0][0] == 0 && ud.wchoice[0][1] == 0)
@@ -724,6 +726,7 @@ void CONFIG_WriteSetup( void )
     SCRIPT_PutNumber( scripthandle, "Misc", "DemoCams",ud.democams,false,false);
     SCRIPT_PutNumber( scripthandle, "Misc", "ShowFPS",ud.tickrate,false,false);
     SCRIPT_PutNumber( scripthandle, "Misc", "Color",ud.color,false,false);
+    SCRIPT_PutNumber( scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,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);
@@ -797,6 +800,17 @@ void CONFIG_WriteSetup( void )
     }
 
     SCRIPT_PutString( scripthandle, "Comm Setup","PlayerName",&myname[0]);
+    SCRIPT_PutString( scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
+
+    {
+        char commmacro[] = "CommbatMacro# ";
+
+        for(dummy = 0;dummy < 10;dummy++)
+        {
+            commmacro[13] = dummy+'0';
+            SCRIPT_PutString( scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
+        }
+    }
 
     SCRIPT_Save (scripthandle, setupfilename);
     SCRIPT_Free (scripthandle);
diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h
index 70f357b47..ef817c460 100644
--- a/polymer/eduke32/source/duke3d.h
+++ b/polymer/eduke32/source/duke3d.h
@@ -336,7 +336,7 @@ struct user_defs {
     long reccnt;
 
     int32 runkey_mode,statusbarscale,mouseaiming,weaponswitch,drawweapon;   // JBF 20031125
-	int32 brightskins,democams,color,pcolor[MAXPLAYERS];
+	int32 brightskins,democams,color,pcolor[MAXPLAYERS], msgdisptime;
 
     int32 entered_name,screen_tilting,shadows,fta_on,executions,auto_run;
     int32 coords,tickrate,levelstats,m_coop,coop,screen_size,lockout,crosshair;
diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c
index 157bb58dd..068fd4bbc 100644
--- a/polymer/eduke32/source/game.c
+++ b/polymer/eduke32/source/game.c
@@ -317,7 +317,7 @@ void adduserquote(char *daquote)
     strcpy(user_quote[0],daquote);
     OSD_Printf("%s\n", daquote);
 
-    user_quote_time[0] = 360;
+    user_quote_time[0] = ud.msgdisptime;
     pub = NUMPAGES;
 }
 
@@ -2047,7 +2047,7 @@ void operatefta(void)
         for(i=0;i<MAXUSERQUOTES;i++)
         {
             if (user_quote_time[i] <= 0) break;
-            k -= scale(8,200,ScreenHeight);
+            k -= 8;
             l = Bstrlen(user_quote[i]); 
             while(l > TEXTWRAPLEN)
             {
diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c
index 3d56bafa3..bb551d4b5 100644
--- a/polymer/eduke32/source/menus.c
+++ b/polymer/eduke32/source/menus.c
@@ -665,7 +665,7 @@ void menus(void)
         rotatesprite((280)<<16,(37+(tilesizy[APLAYER]>>1))<<16,49152L,0,1441-((((4-(totalclock>>4)))&3)*5),0,ud.color,10,0,0,xdim-1,ydim-1);
 
         if (current_menu == 20002) {
-            x = probe(40,50,16,5);
+            x = probe(40,50,16,6);
             switch(x) {
             case -1:
                 cmenu(202);
@@ -703,6 +703,9 @@ void menus(void)
                 ud.mouseaiming = !ud.mouseaiming;
                 updatenames();
                 break;
+            case 5:
+                cmenu(20004);
+                break;
             }
         } else {
             x = strget(200,50-9,buf,12,0);
@@ -741,6 +744,7 @@ void menus(void)
         menutext(40,50+16+16,MENUHIGHLIGHT(2),0,"AUTO AIM");
         menutext(40,50+16+16+16,MENUHIGHLIGHT(3),0,"WEAPON SWITCH");
         menutext(40,50+16+16+16+16,MENUHIGHLIGHT(4),0,"AIMING TYPE");
+        menutext(40,50+16+16+16+16+16,MENUHIGHLIGHT(5),0,"MACRO SETUP");
 
         if (current_menu == 20002) {
             gametext(200,50-9,myname,MENUHIGHLIGHT(0),2+8+16); }
@@ -755,6 +759,48 @@ void menus(void)
 
         break;
 
+    case 20004:
+    case 20005:
+        rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
+        menutext(160,24,0,0,"MACRO SETUP");
+
+        if (current_menu == 20004)
+        {
+            x = probesm(23,45,8,10);
+            if(x == -1)
+            {
+                cmenu(20002);
+                probey = 5;
+            }
+            else if(x >= 0 && x <= 9)
+            {
+                strcpy(buf, ud.ridecule[x]);
+                inputloc = strlen(buf);
+                last_probey = probey;
+                current_menu = 20005;
+                KB_ClearKeyDown(sc_Enter);
+                KB_ClearKeyDown(sc_kpad_Enter);
+                KB_FlushKeyboardQueue();
+            }
+        } else {
+            x = strget(25,40+(8*probey),buf,34,0);
+            if (x) {
+                if (x == 1) {
+                    Bstrcpy(ud.ridecule[last_probey],buf);
+                }
+                KB_ClearKeyDown(sc_Enter);
+                KB_ClearKeyDown(sc_kpad_Enter);
+                KB_FlushKeyboardQueue();
+                current_menu = 20004;
+            }
+        }
+        for(i=0;i<10;i++)
+        {
+            if(current_menu == 20005 && i == last_probey) continue;
+            gametextpal(25,40+(8*i),ud.ridecule[i],MENUHIGHLIGHT(i),0);
+        }
+        break;
+
     case 20010:
         rotatesprite(160<<16,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
         menutext(160,24,0,0,"HOST NETWORK GAME");
diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c
index 8c751713a..70ca1ba2a 100644
--- a/polymer/eduke32/source/osdcmds.c
+++ b/polymer/eduke32/source/osdcmds.c
@@ -424,12 +424,13 @@ struct cvarmappings {
     int max;
 } cvar[] =
     {
-        { "showfps", "showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 },
-        { "showcoords", "showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0, 0, 1 },
-        { "useprecache", "useprecache: enable/disable the pre-level caching routine", (void*)&useprecache, CVAR_BOOL, 0, 0, 1 },
-        { "drawweapon", "drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 0, 2 },
-        { "weaponswitch", "weaponswitch: enable/disable auto weapon switching", (void*)&ud.weaponswitch, CVAR_INT|256, 0, 0, 3 },
-        { "autoaim", "autoaim: enable/disable weapon autoaim", (void*)&AutoAim, CVAR_INT|256, 0, 0, 2 },
+        { "cl_showfps", "cl_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 },
+        { "cl_showcoords", "cl_showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0, 0, 1 },
+        { "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&useprecache, CVAR_BOOL, 0, 0, 1 },
+        { "cl_drawweapon", "cl_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 0, 2 },
+        { "cl_weaponswitch", "cl_weaponswitch: enable/disable auto weapon switching", (void*)&ud.weaponswitch, CVAR_INT|256, 0, 0, 3 },
+        { "cl_autoaim", "cl_autoaim: enable/disable weapon autoaim", (void*)&AutoAim, CVAR_INT|256, 0, 0, 2 },
+        { "cl_messagetime", "cl_messagetime: length of time to display multiplayer chat messages\n", (void*)&ud.msgdisptime, CVAR_INT, 0, 0, 3600 },
         { "name", "name: change your multiplayer nickname", (void*)&myname[0], CVAR_STRING|256, sizeof(myname), 0, 0 }
     };
 
diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c
index 8b75c2401..09b3230a4 100644
--- a/polymer/eduke32/source/player.c
+++ b/polymer/eduke32/source/player.c
@@ -290,6 +290,7 @@ short aim(spritetype *s,short aang,short atwith)
                 case TONGUE__STATIC:
                 case FREEZEBLAST__STATIC:
                 case SHRINKSPARK__STATIC:
+                case SHRINKER__STATIC:
                 case RPG__STATIC:
                 case FIRELASER__STATIC:
                 case SPIT__STATIC: