diff --git a/src/Makefile b/src/Makefile index ee2e90cbc..78dfdd4f7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -285,7 +285,7 @@ else $(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o endif -OPTS += -DCOMPVERSION +OPTS += -DCOMPVERSION -fwrapv ifndef NONX86 ifndef GCC29 diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 77779f7d5..cba731b9c 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -12,7 +12,7 @@ # to avoid a false positive with the version detection... SUPPORTED_GCC_VERSIONS:=\ - 141 14\ + 142 141 140 14\ 132 131 130 13\ 123 122 121 120 12\ 114 113 112 111 110 11\ @@ -24,7 +24,7 @@ SUPPORTED_GCC_VERSIONS:=\ 55 54 53 52 51 50\ 49 48 47 46 45 44 43 42 41 40 -LATEST_GCC_VERSION=14.1 +LATEST_GCC_VERSION=14.2.1 # gcc or g++ ifdef PREFIX @@ -78,12 +78,20 @@ ifeq (,$(filter GCC%,$(.VARIABLES))) endif endif -ifdef GCC141 +ifdef GCC142 GCC141=1 endif +ifdef GCC141 +GCC140=1 +endif + ifdef GCC14 -GCC14=1 +GCC140=1 +endif + +ifdef GCC140 +GCC132=1 endif ifdef GCC132 @@ -437,9 +445,6 @@ endif ifdef GCC44 WFLAGS+=-Wno-error=array-bounds endif -ifdef GCC45 -opts+=-fwrapv -endif ifdef GCC46 WFLAGS+=-Wno-error=suggest-attribute=noreturn endif diff --git a/src/console.c b/src/console.c index 8bd8518f9..5c2e04eb3 100644 --- a/src/console.c +++ b/src/console.c @@ -850,9 +850,36 @@ static void CON_InputAddString(const char *c) Unlock_state(); } +static void CON_InputDel(size_t start, size_t end) +{ + size_t len; + + Lock_state(); + + len = (end - start); + + if (end != input_len) + memmove(&inputlines[inputline][start], &inputlines[inputline][end], input_len-end); + memset(&inputlines[inputline][input_len - len], 0, len); + + input_len -= len; + + if (input_sel >= end) + input_sel -= len; + else if (input_sel > start) + input_sel = start; + + if (input_cur >= end) + input_cur -= len; + else if (input_cur > start) + input_cur = start; + + Unlock_state(); +} + static void CON_InputDelSelection(void) { - size_t start, end, len; + size_t start, end; Lock_state(); @@ -866,18 +893,56 @@ static void CON_InputDelSelection(void) start = input_cur; end = input_sel; } - len = (end - start); - if (end != input_len) - memmove(&inputlines[inputline][start], &inputlines[inputline][end], input_len-end); - memset(&inputlines[inputline][input_len - len], 0, len); + CON_InputDel(start, end); - input_len -= len; input_sel = input_cur = start; Unlock_state(); } +static void CON_ToWordEnd(boolean move_sel) +{ + Lock_state(); + + // Skip spaces + while (input_cur < input_len && isspace(inputlines[inputline][input_cur])) + ++input_cur; + + // Skip word + while (input_cur < input_len && !isspace(inputlines[inputline][input_cur])) + ++input_cur; + + if (move_sel) input_sel = input_cur; + + Unlock_state(); +} + +static void CON_ToWordBegin(boolean move_sel) +{ + Lock_state(); + + // Hack, always move back 1 character if possible so if we press ctrl-left at a word beginning + // we move to previous word + if (input_cur) --input_cur; + + // Skip spaces + while (input_cur && isspace(inputlines[inputline][input_cur])) + --input_cur; + + // Skip word + while (input_cur && !isspace(inputlines[inputline][input_cur])) + --input_cur; + + // Unless we reached beginning of line, we're pointing at a space before word, so move cursor + // forward to fix that + if (input_cur) ++input_cur; + + if (move_sel) input_sel = input_cur; + + Unlock_state(); +} + static void CON_InputAddChar(char c) { if (input_len >= CON_MAXPROMPTCHARS-1) @@ -1055,6 +1120,38 @@ boolean CON_Responder(event_t *ev) completion[0] = 0; return true; } + else if (key == 'w' || key == 'W') + { + size_t word_start, word_end, i; + word_end = i = input_cur; + + // Unless we're pointing at the beginning of line, decrement i so we only start + // removing symbols that come before the cursor + if (i) --i; + + // We might be pointing to spaces, skip them first + while (i && isspace(inputlines[inputline][i])) + --i; + + // Now skip the "word" + while (i && !isspace(inputlines[inputline][i])) + --i; + + // Unless we reached beginning of line, i is pointing at first space that was found + // before word start, and we don't want to remove it + if (i) ++i; + + word_start = i; + + if (word_start != word_end) + CON_InputDel(word_start, word_end); + + return true; + } + else if (key == KEY_RIGHTARROW) + CON_ToWordEnd(!shiftdown); + else if (key == KEY_LEFTARROW) + CON_ToWordBegin(!shiftdown); // Select all if (key == 'a' || key == 'A') diff --git a/src/d_main.c b/src/d_main.c index a9d1428a9..ec020a0d6 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -170,6 +170,31 @@ UINT8 ctrldown = 0; // 0x1 left, 0x2 right UINT8 altdown = 0; // 0x1 left, 0x2 right boolean capslock = 0; // gee i wonder what this does. +static inline void D_DeviceLEDTick(void) +{ + UINT8 i; + UINT16 color[MAXSPLITSCREENPLAYERS]; + UINT16 curcolor[MAXSPLITSCREENPLAYERS]; + + // no gamepads connected + if (I_NumJoys() == 0) + return; + + for (i = 0; i <= splitscreen; i++) + { + if (G_GetDeviceForPlayer(i) == 0) + continue; + + color[i] = G_GetSkinColor(i); + + if (curcolor[i] == color[i]) // dont update if same colour + continue; + + G_SetPlayerGamepadIndicatorColor(i, color[i]); + curcolor[i] = color[i]; + } +} + // // D_ProcessEvents // Send all the events of the given timestamp down the responder chain @@ -839,6 +864,9 @@ void D_SRB2Loop(void) else menuInputDelayTimer = 0; + if (!dedicated && renderisnewtic) // idk does this need dedi check?? + D_DeviceLEDTick(); + // Fully completed frame made. finishprecise = I_GetPreciseTime(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index cd93e0355..ef8de8f07 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -6068,8 +6068,6 @@ static void Command_SkinSearch(void) */ static void Color_OnChange(void) { - G_SetPlayerGamepadIndicatorColor(0, 0); // i want this to always change so its here - if (!Playing()) return; // do whatever you want @@ -6089,8 +6087,6 @@ static void Color_OnChange(void) CV_StealthSetValue(&cv_playercolor, players[consoleplayer].skincolor); } - - G_SetPlayerGamepadIndicatorColor(0, 0); // update again } /** Sends a color change for the secondary splitscreen player, unless that @@ -6113,8 +6109,6 @@ static void Color2_OnChange(void) CV_StealthSetValue(&cv_playercolor2, players[displayplayers[1]].skincolor); } - - G_SetPlayerGamepadIndicatorColor(1, 0); } static void Color3_OnChange(void) @@ -6132,8 +6126,6 @@ static void Color3_OnChange(void) CV_StealthSetValue(&cv_playercolor3, players[displayplayers[2]].skincolor); } - - G_SetPlayerGamepadIndicatorColor(2, 0); } static void Color4_OnChange(void) @@ -6151,8 +6143,6 @@ static void Color4_OnChange(void) CV_StealthSetValue(&cv_playercolor4, players[displayplayers[3]].skincolor); } - - G_SetPlayerGamepadIndicatorColor(3, 0); } /** Displays the result of the chat being muted or unmuted. diff --git a/src/g_game.c b/src/g_game.c index 1fa2aadb1..efda1cf57 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2138,8 +2138,6 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive) if (viewnum == 1 && demo.playback) consoleplayer = displayplayers[0]; - - G_SetPlayerGamepadIndicatorColor(viewnum-1, 0); } // @@ -8546,12 +8544,8 @@ boolean G_DemoTitleResponder(event_t *ev) // void G_SetGamestate(gamestate_t newstate) { - SINT8 i; gamestate = newstate; - for (i = 0; i <= splitscreen; i++) - G_SetPlayerGamepadIndicatorColor(i, 0); // dumb hack but works - #ifdef HAVE_DISCORDRPC DRPC_UpdatePresence(); #endif diff --git a/src/g_input.c b/src/g_input.c index f7057d4e4..00a57d7bc 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -865,7 +865,7 @@ static const char *gamecontrolname[num_gamecontrols] = #include "k_kart.h" -static INT32 G_GetDeviceForPlayer(INT32 player) +INT32 G_GetDeviceForPlayer(INT32 player) { switch (player) { @@ -887,7 +887,7 @@ static INT32 G_GetDeviceForPlayer(INT32 player) } } -static UINT16 G_GetSkinColor(INT32 player) +inline UINT16 G_GetSkinColor(INT32 player) { if (players[displayplayers[player]].skincolor && gamestate == GS_LEVEL) return players[displayplayers[player]].skincolor; diff --git a/src/g_input.h b/src/g_input.h index 92444cccc..8522be618 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -132,6 +132,8 @@ extern INT32 gamecontrol4[num_gamecontrols][2]; // peace to my little coder fingers! // check a gamecontrol being active or not +UINT16 G_GetSkinColor(INT32 player); +INT32 G_GetDeviceForPlayer(INT32 player); void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color); void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2a0ff0c66..ba8d8cef1 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -4772,6 +4772,7 @@ void HWR_ProjectSprite(mobj_t *thing) size_t lumpoff; unsigned rot; UINT8 flip; + boolean vflip; boolean mirrored; boolean hflip; @@ -4795,6 +4796,7 @@ void HWR_ProjectSprite(mobj_t *thing) if (!thing) return; + vflip = (thing->eflags & MFE_VERTICALFLIP); mirrored = thing->mirrored; hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored); papersprite = (thing->frame & FF_PAPERSPRITE); @@ -4924,7 +4926,7 @@ void HWR_ProjectSprite(mobj_t *thing) } if (thing->skin && ((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->flags & SF_HIRES) - this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->highresscale); + this_scale *= FIXED_TO_FLOAT(((skin_t *)( (thing->localskin) ? thing->localskin : thing->skin ))->highresscale); spr_width = spritecachedinfo[lumpoff].width; spr_height = spritecachedinfo[lumpoff].height; @@ -5016,7 +5018,7 @@ void HWR_ProjectSprite(mobj_t *thing) x1 = tr_x + x1 * rightcos; x2 = tr_x - x2 * rightcos; - if (thing->eflags & MFE_VERTICALFLIP) + if (vflip) { gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * spriteyscale); gzt = gz + (FIXED_TO_FLOAT(spr_height) * spriteyscale); @@ -5076,7 +5078,6 @@ void HWR_ProjectSprite(mobj_t *thing) vis->mobj = thing; - //Hurdler: 25/04/2000: now support colormap in hardware mode if ((vis->mobj->flags & MF_BOSS) && (vis->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash" { @@ -5113,10 +5114,7 @@ void HWR_ProjectSprite(mobj_t *thing) //CONS_Debug(DBG_RENDER, "------------------\nH: sprite : %d\nH: frame : %x\nH: type : %d\nH: sname : %s\n\n", // thing->sprite, thing->frame, thing->type, sprnames[thing->sprite]); - if (thing->eflags & MFE_VERTICALFLIP) - vis->vflip = true; - else - vis->vflip = false; + vis->vflip = vflip; vis->precip = false; } diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 27a44f6d7..d363ce73b 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -594,7 +594,10 @@ void HU_AddChatText(const char *text, boolean playsound) if (OLDCHAT) // if we're using oldchat, print directly in console CONS_Printf("%s\n", text); else // if we aren't, still save the message to log.txt - CON_LogMessage(va("%s\n", text)); + { + CON_LogMessage(text); + CON_LogMessage("\n"); // Add newline. Don't use va for that, since `text` might be refering to va's buffer itself + } #else (void)playsound; CONS_Printf("%s\n", text); diff --git a/src/k_director.c b/src/k_director.c index c0687494d..fdf636d46 100644 --- a/src/k_director.c +++ b/src/k_director.c @@ -37,7 +37,7 @@ struct directorinfo INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers? } directorinfo; -static boolean race_rules() +static boolean race_rules(void) { return gametype = GT_RACE; } @@ -69,21 +69,6 @@ void K_InitDirector(void) } } -/*static fixed_t K_GetFinishGap(INT32 leader, INT32 follower) -{ - fixed_t dista = players[follower].distancetofinish; - fixed_t distb = players[leader].distancetofinish; - - if (players[follower].position < players[leader].position) - { - return distb - dista; - } - else - { - return dista - distb; - } -}*/ - static fixed_t K_GetDistanceToFinish(player_t player) { mobj_t *mo; diff --git a/src/k_kart.c b/src/k_kart.c index 293e5209b..a3cfb55b0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7712,49 +7712,6 @@ static void K_drawKartStats(void) if (!LUA_HudEnabled(hud_statdisplay)) return; - - // I tried my best, but this is still mess :/ - if (splitscreen) - { - if (splitscreen == 1) - { - // If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping - // to bottom - if (splitnum == 0) - { - y /= 2; - flags = V_SNAPTOLEFT; - } - else - { - // Can move it down a bit - y += 20; - } - } - else - { - // In 4-player splitscreen... - flags = 0; - - // ...For players 2 and 4, which are at right side, we move x coordinate... - if (splitnum == 1 || splitnum == 3) - x += BASEVIDWIDTH/2; - // ...Else, for players on left side we can snap position to left... - else - flags |= V_SNAPTOLEFT; - - // ...For players 1 and 2, which are at top side, we move y coordinate... - if (splitnum == 0 || splitnum == 1) - y /= 2; - // ...Else, for players on bottom side we can snap position to bottom - else - { - flags |= V_SNAPTOBOTTOM; - // Can move it down a bit - y += 20; - } - } - } //Internal offset for speedometer if (cv_kartspeedometer.value) @@ -7766,17 +7723,47 @@ static void K_drawKartStats(void) } else spdoffset = 0; - + // Customizations c: if (!splitscreen) { x += 18 + cv_stat_xoffset.value; y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; } + else if (splitscreen == 1) // I tried my best, but this is still mess :/ < :Blobcatpats: c: + { + x -= 10; + y -= 40; + y += (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0); + + // If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping + // to bottom + if (splitnum == 0) + { + y /= 2; + flags = V_SNAPTOLEFT; + } + else + { + // Can move it down a bit + y += 45; + } + } else { - x += 18; - y += (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; + if (splitnum == 0 || splitnum == 2) // If we are P1 or P3... + { + // ye i just align it to position number lol + x = POSI_X + 19; + y = POSI_Y - 6; + flags = V_SNAPTOLEFT|((splitnum == 2) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P3 to the bottom. + } + else // else, that means we're P2 or P4. + { + x = POSI2_X - 75; + y = POSI2_Y - 6; + flags = V_SNAPTORIGHT|((splitnum == 3) ? V_SPLITSCREEN|V_SNAPTOBOTTOM : 0); // flip P4 to the bottom + } } flags |= V_HUDTRANS; diff --git a/src/lua_baselib.c b/src/lua_baselib.c index f5763dc09..cd43e40bf 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3022,6 +3022,7 @@ static int lib_gSetPlayerGamepadIndicatorColor(lua_State *L) // Not a local player if (player == -1) return 0; + // pls update with color 0 when youre done with changing led stuff so it can get player color again G_SetPlayerGamepadIndicatorColor(player, color); return 0; diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 74e6b0f32..dd4cf7b03 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -51,6 +51,9 @@ int player_localskin_setter(lua_State *L); int player_sliproll_getter(lua_State *L); int player_sliproll_noset(lua_State *L); +int player_viewrollangle_getter(lua_State *L); +int player_viewrollangle_noset(lua_State *L); + #define FIELD(type, field_name, getter, setter) { #field_name, offsetof(type, field_name), getter, setter } static const udata_field_t player_fields[] = { // Player doesn't actually have field "name" so macro fails. Need to declare field manually. @@ -159,6 +162,7 @@ static const udata_field_t player_fields[] = { #endif // Same as player.name { "sliproll", 0, player_sliproll_getter, player_sliproll_noset }, + { "viewrollangle", 0, player_viewrollangle_getter, player_viewrollangle_noset }, { "ping", 0, player_ping_getter, player_ping_noset }, // Hmm originally setter doesn't exist so data is written as unreachable custom field... { NULL, 0, NULL, NULL }, }; @@ -217,6 +221,7 @@ NOSET(bot) NOSET(splitscreenindex) NOSET(ping) NOSET(sliproll) +NOSET(viewrollangle) #undef NOSET @@ -372,6 +377,15 @@ int player_sliproll_getter(lua_State *L) return 1; } +int player_viewrollangle_getter(lua_State *L) +{ + player_t *plr = GETPLAYER(); + + lua_pushangle(L, R_ViewRollAngle(plr)); + + return 1; +} + static int lib_iteratePlayers(lua_State *L) { INT32 i = -1; diff --git a/src/p_tick.c b/src/p_tick.c index 5acb8b5fb..8054ee554 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -319,7 +319,7 @@ static inline void P_DeviceRumbleTick(void) { UINT8 i; - if (cv_rumble[0].value == 0 && cv_rumble[1].value == 0 && cv_rumble[2].value == 0 && cv_rumble[3].value == 0) + if (I_NumJoys() == 0 || (cv_rumble[0].value == 0 && cv_rumble[1].value == 0 && cv_rumble[2].value == 0 && cv_rumble[3].value == 0)) { return; } @@ -336,6 +336,9 @@ static inline void P_DeviceRumbleTick(void) if (!playeringame[i] || player->spectator) continue; + if (G_GetDeviceForPlayer(i) == 0) + continue; + if (player->exiting) continue; @@ -372,18 +375,10 @@ void P_RunChaseCameras(void) { UINT8 i; - if (!splitscreen) + for (i = 0; i <= splitscreen; i++) { - if (camera[0].chase) - P_MoveChaseCamera(&players[displayplayers[0]], &camera[0], false); - } - else - { - for (i = 0; i <= splitscreen; i++) - { - if (camera[i].chase) - P_MoveChaseCamera(&players[displayplayers[i]], &camera[i], false); - } + if (camera[i].chase) + P_MoveChaseCamera(&players[displayplayers[i]], &camera[i], false); } } diff --git a/src/r_fps.c b/src/r_fps.c index 17e357a16..b46c6e51b 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -147,7 +147,7 @@ static void R_SetupFreelook(void) void R_InterpolateViewRollAngle(fixed_t frac) { - viewroll = oldview->roll + R_LerpAngle(oldview->roll, newview->roll, frac); + viewroll = R_LerpAngle(oldview->roll, newview->roll, frac); } void R_InterpolateView(fixed_t frac, boolean forceinvalid)