Chat bubble.

This commit is contained in:
Joel de Vahl 2007-07-26 11:33:49 +00:00
parent f946cc6f5f
commit 30a027a0da
5 changed files with 43 additions and 2 deletions

View file

@ -181,6 +181,10 @@ images {
cloud_3 {
filename "data/cloud-3.png"
}
chat_bubbles {
filename "data/chatbubbles.png"
}
}
particles {
@ -525,6 +529,10 @@ sprites {
tee_eye_normal 10 2 1 1
}
chatbubbles images.chat_bubbles 4 4 {
chat_dotdot 0 1 1 1
}
}
animations {

View file

@ -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);

View file

@ -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;

View file

@ -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];

View file

@ -243,6 +243,7 @@ public:
int score;
int team;
int state;
bool dead;
int die_tick;