diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-08-27 20:17:04 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-08-27 20:17:04 +0000 |
| commit | 25a2e529bab1d65e19f4bddebda94539f576e2ad (patch) | |
| tree | d14ebd03c6d123fd10c4e603f8b6a463e7044618 /src/game/client | |
| parent | 72ec4f1a9da63ae6364cf72cd10cd5a0966e3f1f (diff) | |
| download | zcatch-25a2e529bab1d65e19f4bddebda94539f576e2ad.tar.gz zcatch-25a2e529bab1d65e19f4bddebda94539f576e2ad.zip | |
fixed so the client gets the correct player info
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/gameclient.cpp | 60 | ||||
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 4 |
2 files changed, 61 insertions, 3 deletions
diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 40682297..12f54b67 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -226,6 +226,63 @@ void GAMECLIENT::on_message(int msgtype) // TODO: this should be done smarter for(int i = 0; i < all.num; i++) all.components[i]->on_message(msgtype, rawmsg); + + // handle core messages + if(msgtype == NETMSGTYPE_SV_SETINFO) + { + NETMSG_SV_SETINFO *msg = (NETMSG_SV_SETINFO *)rawmsg; + + str_copy(clients[msg->cid].name, msg->name, 64); + str_copy(clients[msg->cid].skin_name, msg->skin, 64); + + // make sure that we don't set a special skin on the client + if(clients[msg->cid].skin_name[0] == 'x' || clients[msg->cid].skin_name[1] == '_') + str_copy(clients[msg->cid].skin_name, "default", 64); + + clients[msg->cid].skin_info.color_body = skins->get_color(msg->color_body); + clients[msg->cid].skin_info.color_feet = skins->get_color(msg->color_feet); + clients[msg->cid].skin_info.size = 64; + + // find new skin + clients[msg->cid].skin_id = gameclient.skins->find(clients[msg->cid].skin_name); + if(clients[msg->cid].skin_id < 0) + clients[msg->cid].skin_id = 0; + + if(msg->use_custom_color) + clients[msg->cid].skin_info.texture = gameclient.skins->get(clients[msg->cid].skin_id)->color_texture; + else + { + clients[msg->cid].skin_info.texture = gameclient.skins->get(clients[msg->cid].skin_id)->org_texture; + clients[msg->cid].skin_info.color_body = vec4(1,1,1,1); + clients[msg->cid].skin_info.color_feet = vec4(1,1,1,1); + } + + clients[msg->cid].update_render_info(); + } + else if(msgtype == NETMSGTYPE_SV_WEAPONPICKUP) + { + // TODO: repair me + /*NETMSG_SV_WEAPONPICKUP *msg = (NETMSG_SV_WEAPONPICKUP *)rawmsg; + if(config.cl_autoswitch_weapons) + input_data.wanted_weapon = msg->weapon+1;*/ + } + else if(msgtype == NETMSGTYPE_SV_READYTOENTER) + { + client_entergame(); + } + else if (msgtype == NETMSGTYPE_SV_EMOTICON) + { + NETMSG_SV_EMOTICON *msg = (NETMSG_SV_EMOTICON *)rawmsg; + + // apply + clients[msg->cid].emoticon = msg->emoticon; + clients[msg->cid].emoticon_start = client_tick(); + } + else if(msgtype == NETMSGTYPE_SV_SOUNDGLOBAL) + { + NETMSG_SV_SOUNDGLOBAL *msg = (NETMSG_SV_SOUNDGLOBAL *)rawmsg; + snd_play_random(CHN_GLOBAL, msg->soundid, 1.0f, vec2(0,0)); + } } void GAMECLIENT::on_statechange(int new_state, int old_state) @@ -506,9 +563,6 @@ void GAMECLIENT::CLIENT_DATA::update_render_info() } } - - - void GAMECLIENT::send_switch_team(int team) { NETMSG_CL_SETTEAM msg; diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index 4d0be686..df808a67 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -188,6 +188,7 @@ extern "C" void modc_message(int msgtype) gameclient.on_message(msgtype); +#if 0 // normal void *rawmsg = netmsg_secure_unpack(msgtype); if(!rawmsg) @@ -237,6 +238,7 @@ extern "C" void modc_message(int msgtype) } else if(msgtype == NETMSGTYPE_SV_SETINFO) { + dbg_msg("DEBUG", "got info"); NETMSG_SV_SETINFO *msg = (NETMSG_SV_SETINFO *)rawmsg; str_copy(gameclient.clients[msg->cid].name, msg->name, 64); @@ -309,6 +311,8 @@ extern "C" void modc_message(int msgtype) NETMSG_SV_SOUNDGLOBAL *msg = (NETMSG_SV_SOUNDGLOBAL *)rawmsg; snd_play_random(CHN_GLOBAL, msg->soundid, 1.0f, vec2(0,0)); } + +#endif } extern "C" void modc_connected() |