1

Topic: (minor) Suggestions for Emoticons and winning

I have been 'playing' with the TW source for the last couple of days to try and learn about it (and C++) and I noticed the section of the code  that gets triggered when a tee is killed, part of it makes the winning tee look happy.
This could maybe be replicated in the code for handling winning/loosing, the winning tee or team could be happy and the other team could be sad or angry, a lot like the Worms games, which have different animations for different situations.

Another thought is that emoticons could become the tees facial expressions, this has problems though as it would make emoticons much less obvious. This is sort of related to, and could be integrated with having more animated tees (there was a thread about it a while ago, but I can't find it!).

Hope someone thinks this is useful!

===I take pride in my insanity!===    |    Blender3D    |    What do you think of my post? Rate it!
Admin@SuperSiliconux128:~$quantumphysics --help -mtheory -standardmodel
[quantum_physics]: segmentation fault, core dumped

2 (edited by vandal 2009-04-27 15:56:20)

Re: (minor) Suggestions for Emoticons and winning

its not usefull, just details. Not needed, it's better to spend nights on fixing bugs or other important things.

3

Re: (minor) Suggestions for Emoticons and winning

I think would be fine if some make a patch and submit it to the dev

Support Staff - ESL.eu Teeworlds Admin

4

Re: (minor) Suggestions for Emoticons and winning

Useful? No.. But it can make graphic page of TeeWorlds better. Its having the same priority like this

Goodbye all. Account inactive since March 2011.

5 (edited by Random Tee 2009-04-27 18:46:37)

Re: (minor) Suggestions for Emoticons and winning

How would I go about submitting a patch?

I can code (a bit!) in C++ and I've altered and compiled the TW code, how can I send in my changes in a useful manner?

Thanks for your help!

P.S. Is there any reason that the last 4 emote slots are disabled? I've just activated them in my test client and it works perfectly as far as I can tell, have I missed something?

Randomness: Why is one of the emotes refered to as 'sushi', it doesn't look anything like it!

===I take pride in my insanity!===    |    Blender3D    |    What do you think of my post? Rate it!
Admin@SuperSiliconux128:~$quantumphysics --help -mtheory -standardmodel
[quantum_physics]: segmentation fault, core dumped

6

Re: (minor) Suggestions for Emoticons and winning

You compiled in bam release? Send us the src and exe files smile

Bye.

7

Re: (minor) Suggestions for Emoticons and winning

-.-
theres no point. its only good if everyone can see it

8 (edited by Random Tee 2009-04-30 07:53:54)

Re: (minor) Suggestions for Emoticons and winning

Here's the patch for the 0.5.1 source to add three extra emotes to the client gui and make tees happy/sad on winning/loosing!
Just copy the text below and save it in tw_emotes.patch.

Binary files clean/data/emoticons.png and test_emotes/data/emoticons.png differ
Binary files clean/datasrc/content.pyc and test_emotes/datasrc/content.pyc differ
Binary files clean/datasrc/datatypes.pyc and test_emotes/datasrc/datatypes.pyc differ
Binary files clean/datasrc/network.pyc and test_emotes/datasrc/network.pyc differ
diff -Nruw clean/src/game/client/components/emoticon.cpp test_emotes/src/game/client/components/emoticon.cpp
--- clean/src/game/client/components/emoticon.cpp    2009-01-25 13:50:33.000000000 +0000
+++ test_emotes/src/game/client/components/emoticon.cpp    2009-04-27 18:31:57.000000000 +0100
@@ -100,12 +100,12 @@
     if (length(selector_mouse) > 140)
         selector_mouse = normalize(selector_mouse) * 140;
 
-    float selected_angle = get_angle(selector_mouse) + 2*pi/24;
+    float selected_angle = get_angle(selector_mouse) + 2*pi/30;
     if (selected_angle < 0)
         selected_angle += 2*pi;
 
     if (length(selector_mouse) > 100)
-        selected_emote = (int)(selected_angle / (2*pi) * 12.0f);
+        selected_emote = (int)(selected_angle / (2*pi) * 15.0f);
 
     RECT screen = *ui_screen();
 
@@ -122,9 +122,9 @@
     gfx_texture_set(data->images[IMAGE_EMOTICONS].id);
     gfx_quads_begin();
 
-    for (int i = 0; i < 12; i++)
+    for (int i = 0; i < 15; i++)
     {
-        float angle = 2*pi*i/12.0;
+        float angle = 2*pi*i/15.0;
         if (angle > pi)
             angle -= 2*pi;
 
diff -Nruw clean/src/game/server/entities/character.cpp test_emotes/src/game/server/entities/character.cpp
--- clean/src/game/server/entities/character.cpp    2009-01-25 13:50:33.000000000 +0000
+++ test_emotes/src/game/server/entities/character.cpp    2009-04-29 07:32:09.000000000 +0100
@@ -426,7 +426,6 @@
         } break;
         
     }
-
     if(weapons[active_weapon].ammo > 0) // -1 == unlimited
         weapons[active_weapon].ammo--;
     attack_tick = server_tick();
@@ -485,7 +484,7 @@
             if ((server_tick() - weapons[active_weapon].ammoregenstart) >= ammoregentime * server_tickspeed() / 1000)
             {
                 // Add some ammo
-                weapons[active_weapon].ammo = min(weapons[active_weapon].ammo + 1, 10);
+                weapons[active_weapon].ammo = min(weapons[active_weapon].ammo + 1, data->weapons.id[active_weapon].maxammo);
                 weapons[active_weapon].ammoregenstart = -1;
             }
         }
diff -Nruw clean/src/game/server/gamecontroller.cpp test_emotes/src/game/server/gamecontroller.cpp
--- clean/src/game/server/gamecontroller.cpp    2009-01-25 13:50:33.000000000 +0000
+++ test_emotes/src/game/server/gamecontroller.cpp    2009-04-28 18:17:51.000000000 +0100
@@ -155,11 +155,59 @@
     return false;
 }
 
-void GAMECONTROLLER::endround()
+void GAMECONTROLLER::endround(int topscore=0)
 {
     if(warmup) // game can't end when we are running warmup
         return;
         
+    // make winners look happy and loosers look angry!
+    if(is_teamplay())
+    {
+        // check who won
+        if(teamscore[0]<teamscore[1])
+        {
+            //blue wins
+            topscore=1;
+        }else{
+            //red wins
+            topscore=0;
+        }
+        // do emotes here
+        for(int i = 0; i < MAX_CLIENTS; i++){
+            if (game.players[i]){
+            CHARACTER *chr = game.players[i]->get_character();
+                if(chr){
+                    if (game.players[i]->team==topscore){
+                        //winner
+                        chr->emote_type = EMOTE_HAPPY;
+                        chr->emote_stop = server_tick()*2 + server_tickspeed();
+                    }else{
+                        //looser
+                        chr->emote_type = EMOTE_ANGRY;
+                        chr->emote_stop = server_tick()*2 + server_tickspeed();
+                    }
+                }
+            }
+        }
+    }else{
+        for(int i = 0; i < MAX_CLIENTS; i++){
+            if (game.players[i]){
+                CHARACTER *chr = game.players[i]->get_character();
+                if(chr){
+                    if (game.players[i]->score==topscore){
+                        //winner
+                        chr->emote_type = EMOTE_HAPPY;
+                        chr->emote_stop = server_tick()*2 + server_tickspeed();
+                    }else{
+                        //looser
+                        chr->emote_type = EMOTE_ANGRY;
+                        chr->emote_stop = server_tick()*2 + server_tickspeed();
+                    }
+                }
+            }
+        }
+    }
+    
     game.world.paused = true;
     game_over_tick = server_tick();
     sudden_death = 0;
@@ -636,7 +684,7 @@
             (config.sv_timelimit > 0 && (server_tick()-round_start_tick) >= config.sv_timelimit*server_tickspeed()*60))
         {
             if(topscore_count == 1)
-                endround();
+                endround(topscore);
             else
                 sudden_death = 1;
         }
@@ -652,7 +700,7 @@
             (config.sv_timelimit > 0 && (server_tick()-round_start_tick) >= config.sv_timelimit*server_tickspeed()*60))
         {
             if(teamscore[0] != teamscore[1])
-                endround();
+                endround(0);
             else
                 sudden_death = 1;
         }
diff -Nruw clean/src/game/server/gamecontroller.hpp test_emotes/src/game/server/gamecontroller.hpp
--- clean/src/game/server/gamecontroller.hpp    2009-01-25 13:50:33.000000000 +0000
+++ test_emotes/src/game/server/gamecontroller.hpp    2009-04-28 07:37:28.000000000 +0100
@@ -65,7 +65,7 @@
     void do_warmup(int seconds);
     
     void startround();
-    void endround();
+    void endround(int topscore);
     void change_map(const char *to_map);
     
     bool is_friendly_fire(int cid1, int cid2);

Then  (on Unix/Linux) from the directory containing the TW source and with the .patch in the directory above do:

patch -p1 -l<../tw_emotes.patch

then (re-)compile the source.

The extra emotes are in the client while the happy/sad tees are in the server  code.

This was the best way I could find for people to use it, I hope no one minds the long post!
Also, I hope it will be amusing for someone!

wink

EDIT:patch updated to work properly! I made a silly mistake, oops! >.<
Hmmm... There's a problem here, I'm just trying to sort it out. Hopefully fixed later!
It's fixed, I tested it, you have to use the -l option with patch, uploading the text to the forum garbled the tabbing, -l ignores this. Happy patching!

===I take pride in my insanity!===    |    Blender3D    |    What do you think of my post? Rate it!
Admin@SuperSiliconux128:~$quantumphysics --help -mtheory -standardmodel
[quantum_physics]: segmentation fault, core dumped

9

Re: (minor) Suggestions for Emoticons and winning

3 out of 3 hunks failed - Attempt on Windows

Bye.