diff --git a/source/cl_parse.c b/source/cl_parse.c index 873e3ac..7e97616 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -1249,6 +1249,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(); diff --git a/source/pr_cmds.c b/source/pr_cmds.c index 8630815..9c1f5f4 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -3406,6 +3406,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_BettyPrompt @@ -3818,7 +3851,8 @@ ebfs_builtin_t pr_ebfs_builtins[] = { 505, "nzp_setplayername", PF_SetPlayerName }, { 506, "nzp_setdoubletapver", PF_SetDoubleTapVersion }, { 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 diff --git a/source/protocol.h b/source/protocol.h index 8e16a38..70c742a 100644 --- a/source/protocol.h +++ b/source/protocol.h @@ -161,6 +161,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