mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-02 23:32:09 +00:00
[qw] Get chat info flag mostly working again
Currently does only chat (not afk), but the whole thing needs work anyway (billboarded world-space canvas or similar).
This commit is contained in:
parent
f36fa23666
commit
ca23065b90
3 changed files with 52 additions and 25 deletions
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include "qw/protocol.h"
|
#include "qw/protocol.h"
|
||||||
|
|
||||||
|
void CL_OnFocusChange (void (*func) (int game));
|
||||||
|
|
||||||
void CL_Input_Activate (void);
|
void CL_Input_Activate (void);
|
||||||
void CL_Input_Init (void);
|
void CL_Input_Init (void);
|
||||||
void CL_Input_Init_Cvars (void);
|
void CL_Input_Init_Cvars (void);
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
|
|
||||||
#include "qw/include/client.h"
|
#include "qw/include/client.h"
|
||||||
#include "qw/include/cl_chat.h"
|
#include "qw/include/cl_chat.h"
|
||||||
|
#include "qw/include/cl_input.h"
|
||||||
|
|
||||||
llist_t *ignore_list, *dead_ignore_list;
|
llist_t *ignore_list, *dead_ignore_list;
|
||||||
|
|
||||||
|
@ -237,7 +238,7 @@ CL_Chat_Flush_Ignores (void)
|
||||||
{
|
{
|
||||||
llist_flush (ignore_list);
|
llist_flush (ignore_list);
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
static void
|
static void
|
||||||
CL_ChatInfo (int val)
|
CL_ChatInfo (int val)
|
||||||
{
|
{
|
||||||
|
@ -250,25 +251,12 @@ CL_ChatInfo (int val)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cl_chat_keydest (keydest_t keydest, void *data)
|
cl_chat_on_focus_change (int game)
|
||||||
{
|
{
|
||||||
switch (keydest) {
|
//FIXME afk mode
|
||||||
case key_game:
|
CL_ChatInfo (!!game);
|
||||||
case key_demo:
|
|
||||||
CL_ChatInfo (0);
|
|
||||||
break;
|
|
||||||
case key_message:
|
|
||||||
CL_ChatInfo (1);
|
|
||||||
break;
|
|
||||||
case key_console:
|
|
||||||
case key_menu:
|
|
||||||
case key_unfocused:
|
|
||||||
case key_last: // should not happen
|
|
||||||
CL_ChatInfo (2);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_Chat_Init (void)
|
CL_Chat_Init (void)
|
||||||
|
@ -278,5 +266,5 @@ CL_Chat_Init (void)
|
||||||
|
|
||||||
Cmd_AddCommand ("ignore", CL_Ignore_f, "Ignores chat and name-change messages from a user.");
|
Cmd_AddCommand ("ignore", CL_Ignore_f, "Ignores chat and name-change messages from a user.");
|
||||||
Cmd_AddCommand ("unignore", CL_Unignore_f, "Removes a previously ignored user from the ignore list.");
|
Cmd_AddCommand ("unignore", CL_Unignore_f, "Removes a previously ignored user from the ignore list.");
|
||||||
//Key_KeydestCallback (cl_chat_keydest, 0);
|
CL_OnFocusChange (cl_chat_on_focus_change);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "QF/input.h"
|
#include "QF/input.h"
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
|
#include "QF/listener.h"
|
||||||
#include "QF/msg.h"
|
#include "QF/msg.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/teamplay.h"
|
#include "QF/teamplay.h"
|
||||||
|
@ -66,6 +67,8 @@
|
||||||
int cl_game_context;
|
int cl_game_context;
|
||||||
int cl_demo_context;
|
int cl_demo_context;
|
||||||
static int cl_event_id;
|
static int cl_event_id;
|
||||||
|
static struct LISTENER_SET_TYPE(int) cl_on_focus_change
|
||||||
|
= LISTENER_SET_STATIC_INIT(4);
|
||||||
|
|
||||||
cvar_t *cl_nodelta;
|
cvar_t *cl_nodelta;
|
||||||
cvar_t *cl_maxnetfps;
|
cvar_t *cl_maxnetfps;
|
||||||
|
@ -562,16 +565,50 @@ CL_SendCmd (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cl_event_handler (const IE_event_t *ie_event, void *unused)
|
cl_key_event (const IE_event_t *ie_event)
|
||||||
{
|
{
|
||||||
if (ie_event->type == ie_key) {
|
|
||||||
if (ie_event->key.code == QFK_ESCAPE) {
|
if (ie_event->key.code == QFK_ESCAPE) {
|
||||||
Con_SetState (con_menu);
|
Con_SetState (con_menu);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cl_on_focus_change_redirect (void *_func, const int *game)
|
||||||
|
{
|
||||||
|
void (*func) (int game) = _func;
|
||||||
|
func (*game);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CL_OnFocusChange (void (*func) (int game))
|
||||||
|
{
|
||||||
|
LISTENER_ADD (&cl_on_focus_change, cl_on_focus_change_redirect, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cl_focus_event (const IE_event_t *ie_event)
|
||||||
|
{
|
||||||
|
int game = ie_event->type == ie_gain_focus;
|
||||||
|
LISTENER_INVOKE (&cl_on_focus_change, &game);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cl_event_handler (const IE_event_t *ie_event, void *unused)
|
||||||
|
{
|
||||||
|
static int (*handlers[ie_event_count]) (const IE_event_t *ie_event) = {
|
||||||
|
[ie_key] = cl_key_event,
|
||||||
|
[ie_gain_focus] = cl_focus_event,
|
||||||
|
[ie_lose_focus] = cl_focus_event,
|
||||||
|
};
|
||||||
|
if (ie_event->type < 0 || ie_event->type >= ie_event_count
|
||||||
|
|| !handlers[ie_event->type]) {
|
||||||
return IN_Binding_HandleEvent (ie_event);
|
return IN_Binding_HandleEvent (ie_event);
|
||||||
}
|
}
|
||||||
|
return handlers[ie_event->type] (ie_event);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CL_Input_Init (void)
|
CL_Input_Init (void)
|
||||||
|
|
Loading…
Reference in a new issue