Merge remote-tracking branch 'refs/remotes/origin/master' into menus-cvars-unlocks

# Conflicts:
#	src/g_game.c
#	src/m_cheat.c
#	src/p_user.c
This commit is contained in:
TehRealSalt 2018-01-24 16:24:36 -05:00
commit 403e14e971
14 changed files with 616 additions and 297 deletions

View file

@ -2477,9 +2477,9 @@ static void Command_Teamchange2_f(void)
if (COM_Argc() <= 1)
{
if (G_GametypeHasTeams())
CONS_Printf(M_GetText("changeteam <team>: switch to a new team (%s)\n"), "red, blue or spectator");
CONS_Printf(M_GetText("changeteam2 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
else if (G_GametypeHasSpectators())
CONS_Printf(M_GetText("changeteam <team>: switch to a new team (%s)\n"), "spectator or playing");
CONS_Printf(M_GetText("changeteam2 <team>: switch to a new team (%s)\n"), "spectator or playing");
else
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
return;
@ -2563,12 +2563,196 @@ static void Command_Teamchange2_f(void)
static void Command_Teamchange3_f(void)
{
;
changeteam_union NetPacket;
boolean error = false;
UINT16 usvalue;
NetPacket.value.l = NetPacket.value.b = 0;
// 0 1
// changeteam3 <color>
if (COM_Argc() <= 1)
{
if (G_GametypeHasTeams())
CONS_Printf(M_GetText("changeteam3 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
else if (G_GametypeHasSpectators())
CONS_Printf(M_GetText("changeteam3 <team>: switch to a new team (%s)\n"), "spectator or playing");
else
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
return;
}
if (G_GametypeHasTeams())
{
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1;
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2;
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else
error = true;
}
else if (G_GametypeHasSpectators())
{
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3;
else
error = true;
}
else
{
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
return;
}
if (error)
{
if (G_GametypeHasTeams())
CONS_Printf(M_GetText("changeteam3 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
else if (G_GametypeHasSpectators())
CONS_Printf(M_GetText("changeteam3 <team>: switch to a new team (%s)\n"), "spectator or playing");
return;
}
if (G_GametypeHasTeams())
{
if (NetPacket.packet.newteam == (unsigned)players[thirddisplayplayer].ctfteam ||
(players[thirddisplayplayer].spectator && !NetPacket.packet.newteam))
error = true;
}
else if (G_GametypeHasSpectators())
{
if ((players[thirddisplayplayer].spectator && !NetPacket.packet.newteam) ||
(!players[thirddisplayplayer].spectator && NetPacket.packet.newteam == 3))
error = true;
}
#ifdef PARANOIA
else
I_Error("Invalid gametype after initial checks!");
#endif
if (error)
{
CONS_Alert(CONS_NOTICE, M_GetText("You're already on that team!\n"));
return;
}
if (!cv_allowteamchange.value && NetPacket.packet.newteam) // allow swapping to spectator even in locked teams.
{
CONS_Alert(CONS_NOTICE, M_GetText("The server is not allowing team changes at the moment.\n"));
return;
}
//additional check for hide and seek. Don't allow change of status after hidetime ends.
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
{
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
return;
}
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
SendNetXCmd3(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
}
static void Command_Teamchange4_f(void)
{
;
changeteam_union NetPacket;
boolean error = false;
UINT16 usvalue;
NetPacket.value.l = NetPacket.value.b = 0;
// 0 1
// changeteam4 <color>
if (COM_Argc() <= 1)
{
if (G_GametypeHasTeams())
CONS_Printf(M_GetText("changeteam4 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
else if (G_GametypeHasSpectators())
CONS_Printf(M_GetText("changeteam4 <team>: switch to a new team (%s)\n"), "spectator or playing");
else
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
return;
}
if (G_GametypeHasTeams())
{
if (!strcasecmp(COM_Argv(1), "red") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 1;
else if (!strcasecmp(COM_Argv(1), "blue") || !strcasecmp(COM_Argv(1), "2"))
NetPacket.packet.newteam = 2;
else if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else
error = true;
}
else if (G_GametypeHasSpectators())
{
if (!strcasecmp(COM_Argv(1), "spectator") || !strcasecmp(COM_Argv(1), "0"))
NetPacket.packet.newteam = 0;
else if (!strcasecmp(COM_Argv(1), "playing") || !strcasecmp(COM_Argv(1), "1"))
NetPacket.packet.newteam = 3;
else
error = true;
}
else
{
CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n"));
return;
}
if (error)
{
if (G_GametypeHasTeams())
CONS_Printf(M_GetText("changeteam4 <team>: switch to a new team (%s)\n"), "red, blue or spectator");
else if (G_GametypeHasSpectators())
CONS_Printf(M_GetText("changeteam4 <team>: switch to a new team (%s)\n"), "spectator or playing");
return;
}
if (G_GametypeHasTeams())
{
if (NetPacket.packet.newteam == (unsigned)players[fourthdisplayplayer].ctfteam ||
(players[fourthdisplayplayer].spectator && !NetPacket.packet.newteam))
error = true;
}
else if (G_GametypeHasSpectators())
{
if ((players[fourthdisplayplayer].spectator && !NetPacket.packet.newteam) ||
(!players[fourthdisplayplayer].spectator && NetPacket.packet.newteam == 3))
error = true;
}
#ifdef PARANOIA
else
I_Error("Invalid gametype after initial checks!");
#endif
if (error)
{
CONS_Alert(CONS_NOTICE, M_GetText("You're already on that team!\n"));
return;
}
if (!cv_allowteamchange.value && NetPacket.packet.newteam) // allow swapping to spectator even in locked teams.
{
CONS_Alert(CONS_NOTICE, M_GetText("The server is not allowing team changes at the moment.\n"));
return;
}
//additional check for hide and seek. Don't allow change of status after hidetime ends.
if (gametype == GT_HIDEANDSEEK && leveltime >= (hidetime * TICRATE))
{
CONS_Alert(CONS_NOTICE, M_GetText("Hiding time expired; no Hide and Seek status changes allowed!\n"));
return;
}
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
SendNetXCmd4(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
}
static void Command_ServerTeamChange_f(void)

View file

@ -244,7 +244,6 @@ typedef enum
k_lakitu, // Timer for Lakitu to carry and drop the player
k_throwdir, // Held dir of controls; 1 = forward, 0 = none, -1 = backward (was "player->heldDir")
k_camspin, // Used to 180 the camera while a button is held
k_lapanimation, // Used to make a swoopy lap lakitu, maybe other effects in the future
k_cardanimation, // Used to determine the position of some full-screen Battle Mode graphics
k_sounds, // Used this to stop and then force music restores as it hits zero
@ -356,9 +355,9 @@ typedef struct player_s
// Base height above floor for viewz.
fixed_t viewheight;
// Bob/squat speed.
fixed_t deltaviewheight;
//fixed_t deltaviewheight;
// bounded/scaled total momentum.
fixed_t bob;
//fixed_t bob;
// Mouse aiming, where the guy is looking at!
// It is updated with cmd->aiming.

View file

@ -30,13 +30,13 @@ typedef enum
BT_ATTACK = 1<<4, // Use Item
BT_FORWARD = 1<<5, // Aim Item Forward
BT_BACKWARD = 1<<6, // Aim Item Backward
BT_SPECTATE = 1<<7, // Toggle Spectate
//BT_SPECTATE = 1<<7, // Toggle Spectate
// Want more button space? Help get rid of this hack :V
BT_DRIFTLEFT = 1<<8, // Drift left hack
BT_DRIFTRIGHT = 1<<9, // Drift right hack
BT_DRIFTLEFT = 1<<7, // Drift left hack
BT_DRIFTRIGHT = 1<<8, // Drift right hack
// free: 1<<10 to 1<<12
// free: 1<<9 to 1<<12
// Lua garbage
BT_CUSTOM1 = 1<<13,

View file

@ -7821,7 +7821,7 @@ struct {
{"BT_ATTACK",BT_ATTACK},
{"BT_FORWARD",BT_FORWARD},
{"BT_BACKWARD",BT_BACKWARD},
{"BT_SPECTATE",BT_SPECTATE},
//{"BT_SPECTATE",BT_SPECTATE},
{"BT_DRIFTLEFT",BT_DRIFTLEFT},
{"BT_DRIFTRIGHT",BT_DRIFTRIGHT},
{"BT_CUSTOM1",BT_CUSTOM1}, // Lua customizable

View file

@ -1179,9 +1179,10 @@ static INT32 JoyAxis(axis_input_e axissel, UINT8 p)
//
INT32 localaiming, localaiming2, localaiming3, localaiming4;
angle_t localangle, localangle2, localangle3, localangle4;
boolean camspin, camspin2, camspin3, camspin4;
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
//static fixed_t sidemove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16}; // faster!
static fixed_t sidemove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16}; // faster!
static fixed_t angleturn[3] = {400, 800, 200}; // + slow turn
void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
@ -1190,7 +1191,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
INT32 laim, th, tspeed, forward, side, axis; //i
const INT32 speed = 1;
// these ones used for multiple conditions
boolean turnleft, turnright, invertmouse, mouseaiming, lookaxis, analogjoystickmove, gamepadjoystickmove, kbl; //analog
boolean turnleft, turnright, invertmouse, mouseaiming, lookaxis, analog, analogjoystickmove, gamepadjoystickmove, kbl;
player_t *player;
camera_t *thiscam;
angle_t lang;
@ -1198,45 +1199,45 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
static INT32 turnheld, turnheld2, turnheld3, turnheld4; // for accelerative turning
static boolean keyboard_look, keyboard_look2, keyboard_look3, keyboard_look4; // true if lookup/down using keyboard
if (ssplayer == 2)
switch (ssplayer)
{
player = &players[secondarydisplayplayer];
thiscam = (player->bot == 2 ? &camera : &camera2);
lang = localangle2;
laim = localaiming2;
th = turnheld2;
kbl = keyboard_look2;
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1);
}
else if (ssplayer == 3)
{
player = &players[thirddisplayplayer];
thiscam = &camera3;
lang = localangle3;
laim = localaiming3;
th = turnheld3;
kbl = keyboard_look3;
G_CopyTiccmd(cmd, I_BaseTiccmd3(), 1);
}
else if (ssplayer == 4)
{
player = &players[fourthdisplayplayer];
thiscam = &camera4;
lang = localangle4;
laim = localaiming4;
th = turnheld4;
kbl = keyboard_look4;
G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1);
}
else
{
player = &players[consoleplayer];
thiscam = &camera;
lang = localangle;
laim = localaiming;
th = turnheld;
kbl = keyboard_look;
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
case 2:
player = &players[secondarydisplayplayer];
thiscam = (player->bot == 2 ? &camera : &camera2);
lang = localangle2;
laim = localaiming2;
th = turnheld2;
kbl = keyboard_look2;
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1);
break;
case 3:
player = &players[thirddisplayplayer];
thiscam = &camera3;
lang = localangle3;
laim = localaiming3;
th = turnheld3;
kbl = keyboard_look3;
G_CopyTiccmd(cmd, I_BaseTiccmd3(), 1);
break;
case 4:
player = &players[fourthdisplayplayer];
thiscam = &camera4;
lang = localangle4;
laim = localaiming4;
th = turnheld4;
kbl = keyboard_look4;
G_CopyTiccmd(cmd, I_BaseTiccmd4(), 1);
break;
case 1:
default:
player = &players[consoleplayer];
thiscam = &camera;
lang = localangle;
laim = localaiming;
th = turnheld;
kbl = keyboard_look;
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
break;
}
// why build a ticcmd if we're paused?
@ -1248,41 +1249,41 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
return;
}
if (ssplayer == 2)
switch (ssplayer)
{
mouseaiming = player->spectator; //mouseaiming = (PLAYER2INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook2.value;
invertmouse = cv_invertmouse2.value;
lookaxis = cv_lookaxis2.value;
analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick2.value && Joystick2.bGamepadStyle;
//analog = cv_analog2.value;
}
else if (ssplayer == 3)
{
mouseaiming = false;
invertmouse = false;
lookaxis = cv_lookaxis3.value;
analogjoystickmove = cv_usejoystick3.value && !Joystick3.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick3.value && Joystick3.bGamepadStyle;
//analog = cv_analog3.value;
}
else if (ssplayer == 4)
{
mouseaiming = false;
invertmouse = false;
lookaxis = cv_lookaxis4.value;
analogjoystickmove = cv_usejoystick4.value && !Joystick4.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick4.value && Joystick4.bGamepadStyle;
//analog = cv_analog4.value;
}
else
{
mouseaiming = player->spectator; //mouseaiming = (PLAYER1INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook.value;
invertmouse = cv_invertmouse.value;
lookaxis = cv_lookaxis.value;
analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick.value && Joystick.bGamepadStyle;
//analog = cv_analog.value;
case 2:
mouseaiming = player->spectator; //(PLAYER2INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook2.value;
invertmouse = cv_invertmouse2.value;
lookaxis = cv_lookaxis2.value;
analogjoystickmove = cv_usejoystick2.value && !Joystick2.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick2.value && Joystick2.bGamepadStyle;
analog = cv_analog2.value;
break;
case 3:
mouseaiming = false;
invertmouse = false;
lookaxis = cv_lookaxis3.value;
analogjoystickmove = cv_usejoystick3.value && !Joystick3.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick3.value && Joystick3.bGamepadStyle;
analog = cv_analog3.value;
break;
case 4:
mouseaiming = false;
invertmouse = false;
lookaxis = cv_lookaxis4.value;
analogjoystickmove = cv_usejoystick4.value && !Joystick4.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick4.value && Joystick4.bGamepadStyle;
analog = cv_analog4.value;
break;
case 1:
default:
mouseaiming = player->spectator; //(PLAYER1INPUTDOWN(gc_mouseaiming)) ^ cv_alwaysfreelook.value;
invertmouse = cv_invertmouse.value;
lookaxis = cv_lookaxis.value;
analogjoystickmove = cv_usejoystick.value && !Joystick.bGamepadStyle;
gamepadjoystickmove = cv_usejoystick.value && Joystick.bGamepadStyle;
analog = cv_analog.value;
break;
}
turnright = InputDown(gc_turnright, ssplayer);
@ -1290,7 +1291,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
axis = JoyAxis(AXISTURN, ssplayer);
if (mirrormode)
if (cv_kartmirror.value)
{
turnright ^= turnleft; // swap these using three XORs
turnleft ^= turnright;
@ -1318,49 +1319,94 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
tspeed = speed;
// let movement keys cancel each other out
if (turnright && !(turnleft))
cmd->angleturn = (INT16)(cmd->angleturn - angleturn[tspeed]);
else if (turnleft && !(turnright))
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
if (analogjoystickmove && axis != 0)
if (analog) // Analog
{
// JOYAXISRANGE should be 1023 (divide by 1024)
cmd->angleturn = (INT16)(cmd->angleturn - ((axis * angleturn[1]) >> 10)); // ANALOG!
if (turnright)
cmd->angleturn = (INT16)(cmd->angleturn - angleturn[tspeed]);
if (turnleft)
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
}
// forward with key or button // SRB2kart - we use an accel/brake instead of forward/backward.
if (InputDown(gc_accelerate, ssplayer) || player->kartstuff[k_mushroomtimer])
if (analog || twodlevel
|| (player->mo && (player->mo->flags2 & MF2_TWOD))
|| (!demoplayback && (player->climbing
|| (player->pflags & PF_NIGHTSMODE)
|| (player->pflags & PF_SLIDING)
|| (player->pflags & PF_FORCESTRAFE)))) // Analog
forcestrafe = true;
if (forcestrafe) // Analog
{
cmd->buttons |= BT_ACCELERATE;
forward = forwardmove[1]; // 50
if (turnright)
side += sidemove[speed];
if (turnleft)
side -= sidemove[speed];
if (analogjoystickmove && axis != 0)
{
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
side += ((axis * sidemove[1]) >> 10);
}
}
else
{
if (turnright && !(turnleft))
cmd->angleturn = (INT16)(cmd->angleturn - angleturn[tspeed]);
else if (turnleft && !(turnright))
cmd->angleturn = (INT16)(cmd->angleturn + angleturn[tspeed]);
if (analogjoystickmove && axis != 0)
{
// JOYAXISRANGE should be 1023 (divide by 1024)
cmd->angleturn = (INT16)(cmd->angleturn - ((axis * angleturn[1]) >> 10)); // ANALOG!
}
}
if (InputDown(gc_brake, ssplayer))
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
{
cmd->buttons |= BT_BRAKE;
forward -= forwardmove[0]; // 25 - Halved value so clutching is possible
if (InputDown(gc_accelerate, ssplayer))
cmd->buttons |= BT_ACCELERATE;
if (InputDown(gc_brake, ssplayer))
cmd->buttons |= BT_BRAKE;
axis = JoyAxis(AXISMOVE, ssplayer);
if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0) || (analogjoystickmove && axis < 0))
forward += forwardmove[1];
if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0) || (analogjoystickmove && axis > 0))
forward -= forwardmove[1];
}
else
{
// forward with key or button // SRB2kart - we use an accel/brake instead of forward/backward.
if (InputDown(gc_accelerate, ssplayer) || player->kartstuff[k_mushroomtimer])
{
cmd->buttons |= BT_ACCELERATE;
forward = forwardmove[1]; // 50
}
// drift button
if (InputDown(gc_drift, ssplayer))
cmd->buttons |= BT_DRIFT;
if (InputDown(gc_brake, ssplayer))
{
cmd->buttons |= BT_BRAKE;
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
forward -= forwardmove[0]; // 25 - Halved value so clutching is possible
}
// forward/backward is used for aiming
axis = JoyAxis(AXISMOVE, ssplayer);
if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0) || (analogjoystickmove && axis < 0))
cmd->buttons |= BT_FORWARD;
if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0) || (analogjoystickmove && axis > 0))
cmd->buttons |= BT_BACKWARD;
// But forward/backward IS used for aiming.
axis = JoyAxis(AXISMOVE, ssplayer);
if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0) || (analogjoystickmove && axis < 0))
cmd->buttons |= BT_FORWARD;
if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0) || (analogjoystickmove && axis > 0))
cmd->buttons |= BT_BACKWARD;
}
// fire with any button/key
axis = JoyAxis(AXISFIRE, ssplayer);
if (InputDown(gc_fire, ssplayer) || (cv_usejoystick.value && axis > 0))
cmd->buttons |= BT_ATTACK;
if (InputDown(gc_spectate, ssplayer))
cmd->buttons |= BT_SPECTATE;
// drift button
if (InputDown(gc_drift, ssplayer))
cmd->buttons |= BT_DRIFT;
// Lua scriptable buttons
if (InputDown(gc_custom1, ssplayer))
cmd->buttons |= BT_CUSTOM1;
@ -1414,41 +1460,18 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->aiming = G_ClipAimingPitch(&laim);
}
cmd->angleturn = (INT16)(cmd->angleturn - (mousex*8));
if (!mouseaiming && cv_mousemove.value)
forward += mousey;
if (analog ||
(!demoplayback && (player->climbing
|| (player->pflags & PF_SLIDING)))) // Analog for mouse
side += mousex*2;
else
cmd->angleturn = (INT16)(cmd->angleturn - (mousex*8));
mousex = mousey = mlooky = 0;
//{ SRB2kart - Drift support
axis = JoyAxis(AXISTURN, ssplayer);
if (mirrormode)
axis = -axis;
// TODO: we really need to figure out a better way of doing this, two extra buttons used for this is stupid
if (cmd->angleturn > 0) // Drifting to the left
cmd->buttons |= BT_DRIFTLEFT;
else
cmd->buttons &= ~BT_DRIFTLEFT;
if (cmd->angleturn < 0) // Drifting to the right
cmd->buttons |= BT_DRIFTRIGHT;
else
cmd->buttons &= ~BT_DRIFTRIGHT;
//}
// limit turning to angleturn[1] to stop mouselook letting you look too fast
if (cmd->angleturn > angleturn[1])
cmd->angleturn = angleturn[1];
else if (cmd->angleturn < -angleturn[1])
cmd->angleturn = -angleturn[1];
if (player->mo)
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn);
// SRB2kart - no additional angle if not moving
if ((player->mo && player->speed > 0) || (leveltime > 140 && (cmd->buttons & BT_ACCELERATE) && (cmd->buttons & BT_BRAKE)))
lang += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(lang >> 16);
if (forward > MAXPLMOVE)
forward = MAXPLMOVE;
else if (forward < -MAXPLMOVE)
@ -1474,12 +1497,21 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
side = temp;
}
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
cmd->sidemove = (SINT8)(cmd->sidemove + side);
if (mirrormode)
if (cmd->buttons & BT_BRAKE && !forward) // Sal: If you're not accelerating, but going forward, then you should just lose your momentum. Request from Sev
{
cmd->forwardmove = (SINT8)(cmd->forwardmove / 2);
cmd->sidemove = (SINT8)(cmd->sidemove / 2);
}
else
{
cmd->forwardmove = (SINT8)(cmd->forwardmove + forward);
cmd->sidemove = (SINT8)(cmd->sidemove + side);
}
if (cv_kartmirror.value)
cmd->sidemove = -cmd->sidemove;
/*if (ssplayer == 2 && player->bot == 1) {
if (ssplayer == 2 && player->bot == 1) {
if (!player->powers[pw_tailsfly] && (cmd->forwardmove || cmd->sidemove || cmd->buttons))
{
player->bot = 2; // A player-controlled bot. Returns to AI when it respawns.
@ -1490,35 +1522,79 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1); // empty, or external driver
B_BuildTiccmd(player, cmd);
}
}*/
}
if (ssplayer == 2)
{
localangle2 = lang;
localaiming2 = laim;
keyboard_look2 = kbl;
turnheld2 = th;
}
else if (ssplayer == 3)
{
localangle3 = lang;
localaiming3 = laim;
keyboard_look3 = kbl;
turnheld3 = th;
}
else if (ssplayer == 4)
{
localangle4 = lang;
localaiming4 = laim;
keyboard_look4 = kbl;
turnheld4 = th;
//{ SRB2kart - Drift support
axis = JoyAxis(AXISTURN, ssplayer);
if (cv_kartmirror.value)
axis = -axis;
// TODO: Remove this hack please :(
if (cmd->angleturn > 0) // Drifting to the left
cmd->buttons |= BT_DRIFTLEFT;
else
cmd->buttons &= ~BT_DRIFTLEFT;
if (cmd->angleturn < 0) // Drifting to the right
cmd->buttons |= BT_DRIFTRIGHT;
else
cmd->buttons &= ~BT_DRIFTRIGHT;
//}
if (analog) {
cmd->angleturn = (INT16)(thiscam->angle >> 16);
if (player->awayviewtics)
cmd->angleturn = (INT16)(player->awayviewmobj->angle >> 16);
}
else
{
localangle = lang;
localaiming = laim;
keyboard_look = kbl;
turnheld = th;
// limit turning to angleturn[1] to stop mouselook letting you look too fast
if (cmd->angleturn > angleturn[1])
cmd->angleturn = angleturn[1];
else if (cmd->angleturn < -angleturn[1])
cmd->angleturn = -angleturn[1];
if (player->mo)
cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn);
// SRB2kart - no additional angle if not moving
if ((player->mo && player->speed > 0) || (leveltime > 140 && cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE) || (player->spectator || objectplacing))
lang += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(lang >> 16);
}
switch (ssplayer)
{
case 2:
localangle2 = lang;
localaiming2 = laim;
keyboard_look2 = kbl;
turnheld2 = th;
camspin2 = InputDown(gc_lookback, ssplayer);
break;
case 3:
localangle3 = lang;
localaiming3 = laim;
keyboard_look3 = kbl;
turnheld3 = th;
camspin3 = InputDown(gc_lookback, ssplayer);
break;
case 4:
localangle4 = lang;
localaiming4 = laim;
keyboard_look4 = kbl;
turnheld4 = th;
camspin4 = InputDown(gc_lookback, ssplayer);
break;
case 1:
default:
localangle = lang;
localaiming = laim;
keyboard_look = kbl;
turnheld = th;
camspin = InputDown(gc_lookback, ssplayer);
break;
}
//Reset away view if a command is given.
@ -1725,6 +1801,7 @@ void G_DoLoadLevel(boolean resetplayer)
static INT32 pausedelay = 0;
static INT32 camtoggledelay, camtoggledelay2, camtoggledelay3, camtoggledelay4 = 0;
static INT32 spectatedelay, spectatedelay2, spectatedelay3, spectatedelay4 = 0;
//
// G_Responder
@ -1776,11 +1853,12 @@ boolean G_Responder(event_t *ev)
continue;
}*/
if (gametype != GT_RACE) // srb2kart
// SRB2Kart: Ehhh, who cares, Mario Kart's designed around screen-cheating anyway
/*if (gametype != GT_RACE)
{
if (players[consoleplayer].kartstuff[k_balloon] > 0)
continue;
}
}*/
break;
} while (displayplayer != consoleplayer);
@ -1930,6 +2008,55 @@ boolean G_Responder(event_t *ev)
CV_SetValue(&cv_chasecam4, cv_chasecam4.value ? 0 : 1);
}
}
if (ev->data1 == gamecontrol[gc_spectate][0]
|| ev->data1 == gamecontrol[gc_spectate][1])
{
if ((netgame || splitscreen) && !players[consoleplayer].powers[pw_flashing] && !spectatedelay)
{
if (players[consoleplayer].spectator && cv_allowteamchange.value)
P_SpectatorJoinGame(&players[consoleplayer]);
else
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 (players[secondarydisplayplayer].spectator && cv_allowteamchange.value)
P_SpectatorJoinGame(&players[secondarydisplayplayer]);
else
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 (players[thirddisplayplayer].spectator && cv_allowteamchange.value)
P_SpectatorJoinGame(&players[thirddisplayplayer]);
else
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 (players[fourthdisplayplayer].spectator && cv_allowteamchange.value)
P_SpectatorJoinGame(&players[fourthdisplayplayer]);
else
COM_ImmedExecute("changeteam4 spectator");
}
spectatedelay4 = NEWTICRATE / 7;
}
return true;
case ev_keyup:
@ -2871,8 +2998,12 @@ boolean G_GametypeHasTeams(void)
//
boolean G_GametypeHasSpectators(void)
{
return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE
&& gametype != GT_MATCH); // srb2kart: temporary?
// SRB2Kart: We don't have any exceptions to not being able to spectate yet. Maybe when SP & bots roll around.
#if 0
return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE);
#else
return true;
#endif
}
//

View file

@ -82,6 +82,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming);
extern angle_t localangle, localangle2, localangle3, localangle4;
extern INT32 localaiming, localaiming2, localaiming3, localaiming4; // should be an angle_t but signed
extern boolean camspin, camspin2, camspin3, camspin4; // SRB2Kart
//
// GAME

View file

@ -1172,7 +1172,8 @@ void HU_Drawer(void)
return;
// draw the crosshair, not when viewing demos nor with chasecam
if (!automapactive && cv_crosshair.value && !demoplayback && !camera.chase && !players[displayplayer].spectator)
// SRB2kart: not for kart though :V
/*if (!automapactive && cv_crosshair.value && !demoplayback && !camera.chase && !players[displayplayer].spectator)
HU_DrawCrosshair();
if (!automapactive && cv_crosshair2.value && !demoplayback && !camera2.chase && !players[secondarydisplayplayer].spectator)
@ -1182,7 +1183,7 @@ void HU_Drawer(void)
HU_DrawCrosshair3();
if (!automapactive && cv_crosshair4.value && !demoplayback && !camera4.chase && !players[fourthdisplayplayer].spectator)
HU_DrawCrosshair4();
HU_DrawCrosshair4();*/
// draw desynch text
if (hu_resynching)

View file

@ -2765,6 +2765,9 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
fixed_t p_maxspeed = FixedMul(K_GetKartSpeed(player, false), 3*FRACUNIT);
fixed_t adjustangle = FixedDiv((p_maxspeed>>16) - (player->speed>>16), (p_maxspeed>>16) + player->kartweight);
if (player->spectator)
return turnvalue;
if (player->kartstuff[k_feather] & 2 && !P_IsObjectOnGround(player->mo))
adjustangle /= 2;
@ -4680,9 +4683,12 @@ static void K_drawKartPositionFaces(void)
if (!playeringame[j])
continue;
if (players[j].spectator)
continue;
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i] && completed[i] == false
if (playeringame[i] && completed[i] == false && players[i].mo && !players[i].spectator
&& (rankplayer[ranklines] < 0 || players[i].kartstuff[k_position] < players[rankplayer[ranklines]].kartstuff[k_position]))
{
rankplayer[ranklines] = i;
@ -4837,7 +4843,7 @@ static void K_drawKartSpeedometer(void)
static void K_drawKartBalloonsOrKarma(void)
{
UINT8 *colormap = R_GetTranslationColormap(-1, stplyr->skincolor, 0);
UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, stplyr->skincolor, 0);
INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT);
if (splitscreen > 1)
@ -4914,6 +4920,9 @@ static void K_drawKartPlayerCheck(void)
if (stplyr->awayviewtics)
return;
if (camspin)
return;
for (i = 0; i < MAXPLAYERS; i++)
{
if (&players[i] == stplyr)
@ -4948,7 +4957,7 @@ static void K_drawKartPlayerCheck(void)
else if (x > 306)
x = 306;
colormap = R_GetTranslationColormap(-1, players[i].mo->color, 0);
colormap = R_GetTranslationColormap(TC_DEFAULT, players[i].mo->color, 0);
V_DrawMappedPatch(x, CHEK_Y, V_HUDTRANS|splitflags, localpatch, colormap);
}
}
@ -5356,28 +5365,31 @@ void K_drawKartHUD(void)
}
}
if (gametype == GT_RACE) // Race-only elements
if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode
{
// Draw the lap counter
K_drawKartLaps();
if (!splitscreen)
if (gametype == GT_RACE) // Race-only elements
{
// Draw the speedometer
// TODO: Make a better speedometer.
K_drawKartSpeedometer();
}
// Draw the lap counter
K_drawKartLaps();
if (!modeattacking)
{
// Draw the numerical position
K_DrawKartPositionNum(stplyr->kartstuff[k_position]);
if (!splitscreen)
{
// Draw the speedometer
// TODO: Make a better speedometer.
K_drawKartSpeedometer();
}
if (!modeattacking)
{
// Draw the numerical position
K_DrawKartPositionNum(stplyr->kartstuff[k_position]);
}
}
else if (gametype == GT_MATCH) // Battle-only
{
// Draw the hits left!
K_drawKartBalloonsOrKarma();
}
}
else if (gametype == GT_MATCH) // Battle-only
{
// Draw the hits left!
K_drawKartBalloonsOrKarma();
}
}

View file

@ -112,10 +112,10 @@ static int player_get(lua_State *L)
lua_pushfixed(L, plr->viewz);
else if (fastcmp(field,"viewheight"))
lua_pushfixed(L, plr->viewheight);
else if (fastcmp(field,"deltaviewheight"))
/*else if (fastcmp(field,"deltaviewheight"))
lua_pushfixed(L, plr->deltaviewheight);
else if (fastcmp(field,"bob"))
lua_pushfixed(L, plr->bob);
lua_pushfixed(L, plr->bob);*/
else if (fastcmp(field,"aiming"))
lua_pushangle(L, plr->aiming);
else if (fastcmp(field,"health"))
@ -371,10 +371,10 @@ static int player_set(lua_State *L)
plr->viewz = luaL_checkfixed(L, 3);
else if (fastcmp(field,"viewheight"))
plr->viewheight = luaL_checkfixed(L, 3);
else if (fastcmp(field,"deltaviewheight"))
/*else if (fastcmp(field,"deltaviewheight"))
plr->deltaviewheight = luaL_checkfixed(L, 3);
else if (fastcmp(field,"bob"))
plr->bob = luaL_checkfixed(L, 3);
plr->bob = luaL_checkfixed(L, 3);*/
else if (fastcmp(field,"aiming")) {
plr->aiming = luaL_checkangle(L, 3);
if (plr == &players[consoleplayer])

View file

@ -1010,7 +1010,7 @@ void OP_NightsObjectplace(player_t *player)
}
// This places a bumper!
if (cmd->buttons & BT_SPECTATE)
/*if (cmd->buttons & BT_SPECTATE)
{
player->pflags |= PF_ATTACKDOWN;
if (!OP_HeightOkay(player, false))
@ -1018,7 +1018,7 @@ void OP_NightsObjectplace(player_t *player)
mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false);
P_SpawnMapThing(mt);
}
}*/
// This places a ring!
if (cmd->buttons & BT_BACKWARD)
@ -1101,7 +1101,7 @@ void OP_ObjectplaceMovement(player_t *player)
if (!(cmd->angleturn & TICCMD_RECEIVED))
ticmiss++;
if (cmd->buttons & BT_DRIFT)
if (cmd->buttons & BT_ACCELERATE)
player->mo->z += FRACUNIT*cv_speed.value;
else if (cmd->buttons & BT_BRAKE)
player->mo->z -= FRACUNIT*cv_speed.value;
@ -1130,7 +1130,7 @@ void OP_ObjectplaceMovement(player_t *player)
player->mo->eflags &= ~MFE_VERTICALFLIP;
// make sure viewz follows player if in 1st person mode
player->deltaviewheight = 0;
//player->deltaviewheight = 0;
player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, player->mo->scale);
if (player->mo->eflags & MFE_VERTICALFLIP)
player->viewz = player->mo->z + player->mo->height - player->viewheight;
@ -1167,19 +1167,19 @@ void OP_ObjectplaceMovement(player_t *player)
if (player->pflags & PF_ATTACKDOWN)
{
// Are ANY objectplace buttons pressed? If no, remove flag.
if (!(cmd->buttons & (BT_ATTACK|BT_SPECTATE|BT_BACKWARD|BT_FORWARD)))
if (!(cmd->buttons & (BT_ATTACK|BT_DRIFT)))
player->pflags &= ~PF_ATTACKDOWN;
// Do nothing.
return;
}
if (cmd->buttons & BT_FORWARD)
/*if (cmd->buttons & BT_FORWARD)
{
OP_CycleThings(-1);
player->pflags |= PF_ATTACKDOWN;
}
else if (cmd->buttons & BT_BACKWARD)
else*/ if (cmd->buttons & BT_DRIFT)
{
OP_CycleThings(1);
player->pflags |= PF_ATTACKDOWN;
@ -1266,10 +1266,10 @@ void Command_ObjectPlace_f(void)
HU_DoCEcho(va(M_GetText(
"\\\\\\\\\\\\\\\\\\\\\\\\\x82"
" Objectplace Controls: \x80\\\\"
"Camera L/R: Cycle mapthings\\"
" Jump: Float up \\"
" Spin: Float down \\"
" Fire Ring: Place object \\")));
" Drift: Cycle mapthings\\"
"Accelerate: Float up \\"
" Brake: Float down \\"
" Item: Place object \\")));
}
// Save all the player's data.

View file

@ -139,6 +139,7 @@ boolean P_PlayerInPain(player_t *player);
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
void P_ResetPlayer(player_t *player);
boolean P_IsLocalPlayer(player_t *player);
boolean P_SpectatorJoinGame(player_t *player);
boolean P_IsObjectInGoop(mobj_t *mo);
boolean P_IsObjectOnGround(mobj_t *mo);

View file

@ -2738,8 +2738,8 @@ static void P_PlayerZMovement(mobj_t *mo)
else
mo->player->viewheight -= mo->floorz - mo->z;
mo->player->deltaviewheight =
(FixedMul(cv_viewheight.value<<FRACBITS, mo->scale) - mo->player->viewheight)>>3;
/*mo->player->deltaviewheight =
(FixedMul(cv_viewheight.value<<FRACBITS, mo->scale) - mo->player->viewheight)>>3;*/
}
// adjust height
@ -2812,8 +2812,9 @@ static void P_PlayerZMovement(mobj_t *mo)
mo->pmomz = 0; // We're on a new floor, don't keep doing platform movement.
// Squat down. Decrease viewheight for a moment after hitting the ground (hard),
if (P_MobjFlip(mo)*mo->momz < -FixedMul(8*FRACUNIT, mo->scale))
/*if (P_MobjFlip(mo)*mo->momz < -FixedMul(8*FRACUNIT, mo->scale))
mo->player->deltaviewheight = (P_MobjFlip(mo)*mo->momz)>>3; // make sure momz is negative
*/
if (!tmfloorthing || tmfloorthing->flags & (MF_PUSHABLE|MF_MONITOR)
|| tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER) // Spin Attack
@ -9463,7 +9464,10 @@ void P_SpawnPlayer(INT32 playernum)
p->spectator = false;
}
else if (netgame && p->jointime < 1)
/*p->spectator = true*/;
{
//p->spectator = true;
p->kartstuff[k_comebackshowninfo] = 0;
}
else if (multiplayer && !netgame)
{
// If you're in a team game and you don't have a team assigned yet...
@ -9540,9 +9544,6 @@ void P_SpawnPlayer(INT32 playernum)
overheadarrow->flags2 |= MF2_DONTDRAW;
P_SetScale(overheadarrow, mobj->destscale);
if (leveltime < 1)
p->kartstuff[k_comebackshowninfo] = 0;
if (gametype != GT_RACE)
{
/*INT32 i;

View file

@ -64,7 +64,7 @@ static void P_NukeAllPlayers(player_t *player);
//
// 16 pixels of bob
#define MAXBOB (0x10 << FRACBITS)
//#define MAXBOB (0x10 << FRACBITS)
static boolean onground;
@ -180,9 +180,9 @@ boolean P_AutoPause(void)
//
void P_CalcHeight(player_t *player)
{
INT32 angle;
fixed_t bob;
fixed_t pviewheight;
//INT32 angle;
//fixed_t bob;
//fixed_t pviewheight;
mobj_t *mo = player->mo;
// Regular movement bobbing.
@ -191,11 +191,11 @@ void P_CalcHeight(player_t *player)
// Note: a LUT allows for effects
// like a ramp with low health.
player->bob = (FixedMul(player->rmomx,player->rmomx)
/*player->bob = (FixedMul(player->rmomx,player->rmomx)
+ FixedMul(player->rmomy,player->rmomy))>>2;
if (player->bob > FixedMul(MAXBOB, mo->scale))
player->bob = FixedMul(MAXBOB, mo->scale);
player->bob = FixedMul(MAXBOB, mo->scale);*/
if (!P_IsObjectOnGround(mo))
{
@ -214,13 +214,13 @@ void P_CalcHeight(player_t *player)
return;
}
angle = (FINEANGLES/20*localgametic)&FINEMASK;
bob = FixedMul(player->bob/2, FINESINE(angle));
//angle = (FINEANGLES/20*localgametic)&FINEMASK;
//bob = FixedMul(player->bob/2, FINESINE(angle));
// move viewheight
pviewheight = FixedMul(cv_viewheight.value << FRACBITS, mo->scale); // default eye view height
player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, mo->scale); // default eye view height
if (player->playerstate == PST_LIVE)
/*if (player->playerstate == PST_LIVE)
{
player->viewheight += player->deltaviewheight;
@ -243,12 +243,12 @@ void P_CalcHeight(player_t *player)
if (!player->deltaviewheight)
player->deltaviewheight = 1;
}
}
}*/
if (player->mo->eflags & MFE_VERTICALFLIP)
player->viewz = mo->z + mo->height - player->viewheight - bob;
player->viewz = mo->z + mo->height - player->viewheight; //- bob
else
player->viewz = mo->z + player->viewheight + bob;
player->viewz = mo->z + player->viewheight; //+ bob
if (player->viewz > mo->ceilingz-FixedMul(4*FRACUNIT, mo->scale))
player->viewz = mo->ceilingz-FixedMul(4*FRACUNIT, mo->scale);
@ -5068,7 +5068,7 @@ static void P_SpectatorMovement(player_t *player)
if (player->mo->z < player->mo->floorz)
player->mo->z = player->mo->floorz;
if (cmd->buttons & BT_DRIFT)
if (cmd->buttons & BT_ACCELERATE)
player->mo->z += FRACUNIT*16;
else if (cmd->buttons & BT_BRAKE)
player->mo->z -= FRACUNIT*16;
@ -7993,7 +7993,7 @@ void P_FindEmerald(void)
static void P_DeathThink(player_t *player)
{
ticcmd_t *cmd = &player->cmd;
player->deltaviewheight = 0;
//player->deltaviewheight = 0;
if (player->deadtimer < INT32_MAX)
player->deadtimer++;
@ -8012,12 +8012,13 @@ static void P_DeathThink(player_t *player)
player->playerstate = PST_REBORN;
else if (player->lives > 0 && !G_IsSpecialStage(gamemap) && leveltime >= 140) // Don't allow "click to respawn" in special stages!
{
// SRB2kart
if (player->spectator)
// SRB2kart-- But wait, why'd we add this? :eggthinking:
/*if (player->spectator)
{
CONS_Printf("%s entered the game.\n", player_names[player-players]);
player->spectator = false;
}
}*/
//player->kartstuff[k_lakitu] = 48; // See G_PlayerReborn in g_game.c
// SRB2kart - spawn automatically after 1 second
@ -8174,25 +8175,25 @@ static CV_PossibleValue_t CV_CamRotate[] = {{-720, "MIN"}, {720, "MAX"}, {0, NUL
consvar_t cv_cam_dist = {"cam_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_height = {"cam_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_still = {"cam_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_speed = {"cam_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_speed = {"cam_speed", "0.45", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_rotate = {"cam_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam_rotspeed = {"cam_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_dist = {"cam2_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_height = {"cam2_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_still = {"cam2_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_speed = {"cam2_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_speed = {"cam2_speed", "0.45", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_rotate = {"cam2_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate2_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam2_rotspeed = {"cam2_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_dist = {"cam3_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_height = {"cam3_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_still = {"cam3_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_speed = {"cam3_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_speed = {"cam3_speed", "0.45", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_rotate = {"cam3_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate3_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam3_rotspeed = {"cam3_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_dist = {"cam4_dist", "160", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_height = {"cam4_height", "50", CV_FLOAT|CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_still = {"cam4_still", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_speed = {"cam4_speed", "0.3", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_speed = {"cam4_speed", "0.45", CV_FLOAT|CV_SAVE, CV_CamSpeed, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_rotate = {"cam4_rotate", "0", CV_CALL|CV_NOINIT, CV_CamRotate, CV_CamRotate4_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_cam4_rotspeed = {"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@ -8258,7 +8259,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
angle_t angle = 0, focusangle = 0, focusaiming = 0;
fixed_t x, y, z, dist, height, checkdist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
INT32 camrotate;
boolean camstill, cameranoclip;
boolean camstill, cameranoclip, lookback;
mobj_t *mo;
subsector_t *newsubsec;
fixed_t f1, f2;
@ -8367,6 +8368,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam_rotate.value;
camdist = FixedMul(cv_cam_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
camheight = FixedMul(cv_cam_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
lookback = camspin;
}
else if (thiscam == &camera2) // Camera 2
{
@ -8375,6 +8377,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam2_rotate.value;
camdist = FixedMul(cv_cam2_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
camheight = FixedMul(cv_cam2_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
lookback = camspin2;
}
else if (thiscam == &camera3) // Camera 3
{
@ -8383,6 +8386,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam3_rotate.value;
camdist = FixedMul(cv_cam3_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
camheight = FixedMul(cv_cam3_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
lookback = camspin3;
}
else // Camera 4
{
@ -8391,12 +8395,21 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
camrotate = cv_cam4_rotate.value;
camdist = FixedMul(cv_cam4_dist.value, mapheaderinfo[gamemap-1]->mobj_scale);
camheight = FixedMul(cv_cam4_height.value, mapheaderinfo[gamemap-1]->mobj_scale);
lookback = camspin4;
}
// SRB2kart - Camera flipper
if (lookback)
{
camrotate += 180;
camspeed *= 2;
if (camspeed > FRACUNIT)
camspeed = FRACUNIT;
}
#ifdef REDSANALOG
if (P_AnalogMove(player) && (player->cmd.buttons & (BT_FORWARD|BT_BACKWARD)) == (BT_FORWARD|BT_BACKWARD)) {
camstill = true;
if (camspeed < 4*FRACUNIT/5)
camspeed = 4*FRACUNIT/5;
}
@ -8451,43 +8464,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
thiscam->angle = angle;
}
// SRB2kart - Camera flipper
if (!objectplacing && displayplayer == consoleplayer)
{
if (player->kartstuff[k_camspin] == 1)
{
if (thiscam == &camera)
{
CV_SetValue(&cv_cam_rotate, camrotate + 180);
}
else if (thiscam == &camera2)
{
CV_SetValue(&cv_cam2_rotate, camrotate + 180);
}
else if (thiscam == &camera3)
{
CV_SetValue(&cv_cam3_rotate, camrotate + 180);
}
else
{
CV_SetValue(&cv_cam4_rotate, camrotate + 180);
}
player->kartstuff[k_camspin] = 2;
}
if (player->kartstuff[k_camspin] == -1)
{
if (thiscam == &camera)
{
CV_SetValue(&cv_cam_rotate, camrotate - 180);
}
else
{
CV_SetValue(&cv_cam2_rotate, camrotate - 180);
}
player->kartstuff[k_camspin] = 0;
}
}
/* // SRB2kart - camera controls are disabled... for now.
if (!objectplacing && !(twodlevel || (mo->flags2 & MF2_TWOD)) && !(player->pflags & PF_NIGHTSMODE) && displayplayer == consoleplayer)
{
@ -8805,7 +8781,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
// point viewed by the camera
// this point is just 64 unit forward the player
dist = FixedMul(64 << FRACBITS, mo->scale);
dist = FixedMul(64 << FRACBITS, mapheaderinfo[gamemap-1]->mobj_scale);
viewpointx = mo->x + FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
viewpointy = mo->y + FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
@ -8916,10 +8892,21 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
thiscam->aiming = ANGLE_22h;
}
#if 0
// SRB2Kart: keep camera the same distance away from the player, while maintaining its angle
{
fixed_t xlen = (thiscam->x+thiscam->momx) - (mo->x+mo->momx);
fixed_t ylen = (thiscam->y+thiscam->momy) - (mo->y+mo->momy);
fixed_t xydist = P_AproxDistance(xlen, ylen);
thiscam->momx = FixedMul(dist, FixedDiv(xlen, xydist));
thiscam->momy = FixedMul(dist, FixedDiv(ylen, xydist));
}
#endif
return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming);
}
static boolean P_SpectatorJoinGame(player_t *player)
boolean P_SpectatorJoinGame(player_t *player)
{
if (!G_GametypeHasSpectators() && G_IsSpecialStage(gamemap) && useNightsSS) // Special Stage spectators should NEVER be allowed to rejoin the game
{
@ -10059,7 +10046,7 @@ void P_PlayerAfterThink(player_t *player)
else
{
// defaults to make sure 1st person cam doesn't do anything weird on startup
player->deltaviewheight = 0;
//player->deltaviewheight = 0;
player->viewheight = FixedMul(cv_viewheight.value << FRACBITS, player->mo->scale);
if (player->mo->eflags & MFE_VERTICALFLIP)
player->viewz = player->mo->z + player->mo->height - player->viewheight;

View file

@ -1951,15 +1951,17 @@ static void ST_overlayDrawer(void)
#endif
)
{
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(60), V_HUDTRANSHALF, M_GetText("You are a spectator."));
if (G_GametypeHasTeams())
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("Press Fire to be assigned to a team."));
// SRB2kart: changed positions & text
V_DrawString(2, BASEVIDHEIGHT-50, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
/*if (G_GametypeHasTeams())
V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Team"));
else if (G_IsSpecialStage(gamemap) && useNightsSS)
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("You cannot join the game until the stage has ended."));
else
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), V_HUDTRANSHALF, M_GetText("Press Fire to enter the game."));
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(148), V_HUDTRANSHALF, M_GetText("Press F12 to watch another player."));
V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(164), V_HUDTRANSHALF, M_GetText("Press Jump to float and Spin to sink."));
V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF|V_REDMAP, M_GetText("- CANNOT JOIN -"));
else*/
V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Enter Game"));
V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("F12 - Change View"));
V_DrawString(2, BASEVIDHEIGHT-20, V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
V_DrawString(2, BASEVIDHEIGHT-10, V_HUDTRANSHALF, M_GetText("Brake - Sink"));
}
}