summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Haley2013-09-15 20:24:11 +0000
committerJames Haley2013-09-15 20:24:11 +0000
commitf4eb9088523aef3946f02cd45953d14760c598c6 (patch)
tree3823ffc09de27f50d969945600c5e85ae9ed83a0
parent3ce2a53bc95e3e58383e2b0a982eacba5b396b4a (diff)
downloadchocolate-doom-f4eb9088523aef3946f02cd45953d14760c598c6.tar.gz
chocolate-doom-f4eb9088523aef3946f02cd45953d14760c598c6.tar.bz2
chocolate-doom-f4eb9088523aef3946f02cd45953d14760c598c6.zip
Hopefully complete implementation of player names and Strife player chat
features, which work differently than they did in DOOM. If working properly, then this fully completes Chocolate Strife, aside from any presently unknown issues. Subversion-branch: /branches/v2-branch Subversion-revision: 2646
-rw-r--r--src/strife/d_englsh.h9
-rw-r--r--src/strife/d_main.c16
-rw-r--r--src/strife/g_game.c4
-rw-r--r--src/strife/hu_stuff.c147
-rw-r--r--src/strife/hu_stuff.h3
-rw-r--r--src/strife/p_inter.c4
-rw-r--r--src/strife/st_stuff.c4
7 files changed, 109 insertions, 78 deletions
diff --git a/src/strife/d_englsh.h b/src/strife/d_englsh.h
index 6d615194..7dbeac85 100644
--- a/src/strife/d_englsh.h
+++ b/src/strife/d_englsh.h
@@ -213,10 +213,11 @@
// The following should NOT be changed unless it seems
// just AWFULLY necessary
-#define HUSTR_PLRGREEN "Green: "
-#define HUSTR_PLRINDIGO "Indigo: "
-#define HUSTR_PLRBROWN "Brown: "
-#define HUSTR_PLRRED "Red: "
+// [STRIFE]: Not used, as strings are local to hu_stuff.c
+//#define HUSTR_PLRGREEN "Green: "
+//#define HUSTR_PLRINDIGO "Indigo: "
+//#define HUSTR_PLRBROWN "Brown: "
+//#define HUSTR_PLRRED "Red: "
#define HUSTR_KEYGREEN 'g'
#define HUSTR_KEYINDIGO 'i'
diff --git a/src/strife/d_main.c b/src/strife/d_main.c
index 51782b43..01e560a2 100644
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -160,8 +160,7 @@ static boolean main_loop_started = false;
static int comport = 0;
// fraggle 06/03/11 [STRIFE]: Multiplayer nickname?
-
-static char *nickname = NULL;
+char *nickname = NULL;
void D_ConnectNetGame(void);
void D_CheckNetGame(void);
@@ -415,10 +414,15 @@ void D_BindVariables(void)
M_BindStrifeControls(); // haleyjd 09/01/10: [STRIFE]
M_BindChatControls(MAXPLAYERS);
- key_multi_msgplayer[0] = HUSTR_KEYGREEN;
- key_multi_msgplayer[1] = HUSTR_KEYINDIGO;
- key_multi_msgplayer[2] = HUSTR_KEYBROWN;
- key_multi_msgplayer[3] = HUSTR_KEYRED;
+ // haleyjd 20130915: Strife chat keys
+ key_multi_msgplayer[0] = '1';
+ key_multi_msgplayer[1] = '2';
+ key_multi_msgplayer[2] = '3';
+ key_multi_msgplayer[3] = '4';
+ key_multi_msgplayer[4] = '5';
+ key_multi_msgplayer[5] = '6';
+ key_multi_msgplayer[6] = '7';
+ key_multi_msgplayer[7] = '8';
#ifdef FEATURE_MULTIPLAYER
NET_BindVariables();
diff --git a/src/strife/g_game.c b/src/strife/g_game.c
index 87fb74ac..74e64282 100644
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -983,8 +983,8 @@ void G_Ticker (void)
&& turbodetected[i])
{
static char turbomessage[80];
- extern char *player_names[4];
- sprintf (turbomessage, "%s is turbo!",player_names[i]);
+ extern char player_names[8][16];
+ sprintf (turbomessage, "%s is turbo!", player_names[i]);
players[consoleplayer].message = turbomessage;
turbodetected[i] = false;
}
diff --git a/src/strife/hu_stuff.c b/src/strife/hu_stuff.c
index eae9d166..a7780a44 100644
--- a/src/strife/hu_stuff.c
+++ b/src/strife/hu_stuff.c
@@ -79,7 +79,7 @@ char *chat_macros[10] =
};
// villsa [STRIFE]
-char pnameprefixes[8][16] =
+char player_names[8][16] =
{
"1: ",
"2: ",
@@ -91,14 +91,6 @@ char pnameprefixes[8][16] =
"8: "
};
-char* player_names[] =
-{
- HUSTR_PLRGREEN,
- HUSTR_PLRINDIGO,
- HUSTR_PLRBROWN,
- HUSTR_PLRRED
-};
-
char chat_char; // remove later.
static player_t* plr;
patch_t* hu_font[HU_FONTSIZE];
@@ -121,7 +113,11 @@ static int message_counter;
static boolean headsupactive = false;
-static char * nickname; // haleyjd 09/18/10: [STRIFE]
+// haleyjd 20130915 [STRIFE]: need nickname
+extern char *nickname;
+
+// haleyjd 20130915 [STRIFE]: true if setting nickname
+static boolean hu_setting_name = false;
//
// Builtin map names.
@@ -276,18 +272,14 @@ void HU_Start(void)
headsupactive = true;
// haleyjd 09/18/10: [STRIFE] nickname weirdness.
-
- // STRIFE-TODO: This shit crashes the game.
- /*
- if(nickname != pnameprefixes[consoleplayer])
+ if(nickname != player_names[consoleplayer])
{
if(*nickname)
{
DEH_printf("have one\n");
- nickname = pnameprefixes[consoleplayer];
+ nickname = player_names[consoleplayer];
}
}
- */
}
}
@@ -463,9 +455,7 @@ void HU_Ticker(void)
&& (chat_dest[i] == consoleplayer+1
|| chat_dest[i] == HU_BROADCAST))
{
- // STRIFE-TODO: there is interaction with the player
- // name prefixes array here...
- HU_addMessage(DEH_String(player_names[i]),
+ HU_addMessage(player_names[i],
w_inputbuffer[i].l.l);
message_nottobefuckedwith = true;
@@ -473,6 +463,12 @@ void HU_Ticker(void)
message_counter = HU_MSGTIMEOUT;
S_StartSound(0, sfx_radio);
}
+ else if(chat_dest[i] == HU_CHANGENAME)
+ {
+ // haleyjd 20130915 [STRIFE]: set player name
+ DEH_snprintf(player_names[i], sizeof(player_names[i]),
+ "%.13s: ", w_inputbuffer[i].l.l);
+ }
HUlib_resetIText(&w_inputbuffer[i]);
}
}
@@ -533,7 +529,7 @@ char HU_dequeueChatChar(void)
// - The default value of key_message_refresh is changed. That is handled
// elsewhere in Choco, however.
// - There is support for setting the player name through the chat
-// mechanism. This is a STRIFE-TODO.
+// mechanism.
//
boolean HU_Responder(event_t *ev)
{
@@ -572,44 +568,14 @@ boolean HU_Responder(event_t *ev)
message_counter = HU_MSGTIMEOUT;
eatkey = true;
}
- else if (netgame && ev->data2 == key_multi_msg)
+ else if (/*netgame && */ev->data2 == key_multi_msg)
{
eatkey = chat_on = true;
HUlib_resetIText(&w_chat);
HU_queueChatChar(HU_BROADCAST);
}
- else if (netgame && numplayers > 2)
- {
- // STRIFE-TODO: support for setting player names
-
- for (i=0; i<MAXPLAYERS ; i++)
- {
- if (ev->data2 == key_multi_msgplayer[i])
- {
- if (playeringame[i] && i!=consoleplayer)
- {
- eatkey = chat_on = true;
- HUlib_resetIText(&w_chat);
- HU_queueChatChar(i+1);
- break;
- }
- else if (i == consoleplayer)
- {
- num_nobrainers++;
- if (num_nobrainers < 3)
- plr->message = DEH_String(HUSTR_TALKTOSELF1);
- else if (num_nobrainers < 6)
- plr->message = DEH_String(HUSTR_TALKTOSELF2);
- else if (num_nobrainers < 9)
- plr->message = DEH_String(HUSTR_TALKTOSELF3);
- else if (num_nobrainers < 32)
- plr->message = DEH_String(HUSTR_TALKTOSELF4);
- else
- plr->message = DEH_String(HUSTR_TALKTOSELF5);
- }
- }
- }
- }
+ // [STRIFE]: You cannot go straight to chatting with a particular
+ // player from here... you must press 't' first. See below.
}
else
{
@@ -639,21 +605,80 @@ boolean HU_Responder(event_t *ev)
}
else
{
- eatkey = HUlib_keyInIText(&w_chat, c);
- if (eatkey)
+ if(w_chat.l.len) // [STRIFE]: past first char of chat?
{
- // static unsigned char buf[20]; // DEBUG
- HU_queueChatChar(c);
-
- // sprintf(buf, "KEY: %d => %d", ev->data1, c);
- // plr->message = buf;
+ eatkey = HUlib_keyInIText(&w_chat, c);
+ if (eatkey)
+ HU_queueChatChar(c);
}
+ else
+ {
+ // [STRIFE]: check for player-specific message;
+ // slightly different than vanilla, to allow keys to be customized
+ for(i = 0; i < MAXPLAYERS; i++)
+ {
+ if(c == key_multi_msgplayer[i])
+ break;
+ }
+ if(i < MAXPLAYERS)
+ {
+ // talking to self?
+ if(i == consoleplayer)
+ {
+ num_nobrainers++;
+ if (num_nobrainers < 3)
+ plr->message = DEH_String(HUSTR_TALKTOSELF1);
+ else if (num_nobrainers < 6)
+ plr->message = DEH_String(HUSTR_TALKTOSELF2);
+ else if (num_nobrainers < 9)
+ plr->message = DEH_String(HUSTR_TALKTOSELF3);
+ else if (num_nobrainers < 32)
+ plr->message = DEH_String(HUSTR_TALKTOSELF4);
+ else
+ plr->message = DEH_String(HUSTR_TALKTOSELF5);
+ }
+ else
+ {
+ eatkey = true;
+ HU_queueChatChar(i+1);
+ DEH_snprintf(lastmessage, sizeof(lastmessage),
+ "Talking to: %c", '1' + i);
+ plr->message = lastmessage;
+ }
+ }
+ else if(c == '$') // [STRIFE]: name changing
+ {
+ eatkey = true;
+ HU_queueChatChar(HU_CHANGENAME);
+ strncpy(lastmessage, DEH_String("Changing Name:"), sizeof(lastmessage));
+ plr->message = lastmessage;
+ hu_setting_name = true;
+ }
+ else
+ {
+ eatkey = HUlib_keyInIText(&w_chat, c);
+ if (eatkey)
+ HU_queueChatChar(c);
+ }
+ }
+
if (c == KEY_ENTER)
{
chat_on = false;
if (w_chat.l.len)
{
- strcpy(lastmessage, w_chat.l.l);
+ // [STRIFE]: name setting
+ if(hu_setting_name)
+ {
+ DEH_snprintf(lastmessage, sizeof(lastmessage),
+ "%s now %.13s", player_names[consoleplayer],
+ w_chat.l.l);
+ hu_setting_name = false;
+ }
+ else
+ {
+ strcpy(lastmessage, w_chat.l.l);
+ }
plr->message = lastmessage;
}
}
diff --git a/src/strife/hu_stuff.h b/src/strife/hu_stuff.h
index e245a42c..86670e79 100644
--- a/src/strife/hu_stuff.h
+++ b/src/strife/hu_stuff.h
@@ -39,6 +39,7 @@
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
#define HU_BROADCAST 9 // haleyjd [STRIFE] Changed 5 -> 9
+#define HU_CHANGENAME 10 // haleyjd [STRIFE] Special command
#define HU_MSGX 0
#define HU_MSGY (SHORT(hu_font[0]->height) + 1) // [STRIFE]: DOOM bug fix
@@ -63,7 +64,7 @@ char HU_dequeueChatChar(void);
void HU_Erase(void);
extern char *chat_macros[10];
-extern char pnameprefixes[8][16]; // villsa [STRIFE]
+extern char player_names[8][16]; // villsa [STRIFE]
// haleyjd [STRIFE] externalized:
extern char *mapnames[];
diff --git a/src/strife/p_inter.c b/src/strife/p_inter.c
index bd56cbed..a0166469 100644
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -790,8 +790,8 @@ void P_KillMobj(mobj_t* source, mobj_t* target)
// villsa [STRIFE] new messages when fragging players
DEH_snprintf(plrkilledmsg, sizeof(plrkilledmsg),
"%s killed %s",
- pnameprefixes[source->player->mo->miscdata],
- pnameprefixes[target->player->mo->miscdata]);
+ player_names[source->player->mo->miscdata],
+ player_names[target->player->mo->miscdata]);
if(netgame)
players[consoleplayer].message = plrkilledmsg;
diff --git a/src/strife/st_stuff.c b/src/strife/st_stuff.c
index cec833fc..bd0c8ca8 100644
--- a/src/strife/st_stuff.c
+++ b/src/strife/st_stuff.c
@@ -1218,7 +1218,7 @@ static boolean ST_drawKeysPopup(void)
colpatch = W_CacheLumpName(buffer, PU_CACHE);
V_DrawPatchDirect(28, y, colpatch);
frags = ST_calcFrags(pnum);
- DEH_snprintf(buffer, sizeof(buffer), "%s%d", pnameprefixes[pnum], frags);
+ DEH_snprintf(buffer, sizeof(buffer), "%s%d", player_names[pnum], frags);
HUlib_drawYellowText(38, yt, buffer);
if(!playeringame[pnum])
HUlib_drawYellowText(28, pnum*17 + 65, "X");
@@ -1235,7 +1235,7 @@ static boolean ST_drawKeysPopup(void)
colpatch = W_CacheLumpName(buffer, PU_CACHE);
V_DrawPatchDirect(158, y, colpatch);
frags = ST_calcFrags(pnum);
- DEH_snprintf(buffer, sizeof(buffer), "%s%d", pnameprefixes[pnum], frags);
+ DEH_snprintf(buffer, sizeof(buffer), "%s%d", player_names[pnum], frags);
HUlib_drawYellowText(168, yt, buffer);
if(!playeringame[pnum])
HUlib_drawYellowText(158, pnum*17 - 3, "X");