diff --git a/src/console.c b/src/console.c index 7276b59c8..df7fc299d 100644 --- a/src/console.c +++ b/src/console.c @@ -638,68 +638,28 @@ INT32 CON_ShiftChar(INT32 ch) if (I_UseNativeKeyboard()) return ch; - if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) - { - if (cv_keyboardlayout.value == 3) - { - if (shiftdown ^ capslock) - ch = shiftxform[ch]; - else if (altdown & 0x2) - ch = french_altgrxform[ch]; - else - ch = HU_FallBackFrSpecialLetter(ch); - } - else - { - if (shiftdown ^ capslock) - ch = shiftxform[ch]; - } - } - else // if we're holding shift we should still shift non letter symbols - { - if (cv_keyboardlayout.value == 3) - { - if (shiftdown) - ch = shiftxform[ch]; - else if (altdown & 0x2) - ch = french_altgrxform[ch]; - else - ch = HU_FallBackFrSpecialLetter(ch); - } - else - { - if (shiftdown) - ch = shiftxform[ch]; - } - } - - return ch; -} - -INT32 CON_ShitAndAltGrChar(INT32 ch) -{ if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { if (shiftdown ^ capslock) ch = shiftxform[ch]; } - else // if we're holding shift we should still shift non letter symbols + else // if we're holding shift we should still shift non letter symbols { if (shiftdown) ch = shiftxform[ch]; - else if (altdown & 0x2) + else if (cv_keyboardlayout.value == 3) { - ch = french_altgrxform[ch]; - } - else - { - ch = HU_FallBackFrSpecialLetter(ch); + if (altdown & 0x2) + ch = french_altgrxform[ch]; + else + ch = HU_FallBackFrSpecialLetter(ch); } } return ch; } + // Clear time of console heads up messages // void CON_ClearHUD(void) @@ -892,7 +852,7 @@ boolean CON_Responder(event_t *ev) return true; // ctrl modifier -- changes behavior, adds shortcuts - if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown)) + if (ctrldown && (cv_keyboardlayout.value != 3 || (cv_keyboardlayout.value == 3 && !altdown))) { // show all cvars/commands that match what we have inputted if (key == KEY_TAB) @@ -1222,19 +1182,10 @@ void CON_LogMessage(const char *msg) // Console print! Wahooo! Lots o fun! // -void CONS_Printf(const char *fmt, ...) +static inline void CONS_PrintMsg(char *txt) { - va_list argptr; - static char *txt = NULL; boolean startup; - if (txt == NULL) - txt = malloc(8192); - - va_start(argptr, fmt); - vsnprintf(txt, 8192, fmt, argptr); - va_end(argptr); - // echo console prints to log file DEBFILE(txt); @@ -1260,6 +1211,21 @@ void CONS_Printf(const char *fmt, ...) } } +void CONS_Printf(const char *fmt, ...) +{ + va_list argptr; + static char *txt = NULL; + + if (txt == NULL) + txt = malloc(8192); + + va_start(argptr, fmt); + vsnprintf(txt, 8192, fmt, argptr); + va_end(argptr); + + CONS_PrintMsg(txt); +} + void CONS_Alert(alerttype_t level, const char *fmt, ...) { va_list argptr; @@ -1288,9 +1254,7 @@ void CONS_Alert(alerttype_t level, const char *fmt, ...) break; } - // I am lazy and I feel like just letting CONS_Printf take care of things. - // Is that okay? - CONS_Printf("%s", txt); + CONS_PrintMsg(txt); } void CONS_Debug(INT32 debugflags, const char *fmt, ...) @@ -1308,11 +1272,9 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...) vsnprintf(txt, 8192, fmt, argptr); va_end(argptr); - // Again I am lazy, oh well - CONS_Printf("%s", txt); + CONS_PrintMsg(txt); } - // Print an error message, and wait for ENTER key to continue. // To make sure the user has seen the message // diff --git a/src/console.h b/src/console.h index 3292bc6e3..abb506609 100644 --- a/src/console.h +++ b/src/console.h @@ -49,7 +49,6 @@ extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *or extern UINT8 *consolebgmap; INT32 CON_ShiftChar(INT32 ch); -INT32 CON_ShitAndAltGrChar(INT32 ch); void CON_SetupBackColormap(void); void CON_ClearHUD(void); // clear heads up messages diff --git a/src/d_main.c b/src/d_main.c index 0ecce2047..ccfa61f4e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1208,7 +1208,7 @@ void D_AddPostloadFiles(void) static boolean AddIWAD(const char * file, const char *dir) { - char * path = va(pandf, dir, file); + char *path = va(pandf, dir, file); if (FIL_ReadFileOK(path)) { diff --git a/src/g_demo.c b/src/g_demo.c index 9662ce517..0b8921c69 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -3090,6 +3090,9 @@ post_compat: if (cv_director.value) CV_SetValue(&cv_director, 0); + if (demo.timing) + G_DoneLevelLoad(); + demo.deferstart = true; } #undef SKIPERRORS diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 6ede89fc6..91f9ca7d1 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -97,7 +97,6 @@ static textinput_t w_chat; static boolean headsupactive = false; boolean hu_showscores = false; // draw rankings static char hu_tick; -static tic_t hu_emoteanim = 0; emote_autocomplete_t emote_autocomplete = {0}; static huddrawlist_h luahuddrawlist_scores = NULL; @@ -907,7 +906,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum) target = READSINT8(*p); flags = READUINT8(*p); msg = buf; - READSTRINGL(*p, msg, HU_MAXMSGLEN + 1); + READSTRINGN(*p, msg, HU_MAXMSGLEN + 1); if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum))) { @@ -1095,7 +1094,6 @@ void HU_Ticker(void) return; hu_tick++; - hu_emoteanim++; hu_tick &= 7; // currently only to blink chat input cursor if (PLAYER1INPUTDOWN(gc_scores)) @@ -1810,6 +1808,7 @@ static void HU_DrawChat(void) INT32 t = 0, c = 0, y = chaty - (typelines*charheight); UINT32 i = 0, saylen = strlen(w_chat_buf); // You learn new things everyday! INT32 cflag = 0; + INT32 pm_offset = 0; // for cases when you type emote while also doing /pm size_t select_start = 0, select_end = 0; const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; @@ -1921,64 +1920,6 @@ static void HU_DrawChat(void) } } - if (emote_autocomplete.emotestart != -1 && (emote_autocomplete.complete[0] || (w_chat.cursor - emote_autocomplete.emotestart) > 1)) - { - emote_t *suggest; - int skip = 0; - - const char *complete; - int complete_len; - - if (emote_autocomplete.complete[0]) - { - complete = emote_autocomplete.complete; - complete_len = strlen(complete); - } - else - { - complete = &w_chat_buf[emote_autocomplete.emotestart]; - complete_len = w_chat.cursor - emote_autocomplete.emotestart; - } - - // A bit of copy-paste from /pm code :p - INT32 suggesty = chaty - charheight - 1; - size_t longest_suggestion_length = 0; - - while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL) - { - longest_suggestion_length = max(longest_suggestion_length, strlen(suggest->name)); - ++skip; - } - - skip = 0; - -#ifdef NETSPLITSCREEN - if (splitscreen) - { - suggesty -= BASEVIDHEIGHT/2; - if (splitscreen > 1) - suggesty += 16; - } - else -#endif - suggesty -= (cv_kartspeedometer.value ? 16 : 0); - - while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL) - { - V_DrawFillConsoleMap(chatx + boxw + 2, suggesty - (7*skip), (longest_suggestion_length+2)*4 + EMOTEWIDTH, 6, V_SNAPTOBOTTOM|V_SNAPTOLEFT); - - // Highlight currently suggested emote - int hlflag = 0; - if (skip == emote_autocomplete.skip && emote_autocomplete.complete[0]) - hlflag = V_YELLOWMAP; - - V_DrawSmallString(chatx + boxw + 4 + EMOTEWIDTH, suggesty - (7*skip), hlflag|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", suggest->name)); - M_DrawEmote(chatx + boxw + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT); - - ++skip; - } - } - // handle /pm list. It's messy, horrible and I don't care. if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai { @@ -2059,9 +2000,74 @@ static void HU_DrawChat(void) if (count == 0) // no results. { + pm_offset = 48 + 2; V_DrawFillConsoleMap(chatx + boxw + 2, p_dispy - (6*count), 48, 6, 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); // fill it like the chat so the text doesn't become hard to read because of the hud. V_DrawSmallString(chatx + boxw + 4, p_dispy - (6*count), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, "NO RESULT."); } + else + { + pm_offset = (longest_name_length+4)*4 + 2; + } + } + + if (emote_autocomplete.emotestart != -1 && (emote_autocomplete.complete[0] || (w_chat.cursor - emote_autocomplete.emotestart) > 1)) + { + emote_t *suggest; + int skip = 0; + + const char *complete; + int complete_len; + + if (emote_autocomplete.complete[0]) + { + complete = emote_autocomplete.complete; + complete_len = strlen(complete); + } + else + { + complete = &w_chat_buf[emote_autocomplete.emotestart]; + complete_len = w_chat.cursor - emote_autocomplete.emotestart; + } + + // A bit of copy-paste from /pm code :p + INT32 suggesty = chaty - charheight - 1; + size_t longest_suggestion_length = 0; + + while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL) + { + longest_suggestion_length = max(longest_suggestion_length, strlen(suggest->name)); + ++skip; + } + + INT32 emote_suggest_boxw = (longest_suggestion_length+2)*4 + EMOTEWIDTH; + + skip = 0; + +#ifdef NETSPLITSCREEN + if (splitscreen) + { + suggesty -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + suggesty += 16; + } + else +#endif + suggesty -= (cv_kartspeedometer.value ? 16 : 0); + + while ((suggest = M_FindEmote(complete, complete_len, skip)) != NULL) + { + V_DrawFillConsoleMap(chatx + boxw + pm_offset + 2, suggesty - (7*skip), emote_suggest_boxw, 6, V_SNAPTOBOTTOM|V_SNAPTOLEFT); + + // Highlight currently suggested emote + int hlflag = 0; + if (skip == emote_autocomplete.skip && emote_autocomplete.complete[0]) + hlflag = V_YELLOWMAP; + + V_DrawSmallString(chatx + boxw + pm_offset + 4 + EMOTEWIDTH, suggesty - (7*skip), hlflag|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", suggest->name)); + M_DrawEmote(chatx + boxw + pm_offset + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT); + + ++skip; + } } HU_drawChatLog(typelines - 1); // typelines is the # of lines we're typing. If there's more than 1 then the log should scroll up to give us more space. diff --git a/src/m_menu.c b/src/m_menu.c index 45ff385fd..6686c73c4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2074,7 +2074,6 @@ void M_Init(void) OP_OpenGLOptionsMenu[op_gl_shader].status = IT_GRAYEDOUT; OP_OpenGLOptionsMenu[op_gl_lightdither].status = IT_GRAYEDOUT; OP_OpenGLOptionsMenu[op_gl_palrender].status = IT_GRAYEDOUT; - OP_OpenGLOptionsMenu[op_gl_flashpal].status = IT_GRAYEDOUT; OP_ExpOptionsMenu[op_exp_paldepth].status = IT_GRAYEDOUT; } @@ -7950,7 +7949,7 @@ static void M_DrawSetupMultiPlayerMenu(void) patch_t *statbg = (patch_t *)W_CachePatchName("K_STATBG", PU_PATCH); patch_t *statlr = (patch_t *)W_CachePatchName("K_STATLR", PU_PATCH); patch_t *statud = (patch_t *)W_CachePatchName("K_STATUD", PU_PATCH); - patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0", PU_PATCH); + patch_t *statdot = (patch_t *)W_CachePatchName("K_SDOT0" , PU_PATCH); patch_t *patch; UINT8 frame; UINT8 speed; diff --git a/src/m_menudefs.c b/src/m_menudefs.c index aa3f186c8..e734021eb 100644 --- a/src/m_menudefs.c +++ b/src/m_menudefs.c @@ -1043,7 +1043,6 @@ static const char* OP_OpenGLTooltips[] = "Fallback 3D model for characters that don't have any.", "Graphical Shaders.", "Recreates the look of software mode.", - "Flash palettes for palette rendering.", "Bit-depth of textures.", "Filter to use on textures.", "Anisotropic filtering.", @@ -1062,7 +1061,6 @@ enum op_gl_falbckmdls, op_gl_shader, op_gl_palrender, - op_gl_flashpal, op_gl_scrdepth, op_gl_filter, op_gl_anis, @@ -2772,6 +2770,5 @@ void M_UpdateOGLMenu(void) OP_OpenGLOptionsMenu[op_gl_lightdither].status = (!HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR; OP_OpenGLOptionsMenu[op_gl_palrender].status = (cv_glscreentextures.value != 2 || !HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR; - OP_OpenGLOptionsMenu[op_gl_flashpal].status = (!HWR_ShouldUsePaletteRendering()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR; } #endif diff --git a/src/m_textinput.c b/src/m_textinput.c index 7d050dfc7..c49294094 100644 --- a/src/m_textinput.c +++ b/src/m_textinput.c @@ -256,7 +256,7 @@ static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emot return true; } - if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown)) + if (ctrldown && (cv_keyboardlayout.value != 3 || (cv_keyboardlayout.value == 3 && !altdown))) { if (key == 'x' || key == 'X') { @@ -392,7 +392,7 @@ static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emot key = '/'; // same capslock code as hu_stuff.c's HU_responder. Check there for details. - key = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(key) : CON_ShiftChar(key); + key = CON_ShiftChar(key); // enter a char into the command prompt if (key < 32 || key > 127) diff --git a/src/p_mobj.c b/src/p_mobj.c index 01b3977d0..552ef4eff 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -122,27 +122,6 @@ static void P_CycleMobjState(mobj_t *mobj) } } -// -// P_CycleMobjState for players. -// -static void P_CyclePlayerMobjState(mobj_t *mobj) -{ - // state animations - P_CycleStateAnimation(mobj); - - // cycle through states, - // calling action functions at transitions - if (mobj->tics != -1) - { - mobj->tics--; - - // you can cycle through multiple states in a tic - if (!mobj->tics && mobj->state) - if (!P_SetPlayerMobjState(mobj, mobj->state->nextstate)) - return; // freed itself - } -} - #define MAX_RECURSION 20 // @@ -9221,10 +9200,7 @@ void P_MobjThinker(mobj_t *mobj) } // Can end up here if a player dies. - if (mobj->player) - P_CyclePlayerMobjState(mobj); - else - P_CycleMobjState(mobj); + P_CycleMobjState(mobj); if (P_MobjWasRemoved(mobj)) return;