From 77d80bbf1db458f79e15e824d919cb6000dffbdb Mon Sep 17 00:00:00 2001 From: "Ben Russell (300178622)" Date: Wed, 12 Dec 2012 13:04:33 +1300 Subject: [PATCH] dummied out an abort(), fixed teamchat, added player remove packet --- docs/proto_main.txt | 22 +++++++++++----------- network.c | 5 +++-- pkg/base/client_start.lua | 5 ++++- pkg/base/main_server.lua | 4 ++-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/proto_main.txt b/docs/proto_main.txt index f5fbb77..b519215 100644 --- a/docs/proto_main.txt +++ b/docs/proto_main.txt @@ -109,7 +109,7 @@ Iceball Base Mod: if the gap between the server and client time extends by 10 seconds, client is probably using CE speedhack - 0x03 pid x.s16 y.s16 z.s16: + 0x03 pid x.s16 y.s16 z.s16: @ player set position positions are 11.5 fixed point, @@ -117,7 +117,7 @@ Iceball Base Mod: note, for C->S pid MUST be 0x00 - 0x04 pid ya.u8 xa.u8 keys.u8: + 0x04 pid ya.u8 xa.u8 keys.u8: @ player set orientation / keys angles are as defined: @@ -136,7 +136,7 @@ Iceball Base Mod: note, for C->S pid MUST be 0x00 - 0x05 pid team weapon score.s16 kills.s16 deaths.s16 namelen name[namelen]: (S->C) + 0x05 pid team weapon score.s16 kills.s16 deaths.s16 namelen name[namelen]: (S->C) @ adds player to server note, this can be used to update a player on the server @@ -146,10 +146,10 @@ Iceball Base Mod: yeah that's it really. - 0x06 pid: (S->C) + 0x06 pid: (S->C) @ sets client player id to "pid" - 0x07 pid: (S->C) + 0x07 pid: (S->C) @ removes player from server 0x08 x.u16 y.u16 z.u16 b g r typ: @@ -166,21 +166,21 @@ Iceball Base Mod: NOTE: will be IGNORED if the floodfill hits the bottom! - 0x0C msg.z (C->S) + 0x0C msg.z (C->S) @ send chat message - 0x0D msg.z (C->S) + 0x0D msg.z (C->S) @ send teamchat message - 0x0E bgra.u32 msg.z (S->C) + 0x0E bgra.u32 msg.z (S->C) @ add text to chat - 0x0F bgra.u32 msg.z (S->C) + 0x0F bgra.u32 msg.z (S->C) @ add text to killfeed - 0x10 pid x.fs y.fs z.fs ya.u8 xa.u8: (S->C) + 0x10 pid x.fs y.fs z.fs ya.u8 xa.u8: (S->C) @ player spawn - 0x11 team.s8 weapon.u8 name.z (C->S) + 0x11 team.s8 weapon.u8 name.z (C->S) @ offer player if team == -1, server autoselects diff --git a/network.c b/network.c index 316af88..a100409 100644 --- a/network.c +++ b/network.c @@ -1152,8 +1152,9 @@ void net_flush(void) { fprintf(stderr, "EDOOFUS: given sockfd %i could not be found!\n" , pkt->sockfd); - fflush(stderr); - abort(); + net_packet_free(pkt, &(to_server.send_head), &(to_server.send_tail)); + //fflush(stderr); + //abort(); } else { net_flush_transfer(&to_server, cli, pkt); } diff --git a/pkg/base/client_start.lua b/pkg/base/client_start.lua index 4332caf..6fe5741 100644 --- a/pkg/base/client_start.lua +++ b/pkg/base/client_start.lua @@ -267,7 +267,7 @@ function h_tick_main(sec_current, sec_delta) local cid cid, pkt = common.net_unpack("B", pkt) - print("pkt", cid) + --print("pkt", cid) if cid == 0x03 then local pid, x, y, z @@ -313,6 +313,9 @@ function h_tick_main(sec_current, sec_delta) elseif cid == 0x06 then local pid, pkt = common.net_unpack("B", pkt) players.current = pid + elseif cid == 0x07 then + local pid, pkt = common.net_unpack("B", pkt) + players[pid] = nil elseif cid == 0x0E then -- add to chat local color, msg diff --git a/pkg/base/main_server.lua b/pkg/base/main_server.lua index 05bd7ec..9b4067b 100644 --- a/pkg/base/main_server.lua +++ b/pkg/base/main_server.lua @@ -65,8 +65,6 @@ function net_broadcast_team(tidx, msg) common.net_send(client_list.fdlist[i], msg) end end - -- TODO! - return net_broadcast(sockfd, msg) end function server.hook_connect(sockfd, addrinfo) @@ -109,6 +107,8 @@ function server.hook_disconnect(sockfd, server_force, reason) if plr then net_broadcast(nil, common.net_pack("BIz", 0x0E, 0xFF800000, "* Player "..plr.name.." disconnected")) + net_broadcast(sockfd, common.net_pack("BB", + 0x07, plrid)) players[plrid] = nil end end