mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
FIXED IT
- SendNameAndColor was completely out of order for some reason - SendNameAndColor was sending cvar value instead of the send value. The value for sending. The value chosen specifically for sending, the send value. - Color_OnChange was just broken in the SKINCOLOR_NONE case
This commit is contained in:
parent
5036719280
commit
34987fbffc
1 changed files with 47 additions and 56 deletions
103
src/d_netcmd.c
103
src/d_netcmd.c
|
|
@ -1472,12 +1472,6 @@ static void SendNameAndColor(const UINT8 n)
|
||||||
const INT32 playernum = g_localplayers[n];
|
const INT32 playernum = g_localplayers[n];
|
||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
|
|
||||||
char buf[MAXPLAYERNAME+12];
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
UINT16 sendColor = cv_playercolor[n].value;
|
|
||||||
UINT16 sendFollowerColor = cv_followercolor[n].value;
|
|
||||||
|
|
||||||
if (splitscreen < n)
|
if (splitscreen < n)
|
||||||
{
|
{
|
||||||
return; // can happen if skin4/color4/name4 changed
|
return; // can happen if skin4/color4/name4 changed
|
||||||
|
|
@ -1490,7 +1484,8 @@ static void SendNameAndColor(const UINT8 n)
|
||||||
|
|
||||||
player = &players[playernum];
|
player = &players[playernum];
|
||||||
|
|
||||||
p = buf;
|
UINT16 sendColor = cv_playercolor[n].value;
|
||||||
|
UINT16 sendFollowerColor = cv_followercolor[n].value;
|
||||||
|
|
||||||
// don't allow inaccessible colors
|
// don't allow inaccessible colors
|
||||||
if (sendColor != SKINCOLOR_NONE && K_ColorUsable(sendColor, false) == false)
|
if (sendColor != SKINCOLOR_NONE && K_ColorUsable(sendColor, false) == false)
|
||||||
|
|
@ -1516,40 +1511,12 @@ static void SendNameAndColor(const UINT8 n)
|
||||||
sendFollowerColor = cv_followercolor[n].value;
|
sendFollowerColor = cv_followercolor[n].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't send if everything was identical.
|
|
||||||
if (!strcmp(cv_playername[n].string, player_names[playernum])
|
|
||||||
&& sendColor == player->skincolor
|
|
||||||
&& !stricmp(cv_skin[n].string, skins[player->skin].name)
|
|
||||||
&& !stricmp(cv_follower[n].string,
|
|
||||||
(player->followerskin < 0 ? "None" : followers[player->followerskin].name))
|
|
||||||
&& sendFollowerColor == player->followercolor)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We'll handle it later if we're not playing.
|
// We'll handle it later if we're not playing.
|
||||||
if (!Playing())
|
if (!Playing())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
snacpending[n]++;
|
|
||||||
|
|
||||||
// Don't change name if muted
|
|
||||||
if (player_name_changes[playernum] >= MAXNAMECHANGES)
|
|
||||||
{
|
|
||||||
CV_StealthSet(&cv_playername[n], player_names[playernum]);
|
|
||||||
HU_AddChatText("\x85* You must wait to change your name again.", false);
|
|
||||||
}
|
|
||||||
else if (cv_mute.value && !(server || IsPlayerAdmin(playernum)))
|
|
||||||
{
|
|
||||||
CV_StealthSet(&cv_playername[n], player_names[playernum]);
|
|
||||||
}
|
|
||||||
else // Cleanup name if changing it
|
|
||||||
{
|
|
||||||
CleanupPlayerName(playernum, cv_playername[n].zstring);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't change skin if the server doesn't want you to.
|
// Don't change skin if the server doesn't want you to.
|
||||||
if (!CanChangeSkin(playernum))
|
if (!CanChangeSkin(playernum))
|
||||||
{
|
{
|
||||||
|
|
@ -1589,13 +1556,44 @@ static void SendNameAndColor(const UINT8 n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't send if everything was identical.
|
||||||
|
if (!strcmp(cv_playername[n].string, player_names[playernum])
|
||||||
|
&& sendColor == player->skincolor
|
||||||
|
&& !stricmp(cv_skin[n].string, skins[player->skin].name)
|
||||||
|
&& !stricmp(cv_follower[n].string,
|
||||||
|
(player->followerskin < 0 ? "None" : followers[player->followerskin].name))
|
||||||
|
&& sendFollowerColor == player->followercolor)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
snacpending[n]++;
|
||||||
|
|
||||||
|
// Don't change name if muted
|
||||||
|
if (player_name_changes[playernum] >= MAXNAMECHANGES)
|
||||||
|
{
|
||||||
|
CV_StealthSet(&cv_playername[n], player_names[playernum]);
|
||||||
|
HU_AddChatText("\x85* You must wait to change your name again.", false);
|
||||||
|
}
|
||||||
|
else if (cv_mute.value && !(server || IsPlayerAdmin(playernum)))
|
||||||
|
{
|
||||||
|
CV_StealthSet(&cv_playername[n], player_names[playernum]);
|
||||||
|
}
|
||||||
|
else // Cleanup name if changing it
|
||||||
|
{
|
||||||
|
CleanupPlayerName(playernum, cv_playername[n].zstring);
|
||||||
|
}
|
||||||
|
|
||||||
|
char buf[MAXPLAYERNAME+12];
|
||||||
|
char *p = buf;
|
||||||
|
|
||||||
// Finally write out the complete packet and send it off.
|
// Finally write out the complete packet and send it off.
|
||||||
WRITESTRINGN(p, cv_playername[n].zstring, MAXPLAYERNAME);
|
WRITESTRINGN(p, cv_playername[n].zstring, MAXPLAYERNAME);
|
||||||
WRITEUINT16(p, (UINT16)cv_playercolor[n].value);
|
WRITEUINT16(p, sendColor);
|
||||||
WRITEUINT8(p, (UINT8)cv_skin[n].value);
|
WRITEUINT8(p, (UINT8)cv_skin[n].value);
|
||||||
WRITEINT16(p, (INT16)cv_follower[n].value);
|
WRITEINT16(p, (INT16)cv_follower[n].value);
|
||||||
//CONS_Printf("Sending follower id %d\n", (INT16)cv_follower[n].value);
|
//CONS_Printf("Sending follower id %d\n", (INT16)cv_follower[n].value);
|
||||||
WRITEUINT16(p, (UINT16)cv_followercolor[n].value);
|
WRITEUINT16(p, sendFollowerColor);
|
||||||
|
|
||||||
SendNetXCmdForPlayer(n, XD_NAMEANDCOLOR, buf, p - buf);
|
SendNetXCmdForPlayer(n, XD_NAMEANDCOLOR, buf, p - buf);
|
||||||
}
|
}
|
||||||
|
|
@ -6756,38 +6754,31 @@ static void Skin4_OnChange(void)
|
||||||
*/
|
*/
|
||||||
static void Color_OnChange(const UINT8 p)
|
static void Color_OnChange(const UINT8 p)
|
||||||
{
|
{
|
||||||
UINT16 color = SKINCOLOR_NONE;
|
|
||||||
|
|
||||||
I_Assert(p < MAXSPLITSCREENPLAYERS);
|
I_Assert(p < MAXSPLITSCREENPLAYERS);
|
||||||
|
|
||||||
color = cv_playercolor[p].value;
|
UINT16 color = cv_playercolor[p].value;
|
||||||
|
boolean colorisgood = (color == SKINCOLOR_NONE || K_ColorUsable(color, false) == true);
|
||||||
|
|
||||||
if (!Playing() || splitscreen < p)
|
if (Playing() && splitscreen < p)
|
||||||
{
|
{
|
||||||
if (color != SKINCOLOR_NONE && K_ColorUsable(color, false) == false)
|
if (P_PlayerMoving(g_localplayers[p]) == true)
|
||||||
{
|
{
|
||||||
CV_StealthSetValue(&cv_playercolor[p], lastgoodcolor[p]);
|
colorisgood = false;
|
||||||
color = cv_playercolor[p].value;
|
|
||||||
}
|
}
|
||||||
}
|
else if (colorisgood == true)
|
||||||
else
|
|
||||||
{
|
|
||||||
player_t *const player = &players[ g_localplayers[p] ];
|
|
||||||
|
|
||||||
if (P_PlayerMoving(g_localplayers[p]) == false && K_ColorUsable(color, false) == true)
|
|
||||||
{
|
{
|
||||||
// Color change menu scrolling fix is no longer necessary
|
// Color change menu scrolling fix is no longer necessary
|
||||||
SendNameAndColor(p);
|
SendNameAndColor(p);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
CV_StealthSetValue(&cv_playercolor[p], player->skincolor);
|
if (colorisgood == false)
|
||||||
color = cv_playercolor[p].value;
|
{
|
||||||
}
|
CV_StealthSetValue(&cv_playercolor[p], lastgoodcolor[p]);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastgoodcolor[p] = color;
|
lastgoodcolor[p] = color;
|
||||||
|
|
||||||
G_SetPlayerGamepadIndicatorToPlayerColor(p);
|
G_SetPlayerGamepadIndicatorToPlayerColor(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue