diff --git a/include/view.h b/include/view.h index 8d81bccdb..f327bb91d 100644 --- a/include/view.h +++ b/include/view.h @@ -48,7 +48,6 @@ void V_StopPitchDrift (void); void V_RenderView (void); void V_UpdatePalette (void); void V_Register (void); -void V_ParseDamage (void); void V_SetContentsColor (int contents); void V_CalcBlend (void); diff --git a/qw/include/client.h b/qw/include/client.h index a0ed031d2..3c6415456 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -338,6 +338,8 @@ void CL_UpdateScreen (double realtime); void CL_SetState (cactive_t state); +void CL_ParseDamage (void); + void V_PrepBlend (void); #define RSSHOT_WIDTH 320 diff --git a/qw/include/net_svc.h b/qw/include/net_svc.h index 41ecfdffc..969226bf0 100644 --- a/qw/include/net_svc.h +++ b/qw/include/net_svc.h @@ -42,12 +42,31 @@ typedef enum NET_ERROR } net_status_t; + +typedef struct net_svc_nop_s +{ +} net_svc_nop_t; + +typedef struct net_svc_disconnect_s +{ +} net_svc_disconnect_t; + typedef struct net_svc_print_s { byte level; const char *message; } net_svc_print_t; +typedef struct net_svc_centerprint_s +{ + const char *message; +} net_svc_centerprint_t; + +typedef struct net_svc_stufftext_s +{ + const char *commands; +} net_svc_stufftext_t; + typedef struct net_svc_damage_s { byte armor; @@ -66,6 +85,17 @@ typedef struct net_svc_serverdata_s movevars_t movevars; } net_svc_serverdata_t; +typedef struct net_svc_setangle_s +{ + vec3_t angles; +} net_svc_setangle_t; + +typedef struct net_svc_lightstyle_s +{ + byte stylenum; + const char *map; +} net_svc_lightstyle_t; + typedef struct net_svc_sound_s { short channel; @@ -76,6 +106,18 @@ typedef struct net_svc_sound_s int entity; } net_svc_sound_t; +typedef struct net_svc_stopsound_s +{ + int entity; + int channel; +} net_svc_stopsound_t; + +typedef struct net_svc_updatefrags_s +{ + byte player; + short frags; +} net_svc_updatefrags_t; + typedef struct net_svc_updateping_s { byte player; @@ -126,6 +168,14 @@ typedef struct net_svc_tempentity_s short beamentity; // beam entity } net_svc_tempentity_t; +typedef struct net_svc_killedmonster_s +{ +} net_svc_killedmonster_t; + +typedef struct net_svc_foundsecret_s +{ +} net_svc_foundsecret_t; + typedef struct net_svc_spawnstaticsound_s { vec3_t position; @@ -162,6 +212,18 @@ typedef struct net_svc_finale_s const char *message; } net_svc_finale_t; +typedef struct net_svc_sellscreen_s +{ +} net_svc_sellscreen_t; + +typedef struct net_svc_smallkick_s +{ +} net_svc_smallkick_t; + +typedef struct net_svc_bigkick_s +{ +} net_svc_bigkick_t; + typedef struct net_svc_muzzleflash_s { short player; @@ -271,15 +333,39 @@ typedef struct net_svc_setpause_s } net_svc_setpause_t; const char *NET_SVC_GetString (int type); +net_status_t NET_SVC_NOP_Emit (net_svc_nop_t *block, sizebuf_t *buf); +net_status_t NET_SVC_NOP_Parse (net_svc_nop_t *block, msg_t *msg); +net_status_t NET_SVC_Disconnect_Emit (net_svc_disconnect_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_Disconnect_Parse (net_svc_disconnect_t *block, msg_t *msg); net_status_t NET_SVC_Print_Emit (net_svc_print_t *block, sizebuf_t *buf); net_status_t NET_SVC_Print_Parse (net_svc_print_t *block, msg_t *msg); +net_status_t NET_SVC_Centerprint_Emit (net_svc_centerprint_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_Centerprint_Parse (net_svc_centerprint_t *block, + msg_t *msg); +net_status_t NET_SVC_Stufftext_Emit (net_svc_stufftext_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_Stufftext_Parse (net_svc_stufftext_t *block, msg_t *msg); net_status_t NET_SVC_Damage_Emit (net_svc_damage_t *block, sizebuf_t *buf); net_status_t NET_SVC_Damage_Parse (net_svc_damage_t *block, msg_t *msg); net_status_t NET_SVC_ServerData_Emit (net_svc_serverdata_t *block, sizebuf_t *buf); net_status_t NET_SVC_ServerData_Parse (net_svc_serverdata_t *block, msg_t *msg); +net_status_t NET_SVC_SetAngle_Emit (net_svc_setangle_t *block, sizebuf_t *buf); +net_status_t NET_SVC_SetAngle_Parse (net_svc_setangle_t *block, msg_t *msg); +net_status_t NET_SVC_LightStyle_Emit (net_svc_lightstyle_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_LightStyle_Parse (net_svc_lightstyle_t *block, msg_t *msg); net_status_t NET_SVC_Sound_Emit (net_svc_sound_t *block, sizebuf_t *buf); net_status_t NET_SVC_Sound_Parse (net_svc_sound_t *block, msg_t *msg); +net_status_t NET_SVC_StopSound_Emit (net_svc_stopsound_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_StopSound_Parse (net_svc_stopsound_t *block, msg_t *msg); +net_status_t NET_SVC_UpdateFrags_Emit (net_svc_updatefrags_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_UpdateFrags_Parse (net_svc_updatefrags_t *block, + msg_t *msg); net_status_t NET_SVC_UpdatePing_Emit (net_svc_updateping_t *block, sizebuf_t *buf); net_status_t NET_SVC_UpdatePing_Parse (net_svc_updateping_t *block, msg_t *msg); @@ -300,6 +386,14 @@ net_status_t NET_SVC_SpawnStatic_Parse (net_svc_spawnstatic_t *block, net_status_t NET_SVC_TempEntity_Emit (net_svc_tempentity_t *block, sizebuf_t *buf); net_status_t NET_SVC_TempEntity_Parse (net_svc_tempentity_t *block, msg_t *msg); +net_status_t NET_SVC_KilledMonster_Emit (net_svc_killedmonster_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_KilledMonster_Parse (net_svc_killedmonster_t *block, + msg_t *msg); +net_status_t NET_SVC_FoundSecret_Emit (net_svc_foundsecret_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_FoundSecret_Parse (net_svc_foundsecret_t *block, + msg_t *msg); net_status_t NET_SVC_SpawnStaticSound_Emit (net_svc_spawnstaticsound_t *block, sizebuf_t *buf); net_status_t NET_SVC_SpawnStaticSound_Parse (net_svc_spawnstaticsound_t *block, @@ -319,6 +413,14 @@ net_status_t NET_SVC_Intermission_Parse (net_svc_intermission_t *block, msg_t *msg); net_status_t NET_SVC_Finale_Emit (net_svc_finale_t *block, sizebuf_t *buf); net_status_t NET_SVC_Finale_Parse (net_svc_finale_t *block, msg_t *msg); +net_status_t NET_SVC_SellScreen_Emit (net_svc_sellscreen_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_SellScreen_Parse (net_svc_sellscreen_t *block, msg_t *msg); +net_status_t NET_SVC_SmallKick_Emit (net_svc_smallkick_t *block, + sizebuf_t *buf); +net_status_t NET_SVC_SmallKick_Parse (net_svc_smallkick_t *block, msg_t *msg); +net_status_t NET_SVC_BigKick_Emit (net_svc_bigkick_t *block, sizebuf_t *buf); +net_status_t NET_SVC_BigKick_Parse (net_svc_bigkick_t *block, msg_t *msg); net_status_t NET_SVC_MuzzleFlash_Emit (net_svc_muzzleflash_t *block, sizebuf_t *buf); net_status_t NET_SVC_MuzzleFlash_Parse (net_svc_muzzleflash_t *block, diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 6b4b00909..3a360cb0a 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -577,6 +577,9 @@ CL_ParseServerData (void) return; } + // make sure any stuffed commands are done + Cbuf_Execute (); + // wipe the client_state_t struct CL_ClearState (); @@ -651,6 +654,9 @@ CL_ParseServerData (void) CL_SetState (ca_onserver); CL_ClearBaselines (); + + // leave full screen intermission + vid.recalc_refdef = true; } // LordHavoc: BIG BUG-FIX! Clear baselines each time it connects... @@ -762,6 +768,128 @@ CL_ParseModellist (void) Model_NextDownload (); } +void +CL_ParseNOP (void) +{ + net_svc_nop_t block; + + if (NET_SVC_NOP_Parse (&block, net_message)) { + Host_NetError ("CL_ParseNOP: Bad Read\n"); + return; + } +} + +void +CL_ParseDisconnect (void) +{ + net_svc_disconnect_t block; + + if (NET_SVC_Disconnect_Parse (&block, net_message)) { + Host_NetError ("CL_ParseDisconnect: Bad Read\n"); + return; + } + + if (cls.state == ca_connected) + Host_EndGame ("Server disconnected\n" + "Server version may not be compatible"); + else + Host_EndGame ("Server disconnected"); +} + +void +CL_ParseCenterprint (void) +{ + net_svc_centerprint_t block; + + if (NET_SVC_Centerprint_Parse (&block, net_message)) { + Host_NetError ("CL_ParseCenterprint: Bad Read\n"); + return; + } + + SCR_CenterPrint (block.message); +} + +void +CL_ParseStufftext (void) +{ + net_svc_stufftext_t block; + + if (NET_SVC_Stufftext_Parse (&block, net_message)) { + Host_NetError ("CL_ParseStufftext: Bad Read\n"); + return; + } + + Con_DPrintf ("stufftext: %s\n", block.commands); + Cbuf_AddText (block.commands); +} + +void +CL_ParseSetAngle (void) +{ + net_svc_setangle_t block; + + if (NET_SVC_SetAngle_Parse (&block, net_message)) { + Host_NetError ("CL_ParseSetAngle: Bad Read\n"); + return; + } + + VectorCopy (block.angles, cl.viewangles); +} + +void +CL_ParseLightStyle (void) +{ + lightstyle_t *style; + net_svc_lightstyle_t block; + + if (NET_SVC_LightStyle_Parse (&block, net_message)) { + Host_NetError ("CL_ParseLightStyle: Bad Read\n"); + return; + } + + if (block.stylenum >= MAX_LIGHTSTYLES) { + Host_NetError ("svc_lightstyle > MAX_LIGHTSTYLES"); + return; + } + style = &r_lightstyle[block.stylenum]; + + strncpy (style->map, block.map, sizeof (style->map) - 1); + style->map[sizeof (style->map) - 1] = 0; + style->length = strlen (style->map); +} + +void +CL_ParseStopSound (void) +{ + net_svc_stopsound_t block; + + if (NET_SVC_StopSound_Parse (&block, net_message)) { + Host_NetError ("CL_ParseStopSound: Bad Read\n"); + return; + } + + S_StopSound (block.entity, block.channel); +} + +void +CL_ParseUpdateFrags (void) +{ + net_svc_updatefrags_t block; + + if (NET_SVC_UpdateFrags_Parse (&block, net_message)) { + Host_NetError ("CL_ParseUpdateFrags: Bad Read\n"); + return; + } + + Sbar_Changed (); + if (block.player >= MAX_CLIENTS) { + Host_NetError ("CL_ParseServerMessage: svc_updatefrags > " + "MAX_SCOREBOARD"); + return; + } + cl.players[block.player].frags = block.frags; +} + void CL_ParseUpdatePing (void) { @@ -914,21 +1042,21 @@ CL_ParseStaticSound (void) /* ACTION MESSAGES */ void -CL_ParseStartSoundPacket (void) +CL_ParseSound (void) { net_svc_sound_t sound; if (NET_SVC_Sound_Parse (&sound, net_message)) { - Host_NetError ("CL_ParseStartSoundPacket: Bad Read\n"); + Host_NetError ("CL_ParseSound: Bad Read\n"); return; } if (sound.entity >= MAX_EDICTS) { - Host_NetError ("CL_ParseStartSoundPacket: ent = %i", sound.entity); + Host_NetError ("CL_ParseSound: ent = %i", sound.entity); return; } if (sound.sound_num >= MAX_SOUNDS) { - Host_NetError ("CL_ParseStartSoundPacket: sound_num = %i", + Host_NetError ("CL_ParseSound: sound_num = %i", sound.sound_num); return; } @@ -1038,19 +1166,19 @@ CL_ParseUpdateUserInfo (void) } void -CL_SetInfo (void) +CL_ParseSetInfo (void) { int flags; player_info_t *player; net_svc_setinfo_t setinfo; if (NET_SVC_SetInfo_Parse (&setinfo, net_message)) { - Host_NetError ("CL_SetInfo: Bad Read\n"); + Host_NetError ("CL_ParseSetInfo: Bad Read\n"); return; } if (setinfo.slot >= MAX_CLIENTS) { - Host_NetError ("CL_SetInfo: slot %i >= MAX_CLIENTS", setinfo.slot); + Host_NetError ("CL_ParseSetInfo: slot %i >= MAX_CLIENTS", setinfo.slot); return; } @@ -1069,12 +1197,12 @@ CL_SetInfo (void) } void -CL_ServerInfo (void) +CL_ParseServerInfo (void) { net_svc_serverinfo_t block; if (NET_SVC_ServerInfo_Parse (&block, net_message)) { - Host_NetError ("CL_ServerInfo: Bad Read\n"); + Host_NetError ("CL_ParseServerInfo: Bad Read\n"); return; } @@ -1115,6 +1243,32 @@ CL_SetStat (int stat, int value) cl.stats[stat] = value; } +void +CL_ParseKilledMonster (void) +{ + net_svc_killedmonster_t block; + + if (NET_SVC_KilledMonster_Parse (&block, net_message)) { + Host_NetError ("CL_ParseKilledMonster: Bad Read\n"); + return; + } + + cl.stats[STAT_MONSTERS]++; +} + +void +CL_ParseFoundSecret (void) +{ + net_svc_foundsecret_t block; + + if (NET_SVC_FoundSecret_Parse (&block, net_message)) { + Host_NetError ("CL_ParseFoundSecret: Bad Read\n"); + return; + } + + cl.stats[STAT_SECRETS]++; +} + void CL_ParseUpdateStat (void) { @@ -1193,6 +1347,45 @@ CL_ParseFinale (void) SCR_CenterPrint (block.message); } +void +CL_ParseSellScreen (void) +{ + net_svc_sellscreen_t block; + + if (NET_SVC_SellScreen_Parse (&block, net_message)) { + Host_NetError ("CL_ParseSellScreen: Bad Read\n"); + return; + } + + Cmd_ExecuteString ("help", src_command); +} + +void +CL_ParseSmallKick (void) +{ + net_svc_smallkick_t block; + + if (NET_SVC_SmallKick_Parse (&block, net_message)) { + Host_NetError ("CL_ParseSmallKick: Bad Read\n"); + return; + } + + cl.punchangle = -2; +} + +void +CL_ParseBigKick (void) +{ + net_svc_bigkick_t block; + + if (NET_SVC_BigKick_Parse (&block, net_message)) { + Host_NetError ("CL_ParseBigKick: Bad Read\n"); + return; + } + + cl.punchangle = -4; +} + void CL_ParseMuzzleFlash (void) { @@ -1294,8 +1487,7 @@ int received_framecount; void CL_ParseServerMessage (void) { - const char *s; - int cmd, i; + int cmd; received_framecount = host_framecount; cl.last_servermessage = realtime; @@ -1339,202 +1531,50 @@ CL_ParseServerMessage (void) "server message"); break; - case svc_nop: -// Con_Printf ("svc_nop\n"); - break; - - case svc_disconnect: - if (cls.state == ca_connected) - Host_EndGame ("Server disconnected\n" - "Server version may not be compatible"); - else - Host_EndGame ("Server disconnected"); - break; - - case svc_print: - CL_ParsePrint (); - break; - - case svc_centerprint: - SCR_CenterPrint (MSG_ReadString (net_message)); - break; - - case svc_stufftext: - s = MSG_ReadString (net_message); - Con_DPrintf ("stufftext: %s\n", s); - Cbuf_AddText (s); - break; - - case svc_damage: - V_ParseDamage (); - break; - - case svc_serverdata: - Cbuf_Execute (); // make sure any stuffed commands are - // done - CL_ParseServerData (); - vid.recalc_refdef = true; // leave full screen intermission - break; - - case svc_setangle: - for (i = 0; i < 3; i++) - cl.viewangles[i] = MSG_ReadAngle (net_message); -// cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0; - break; - - case svc_lightstyle: - i = MSG_ReadByte (net_message); - if (i >= MAX_LIGHTSTYLES) -// Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES"); - Host_NetError ("svc_lightstyle > MAX_LIGHTSTYLES"); - strncpy (r_lightstyle[i].map, MSG_ReadString (net_message), - sizeof (r_lightstyle[i].map) - 1); - r_lightstyle[i].map[sizeof (r_lightstyle[i].map) - 1] = 0; - r_lightstyle[i].length = strlen (r_lightstyle[i].map); - break; - - case svc_sound: - CL_ParseStartSoundPacket (); - break; - - case svc_stopsound: - i = MSG_ReadShort (net_message); - S_StopSound (i >> 3, i & 7); - break; - - case svc_updatefrags: - Sbar_Changed (); - i = MSG_ReadByte (net_message); - if (i >= MAX_CLIENTS) - Host_NetError ("CL_ParseServerMessage: svc_updatefrags > " - "MAX_SCOREBOARD"); - cl.players[i].frags = MSG_ReadShort (net_message); - break; - - case svc_updateping: - CL_ParseUpdatePing (); - break; - - case svc_updatepl: - CL_ParseUpdatePL (); - break; - - case svc_updateentertime: - CL_ParseUpdateEnterTime (); - break; - - case svc_spawnbaseline: - CL_ParseSpawnBaseline (); - break; - case svc_spawnstatic: - CL_ParseStatic (); - break; - case svc_temp_entity: - CL_ParseTEnt (); - break; - - case svc_killedmonster: - cl.stats[STAT_MONSTERS]++; - break; - - case svc_foundsecret: - cl.stats[STAT_SECRETS]++; - break; - - case svc_updatestat: - CL_ParseUpdateStat (); - break; - case svc_updatestatlong: - CL_ParseUpdateStatLong (); - break; - - case svc_spawnstaticsound: - CL_ParseStaticSound (); - break; - - case svc_cdtrack: - CL_ParseCDTrack (); - break; - - case svc_intermission: - CL_ParseIntermission (); - break; - - case svc_finale: - CL_ParseFinale (); - break; - - case svc_sellscreen: - Cmd_ExecuteString ("help", src_command); - break; - - case svc_smallkick: - cl.punchangle = -2; - break; - case svc_bigkick: - cl.punchangle = -4; - break; - - case svc_muzzleflash: - CL_ParseMuzzleFlash (); - break; - - case svc_updateuserinfo: - CL_ParseUpdateUserInfo (); - break; - - case svc_setinfo: - CL_SetInfo (); - break; - - case svc_serverinfo: - CL_ServerInfo (); - break; - - case svc_download: - CL_ParseDownload (); - break; - - case svc_playerinfo: - CL_ParsePlayerinfo (); - break; - - case svc_nails: - CL_ParseProjectiles (); - break; - - case svc_chokecount: // some preceding packets were choked - CL_ParseChokeCount (); - break; - - case svc_modellist: - CL_ParseModellist (); - break; - - case svc_soundlist: - CL_ParseSoundlist (); - break; - - case svc_packetentities: - CL_ParsePacketEntities (); - break; - - case svc_deltapacketentities: - CL_ParseDeltaPacketEntities (); - break; - - case svc_maxspeed: - CL_ParseMaxSpeed (); - break; - - case svc_entgravity: - CL_ParseEntGravity (); - break; - - case svc_setpause: - CL_ParseSetPause (); - break; - + case svc_nop: CL_ParseNOP (); break; + case svc_disconnect: CL_ParseDisconnect (); break; + case svc_print: CL_ParsePrint (); break; + case svc_centerprint: CL_ParseCenterprint (); break; + case svc_stufftext: CL_ParseStufftext (); break; + case svc_damage: CL_ParseDamage (); break; + case svc_serverdata: CL_ParseServerData (); break; + case svc_setangle: CL_ParseSetAngle (); break; + case svc_lightstyle: CL_ParseLightStyle (); break; + case svc_sound: CL_ParseSound (); break; + case svc_stopsound: CL_ParseStopSound (); break; + case svc_updatefrags: CL_ParseUpdateFrags (); break; + case svc_updateping: CL_ParseUpdatePing (); break; + case svc_updatepl: CL_ParseUpdatePL (); break; + case svc_updateentertime: CL_ParseUpdateEnterTime (); break; + case svc_spawnbaseline: CL_ParseSpawnBaseline (); break; + case svc_spawnstatic: CL_ParseStatic (); break; + case svc_temp_entity: CL_ParseTEnt (); break; + case svc_killedmonster: CL_ParseKilledMonster (); break; + case svc_foundsecret: CL_ParseFoundSecret (); break; + case svc_updatestat: CL_ParseUpdateStat (); break; + case svc_updatestatlong: CL_ParseUpdateStatLong (); break; + case svc_spawnstaticsound: CL_ParseStaticSound (); break; + case svc_cdtrack: CL_ParseCDTrack (); break; + case svc_intermission: CL_ParseIntermission (); break; + case svc_finale: CL_ParseFinale (); break; + case svc_sellscreen: CL_ParseSellScreen (); break; + case svc_smallkick: CL_ParseSmallKick (); break; + case svc_bigkick: CL_ParseBigKick (); break; + case svc_muzzleflash: CL_ParseMuzzleFlash (); break; + case svc_updateuserinfo: CL_ParseUpdateUserInfo (); break; + case svc_setinfo: CL_ParseSetInfo (); break; + case svc_serverinfo: CL_ParseServerInfo (); break; + case svc_download: CL_ParseDownload (); break; + case svc_playerinfo: CL_ParsePlayerinfo (); break; + case svc_nails: CL_ParseProjectiles (); break; + case svc_chokecount: CL_ParseChokeCount (); break; + case svc_modellist: CL_ParseModellist (); break; + case svc_soundlist: CL_ParseSoundlist (); break; + case svc_packetentities: CL_ParsePacketEntities (); break; + case svc_deltapacketentities: CL_ParseDeltaPacketEntities (); break; + case svc_maxspeed: CL_ParseMaxSpeed (); break; + case svc_entgravity: CL_ParseEntGravity (); break; + case svc_setpause: CL_ParseSetPause (); break; } } diff --git a/qw/source/cl_view.c b/qw/source/cl_view.c index 4fa6bd656..04efe9dd4 100644 --- a/qw/source/cl_view.c +++ b/qw/source/cl_view.c @@ -241,14 +241,14 @@ V_DriftPitch (void) /* PALETTE FLASHES */ void -V_ParseDamage (void) +CL_ParseDamage (void) { float count, side; vec3_t forward, right, up; net_svc_damage_t damage; if (NET_SVC_Damage_Parse (&damage, net_message)) { - Host_NetError ("V_ParseDamage: Bad Read\n"); + Host_NetError ("CL_ParseDamage: Bad Read\n"); return; } diff --git a/qw/source/net_svc.c b/qw/source/net_svc.c index 5f2d47385..425d98147 100644 --- a/qw/source/net_svc.c +++ b/qw/source/net_svc.c @@ -122,6 +122,30 @@ NET_SVC_GetString (int type) } +net_status_t +NET_SVC_NOP_Emit (net_svc_nop_t *block, sizebuf_t *buf) +{ + return buf->overflowed; +} + +net_status_t +NET_SVC_NOP_Parse (net_svc_nop_t *block, msg_t *msg) +{ + return msg->badread; +} + +net_status_t +NET_SVC_Disconnect_Emit (net_svc_disconnect_t *block, sizebuf_t *buf) +{ + return buf->overflowed; +} + +net_status_t +NET_SVC_Disconnect_Parse (net_svc_disconnect_t *block, msg_t *msg) +{ + return msg->badread; +} + net_status_t NET_SVC_Print_Emit (net_svc_print_t *block, sizebuf_t *buf) { @@ -140,6 +164,38 @@ NET_SVC_Print_Parse (net_svc_print_t *block, msg_t *msg) return msg->badread; } +net_status_t +NET_SVC_Centerprint_Emit (net_svc_centerprint_t *block, sizebuf_t *buf) +{ + MSG_WriteString (buf, block->message); + + return buf->overflowed; +} + +net_status_t +NET_SVC_Centerprint_Parse (net_svc_centerprint_t *block, msg_t *msg) +{ + block->message = MSG_ReadString (msg); + + return msg->badread; +} + +net_status_t +NET_SVC_Stufftext_Emit (net_svc_stufftext_t *block, sizebuf_t *buf) +{ + MSG_WriteString (buf, block->commands); + + return buf->overflowed; +} + +net_status_t +NET_SVC_Stufftext_Parse (net_svc_stufftext_t *block, msg_t *msg) +{ + block->commands = MSG_ReadString (msg); + + return msg->badread; +} + net_status_t NET_SVC_Damage_Emit (net_svc_damage_t *block, sizebuf_t *buf) { @@ -217,6 +273,46 @@ NET_SVC_ServerData_Parse (net_svc_serverdata_t *block, msg_t *msg) return msg->badread; } +net_status_t +NET_SVC_SetAngle_Emit (net_svc_setangle_t *block, sizebuf_t *buf) +{ + int i; + + for (i = 0; i < 3; i++) + MSG_WriteAngle (buf, block->angles[i]); + + return buf->overflowed; +} + +net_status_t +NET_SVC_SetAngle_Parse (net_svc_setangle_t *block, msg_t *msg) +{ + int i; + + for (i = 0; i < 3; i++) + block->angles[i] = MSG_ReadAngle (msg); + + return msg->badread; +} + +net_status_t +NET_SVC_LightStyle_Emit (net_svc_lightstyle_t *block, sizebuf_t *buf) +{ + MSG_WriteByte (buf, block->stylenum); + MSG_WriteString (buf, block->map); + + return buf->overflowed; +} + +net_status_t +NET_SVC_LightStyle_Parse (net_svc_lightstyle_t *block, msg_t *msg) +{ + block->stylenum = MSG_ReadByte (msg); + block->map = MSG_ReadString (msg); + + return msg->badread; +} + net_status_t NET_SVC_Sound_Emit (net_svc_sound_t *block, sizebuf_t *buf) { @@ -268,6 +364,42 @@ NET_SVC_Sound_Parse (net_svc_sound_t *block, msg_t *msg) return msg->badread; } +net_status_t +NET_SVC_StopSound_Emit (net_svc_stopsound_t *block, sizebuf_t *buf) +{ + MSG_WriteShort (buf, (block->entity << 3) & (block->channel & 7)); + + return buf->overflowed; +} + +net_status_t +NET_SVC_StopSound_Parse (net_svc_stopsound_t *block, msg_t *msg) +{ + int i = MSG_ReadShort (msg); + block->entity = i >> 3; + block->channel = i & 7; + + return msg->badread; +} + +net_status_t +NET_SVC_UpdateFrags_Emit (net_svc_updatefrags_t *block, sizebuf_t *buf) +{ + MSG_WriteByte (buf, block->player); + MSG_WriteShort (buf, block->frags); + + return buf->overflowed; +} + +net_status_t +NET_SVC_UpdateFrags_Parse (net_svc_updatefrags_t *block, msg_t *msg) +{ + block->player = MSG_ReadByte (msg); + block->frags = MSG_ReadShort (msg); + + return msg->badread; +} + net_status_t NET_SVC_UpdatePing_Emit (net_svc_updateping_t *block, sizebuf_t *buf) { @@ -493,6 +625,30 @@ NET_SVC_TempEntity_Parse (net_svc_tempentity_t *block, msg_t *msg) return msg->badread; } +net_status_t +NET_SVC_KilledMonster_Emit (net_svc_killedmonster_t *block, sizebuf_t *buf) +{ + return buf->overflowed; +} + +net_status_t +NET_SVC_KilledMonster_Parse (net_svc_killedmonster_t *block, msg_t *msg) +{ + return msg->badread; +} + +net_status_t +NET_SVC_FoundSecret_Emit (net_svc_foundsecret_t *block, sizebuf_t *buf) +{ + return buf->overflowed; +} + +net_status_t +NET_SVC_FoundSecret_Parse (net_svc_foundsecret_t *block, msg_t *msg) +{ + return msg->badread; +} + net_status_t NET_SVC_SpawnStaticSound_Emit (net_svc_spawnstaticsound_t *block, sizebuf_t *buf) @@ -617,6 +773,42 @@ NET_SVC_Finale_Parse (net_svc_finale_t *block, msg_t *msg) return msg->badread; } +net_status_t +NET_SVC_SellScreen_Emit (net_svc_sellscreen_t *block, sizebuf_t *buf) +{ + return buf->overflowed; +} + +net_status_t +NET_SVC_SellScreen_Parse (net_svc_sellscreen_t *block, msg_t *msg) +{ + return msg->badread; +} + +net_status_t +NET_SVC_SmallKick_Emit (net_svc_smallkick_t *block, sizebuf_t *buf) +{ + return buf->overflowed; +} + +net_status_t +NET_SVC_SmallKick_Parse (net_svc_smallkick_t *block, msg_t *msg) +{ + return msg->badread; +} + +net_status_t +NET_SVC_BigKick_Emit (net_svc_bigkick_t *block, sizebuf_t *buf) +{ + return buf->overflowed; +} + +net_status_t +NET_SVC_BigKick_Parse (net_svc_bigkick_t *block, msg_t *msg) +{ + return msg->badread; +} + net_status_t NET_SVC_MuzzleFlash_Emit (net_svc_muzzleflash_t *block, sizebuf_t *buf) { @@ -1016,7 +1208,7 @@ NET_SVC_Delta_Emit (entity_state_t *es, unsigned int bits, sizebuf_t *buf) } // this is a sub-block, not a real block -void +static void NET_SVC_Delta_Parse (entity_state_t *es, unsigned int bits, msg_t *msg) { // bytes of bits: [EXT2][EXT1][ORIG][MORE]