Merge remote-tracking branch 'origin/Saturn-Next' into lugstuff
This commit is contained in:
commit
8c115ddf1d
5 files changed
+60
-27
No files matched your search
+26
-1
@@ -33,6 +33,8 @@
|
||||
#include "d_main.h"
|
||||
#include "m_menu.h"
|
||||
#include "m_textinput.h"
|
||||
#include "m_emotes.h"
|
||||
#include "i_time.h"
|
||||
#include "filesrch.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
@@ -1453,7 +1455,18 @@ static void CON_DrawHudlines(void)
|
||||
}
|
||||
if (c >= con_width)
|
||||
break;
|
||||
if (*p < HU_FONTSTART)
|
||||
|
||||
int emotelen;
|
||||
emote_t *emote;
|
||||
|
||||
if ((emote = M_VerifyEmote((const char *)p, &emotelen)))
|
||||
{
|
||||
M_DrawScaledEmote(x<<FRACBITS, (y+2*con_scalefactor)<<FRACBITS, charwidth*FRACUNIT/EMOTEWIDTH, emote, I_GetTime(), V_NOSCALESTART|V_NOSCALEPATCH);
|
||||
p += emotelen-1;
|
||||
c += emotelen-1;
|
||||
continue;
|
||||
}
|
||||
else if (*p < HU_FONTSTART)
|
||||
;//charwidth = 4 * con_scalefactor;
|
||||
else
|
||||
{
|
||||
@@ -1527,8 +1540,20 @@ static void CON_DrawConsole(void)
|
||||
p++;
|
||||
c++;
|
||||
}
|
||||
|
||||
if (c >= con_width)
|
||||
break;
|
||||
|
||||
int emotelen;
|
||||
emote_t *emote;
|
||||
|
||||
if ((emote = M_VerifyEmote((const char *)p, &emotelen)))
|
||||
{
|
||||
M_DrawScaledEmote(x<<FRACBITS, (y+2*con_scalefactor)<<FRACBITS, charwidth*FRACUNIT/EMOTEWIDTH, emote, I_GetTime(), V_NOSCALESTART|V_NOSCALEPATCH);
|
||||
p += emotelen-1;
|
||||
c += emotelen-1;
|
||||
continue;
|
||||
}
|
||||
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
}
|
||||
}
|
||||
|
||||
+20
-12
@@ -1387,9 +1387,9 @@ boolean HU_Responder(event_t *ev)
|
||||
&& ev->data1 != gamecontrol[0][gc_talkkey][1]))
|
||||
return false;
|
||||
|
||||
M_TextInputHandleEmotes(&w_chat, c, &emote_autocomplete);
|
||||
|
||||
if (c == KEY_ENTER)
|
||||
if (M_TextInputHandleEmotes(&w_chat, c, &emote_autocomplete))
|
||||
; // Do nothing
|
||||
else if (c == KEY_ENTER)
|
||||
{
|
||||
chat_on = false;
|
||||
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
|
||||
@@ -1427,6 +1427,7 @@ boolean HU_Responder(event_t *ev)
|
||||
//======================================================================
|
||||
|
||||
#define HU_DrawEmote(x, y, emote, flags) M_DrawEmote((x), (y), (emote), hu_emoteanim, (flags))
|
||||
#define HU_DrawScaledEmote(x, y, scale, emote, flags) M_DrawScaledEmote((x), (y), (scale), (emote), hu_emoteanim, (flags))
|
||||
|
||||
// Precompile a wordwrapped string to any given width.
|
||||
// This is a muuuch better method than V_WORDWRAP.
|
||||
@@ -1917,7 +1918,7 @@ static void HU_DrawChat(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (emote_autocomplete.emotestart != -1 && (emote_autocomplete.complete[0] || (w_chat.cursor - emote_autocomplete.emotestart) > 0))
|
||||
if (emote_autocomplete.emotestart != -1 && (emote_autocomplete.complete[0] || (w_chat.cursor - emote_autocomplete.emotestart) > 1))
|
||||
{
|
||||
emote_t *suggest;
|
||||
int skip = 0;
|
||||
@@ -2106,15 +2107,15 @@ static void HU_DrawChat_Old(void)
|
||||
i = 0;
|
||||
while (w_chat_buf[i])
|
||||
{
|
||||
if (w_chat.cursor == (i+1) && hu_tick < 4)
|
||||
{
|
||||
INT32 cursorx = (HU_INPUTX+c+charwidth < vid.width) ? (HU_INPUTX + c + charwidth) : (HU_INPUTX); // we may have to go down.
|
||||
INT32 cursory = (cursorx != HU_INPUTX) ? (y) : (y+charheight);
|
||||
V_DrawCharacter(cursorx, cursory+2*con_scalefactor, '_' |cv_constextsize.value | V_NOSCALESTART|t, !cv_allcaps.value);
|
||||
}
|
||||
int emotelen;
|
||||
emote_t *emote;
|
||||
|
||||
//Hurdler: isn't it better like that?
|
||||
if (w_chat_buf[i] >= HU_FONTSTART)
|
||||
if ((emote = M_VerifyEmote(w_chat_buf+i, &emotelen)))
|
||||
{
|
||||
HU_DrawScaledEmote((HU_INPUTX + c)<<FRACBITS, (y+con_scalefactor*2)<<FRACBITS, charwidth*FRACUNIT/EMOTEWIDTH, emote, V_NOSCALESTART | V_NOSCALEPATCH | t);
|
||||
i += emotelen-1;
|
||||
}
|
||||
else if (w_chat_buf[i] >= HU_FONTSTART) //Hurdler: isn't it better like that?
|
||||
{
|
||||
//charwidth = hu_font[w_chat[i]-HU_FONTSTART]->width * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat_buf[i] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value);
|
||||
@@ -2126,6 +2127,13 @@ static void HU_DrawChat_Old(void)
|
||||
|
||||
++i;
|
||||
|
||||
if (w_chat.cursor == i && hu_tick < 4)
|
||||
{
|
||||
INT32 cursorx = (HU_INPUTX+c+charwidth < vid.width) ? (HU_INPUTX + c + charwidth) : (HU_INPUTX); // we may have to go down.
|
||||
INT32 cursory = (cursorx != HU_INPUTX) ? (y) : (y+charheight);
|
||||
V_DrawCharacter(cursorx, cursory+2*con_scalefactor, '_' |cv_constextsize.value | V_NOSCALESTART|t, !cv_allcaps.value);
|
||||
}
|
||||
|
||||
c += charwidth;
|
||||
if (c >= vid.width)
|
||||
{
|
||||
|
||||
+2
-7
@@ -248,7 +248,7 @@ emote_t *M_VerifyEmote(const char *name, int *emotelen)
|
||||
return match;
|
||||
}
|
||||
|
||||
void M_DrawEmote(INT32 x, INT32 y, emote_t *emote, tic_t anim, INT32 flags)
|
||||
void M_DrawScaledEmote(fixed_t x, fixed_t y, fixed_t scale, emote_t *emote, tic_t anim, INT32 flags)
|
||||
{
|
||||
if (emote->numframes == 0)
|
||||
return;
|
||||
@@ -258,13 +258,8 @@ void M_DrawEmote(INT32 x, INT32 y, emote_t *emote, tic_t anim, INT32 flags)
|
||||
|
||||
const int CHARHEIGHT = 6;
|
||||
|
||||
fixed_t scale = FRACUNIT;
|
||||
|
||||
x *= FRACUNIT;
|
||||
y *= FRACUNIT;
|
||||
|
||||
if (emotepatch->width > EMOTEWIDTH)
|
||||
scale = (FRACUNIT/emotepatch->width)*EMOTEWIDTH;
|
||||
scale = FixedMul(scale, (FRACUNIT/emotepatch->width)*EMOTEWIDTH);
|
||||
else if (emotepatch->width < EMOTEWIDTH)
|
||||
x += (EMOTEWIDTH-emotepatch->width)*FRACUNIT/2;
|
||||
|
||||
|
||||
+3
-1
@@ -17,6 +17,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "m_fixed.h"
|
||||
#include "command.h"
|
||||
|
||||
extern consvar_t cv_emotes;
|
||||
@@ -50,7 +51,8 @@ emote_t *M_VerifyEmote(const char *name, int *emotelen);
|
||||
|
||||
// Draw the emote, anim should be some kind of timer ticking every game tic
|
||||
// for animated emotes
|
||||
void M_DrawEmote(INT32 x, INT32 y, emote_t *emote, tic_t anim, INT32 flags);
|
||||
#define M_DrawEmote(x, y, emote, anim, flags) M_DrawScaledEmote((x)<<FRACBITS, (y)<<FRACBITS, FRACUNIT, emote, anim, flags)
|
||||
void M_DrawScaledEmote(fixed_t x, fixed_t y, fixed_t scale, emote_t *emote, tic_t anim, INT32 flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
+9
-6
@@ -435,10 +435,10 @@ static int M_TextInputEmoteStart(textinput_t *input)
|
||||
return emotestart;
|
||||
}
|
||||
|
||||
static void M_TextInputCompleteEmote(textinput_t *input, emote_autocomplete_t *autocomplete)
|
||||
static boolean M_TextInputCompleteEmote(textinput_t *input, emote_autocomplete_t *autocomplete)
|
||||
{
|
||||
if (input->cursor == 0)
|
||||
return;
|
||||
return false;
|
||||
|
||||
// If we're in "autocomplete" state, delete ':' for latest autocompleted emote
|
||||
if (autocomplete->complete[0])
|
||||
@@ -457,8 +457,8 @@ static void M_TextInputCompleteEmote(textinput_t *input, emote_autocomplete_t *a
|
||||
int emotestart = autocomplete->emotestart;
|
||||
|
||||
// No emote - no autocomplete
|
||||
if (emotestart == -1 || (size_t)emotestart == input->cursor)
|
||||
return;
|
||||
if (emotestart == -1 || input->cursor - emotestart < 2)
|
||||
return false;
|
||||
|
||||
strlcpy(autocomplete->complete, &input->buffer[emotestart], input->cursor-emotestart+1);
|
||||
}
|
||||
@@ -476,7 +476,7 @@ static void M_TextInputCompleteEmote(textinput_t *input, emote_autocomplete_t *a
|
||||
{
|
||||
// Clear autocompletion state
|
||||
autocomplete->complete[0] = 0;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,6 +488,8 @@ static void M_TextInputCompleteEmote(textinput_t *input, emote_autocomplete_t *a
|
||||
|
||||
M_TextInputAddString(input, completed->name);
|
||||
M_TextInputAddChar(input, ':');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean M_TextInputHandleEmotes(textinput_t *input, INT32 key, emote_autocomplete_t *autocomplete)
|
||||
@@ -503,7 +505,8 @@ boolean M_TextInputHandleEmotes(textinput_t *input, INT32 key, emote_autocomplet
|
||||
|
||||
if (key == '\t' || (autocomplete->complete[0] == 0 && key == KEY_ENTER))
|
||||
{
|
||||
M_TextInputCompleteEmote(input, autocomplete);
|
||||
if (M_TextInputCompleteEmote(input, autocomplete) && key == KEY_ENTER) // Don't send message if we've autocompleted an emote
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user