emoticons now wiggle funny when they appear

This commit is contained in:
Jakob Fries 2007-08-15 00:20:04 +00:00
parent 031743f5fb
commit b00ab37df6

View file

@ -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();
}
}