Merge branch 'tutorial-spectate-debug' into 'master'

Freecam spectator fixes; Tutorial spectator debugging

See merge request KartKrew/Kart!2098
This commit is contained in:
Gunla 2024-03-13 23:49:25 +00:00
commit 0212191839
5 changed files with 29 additions and 8 deletions

View file

@ -803,6 +803,7 @@ consvar_t cv_capsuletest = OnlineCheat("capsuletest", "Off").values(capsuletest_
consvar_t cv_debugcheese = OnlineCheat("debugcheese", "Off").on_off().description("Disable checks that prevent farming item boxes");
consvar_t cv_debugencorevote = OnlineCheat("debugencorevote", "Off").on_off().description("Force encore choice to appear on vote screen");
consvar_t cv_debuglapcheat = OnlineCheat("debuglapcheat", "Off").on_off().description("Permit far waypoint jumps and disable lap cheat prevention");
consvar_t cv_debugnewchallenger = OnlineCheat("debugnewchallenger", "Off").on_off().description("Do not restart the map to toggle Duel mode");
consvar_t cv_forcebots = OnlineCheat("forcebots", "No").yes_no().description("Force bots to appear, even in wrong game modes");
void ForceSkin_OnChange(void);
@ -1173,6 +1174,8 @@ consvar_t cv_fov[MAXSPLITSCREENPLAYERS] = {
Player("fov4", "90").floating_point().min_max(60*FRACUNIT, 179*FRACUNIT).onchange(Fov_OnChange).dont_save(),
};
consvar_t cv_freecam_speed = Player("freecam_speed", "1").min_max(1, 10).dont_save();
void I_JoyScale(void);
void I_JoyScale2(void);
void I_JoyScale3(void);

View file

@ -13524,7 +13524,8 @@ void K_CheckSpectateStatus(boolean considermapreset)
// Reset the match when 2P joins 1P, DUEL mode
// Reset the match when 3P joins 1P and 2P, DUEL mode must be disabled
if (i > 0 && !mapreset && gamestate == GS_LEVEL && (numingame < 3 && numingame+i >= 2))
extern consvar_t cv_debugnewchallenger;
if (i > 0 && !mapreset && gamestate == GS_LEVEL && (numingame < 3 && numingame+i >= 2) && !cv_debugnewchallenger.value)
{
Music_Play("comeon"); // COME ON
mapreset = 3*TICRATE; // Even though only the server uses this for game logic, set for everyone for HUD

View file

@ -40,6 +40,8 @@
#include "fastcmp.h"
#include "g_party.h"
//
// CHEAT SEQUENCE PACKAGE
//
@ -619,7 +621,11 @@ void Command_Savecheckpoint_f(void)
REQUIRE_CHEATS;
REQUIRE_INLEVEL;
if (!P_MobjWasRemoved(thing))
if (camera[G_PartyPosition(consoleplayer)].freecam || players[consoleplayer].spectator)
{
D_Cheat(consoleplayer, CHEAT_SAVECHECKPOINT, camera[0].x, camera[0].y, camera[0].z);
}
else if (!P_MobjWasRemoved(thing))
{
D_Cheat(consoleplayer, CHEAT_SAVECHECKPOINT, thing->x, thing->y, thing->z);
}

View file

@ -12152,7 +12152,10 @@ void P_SpawnPlayer(INT32 playernum)
// changes.
if (!demo.playback)
{
camera[G_PartyPosition(playernum)].freecam = false;
if (!p->spectator)
{
camera[G_PartyPosition(playernum)].freecam = false;
}
displayplayers[G_PartyPosition(playernum)] = playernum;
}

View file

@ -2846,6 +2846,9 @@ static void P_DeathThink(player_t *player)
{
if (!netgame && !splitscreen
&& player->bot == false
#ifdef DEVELOP
&& player->spectator == false
#endif
&& (gametyperules & GTR_CHECKPOINTS))
{
G_SetRetryFlag();
@ -2918,6 +2921,8 @@ fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS] = {-42,-42,-42,-42};
void P_DemoCameraMovement(camera_t *cam, UINT8 num)
{
extern consvar_t cv_freecam_speed;
ticcmd_t *cmd;
angle_t thrustangle;
player_t *lastp;
@ -2946,16 +2951,17 @@ void P_DemoCameraMovement(camera_t *cam, UINT8 num)
if (!cam->button_a_held)
{
int dir = ((cmd->buttons & BT_ACCELERATE) ? 1 : 0) + ((cmd->buttons & BT_BRAKE) ? -1 : 0);
fixed_t spd = 32*mapobjectscale*cv_freecam_speed.value;
switch (dir)
{
case 1:
cam->z += 32*mapobjectscale;
cam->z += spd;
moving = true;
break;
case -1:
cam->z -= 32*mapobjectscale;
cam->z -= spd;
moving = true;
break;
}
@ -3025,14 +3031,16 @@ void P_DemoCameraMovement(camera_t *cam, UINT8 num)
if (cmd->forwardmove != 0)
{
fixed_t spd = cmd->forwardmove*mapobjectscale*cv_freecam_speed.value;
thrustangle = cam->angle >> ANGLETOFINESHIFT;
cam->x += FixedMul(cmd->forwardmove*mapobjectscale, FINECOSINE(thrustangle));
cam->y += FixedMul(cmd->forwardmove*mapobjectscale, FINESINE(thrustangle));
cam->x += FixedMul(spd, FINECOSINE(thrustangle));
cam->y += FixedMul(spd, FINESINE(thrustangle));
if (!cam->reset_aiming)
{
cam->z += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(cam->aiming));
cam->z += FixedMul(spd, AIMINGTOSLOPE(cam->aiming));
}
// momentums are useless here, directly add to the coordinates