Merge branch 'splitscreendirector' into Saturn-Testing
This commit is contained in:
commit
ecefd1d3ee
21 files changed
+517
-339
No files matched your search
@@ -511,6 +511,11 @@ void D_ResetTiccmds(void)
|
||||
D_Clearticcmd(textcmds[i]->tic);
|
||||
}
|
||||
|
||||
ticcmd_t *D_LocalTiccmd(UINT8 ss)
|
||||
{
|
||||
return &localcmds[ss];
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// end of extra data function
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
@@ -645,7 +645,9 @@ extern char motd[254], server_context[8];
|
||||
extern UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
INT32 D_NumPlayers(void);
|
||||
|
||||
void D_ResetTiccmds(void);
|
||||
ticcmd_t *D_LocalTiccmd(UINT8 ss);
|
||||
|
||||
tic_t GetLag(INT32 node);
|
||||
//UINT8 GetFreeXCmdSize(UINT8 playerid);
|
||||
|
||||
+15
-3
@@ -572,7 +572,15 @@ static CV_PossibleValue_t ps_descriptor_cons_t[] = {
|
||||
{1, "Average"}, {2, "SD"}, {3, "Minimum"}, {4, "Maximum"}, {0, NULL}};
|
||||
consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
//consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_director[MAXSPLITSCREENPLAYERS] = {
|
||||
{"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_kartdebugdirector = {"debugdirector", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showdirectorhud = {"showdirectorhud", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -1009,7 +1017,11 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_showviewpointtext);
|
||||
CV_RegisterVar(&cv_showdownloadprompt);
|
||||
|
||||
CV_RegisterVar(&cv_director);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_director[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_kartdebugdirector);
|
||||
CV_RegisterVar(&cv_showdirectorhud);
|
||||
|
||||
@@ -2305,7 +2317,7 @@ static void Command_View_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (demo.freecam)
|
||||
if (camera[viewnum-1].freecam)
|
||||
return;
|
||||
|
||||
displayplayerp = &displayplayers[viewnum-1];
|
||||
|
||||
+2
-1
@@ -197,7 +197,8 @@ extern consvar_t cv_ps_thinkframe_page;
|
||||
extern consvar_t cv_ps_samplesize;
|
||||
extern consvar_t cv_ps_descriptor;
|
||||
|
||||
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
|
||||
extern consvar_t cv_director[4]; // screw you includes
|
||||
extern consvar_t cv_kartdebugdirector, cv_showdirectorhud;
|
||||
|
||||
extern consvar_t cv_showtrackaddon;
|
||||
|
||||
|
||||
+11
-1
@@ -8563,6 +8563,16 @@ static int lua_enumlib_mariomode_get(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_enumlib_replayfreecam_get(lua_State *L)
|
||||
{
|
||||
if (dedicated) // huh?
|
||||
lua_pushboolean(L, false);
|
||||
else
|
||||
lua_pushboolean(L, camera[R_GetViewNumber()].freecam);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_enumlib_twodlevel_get(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, twodlevel);
|
||||
@@ -9240,7 +9250,7 @@ int LUA_EnumLib(lua_State *L)
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "replayfreecam");
|
||||
lua_glib_push_bool_getter(L, &demo.freecam);
|
||||
lua_pushcfunction(L, lua_enumlib_replayfreecam_get);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
if (!mathlib)
|
||||
|
||||
+62
-34
@@ -338,7 +338,7 @@ INT16 prevmap, nextmap;
|
||||
|
||||
// save if director is enabled
|
||||
// so demos can disable it by default and restore it after
|
||||
static int directorstate = 0;
|
||||
static int directorstate[MAXSPLITSCREENPLAYERS] = {0,0,0,0};
|
||||
tic_t directortoggletimer = 0;
|
||||
|
||||
static CV_PossibleValue_t recordmultiplayerdemos_cons_t[] = {{0, "Disabled"}, {1, "Manual Save"}, {2, "Auto Save"}, {0, NULL}};
|
||||
@@ -885,6 +885,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
thiscam = (player->bot == 2 ? &camera[0] : &camera[forplayer]);
|
||||
else
|
||||
thiscam = &camera[forplayer];
|
||||
|
||||
lang = localangle[forplayer];
|
||||
laim = localaiming[forplayer];
|
||||
th = turnheld[forplayer];
|
||||
@@ -1211,8 +1212,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
displayplayers[0] = consoleplayer;
|
||||
G_FixCamera(1);
|
||||
// i dont like this lmao
|
||||
if (cv_director.value)
|
||||
CV_SetValue(&cv_director, 0);
|
||||
if (cv_director[0].value)
|
||||
CV_SetValue(&cv_director[0], 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1401,7 +1402,7 @@ boolean G_Responder(event_t *ev)
|
||||
}
|
||||
}
|
||||
|
||||
if (gamestate == GS_LEVEL && ev->type == ev_keydown && multiplayer && demo.playback && !demo.freecam)
|
||||
if (gamestate == GS_LEVEL && ev->type == ev_keydown && multiplayer && demo.playback)
|
||||
{
|
||||
if (ev->data1 == gamecontrolbis[gc_viewpoint][0] || ev->data1 == gamecontrolbis[gc_viewpoint][1])
|
||||
{
|
||||
@@ -1548,10 +1549,39 @@ boolean G_Responder(event_t *ev)
|
||||
COM_ImmedExecute("changeteam4 spectator");
|
||||
}
|
||||
}
|
||||
if (ev->data1 == gamecontrol[gc_director][0]
|
||||
|| ev->data1 == gamecontrol[gc_director][1])
|
||||
|
||||
if (ev->data1 == gamecontrol[gc_director][0] || ev->data1 == gamecontrol[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector();
|
||||
K_ToggleDirector(0);
|
||||
}
|
||||
else if (ev->data1 == gamecontrolbis[gc_director][0] || ev->data1 == gamecontrolbis[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector(1);
|
||||
}
|
||||
else if (ev->data1 == gamecontrol3[gc_director][0] || ev->data1 == gamecontrol3[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector(2);
|
||||
}
|
||||
else if (ev->data1 == gamecontrol4[gc_director][0] || ev->data1 == gamecontrol4[gc_director][1])
|
||||
{
|
||||
K_ToggleDirector(3);
|
||||
}
|
||||
|
||||
if (ev->data1 == gamecontrol[gc_freecam][0] || ev->data1 == gamecontrol[gc_freecam][1])
|
||||
{
|
||||
P_ToggleDemoCamera(0);
|
||||
}
|
||||
else if (ev->data1 == gamecontrolbis[gc_freecam][0] || ev->data1 == gamecontrolbis[gc_freecam][1])
|
||||
{
|
||||
P_ToggleDemoCamera(1);
|
||||
}
|
||||
else if (ev->data1 == gamecontrol3[gc_freecam][0] || ev->data1 == gamecontrol3[gc_freecam][1])
|
||||
{
|
||||
P_ToggleDemoCamera(2);
|
||||
}
|
||||
else if (ev->data1 == gamecontrol4[gc_freecam][0] || ev->data1 == gamecontrol4[gc_freecam][1])
|
||||
{
|
||||
P_ToggleDemoCamera(3);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1734,13 +1764,6 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||
viewnum = playersviewable;
|
||||
splitscreen = viewnum-1;
|
||||
|
||||
/* Prepare extra views for G_FindView to pass. */
|
||||
for (viewd = splits+1; viewd < viewnum; ++viewd)
|
||||
{
|
||||
displayplayerp = (&displayplayers[viewd-1]);
|
||||
(*displayplayerp) = INT32_MAX;
|
||||
}
|
||||
|
||||
R_ExecuteSetViewSize();
|
||||
}
|
||||
|
||||
@@ -1761,7 +1784,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||
G_FixCamera(viewd);
|
||||
}
|
||||
|
||||
if (viewnum == 1 && demo.playback)
|
||||
if (demo.playback && viewnum == 1)
|
||||
consoleplayer = displayplayers[0];
|
||||
}
|
||||
|
||||
@@ -1775,6 +1798,10 @@ void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
|
||||
INT32 *displayplayerp, oldview;
|
||||
displayplayerp = &displayplayers[viewnum-1];
|
||||
oldview = (*displayplayerp);
|
||||
|
||||
// turn off the freecam
|
||||
camera[viewnum].freecam = false;
|
||||
|
||||
G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive);
|
||||
|
||||
// If no other view could be found, go back to what we had.
|
||||
@@ -5775,9 +5802,6 @@ void G_ConfirmRewind(tic_t rewindtime)
|
||||
|
||||
COM_BufInsertText("renderview on\n");
|
||||
|
||||
if (demo.freecam)
|
||||
return; // don't touch from there
|
||||
|
||||
splitscreen = oldss;
|
||||
displayplayers[0] = olddp1;
|
||||
displayplayers[1] = olddp2;
|
||||
@@ -7170,15 +7194,14 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
|
||||
//LUA_HookInt(gamemap, HOOK(MapChange));
|
||||
|
||||
displayplayers[0] = consoleplayer = 0;
|
||||
consoleplayer = 0;
|
||||
memset(playeringame,0,sizeof(playeringame));
|
||||
memset(displayplayers,0,sizeof(displayplayers));
|
||||
memset(camera,0,sizeof(camera)); // reset freecam
|
||||
|
||||
// Load players that were in-game when the map started
|
||||
p = READUINT8(demobuf.p);
|
||||
|
||||
for (i = 1; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
displayplayers[i] = INT32_MAX;
|
||||
|
||||
while (p != 0xFF)
|
||||
{
|
||||
spectator = false;
|
||||
@@ -7294,8 +7317,11 @@ post_compat:
|
||||
players[i].kartweight = kartweight[i];
|
||||
}
|
||||
|
||||
directorstate = cv_director.value;
|
||||
CV_SetValue(&cv_director, 0);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
directorstate[i] = cv_director[i].value;
|
||||
CV_SetValue(&cv_director[i], 0);
|
||||
}
|
||||
|
||||
demo.deferstart = true;
|
||||
}
|
||||
@@ -7862,8 +7888,11 @@ void G_StopDemo(void)
|
||||
demobuf.buffer = NULL;
|
||||
if (demo.playback)
|
||||
{
|
||||
CV_SetValue(&cv_director, directorstate);
|
||||
directorstate = 0;
|
||||
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_SetValue(&cv_director[i], directorstate[i]);
|
||||
directorstate[i] = 0;
|
||||
}
|
||||
}
|
||||
demo.playback = false;
|
||||
if (demo.title)
|
||||
@@ -7872,14 +7901,13 @@ void G_StopDemo(void)
|
||||
demo.timing = false;
|
||||
singletics = false;
|
||||
|
||||
demo.freecam = false;
|
||||
// reset democam shit too:
|
||||
democam.cam = NULL;
|
||||
democam.soundmobj = NULL;
|
||||
democam.localangle = 0;
|
||||
democam.localaiming = 0;
|
||||
democam.turnheld = false;
|
||||
democam.keyboardlook = false;
|
||||
UINT8 i;
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; ++i)
|
||||
{
|
||||
camera[i].freecam = false;
|
||||
camera[i].localangle = 0;
|
||||
camera[i].localaiming = 0;
|
||||
}
|
||||
|
||||
CV_SetValue(&cv_playbackspeed, 1);
|
||||
demo.rewinding = false;
|
||||
|
||||
@@ -902,6 +902,9 @@ static const char *gamecontrolname[num_gamecontrols] =
|
||||
"custom2",
|
||||
"custom3",
|
||||
"director",
|
||||
"freecam",
|
||||
"camfloat",
|
||||
"camsink",
|
||||
};
|
||||
|
||||
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
|
||||
@@ -1139,6 +1142,12 @@ void G_Controldefault(UINT8 player)
|
||||
//gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT
|
||||
gamecontrol[gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down
|
||||
gamecontrol[gc_scores ][1] = KEY_HAT1+0; // D-Pad Up
|
||||
|
||||
gamecontrol[gc_camfloat ][1] = 'a';
|
||||
gamecontrol[gc_camsink ][1] = 'd';
|
||||
|
||||
gamecontrol[gc_camfloat ][1] = KEY_JOY1+0; // A
|
||||
gamecontrol[gc_camsink ][1] = KEY_JOY1+1; // B
|
||||
}
|
||||
|
||||
if (player == 0 || player == 2)
|
||||
|
||||
@@ -100,6 +100,9 @@ typedef enum
|
||||
gc_custom2, // Lua scriptable
|
||||
gc_custom3, // Lua scriptable
|
||||
gc_director,
|
||||
gc_freecam, // Toggle for freecam while ingame
|
||||
gc_camfloat, // alternative button for raising cam
|
||||
gc_camsink, // alternative button for sinking
|
||||
num_gamecontrols
|
||||
} gamecontrols_e;
|
||||
|
||||
|
||||
+95
-74
@@ -12,6 +12,7 @@
|
||||
|
||||
//#include "k_kart.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "v_video.h"
|
||||
#include "k_director.h"
|
||||
@@ -19,6 +20,8 @@
|
||||
#include "p_local.h"
|
||||
#include "st_stuff.h"
|
||||
|
||||
#include "r_fps.h"
|
||||
|
||||
#define SWITCHTIME TICRATE * 5 // cooldown between unforced switches
|
||||
#define BOREDOMTIME 3 * TICRATE / 2 // how long until players considered far apart?
|
||||
#define TRANSFERTIME TICRATE // how long to delay reaction shots?
|
||||
@@ -28,6 +31,8 @@
|
||||
|
||||
struct directorinfo
|
||||
{
|
||||
UINT8 viewnum;
|
||||
player_t* viewplayer;
|
||||
tic_t cooldown; // how long has it been since we last switched?
|
||||
tic_t freeze; // when nonzero, fixed switch pending, freeze logic!
|
||||
INT32 attacker; // who to switch to when freeze delay elapses
|
||||
@@ -38,6 +43,8 @@ struct directorinfo
|
||||
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
|
||||
} directorinfo;
|
||||
|
||||
struct directorinfo directorinfosplit[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
boolean K_DirectorIsPlayerAlone(void)
|
||||
{
|
||||
UINT8 pingame = 0;
|
||||
@@ -67,25 +74,38 @@ static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
|
||||
return FixedMul(n, FixedDiv(scale, mapobjectscale));
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(void)
|
||||
boolean K_DirectorIsAvailable(UINT8 viewnum)
|
||||
{
|
||||
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !demo.freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
|
||||
if ((demo.playback && demo.title) || modeattacking)
|
||||
return false;
|
||||
return ((gamestate == GS_LEVEL) && (demo.playback || ((viewnum <= splitscreen) && (!playeringame[displayplayers[viewnum]] || players[displayplayers[viewnum]].spectator) && !camera[viewnum].freecam && !K_DirectorIsPlayerAlone())));
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(const UINT8 viewnum)
|
||||
{
|
||||
return (cv_director[viewnum].value && K_DirectorIsAvailable(viewnum));
|
||||
}
|
||||
|
||||
void K_InitDirector(void)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
directorinfo.freeze = 0;
|
||||
directorinfo.attacker = 0;
|
||||
directorinfo.maxdist = 0;
|
||||
directorinfo.viewnum = 0;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
directorinfo.sortedplayers[playernum] = -1;
|
||||
directorinfo.gap[playernum] = INT32_MAX;
|
||||
directorinfo.boredom[playernum] = 0;
|
||||
directorinfosplit[i].cooldown = SWITCHTIME;
|
||||
directorinfosplit[i].freeze = 0;
|
||||
directorinfosplit[i].attacker = 0;
|
||||
directorinfosplit[i].maxdist = 0;
|
||||
directorinfosplit[i].viewplayer = NULL;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
directorinfosplit[i].sortedplayers[playernum] = -1;
|
||||
directorinfosplit[i].gap[playernum] = INT32_MAX;
|
||||
directorinfosplit[i].boredom[playernum] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,8 +124,8 @@ static fixed_t K_GetDistanceToFinish(player_t player)
|
||||
continue;
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -124,7 +144,7 @@ static fixed_t K_GetDistanceToFinish(player_t player)
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -148,13 +168,13 @@ static fixed_t K_GetFinishGap(INT32 leader, INT32 follower)
|
||||
}
|
||||
}
|
||||
|
||||
static void K_UpdateDirectorPositions(void)
|
||||
static void K_UpdateDirectorPositions(const UINT8 viewnum)
|
||||
{
|
||||
INT32 playernum;
|
||||
INT32 position;
|
||||
player_t* target;
|
||||
|
||||
memset(directorinfo.sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
memset(directorinfosplit[viewnum].sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
@@ -162,43 +182,43 @@ static void K_UpdateDirectorPositions(void)
|
||||
|
||||
if (playeringame[playernum] && !target->spectator && target->kartstuff[k_position] > 0)
|
||||
{
|
||||
directorinfo.sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
directorinfosplit[viewnum].sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
}
|
||||
}
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
directorinfo.gap[position] = INT32_MAX;
|
||||
directorinfosplit[viewnum].gap[position] = INT32_MAX;
|
||||
|
||||
if (directorinfo.sortedplayers[position] == -1 || directorinfo.sortedplayers[position + 1] == -1)
|
||||
if (directorinfosplit[viewnum].sortedplayers[position] == -1 || directorinfosplit[viewnum].sortedplayers[position + 1] == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
directorinfo.gap[position] = ScaleFromMap(K_GetFinishGap(directorinfo.sortedplayers[position], directorinfo.sortedplayers[position + 1]), FRACUNIT);
|
||||
directorinfosplit[viewnum].gap[position] = ScaleFromMap(K_GetFinishGap(directorinfosplit[viewnum].sortedplayers[position], directorinfosplit[viewnum].sortedplayers[position + 1]), FRACUNIT);
|
||||
|
||||
if (directorinfo.gap[position] >= BREAKAWAYDIST)
|
||||
if (directorinfosplit[viewnum].gap[position] >= BREAKAWAYDIST)
|
||||
{
|
||||
directorinfo.boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfo.boredom[position] + 1));
|
||||
directorinfosplit[viewnum].boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfosplit[viewnum].boredom[position] + 1));
|
||||
}
|
||||
else if (directorinfo.boredom[position] > 0)
|
||||
else if (directorinfosplit[viewnum].boredom[position] > 0)
|
||||
{
|
||||
directorinfo.boredom[position]--;
|
||||
directorinfosplit[viewnum].boredom[position]--;
|
||||
}
|
||||
}
|
||||
|
||||
if (directorinfo.sortedplayers[0] == -1)
|
||||
if (directorinfosplit[viewnum].sortedplayers[0] == -1)
|
||||
{
|
||||
directorinfo.maxdist = -1;
|
||||
directorinfosplit[viewnum].maxdist = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfo.maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfo.sortedplayers[0]]), FRACUNIT);
|
||||
directorinfosplit[viewnum].maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfosplit[viewnum].sortedplayers[0]]), FRACUNIT);
|
||||
}
|
||||
|
||||
static boolean K_CanSwitchDirector(void)
|
||||
static boolean K_CanSwitchDirector(const UINT8 viewnum)
|
||||
{
|
||||
if (directorinfo.cooldown > 0)
|
||||
if (directorinfosplit[viewnum].cooldown > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -206,9 +226,9 @@ static boolean K_CanSwitchDirector(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
static void K_DirectorSwitch(INT32 player, boolean force, const UINT8 viewnum)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsEnabled(viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -223,45 +243,45 @@ static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!force && !K_CanSwitchDirector())
|
||||
if (!force && !K_CanSwitchDirector(viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
G_ResetView(1, player, true);
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
G_ResetView(viewnum+1, player, true);
|
||||
directorinfosplit[viewnum].cooldown = SWITCHTIME;
|
||||
}
|
||||
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time)
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time, const UINT8 viewnum)
|
||||
{
|
||||
if (players[player].exiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfo.attacker = player;
|
||||
directorinfo.freeze = time;
|
||||
directorinfosplit[viewnum].attacker = player;
|
||||
directorinfosplit[viewnum].freeze = time;
|
||||
}
|
||||
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsEnabled(directorinfo.viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!P_IsDisplayPlayer(player))
|
||||
if (directorinfosplit[directorinfo.viewnum].viewplayer != player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (inflictor && inflictor->player)
|
||||
{
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME);
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME, directorinfo.viewnum);
|
||||
}
|
||||
else if (source && source->player)
|
||||
{
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME);
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME, directorinfo.viewnum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,14 +301,14 @@ void K_DrawDirectorDebugger(void)
|
||||
V_DrawThinString(40, 0, V_70TRANS, va("CONF?"));
|
||||
V_DrawThinString(80, 0, V_70TRANS, va("GAP"));
|
||||
V_DrawThinString(120, 0, V_70TRANS, va("BORED"));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfo.cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfo.maxdist));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfosplit[0].cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfosplit[0].maxdist));
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
ytxt = 10 * (position + 1);
|
||||
leader = directorinfo.sortedplayers[position];
|
||||
follower = directorinfo.sortedplayers[position + 1];
|
||||
leader = directorinfosplit[0].sortedplayers[position];
|
||||
follower = directorinfosplit[0].sortedplayers[position + 1];
|
||||
|
||||
if (leader == -1 || follower == -1)
|
||||
break;
|
||||
@@ -301,15 +321,15 @@ void K_DrawDirectorDebugger(void)
|
||||
V_DrawThinString(40, ytxt, V_70TRANS, va("NG"));
|
||||
}
|
||||
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfo.gap[position]));
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfosplit[0].gap[position]));
|
||||
|
||||
if (directorinfo.boredom[position] >= BOREDOMTIME)
|
||||
if (directorinfosplit[0].boredom[position] >= BOREDOMTIME)
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("BORED"));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfo.boredom[position]));
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfosplit[0].boredom[position]));
|
||||
}
|
||||
|
||||
V_DrawThinString(150, ytxt, V_70TRANS, va("%s", player_names[leader]));
|
||||
@@ -317,37 +337,38 @@ void K_DrawDirectorDebugger(void)
|
||||
}
|
||||
}
|
||||
|
||||
void K_UpdateDirector(void)
|
||||
void K_UpdateDirector(const UINT8 viewnum)
|
||||
{
|
||||
INT32 *displayplayerp = &displayplayers[0];
|
||||
INT32 targetposition;
|
||||
directorinfo.viewnum = viewnum;
|
||||
directorinfosplit[directorinfo.viewnum].viewplayer = &players[displayplayers[directorinfo.viewnum]];
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsEnabled(directorinfo.viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
K_UpdateDirectorPositions();
|
||||
K_UpdateDirectorPositions(directorinfo.viewnum);
|
||||
|
||||
if (directorinfo.cooldown > 0) {
|
||||
directorinfo.cooldown--;
|
||||
if (directorinfosplit[directorinfo.viewnum].cooldown > 0) {
|
||||
directorinfosplit[directorinfo.viewnum].cooldown--;
|
||||
}
|
||||
|
||||
// handle pending forced switches
|
||||
if (directorinfo.freeze > 0)
|
||||
if (directorinfosplit[directorinfo.viewnum].freeze > 0)
|
||||
{
|
||||
if (!(--directorinfo.freeze))
|
||||
K_DirectorSwitch(directorinfo.attacker, true);
|
||||
if (!(--directorinfosplit[directorinfo.viewnum].freeze))
|
||||
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].attacker, true, directorinfo.viewnum);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if there's only one player left in the list, just switch to that player
|
||||
if (directorinfo.sortedplayers[0] != -1 && (directorinfo.sortedplayers[1] == -1 ||
|
||||
if (directorinfosplit[directorinfo.viewnum].sortedplayers[0] != -1 && (directorinfosplit[directorinfo.viewnum].sortedplayers[1] == -1 ||
|
||||
// TODO: Battle; I just threw this together quick. Focus on leader.
|
||||
!race_rules()))
|
||||
{
|
||||
K_DirectorSwitch(directorinfo.sortedplayers[0], false);
|
||||
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].sortedplayers[0], false, directorinfo.viewnum);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -359,39 +380,39 @@ void K_UpdateDirector(void)
|
||||
INT32 target;
|
||||
|
||||
// you are out of players, try again
|
||||
if (directorinfo.sortedplayers[targetposition] == -1)
|
||||
if (directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition] == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// pair too far apart? try the next one
|
||||
if (directorinfo.boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
if (directorinfosplit[directorinfo.viewnum].boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// pair finished? try the next one
|
||||
if (players[directorinfo.sortedplayers[targetposition]].exiting)
|
||||
if (players[directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition]].exiting)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't risk switching away from forward pairs at race end, might miss something!
|
||||
if (directorinfo.maxdist > PINCHDIST)
|
||||
if (directorinfosplit[directorinfo.viewnum].maxdist > PINCHDIST)
|
||||
{
|
||||
// if the "next" player is close enough, they should be able to see everyone fine!
|
||||
// walk back through the standings to find a vantage that gets everyone in frame.
|
||||
// (also creates a pretty cool effect w/ overtakes at speed)
|
||||
while (targetposition < MAXPLAYERS && directorinfo.gap[targetposition] < WALKBACKDIST)
|
||||
while (targetposition < MAXPLAYERS && directorinfosplit[directorinfo.viewnum].gap[targetposition] < WALKBACKDIST)
|
||||
{
|
||||
targetposition++;
|
||||
}
|
||||
}
|
||||
|
||||
target = directorinfo.sortedplayers[targetposition];
|
||||
target = directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition];
|
||||
|
||||
// stop here since we're already viewing this player
|
||||
if (*displayplayerp == target)
|
||||
if (displayplayers[directorinfo.viewnum] == target)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -405,30 +426,30 @@ void K_UpdateDirector(void)
|
||||
// if we're certain the back half of the pair is actually in this position, try to switch
|
||||
if (!players[target].kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
K_DirectorSwitch(target, false, directorinfo.viewnum);
|
||||
}
|
||||
|
||||
// even if we're not certain, if we're certain we're watching the WRONG player, try to switch
|
||||
if (players[*displayplayerp].kartstuff[k_position] != targetposition+1 && !players[*displayplayerp].kartstuff[k_positiondelay])
|
||||
// even if we're not certain, if we're cetain we're watching the WRONG player, try to switch
|
||||
if (directorinfosplit[directorinfo.viewnum].viewplayer->kartstuff[k_position] != targetposition+1 && !directorinfosplit[directorinfo.viewnum].viewplayer->kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
K_DirectorSwitch(target, false, directorinfo.viewnum);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void K_ToggleDirector(void)
|
||||
void K_ToggleDirector(const UINT8 viewnum)
|
||||
{
|
||||
if (!directortextactive)
|
||||
if (!K_DirectorIsAvailable(viewnum))
|
||||
return;
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsEnabled(viewnum))
|
||||
{
|
||||
directorinfo.cooldown = 0; // switch immediately
|
||||
directorinfosplit[viewnum].cooldown = 0; // switch immediately
|
||||
}
|
||||
|
||||
directortoggletimer = 0;
|
||||
|
||||
COM_ImmedExecute("add director 1");
|
||||
CV_SetValue(&cv_director[viewnum], (cv_director[viewnum].value ^ 1));
|
||||
}
|
||||
+3
-2
@@ -10,8 +10,9 @@
|
||||
/// \file k_director.h
|
||||
/// \brief SRB2kart automatic spectator camera.
|
||||
|
||||
boolean K_DirectorIsAvailable(UINT8 viewnum);
|
||||
void K_InitDirector(void);
|
||||
void K_UpdateDirector(void);
|
||||
void K_UpdateDirector(UINT8 viewnum);
|
||||
void K_DrawDirectorDebugger(void);
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
|
||||
void K_ToggleDirector(void);
|
||||
void K_ToggleDirector(UINT8 viewnum);
|
||||
+11
-14
@@ -1233,7 +1233,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
||||
dontforcespb = true;
|
||||
|
||||
// This makes the roulette produce the random noises.
|
||||
if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player) && !demo.freecam)
|
||||
if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsDisplayPlayer(player))
|
||||
{
|
||||
#define PLAYROULETTESND S_StartSound(NULL, sfx_itrol1 + ((player->kartstuff[k_itemroulette] / 3) % 8))
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
@@ -1267,7 +1267,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
||||
//player->kartstuff[k_itemblinkmode] = 1;
|
||||
player->kartstuff[k_itemroulette] = 0;
|
||||
player->kartstuff[k_roulettetype] = 0;
|
||||
if (P_IsDisplayPlayer(player) && !demo.freecam)
|
||||
if (P_IsDisplayPlayer(player))
|
||||
S_StartSound(NULL, sfx_itrole);
|
||||
return;
|
||||
}
|
||||
@@ -1280,7 +1280,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
||||
player->kartstuff[k_itemblinkmode] = 2;
|
||||
player->kartstuff[k_itemroulette] = 0;
|
||||
player->kartstuff[k_roulettetype] = 0;
|
||||
if (P_IsDisplayPlayer(player) && !demo.freecam)
|
||||
if (P_IsDisplayPlayer(player))
|
||||
S_StartSound(NULL, sfx_dbgsal);
|
||||
return;
|
||||
}
|
||||
@@ -1312,7 +1312,7 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd)
|
||||
player->kartstuff[k_itemamount] = 1;
|
||||
}
|
||||
|
||||
if (P_IsDisplayPlayer(player) && !demo.freecam)
|
||||
if (P_IsDisplayPlayer(player))
|
||||
S_StartSound(NULL, ((player->kartstuff[k_roulettetype] == 1) ? sfx_itrolk : (mashed ? sfx_itrolm : sfx_itrolf)));
|
||||
|
||||
player->kartstuff[k_itemblink] = TICRATE;
|
||||
@@ -9311,7 +9311,7 @@ static void K_drawDriftGauge(void)
|
||||
0, 31, 47, 63, 79, 95, 111, 119, 127, 143, 159, 175, 183, 191, 199, 207, 223, 247
|
||||
};
|
||||
|
||||
if (demo.playback && demo.freecam)
|
||||
if (demo.playback && camera[R_GetViewNumber()].freecam)
|
||||
return;
|
||||
|
||||
if (P_MobjWasRemoved(stplyr->mo) || (!splitscreen && !camera->chase))
|
||||
@@ -10419,22 +10419,19 @@ void K_drawKartHUD(void)
|
||||
{
|
||||
boolean isfreeplay = false;
|
||||
boolean battlefullscreen = false;
|
||||
boolean freecam = demo.freecam; //disable some hud elements w/ freecam
|
||||
UINT8 i;
|
||||
UINT8 viewnum = R_GetViewNumber();
|
||||
boolean freecam = camera[viewnum].freecam; //disable some hud elements w/ freecam
|
||||
|
||||
// Define the X and Y for each drawn object
|
||||
// This is handled by console/menu values
|
||||
K_initKartHUD();
|
||||
|
||||
// Draw that fun first person HUD! Drawn ASAP so it looks more "real".
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (stplyr == &players[displayplayers[i]] && !camera[i].chase && !freecam)
|
||||
K_drawKartFirstPerson();
|
||||
}
|
||||
if (!camera[viewnum].chase && !freecam)
|
||||
K_drawKartFirstPerson();
|
||||
|
||||
// Draw full screen stuff that turns off the rest of the HUD
|
||||
if (mapreset && stplyr == &players[displayplayers[0]])
|
||||
if (mapreset && R_GetViewNumber() == 0)
|
||||
{
|
||||
K_drawChallengerScreen();
|
||||
return;
|
||||
@@ -10527,7 +10524,7 @@ void K_drawKartHUD(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (!stplyr->spectator && !demo.freecam) // Bottom of the screen elements, don't need in spectate mode
|
||||
if (!stplyr->spectator && !freecam) // Bottom of the screen elements, don't need in spectate mode
|
||||
{
|
||||
if (!(splitscreen || demo.title))
|
||||
{
|
||||
|
||||
+39
-42
@@ -1182,6 +1182,7 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
{
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0},
|
||||
{IT_CALL|IT_STRING, NULL, "Reset to defaults", M_ResetControls, 8},
|
||||
|
||||
//{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
@@ -1194,26 +1195,35 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
{IT_CONTROL, NULL, "Aim Forward", M_ChangeControl, gc_aimforward },
|
||||
{IT_CONTROL, NULL, "Aim Backward", M_ChangeControl, gc_aimbackward},
|
||||
{IT_CONTROL, NULL, "Look Backward", M_ChangeControl, gc_lookback },
|
||||
|
||||
{IT_HEADER, NULL, "Miscelleanous Controls", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
{IT_CONTROL, NULL, "Chat", M_ChangeControl, gc_talkkey },
|
||||
//{IT_CONTROL, NULL, "Team Chat", M_ChangeControl, gc_teamkey },
|
||||
//{IT_CONTROL, NULL, "Team Chat", M_ChangeControl, gc_teamkey },
|
||||
{IT_CONTROL, NULL, "Show Rankings", M_ChangeControl, gc_scores },
|
||||
{IT_CONTROL, NULL, "Change Viewpoint", M_ChangeControl, gc_viewpoint },
|
||||
{IT_CONTROL, NULL, "Reset Camera", M_ChangeControl, gc_camreset },
|
||||
{IT_CONTROL, NULL, "Toggle First-Person", M_ChangeControl, gc_camtoggle },
|
||||
{IT_CONTROL, NULL, "Pause", M_ChangeControl, gc_pause },
|
||||
{IT_CONTROL, NULL, "Screenshot", M_ChangeControl, gc_screenshot },
|
||||
{IT_CONTROL, NULL, "Toggle GIF Recording", M_ChangeControl, gc_recordgif },
|
||||
{IT_CONTROL, NULL, "Open/Close Menu (ESC)", M_ChangeControl, gc_systemmenu },
|
||||
{IT_CONTROL, NULL, "Developer Console", M_ChangeControl, gc_console },
|
||||
{IT_HEADER, NULL, "Spectator Controls", NULL, 0},
|
||||
|
||||
{IT_HEADER, NULL, "Camera Controls", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
{IT_CONTROL, NULL, "Become Spectator", M_ChangeControl, gc_spectate },
|
||||
{IT_CONTROL, NULL, "Toggle Freecam", M_ChangeControl, gc_freecam },
|
||||
{IT_CONTROL, NULL, "Look Up", M_ChangeControl, gc_lookup },
|
||||
{IT_CONTROL, NULL, "Look Down", M_ChangeControl, gc_lookdown },
|
||||
{IT_CONTROL, NULL, "Center View", M_ChangeControl, gc_centerview },
|
||||
{IT_CONTROL, NULL, "Float", M_ChangeControl, gc_camfloat },
|
||||
{IT_CONTROL, NULL, "Sink", M_ChangeControl, gc_camsink },
|
||||
{IT_CONTROL, NULL, "Change Viewpoint", M_ChangeControl, gc_viewpoint },
|
||||
{IT_CONTROL, NULL, "Reset Camera", M_ChangeControl, gc_camreset },
|
||||
//{IT_CONTROL, NULL, "Toggle First-Person", M_ChangeControl, gc_camtoggle },
|
||||
|
||||
{IT_HEADER, NULL, "Spectator Controls", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
{IT_CONTROL, NULL, "Become Spectator", M_ChangeControl, gc_spectate },
|
||||
{IT_CONTROL, NULL, "Toggle Director", M_ChangeControl, gc_director },
|
||||
|
||||
{IT_HEADER, NULL, "Custom Lua Actions", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
{IT_CONTROL, NULL, "Custom Action 1", M_ChangeControl, gc_custom1 },
|
||||
@@ -7713,19 +7723,10 @@ static void M_PlaybackToggleFreecam(INT32 choice)
|
||||
splitscreen = 0;
|
||||
R_ExecuteSetViewSize();
|
||||
|
||||
P_InitCameraCmd(); // init camera controls
|
||||
if (!demo.freecam) // toggle on
|
||||
UINT8 i;
|
||||
for (i = 0; i <= splitscreen; ++i)
|
||||
{
|
||||
demo.freecam = true;
|
||||
democam.cam = &camera[0]; // this is rather useful
|
||||
}
|
||||
else // toggle off
|
||||
{
|
||||
demo.freecam = false;
|
||||
// reset democam vars:
|
||||
democam.cam = NULL;
|
||||
democam.turnheld = false;
|
||||
democam.keyboardlook = false; // reset only these. localangle / aiming gets set before the cam does anything anyway
|
||||
P_ToggleDemoCamera(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12096,12 +12097,11 @@ static void M_Setup1PControlsMenu(INT32 choice)
|
||||
// Unhide P1-only controls
|
||||
OP_AllControlsMenu[15].status = IT_CONTROL; // Chat
|
||||
OP_AllControlsMenu[16].status = IT_CONTROL; // Rankings
|
||||
// 18 is Reset Camera, 19 is Toggle Chasecam
|
||||
OP_AllControlsMenu[20].status = IT_CONTROL; // Pause
|
||||
OP_AllControlsMenu[21].status = IT_CONTROL; // Screenshot
|
||||
OP_AllControlsMenu[22].status = IT_CONTROL; // GIF
|
||||
OP_AllControlsMenu[23].status = IT_CONTROL; // System Menu
|
||||
OP_AllControlsMenu[24].status = IT_CONTROL; // Console
|
||||
OP_AllControlsMenu[17].status = IT_CONTROL; // Pause
|
||||
OP_AllControlsMenu[18].status = IT_CONTROL; // Screenshot
|
||||
OP_AllControlsMenu[19].status = IT_CONTROL; // GIF
|
||||
OP_AllControlsMenu[20].status = IT_CONTROL; // System Menu
|
||||
OP_AllControlsMenu[21].status = IT_CONTROL; // Console
|
||||
|
||||
M_SetupNextMenu(&OP_AllControlsDef);
|
||||
}
|
||||
@@ -12119,12 +12119,11 @@ static void M_Setup2PControlsMenu(INT32 choice)
|
||||
// Hide P1-only controls
|
||||
OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
|
||||
OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
|
||||
// 18 is Reset Camera, 19 is Toggle Chasecam
|
||||
OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
|
||||
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
|
||||
OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
|
||||
OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
|
||||
OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
|
||||
OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Pause
|
||||
OP_AllControlsMenu[18].status = IT_GRAYEDOUT2; // Screenshot
|
||||
OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // GIF
|
||||
OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // System Menu
|
||||
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Console
|
||||
|
||||
M_SetupNextMenu(&OP_AllControlsDef);
|
||||
}
|
||||
@@ -12142,12 +12141,11 @@ static void M_Setup3PControlsMenu(INT32 choice)
|
||||
// Hide P1-only controls
|
||||
OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
|
||||
OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
|
||||
// 18 is Reset Camera, 19 is Toggle Chasecam
|
||||
OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
|
||||
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
|
||||
OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
|
||||
OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
|
||||
OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
|
||||
OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Pause
|
||||
OP_AllControlsMenu[18].status = IT_GRAYEDOUT2; // Screenshot
|
||||
OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // GIF
|
||||
OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // System Menu
|
||||
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Console
|
||||
|
||||
M_SetupNextMenu(&OP_AllControlsDef);
|
||||
}
|
||||
@@ -12165,12 +12163,11 @@ static void M_Setup4PControlsMenu(INT32 choice)
|
||||
// Hide P1-only controls
|
||||
OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
|
||||
OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
|
||||
// 18 is Reset Camera, 19 is Toggle Chasecam
|
||||
OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // Pause
|
||||
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Screenshot
|
||||
OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // GIF
|
||||
OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // System Menu
|
||||
OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Console
|
||||
OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Pause
|
||||
OP_AllControlsMenu[18].status = IT_GRAYEDOUT2; // Screenshot
|
||||
OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // GIF
|
||||
OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // System Menu
|
||||
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Console
|
||||
|
||||
M_SetupNextMenu(&OP_AllControlsDef);
|
||||
}
|
||||
|
||||
+15
-16
@@ -81,8 +81,19 @@ void P_UnlinkThinker(thinker_t *thinker);
|
||||
typedef struct camera_s
|
||||
{
|
||||
boolean chase;
|
||||
boolean freecam;
|
||||
|
||||
angle_t localangle;
|
||||
INT32 localaiming;
|
||||
|
||||
angle_t aiming;
|
||||
|
||||
// Freecam: A button was held since entering from menu, so don't move camera
|
||||
UINT8 button_a_held;
|
||||
|
||||
// Freecam: aiming needs to be reset after switching from chasecam
|
||||
boolean reset_aiming;
|
||||
|
||||
// Things used by FS cameras.
|
||||
fixed_t viewheight;
|
||||
angle_t startangle;
|
||||
@@ -114,20 +125,6 @@ typedef struct camera_s
|
||||
fixed_t pan;
|
||||
} camera_t;
|
||||
|
||||
// demo freecam or something before i commit die
|
||||
struct demofreecam_s {
|
||||
|
||||
camera_t *cam; // this is useful when the game is paused, notably
|
||||
mobj_t *soundmobj; // mobj to play sound from, used in s_sound
|
||||
|
||||
angle_t localangle; // keeps track of the cam angle for cmds
|
||||
angle_t localaiming; // ditto with aiming
|
||||
boolean turnheld; // holding turn button for gradual turn speed
|
||||
boolean keyboardlook; // keyboard look
|
||||
};
|
||||
|
||||
extern struct demofreecam_s democam;
|
||||
|
||||
extern camera_t camera[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_dist[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_still[MAXSPLITSCREENPLAYERS];
|
||||
@@ -136,6 +133,8 @@ extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotspeed[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_freecam_speed;
|
||||
|
||||
extern consvar_t cv_tilting;
|
||||
extern consvar_t cv_quaketilt;
|
||||
extern consvar_t cv_tiltsmoothing;
|
||||
@@ -152,10 +151,10 @@ void P_AddPlayerScore(player_t *player, UINT32 amount);
|
||||
void P_ResetCamera(player_t *player, camera_t *thiscam);
|
||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
|
||||
void P_SlideCameraMove(camera_t *thiscam);
|
||||
void P_DemoCameraMovement(camera_t *cam);
|
||||
//void P_DemoCameraMovement(camera_t *cam, UINT8 num);
|
||||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled);
|
||||
void P_ResetLocalCamAiming(player_t *player);
|
||||
void P_InitCameraCmd(void);
|
||||
void P_ToggleDemoCamera(UINT8 viewnum);
|
||||
boolean P_PlayerInPain(player_t *player);
|
||||
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||
void P_ResetPlayer(player_t *player);
|
||||
|
||||
+21
-6
@@ -10766,6 +10766,18 @@ void P_SpawnPlayer(INT32 playernum)
|
||||
P_SetScale(karmahitbox, mobj->scale);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: handle splitscreen
|
||||
// Spectators can switch to freecam. This should be
|
||||
// disabled when they enter the race, or when the level
|
||||
// changes.
|
||||
if (!demo.playback)
|
||||
{
|
||||
if (!p->spectator)
|
||||
{
|
||||
camera[playernum].freecam = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void P_AfterPlayerSpawn(INT32 playernum)
|
||||
@@ -10808,15 +10820,18 @@ void P_AfterPlayerSpawn(INT32 playernum)
|
||||
|
||||
SV_SpawnPlayer(playernum, mobj->x, mobj->y, mobj->angle);
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
if (p->spectator == false)
|
||||
{
|
||||
if (!camera[i].chase)
|
||||
continue;
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (!camera[i].chase)
|
||||
continue;
|
||||
|
||||
if (displayplayers[i] != playernum)
|
||||
continue;
|
||||
if (displayplayers[i] != playernum)
|
||||
continue;
|
||||
|
||||
P_ResetCamera(p, &camera[i]);
|
||||
P_ResetCamera(p, &camera[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckForReverseGravity)
|
||||
|
||||
@@ -2525,6 +2525,8 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->angle = FixedAngle((fixed_t)thing->angle << FRACBITS);
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
|
||||
cam->chase = false; // tell camera to reset its position next tic
|
||||
}
|
||||
|
||||
static void P_InitCamera(void)
|
||||
|
||||
+6
-3
@@ -525,8 +525,8 @@ void P_Ticker(boolean run)
|
||||
timeinmap = (timeinmap-1) & ~3;
|
||||
G_PreviewRewind(leveltime);
|
||||
}
|
||||
else if (demo.freecam && democam.cam) // special case: allow freecam to MOVE during pause!
|
||||
P_DemoCameraMovement(democam.cam);
|
||||
else
|
||||
P_RunChaseCameras(); // special case: allow freecam to MOVE during pause!
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -726,7 +726,10 @@ void P_Ticker(boolean run)
|
||||
PS_STOP_TIMING(ps_lua_postthinkframe_time);
|
||||
}
|
||||
|
||||
K_UpdateDirector();
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
K_UpdateDirector(i);
|
||||
}
|
||||
|
||||
// Always move the camera.
|
||||
P_RunChaseCameras();
|
||||
|
||||
+166
-101
@@ -1054,6 +1054,15 @@ boolean P_IsDisplayPlayer(const player_t *player)
|
||||
|
||||
for (i = 0; i <= splitscreen; i++) // DON'T skip P1
|
||||
{
|
||||
if (camera[i].freecam)
|
||||
{
|
||||
// Freecam still techically has a player in
|
||||
// displayplayers. But since the camera is
|
||||
// detached, it would be weird if sounds were
|
||||
// heard from that player's perspective.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player == &players[displayplayers[i]])
|
||||
return true;
|
||||
}
|
||||
@@ -3104,6 +3113,9 @@ consvar_t cv_cam_rotspeed[MAXSPLITSCREENPLAYERS] = {
|
||||
{"cam4_rotspeed", "10", CV_SAVE, rotation_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t freecam_speed_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_freecam_speed = {"freecam_speed", "1", CV_SAVE, freecam_speed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_tilting = {"tilting", "Off", CV_SAVE|CV_CALL, CV_OnOff, Bird_menu_Onchange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_quaketilt = {"quaketilt", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -3117,61 +3129,61 @@ fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS] = {-42, -42, -42, -42};
|
||||
|
||||
#define MAXCAMERADIST 140*FRACUNIT // Max distance the camera can be in front of the player (2D mode)
|
||||
|
||||
// Heavily simplified version of G_BuildTicCmd that only takes the local first player's control input and converts it to readable ticcmd_t
|
||||
// we then throw that ticcmd garbage in the camera and make it move
|
||||
|
||||
// redefine this
|
||||
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
|
||||
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
|
||||
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
||||
|
||||
static ticcmd_t cameracmd;
|
||||
|
||||
struct demofreecam_s democam;
|
||||
|
||||
// called by m_menu to reinit cam input every time it's toggled
|
||||
void P_InitCameraCmd(void)
|
||||
void P_ToggleDemoCamera(UINT8 viewnum)
|
||||
{
|
||||
memset(&cameracmd, 0, sizeof(ticcmd_t)); // initialize cmd
|
||||
camera_t *cam = &camera[viewnum];
|
||||
|
||||
// dont let freecam be toggled when in spec lel
|
||||
if (players[displayplayers[viewnum]].spectator)
|
||||
return;
|
||||
|
||||
if (!cam->freecam) // toggle on
|
||||
{
|
||||
cam->freecam = true;
|
||||
cam->button_a_held = 2;
|
||||
cam->reset_aiming = true;
|
||||
}
|
||||
else // toggle off
|
||||
{
|
||||
cam->freecam = false;
|
||||
}
|
||||
}
|
||||
|
||||
static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||
static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
|
||||
{
|
||||
INT32 laim, th, tspeed, forward, side, axis; //i
|
||||
const INT32 speed = 1;
|
||||
INT32 laim, th, tspeed, forward, side, axis;
|
||||
|
||||
// these ones used for multiple conditions
|
||||
boolean turnleft, turnright, mouseaiming;
|
||||
boolean invertmouse, lookaxis, usejoystick, kbl;
|
||||
boolean turnleft, turnright;
|
||||
boolean usejoystick;
|
||||
angle_t lang;
|
||||
INT32 player_invert;
|
||||
INT32 screen_invert;
|
||||
const UINT8 forplayer = num+1;
|
||||
|
||||
ticcmd_t *cmd = &cameracmd;
|
||||
ticcmd_t *cmd = D_LocalTiccmd(num);
|
||||
|
||||
(void)cam;
|
||||
|
||||
if (!demo.playback)
|
||||
if (!cam->freecam)
|
||||
return cmd; // empty cmd, no.
|
||||
|
||||
lang = democam.localangle;
|
||||
laim = democam.localaiming;
|
||||
th = democam.turnheld;
|
||||
kbl = democam.keyboardlook;
|
||||
|
||||
G_CopyTiccmd(cmd, I_BaseTiccmd(), 1); // empty, or external driver
|
||||
lang = cam->localangle;
|
||||
laim = cam->localaiming;
|
||||
|
||||
cmd->angleturn = (INT16)(lang >> 16);
|
||||
cmd->aiming = G_ClipAimingPitch(&laim);
|
||||
|
||||
mouseaiming = true;
|
||||
invertmouse = cv_invertmouse.value;
|
||||
lookaxis = cv_lookaxis[0].value;
|
||||
const boolean lookaxis = cv_lookaxis[num].value;
|
||||
const boolean analogjoystickmove = cv_usejoystick[num].value && !Joystick[num].bGamepadStyle;
|
||||
const boolean gamepadjoystickmove = cv_usejoystick[num].value && Joystick[num].bGamepadStyle;
|
||||
|
||||
usejoystick = true;
|
||||
turnright = InputDown(gc_turnright, 1);
|
||||
turnleft = InputDown(gc_turnleft, 1);
|
||||
usejoystick = (analogjoystickmove || gamepadjoystickmove);
|
||||
|
||||
axis = JoyAxis(AXISTURN, 1);
|
||||
turnright = InputDown(gc_turnright, forplayer);
|
||||
turnleft = InputDown(gc_turnleft, forplayer);
|
||||
|
||||
axis = JoyAxis(AXISTURN, forplayer);
|
||||
|
||||
if (encoremode)
|
||||
{
|
||||
@@ -3181,7 +3193,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||
axis = -axis;
|
||||
}
|
||||
|
||||
if (axis != 0)
|
||||
if (gamepadjoystickmove && axis != 0)
|
||||
{
|
||||
turnright = turnright || (axis > 0);
|
||||
turnleft = turnleft || (axis < 0);
|
||||
@@ -3198,7 +3210,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||
if (th < SLOWTURNTICS)
|
||||
tspeed = 2; // slow turn
|
||||
else
|
||||
tspeed = speed;
|
||||
tspeed = 1;
|
||||
|
||||
// let movement keys cancel each other out
|
||||
if (turnright && !(turnleft))
|
||||
@@ -3212,53 +3224,46 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||
side -= sidemove[1];
|
||||
}
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
{
|
||||
// JOYAXISRANGE should be 1023 (divide by 1024)
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - (((axis * angleturn[1]) >> 10))); // ANALOG!
|
||||
side += ((axis * sidemove[0]) >> 10);
|
||||
}
|
||||
|
||||
cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
||||
|
||||
axis = JoyAxis(AXISMOVE, 1);
|
||||
if (InputDown(gc_accelerate, 1) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
axis = JoyAxis(AXISBRAKE, 1);
|
||||
if (InputDown(gc_brake, 1) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_BRAKE;
|
||||
axis = JoyAxis(AXISAIM, 1);
|
||||
if (InputDown(gc_aimforward, 1) || (usejoystick && axis < 0))
|
||||
axis = JoyAxis(AXISAIM, forplayer);
|
||||
if (InputDown(gc_aimforward, forplayer) || (usejoystick && axis < 0))
|
||||
forward += forwardmove[1];
|
||||
if (InputDown(gc_aimbackward, 1) || (usejoystick && axis > 0))
|
||||
if (InputDown(gc_aimbackward, forplayer) || (usejoystick && axis > 0))
|
||||
forward -= forwardmove[1];
|
||||
|
||||
// fire with any button/key
|
||||
axis = JoyAxis(AXISFIRE, 1);
|
||||
axis = JoyAxis(AXISFIRE, forplayer);
|
||||
if (InputDown(gc_fire, 1) || (usejoystick && axis > 0))
|
||||
cmd->buttons |= BT_ATTACK;
|
||||
|
||||
// spectator aiming shit, ahhhh...
|
||||
player_invert = invertmouse ? -1 : 1;
|
||||
screen_invert = 1; // nope
|
||||
|
||||
// mouse look stuff (mouse look is not the same as mouse aim)
|
||||
kbl = false;
|
||||
|
||||
// looking up/down
|
||||
laim += (mlooky<<19)*player_invert*screen_invert;
|
||||
laim += (mlooky<<19);
|
||||
|
||||
axis = JoyAxis(AXISLOOK, 1);
|
||||
axis = JoyAxis(AXISLOOK, forplayer);
|
||||
|
||||
// spring back if not using keyboard neither mouselookin'
|
||||
if (!kbl && !lookaxis && !mouseaiming)
|
||||
laim = 0;
|
||||
if (analogjoystickmove && axis != 0 && lookaxis)
|
||||
laim += (axis<<16);
|
||||
|
||||
if (InputDown(gc_lookup, 1) || (axis < 0))
|
||||
if (InputDown(gc_lookup, forplayer) || (gamepadjoystickmove && axis < 0))
|
||||
{
|
||||
laim += KB_LOOKSPEED * screen_invert;
|
||||
kbl = true;
|
||||
laim += KB_LOOKSPEED;
|
||||
}
|
||||
else if (InputDown(gc_lookdown, 1) || (axis > 0))
|
||||
else if (InputDown(gc_lookdown, forplayer) || (gamepadjoystickmove && axis > 0))
|
||||
{
|
||||
laim -= KB_LOOKSPEED * screen_invert;
|
||||
kbl = true;
|
||||
laim -= KB_LOOKSPEED;
|
||||
}
|
||||
|
||||
if (InputDown(gc_centerview, 1)) // No need to put a spectator limit on this one though :V
|
||||
if (InputDown(gc_centerview, forplayer)) // No need to put a spectator limit on this one though :V
|
||||
laim = 0;
|
||||
|
||||
cmd->aiming = G_ClipAimingPitch(&laim);
|
||||
@@ -3283,38 +3288,66 @@ static ticcmd_t *P_CameraCmd(camera_t *cam)
|
||||
|
||||
lang += (cmd->angleturn<<16);
|
||||
|
||||
democam.localangle = lang;
|
||||
democam.localaiming = laim;
|
||||
democam.turnheld = th;
|
||||
democam.keyboardlook = kbl;
|
||||
cam->localangle = lang;
|
||||
cam->localaiming = laim;
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
void P_DemoCameraMovement(camera_t *cam)
|
||||
#define intsign(n) \
|
||||
((n) < 0 ? -1 : (n) > 0 ? 1 : 0)
|
||||
|
||||
static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
|
||||
{
|
||||
ticcmd_t *cmd;
|
||||
angle_t thrustangle;
|
||||
mobj_t *awayviewmobj_hack;
|
||||
player_t *lastp;
|
||||
const UINT8 forplayer = num+1;
|
||||
boolean moving = false;
|
||||
|
||||
// update democam stuff with what we got here:
|
||||
democam.cam = cam;
|
||||
democam.localangle = cam->angle;
|
||||
democam.localaiming = cam->aiming;
|
||||
cam->localangle = cam->angle;
|
||||
cam->localaiming = cam->aiming;
|
||||
|
||||
// first off we need to get button input
|
||||
cmd = P_CameraCmd(cam);
|
||||
cmd = P_CameraCmd(cam, num);
|
||||
|
||||
cam->aiming = cmd->aiming<<FRACBITS;
|
||||
cam->angle = cmd->angleturn<<16;
|
||||
// let centerview work proper
|
||||
if (InputDown(gc_centerview, forplayer))
|
||||
cam->aiming = 0;
|
||||
|
||||
if (cmd->aiming != 0)
|
||||
{
|
||||
cam->aiming = cmd->aiming << FRACBITS;
|
||||
|
||||
cam->reset_aiming = false;
|
||||
}
|
||||
|
||||
cam->angle = cmd->angleturn << 16;
|
||||
|
||||
// camera movement:
|
||||
if (!cam->button_a_held)
|
||||
{
|
||||
fixed_t spd = 32*mapobjectscale*cv_freecam_speed.value;
|
||||
int dir = ((InputDown(gc_camfloat, forplayer)) ? 1 : 0) + ((InputDown(gc_camsink, forplayer)) ? -1 : 0);
|
||||
|
||||
if (cmd->buttons & BT_ACCELERATE)
|
||||
cam->z += 32*mapobjectscale;
|
||||
else if (cmd->buttons & BT_BRAKE)
|
||||
cam->z -= 32*mapobjectscale;
|
||||
switch (dir)
|
||||
{
|
||||
case 1:
|
||||
cam->z += spd;
|
||||
moving = true;
|
||||
break;
|
||||
|
||||
case -1:
|
||||
cam->z -= spd;
|
||||
moving = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(InputDown(gc_camfloat, forplayer) || InputDown(gc_camsink, forplayer)) && cam->button_a_held)
|
||||
{
|
||||
cam->button_a_held--;
|
||||
}
|
||||
|
||||
// if you hold item, you will lock on to displayplayer. (The last player you were ""f12-ing"")
|
||||
if (cmd->buttons & BT_ATTACK)
|
||||
@@ -3322,41 +3355,70 @@ void P_DemoCameraMovement(camera_t *cam)
|
||||
lastp = &players[displayplayers[0]]; // Fun fact, I was trying displayplayers[0]->mo as if it was Lua like an absolute idiot.
|
||||
cam->angle = R_PointToAngle2(cam->x, cam->y, lastp->mo->x, lastp->mo->y);
|
||||
cam->aiming = R_PointToAngle2(0, cam->z, R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y), lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads.
|
||||
|
||||
cam->reset_aiming = false;
|
||||
}
|
||||
|
||||
if (cmd->forwardmove != 0)
|
||||
{
|
||||
moving = true;
|
||||
}
|
||||
|
||||
// After switching to democam, the vertical angle of
|
||||
// chasecam is inherited. This is intentional because it
|
||||
// creates a smooth transition. However, moving
|
||||
// forward/back will have a slope. So, as long as democam
|
||||
// controls haven't been used to alter the vertical angle,
|
||||
// slowly reset it to flat.
|
||||
if ((cam->reset_aiming && moving) || ((InputDown(gc_camsink, forplayer)) && !cam->button_a_held))
|
||||
{
|
||||
INT32 aiming = cam->aiming;
|
||||
INT32 smooth = FixedMul(ANGLE_11hh / 4, FCOS(cam->aiming));
|
||||
|
||||
if (abs(smooth) < abs(aiming))
|
||||
{
|
||||
cam->aiming -= smooth * intsign(aiming);
|
||||
}
|
||||
else
|
||||
{
|
||||
cam->aiming = 0;
|
||||
cam->reset_aiming = false; // completely smoothed out
|
||||
}
|
||||
}
|
||||
|
||||
cam->momx = cam->momy = cam->momz = 0;
|
||||
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->z += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(cam->aiming));
|
||||
cam->x += FixedMul(spd, FINECOSINE(thrustangle));
|
||||
cam->y += FixedMul(spd, FINESINE(thrustangle));
|
||||
|
||||
if (!cam->reset_aiming)
|
||||
{
|
||||
cam->z += FixedMul(spd, AIMINGTOSLOPE(cam->aiming));
|
||||
}
|
||||
|
||||
// momentums are useless here, directly add to the coordinates
|
||||
|
||||
// this.......... doesn't actually check for floors and walls and whatnot but the function to do that is a pure mess so fuck that.
|
||||
// besides freecam going inside walls sounds pretty cool on paper.
|
||||
}
|
||||
|
||||
// awayviewmobj hack; this is to prevent us from hearing sounds from the player's perspective
|
||||
|
||||
awayviewmobj_hack = P_SpawnMobj(cam->x, cam->y, cam->z, MT_THOK);
|
||||
awayviewmobj_hack->tics = 2;
|
||||
awayviewmobj_hack->flags2 |= MF2_DONTDRAW;
|
||||
|
||||
democam.soundmobj = awayviewmobj_hack;
|
||||
|
||||
// update subsector to avoid crashes;
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y);
|
||||
}
|
||||
|
||||
#undef intsign
|
||||
|
||||
void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
tic_t tries = 0;
|
||||
fixed_t x, y, z;
|
||||
|
||||
if (demo.freecam)
|
||||
if (thiscam->freecam)
|
||||
return; // do not reset the camera there.
|
||||
|
||||
if (!player->mo)
|
||||
@@ -3395,6 +3457,8 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
||||
thiscam->radius = 20*FRACUNIT;
|
||||
thiscam->height = 16*FRACUNIT;
|
||||
|
||||
thiscam->reset_aiming = true;
|
||||
|
||||
while (!P_MoveChaseCamera(player,thiscam,true) && ++tries < 2*TICRATE);
|
||||
}
|
||||
|
||||
@@ -3416,8 +3480,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
subsector_t *newsubsec;
|
||||
#endif
|
||||
|
||||
democam.soundmobj = NULL; // reset this each frame, we don't want the game crashing for stupid reasons now do we
|
||||
|
||||
// We probably shouldn't move the camera if there is no player or player mobj somehow
|
||||
if (!player || !player->mo)
|
||||
return true;
|
||||
@@ -3426,12 +3488,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
|
||||
return true;
|
||||
|
||||
if (demo.freecam)
|
||||
{
|
||||
P_DemoCameraMovement(thiscam);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (thiscam == &camera[1]) // Camera 2
|
||||
{
|
||||
num = 1;
|
||||
@@ -3449,6 +3505,15 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||
num = 0;
|
||||
}
|
||||
|
||||
if (thiscam->freecam || player->spectator)
|
||||
{
|
||||
P_DemoCameraMovement(thiscam, num);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (paused || P_AutoPause())
|
||||
return true;
|
||||
|
||||
if (player == &players[consoleplayer])
|
||||
{
|
||||
plyrnum = 0;
|
||||
|
||||
@@ -37,6 +37,10 @@ enum viewcontext_e
|
||||
VIEWCONTEXT_SKY4
|
||||
};
|
||||
|
||||
extern enum viewcontext_e viewcontext;
|
||||
|
||||
#define R_GetViewNumber() ((viewcontext - VIEWCONTEXT_PLAYER1) & 3)
|
||||
|
||||
typedef struct {
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
|
||||
+16
-6
@@ -867,6 +867,7 @@ static inline int intsign(int n) {
|
||||
angle_t R_ViewRollAngle(const player_t *player)
|
||||
{
|
||||
angle_t roll = 0;
|
||||
const UINT8 viewnum = R_GetViewNumber();
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
@@ -885,7 +886,7 @@ angle_t R_ViewRollAngle(const player_t *player)
|
||||
|
||||
if (cv_tilting.value)
|
||||
{
|
||||
if (!player->spectator && !demo.freecam)
|
||||
if (!player->spectator && !camera[viewnum].freecam)
|
||||
roll += player->tilt;
|
||||
|
||||
if (cv_actionmovie.value)
|
||||
@@ -1063,6 +1064,8 @@ R_SetupCommonFrame
|
||||
( player_t * player,
|
||||
subsector_t * subsector)
|
||||
{
|
||||
const UINT8 viewnum = R_GetViewNumber();
|
||||
|
||||
newview->player = player;
|
||||
|
||||
newview->x += quake.x;
|
||||
@@ -1076,7 +1079,7 @@ R_SetupCommonFrame
|
||||
else
|
||||
newview->sector = R_PointInSubsector(newview->x, newview->y)->sector;
|
||||
|
||||
R_InterpolateView(R_UsingFrameInterpolation() ? (demo.playback && demo.freecam) ? rendertimefrac_unpaused : rendertimefrac : FRACUNIT, false);
|
||||
R_InterpolateView(R_UsingFrameInterpolation() ? (camera[viewnum].freecam ? rendertimefrac_unpaused : rendertimefrac) : FRACUNIT, false);
|
||||
}
|
||||
|
||||
static void R_SetupAimingFrame(player_t *player, camera_t *thiscam)
|
||||
@@ -1222,9 +1225,14 @@ void R_SetupFrame(int s, boolean skybox)
|
||||
thiscam->reset = false;
|
||||
}
|
||||
|
||||
if (player->spectator) // no spectator chasecam
|
||||
chasecam = false; // force chasecam off
|
||||
else if (player->playerstate == PST_DEAD || player->exiting)
|
||||
if (player->spectator)
|
||||
{
|
||||
// Free flying spectator uses demo freecam. This
|
||||
// requires chasecam to be enabled.
|
||||
chasecam = true;
|
||||
}
|
||||
|
||||
if (player->playerstate == PST_DEAD || player->exiting)
|
||||
chasecam = true; // force chasecam on
|
||||
|
||||
if (chasecam && (thiscam && !thiscam->chase))
|
||||
@@ -1253,7 +1261,7 @@ void R_SetupFrame(int s, boolean skybox)
|
||||
|
||||
R_SetupCommonFrame(player, subsector);
|
||||
}
|
||||
else if (!player->spectator && (thiscam && chasecam)) // use outside cam view
|
||||
else if (thiscam && chasecam) // use outside cam view
|
||||
{
|
||||
viewmobj = NULL;
|
||||
|
||||
@@ -1529,6 +1537,8 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_cam_rotspeed[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_freecam_speed);
|
||||
|
||||
CV_RegisterVar(&cv_tilting);
|
||||
CV_RegisterVar(&cv_quaketilt);
|
||||
CV_RegisterVar(&cv_tiltsmoothing);
|
||||
|
||||
+5
-12
@@ -456,11 +456,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
memset(&listener[i], 0, sizeof (listener[i]));
|
||||
listenmobj[i] = NULL;
|
||||
|
||||
if (i == 0 && democam.soundmobj)
|
||||
{
|
||||
listenmobj[i] = democam.soundmobj;
|
||||
}
|
||||
else if (player->awayviewtics)
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
listenmobj[i] = player->awayviewmobj;
|
||||
}
|
||||
@@ -469,7 +465,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
listenmobj[i] = player->mo;
|
||||
}
|
||||
|
||||
if (origin && origin == listenmobj[i])
|
||||
if (origin && origin == listenmobj[i] && !camera[i].freecam)
|
||||
{
|
||||
itsUs = true;
|
||||
}
|
||||
@@ -719,12 +715,6 @@ void S_UpdateSounds(void)
|
||||
memset(&listener[i], 0, sizeof (listener[i]));
|
||||
listenmobj[i] = NULL;
|
||||
|
||||
if (i == 0 && democam.soundmobj)
|
||||
{
|
||||
listenmobj[i] = democam.soundmobj;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player->awayviewtics)
|
||||
{
|
||||
listenmobj[i] = player->awayviewmobj;
|
||||
@@ -780,6 +770,9 @@ void S_UpdateSounds(void)
|
||||
|
||||
for (i = splitscreen; i >= 0; i--)
|
||||
{
|
||||
if (camera[i].freecam)
|
||||
continue;
|
||||
|
||||
if (c->origin != listenmobj[i])
|
||||
continue;
|
||||
|
||||
|
||||
+25
-24
@@ -16,6 +16,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "g_game.h"
|
||||
#include "g_input.h"
|
||||
#include "k_director.h"
|
||||
#include "r_local.h"
|
||||
#include "p_local.h"
|
||||
#include "f_finale.h"
|
||||
@@ -156,8 +157,6 @@ static patch_t *envelope;
|
||||
player_t *stplyr;
|
||||
UINT8 stplyrnum;
|
||||
|
||||
boolean directortextactive = false;
|
||||
|
||||
// SRB2kart
|
||||
|
||||
hudinfo_t hudinfo[NUMHUDITEMS] =
|
||||
@@ -652,11 +651,27 @@ static void ST_drawLevelTitle(void)
|
||||
V_DrawLevelTitle(ttlnumxpos+12, bary+6, V_SNAPTOBOTTOM, actnum);
|
||||
}
|
||||
|
||||
static const char *ST_GetButtonName(INT32 control, const char *inputtext)
|
||||
{
|
||||
static char buttname[32] = {0}; // Static buffer
|
||||
const char *item1 = gamecontrol[control][0] != 0 ? G_KeynumToString(gamecontrol[control][0]) : NULL;
|
||||
const char *item2 = gamecontrol[control][1] != 0 ? G_KeynumToString(gamecontrol[control][1]) : NULL;
|
||||
|
||||
if (item1 != NULL && item2 != NULL)
|
||||
snprintf(buttname, 32, "%s/%s - %s", item1, item2, inputtext);
|
||||
else
|
||||
snprintf(buttname, 32, "%s - %s", item1 != NULL ? item1 : item2 != NULL ? item2 : "Not Bound", inputtext);
|
||||
|
||||
return buttname;
|
||||
}
|
||||
|
||||
// Draw the status bar overlay, customisable: the user chooses which
|
||||
// kind of information to overlay
|
||||
//
|
||||
static void ST_overlayDrawer(void)
|
||||
{
|
||||
const UINT8 viewnum = R_GetViewNumber();
|
||||
|
||||
//hu_showscores = auto hide score/time/rings when tab rankings are shown
|
||||
if (!(hu_showscores && (netgame || multiplayer)))
|
||||
{
|
||||
@@ -665,13 +680,12 @@ static void ST_overlayDrawer(void)
|
||||
|
||||
if (!hu_showscores) // hide the following if TAB is held
|
||||
{
|
||||
if (cv_showdirectorhud.value && !splitscreen && ((demo.playback && !demo.freecam && (!demo.title || !modeattacking)) || !P_IsLocalPlayer(stplyr)) && !K_DirectorIsPlayerAlone())
|
||||
// TODO: splitscreen support!
|
||||
if (cv_showdirectorhud.value && !splitscreen && !P_IsLocalPlayer(stplyr) && K_DirectorIsAvailable(0) && !K_DirectorIsPlayerAlone())
|
||||
{
|
||||
char directortext[20] = {0};
|
||||
|
||||
snprintf(directortext, 20, "Director: %s", cv_director.value ? "On" : "Off");
|
||||
|
||||
directortextactive = true;
|
||||
snprintf(directortext, 20, "Director: %s", cv_director[0].value ? "On" : "Off");
|
||||
|
||||
if ((!demo.playback && directortoggletimer < 13*TICRATE) || (demo.playback && directortoggletimer < 4*TICRATE))
|
||||
{
|
||||
@@ -687,7 +701,6 @@ static void ST_overlayDrawer(void)
|
||||
else
|
||||
{
|
||||
directortoggletimer = 0;
|
||||
directortextactive = false;
|
||||
}
|
||||
|
||||
if (cv_showviewpointtext.value)
|
||||
@@ -778,28 +791,16 @@ static void ST_overlayDrawer(void)
|
||||
{
|
||||
V_DrawString(2, BASEVIDHEIGHT-50, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
|
||||
V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt);
|
||||
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
|
||||
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Brake - Sink"));
|
||||
|
||||
char directortoggle[32] = {0};
|
||||
const char *item1 = gamecontrol[gc_director][0] != 0 ? G_KeynumToString(gamecontrol[gc_director][0]) : NULL;
|
||||
const char *item2 = gamecontrol[gc_director][1] != 0 ? G_KeynumToString(gamecontrol[gc_director][1]) : NULL;
|
||||
|
||||
if (item1 != NULL && item2 != NULL)
|
||||
snprintf(directortoggle, 32, "%s/%s - Toggle Director", item1, item2);
|
||||
else
|
||||
snprintf(directortoggle, 32, "%s - Toggle Director", item1 != NULL ? item1 : item2 != NULL ? item2 : "Not Bound");
|
||||
|
||||
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, directortoggle);
|
||||
|
||||
directortextactive = true;
|
||||
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, ST_GetButtonName(gc_camfloat, "Float"));
|
||||
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, ST_GetButtonName(gc_camsink, "Sink"));
|
||||
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, ST_GetButtonName(gc_director, "Toggle Director"));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
|
||||
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt);
|
||||
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
|
||||
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Brake - Sink"));
|
||||
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, ST_GetButtonName(gc_camfloat, "Float"));
|
||||
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, ST_GetButtonName(gc_camsink, "Sink"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user