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!
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