Add support for nzp_rumble builtin

This commit is contained in:
cypress 2024-06-30 19:15:23 -07:00
parent a35cfdfd0e
commit 5ea6df895b
3 changed files with 43 additions and 0 deletions

View file

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

View file

@ -3345,6 +3345,39 @@ void PF_LockViewmodel(void)
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_ScreenFlash
@ -4058,6 +4091,8 @@ PF_BettyPrompt, // #504
PF_SetPlayerName, // #505
PF_SetDoubleTapVersion, // #506
PF_ScreenFlash, // #507
PF_LockViewmodel, // #508
PF_Rumble, // #509
PF_Fixme,
};

View file

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