From b00ab37df6b1bd81288dac737d35cd90268775cf Mon Sep 17 00:00:00 2001 From: Jakob Fries Date: Wed, 15 Aug 2007 00:20:04 +0000 Subject: [PATCH] emoticons now wiggle funny when they appear --- src/game/client/game_client.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index 10716426d..00004a982 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -1260,22 +1260,30 @@ static void render_player(const obj_player *prev, const obj_player *player) gfx_texture_set(data->images[IMAGE_EMOTICONS].id); gfx_quads_begin(); - float a; - int since_start = client_tick() - client_datas[player->clientid].emoticon_start; int from_end = client_datas[player->clientid].emoticon_start + 2 * client_tickspeed() - client_tick(); - if (since_start < client_tickspeed() / 5) - a = since_start / (client_tickspeed() / 5.0); - else if (from_end < client_tickspeed() / 5) + float a = 1; + + if (from_end < client_tickspeed() / 5) a = from_end / (client_tickspeed() / 5.0); - else - a = 1; + + float h = 1; + if (since_start < client_tickspeed() / 10) + h = since_start / (client_tickspeed() / 10.0); + + float wiggle = 0; + if (since_start < client_tickspeed() / 5) + wiggle = since_start / (client_tickspeed() / 5.0); + + float wiggle_angle = sin(5*wiggle); + + gfx_quads_setrotation(pi/6*wiggle_angle); gfx_quads_setcolor(1.0f,1.0f,1.0f,a); // client_datas::emoticon is an offset from the first emoticon select_sprite(SPRITE_OOP + client_datas[player->clientid].emoticon); - gfx_quads_draw(position.x, position.y - 55, 64, 64); + gfx_quads_draw(position.x, position.y - 23 - 32*h, 64, 64*h); gfx_quads_end(); } }