Add support for nzp_rumble builtin

This commit is contained in:
cypress 2024-06-30 19:15:15 -07:00
parent b1018b3f64
commit 8440319b4b
3 changed files with 43 additions and 1 deletions

View file

@ -1249,6 +1249,13 @@ void CL_ParseServerMessage (void)
MSG_ReadByte(); MSG_ReadByte();
break; break;
case svc_rumble:
// This platform doesn't use this.
MSG_ReadShort();
MSG_ReadShort();
MSG_ReadShort();
break;
case svc_screenflash: case svc_screenflash:
screenflash_color = MSG_ReadByte(); screenflash_color = MSG_ReadByte();
screenflash_duration = sv.time + MSG_ReadByte(); screenflash_duration = sv.time + MSG_ReadByte();

View file

@ -3406,6 +3406,39 @@ void PF_LockViewmodel(void)
MSG_WriteByte (&client->message, state); MSG_WriteByte (&client->message, state);
} }
/*
=================
PF_Rumble
Server tells client to rumble their
GamePad.
nzp_rumble()
=================
*/
void PF_Rumble(void)
{
client_t *client;
int entnum;
int low_frequency;
int high_frequency;
int duration;
entnum = G_EDICTNUM(OFS_PARM0);
low_frequency = G_FLOAT(OFS_PARM1);
high_frequency = G_FLOAT(OFS_PARM2);
duration = G_FLOAT(OFS_PARM3);
if (entnum < 1 || entnum > svs.maxclients)
return;
client = &svs.clients[entnum-1];
MSG_WriteByte (&client->message, svc_rumble);
MSG_WriteShort (&client->message, low_frequency);
MSG_WriteShort (&client->message, high_frequency);
MSG_WriteShort (&client->message, duration);
}
/* /*
================= =================
PF_BettyPrompt PF_BettyPrompt
@ -3818,7 +3851,8 @@ ebfs_builtin_t pr_ebfs_builtins[] =
{ 505, "nzp_setplayername", PF_SetPlayerName }, { 505, "nzp_setplayername", PF_SetPlayerName },
{ 506, "nzp_setdoubletapver", PF_SetDoubleTapVersion }, { 506, "nzp_setdoubletapver", PF_SetDoubleTapVersion },
{ 507, "nzp_screenflash", PF_ScreenFlash }, { 507, "nzp_screenflash", PF_ScreenFlash },
{ 508, "nzp_lockviewmodel", PF_LockViewmodel } { 508, "nzp_lockviewmodel", PF_LockViewmodel },
{ 509, "nzp_rumble", PF_Rumble }
// 2001-11-15 DarkPlaces general builtin functions by Lord Havoc end // 2001-11-15 DarkPlaces general builtin functions by Lord Havoc end

View file

@ -161,6 +161,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_doubletap 49 #define svc_doubletap 49
#define svc_screenflash 50 // [byte] color [byte] duration [byte] type #define svc_screenflash 50 // [byte] color [byte] duration [byte] type
#define svc_lockviewmodel 51 #define svc_lockviewmodel 51
#define svc_rumble 52 // [short] low frequency [short] high frequency [short] duration (ms)
// //
// client to server // client to server