about summary refs log tree commit diff
path: root/src/game
diff options
context:
space:
mode:
authorJakob Fries <jakob.fries@gmail.com>2007-08-15 00:20:04 +0000
committerJakob Fries <jakob.fries@gmail.com>2007-08-15 00:20:04 +0000
commitb00ab37df6b1bd81288dac737d35cd90268775cf (patch)
tree953b6b3a24a27cc68ee7a5852838b7dc0a3b2704 /src/game
parent031743f5fb9f373d9a733349abeb91ea7b77b773 (diff)
downloadzcatch-b00ab37df6b1bd81288dac737d35cd90268775cf.tar.gz
zcatch-b00ab37df6b1bd81288dac737d35cd90268775cf.zip
emoticons now wiggle funny when they appear
Diffstat (limited to 'src/game')
-rw-r--r--src/game/client/game_client.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp
index 10716426..00004a98 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();
 	}
 }