diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-10 19:36:05 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-03-10 19:36:05 +0000 |
| commit | e7241d743cbd73b2950ce73daba35491a47735ea (patch) | |
| tree | b479fdb0380557909f791052fb094ad336318610 /src | |
| parent | 3f3e1715114c8f1af1b4128afac0b0699870ae68 (diff) | |
| download | zcatch-e7241d743cbd73b2950ce73daba35491a47735ea.tar.gz zcatch-e7241d743cbd73b2950ce73daba35491a47735ea.zip | |
fixed the ninja rendering
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/client/gc_client.h | 1 | ||||
| -rw-r--r-- | src/game/client/gc_effects.cpp | 21 | ||||
| -rw-r--r-- | src/game/client/gc_hooks.cpp | 8 | ||||
| -rw-r--r-- | src/game/client/gc_menu.cpp | 5 | ||||
| -rw-r--r-- | src/game/client/gc_render_obj.cpp | 26 |
5 files changed, 55 insertions, 6 deletions
diff --git a/src/game/client/gc_client.h b/src/game/client/gc_client.h index 48313765..5c89dc61 100644 --- a/src/game/client/gc_client.h +++ b/src/game/client/gc_client.h @@ -146,6 +146,7 @@ void effect_air_jump(vec2 pos); void effect_damage_indicator(vec2 pos, vec2 dir); void effect_playerspawn(vec2 pos); void effect_playerdeath(vec2 pos); +void effect_powerupshine(vec2 pos, vec2 size); // particles struct particle diff --git a/src/game/client/gc_effects.cpp b/src/game/client/gc_effects.cpp index 6394075e..fcf7ac93 100644 --- a/src/game/client/gc_effects.cpp +++ b/src/game/client/gc_effects.cpp @@ -25,6 +25,27 @@ void effect_air_jump(vec2 pos) particle_add(PARTGROUP_GENERAL, &p); } +void effect_powerupshine(vec2 pos, vec2 size) +{ + if(!add_trail) + 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; + particle_add(PARTGROUP_GENERAL, &p); +} + void effect_smoketrail(vec2 pos, vec2 vel) { if(!add_trail) diff --git a/src/game/client/gc_hooks.cpp b/src/game/client/gc_hooks.cpp index e1644f36..7d2e1546 100644 --- a/src/game/client/gc_hooks.cpp +++ b/src/game/client/gc_hooks.cpp @@ -506,8 +506,12 @@ extern "C" void modc_message(int msg) if(msg_unpack_error() || cid < 0 || cid >= MAX_CLIENTS) return; - strncpy(client_datas[cid].name, name, 64); - strncpy(client_datas[cid].skin_name, skinname, 64); + str_copy(client_datas[cid].name, name, 64); + str_copy(client_datas[cid].skin_name, skinname, 64); + + // make sure that we don't set a special skin on the client + if(client_datas[cid].skin_name[0] == 'x' || client_datas[cid].skin_name[1] == '_') + str_copy(client_datas[cid].skin_name, "default", 64); int use_custom_color = msg_unpack_int(); client_datas[cid].skin_info.color_body = skin_get_color(msg_unpack_int()); diff --git a/src/game/client/gc_menu.cpp b/src/game/client/gc_menu.cpp index d4b45eff..cc6363f7 100644 --- a/src/game/client/gc_menu.cpp +++ b/src/game/client/gc_menu.cpp @@ -1258,6 +1258,11 @@ static void menu2_render_settings_player(RECT main_view) for(int i = start; i < start+num && i < skin_num(); i++) { const skin *s = skin_get(i); + + // no special skins + if(s->name[0] == 'x' && s->name[1] == '_') + continue; + char buf[128]; str_format(buf, sizeof(buf), "%s", s->name); int selected = 0; diff --git a/src/game/client/gc_render_obj.cpp b/src/game/client/gc_render_obj.cpp index 995994ed..73f58a85 100644 --- a/src/game/client/gc_render_obj.cpp +++ b/src/game/client/gc_render_obj.cpp @@ -9,6 +9,7 @@ #include "gc_render.h" #include "gc_anim.h" #include "gc_client.h" +#include "gc_skin.h" void render_projectile(const NETOBJ_PROJECTILE *current, int itemid) @@ -89,10 +90,7 @@ void render_powerup(const NETOBJ_POWERUP *prev, const NETOBJ_POWERUP *current) if(c[current->type] == SPRITE_POWERUP_NINJA) { - /* - proj_particles.addparticle(0, 0, - pos+vec2((frandom()-0.5f)*80.0f, (frandom()-0.5f)*20.0f), - vec2((frandom()-0.5f)*10.0f, (frandom()-0.5f)*10.0f));*/ + effect_powerupshine(pos, vec2(96,18)); size *= 2.0f; pos.x += 10.0f; } @@ -261,6 +259,10 @@ void render_player( float intratick = client_intratick(); float ticktime = client_ticktime(); + + bool is_teamplay = false; + if(netobjects.gameobj && netobjects.gameobj->gametype != GAMETYPE_DM) + is_teamplay = true; if(player.health < 0) // dont render dead players return; @@ -396,6 +398,20 @@ void render_player( } else if (player.weapon == WEAPON_NINJA) { + // change the skin for the player to the ninja + int skin = skin_find("x_ninja"); + if(skin != -1) + { + if(is_teamplay) + render_info.texture = skin_get(skin)->color_texture; + else + { + render_info.texture = skin_get(skin)->org_texture; + render_info.color_body = vec4(1,1,1,1); + render_info.color_feet = vec4(1,1,1,1); + } + } + p = position; p.y += data->weapons[iw].offsety; @@ -403,10 +419,12 @@ void render_player( { gfx_quads_setrotation(-pi/2-state.attach.angle*pi*2); p.x -= data->weapons[iw].offsetx; + effect_powerupshine(p+vec2(32,0), vec2(32,12)); } else { gfx_quads_setrotation(-pi/2+state.attach.angle*pi*2); + effect_powerupshine(p-vec2(32,0), vec2(32,12)); } draw_sprite(p.x, p.y, data->weapons[iw].visual_size); |