From 9a1296702031a15b5a69ef0c5d8b99729622d8e0 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 17 Feb 2019 23:39:00 +0100 Subject: [PATCH 01/21] Expose battlefullscreen and battlecomebacktimer huds to lua --- src/k_kart.c | 18 +++++++++++++++--- src/lua_hud.h | 2 ++ src/lua_hudlib.c | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b006ae3bb..39da4a229 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7838,6 +7838,11 @@ static void K_drawBattleFullscreen(void) INT32 y = -64+(stplyr->kartstuff[k_cardanimation]); // 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 fixed_t scale = FRACUNIT; + boolean drawcomebacktimer = true; // lazy hack because it's cleaner in the long run. +#ifdef HAVE_BLUA + if (!LUA_HudEnabled(hud_battlecomebacktimer)) + drawcomebacktimer = false; +#endif if (splitscreen) { @@ -7889,7 +7894,7 @@ static void K_drawBattleFullscreen(void) else K_drawKartFinish(); } - else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator) + else if (stplyr->kartstuff[k_bumper] <= 0 && stplyr->kartstuff[k_comebacktimer] && comeback && !stplyr->spectator && drawcomebacktimer) { UINT16 t = stplyr->kartstuff[k_comebacktimer]/(10*TICRATE); INT32 txoff, adjust = (splitscreen > 1) ? 4 : 6; // normal string is 8, kart string is 12, half of that for ease @@ -8449,8 +8454,15 @@ void K_drawKartHUD(void) if (battlefullscreen) { - K_drawBattleFullscreen(); - return; +#ifdef HAVE_BLUA + if (LUA_HudEnabled(hud_battlefullscreen)) + { +#endif + K_drawBattleFullscreen(); + return; +#ifdef HAVE_BLUA + } // yes we legit checked if we had lua to close a single bracket. Not my proudest code edit tbh. +#endif } // Draw the item window diff --git a/src/lua_hud.h b/src/lua_hud.h index 4fbbbace4..88d7fd6bc 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -21,6 +21,8 @@ enum hud { hud_position, hud_minirankings, // Rankings to the left hud_battlebumpers, // mini rankings battle bumpers. + hud_battlefullscreen, // battle huge text (WAIT, WIN, LOSE ...) + karma comeback time + hud_battlecomebacktimer, // comeback timer in battlefullscreen. separated for ease of use. hud_wanted, hud_speedometer, hud_freeplay, diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index cd8e03923..e0a360ade 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -48,6 +48,8 @@ static const char *const hud_disable_options[] = { "position", "minirankings", // Gametype rankings to the left "battlerankingsbumpers", // bumper drawer for battle. Useful if you want to make a custom battle gamemode without bumpers being involved. + "battlefullscreen", // battlefullscreen func (WAIT, ATTACK OR PROTECT ...) + "battlecomebacktimer", // come back timer in battlefullscreen "wanted", "speedometer", "freeplay", From cd4b9abb7897b03f53caa58b5aa3ae86c9c297a2 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 12 May 2019 14:17:56 +0200 Subject: [PATCH 02/21] SPB intangibility --- src/p_enemy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/p_enemy.c b/src/p_enemy.c index bf1cacdc7..7963286d2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8355,6 +8355,7 @@ void A_SPBChase(mobj_t *actor) actor->lastlook = -1; spbplace = -1; P_InstaThrust(actor, actor->angle, wspeed); + actor->flags &= ~MF_NOCLIPTHING; // just in case. return; } @@ -8384,6 +8385,10 @@ void A_SPBChase(mobj_t *actor) { if (actor->tracer && actor->tracer->health) { + + // we're tailing a player, now's a good time to regain our damage properties + actor->flags &= ~MF_NOCLIPTHING; + fixed_t defspeed = wspeed; fixed_t range = (160*actor->tracer->scale); fixed_t cx = 0, cy =0; @@ -8515,6 +8520,9 @@ void A_SPBChase(mobj_t *actor) { actor->momx = actor->momy = actor->momz = 0; // Stoooop + // don't hurt players that have nothing to do with this: + actor->flags |= MF_NOCLIPTHING; + if (actor->lastlook != -1 && playeringame[actor->lastlook] && !players[actor->lastlook].spectator @@ -8550,6 +8558,10 @@ void A_SPBChase(mobj_t *actor) } // Found someone, now get close enough to initiate the slaughter... + + // don't hurt players that have nothing to do with this: + actor->flags |= MF_NOCLIPTHING; + P_SetTarget(&actor->tracer, player->mo); spbplace = bestrank; From 1c52319d08c758a8c617a464b6702194026d3ab8 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Tue, 14 May 2019 22:29:28 -0500 Subject: [PATCH 03/21] More credits updates --- src/f_finale.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 19a7b8c98..2bf5c7438 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -438,6 +438,7 @@ static const char *credits[] = { "", "\1Support Programming", "Colette \"fickleheart\" Bordelon", + "James R.", "\"Lat\'\"", "\"Monster Iestyn\"", "\"Shuffle\"", @@ -501,13 +502,18 @@ static const char *credits[] = { "\"DrTapeworm\"", "Paul \"Boinciel\" Clempson", "Sherman \"CoatRack\" DesJardins", + "Colette \"fickleheart\" Bordelon", "Vivian \"toaster\" Grannell", "James \"SeventhSentinel\" Hall", "\"Lat\'\"", + "\"MK\"", + "\"Ninferno\"", "Sean \"Sryder\" Ryder", "\"Ryuspark\"", "\"Simsmagic\"", "\"SP47\"", + "\"TG\"", + "\"Victor Rush Turbo\"", "\"ZarroTsu\"", "", "\1Testing", @@ -560,7 +566,7 @@ static struct { // This Tyler52 gag is troublesome // Alignment should be ((spaces+1 * 100) + (headers+1 * 38) + (lines * 15)) // Current max image spacing: (200*17) - {112, (15*100)+(17*38)+(72*15), "TYLER52", SKINCOLOR_NONE}, + {112, (15*100)+(17*38)+(86*15), "TYLER52", SKINCOLOR_NONE}, {0, 0, NULL, SKINCOLOR_NONE} }; From 519a2893737b9b6a29f41d71261fd713857b9590 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Fri, 17 May 2019 08:06:18 -0500 Subject: [PATCH 04/21] Fix the permanent instashield bug --- src/k_kart.c | 2 +- src/p_user.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 526564a6f..43c6c7cc8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4574,7 +4574,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) { player->powers[pw_flashing] = K_GetKartFlashing(player); } - else if (player->powers[pw_flashing] == K_GetKartFlashing(player)) + else if (player->powers[pw_flashing] >= K_GetKartFlashing(player)) { player->powers[pw_flashing]--; } diff --git a/src/p_user.c b/src/p_user.c index 61d8f36f3..a9ea84432 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8495,8 +8495,8 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_invulnerability] && player->powers[pw_invulnerability] < UINT16_MAX) player->powers[pw_invulnerability]--; - if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && ((player->pflags & PF_NIGHTSMODE) - || (player->spectator || player->powers[pw_flashing] < K_GetKartFlashing(player)))) + if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && + (player->spectator || player->powers[pw_flashing] < K_GetKartFlashing(player))) player->powers[pw_flashing]--; if (player->powers[pw_tailsfly] && player->powers[pw_tailsfly] < UINT16_MAX /*&& player->charability != CA_SWIM*/ && !(player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) // tails fly counter From e1451b7a985a42687f00cfc5c38c96a1049fc2cd Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 22 May 2019 22:45:32 -0700 Subject: [PATCH 05/21] Acknowledge fallback models as an OGL option indeed (You may also be able to actually read that code too.) --- src/m_menu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 52a73b601..cf9f649ac 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1270,6 +1270,7 @@ enum op_video_vsync, #ifdef HWRENDER op_video_md2, + op_video_kartman, op_video_ogl, #endif }; @@ -3334,7 +3335,9 @@ void M_Init(void) #ifdef HWRENDER // Permanently hide some options based on render mode if (rendermode == render_soft) - OP_VideoOptionsMenu[op_video_ogl].status = OP_VideoOptionsMenu[op_video_md2].status = IT_DISABLED; + OP_VideoOptionsMenu[op_video_ogl].status = + OP_VideoOptionsMenu[op_video_kartman].status = + OP_VideoOptionsMenu[op_video_md2] .status = IT_DISABLED; #endif #ifndef NONET From 38360f29ec1bccce2adfbc7b039075e38ac6988f Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 22 May 2019 23:16:20 -0700 Subject: [PATCH 06/21] Move FOV option out of OGL options --- src/m_menu.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index cf9f649ac..9b5e98e44 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1244,14 +1244,15 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Weather Draw Distance",&cv_drawdist_precip, 55}, //{IT_STRING | IT_CVAR, NULL, "Weather Density", &cv_precipdensity, 65}, {IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 65}, + {IT_STRING | IT_CVAR, NULL, "Field of View", &cv_fov, 75}, - {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 80}, - {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 90}, + {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 90}, + {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 100}, #ifdef HWRENDER - {IT_STRING | IT_CVAR, NULL, "3D models", &cv_grmdls, 105}, - {IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 115}, - {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 125}, + {IT_STRING | IT_CVAR, NULL, "3D models", &cv_grmdls, 115}, + {IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 125}, + {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 135}, #endif }; @@ -1266,6 +1267,7 @@ enum op_video_wdd, //op_video_wd, op_video_skybox, + op_video_fov, op_video_fps, op_video_vsync, #ifdef HWRENDER @@ -1286,10 +1288,9 @@ static menuitem_t OP_OpenGLOptionsMenu[] = {IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 10}, {IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 20}, - {IT_STRING|IT_CVAR, NULL, "Field of View", &cv_fov, 35}, - {IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 45}, - {IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 55}, - {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 65}, + {IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 35}, + {IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 45}, + {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 55}, /*#ifdef _WINDOWS {IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 50}, #endif From ccd0ec96a45f6d92bff2db11ca6da2d03ca51b5c Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 25 May 2019 13:08:38 +0200 Subject: [PATCH 07/21] let angle be changed while spun out and boosting --- src/d_player.h | 1 + src/g_game.c | 7 +++---- src/k_kart.c | 8 ++++++++ src/p_user.c | 8 +++++--- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index c6a7f0f34..114674ff5 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -273,6 +273,7 @@ typedef enum k_boostpower, // Base boost value, for offroad k_speedboost, // Boost value smoothing for max speed k_accelboost, // Boost value smoothing for acceleration + k_boostangle, // angle set when not spun out OR boosted to determine what direction you should keep going at if you're spun out and boosted. k_boostcam, // Camera push forward on boost k_destboostcam, // Ditto k_timeovercam, // Camera timer for leaving behind or not diff --git a/src/g_game.c b/src/g_game.c index 5aa3edbbd..f29c97874 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1253,7 +1253,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) player = &players[consoleplayer]; else player = &players[displayplayers[ssplayer-1]]; - + if (ssplayer == 2) thiscam = (player->bot == 2 ? &camera[0] : &camera[ssplayer-1]); else @@ -1558,8 +1558,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (((player->mo && player->speed > 0) // Moving || (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn || (player->kartstuff[k_respawn]) // Respawning - || (player->spectator || objectplacing)) // Not a physical player - && !(player->kartstuff[k_spinouttimer] && player->kartstuff[k_sneakertimer])) // Spinning and boosting cancels out turning + || (player->spectator || objectplacing))) // Not a physical player lang += (cmd->angleturn<<16); cmd->angleturn = (INT16)(lang >> 16); @@ -3274,7 +3273,7 @@ const char *Gametype_Names[NUMGAMETYPES] = { "Race", // GT_RACE "Battle" // GT_MATCH - + /*"Co-op", // GT_COOP "Competition", // GT_COMPETITION "Team Match", // GT_TEAMMATCH diff --git a/src/k_kart.c b/src/k_kart.c index 43c6c7cc8..6eeb091c7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3541,6 +3541,9 @@ void K_DoSneaker(player_t *player, INT32 type) player->kartstuff[k_sneakertimer] = sneakertime; + // set angle for spun out players: + player->kartstuff[k_boostangle] = (INT32)player->mo->angle; + if (type != 0) { player->pflags |= PF_ATTACKDOWN; @@ -4469,6 +4472,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) { K_UpdateOffroad(player); K_UpdateEngineSounds(player, cmd); // Thanks, VAda! + + // update boost angle if not spun out + if (!player->kartstuff[k_spinouttimer] && !player->kartstuff[k_wipeoutslow]) + player->kartstuff[k_boostangle] = (INT32)player->mo->angle; + K_GetKartBoostPower(player); // Speed lines diff --git a/src/p_user.c b/src/p_user.c index a9ea84432..0b938b0b0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4054,6 +4054,8 @@ static void P_3dMovement(player_t *player) { if (player->kartstuff[k_drift] != 0) movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift]; + else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle + movepushangle = (angle_t)player->kartstuff[k_boostangle]; else movepushangle = player->mo->angle; } @@ -5780,7 +5782,7 @@ static void P_MovePlayer(player_t *player) || (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn || (player->kartstuff[k_respawn]) // Respawning || (player->spectator || objectplacing)) // Not a physical player - && !(player->kartstuff[k_spinouttimer] && player->kartstuff[k_sneakertimer])) // Spinning and boosting cancels out turning + ) // ~~Spinning and boosting cancels out turning~~ Not anymore given spinout is more slippery and more prone to get you killed because of boosters. { player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1; player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1; @@ -7377,7 +7379,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (P_CameraThinker(player, thiscam, resetcalled)) return true; - + if (thiscam == &camera[1]) // Camera 2 { num = 1; @@ -8495,7 +8497,7 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_invulnerability] && player->powers[pw_invulnerability] < UINT16_MAX) player->powers[pw_invulnerability]--; - if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && + if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && (player->spectator || player->powers[pw_flashing] < K_GetKartFlashing(player))) player->powers[pw_flashing]--; From 8628a543a5910a7c18515bb7157b08b503cba794 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 25 May 2019 13:51:19 +0200 Subject: [PATCH 08/21] give friction to brakes --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 43c6c7cc8..d96e092ba 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5778,8 +5778,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392) player->mo->friction += 4608; - if (player->speed > 0 && cmd->forwardmove < 0 && player->mo->friction == 59392) - player->mo->friction += 1608; + if (player->speed > 0 && cmd->forwardmove < 0) // change friction while braking no matter what, otherwise it's not any more effective than just letting go off accel + player->mo->friction -= 2048; } // Karma ice physics From cb8af8eb9594ae75d1eaa7528e6133807bc2fcca Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 25 May 2019 14:11:26 +0200 Subject: [PATCH 09/21] add k_booostangle to dehacked --- src/dehacked.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dehacked.c b/src/dehacked.c index 7b1b321d7..b311a860c 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8391,6 +8391,7 @@ static const char *const KARTSTUFF_LIST[] = { "BOOSTPOWER", "SPEEDBOOST", "ACCELBOOST", + "BOOSTANGLE", "BOOSTCAM", "DESTBOOSTCAM", "TIMEOVERCAM", From d97a0ce2b4e30cdb92714048d61c9427ae1bb695 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sat, 25 May 2019 14:13:35 +0200 Subject: [PATCH 10/21] Move the friction change out of the offroad check --- src/k_kart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d96e092ba..e17d45dfb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5778,10 +5778,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392) player->mo->friction += 4608; - if (player->speed > 0 && cmd->forwardmove < 0) // change friction while braking no matter what, otherwise it's not any more effective than just letting go off accel - player->mo->friction -= 2048; } + if (player->speed > 0 && cmd->forwardmove < 0) // change friction while braking no matter what, otherwise it's not any more effective than just letting go off accel + player->mo->friction -= 2048; + // Karma ice physics if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) { From ba3e682e0e91a86be557ec6ce0e62345847c2298 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 26 May 2019 11:19:26 +0200 Subject: [PATCH 11/21] fix banana's SpinPlayer using the wrong inflictor --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 2c766349d..fd1047daa 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1076,7 +1076,7 @@ static boolean PIT_CheckThing(mobj_t *thing) S_StartSound(tmthing, sfx_bsnipe); // Player Damage - K_SpinPlayer(tmthing->player, thing->target, 0, tmthing, (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD)); + K_SpinPlayer(tmthing->player, thing->target, 0, thing, (thing->type == MT_BANANA || thing->type == MT_BANANA_SHIELD)); // Other Item Damage if (thing->eflags & MFE_VERTICALFLIP) From 1bcebaadfd8ba5dfb0fc30471de1c2f35f11605b Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Sun, 26 May 2019 15:05:10 +0200 Subject: [PATCH 12/21] Lua fixes + new drawOnMinimap function --- src/k_kart.c | 8 +-- src/lua_hudlib.c | 174 +++++++++++++++++++++++++++++++++++++++++++++++ src/p_map.c | 2 +- src/p_user.c | 4 +- 4 files changed, 181 insertions(+), 7 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index e32295ad6..fc1552296 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8184,7 +8184,7 @@ static void K_drawBattleFullscreen(void) #ifdef HAVE_BLUA if (!LUA_HudEnabled(hud_battlecomebacktimer)) drawcomebacktimer = false; -#endif +#endif if (splitscreen) { @@ -8796,13 +8796,13 @@ void K_drawKartHUD(void) { #ifdef HAVE_BLUA if (LUA_HudEnabled(hud_battlefullscreen)) - { -#endif + { +#endif K_drawBattleFullscreen(); return; #ifdef HAVE_BLUA } // yes we legit checked if we had lua to close a single bracket. Not my proudest code edit tbh. -#endif +#endif } // Draw the item window diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 3a72a32d3..22c89a234 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -383,6 +383,179 @@ static int libd_drawScaled(lua_State *L) return 0; } +// KART: draw patch on minimap from x, y coordinates on the map +static int libd_drawOnMinimap(lua_State *L) +{ + fixed_t x, y, scale; // coordinates of the object + patch_t *patch; // patch we want to draw + const UINT8 *colormap = NULL; // do we want to colormap this patch? + boolean centered; // the patch is centered and doesn't need readjusting on x/y coordinates. + + // variables used to replicate k_kart's mmap drawer: + INT32 lumpnum; + patch_t *AutomapPic; + INT32 mx, my; + INT32 splitflags, minimaptrans; + + // base position of the minimap which also takes splits into account: + INT32 MM_X, MM_Y; + + // variables used for actually drawing the icon: + fixed_t amnumxpos, amnumypos; + INT32 amxpos, amypos; + + node_t *bsp = &nodes[numnodes-1]; + fixed_t maxx, minx, maxy, miny; + + fixed_t mapwidth, mapheight; + fixed_t xoffset, yoffset; + fixed_t xscale, yscale, zoom; + fixed_t patchw, patchh; + + HUDONLY // only run this function in hud hooks + x = luaL_checkinteger(L, 1); + y = luaL_checkinteger(L, 2); + scale = luaL_checkinteger(L, 3); + patch = *((patch_t **)luaL_checkudata(L, 4, META_PATCH)); + if (!lua_isnoneornil(L, 5)) + colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP)); + centered = lua_optboolean(L, 6); + + // replicate exactly what source does for its minimap drawer; AKA hardcoded garbo. + + // first, check what position the mmap is supposed to be in (pasted from k_kart.c): + MM_X = BASEVIDWIDTH - 50; // 270 + MM_Y = (BASEVIDHEIGHT/2)-16; // 84 + if (splitscreen) + { + MM_Y = (BASEVIDHEIGHT/2); + if (splitscreen > 1) // 3P : bottom right + { + MM_X = (3*BASEVIDWIDTH/4); + MM_Y = (3*BASEVIDHEIGHT/4); + + if (splitscreen > 2) // 4P: centered + { + MM_X = (BASEVIDWIDTH/2); + MM_Y = (BASEVIDHEIGHT/2); + } + } + } + + // splitscreen flags + splitflags = (splitscreen == 3 ? 0 : V_SNAPTORIGHT); // flags should only be 0 when it's centered (4p split) + + // translucency: + if (timeinmap > 105) + { + minimaptrans = cv_kartminimap.value; + if (timeinmap <= 113) + minimaptrans = ((((INT32)timeinmap) - 105)*minimaptrans)/(113-105); + if (!minimaptrans) + return 0; + } + else + return 0; + + + minimaptrans = ((10-minimaptrans)<width/2); + my = MM_Y - (AutomapPic->height/2); + + // let offsets transfer to the heads, too! + if (encoremode) + mx += SHORT(AutomapPic->leftoffset); + else + mx -= SHORT(AutomapPic->leftoffset); + my -= SHORT(AutomapPic->topoffset); + + // now that we have replicated this behavior, we can draw an icon from our supplied x, y coordinates by replicating k_kart.c's totally understandable uncommented code!!! + + // get map boundaries using nodes + maxx = maxy = INT32_MAX; + minx = miny = INT32_MIN; + minx = bsp->bbox[0][BOXLEFT]; + maxx = bsp->bbox[0][BOXRIGHT]; + miny = bsp->bbox[0][BOXBOTTOM]; + maxy = bsp->bbox[0][BOXTOP]; + + if (bsp->bbox[1][BOXLEFT] < minx) + minx = bsp->bbox[1][BOXLEFT]; + if (bsp->bbox[1][BOXRIGHT] > maxx) + maxx = bsp->bbox[1][BOXRIGHT]; + if (bsp->bbox[1][BOXBOTTOM] < miny) + miny = bsp->bbox[1][BOXBOTTOM]; + if (bsp->bbox[1][BOXTOP] > maxy) + maxy = bsp->bbox[1][BOXTOP]; + + // You might be wondering why these are being bitshift here + // it's because mapwidth and height would otherwise overflow for maps larger than half the size possible... + // map boundaries and sizes will ALWAYS be whole numbers thankfully + // later calculations take into consideration that these are actually not in terms of FRACUNIT though + minx >>= FRACBITS; + maxx >>= FRACBITS; + miny >>= FRACBITS; + maxy >>= FRACBITS; + + // these are our final map boundaries: + mapwidth = maxx - minx; + mapheight = maxy - miny; + + // These should always be small enough to be bitshift back right now + xoffset = (minx + mapwidth/2)<width, mapwidth); + yscale = FixedDiv(AutomapPic->height, mapheight); + zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20); + + amnumxpos = (FixedMul(x, zoom) - FixedMul(xoffset, zoom)); + amnumypos = -(FixedMul(y, zoom) - FixedMul(yoffset, zoom)); + + if (encoremode) + amnumxpos = -amnumxpos; + + // scale patch coords + patchw = patch->width*scale /2; + patchh = patch->height*scale /2; + + if (centered) + patchw = patchh = 0; // patch is supposedly already centered, don't butt in. + + amxpos = amnumxpos + ((mx + AutomapPic->width/2)<height/2)<state == &states[S_MINEEXPLOSION1]) K_ExplodePlayer(tmthing->player, thing->target, thing); else - K_SpinPlayer(tmthing->player, thing->target, 0, tmthing, false); + K_SpinPlayer(tmthing->player, thing->target, 0, thing, false); return true; } diff --git a/src/p_user.c b/src/p_user.c index a9ea84432..c43e09291 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7377,7 +7377,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (P_CameraThinker(player, thiscam, resetcalled)) return true; - + if (thiscam == &camera[1]) // Camera 2 { num = 1; @@ -8495,7 +8495,7 @@ void P_PlayerThink(player_t *player) if (player->powers[pw_invulnerability] && player->powers[pw_invulnerability] < UINT16_MAX) player->powers[pw_invulnerability]--; - if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && + if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && (player->spectator || player->powers[pw_flashing] < K_GetKartFlashing(player))) player->powers[pw_flashing]--; From 1a9b21c195b3b95fa5889f0b971e1ff0bb82bfd4 Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 27 May 2019 22:03:17 +0100 Subject: [PATCH 13/21] Fix Post Processing in 64-bit Software 3P/4P Vid_BlitLinearScreen didn't make sure that it was actually meant to be copying the entire screen rows before doing it properly. --- src/v_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v_video.c b/src/v_video.c index 3dfea0418..a624878c6 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -292,7 +292,7 @@ void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT3 #ifdef HAVE_VIDCOPY VID_BlitLinearScreen_ASM(srcptr,destptr,width,height,srcrowbytes,destrowbytes); #else - if (srcrowbytes == destrowbytes) + if ((srcrowbytes == destrowbytes) && (srcrowbytes == (size_t)width)) M_Memcpy(destptr, srcptr, srcrowbytes * height); else { From 88d5e9b7d22388769cf5d720c521180799af1938 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 27 May 2019 14:20:07 -0700 Subject: [PATCH 14/21] wip --- src/v_video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/v_video.c b/src/v_video.c index a624878c6..2ba28b43c 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2537,8 +2537,10 @@ Unoptimized version UINT8 *srcscr = screens[0]; INT32 y; +#if 0 if (splitscreen > 1) // 3P/4P has trouble supporting this, anyone want to fix it? :p return; +#endif // Make sure table is built if (heatshifter == NULL || lastheight != viewheight) From 392f357b1af90dc4caa7e770ea87aedba78fb2de Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 27 May 2019 14:20:12 -0700 Subject: [PATCH 15/21] Revert "Fix Post Processing in 64-bit Software 3P/4P" This reverts commit 1a9b21c195b3b95fa5889f0b971e1ff0bb82bfd4. --- src/v_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v_video.c b/src/v_video.c index 2ba28b43c..5b5e3a063 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -292,7 +292,7 @@ void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT3 #ifdef HAVE_VIDCOPY VID_BlitLinearScreen_ASM(srcptr,destptr,width,height,srcrowbytes,destrowbytes); #else - if ((srcrowbytes == destrowbytes) && (srcrowbytes == (size_t)width)) + if (srcrowbytes == destrowbytes) M_Memcpy(destptr, srcptr, srcrowbytes * height); else { From 01a0fb1c8f0e43712d4c5e21949c20589a89996a Mon Sep 17 00:00:00 2001 From: Sryder Date: Mon, 27 May 2019 22:59:58 +0100 Subject: [PATCH 16/21] Fix Heatwave Post-processing Effect in 3P/4P --- src/v_video.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index a624878c6..9233eda42 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2404,7 +2404,7 @@ INT32 V_ThinStringWidth(const char *string, INT32 option) boolean *heatshifter = NULL; INT32 lastheight = 0; -INT32 heatindex[2] = { 0, 0 }; +INT32 heatindex[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0}; // // V_DoPostProcessor @@ -2537,9 +2537,6 @@ Unoptimized version UINT8 *srcscr = screens[0]; INT32 y; - if (splitscreen > 1) // 3P/4P has trouble supporting this, anyone want to fix it? :p - return; - // Make sure table is built if (heatshifter == NULL || lastheight != viewheight) { @@ -2554,7 +2551,7 @@ Unoptimized version heatshifter[y] = true; } - heatindex[0] = heatindex[1] = 0; + heatindex[0] = heatindex[1] = heatindex[2] = heatindex[3] = 0; lastheight = viewheight; } From 96b5a1df43d022095826a9a0123c4545c14f4739 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Tue, 28 May 2019 06:33:38 -0500 Subject: [PATCH 17/21] Update patch.kart hash THIS SHOULD BE THE LAST TIME I SWEAR --- src/config.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.h.in b/src/config.h.in index 338647435..f3f8339f8 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -52,7 +52,7 @@ #define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964" #define ASSET_HASH_MAPS_KART "1335cd064656aedca359cfbb5233ac4a" #ifdef USE_PATCH_KART -#define ASSET_HASH_PATCH_KART "6461b30bb20754a16a1b582120f55842" +#define ASSET_HASH_PATCH_KART "7093231f2c3c1cca1a909a708be85d9a" #endif #endif From 1a038ad463624293479de086cb661bc43e073de3 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Tue, 28 May 2019 06:56:35 -0500 Subject: [PATCH 18/21] Don't guard the return --- src/k_kart.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index fc1552296..9964140d3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8796,13 +8796,9 @@ void K_drawKartHUD(void) { #ifdef HAVE_BLUA if (LUA_HudEnabled(hud_battlefullscreen)) - { #endif K_drawBattleFullscreen(); - return; -#ifdef HAVE_BLUA - } // yes we legit checked if we had lua to close a single bracket. Not my proudest code edit tbh. -#endif + return; } // Draw the item window From 9ec9c639ddb475aae1a06c7cfe9cb1726db68908 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 28 May 2019 15:08:33 -0700 Subject: [PATCH 19/21] Revert "Revert "Fix Post Processing in 64-bit Software 3P/4P"" This reverts commit 392f357b1af90dc4caa7e770ea87aedba78fb2de. --- src/v_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v_video.c b/src/v_video.c index 1f8bb6777..9233eda42 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -292,7 +292,7 @@ void VID_BlitLinearScreen(const UINT8 *srcptr, UINT8 *destptr, INT32 width, INT3 #ifdef HAVE_VIDCOPY VID_BlitLinearScreen_ASM(srcptr,destptr,width,height,srcrowbytes,destrowbytes); #else - if (srcrowbytes == destrowbytes) + if ((srcrowbytes == destrowbytes) && (srcrowbytes == (size_t)width)) M_Memcpy(destptr, srcptr, srcrowbytes * height); else { From d8967112c604db567dd4c63073849fc4bb8c4818 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 28 May 2019 15:11:37 -0700 Subject: [PATCH 20/21] Fix compiler errors The truncation handling in this one spot is okay, but the compiler isn't smart enough for it. I'm leaving it as a warning because I'd like to make a dedicated function for handling snprintf truncation in the future. --- src/Makefile.cfg | 1 + src/p_enemy.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index a0398154a..8402e349f 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -222,6 +222,7 @@ endif ifdef GCC71 WFLAGS+=-Wno-error=implicit-fallthrough WFLAGS+=-Wno-implicit-fallthrough + WFLAGS+=-Wno-error=format-truncation endif ifdef GCC80 WFLAGS+=-Wno-error=format-overflow diff --git a/src/p_enemy.c b/src/p_enemy.c index 7963286d2..1795a304b 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8386,13 +8386,13 @@ void A_SPBChase(mobj_t *actor) if (actor->tracer && actor->tracer->health) { - // we're tailing a player, now's a good time to regain our damage properties - actor->flags &= ~MF_NOCLIPTHING; - fixed_t defspeed = wspeed; fixed_t range = (160*actor->tracer->scale); fixed_t cx = 0, cy =0; + // we're tailing a player, now's a good time to regain our damage properties + actor->flags &= ~MF_NOCLIPTHING; + // Play the intimidating gurgle if (!S_SoundPlaying(actor, actor->info->activesound)) S_StartSound(actor, actor->info->activesound); From 0bfe8249d4ae313c46d7ac872817010a41219665 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 29 May 2019 21:53:21 -0400 Subject: [PATCH 21/21] Fix Garden having a few steel blues from improper conversion This has been bothering me for a while --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 65846c553..0620193e3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -300,7 +300,7 @@ UINT8 colortranslations[MAXTRANSLATIONS][16] = { { 0, 80, 81, 88, 88, 188, 189, 76, 76, 77, 78, 79, 236, 237, 238, 239}, // SKINCOLOR_CROCODILE { 0, 80, 81, 88, 188, 189, 190, 191, 94, 94, 95, 95, 109, 110, 111, 31}, // SKINCOLOR_PERIDOT { 0, 208, 216, 209, 218, 51, 65, 76, 191, 191, 126, 143, 138, 175, 169, 254}, // SKINCOLOR_VOMIT - { 81, 82, 83, 73, 64, 65, 66, 92, 92, 93, 93, 94, 95, 173, 174, 175}, // SKINCOLOR_GARDEN + { 81, 82, 83, 73, 64, 65, 66, 92, 92, 93, 93, 94, 95, 109, 110, 111}, // SKINCOLOR_GARDEN { 0, 80, 81, 82, 83, 88, 89, 99, 100, 102, 104, 126, 143, 138, 139, 31}, // SKINCOLOR_LIME { 83, 72, 73, 74, 75, 76, 102, 104, 105, 106, 107, 108, 109, 110, 111, 31}, // SKINCOLOR_HANDHELD { 0, 80, 80, 81, 88, 89, 90, 91, 92, 93, 94, 95, 109, 110, 111, 31}, // SKINCOLOR_TEA