mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 04:41:23 +00:00
Merge remote-tracking branch 'origin/master' into next
This commit is contained in:
commit
5b0cb1afcb
10 changed files with 161 additions and 156 deletions
|
@ -1309,10 +1309,8 @@ static boolean CL_SendJoin(void)
|
|||
static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||
{
|
||||
UINT8 *p;
|
||||
#ifdef HAVE_CURL
|
||||
size_t mirror_length;
|
||||
const char *httpurl = cv_httpsource.string;
|
||||
#endif
|
||||
|
||||
netbuffer->packettype = PT_SERVERINFO;
|
||||
netbuffer->u.serverinfo._255 = 255;
|
||||
|
@ -1401,7 +1399,6 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
|
||||
netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
mirror_length = strlen(httpurl);
|
||||
if (mirror_length > MAX_MIRROR_LENGTH)
|
||||
mirror_length = MAX_MIRROR_LENGTH;
|
||||
|
@ -1411,7 +1408,6 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
|||
strncpy(netbuffer->u.serverinfo.httpsource, "", mirror_length);
|
||||
|
||||
netbuffer->u.serverinfo.httpsource[MAX_MIRROR_LENGTH-1] = '\0';
|
||||
#endif
|
||||
|
||||
p = PutFileNeeded(0);
|
||||
|
||||
|
@ -1824,7 +1820,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
|||
M_SortServerList();
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
struct Fetch_servers_ctx
|
||||
{
|
||||
int room;
|
||||
|
@ -1869,7 +1865,7 @@ Fetch_servers_thread (struct Fetch_servers_ctx *ctx)
|
|||
|
||||
free(ctx);
|
||||
}
|
||||
#endif/*HAVE_THREADS*/
|
||||
#endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/
|
||||
|
||||
void CL_QueryServerList (msg_server_t *server_list)
|
||||
{
|
||||
|
@ -1906,9 +1902,8 @@ void CL_QueryServerList (msg_server_t *server_list)
|
|||
|
||||
void CL_UpdateServerList(boolean internetsearch, INT32 room)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
struct Fetch_servers_ctx *ctx;
|
||||
#endif
|
||||
(void)internetsearch;
|
||||
(void)room;
|
||||
|
||||
SL_ClearServerList(0);
|
||||
|
||||
|
@ -1925,9 +1920,12 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
|
|||
if (netgame)
|
||||
SendAskInfo(BROADCASTADDR);
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
if (internetsearch)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
struct Fetch_servers_ctx *ctx;
|
||||
|
||||
ctx = malloc(sizeof *ctx);
|
||||
|
||||
/* This called from M_Refresh so I don't use a mutex */
|
||||
|
@ -1954,6 +1952,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
#endif // ifndef NONET
|
||||
|
@ -3427,8 +3426,10 @@ void D_QuitNetGame(void)
|
|||
for (i = 0; i < MAXNETNODES; i++)
|
||||
if (nodeingame[i])
|
||||
HSendPacket(i, true, 0, 0);
|
||||
#ifdef MASTERSERVER
|
||||
if (serverrunning && ms_RoomId > 0)
|
||||
UnregisterServer();
|
||||
#endif
|
||||
}
|
||||
else if (servernode > 0 && servernode < MAXNETNODES && nodeingame[(UINT8)servernode])
|
||||
{
|
||||
|
@ -3676,8 +3677,10 @@ boolean SV_SpawnServer(void)
|
|||
if (netgame && I_NetOpenSocket)
|
||||
{
|
||||
I_NetOpenSocket();
|
||||
#ifdef MASTERSERVER
|
||||
if (ms_RoomId > 0)
|
||||
RegisterServer();
|
||||
#endif
|
||||
}
|
||||
|
||||
// non dedicated server just connect to itself
|
||||
|
@ -5395,7 +5398,9 @@ FILESTAMP
|
|||
GetPackets();
|
||||
FILESTAMP
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
MasterClient_Ticker();
|
||||
#endif
|
||||
|
||||
if (client)
|
||||
{
|
||||
|
@ -5452,7 +5457,9 @@ FILESTAMP
|
|||
// client send the command after a receive of the server
|
||||
// the server send before because in single player is beter
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
MasterClient_Ticker(); // Acking the Master Server
|
||||
#endif
|
||||
|
||||
if (client)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,8 @@ extern SINT8 nodetoplayer4[MAXNETNODES]; // Say the numplayer for this node if a
|
|||
extern UINT8 playerpernode[MAXNETNODES]; // Used specially for splitscreen
|
||||
extern boolean nodeingame[MAXNETNODES]; // Set false as nodes leave game
|
||||
|
||||
extern boolean serverrunning;
|
||||
|
||||
INT32 Net_GetFreeAcks(boolean urgent);
|
||||
void Net_AckTicker(void);
|
||||
|
||||
|
|
|
@ -681,4 +681,10 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// Hardware renderer: OpenGL
|
||||
#define GL_SHADERS
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
#define MASTERSERVER
|
||||
#else
|
||||
#undef UPDATE_ALERT
|
||||
#endif
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
|
|
|
@ -14,7 +14,9 @@ Documentation available here.
|
|||
<http://mb.srb2.org/MS/tools/api/v1/>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
#include <curl/curl.h>
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "d_clisrv.h"
|
||||
|
@ -49,6 +51,8 @@ consvar_t cv_masterserver_token = {
|
|||
NULL, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
|
||||
};
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
|
||||
static int hms_started;
|
||||
|
||||
static char *hms_api;
|
||||
|
@ -666,10 +670,14 @@ HMS_set_api (char *api)
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
static void
|
||||
MasterServer_Debug_OnChange (void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
/* TODO: change to 'latest-log.txt' for log files revision. */
|
||||
if (cv_masterserver_debug.value)
|
||||
CONS_Printf("Master server debug messages will appear in log.txt\n");
|
||||
#endif
|
||||
}
|
||||
|
|
35
src/i_tcp.c
35
src/i_tcp.c
|
@ -246,7 +246,8 @@ static size_t numbans = 0;
|
|||
static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1?
|
||||
static boolean init_tcp_driver = false;
|
||||
|
||||
static char port_name[8] = DEFAULTPORT;
|
||||
static const char *serverport_name = DEFAULTPORT;
|
||||
static const char *clientport_name;/* any port */
|
||||
|
||||
#ifndef NONET
|
||||
|
||||
|
@ -924,6 +925,7 @@ static boolean UDP_Socket(void)
|
|||
#ifdef HAVE_IPV6
|
||||
const INT32 b_ipv6 = M_CheckParm("-ipv6");
|
||||
#endif
|
||||
const char *serv;
|
||||
|
||||
|
||||
for (s = 0; s < mysocketses; s++)
|
||||
|
@ -939,11 +941,16 @@ static boolean UDP_Socket(void)
|
|||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_protocol = IPPROTO_UDP;
|
||||
|
||||
if (serverrunning)
|
||||
serv = serverport_name;
|
||||
else
|
||||
serv = clientport_name;
|
||||
|
||||
if (M_CheckParm("-bindaddr"))
|
||||
{
|
||||
while (M_IsNextParm())
|
||||
{
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -964,7 +971,7 @@ static boolean UDP_Socket(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
gaie = I_getaddrinfo("0.0.0.0", port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo("0.0.0.0", serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -979,8 +986,8 @@ static boolean UDP_Socket(void)
|
|||
#ifdef HAVE_MINIUPNPC
|
||||
if (UPNP_support)
|
||||
{
|
||||
I_UPnP_rem(port_name, "UDP");
|
||||
I_UPnP_add(NULL, port_name, "UDP");
|
||||
I_UPnP_rem(serverport_name, "UDP");
|
||||
I_UPnP_add(NULL, serverport_name, "UDP");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -997,7 +1004,7 @@ static boolean UDP_Socket(void)
|
|||
{
|
||||
while (M_IsNextParm())
|
||||
{
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo(M_GetNextParm(), serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -1018,7 +1025,7 @@ static boolean UDP_Socket(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
gaie = I_getaddrinfo("::", port_name, &hints, &ai);
|
||||
gaie = I_getaddrinfo("::", serv, &hints, &ai);
|
||||
if (gaie == 0)
|
||||
{
|
||||
runp = ai;
|
||||
|
@ -1475,15 +1482,19 @@ boolean I_InitTcpNetwork(void)
|
|||
if (!I_InitTcpDriver())
|
||||
return false;
|
||||
|
||||
if (M_CheckParm("-port"))
|
||||
if (M_CheckParm("-port") || M_CheckParm("-serverport"))
|
||||
// Combined -udpport and -clientport into -port
|
||||
// As it was really redundant having two seperate parms that does the same thing
|
||||
/* Sorry Steel, I'm adding these back. But -udpport is a stupid name. */
|
||||
{
|
||||
if (M_IsNextParm())
|
||||
strcpy(port_name, M_GetNextParm());
|
||||
else
|
||||
strcpy(port_name, "0");
|
||||
/*
|
||||
If it's NULL, that's okay! Because then
|
||||
we'll get a random port from getaddrinfo.
|
||||
*/
|
||||
serverport_name = M_GetNextParm();
|
||||
}
|
||||
if (M_CheckParm("-clientport"))
|
||||
clientport_name = M_GetNextParm();
|
||||
|
||||
// parse network game options,
|
||||
if (M_CheckParm("-server") || dedicated)
|
||||
|
|
27
src/m_menu.c
27
src/m_menu.c
|
@ -3310,7 +3310,7 @@ void M_SetupNextMenu(menu_t *menudef)
|
|||
{
|
||||
INT16 i;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
if (currentMenu == &MP_RoomDef || currentMenu == &MP_ConnectDef)
|
||||
{
|
||||
I_lock_mutex(&ms_QueryId_mutex);
|
||||
|
@ -3392,7 +3392,7 @@ void M_Ticker(void)
|
|||
setmodeneeded = vidm_previousmode + 1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
I_lock_mutex(&ms_ServerList_mutex);
|
||||
{
|
||||
if (ms_ServerList)
|
||||
|
@ -8603,8 +8603,9 @@ static boolean M_CheckMODVersion(int id)
|
|||
} else
|
||||
return true;
|
||||
}
|
||||
#endif/*UPDATE_ALERT*/
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
static void
|
||||
Check_new_version_thread (int *id)
|
||||
{
|
||||
|
@ -8613,7 +8614,9 @@ Check_new_version_thread (int *id)
|
|||
|
||||
okay = 0;
|
||||
|
||||
#ifdef UPDATE_ALERT
|
||||
if (M_CheckMODVersion(*id))
|
||||
#endif
|
||||
{
|
||||
I_lock_mutex(&ms_QueryId_mutex);
|
||||
{
|
||||
|
@ -8657,8 +8660,7 @@ Check_new_version_thread (int *id)
|
|||
|
||||
free(id);
|
||||
}
|
||||
#endif/*HAVE_THREADS*/
|
||||
#endif/*UPDATE_ALERT*/
|
||||
#endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/
|
||||
|
||||
static void M_ConnectMenu(INT32 choice)
|
||||
{
|
||||
|
@ -8699,7 +8701,7 @@ UINT32 roomIds[NUM_LIST_ROOMS];
|
|||
static void M_RoomMenu(INT32 choice)
|
||||
{
|
||||
INT32 i;
|
||||
#ifdef HAVE_THREADS
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
int *id;
|
||||
#endif
|
||||
|
||||
|
@ -8721,9 +8723,14 @@ static void M_RoomMenu(INT32 choice)
|
|||
MP_RoomDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&MP_RoomDef);
|
||||
|
||||
#ifdef UPDATE_ALERT
|
||||
#ifdef MASTERSERVER
|
||||
#ifdef HAVE_THREADS
|
||||
#ifdef UPDATE_ALERT
|
||||
m_waiting_mode = M_WAITING_VERSION;
|
||||
#else/*UPDATE_ALERT*/
|
||||
m_waiting_mode = M_WAITING_ROOMS;
|
||||
#endif/*UPDATE_ALERT*/
|
||||
|
||||
MP_RoomMenu[0].text = "";
|
||||
|
||||
id = malloc(sizeof *id);
|
||||
|
@ -8737,17 +8744,19 @@ static void M_RoomMenu(INT32 choice)
|
|||
I_spawn_thread("check-new-version",
|
||||
(I_thread_fn)Check_new_version_thread, id);
|
||||
#else/*HAVE_THREADS*/
|
||||
#ifdef UPDATE_ALERT
|
||||
if (M_CheckMODVersion(0))
|
||||
#endif/*UPDATE_ALERT*/
|
||||
{
|
||||
GetRoomsList(currentMenu->prevMenu == &MP_ServerDef, 0);
|
||||
}
|
||||
#endif/*HAVE_THREADS*/
|
||||
#endif/*UPDATE_ALERT*/
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static void M_ChooseRoom(INT32 choice)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
I_lock_mutex(&ms_QueryId_mutex);
|
||||
{
|
||||
ms_QueryId++;
|
||||
|
|
65
src/mserv.c
65
src/mserv.c
|
@ -23,6 +23,8 @@
|
|||
#include "m_menu.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
|
||||
static int MSId;
|
||||
static int MSRegisteredId = -1;
|
||||
|
||||
|
@ -43,11 +45,14 @@ static I_cond MSCond;
|
|||
# define Unlock_state()
|
||||
#endif/*HAVE_THREADS*/
|
||||
|
||||
static void Update_parameters (void);
|
||||
|
||||
#ifndef NONET
|
||||
static void Command_Listserv_f(void);
|
||||
#endif
|
||||
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
static void Update_parameters (void);
|
||||
|
||||
static void MasterServer_OnChange(void);
|
||||
|
||||
static CV_PossibleValue_t masterserver_update_rate_cons_t[] = {
|
||||
|
@ -63,7 +68,7 @@ consvar_t cv_masterserver_update_rate = {"masterserver_update_rate", "15", CV_SA
|
|||
|
||||
INT16 ms_RoomId = -1;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
int ms_QueryId;
|
||||
I_mutex ms_QueryId_mutex;
|
||||
|
||||
|
@ -91,10 +96,14 @@ void AddMServCommands(void)
|
|||
CV_RegisterVar(&cv_masterserver_debug);
|
||||
CV_RegisterVar(&cv_masterserver_token);
|
||||
CV_RegisterVar(&cv_servername);
|
||||
#ifdef MASTERSERVER
|
||||
COM_AddCommand("listserv", Command_Listserv_f);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
|
||||
static void WarnGUI (void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
|
@ -395,6 +404,7 @@ Change_masterserver_thread (char *api)
|
|||
|
||||
void RegisterServer(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"register-server",
|
||||
|
@ -404,6 +414,7 @@ void RegisterServer(void)
|
|||
#else
|
||||
Finish_registration();
|
||||
#endif
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static void UpdateServer(void)
|
||||
|
@ -421,6 +432,7 @@ static void UpdateServer(void)
|
|||
|
||||
void UnregisterServer(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"unlist-server",
|
||||
|
@ -430,6 +442,7 @@ void UnregisterServer(void)
|
|||
#else
|
||||
Finish_unlist();
|
||||
#endif
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static boolean
|
||||
|
@ -465,9 +478,33 @@ static inline void SendPingToMasterServer(void)
|
|||
}
|
||||
}
|
||||
|
||||
void MasterClient_Ticker(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
SendPingToMasterServer();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
Set_api (const char *api)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"change-masterserver",
|
||||
(I_thread_fn)Change_masterserver_thread,
|
||||
strdup(api)
|
||||
);
|
||||
#else
|
||||
HMS_set_api(strdup(api));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
static void
|
||||
Update_parameters (void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
int registered;
|
||||
int delayed;
|
||||
|
||||
|
@ -487,29 +524,12 @@ Update_parameters (void)
|
|||
if (! delayed && registered)
|
||||
UpdateServer();
|
||||
}
|
||||
}
|
||||
|
||||
void MasterClient_Ticker(void)
|
||||
{
|
||||
SendPingToMasterServer();
|
||||
}
|
||||
|
||||
static void
|
||||
Set_api (const char *api)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"change-masterserver",
|
||||
(I_thread_fn)Change_masterserver_thread,
|
||||
strdup(api)
|
||||
);
|
||||
#else
|
||||
HMS_set_api(strdup(api));
|
||||
#endif
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static void MasterServer_OnChange(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
UnregisterServer();
|
||||
|
||||
/*
|
||||
|
@ -527,4 +547,5 @@ static void MasterServer_OnChange(void)
|
|||
|
||||
if (Online())
|
||||
RegisterServer();
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
|
21
src/p_user.c
21
src/p_user.c
|
@ -7487,13 +7487,14 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
|||
|
||||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled)
|
||||
{
|
||||
static UINT8 lookbackdelay[4] = {0,0,0,0};
|
||||
static boolean lookbackactive[MAXSPLITSCREENPLAYERS];
|
||||
static UINT8 lookbackdelay[MAXSPLITSCREENPLAYERS];
|
||||
UINT8 num;
|
||||
angle_t angle = 0, focusangle = 0, focusaiming = 0;
|
||||
fixed_t x, y, z, dist, height, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
|
||||
fixed_t x, y, z, dist, viewpointx, viewpointy, camspeed, camdist, camheight, pviewheight;
|
||||
fixed_t pan, xpan, ypan;
|
||||
INT32 camrotate;
|
||||
boolean camstill, lookback;
|
||||
boolean camstill, lookback, lookbackdown;
|
||||
UINT8 timeover;
|
||||
mobj_t *mo;
|
||||
fixed_t f1, f2;
|
||||
|
@ -7684,15 +7685,19 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
camstill = true;
|
||||
else if (lookback || lookbackdelay[num]) // SRB2kart - Camera flipper
|
||||
{
|
||||
#define MAXLOOKBACKDELAY 2
|
||||
camspeed = FRACUNIT;
|
||||
if (lookback)
|
||||
{
|
||||
camrotate += 180;
|
||||
lookbackdelay[num] = 2;
|
||||
lookbackdelay[num] = MAXLOOKBACKDELAY;
|
||||
}
|
||||
else
|
||||
lookbackdelay[num]--;
|
||||
}
|
||||
lookbackdown = (lookbackdelay[num] == MAXLOOKBACKDELAY) != lookbackactive[num];
|
||||
lookbackactive[num] = (lookbackdelay[num] == MAXLOOKBACKDELAY);
|
||||
#undef MAXLOOKBACKDELAY
|
||||
|
||||
if (mo->eflags & MFE_VERTICALFLIP)
|
||||
camheight += thiscam->height;
|
||||
|
@ -7735,8 +7740,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
thiscam->angle = angle;
|
||||
}
|
||||
|
||||
height = camheight;
|
||||
|
||||
// sets ideal cam pos
|
||||
dist = camdist;
|
||||
|
||||
|
@ -7745,10 +7748,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
dist += abs(thiscam->momz)/4;
|
||||
|
||||
if (player->kartstuff[k_boostcam])
|
||||
{
|
||||
dist -= FixedMul(11*dist/16, player->kartstuff[k_boostcam]);
|
||||
height -= FixedMul(height, player->kartstuff[k_boostcam]);
|
||||
}
|
||||
|
||||
x = mo->x - FixedMul(FINECOSINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
|
||||
y = mo->y - FixedMul(FINESINE((angle>>ANGLETOFINESHIFT) & FINEMASK), dist);
|
||||
|
@ -8070,6 +8070,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
thiscam->aiming = ANGLE_22h;
|
||||
}
|
||||
|
||||
if (lookbackdown)
|
||||
P_MoveChaseCamera(player, thiscam, false);
|
||||
|
||||
return (x == thiscam->x && y == thiscam->y && z == thiscam->z && angle == thiscam->aiming);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,27 @@ static void var_cleanup(void)
|
|||
internal_volume = 100;
|
||||
}
|
||||
|
||||
static const char* get_zlib_error(int zErr)
|
||||
{
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
return "Z_ERRNO";
|
||||
case Z_STREAM_ERROR:
|
||||
return "Z_STREAM_ERROR";
|
||||
case Z_DATA_ERROR:
|
||||
return "Z_DATA_ERROR";
|
||||
case Z_MEM_ERROR:
|
||||
return "Z_MEM_ERROR";
|
||||
case Z_BUF_ERROR:
|
||||
return "Z_BUF_ERROR";
|
||||
case Z_VERSION_ERROR:
|
||||
return "Z_VERSION_ERROR";
|
||||
default:
|
||||
return "unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
/// Audio System
|
||||
/// ------------------------
|
||||
|
@ -371,51 +392,11 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *errorType;
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
errorType = "Z_ERRNO"; break;
|
||||
case Z_STREAM_ERROR:
|
||||
errorType = "Z_STREAM_ERROR"; break;
|
||||
case Z_DATA_ERROR:
|
||||
errorType = "Z_DATA_ERROR"; break;
|
||||
case Z_MEM_ERROR:
|
||||
errorType = "Z_MEM_ERROR"; break;
|
||||
case Z_BUF_ERROR:
|
||||
errorType = "Z_BUF_ERROR"; break;
|
||||
case Z_VERSION_ERROR:
|
||||
errorType = "Z_VERSION_ERROR"; break;
|
||||
default:
|
||||
errorType = "unknown error";
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
{
|
||||
const char *errorType;
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
errorType = "Z_ERRNO"; break;
|
||||
case Z_STREAM_ERROR:
|
||||
errorType = "Z_STREAM_ERROR"; break;
|
||||
case Z_DATA_ERROR:
|
||||
errorType = "Z_DATA_ERROR"; break;
|
||||
case Z_MEM_ERROR:
|
||||
errorType = "Z_MEM_ERROR"; break;
|
||||
case Z_BUF_ERROR:
|
||||
errorType = "Z_BUF_ERROR"; break;
|
||||
case Z_VERSION_ERROR:
|
||||
errorType = "Z_VERSION_ERROR"; break;
|
||||
default:
|
||||
errorType = "unknown error";
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
#else
|
||||
return NULL; // No zlib support
|
||||
|
@ -945,73 +926,25 @@ boolean I_LoadSong(char *data, size_t len)
|
|||
// Run GME on new data
|
||||
if (!gme_open_data(inflatedData, inflatedLen, &gme, 44100))
|
||||
{
|
||||
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
|
||||
gme_start_track(gme, 0);
|
||||
current_track = 0;
|
||||
gme_set_equalizer(gme, &eq);
|
||||
Mix_HookMusic(mix_gme, gme);
|
||||
Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *errorType;
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
errorType = "Z_ERRNO"; break;
|
||||
case Z_STREAM_ERROR:
|
||||
errorType = "Z_STREAM_ERROR"; break;
|
||||
case Z_DATA_ERROR:
|
||||
errorType = "Z_DATA_ERROR"; break;
|
||||
case Z_MEM_ERROR:
|
||||
errorType = "Z_MEM_ERROR"; break;
|
||||
case Z_BUF_ERROR:
|
||||
errorType = "Z_BUF_ERROR"; break;
|
||||
case Z_VERSION_ERROR:
|
||||
errorType = "Z_VERSION_ERROR"; break;
|
||||
default:
|
||||
errorType = "unknown error";
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
|
||||
}
|
||||
CONS_Alert(CONS_ERROR, "Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
{
|
||||
const char *errorType;
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
errorType = "Z_ERRNO"; break;
|
||||
case Z_STREAM_ERROR:
|
||||
errorType = "Z_STREAM_ERROR"; break;
|
||||
case Z_DATA_ERROR:
|
||||
errorType = "Z_DATA_ERROR"; break;
|
||||
case Z_MEM_ERROR:
|
||||
errorType = "Z_MEM_ERROR"; break;
|
||||
case Z_BUF_ERROR:
|
||||
errorType = "Z_BUF_ERROR"; break;
|
||||
case Z_VERSION_ERROR:
|
||||
errorType = "Z_VERSION_ERROR"; break;
|
||||
default:
|
||||
errorType = "unknown error";
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
|
||||
}
|
||||
CONS_Alert(CONS_ERROR, "Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
return false;
|
||||
#else
|
||||
CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
|
||||
return true;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
else if (!gme_open_data(data, len, &gme, 44100))
|
||||
{
|
||||
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
|
||||
gme_set_equalizer(gme, &eq);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
rw = SDL_RWFromMem(data, len);
|
||||
|
@ -1082,6 +1015,8 @@ boolean I_PlaySong(boolean looping)
|
|||
#ifdef HAVE_LIBGME
|
||||
if (gme)
|
||||
{
|
||||
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
|
||||
gme_set_equalizer(gme, &eq);
|
||||
gme_start_track(gme, 0);
|
||||
current_track = 0;
|
||||
Mix_HookMusic(mix_gme, gme);
|
||||
|
|
|
@ -150,7 +150,10 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
|
|||
{
|
||||
FILE *handle;
|
||||
|
||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||
if (filenamebuf != *filename) {
|
||||
// avoid overlap
|
||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||
}
|
||||
filenamebuf[MAX_WADPATH - 1] = '\0';
|
||||
*filename = filenamebuf;
|
||||
|
||||
|
|
Loading…
Reference in a new issue