mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Turn speed hack check into a function
This commit is contained in:
parent
26a014dc11
commit
cd312e73f5
1 changed files with 30 additions and 51 deletions
|
|
@ -3887,6 +3887,32 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
#undef SERVERONLY
|
#undef SERVERONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Checks ticcmd for "speed hacks"
|
||||||
|
*
|
||||||
|
* \param p Which player
|
||||||
|
* \return True if player is hacking
|
||||||
|
* \sa HandlePacketFromPlayer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static boolean CheckForSpeedHacks(UINT8 p)
|
||||||
|
{
|
||||||
|
if (netcmds[maketic%BACKUPTICS][p].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][p].forwardmove < -MAXPLMOVE
|
||||||
|
|| netcmds[maketic%BACKUPTICS][p].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][p].sidemove < -MAXPLMOVE
|
||||||
|
|| netcmds[maketic%BACKUPTICS][p].driftturn > KART_FULLTURN || netcmds[maketic%BACKUPTICS][p].driftturn < -KART_FULLTURN)
|
||||||
|
{
|
||||||
|
XBOXSTATIC char buf[2];
|
||||||
|
CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), playernode[p]);
|
||||||
|
//D_Clearticcmd(k);
|
||||||
|
|
||||||
|
buf[0] = (char)p;
|
||||||
|
buf[1] = KICK_MSG_CON_FAIL;
|
||||||
|
SendNetXCmd(XD_KICK, &buf, 2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/** Handles a packet received from a node that is in game
|
/** Handles a packet received from a node that is in game
|
||||||
*
|
*
|
||||||
* \param node The packet sender
|
* \param node The packet sender
|
||||||
|
|
@ -3981,19 +4007,8 @@ FILESTAMP
|
||||||
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][netconsole], &netbuffer->u.clientpak.cmd, 1);
|
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][netconsole], &netbuffer->u.clientpak.cmd, 1);
|
||||||
|
|
||||||
// Check ticcmd for "speed hacks"
|
// Check ticcmd for "speed hacks"
|
||||||
if (netcmds[maketic%BACKUPTICS][netconsole].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].forwardmove < -MAXPLMOVE
|
if (CheckForSpeedHacks((UINT8)netconsole))
|
||||||
|| netcmds[maketic%BACKUPTICS][netconsole].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][netconsole].sidemove < -MAXPLMOVE ||
|
|
||||||
netcmds[maketic%BACKUPTICS][netconsole].driftturn > KART_FULLTURN || netcmds[maketic%BACKUPTICS][netconsole].driftturn < -KART_FULLTURN)
|
|
||||||
{
|
|
||||||
XBOXSTATIC char buf[2];
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), node);
|
|
||||||
//D_Clearticcmd(k);
|
|
||||||
|
|
||||||
buf[0] = (char)netconsole;
|
|
||||||
buf[1] = KICK_MSG_CON_FAIL;
|
|
||||||
SendNetXCmd(XD_KICK, &buf, 2);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
// Splitscreen cmd
|
// Splitscreen cmd
|
||||||
if (((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS)
|
if (((netbuffer->packettype == PT_CLIENT2CMD || netbuffer->packettype == PT_CLIENT2MIS)
|
||||||
|
|
@ -4004,21 +4019,9 @@ FILESTAMP
|
||||||
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]],
|
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]],
|
||||||
&netbuffer->u.client2pak.cmd2, 1);
|
&netbuffer->u.client2pak.cmd2, 1);
|
||||||
|
|
||||||
// more "speed hacks"
|
if (CheckForSpeedHacks((UINT8)nodetoplayer2[node]))
|
||||||
if (netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]].forwardmove < -MAXPLMOVE
|
|
||||||
|| netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]].sidemove < -MAXPLMOVE ||
|
|
||||||
netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]].driftturn > KART_FULLTURN || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer2[node]].driftturn < -KART_FULLTURN)
|
|
||||||
{
|
|
||||||
XBOXSTATIC char buf[2];
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), node);
|
|
||||||
//D_Clearticcmd(k);
|
|
||||||
|
|
||||||
buf[0] = (char)nodetoplayer2[node];
|
|
||||||
buf[1] = KICK_MSG_CON_FAIL;
|
|
||||||
SendNetXCmd(XD_KICK, &buf, 2);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (((netbuffer->packettype == PT_CLIENT3CMD || netbuffer->packettype == PT_CLIENT3MIS)
|
if (((netbuffer->packettype == PT_CLIENT3CMD || netbuffer->packettype == PT_CLIENT3MIS)
|
||||||
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
|
|| (netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS))
|
||||||
|
|
@ -4027,21 +4030,9 @@ FILESTAMP
|
||||||
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]],
|
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]],
|
||||||
&netbuffer->u.client3pak.cmd3, 1);
|
&netbuffer->u.client3pak.cmd3, 1);
|
||||||
|
|
||||||
// more "speed hacks"
|
if (CheckForSpeedHacks((UINT8)nodetoplayer3[node]))
|
||||||
if (netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]].forwardmove < -MAXPLMOVE
|
|
||||||
|| netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]].sidemove < -MAXPLMOVE ||
|
|
||||||
netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]].driftturn > KART_FULLTURN || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer3[node]].driftturn < -KART_FULLTURN)
|
|
||||||
{
|
|
||||||
XBOXSTATIC char buf[2];
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), node);
|
|
||||||
//D_Clearticcmd(k);
|
|
||||||
|
|
||||||
buf[0] = (char)nodetoplayer3[node];
|
|
||||||
buf[1] = KICK_MSG_CON_FAIL;
|
|
||||||
SendNetXCmd(XD_KICK, &buf, 2);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)
|
if ((netbuffer->packettype == PT_CLIENT4CMD || netbuffer->packettype == PT_CLIENT4MIS)
|
||||||
&& (nodetoplayer4[node] >= 0))
|
&& (nodetoplayer4[node] >= 0))
|
||||||
|
|
@ -4049,21 +4040,9 @@ FILESTAMP
|
||||||
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]],
|
G_MoveTiccmd(&netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]],
|
||||||
&netbuffer->u.client4pak.cmd4, 1);
|
&netbuffer->u.client4pak.cmd4, 1);
|
||||||
|
|
||||||
// more "speed hacks"
|
if (CheckForSpeedHacks((UINT8)nodetoplayer4[node]))
|
||||||
if (netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]].forwardmove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]].forwardmove < -MAXPLMOVE
|
|
||||||
|| netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]].sidemove > MAXPLMOVE || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]].sidemove < -MAXPLMOVE ||
|
|
||||||
netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]].driftturn > KART_FULLTURN || netcmds[maketic%BACKUPTICS][(UINT8)nodetoplayer4[node]].driftturn < -KART_FULLTURN)
|
|
||||||
{
|
|
||||||
XBOXSTATIC char buf[2];
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal movement value received from node %d\n"), node);
|
|
||||||
//D_Clearticcmd(k);
|
|
||||||
|
|
||||||
buf[0] = (char)nodetoplayer4[node];
|
|
||||||
buf[1] = KICK_MSG_CON_FAIL;
|
|
||||||
SendNetXCmd(XD_KICK, &buf, 2);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// A delay before we check resynching
|
// A delay before we check resynching
|
||||||
// Used on join or just after a synch fail
|
// Used on join or just after a synch fail
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue