diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-08-27 20:51:51 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-08-27 20:51:51 +0000 |
| commit | b22dd1488cdae53d27215fda051fea9bfc72ac1d (patch) | |
| tree | b1095afdbca496995fc716cdfb25a55bc3933f21 /src | |
| parent | a47fe88d196735a52809a1387ed67aa1a767bd4f (diff) | |
| download | zcatch-b22dd1488cdae53d27215fda051fea9bfc72ac1d.tar.gz zcatch-b22dd1488cdae53d27215fda051fea9bfc72ac1d.zip | |
futher cleanups
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/client/gc_effects.cpp | 234 | ||||
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 126 |
2 files changed, 0 insertions, 360 deletions
diff --git a/src/game/client/gc_effects.cpp b/src/game/client/gc_effects.cpp deleted file mode 100644 index f8c4e2c8..00000000 --- a/src/game/client/gc_effects.cpp +++ /dev/null @@ -1,234 +0,0 @@ -#include <engine/e_client_interface.h> -#include "gc_client.hpp" -#include "../generated/gc_data.hpp" - -#include "components/particles.hpp" -#include "components/skins.hpp" -#include "components/flow.hpp" -#include "components/damageind.hpp" -#include "gameclient.hpp" - -static bool add_50hz = false; -static bool add_100hz = false; - -void effect_air_jump(vec2 pos) -{ - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_AIRJUMP; - p.pos = pos + vec2(-6.0f, 16.0f); - p.vel = vec2(0, -200); - p.life_span = 0.5f; - p.start_size = 48.0f; - p.end_size = 0; - p.rot = frandom()*pi*2; - p.rotspeed = pi*2; - p.gravity = 500; - p.friction = 0.7f; - p.flow_affected = 0.0f; - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - - p.pos = pos + vec2(6.0f, 16.0f); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); -} - -void effect_damage_indicator(vec2 pos, vec2 dir) -{ - gameclient.damageind->create(pos, dir); -} - -void effect_powerupshine(vec2 pos, vec2 size) -{ - if(!add_50hz) - return; - - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SLICE; - p.pos = pos + vec2((frandom()-0.5f)*size.x, (frandom()-0.5f)*size.y); - p.vel = vec2(0, 0); - p.life_span = 0.5f; - p.start_size = 16.0f; - p.end_size = 0; - p.rot = frandom()*pi*2; - p.rotspeed = pi*2; - p.gravity = 500; - p.friction = 0.9f; - p.flow_affected = 0.0f; - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); -} - -void effect_smoketrail(vec2 pos, vec2 vel) -{ - if(!add_50hz) - return; - - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SMOKE; - p.pos = pos; - p.vel = vel + random_dir()*50.0f; - p.life_span = 0.5f + frandom()*0.5f; - p.start_size = 12.0f + frandom()*8; - p.end_size = 0; - p.friction = 0.7; - p.gravity = frandom()*-500.0f; - gameclient.particles->add(PARTICLES::GROUP_PROJECTILE_TRAIL, &p); -} - - -void effect_skidtrail(vec2 pos, vec2 vel) -{ - if(!add_100hz) - return; - - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SMOKE; - p.pos = pos; - p.vel = vel + random_dir()*50.0f; - p.life_span = 0.5f + frandom()*0.5f; - p.start_size = 24.0f + frandom()*12; - p.end_size = 0; - p.friction = 0.7f; - p.gravity = frandom()*-500.0f; - p.color = vec4(0.75f,0.75f,0.75f,1.0f); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); -} - -void effect_bullettrail(vec2 pos) -{ - if(!add_100hz) - return; - - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_BALL; - p.pos = pos; - p.life_span = 0.25f + frandom()*0.25f; - p.start_size = 8.0f; - p.end_size = 0; - p.friction = 0.7f; - gameclient.particles->add(PARTICLES::GROUP_PROJECTILE_TRAIL, &p); -} - -void effect_playerspawn(vec2 pos) -{ - for(int i = 0; i < 32; i++) - { - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SHELL; - p.pos = pos; - p.vel = random_dir() * (pow(frandom(), 3)*600.0f); - p.life_span = 0.3f + frandom()*0.3f; - p.start_size = 64.0f + frandom()*32; - p.end_size = 0; - p.rot = frandom()*pi*2; - p.rotspeed = frandom(); - p.gravity = frandom()*-400.0f; - p.friction = 0.7f; - p.color = vec4(0xb5/255.0f, 0x50/255.0f, 0xcb/255.0f, 1.0f); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - - } -} - -void effect_playerdeath(vec2 pos, int cid) -{ - vec3 blood_color(1.0f,1.0f,1.0f); - - if(cid >= 0) - { - const SKINS::SKIN *s = gameclient.skins->get(gameclient.clients[cid].skin_id); - if(s) - blood_color = s->blood_color; - } - - for(int i = 0; i < 64; i++) - { - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SPLAT01 + (rand()%3); - p.pos = pos; - p.vel = random_dir() * ((frandom()+0.1f)*900.0f); - p.life_span = 0.3f + frandom()*0.3f; - p.start_size = 24.0f + frandom()*16; - p.end_size = 0; - p.rot = frandom()*pi*2; - p.rotspeed = (frandom()-0.5f) * pi; - p.gravity = 800.0f; - p.friction = 0.8f; - vec3 c = blood_color * (0.75f + frandom()*0.25f); - p.color = vec4(c.r, c.g, c.b, 0.75f); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - } -} - - -void effect_explosion(vec2 pos) -{ - // add to flow - for(int y = -8; y <= 8; y++) - for(int x = -8; x <= 8; x++) - { - if(x == 0 && y == 0) - continue; - - float a = 1 - (length(vec2(x,y)) / length(vec2(8,8))); - gameclient.flow->add(pos+vec2(x,y)*16, normalize(vec2(x,y))*5000.0f*a, 10.0f); - } - - // add the explosion - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_EXPL01; - p.pos = pos; - p.life_span = 0.4f; - p.start_size = 150.0f; - p.end_size = 0; - p.rot = frandom()*pi*2; - gameclient.particles->add(PARTICLES::GROUP_EXPLOSIONS, &p); - - // add the smoke - for(int i = 0; i < 24; i++) - { - PARTICLE p; - p.set_default(); - p.spr = SPRITE_PART_SMOKE; - p.pos = pos; - p.vel = random_dir() * ((1.0f + frandom()*0.2f) * 1000.0f); - p.life_span = 0.5f + frandom()*0.4f; - p.start_size = 32.0f + frandom()*8; - p.end_size = 0; - p.gravity = frandom()*-800.0f; - p.friction = 0.4f; - p.color = mix(vec4(0.75f,0.75f,0.75f,1.0f), vec4(0.5f,0.5f,0.5f,1.0f), frandom()); - gameclient.particles->add(PARTICLES::GROUP_GENERAL, &p); - } -} - -void effects_update() -{ - static int64 last_update_100hz = 0; - static int64 last_update_50hz = 0; - - if(time_get()-last_update_100hz > time_freq()/100) - { - add_100hz = true; - last_update_100hz = time_get(); - } - else - add_100hz = false; - - if(time_get()-last_update_50hz > time_freq()/100) - { - add_50hz = true; - last_update_50hz = time_get(); - } - else - add_50hz = false; - - if(add_50hz) - gameclient.flow->update(); -} diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index df808a67..11c2cc85 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -187,132 +187,6 @@ extern "C" void modc_message(int msgtype) } gameclient.on_message(msgtype); - -#if 0 - // normal - void *rawmsg = netmsg_secure_unpack(msgtype); - if(!rawmsg) - { - dbg_msg("client", "dropped weird message '%s' (%d), failed on '%s'", netmsg_get_name(msgtype), msgtype, netmsg_failed_on()); - return; - } - - - if(msgtype == NETMSGTYPE_SV_CHAT) - { - - } - else if(msgtype == NETMSGTYPE_SV_BROADCAST) - { - /* - NETMSG_SV_BROADCAST *msg = (NETMSG_SV_BROADCAST *)rawmsg; - str_copy(broadcast_text, msg->message, sizeof(broadcast_text)); - broadcast_time = time_get()+time_freq()*10; - */ - } - else if(msgtype == NETMSGTYPE_SV_MOTD) - { - /* - NETMSG_SV_MOTD *msg = (NETMSG_SV_MOTD *)rawmsg; - - // process escaping - str_copy(server_motd, msg->message, sizeof(server_motd)); - for(int i = 0; server_motd[i]; i++) - { - if(server_motd[i] == '\\') - { - if(server_motd[i+1] == 'n') - { - server_motd[i] = ' '; - server_motd[i+1] = '\n'; - i++; - } - } - } - - if(server_motd[0] && config.cl_motd_time) - server_motd_time = time_get()+time_freq()*config.cl_motd_time; - else - server_motd_time = 0; - */ - } - 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); - str_copy(gameclient.clients[msg->cid].skin_name, msg->skin, 64); - - // make sure that we don't set a special skin on the client - if(gameclient.clients[msg->cid].skin_name[0] == 'x' || gameclient.clients[msg->cid].skin_name[1] == '_') - str_copy(gameclient.clients[msg->cid].skin_name, "default", 64); - - gameclient.clients[msg->cid].skin_info.color_body = gameclient.skins->get_color(msg->color_body); - gameclient.clients[msg->cid].skin_info.color_feet = gameclient.skins->get_color(msg->color_feet); - gameclient.clients[msg->cid].skin_info.size = 64; - - // find new skin - gameclient.clients[msg->cid].skin_id = gameclient.skins->find(gameclient.clients[msg->cid].skin_name); - if(gameclient.clients[msg->cid].skin_id < 0) - gameclient.clients[msg->cid].skin_id = 0; - - if(msg->use_custom_color) - gameclient.clients[msg->cid].skin_info.texture = gameclient.skins->get(gameclient.clients[msg->cid].skin_id)->color_texture; - else - { - gameclient.clients[msg->cid].skin_info.texture = gameclient.skins->get(gameclient.clients[msg->cid].skin_id)->org_texture; - gameclient.clients[msg->cid].skin_info.color_body = vec4(1,1,1,1); - gameclient.clients[msg->cid].skin_info.color_feet = vec4(1,1,1,1); - } - - gameclient.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_KILLMSG) - { - /* - NETMSG_SV_KILLMSG *msg = (NETMSG_SV_KILLMSG *)rawmsg; - - gameclient.killmsgs.handle_message((NETMSG_SV_KILLMSG *)rawmsg); - - // unpack messages - KILLMSG kill; - kill.killer = msg->killer; - kill.victim = msg->victim; - kill.weapon = msg->weapon; - kill.mode_special = msg->mode_special; - kill.tick = client_tick(); - - // add the message - killmsg_current = (killmsg_current+1)%killmsg_max; - killmsgs[killmsg_current] = kill;*/ - } - else if (msgtype == NETMSGTYPE_SV_EMOTICON) - { - NETMSG_SV_EMOTICON *msg = (NETMSG_SV_EMOTICON *)rawmsg; - - // apply - gameclient.clients[msg->cid].emoticon = msg->emoticon; - gameclient.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)); - } - -#endif } extern "C" void modc_connected() |