mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-31 05:20:51 +00:00
Fixed spectating for real, messages for changing some kart cvars, Mirror Mode disallowed in Battle
This commit is contained in:
parent
5b9a9faae7
commit
1e01e65a8b
5 changed files with 91 additions and 56 deletions
|
@ -105,6 +105,11 @@ static void Color4_OnChange(void);
|
|||
static void DummyConsvar_OnChange(void);
|
||||
static void SoundTest_OnChange(void);
|
||||
|
||||
static void KartFrantic_OnChange(void);
|
||||
static void KartSpeed_OnChange(void);
|
||||
static void KartMirror_OnChange(void);
|
||||
static void KartComeback_OnChange(void);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
static void Fishcake_OnChange(void);
|
||||
#endif
|
||||
|
@ -347,12 +352,12 @@ consvar_t cv_kartminimap = {"kartminimap", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NU
|
|||
consvar_t cv_kartcheck = {"kartcheck", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t kartstarsfx_cons_t[] = {{0, "Music"}, {1, "SMK"}, {0, NULL}};
|
||||
consvar_t cv_kartstarsfx = {"kartstarsfx", "SMK", CV_SAVE, kartstarsfx_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartspeed = {"kartspeed", "Standard", CV_NETVAR, kartspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartspeed = {"kartspeed", "Standard", CV_NETVAR|CV_CALL|CV_NOINIT, kartspeed_cons_t, KartSpeed_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t kartballoons_cons_t[] = {{1, "MIN"}, {12, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_kartballoons = {"kartballoons", "3", CV_NETVAR, kartballoons_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartfrantic = {"kartfrantic", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartcomeback = {"kartcomeback", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartmirror = {"kartmirror", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartballoons = {"kartballoons", "3", CV_NETVAR|CV_CHEAT, kartballoons_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartfrantic = {"kartfrantic", "Off", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOINIT, CV_OnOff, KartFrantic_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartcomeback = {"kartcomeback", "On", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOINIT, CV_OnOff, KartComeback_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartmirror = {"kartmirror", "Off", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOINIT, CV_OnOff, KartMirror_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t speedometer_cons_t[] = {{0, "Off"}, {1, "Kilometers"}, {2, "Miles"}, {3, "Fracunits"}, {0, NULL}};
|
||||
consvar_t cv_speedometer = {"speedometer", "Kilometers", CV_SAVE, speedometer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
|
||||
|
||||
|
@ -5049,3 +5054,28 @@ static void Command_ShowTime_f(void)
|
|||
|
||||
CONS_Printf(M_GetText("The current time is %f.\nThe timelimit is %f\n"), (double)leveltime/TICRATE, (double)timelimitintics/TICRATE);
|
||||
}
|
||||
|
||||
// SRB2Kart: On change messages
|
||||
static void KartFrantic_OnChange(void)
|
||||
{
|
||||
if (cv_kartfrantic.value != franticitems && gamestate == GS_LEVEL)
|
||||
CONS_Printf(M_GetText("Frantic Items will be turned %s next round.\n"), cv_kartfrantic.value ? M_GetText("on") : M_GetText("off"));
|
||||
}
|
||||
|
||||
static void KartSpeed_OnChange(void)
|
||||
{
|
||||
if (cv_kartspeed.value != gamespeed && gametype == GT_RACE && gamestate == GS_LEVEL)
|
||||
CONS_Printf(M_GetText("Game speed will be changed to \"%s\" next round.\n"), cv_kartspeed.string);
|
||||
}
|
||||
|
||||
static void KartMirror_OnChange(void)
|
||||
{
|
||||
if (cv_kartmirror.value != mirrormode && gametype == GT_RACE && gamestate == GS_LEVEL)
|
||||
CONS_Printf(M_GetText("Mirror Mode will be turned %s next round.\n"), cv_kartmirror.value ? M_GetText("on") : M_GetText("off"));
|
||||
}
|
||||
|
||||
static void KartComeback_OnChange(void)
|
||||
{
|
||||
if (cv_kartcomeback.value != comeback && gametype == GT_MATCH && gamestate == GS_LEVEL)
|
||||
CONS_Printf(M_GetText("Karma Comeback will be turned %s next round.\n"), cv_kartcomeback.value ? M_GetText("on") : M_GetText("off"));
|
||||
}
|
56
src/g_game.c
56
src/g_game.c
|
@ -1293,7 +1293,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
|
||||
axis = JoyAxis(AXISTURN, ssplayer);
|
||||
|
||||
if (cv_kartmirror.value)
|
||||
if (mirrormode)
|
||||
{
|
||||
turnright ^= turnleft; // swap these using three XORs
|
||||
turnleft ^= turnright;
|
||||
|
@ -1514,7 +1514,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||
}
|
||||
|
||||
if (cv_kartmirror.value)
|
||||
if (mirrormode)
|
||||
cmd->sidemove = -cmd->sidemove;
|
||||
|
||||
if (ssplayer == 2 && player->bot == 1) {
|
||||
|
@ -1532,7 +1532,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
|
||||
//{ SRB2kart - Drift support
|
||||
axis = JoyAxis(AXISTURN, ssplayer);
|
||||
if (cv_kartmirror.value)
|
||||
if (mirrormode)
|
||||
axis = -axis;
|
||||
|
||||
// TODO: Remove this hack please :(
|
||||
|
@ -2017,50 +2017,38 @@ boolean G_Responder(event_t *ev)
|
|||
if (ev->data1 == gamecontrol[gc_spectate][0]
|
||||
|| ev->data1 == gamecontrol[gc_spectate][1])
|
||||
{
|
||||
if ((netgame || splitscreen) && !players[consoleplayer].powers[pw_flashing] && !spectatedelay)
|
||||
if (!spectatedelay)
|
||||
{
|
||||
if (players[consoleplayer].spectator && cv_allowteamchange.value)
|
||||
P_SpectatorJoinGame(&players[consoleplayer]);
|
||||
else
|
||||
COM_ImmedExecute("changeteam spectator");
|
||||
spectatedelay = NEWTICRATE / 7;
|
||||
COM_ImmedExecute("changeteam spectator");
|
||||
}
|
||||
spectatedelay = NEWTICRATE / 7;
|
||||
}
|
||||
if (ev->data1 == gamecontrolbis[gc_spectate][0]
|
||||
|| ev->data1 == gamecontrolbis[gc_spectate][1])
|
||||
{
|
||||
if (splitscreen && !players[secondarydisplayplayer].powers[pw_flashing] && !spectatedelay2)
|
||||
if (!spectatedelay2)
|
||||
{
|
||||
if (players[secondarydisplayplayer].spectator && cv_allowteamchange.value)
|
||||
P_SpectatorJoinGame(&players[secondarydisplayplayer]);
|
||||
else
|
||||
COM_ImmedExecute("changeteam2 spectator");
|
||||
spectatedelay2 = NEWTICRATE / 7;
|
||||
COM_ImmedExecute("changeteam2 spectator");
|
||||
}
|
||||
spectatedelay2 = NEWTICRATE / 7;
|
||||
}
|
||||
if (ev->data1 == gamecontrol3[gc_spectate][0]
|
||||
|| ev->data1 == gamecontrol3[gc_spectate][1])
|
||||
{
|
||||
if (splitscreen > 1 && !players[thirddisplayplayer].powers[pw_flashing] && !spectatedelay3)
|
||||
if (!spectatedelay3)
|
||||
{
|
||||
if (players[thirddisplayplayer].spectator && cv_allowteamchange.value)
|
||||
P_SpectatorJoinGame(&players[thirddisplayplayer]);
|
||||
else
|
||||
COM_ImmedExecute("changeteam3 spectator");
|
||||
spectatedelay3 = NEWTICRATE / 7;
|
||||
COM_ImmedExecute("changeteam3 spectator");
|
||||
}
|
||||
spectatedelay3 = NEWTICRATE / 7;
|
||||
}
|
||||
if (ev->data1 == gamecontrol4[gc_spectate][0]
|
||||
|| ev->data1 == gamecontrol4[gc_spectate][1])
|
||||
{
|
||||
if (splitscreen > 2 && !players[fourthdisplayplayer].powers[pw_flashing] && !spectatedelay4)
|
||||
if (!spectatedelay4)
|
||||
{
|
||||
if (players[fourthdisplayplayer].spectator && cv_allowteamchange.value)
|
||||
P_SpectatorJoinGame(&players[fourthdisplayplayer]);
|
||||
else
|
||||
COM_ImmedExecute("changeteam4 spectator");
|
||||
spectatedelay4 = NEWTICRATE / 7;
|
||||
COM_ImmedExecute("changeteam4 spectator");
|
||||
}
|
||||
spectatedelay4 = NEWTICRATE / 7;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -2227,9 +2215,21 @@ void G_Ticker(boolean run)
|
|||
|
||||
if (camtoggledelay)
|
||||
camtoggledelay--;
|
||||
|
||||
if (camtoggledelay2)
|
||||
camtoggledelay2--;
|
||||
if (camtoggledelay3)
|
||||
camtoggledelay3--;
|
||||
if (camtoggledelay4)
|
||||
camtoggledelay4--;
|
||||
|
||||
if (spectatedelay)
|
||||
spectatedelay--;
|
||||
if (spectatedelay2)
|
||||
spectatedelay2--;
|
||||
if (spectatedelay3)
|
||||
spectatedelay3--;
|
||||
if (spectatedelay4)
|
||||
spectatedelay4--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
39
src/k_kart.c
39
src/k_kart.c
|
@ -1037,7 +1037,8 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator && players[i].kartstuff[k_position] < player->kartstuff[k_position])
|
||||
if (playeringame[i] && !players[i].spectator && players[i].mo
|
||||
&& players[i].kartstuff[k_position] < player->kartstuff[k_position])
|
||||
pdis += P_AproxDistance(P_AproxDistance(players[i].mo->x - player->mo->x,
|
||||
players[i].mo->y - player->mo->y),
|
||||
players[i].mo->z - player->mo->z) / FRACUNIT
|
||||
|
@ -1057,12 +1058,8 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (franticitems) // Frantic items
|
||||
{
|
||||
pdis = (13*pdis/12); // make the distances between everyone artifically higher...
|
||||
//pdis += distvar; // and set everyone back another place!
|
||||
}
|
||||
|
||||
if (franticitems) // Frantic items make the distances between everyone artifically higher :P
|
||||
pdis = (15*pdis/14);
|
||||
if (pingame == 1) useodds = 0; // Record Attack, or just alone
|
||||
else if (pdis <= distvar * 0) useodds = 1; // (64*14) * 0 = 0
|
||||
else if (pdis <= distvar * 1) useodds = 2; // (64*14) * 1 = 896
|
||||
|
@ -1083,8 +1080,8 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
//{
|
||||
if (cv_magnet.value) SETITEMRESULT(useodds, 1); // Magnet
|
||||
if (cv_boo.value) SETITEMRESULT(useodds, 2); // Boo
|
||||
if (cv_mushroom.value) SETITEMRESULT(useodds, 3); // Mushroom
|
||||
if (cv_mushroom.value) SETITEMRESULT(useodds, 4); // Triple Mushroom
|
||||
if (cv_mushroom.value && !modeattacking) SETITEMRESULT(useodds, 3); // Mushroom
|
||||
if (cv_triplemushroom.value) SETITEMRESULT(useodds, 4); // Triple Mushroom
|
||||
if (cv_megashroom.value && !player->kartstuff[k_poweritemtimer]) SETITEMRESULT(useodds, 5); // Mega Mushroom
|
||||
if (cv_goldshroom.value) SETITEMRESULT(useodds, 6); // Gold Mushroom
|
||||
if (cv_star.value && !player->kartstuff[k_poweritemtimer]) SETITEMRESULT(useodds, 7); // Star
|
||||
|
@ -1097,7 +1094,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd)
|
|||
if (cv_bobomb.value) SETITEMRESULT(useodds, 14); // Bob-omb
|
||||
if (cv_blueshell.value && pexiting == 0) SETITEMRESULT(useodds, 15); // Blue Shell
|
||||
if (cv_fireflower.value) SETITEMRESULT(useodds, 16); // Fire Flower
|
||||
if (cv_tripleredshell.value && pingame > 2) SETITEMRESULT(useodds, 17); // Triple Red Shell
|
||||
if (cv_tripleredshell.value && pingame > 2) SETITEMRESULT(useodds, 17); // Triple Red Shell
|
||||
if (cv_lightning.value && pingame > pexiting) SETITEMRESULT(useodds, 18); // Lightning
|
||||
if (cv_feather.value) SETITEMRESULT(useodds, 19); // Feather
|
||||
|
||||
|
@ -2927,17 +2924,21 @@ static void K_KartUpdatePosition(player_t *player)
|
|||
thinker_t *th;
|
||||
mobj_t *mo;
|
||||
|
||||
if (player->spectator || !player->mo)
|
||||
return;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator || !players[i].mo)
|
||||
continue;
|
||||
|
||||
if (gametype == GT_RACE)
|
||||
{
|
||||
if (playeringame[i] && !players[i].spectator &&
|
||||
(((players[i].starpostnum) + (numstarposts + 1) * players[i].laps) >
|
||||
if ((((players[i].starpostnum) + (numstarposts + 1) * players[i].laps) >
|
||||
((player->starpostnum) + (numstarposts + 1) * player->laps)))
|
||||
position++;
|
||||
else if (playeringame[i] && !players[i].spectator
|
||||
&& (((players[i].starpostnum) + (numstarposts+1)*players[i].laps) ==
|
||||
((player->starpostnum) + (numstarposts+1)*player->laps)))
|
||||
else if (((players[i].starpostnum) + (numstarposts+1)*players[i].laps) ==
|
||||
((player->starpostnum) + (numstarposts+1)*player->laps))
|
||||
{
|
||||
ppcd = pncd = ipcd = incd = 0;
|
||||
|
||||
|
@ -3147,7 +3148,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
else if (cmd->buttons & BT_ATTACK)
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
|
||||
if (player && player->health > 0 && !player->spectator && !player->exiting && player->kartstuff[k_spinouttimer] == 0)
|
||||
if (player && player->mo && player->mo->health > 0 && !player->spectator && !player->exiting && player->kartstuff[k_spinouttimer] == 0)
|
||||
{
|
||||
|
||||
// Magnet
|
||||
|
@ -4680,10 +4681,7 @@ static void K_drawKartPositionFaces(void)
|
|||
|
||||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
{
|
||||
if (!playeringame[j])
|
||||
continue;
|
||||
|
||||
if (players[j].spectator)
|
||||
if (!playeringame[j] || players[j].spectator || !players[j].mo)
|
||||
continue;
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
|
@ -4706,6 +4704,7 @@ static void K_drawKartPositionFaces(void)
|
|||
for (i = 0; i < ranklines; i++)
|
||||
{
|
||||
if (players[rankplayer[i]].spectator) continue; // Spectators are ignored
|
||||
if (!players[rankplayer[i]].mo) continue;
|
||||
|
||||
balloonx = FACE_X+18;
|
||||
|
||||
|
|
|
@ -6782,8 +6782,9 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
break;
|
||||
case MT_PLAYERARROW:
|
||||
if (mobj->target && mobj->target->health
|
||||
&& mobj->target->player && mobj->target->player->mo
|
||||
&& mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD)
|
||||
&& mobj->target->player && !mobj->target->player->spectator
|
||||
&& mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD
|
||||
&& players[displayplayer].mo && !players[displayplayer].spectator)
|
||||
{
|
||||
fixed_t scale = mobj->target->scale;
|
||||
mobj->color = mobj->target->color;
|
||||
|
|
|
@ -2982,8 +2982,13 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
gamespeed = 0;
|
||||
else
|
||||
gamespeed = cv_kartspeed.value;
|
||||
|
||||
if (gametype == GT_MATCH)
|
||||
mirrormode = false;
|
||||
else
|
||||
mirrormode = cv_kartmirror.value;
|
||||
|
||||
franticitems = cv_kartfrantic.value;
|
||||
mirrormode = cv_kartmirror.value;
|
||||
comeback = cv_kartcomeback.value;
|
||||
|
||||
// clear special respawning que
|
||||
|
|
Loading…
Reference in a new issue