diff options
| author | Joel de Vahl <joel@stalverk80.se> | 2007-07-26 11:33:49 +0000 |
|---|---|---|
| committer | Joel de Vahl <joel@stalverk80.se> | 2007-07-26 11:33:49 +0000 |
| commit | 30a027a0dab9e0ef82f23da8a91d7692cb7fad8a (patch) | |
| tree | 63f8f8ef3ab0c6337b0ed96bfb33cfe047e2bc10 /src/game | |
| parent | f946cc6f5ff2f93fb681c960093c5e4525006fd8 (diff) | |
| download | zcatch-30a027a0dab9e0ef82f23da8a91d7692cb7fad8a.tar.gz zcatch-30a027a0dab9e0ef82f23da8a91d7692cb7fad8a.zip | |
Chat bubble.
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/game_client.cpp | 20 | ||||
| -rw-r--r-- | src/game/game.h | 10 | ||||
| -rw-r--r-- | src/game/server/game_server.cpp | 6 | ||||
| -rw-r--r-- | src/game/server/game_server.h | 1 |
4 files changed, 35 insertions, 2 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index 7c4fd047..c500cb70 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -1012,6 +1012,17 @@ static void render_player(obj_player *prev, obj_player *player) // render the tee int skin = gametype == GAMETYPE_TDM ? skinseed + player->team : player->clientid; render_tee(&state, skin, direction, position); + + if(player->state == STATE_CHATTING) + { + + gfx_texture_set(data->images[IMAGE_CHAT_BUBBLES].id); + gfx_quads_begin(); + select_sprite(SPRITE_CHAT_DOTDOT); + gfx_quads_draw(position.x + 24, position.y - 40, 64,64); + gfx_quads_end(); + } + } @@ -1211,9 +1222,14 @@ void modc_render() input.target_x = (int)mouse_pos.x; //(int)(a*256.0f); input.target_y = (int)mouse_pos.y; //(int)(a*256.0f); input.activeweapon = -1; - - if(!chat_active && !menu_active) + + if(chat_active) + input.state = STATE_CHATTING; + else if(menu_active) + input.state = STATE_IN_MENU; + else { + input.state = STATE_PLAYING; input.left = inp_key_pressed(config.key_move_left); input.right = inp_key_pressed(config.key_move_right); input.jump = inp_key_pressed(config.key_jump); diff --git a/src/game/game.h b/src/game/game.h index 81510c93..e2da27dc 100644 --- a/src/game/game.h +++ b/src/game/game.h @@ -62,6 +62,14 @@ enum EMOTE_HAPPY, }; +enum +{ + STATE_UNKNOWN=0, + STATE_PLAYING, + STATE_IN_MENU, + STATE_CHATTING, +}; + struct player_input { int left; @@ -75,6 +83,7 @@ struct player_input int hook; int blink; int activeweapon; + int state; }; @@ -141,6 +150,7 @@ struct obj_player { int local; int clientid; + int state; int health; int armor; diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index 09831ba5..5a08a1d7 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -675,6 +675,7 @@ void player::reset() score = 0; dead = true; die_tick = 0; + state = STATE_UNKNOWN; } void player::destroy() { } @@ -686,6 +687,7 @@ void player::respawn() jumped = 0; dead = false; set_flag(entity::FLAG_ALIVE); + state = STATE_PLAYING; mem_zero(&input, sizeof(input)); vel = vec2(0.0f, 0.0f); @@ -1207,6 +1209,8 @@ void player::tick() defered_pos = pos; move_box(&defered_pos, &vel, vec2(phys_size, phys_size), 0); } + + state = input.state; // Previnput previnput = input; @@ -1353,6 +1357,8 @@ void player::snap(int snaping_client) player->score = score; player->team = team; + + player->state = state; } player players[MAX_CLIENTS]; diff --git a/src/game/server/game_server.h b/src/game/server/game_server.h index d234bb13..650d5c84 100644 --- a/src/game/server/game_server.h +++ b/src/game/server/game_server.h @@ -243,6 +243,7 @@ public: int score; int team; + int state; bool dead; int die_tick; |