diff --git a/src/d_netcmd.c b/src/d_netcmd.c index fd08830f0..4e217946e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1008,9 +1008,17 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_usejoystick[i]); CV_RegisterVar(&cv_joyscale[i]); - CV_RegisterVar(&cv_rumble[i]); - CV_RegisterVar(&cv_rumblestrength[i]); CV_RegisterVar(&cv_gamepadled[i]); + + CV_RegisterVar(&cv_rumble[i]); + CV_RegisterVar(&cv_rumble_strength[i]); + CV_RegisterVar(&cv_rumble_spinout[i]); + CV_RegisterVar(&cv_rumble_sneakerboost[i]); + CV_RegisterVar(&cv_rumble_offroad[i]); + CV_RegisterVar(&cv_rumble_bananadrag[i]); + CV_RegisterVar(&cv_rumble_stairjank[i]); + CV_RegisterVar(&cv_rumble_brakedrift[i]); + CV_RegisterVar(&cv_rumble_driftcharge[i]); } CV_RegisterVar(&cv_gamepadifunfocused); diff --git a/src/g_input.c b/src/g_input.c index fa18272b8..c4dfece9d 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -66,13 +66,30 @@ consvar_t cv_rumble[MAXSPLITSCREENPLAYERS] = { static CV_PossibleValue_t rumblestrength_cons_t[] = {{FRACUNIT/4, "MIN"}, {FRACUNIT*4, "MAX"}, {0, NULL}}; -consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS] = { +consvar_t cv_rumble_strength[MAXSPLITSCREENPLAYERS] = { {"rumblestrength", "1.0", CV_SAVE|CV_FLOAT, rumblestrength_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"rumblestrength2", "1.0", CV_SAVE|CV_FLOAT, rumblestrength_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"rumblestrength3", "1.0", CV_SAVE|CV_FLOAT, rumblestrength_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}, {"rumblestrength4", "1.0", CV_SAVE|CV_FLOAT, rumblestrength_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL} }; +#define IMPL_RUMBLE_TYPE(type)\ +consvar_t cv_rumble_##type [MAXSPLITSCREENPLAYERS] = {\ + {"rumble_" #type, "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},\ + {"rumble2_" #type, "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},\ + {"rumble3_" #type, "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},\ + {"rumble4_" #type, "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}\ +}; + +IMPL_RUMBLE_TYPE(spinout); +IMPL_RUMBLE_TYPE(sneakerboost); +IMPL_RUMBLE_TYPE(offroad); +IMPL_RUMBLE_TYPE(bananadrag); +IMPL_RUMBLE_TYPE(stairjank); +IMPL_RUMBLE_TYPE(brakedrift); +IMPL_RUMBLE_TYPE(driftcharge); + + static CV_PossibleValue_t gamepadled_cons_t[] = {{0, "Off"}, {1, "Skincolor"}, {2, "Mobjcolor"}, {0, NULL}}; consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS] = { {"gamepadled", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle, 0, NULL, NULL, 0, 0, NULL}, @@ -1036,8 +1053,8 @@ void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_stre // doesent need to be super precise // but ensure this is within range (0-65535) // placed here so it applies to lua aswell - low_strength = (UINT16)min(FixedMul(low_strength, cv_rumblestrength[playernum].value), UINT16_MAX); - high_strength = (UINT16)min(FixedMul(high_strength, cv_rumblestrength[playernum].value), UINT16_MAX); + low_strength = (UINT16)min(FixedMul(low_strength, cv_rumble_strength[playernum].value), UINT16_MAX); + high_strength = (UINT16)min(FixedMul(high_strength, cv_rumble_strength[playernum].value), UINT16_MAX); I_GamepadRumble(playernum, low_strength, high_strength, duration); } @@ -1059,7 +1076,7 @@ void G_DeviceRumbleTick(void) { UINT8 i; - if (dedicated || numcontrollers == 0 || gamestate != GS_LEVEL) + if (dedicated || numcontrollers == 0 || gamestate != GS_LEVEL || demo.playback) { return; } @@ -1090,6 +1107,11 @@ void G_DeviceRumbleTick(void) const player_t *player = P_GetLocalPlayerForNum(i); + if (!player) + { + continue; + } + // allow lua to do some crap for spectators if (player->spectator || !player->mo) { @@ -1105,17 +1127,20 @@ void G_DeviceRumbleTick(void) continue; } - if (player->kartstuff[k_spinouttimer]) + if (cv_rumble_spinout[i].value + && player->kartstuff[k_spinouttimer]) { //low = high = FRACUNIT / 6; low = high = FixedMul((RUMBLE_VERYSTRONG), (FixedDiv(player->kartstuff[k_spinouttimer], (3*TICRATE / 2)))); // try do some some kinda fadeout, 3*TICRATE / 2 is the "default" spinout time } - else if (player->kartstuff[k_sneakertimer] > (sneakertime-(TICRATE/2))) + else if (cv_rumble_sneakerboost[i].value + && (player->kartstuff[k_sneakertimer] > (sneakertime-(TICRATE/2)))) { low = high = RUMBLE_STRONG; } - else if ((player->kartstuff[k_offroad]) - && player->speed != 0 + else if (cv_rumble_offroad[i].value + && (player->kartstuff[k_offroad]) + && (player->speed != 0) && P_IsObjectOnGround(player->mo)) { // weaken this depending on if you got hyu or invinc @@ -1132,32 +1157,37 @@ void G_DeviceRumbleTick(void) low = high = RUMBLE_MODERATE; } } - else if ((player->kartstuff[k_bananadrag] > TICRATE) - && player->speed != 0 + else if (cv_rumble_bananadrag[i].value + && (player->kartstuff[k_bananadrag] > TICRATE) + && (player->speed != 0) && P_IsObjectOnGround(player->mo)) { if (leveltime & 1) // this is actually funny lel high = RUMBLE_MODERATE; } - /*else if ((player->stairjank > 8) // this is kinda cool but prob gets annoying after a while - && player->speed != 0 + else if (cv_rumble_stairjank[i].value + && (player->stairjank > 8) + && (player->speed != 0) && P_IsObjectOnGround(player->mo)) { - low = high = RUMBLE_WEAK; - }*/ + low = high = RUMBLE_VERYWEAK; + } - if (player->kartstuff[k_brakedrift]) + if (cv_rumble_brakedrift[i].value + && player->kartstuff[k_brakedrift]) { high = CLAMP((high + RUMBLE_VERYWEAK), 0, UINT16_MAX); } // pulse when gettin new driftlevel // let this come last - if (player->kartstuff[k_driftcharge] + if (cv_rumble_driftcharge[i].value + && player->kartstuff[k_driftcharge] && player->driftlevel) { high = CLAMP((high + RUMBLE_VERYWEAK), 0, UINT16_MAX); + // make it rumble slightly longer the higher your driftlevel! if (player->driftlevel == 2) lenght = 114; else if (player->driftlevel == 3) diff --git a/src/g_input.h b/src/g_input.h index 1cf4b2956..bed5beb0e 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -100,9 +100,10 @@ typedef enum gc_custom2, // Lua scriptable gc_custom3, // Lua scriptable gc_director, - gc_freecam, // Toggle for freecam while ingame - gc_camfloat, // alternative button for raising cam - gc_camsink, // alternative button for sinking + // freecam specific controls + gc_freecam, // Toggle for freecam while ingame + gc_camfloat, // alternative button for raising camera + gc_camsink, // alternative button for sinking camera gc_strafeleft, gc_straferight, num_gamecontrols @@ -112,10 +113,19 @@ typedef enum extern consvar_t cv_mousexsens, cv_mouseysens; extern consvar_t cv_controlperkey; extern consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS]; -extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS]; -extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS]; + extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble_strength[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble_spinout[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble_sneakerboost[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble_offroad[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble_bananadrag[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble_stairjank[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble_brakedrift[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_rumble_driftcharge[MAXSPLITSCREENPLAYERS]; + extern consvar_t cv_gamepadifunfocused; extern consvar_t cv_gamepadledifunfocused; extern consvar_t cv_rumbleifunfocused; diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index c01c59afc..9be30db07 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -3702,7 +3702,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite) wallVerts[1].z = baseWallVerts[2].z + (baseWallVerts[2].z - baseWallVerts[1].z) * heightmult; } - HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !(sprmo->frame & FF_FULLBRIGHT)); + HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !R_ThingIsFullBright(sprmo)); Surf.PolyColor.s.alpha = alpha; @@ -3756,7 +3756,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) if (!sprmo->subsector) return; - const boolean papersprite = (sprmo->frame & FF_PAPERSPRITE); + const boolean papersprite = R_ThingIsPaperSprite(sprmo); const sector_t *sector = sprmo->subsector->sector; if (sector->numlights) @@ -3915,7 +3915,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) INT32 shader = SHADER_NONE; - const precipmobj_t *sprmo = spr->precip; + precipmobj_t *sprmo = spr->precip; if (!sprmo->subsector) return; @@ -3961,11 +3961,10 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) if (sector->numlights) { - INT32 light; + // Always use the light at the top instead of whatever I was doing before + INT32 light = R_GetPlaneLight(sector, sprmo->z, false); // sprmo->z + sprmo->height - light = R_GetPlaneLight(sector, sprmo->z, false); // Always use the light at the top instead of whatever I was doing before - - if (!(sprmo->frame & FF_FULLBRIGHT)) + if (!R_PrecipThingIsFullBright(sprmo)) lightlevel = static_cast(*sector->lightlist[light].lightlevel); if (sector->lightlist[light].extra_colormap) @@ -3973,7 +3972,7 @@ static void HWR_DrawPrecipitationSprite(gl_vissprite_t *spr) } else { - if (!(sprmo->frame & FF_FULLBRIGHT)) + if (!R_PrecipThingIsFullBright(sprmo)) lightlevel = static_cast(sector->lightlevel); if (sector->extra_colormap) @@ -4557,7 +4556,7 @@ static void HWR_ProjectSprite(mobj_t *thing) return; } - const boolean papersprite = (thing->frame & FF_PAPERSPRITE); + const boolean papersprite = R_ThingIsPaperSprite(thing); // transform the origin point tr_x = FixedToFloat(interp.x); @@ -4571,8 +4570,8 @@ static void HWR_ProjectSprite(mobj_t *thing) return; const boolean mirrored = thing->mirrored; - const boolean vflip = (thing->eflags & MFE_VERTICALFLIP); - const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored); + const boolean vflip = R_ThingVerticallyFlipped(thing); + const boolean hflip = (!R_ThingHorizontallyFlipped(thing) != !mirrored); // decide which patch to use for sprite relative to player #ifdef RANGECHECK diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 4cb8a0a51..0f8328041 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1153,8 +1153,11 @@ void HWR_DrawMD2(gl_vissprite_t *spr) INT32 durs = spr->mobj->state->tics; INT32 tics = spr->mobj->tics; //mdlframe_t *next = NULL; + + //const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(spr->mobj)); // :chaosleep: const UINT8 flip = (UINT8)((spr->mobj->eflags & MFE_VERTICALFLIP) == MFE_VERTICALFLIP); - const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !(spr->mobj->frame & FF_HORIZONTALFLIP)); + const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !R_ThingHorizontallyFlipped(spr->mobj)); + spritedef_t *sprdef; spriteframe_t *sprframe; spriteinfo_t *sprinfo; diff --git a/src/i_tcp.c b/src/i_tcp.c index 0e6f23f2d..834b65a53 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -1721,6 +1721,7 @@ boolean I_InitTcpNetwork(void) hardware_MAXPACKETLENGTH = MAXPACKETLENGTH; } } + if (M_CheckProtoParam("ip")) { COM_ImmedExecute(va("exec \"%s"PATHSEP"kartexec.cfg\" -noerror\n", srb2home)); diff --git a/src/k_hud.c b/src/k_hud.c index 3dd36c95d..c5b166d36 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -3941,10 +3941,23 @@ static void K_drawBattleFullscreen(void) INT32 x = BASEVIDWIDTH/2; INT32 y = (-64*FRACUNIT) + cardanim; // card animation goes from 0 to 164, 164 is the middle of the screen - INT32 splitflags = V_SNAPTOTOP; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead + INT32 splitflags = splitscreen ? V_SNAPTOTOP : 0; // I don't feel like properly supporting non-green resolutions, so you can have a misuse of SNAPTO instead fixed_t scale = FRACUNIT; boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run. + // Small hack, if we're not in splitscreen we will not use V_SNAPTOTOP, instead we will just slightly offset + // y position so "attack or protect" doesn't slightly show before popping in + // We will also reduce this when is closer to finishing so when its at the bottom, the "hack offset" is 0 + if (!splitscreen) + { + fixed_t offset = ((vid.height - vid.dup*BASEVIDHEIGHT)/vid.dup) * FRACUNIT/2; + + // cardanim goes from 0 to 164, so when it is 164 offset will be multiplied by (1 - 164/164) = 0 :3 + offset = FixedMul(offset, FRACUNIT - FixedDiv(cardanim, 164*FRACUNIT)); + + y -= offset; + } + if (!LUA_HudEnabled(hud_battlecomebacktimer)) drawcomebacktimer = false; @@ -4032,12 +4045,12 @@ static void K_drawBattleFullscreen(void) if (K_UseColorHud()) // Colourized hud { UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE); - V_DrawFixedPatch(x<kartstuff[k_comebacktimer]/TICRATE)); + V_DrawKartString(x-txoff, ty, splitflags, va("%d", stplyr->kartstuff[k_comebacktimer]/TICRATE)); } } diff --git a/src/k_kart.c b/src/k_kart.c index 39961c1a9..44aa70377 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -34,7 +34,7 @@ // extra colourisation stuff -static CV_PossibleValue_t colorspeedlines_cons_t[] = {{0, "Off"}, {1, "Normal"}, {2, "+Driftcharge"}, {3, "Drift only"}, {0, NULL}}; +static CV_PossibleValue_t colorspeedlines_cons_t[] = {{0, "Off"}, {1, "On"}, {0, NULL}}; consvar_t cv_coloredspeedlines = {"colorizedspeedlines", "Off", CV_SAVE, colorspeedlines_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_coloredsneakertrail = {"sneakertrailcolor", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -3526,13 +3526,14 @@ static INT32 K_StairJankFlip(INT32 value) // if not cv_bananthrowroll option "+Onground" static void K_ResetBananaRollangle(mobj_t* mo) { - if (cv_bananthrowroll.value != 1) - return; - if (!mo->rollangle) return; - if (mo->type != MT_BANANA && mo->type != MT_EGGMANITEM) + if (mo->type != MT_BANANA && mo->type != MT_EGGMANITEM) // always reset eggboxes + return; + + // keep banans "rotated" if we want them to + if (mo->type == MT_BANANA && cv_bananthrowroll.value == 2) return; // only reset if on ground @@ -5485,59 +5486,15 @@ boolean K_PlayerEffectsShouldBlend(player_t *player) return false; } -static UINT8 K_GetSpeedLineColor(player_t *player, boolean colorSpeed) +FUNCINLINE static ATTRINLINE void K_SpawnNormalSpeedLines(player_t *player) { - UINT8 speedcolor = SKINCOLOR_NONE; - const UINT8 playercolor = player->mo->color; - - if (colorSpeed) - { - if (cv_coloredspeedlines.value != 3) - speedcolor = playercolor; - - if (cv_coloredspeedlines.value >= 2 && player->kartstuff[k_driftboost]) - { - if (player->kartstuff[k_driftboost] <= 20) - speedcolor = SKINCOLOR_SAPPHIRE; - else if (player->kartstuff[k_driftboost] <= 50) - speedcolor = SKINCOLOR_RASPBERRY; - else if (player->kartstuff[k_driftboost] <= 125) - speedcolor = K_RainbowColor(); - - if (cv_coloredspeedlines.value == 2) - speedcolor = (leveltime & 1) ? playercolor : speedcolor; - } - } - - if (cv_coloredspeedlines.value != 3) - { - if (player->kartstuff[k_eggmanexplode]) - { - // Make it red when you have the eggman speed boost - speedcolor = SKINCOLOR_RED; - } - else if (player->kartstuff[k_invincibilitytimer]) - { - speedcolor = playercolor; - } - } - - return speedcolor; -} - -typedef INT32 (*randomFunc)(INT32 min, INT32 max); - -FUNCINLINE static ATTRINLINE void K_SpawnNormalSpeedLines(player_t *player, boolean synched) -{ - const randomFunc randomfunc = synched ? P_RandomRange : M_RandomRange; - fixed_t rand_x; fixed_t rand_y; fixed_t rand_z; - rand_z = player->mo->z + (player->mo->height/2) + (randomfunc(-20,20) * player->mo->scale); - rand_y = player->mo->y + (randomfunc(-36,36) * player->mo->scale); - rand_x = player->mo->x + (randomfunc(-36,36) * player->mo->scale); + rand_z = player->mo->z + (player->mo->height/2) + (P_RandomRange(-20, 20) * player->mo->scale); + rand_y = player->mo->y + (P_RandomRange(-36, 36) * player->mo->scale); + rand_x = player->mo->x + (P_RandomRange(-36, 36) * player->mo->scale); mobj_t *fast = P_SpawnMobj(rand_x, rand_y, rand_z, MT_FASTLINE); @@ -5545,7 +5502,7 @@ FUNCINLINE static ATTRINLINE void K_SpawnNormalSpeedLines(player_t *player, bool fast->momx = 3*player->mo->momx/4; fast->momy = 3*player->mo->momy/4; fast->momz = 3*player->mo->momz/4; - fast->islocal = !synched; + //fast->islocal = false; P_SetTarget(&fast->target, player->mo); // easier lua access K_MatchGenericExtraFlags(fast, player->mo); @@ -5556,8 +5513,11 @@ FUNCINLINE static ATTRINLINE void K_SpawnNormalSpeedLines(player_t *player, bool if (cv_coloredspeedlines.value) { - fast->color = K_GetSpeedLineColor(player, colorSpeed); - fast->colorized = true; + if (colorSpeed || player->kartstuff[k_invincibilitytimer]) // let invul color them even when players go rather slow + { + fast->color = player->mo->color; + fast->colorized = true; + } } if (colorSpeed && K_PlayerEffectsShouldBlend(player)) @@ -5586,11 +5546,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) // Speed lines if ((player->kartstuff[k_sneakertimer] || player->kartstuff[k_driftboost] || player->kartstuff[k_startboost]) && player->speed > 0) { - K_SpawnNormalSpeedLines(player, true); - } - else if ((cv_coloredspeedlines.value == 1 || cv_coloredspeedlines.value == 2) && player->kartstuff[k_eggmanexplode]) // gotta love the speedlines calling synched rng :chaosleep: - { - K_SpawnNormalSpeedLines(player, false); + K_SpawnNormalSpeedLines(player); } if (player->playerstate == PST_DEAD || player->kartstuff[k_respawn] > 1) // Ensure these are set correctly here diff --git a/src/lua_baselib.c b/src/lua_baselib.c index bc94e2949..d24b88c51 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3055,58 +3055,44 @@ static int lib_kSetHyuCountdown(lua_State *L) static int lib_gSetPlayerGamepadIndicatorColor(lua_State *L) { - INT32 player = -1; - player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player + INT32 pnum = -1; + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player UINT8 color = (UINT8)luaL_checkinteger(L, 2); // skincolor - if (!plr) + if (!player) return LUA_ErrInvalid(L, "player_t"); if (color >= MAXTRANSLATIONS) return luaL_error(L, "color %d out of range (0 - %d).", color, MAXTRANSLATIONS-1); - for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i) - { - if (plr - players == displayplayers[i]) - { - player = i; - break; - } - } + pnum = P_GetLocalPlayerNumForPlayer(player); // Not a local player - if (player == -1) return 0; + if (pnum == -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); + G_SetPlayerGamepadIndicatorColor(pnum, color); return 0; } static int lib_gPlayerDeviceRumble(lua_State *L) { - INT32 player = -1; - player_t *plr = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player + INT32 pnum = -1; + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player UINT16 low_strength = (UINT16)luaL_checkinteger(L, 2); // low frequency rumble motor strenght UINT16 high_strength = (UINT16)luaL_checkinteger(L, 3); // high frequency rumble motor strenght UINT32 duration = (UINT32)luaL_optinteger(L, 4, 84); // duration of rumble in ms - if (!plr) + if (!player) return LUA_ErrInvalid(L, "player_t"); - for (int i = 0; i < MAXSPLITSCREENPLAYERS; ++i) - { - if (plr - players == displayplayers[i]) - { - player = i; - break; - } - } + pnum = P_GetLocalPlayerNumForPlayer(player); // Not a local player - if (player == -1) return 0; + if (pnum == -1) return 0; - G_PlayerDeviceRumble(player, low_strength, high_strength, duration); + G_PlayerDeviceRumble(pnum, low_strength, high_strength, duration); return 0; } diff --git a/src/m_menudefs.c b/src/m_menudefs.c index 4da3c7ea7..23557b8c4 100644 --- a/src/m_menudefs.c +++ b/src/m_menudefs.c @@ -36,6 +36,7 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef; menu_t OP_ControlsDef, OP_AllControlsDef; menu_t OP_MouseOptionsDef; menu_t OP_Joystick1Def, OP_Joystick2Def, OP_Joystick3Def, OP_Joystick4Def; +menu_t OP_Joystick1RumbleDef, OP_Joystick2RumbleDef, OP_Joystick3RumbleDef, OP_Joystick4RumbleDef; // Custom cvar menu menu_t OP_CustomCvarMenuDef; @@ -725,6 +726,14 @@ static const char* OP_AllControlsTooltips[sizeof(OP_AllControlsMenu)/sizeof(OP_A // The rest is null, for now }; +// i really do not feel like messing with setup routines +// and macro preprocessor cannot eval maths for string shit like this :chaosleep: +#define RUMBDEF_0 OP_Joystick1RumbleDef +#define RUMBDEF_1 OP_Joystick2RumbleDef +#define RUMBDEF_2 OP_Joystick3RumbleDef +#define RUMBDEF_3 OP_Joystick4RumbleDef +#define RUMBDEF(x) RUMBDEF_##x + #define OP_JOYMENU(pnum) \ {IT_HEADER, NULL, "Gameplay Controls", NULL, 7}, \ {IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[pnum] , 15}, \ @@ -745,9 +754,8 @@ static const char* OP_AllControlsTooltips[sizeof(OP_AllControlsMenu)/sizeof(OP_A {IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone[pnum] , 100}, \ {IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone[pnum] , 105}, \ {IT_HEADER, NULL, "Miscellaneous", NULL, 112}, \ - {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[pnum] , 120}, \ - {IT_STRING | IT_CVAR, NULL, "Controller Rumble Strength" , &cv_rumblestrength[pnum] , 125}, \ - {IT_STRING | IT_CVAR, NULL, "Set LED to Player color" , &cv_gamepadled[pnum] , 130}, + {IT_SUBMENU|IT_STRING, NULL, "Rumble Options..." , &RUMBDEF(pnum) , 120}, \ + {IT_STRING | IT_CVAR, NULL, "Set LED to Player color" , &cv_gamepadled[pnum] , 125}, static menuitem_t OP_Joystick1Menu[] = { @@ -773,6 +781,46 @@ static menuitem_t OP_Joystick4Menu[] = OP_JOYMENU(3) }; +#undef RUMBDEF +#undef RUMBDEF_0 +#undef RUMBDEF_1 +#undef RUMBDEF_2 +#undef RUMBDEF_3 + +// FIXME: stair jank rumble should be greyed out if its disabled, but menus suck butt! +#define OP_JOYRUMBLEMENU(pnum) \ + {IT_HEADER, NULL, "Global", NULL, 7}, \ + {IT_STRING | IT_CVAR, NULL, "Controller Rumble" , &cv_rumble[pnum] , 15}, \ + {IT_STRING | IT_CVAR, NULL, "Controller Rumble Strength" , &cv_rumble_strength[pnum] , 20}, \ + {IT_HEADER, NULL, "Rumble Types", NULL, 27}, \ + {IT_STRING | IT_CVAR, NULL, "Spinout" , &cv_rumble_spinout[pnum] , 35}, \ + {IT_STRING | IT_CVAR, NULL, "Sneaker Boost" , &cv_rumble_sneakerboost[pnum] , 40}, \ + {IT_STRING | IT_CVAR, NULL, "Offroad" , &cv_rumble_offroad[pnum] , 45}, \ + {IT_STRING | IT_CVAR, NULL, "Banana Dragging" , &cv_rumble_bananadrag[pnum] , 50}, \ + {IT_STRING | IT_CVAR, NULL, "Stair Jank" , &cv_rumble_stairjank[pnum] , 55}, \ + {IT_STRING | IT_CVAR, NULL, "Brake Drift" , &cv_rumble_brakedrift[pnum] , 60}, \ + {IT_STRING | IT_CVAR, NULL, "Drift Charge" , &cv_rumble_driftcharge[pnum] , 65}, \ + +static menuitem_t OP_Joystick1RumbleMenu[] = +{ + OP_JOYRUMBLEMENU(0) +}; + +static menuitem_t OP_Joystick2RumbleMenu[] = +{ + OP_JOYRUMBLEMENU(1) +}; + +static menuitem_t OP_Joystick3RumbleMenu[] = +{ + OP_JOYRUMBLEMENU(2) +}; + +static menuitem_t OP_Joystick4RumbleMenu[] = +{ + OP_JOYRUMBLEMENU(3) +}; + static menuitem_t OP_JoystickSetMenu[] = { {IT_CALL | IT_NOTHING, "None", NULL, M_AssignJoystick, LINEHEIGHT+5}, @@ -2530,6 +2578,11 @@ menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 30, 36, NULL); menu_t OP_Joystick4Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 30, 36, NULL); +menu_t OP_Joystick1RumbleDef = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1RumbleMenu, &OP_Joystick1Def, 30, 36, NULL); +menu_t OP_Joystick2RumbleDef = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2RumbleMenu, &OP_Joystick2Def, 30, 36, NULL); +menu_t OP_Joystick3RumbleDef = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3RumbleMenu, &OP_Joystick3Def, 30, 36, NULL); +menu_t OP_Joystick4RumbleDef = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick4RumbleMenu, &OP_Joystick4Def, 30, 36, NULL); + menu_t OP_JoystickSetDef = { "M_CONTRO", diff --git a/src/p_mobj.c b/src/p_mobj.c index 02e1e1bc6..14ba3a93d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7184,6 +7184,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) { boolean grounded = P_IsObjectOnGround(mobj); + // rotate thrown eggboxes and bananas mid air! if (cv_bananthrowroll.value && !grounded) { // tilt n tumble @@ -7204,7 +7205,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj) mobj->health = 1; } - P_RollPitchMobj(mobj); + // do not rotate eggman items on slopes + // they are meant to deceive the player + // having them rotated makes them stand out a lot more + // since random items do not roll“n pitch on slopes! + if (mobj->type == MT_BANANA) + P_RollPitchMobj(mobj); if (mobj->threshold > 0) mobj->threshold--; diff --git a/src/r_main.cpp b/src/r_main.cpp index 038fa8a6a..d2b6eed65 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -411,7 +411,7 @@ angle_t R_PlayerSliptideAngle(player_t *player) if (!sprframe) return 0; - if (sprframe->rotate != SRF_SINGLE || (mo->frame & FF_PAPERSPRITE)) + if (sprframe->rotate != SRF_SINGLE || R_ThingIsPaperSprite(mo)) ang = R_PointToAngle(mo->x, mo->y) - mo->angle; return FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), mo->player->sliproll * mo->player->kartstuff[k_aizdriftstrat]); diff --git a/src/r_things.cpp b/src/r_things.cpp index bc01c4cc8..ee517c11f 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -1241,9 +1241,9 @@ static void R_ProjectSprite(mobj_t *thing) return; const boolean mirrored = thing->mirrored; - const boolean vflip = (thing->eflags & MFE_VERTICALFLIP); - const boolean hflip = (!(thing->frame & FF_HORIZONTALFLIP) != !mirrored); - const boolean papersprite = (thing->frame & FF_PAPERSPRITE); + const boolean vflip = R_ThingVerticallyFlipped(thing); + const boolean hflip = (!R_ThingHorizontallyFlipped(thing) != !mirrored); + const boolean papersprite = R_ThingIsPaperSprite(thing); // transform the origin point tr_x = interp.x - viewx; @@ -3022,11 +3022,37 @@ boolean R_CheckMobjInterpDist(mobj_t *thing) return R_CheckInterpDist(thing); } -boolean R_ThingIsFullBright(mobj_t *thing) +boolean R_ThingHorizontallyFlipped(mobj_t *thing) +{ + return (thing->frame & FF_HORIZONTALFLIP); +} + +boolean R_ThingVerticallyFlipped(mobj_t *thing) +{ + return (thing->eflags & MFE_VERTICALFLIP); //(thing->frame & FF_VERTICALFLIP); +} + +boolean R_ThingIsPaperSprite(mobj_t *thing) +{ + return (thing->frame & FF_PAPERSPRITE); +} + +template +static boolean R_ThingIsFullBrightT(T *thing) { return ((thing->frame & FF_BRIGHTMASK) == FF_FULLBRIGHT); } +boolean R_PrecipThingIsFullBright(precipmobj_t *thing) +{ + return R_ThingIsFullBrightT(thing); +} + +boolean R_ThingIsFullBright(mobj_t *thing) +{ + return R_ThingIsFullBrightT(thing); +} + boolean R_ThingIsSemiBright(mobj_t *thing) { return ((thing->frame & FF_BRIGHTMASK) == FF_SEMIBRIGHT); diff --git a/src/r_things.h b/src/r_things.h index e8e30ca6b..bde0ad592 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -88,6 +88,11 @@ boolean R_CheckPrecipMobjInterpDist(precipmobj_t *thing); boolean R_CheckMobjInterpDist(mobj_t *thing); fixed_t R_DoPlayerFade(mobj_t *thing); +boolean R_ThingHorizontallyFlipped(mobj_t *thing); +boolean R_ThingVerticallyFlipped(mobj_t *thing); +boolean R_ThingIsPaperSprite(mobj_t *thing); + +boolean R_PrecipThingIsFullBright(precipmobj_t *thing); boolean R_ThingIsFullBright(mobj_t *thing); boolean R_ThingIsSemiBright(mobj_t *thing); boolean R_ThingIsFullDark(mobj_t *thing); diff --git a/src/s_sound.c b/src/s_sound.c index 050b2c932..0a81764c7 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1297,9 +1297,7 @@ static boolean ReadMusicDefFields(UINT16 wadnum, int line, char *stoken, musicde if (!value) { - CONS_Alert(CONS_WARNING, - "MUSICDEF: Field '%s' is missing name. (file %s, line %d)\n", - stoken, wadfiles[wadnum]->filename, line); + CONS_Alert(CONS_WARNING, "MUSICDEF: Field '%s' is missing name. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line); (void)strtok(NULL, " "); return true; } @@ -1332,9 +1330,7 @@ static boolean ReadMusicDefFields(UINT16 wadnum, int line, char *stoken, musicde if (!value) { - CONS_Alert(CONS_WARNING, - "MUSICDEF: Field '%s' is missing value. (file %s, line %d)\n", - stoken, wadfiles[wadnum]->filename, line); + CONS_Alert(CONS_WARNING, "MUSICDEF: Field '%s' is missing value. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line); (void)strtok(NULL, " "); return true; } @@ -1344,9 +1340,7 @@ static boolean ReadMusicDefFields(UINT16 wadnum, int line, char *stoken, musicde if (!def) { - CONS_Alert(CONS_ERROR, - "MUSICDEF: No music definition before field '%s'. (file %s, line %d)\n", - stoken, wadfiles[wadnum]->filename, line); + CONS_Alert(CONS_ERROR, "MUSICDEF: No music definition before field '%s'. (file %s, line %d)\n", stoken, wadfiles[wadnum]->filename, line); return false; } @@ -1360,9 +1354,12 @@ static boolean ReadMusicDefFields(UINT16 wadnum, int line, char *stoken, musicde // turn _ into spaces. #define ADDDEF(field)\ + int err = 0;\ STRBUFCPY(def->field, textline);\ - for (textline = def->field; *textline; textline++)\ - if (*textline == '_') *textline = ' '; + for (textline = def->field; *textline; textline++) {\ + if (err == 0 && *textline == ' ') {err = 1; CONS_Alert(CONS_WARNING, "MUSICDEF: Erroneous whitespace detected in field '%s': '%s'.\n(file %s, line %d) Musicdef might not work correctly!\n", stoken, def->field, wadfiles[wadnum]->filename, line);}\ + if (*textline == '_') *textline = ' ';\ + } if (fasticmp(stoken, "usage")) { diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index c736330ad..c6554c2b9 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1816,15 +1816,18 @@ void I_StartupGraphics(void) framebuffer = SDL_TRUE; } + // Choose Software renderer if (M_CheckParm("-software")) rendermode = render_soft; #ifdef HWRENDER + // Choose OpenGL renderer else if (M_CheckParm("-opengl")) rendermode = render_opengl; msaa = 0; boolean msaa_set = false; a2c = false; boolean a2c_set = false; + // MSAA antialiasing if (M_CheckParm("-msaa") && M_IsNextParm()) { const char* str = M_GetNextParm(); diff --git a/src/v_video.c b/src/v_video.c index 2ac659ba6..fc84a0cdc 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1563,8 +1563,8 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) { // mpc 12-04-2018 const UINT8 *fadetable = ((UINT8 *)transtables + ((alphalevel-1)<y) ? y : x - w = clip(w,vid.width); - h = clip(h,vid.height); + w = clip(w, vid.width); + h = clip(h, vid.height); #undef clip for (v = 0; v < h; v++, dest += vid.width) {