mirror of https://github.com/OpenRCT2/OpenRCT2.git
Remove need of SDL in chat.c
This commit is contained in:
parent
a9e5a58d28
commit
9cd8fd1498
|
@ -1419,6 +1419,22 @@ static void input_handle_console(sint32 key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void input_handle_chat(sint32 key)
|
||||||
|
{
|
||||||
|
CHAT_INPUT input = CHAT_INPUT_NONE;
|
||||||
|
switch (key) {
|
||||||
|
case SDL_SCANCODE_ESCAPE:
|
||||||
|
input = CHAT_INPUT_CLOSE;
|
||||||
|
break;
|
||||||
|
case SDL_SCANCODE_RETURN:
|
||||||
|
input = CHAT_INPUT_SEND;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (input != CHAT_INPUT_NONE) {
|
||||||
|
chat_input(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x006E3B43
|
* rct2: 0x006E3B43
|
||||||
|
@ -1540,7 +1556,7 @@ void game_handle_keyboard_input()
|
||||||
input_handle_console(key);
|
input_handle_console(key);
|
||||||
continue;
|
continue;
|
||||||
} else if (gChatOpen) {
|
} else if (gChatOpen) {
|
||||||
chat_input(key);
|
input_handle_chat(key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,19 +215,21 @@ void chat_history_add(const char * src)
|
||||||
Mixer_Play_Effect(SOUND_NEWS_ITEM, 0, SDL_MIX_MAXVOLUME, 0, 1.5f, true);
|
Mixer_Play_Effect(SOUND_NEWS_ITEM, 0, SDL_MIX_MAXVOLUME, 0, 1.5f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void chat_input(sint32 c)
|
void chat_input(CHAT_INPUT input)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (input) {
|
||||||
case SDL_SCANCODE_RETURN:
|
case CHAT_INPUT_SEND:
|
||||||
if (strlen(_chatCurrentLine) > 0) {
|
if (strlen(_chatCurrentLine) > 0) {
|
||||||
network_send_chat(_chatCurrentLine);
|
network_send_chat(_chatCurrentLine);
|
||||||
}
|
}
|
||||||
chat_clear_input();
|
chat_clear_input();
|
||||||
chat_close();
|
chat_close();
|
||||||
return;
|
break;
|
||||||
case SDL_SCANCODE_ESCAPE:
|
case CHAT_INPUT_CLOSE:
|
||||||
chat_close();
|
chat_close();
|
||||||
return;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,13 @@
|
||||||
#define CHAT_MAX_MESSAGE_LENGTH 200
|
#define CHAT_MAX_MESSAGE_LENGTH 200
|
||||||
#define CHAT_MAX_WINDOW_WIDTH 600
|
#define CHAT_MAX_WINDOW_WIDTH 600
|
||||||
|
|
||||||
|
typedef enum CHAT_INPUT
|
||||||
|
{
|
||||||
|
CHAT_INPUT_NONE,
|
||||||
|
CHAT_INPUT_SEND,
|
||||||
|
CHAT_INPUT_CLOSE,
|
||||||
|
} CHAT_INPUT;
|
||||||
|
|
||||||
extern bool gChatOpen;
|
extern bool gChatOpen;
|
||||||
|
|
||||||
void chat_open();
|
void chat_open();
|
||||||
|
@ -36,7 +43,7 @@ void chat_update();
|
||||||
void chat_draw(rct_drawpixelinfo * dpi);
|
void chat_draw(rct_drawpixelinfo * dpi);
|
||||||
|
|
||||||
void chat_history_add(const char *src);
|
void chat_history_add(const char *src);
|
||||||
void chat_input(sint32 c);
|
void chat_input(CHAT_INPUT input);
|
||||||
|
|
||||||
sint32 chat_string_wrapped_get_height(void *args, sint32 width);
|
sint32 chat_string_wrapped_get_height(void *args, sint32 width);
|
||||||
sint32 chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width);
|
sint32 chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width);
|
||||||
|
|
Loading…
Reference in New Issue