Skip to content

Commit

Permalink
added new emoticons. Closes teeworlds#362
Browse files Browse the repository at this point in the history
  • Loading branch information
oy committed Feb 16, 2011
1 parent b59c710 commit 927954a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
Binary file modified data/emoticons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions datasrc/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,17 @@ def FileList(format, num):
container.sprites.Add(Sprite("hearts", set_emoticons, 2, 0, 1, 1))
container.sprites.Add(Sprite("drop", set_emoticons, 3, 0, 1, 1))
container.sprites.Add(Sprite("dotdot", set_emoticons, 0, 1, 1, 1))
container.sprites.Add(Sprite("music1", set_emoticons, 1, 1, 1, 1))
container.sprites.Add(Sprite("music2", set_emoticons, 2, 1, 1, 1))
container.sprites.Add(Sprite("music", set_emoticons, 1, 1, 1, 1))
container.sprites.Add(Sprite("sorry", set_emoticons, 2, 1, 1, 1))
container.sprites.Add(Sprite("ghost", set_emoticons, 3, 1, 1, 1))
container.sprites.Add(Sprite("sushi", set_emoticons, 0, 2, 1, 1))
container.sprites.Add(Sprite("splattee", set_emoticons, 1, 2, 1, 1))
container.sprites.Add(Sprite("deviltee", set_emoticons, 2, 2, 1, 1))
container.sprites.Add(Sprite("zomg", set_emoticons, 3, 2, 1, 1))
container.sprites.Add(Sprite("zzz", set_emoticons, 0, 3, 1, 1))
container.sprites.Add(Sprite("blank1", set_emoticons, 1, 3, 1, 1))
container.sprites.Add(Sprite("deadtee", set_emoticons, 2, 3, 1, 1))
container.sprites.Add(Sprite("blank2", set_emoticons, 3, 3, 1, 1))
container.sprites.Add(Sprite("wtf", set_emoticons, 1, 3, 1, 1))
container.sprites.Add(Sprite("eyes", set_emoticons, 2, 3, 1, 1))
container.sprites.Add(Sprite("question", set_emoticons, 3, 3, 1, 1))

container.sprites.Add(Sprite("browse_lock", set_browseicons, 0,0,1,1))
container.sprites.Add(Sprite("browse_heart", set_browseicons, 1,0,1,1))
Expand Down
2 changes: 1 addition & 1 deletion datasrc/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
PlayerStates = ["UNKNOWN", "PLAYING", "IN_MENU", "CHATTING"]
GameFlags = ["TEAMS", "FLAGS"]

Emoticons = [str(x) for x in range(1,16)]
Emoticons = [str(x) for x in range(0,16)]

Powerups = ["HEALTH", "ARMOR", "WEAPON", "NINJA"]

Expand Down
15 changes: 4 additions & 11 deletions src/game/client/components/emoticon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <game/generated/client_data.h>

#include <game/gamecore.h> // get_angle
#include <game/client/gameclient.h>
#include <game/client/ui.h>
#include <game/client/render.h>
#include "emoticon.h"
Expand Down Expand Up @@ -104,12 +103,6 @@ void CEmoticon::OnRender()

m_WasActive = true;

float x, y;
Input()->MouseRelative(&x, &y);

m_SelectorMouse.x += x;
m_SelectorMouse.y += y;

if (length(m_SelectorMouse) > 140)
m_SelectorMouse = normalize(m_SelectorMouse) * 140;

Expand All @@ -118,7 +111,7 @@ void CEmoticon::OnRender()
SelectedAngle += 2*pi;

if (length(m_SelectorMouse) > 100)
m_SelectedEmote = (int)(SelectedAngle / (2*pi) * 12.0f);
m_SelectedEmote = (int)(SelectedAngle / (2*pi) * NUM_EMOTICONS);

CUIRect Screen = *UI()->Screen();

Expand All @@ -135,15 +128,15 @@ void CEmoticon::OnRender()
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_EMOTICONS].m_Id);
Graphics()->QuadsBegin();

for (int i = 0; i < 12; i++)
for (int i = 0; i < NUM_EMOTICONS; i++)
{
float Angle = 2*pi*i/12.0;
float Angle = 2*pi*i/NUM_EMOTICONS;
if (Angle > pi)
Angle -= 2*pi;

bool Selected = m_SelectedEmote == i;

float Size = Selected ? 96 : 64;
float Size = Selected ? 80 : 32;

float NudgeX = 120 * cosf(Angle);
float NudgeY = 120 * sinf(Angle);
Expand Down

0 comments on commit 927954a

Please sign in to comment.