Misc small bugfixes and tweaks.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6005 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-08-04 21:18:04 +00:00
parent 8156eda700
commit 52ab543bd7
17 changed files with 151 additions and 111 deletions

View file

@ -5,8 +5,15 @@
BUILDFOLDER=~/htdocs
BUILDLOGFOLDER=$BUILDFOLDER/build_logs
if [ "$FTEQCC" == "" ]; then
QSS=~/htdocs/qss/quakespasm-spiked-linux64
FTEQW=~/htdocs/linux_amd64/fteqw64
FTEQCC=~/htdocs/linux_amd64/fteqcc64
fi
#this really should use the native cpu type... until then we use 32bit in case anyone's still using a 32bit kernel.
if [ "FTEQW" != "" ]; then
if [ "$FTEQW" != "" ]; then
echo "--- QC builds ---"
echo "Making fteextensions.qc"

View file

@ -1612,7 +1612,6 @@ void CLQ2_ParseFrame (int extrabits)
//in splitscreen we may have multiple player states, one per player.
if (cls.protocol_q2 != PROTOCOL_VERSION_R1Q2 && cls.protocol_q2 != PROTOCOL_VERSION_Q2PRO)
{
cl.splitclients = 0;
for (cl.splitclients = 0; ; )
{
cmd = MSG_ReadByte ();

View file

@ -230,7 +230,7 @@ static void J_ControllerAxis(SDL_JoystickID jid, int axis, int value)
}
static void J_JoystickAxis(SDL_JoystickID jid, int axis, int value)
{
static int axismap[] = {0,1,3,4,2,5};
static const int axismap[] = {0,1,3,4,2,5};
struct sdljoy_s *joy = J_DevId(jid);
if (joy && axis < sizeof(axismap)/sizeof(axismap[0]) && joy->qdevid != DEVID_UNSET)
@ -241,7 +241,7 @@ static void J_ControllerButton(SDL_JoystickID jid, int button, qboolean pressed)
{
//controllers have reliable button maps.
//but that doesn't meant that fte has specific k_ names for those buttons, but the mapping should be reliable, at least until they get mapped to proper k_ values.
static int buttonmap[] =
static const int buttonmap[] =
{
K_GP_A,
K_GP_B,
@ -281,7 +281,7 @@ static void J_ControllerButton(SDL_JoystickID jid, int button, qboolean pressed)
static void J_JoystickButton(SDL_JoystickID jid, int button, qboolean pressed)
{
//generic joysticks have no specific mappings. they're really random like that.
static int buttonmap[] = {
static const int buttonmap[] = {
K_JOY1,
K_JOY2,
K_JOY3,
@ -345,7 +345,7 @@ static void J_JoystickButton(SDL_JoystickID jid, int button, qboolean pressed)
}
}
void J_Rumble(int id, uint16_t amp_low, uint16_t amp_high, int duration)
void INS_Rumble(int id, quint16_t amp_low, quint16_t amp_high, quint32_t duration)
{
#if SDL_VERSION_ATLEAST(2,0,9)
int i;
@ -365,7 +365,7 @@ void J_Rumble(int id, uint16_t amp_low, uint16_t amp_high, int duration)
#endif
}
void J_RumbleTriggers(int id, uint16_t left, uint16_t right, uint32_t duration)
void INS_RumbleTriggers(int id, quint16_t left, quint16_t right, quint32_t duration)
{
#if SDL_VERSION_ATLEAST(2,0,14)
int i;
@ -385,7 +385,7 @@ void J_RumbleTriggers(int id, uint16_t left, uint16_t right, uint32_t duration)
#endif
}
void J_SetLEDColor(int id, vec3_t color)
void INS_SetLEDColor(int id, vec3_t color)
{
#if SDL_VERSION_ATLEAST(2,0,14)
int i;
@ -407,7 +407,7 @@ void J_SetLEDColor(int id, vec3_t color)
#endif
}
void J_SetTriggerFX(int id, const void *data, int size)
void INS_SetTriggerFX(int id, const void *data, size_t size)
{
#if SDL_VERSION_ATLEAST(2,0,15)
for (int i = 0; i < MAX_JOYSTICKS; i++)

View file

@ -464,22 +464,22 @@ static int Joy_AllocateDevID(void)
}
}
void J_Rumble(int id, uint16_t amp_low, uint16_t amp_high, int duration)
void INS_Rumble(int id, quint16_t amp_low, quint16_t amp_high, quint32_t duration)
{
//Con_DPrintf(CON_WARNING "Rumble is unavailable on this platform\n");
}
void J_RumbleTriggers(int id, uint16_t left, uint16_t right, uint32_t duration)
void INS_RumbleTriggers(int id, quint16_t left, quint16_t right, quint32_t duration)
{
//Con_DPrintf(CON_WARNING "Trigger rumble is unavailable on this platform\n");
}
void J_SetLEDColor(int id, vec3_t color)
void INS_SetLEDColor(int id, vec3_t color)
{
//Con_DPrintf(CON_WARNING "Game-Pad LED colors are unavailable on this platform\n");
}
void J_SetTriggerFX(int id, const void *data, int size)
void INS_SetTriggerFX(int id, const void *data, size_t size)
{
//Con_DPrintf(CON_WARNING "Trigger FX are unavailable on this platform\n");
}

View file

@ -64,6 +64,11 @@ void INS_Commands (void); //final chance to call IN_MouseMove/IN_KeyEvent each f
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, unsigned int *qdevid));
void INS_SetupControllerAudioDevices(qboolean enabled); //creates audio devices for each controller (where controllers have their own audio devices)
void INS_Rumble(int joy, quint16_t amp_low, quint16_t amp_high, quint32_t duration);
void INS_RumbleTriggers(int joy, quint16_t left, quint16_t right, quint32_t duration);
void INS_SetLEDColor(int id, vec3_t color);
void INS_SetTriggerFX(int id, const void *data, size_t size);
#define DEVID_UNSET ~0u
extern cvar_t cl_splitscreen;

View file

@ -3671,7 +3671,7 @@ static qboolean PM_SignatureOkay(package_t *p)
//metadata doesn't specify all file names for zips.
if (p->extract == EXTRACT_ZIP)
return false;
if (!p->gamedir || !*p->gamedir)
if (!*p->gamedir)
return false;
for (dep = p->deps; dep; dep = dep->next)
@ -3911,7 +3911,7 @@ static void PM_StartADownload(void)
{
p->download = HTTP_CL_Get(mirror, NULL, PM_Download_PreliminaryGot);
if (!p->download)
Con_Printf("Unable to download %s\n", p->name);
Con_Printf("Unable to download %s (%s)\n", p->name, mirror);
}
else
{
@ -4833,12 +4833,12 @@ void PM_AddManifestPackages(ftemanifest_t *man)
{
package_t *p, *m;
size_t i;
const char *path;
const char *path, *url;
char buffer[MAX_OSPATH], *url;
char buffer[MAX_OSPATH];
int idx;
struct manpack_s *pack;
const char *baseurl = man->updateurl;
const char *baseurl = man->updateurl; //this is a url for updated versions of the fmf itself.
for (p = availablepackages; p; p = p->next)
p->flags &= ~DPF_MANIMARKED;
@ -4891,11 +4891,10 @@ void PM_AddManifestPackages(ftemanifest_t *man)
p->extract = EXTRACT_COPY;
for (i = 0; i < countof(pack->mirrors) && i < countof(p->mirror); i++)
if (pack->mirrors[i])
{
if (pack->mirrors[i])
{
url = pack->mirrors[i];
if (!url)
continue;
if (!strncmp(url, "gz:", 3))
{
url+=3;
@ -4928,8 +4927,9 @@ void PM_AddManifestPackages(ftemanifest_t *man)
fspdl_extracttype = X_COPY;
}*/
p->mirror[i] = Z_StrDup(FS_RelativeURL(baseurl, url, buffer, sizeof(buffer)));
}
url = FS_RelativeURL(baseurl, url, buffer, sizeof(buffer));
if (url && *url)
p->mirror[i] = Z_StrDup(url);
}
PM_AddDep(p, DEP_FILE, path);

View file

@ -6731,33 +6731,28 @@ static void QCBUILTIN PF_resourcestatus(pubprogfuncs_t *prinst, struct globalvar
}
}
void J_Rumble(int joy, uint16_t amp_low, uint16_t amp_high, uint32_t duration);
void J_RumbleTriggers(int joy, uint16_t left, uint16_t right, uint32_t duration);
void J_SetLEDColor(int id, vec3_t color);
void J_SetTriggerFX(int id, const void *data, int size);
static void QCBUILTIN PF_cl_gp_rumble(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int device = G_FLOAT(OFS_PARM0);
uint16_t amp_low = G_FLOAT(OFS_PARM1);
uint16_t amp_high = G_FLOAT(OFS_PARM2);
uint32_t duration = G_FLOAT(OFS_PARM3);
J_Rumble(device, amp_low, amp_high, duration);
quint16_t amp_low = G_FLOAT(OFS_PARM1);
quint16_t amp_high = G_FLOAT(OFS_PARM2);
quint32_t duration = G_FLOAT(OFS_PARM3);
INS_Rumble(device, amp_low, amp_high, duration);
}
static void QCBUILTIN PF_cl_gp_rumbletriggers(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int device = G_FLOAT(OFS_PARM0);
uint16_t left = G_FLOAT(OFS_PARM1);
uint16_t right = G_FLOAT(OFS_PARM2);
uint32_t duration = G_FLOAT(OFS_PARM3);
J_RumbleTriggers(device, left, right, duration);
quint16_t left = G_FLOAT(OFS_PARM1);
quint16_t right = G_FLOAT(OFS_PARM2);
quint32_t duration = G_FLOAT(OFS_PARM3);
INS_RumbleTriggers(device, left, right, duration);
}
static void QCBUILTIN PF_cl_gp_setledcolor(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int device = G_FLOAT(OFS_PARM0);
J_SetLEDColor(device, G_VECTOR(OFS_PARM1));
INS_SetLEDColor(device, G_VECTOR(OFS_PARM1));
}
static void QCBUILTIN PF_cl_gp_settriggerfx(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
@ -6769,7 +6764,7 @@ static void QCBUILTIN PF_cl_gp_settriggerfx(pubprogfuncs_t *prinst, struct globa
if (!fxptr)
PR_BIError(prinst, "PF_cl_gp_settriggerfx: invalid pointer/size\n");
else
J_SetTriggerFX(device, fxptr, size);
INS_SetTriggerFX(device, fxptr, size);
}
/*static void PF_cs_clipboard_got(void *ctx, const char *utf8)

View file

@ -164,7 +164,7 @@ static void QDECL S_Voip_Play_Callback(cvar_t *var, char *oldval);
cvar_t snd_voip_capturedevice = CVARF("cl_voip_capturedevice", "", CVAR_ARCHIVE);
cvar_t snd_voip_capturedevice_opts = CVARFD("_cl_voip_capturedevice_opts", "", CVAR_NOSET, "The possible audio capture devices, in \"value\" \"description\" pairs, for gamecode to read.");
int voipbutton; //+voip, no longer part of cl_voip_send to avoid it getting saved
cvar_t snd_voip_send = CVARFD("cl_voip_send", "0", CVAR_ARCHIVE, "Sends voice-over-ip data to the server whenever it is set.\n0: only send voice if +voip is pressed.\n1: voice activation.\n2: constantly send.\n+4: Do not send to game, only to rtp sessions.");
cvar_t snd_voip_send = CVARFD("cl_voip_send", "0", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "Sends voice-over-ip data to the server whenever it is set.\n0: only send voice if +voip is pressed.\n1: voice activation.\n2: constantly send.\n+4: Do not send to game, only to rtp sessions.");
cvar_t snd_voip_test = CVARD("cl_voip_test", "0", "If 1, enables you to hear your own voice directly, bypassing the server and thus without networking latency, but is fine for checking audio levels. Note that sv_voip_echo can be set if you want to include latency and packetloss considerations, but setting that cvar requires server admin access and is thus much harder to use.");
cvar_t snd_voip_vad_threshhold = CVARFD("cl_voip_vad_threshhold", "15", CVAR_ARCHIVE, "This is the threshhold for voice-activation-detection when sending voip data");
cvar_t snd_voip_vad_delay = CVARD("cl_voip_vad_delay", "0.3", "Keeps sending voice data for this many seconds after voice activation would normally stop");
@ -1670,6 +1670,8 @@ void S_Voip_Ignore(unsigned int slot, qboolean ignore)
}
static void S_Voip_Enable_f(void)
{
if (Cmd_IsInsecure())
return;
voipbutton = true;
}
static void S_Voip_Disable_f(void)
@ -2645,7 +2647,6 @@ channel_t *SND_PickChannel(soundcardinfo_t *sc, int entnum, int entchannel)
if (oldest == -1)
return NULL;
//if (sc->channel[oldest].sfx)
sc->channel[oldest].sfx = NULL;
if (sc->total_chans <= oldest)

View file

@ -86,6 +86,18 @@ void INS_ReInit(void)
void INS_Shutdown(void)
{
}
void INS_Rumble(int joy, uint16_t amp_low, uint16_t amp_high, uint32_t duration)
{
}
void INS_RumbleTriggers(int joy, uint16_t left, uint16_t right, uint32_t duration)
{
}
void INS_SetLEDColor(int id, vec3_t color)
{
}
void INS_SetTriggerFX(int id, const void *data, size_t size)
{
}
void Sys_Vibrate(float count)
{
// if (count < 0)
@ -202,8 +214,8 @@ static int mapkey(int androidkey)
case AKEYCODE_BUTTON_R1: return K_GP_RIGHT_SHOULDER;
case AKEYCODE_BUTTON_L2: return K_GP_LEFT_TRIGGER;
case AKEYCODE_BUTTON_R2: return K_GP_RIGHT_TRIGGER;
case AKEYCODE_BUTTON_THUMBL: return K_GP_LEFT_THUMB;
case AKEYCODE_BUTTON_THUMBR: return K_GP_RIGHT_THUMB;
case AKEYCODE_BUTTON_THUMBL: return K_GP_LEFT_STICK;
case AKEYCODE_BUTTON_THUMBR: return K_GP_RIGHT_STICK;
case AKEYCODE_BUTTON_START: return K_GP_START;
case AKEYCODE_BUTTON_SELECT: return K_GP_BACK;
case AKEYCODE_BUTTON_MODE: return K_GP_GUIDE;

View file

@ -817,6 +817,7 @@ int QDECL main(int argc, char **argv)
{
float time, newtime, oldtime;
quakeparms_t parms;
int i;
memset(&parms, 0, sizeof(parms));
@ -842,6 +843,15 @@ int QDECL main(int argc, char **argv)
oldtime = Sys_DoubleTime ();
for (i = 1; i < parms.argc; i++)
{
if (!parms.argv[i])
continue;
if (*parms.argv[i] == '+' || *parms.argv[i] == '-')
break;
Host_RunFile(parms.argv[i], strlen(parms.argv[i]), NULL);
}
//client console should now be initialized.
/* main window message loop */

View file

@ -809,7 +809,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//safeswitch(foo){safedefault: break;}
//switch, but errors for any omitted enum values despite the presence of a default case.
//(gcc will generally give warnings without the default, but sometimes you don't have control over the source of your enumeration values)
#if (__GNUC__ >= 4)
//note: android's gcc seems to screw up the pop, instead leaving the warnings enabled, which gets horrendously spammy.
#if (__GNUC__ >= 4) && !defined(ANDROID)
#define safeswitch \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic error \"-Wswitch-enum\"") \

View file

@ -2853,6 +2853,9 @@ void COM_FlushTempoaryPacks(void) //flush all temporary packages
COM_AssertMainThread("COM_FlushTempoaryPacks");
if (!com_searchpaths || !fs_thread_mutex)
return; //we already shut down...
COM_WorkerLock(); //make sure no workers are poking files...
Sys_LockMutex(fs_thread_mutex);

View file

@ -5004,22 +5004,22 @@ void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type
}
/* doubt this will ever happen to begin with */
void J_Rumble(int id, uint16_t amp_low, uint16_t amp_high, int duration)
void INS_Rumble(int id, quint16_t amp_low, quint16_t amp_high, quint32_t duration)
{
//Con_DPrintf(CON_WARNING "Rumble is unavailable on this platform\n");
}
void J_RumbleTriggers(int id, uint16_t left, uint16_t right, uint32_t duration)
void INS_RumbleTriggers(int id, quint16_t left, quint16_t right, quint32_t duration)
{
//Con_DPrintf(CON_WARNING "Trigger rumble is unavailable on this platform\n");
}
void J_SetLEDColor(int id, vec3_t color)
void INS_SetLEDColor(int id, vec3_t color)
{
//Con_DPrintf(CON_WARNING "Game-Pad LED colors are unavailable on this platform\n");
}
void J_SetTriggerFX(int id, const void *data, int size)
void INS_SetTriggerFX(int id, const void *data, size_t size)
{
//Con_DPrintf(CON_WARNING "Trigger FX are unavailable on this platform\n");
}

View file

@ -12485,17 +12485,12 @@ static void PR_DumpPlatform_SymbolType(vfsfile_t *f, const struct symtable_s *sy
int symstart = 0;
const char *colon;
//we need to skip over any #defines prefixed to the type string
while(symtype[symstart] == '#')
//skip over any "typedef struct {...;};\n" or "#define foo bar\n" blocks in there
while ((colon = strstr(symtype+symstart, "\n")))
{
while (symtype[symstart] && symtype[symstart] != '\n')
symstart++;
if (symtype[symstart])
symstart++; //skip over the \n
symstart = (colon+1) - symtype;
continue;
}
//skip over any "typedef struct {...;};\n" blocks in there
while ((colon = strstr(symtype+symstart, ";\n")))
symstart = colon+2 - symtype;
//write those prefixes we tried to skip...
VFS_WRITE(f, symtype, symstart);

View file

@ -1895,11 +1895,9 @@ void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg)
// stuff the sigil bits into the high bits of items for sbar, or else
// mix in items2
// val = GetEdictFieldValue(ent, "items2", &items2cache);
// if (val)
// items = (int)ent->v->items | ((int)val->_float << 23);
// else
if (sv.haveitems2)
items = (int)ent->v->items | ((int)ent->xv->items2 << 23);
else
items = (int)ent->v->items | ((int)pr_global_struct->serverflags << 28);

View file

@ -7,6 +7,8 @@
#include "vr.h"
#define VK_API_MAX_VERSION VK_API_VERSION_1_0
extern qboolean vid_isfullscreen;
cvar_t vk_stagingbuffers = CVARFD ("vk_stagingbuffers", "", CVAR_RENDERERLATCH, "Configures which dynamic buffers are copied into gpu memory for rendering, instead of reading from shared memory. Empty for default settings.\nAccepted chars are u(niform), e(lements), v(ertex), 0(none).");
@ -4535,15 +4537,14 @@ qboolean VK_EnumerateDevices (void *usercontext, void(*callback)(void *context,
#undef VKFunc
#endif
#define ENGINEVERSION 1
memset(&app, 0, sizeof(app));
app.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
app.pNext = NULL;
app.pApplicationName = NULL;
app.applicationVersion = 0;
app.pEngineName = FULLENGINENAME;
app.engineVersion = ENGINEVERSION;
app.apiVersion = VK_MAKE_VERSION(1, 0, 2);
app.pApplicationName = FULLENGINENAME;
app.applicationVersion = revision_number(false);
app.pEngineName = "FTE Quake";
app.engineVersion = VK_MAKE_VERSION(FTE_VER_MAJOR, FTE_VER_MINOR, 0);
app.apiVersion = VK_API_MAX_VERSION;
memset(&inst_info, 0, sizeof(inst_info));
inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
@ -4723,11 +4724,11 @@ qboolean VK_Init(rendererstate_t *info, const char **sysextnames, qboolean (*cre
memset(&app, 0, sizeof(app));
app.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
app.pNext = NULL;
app.pApplicationName = NULL;
app.applicationVersion = 0;
app.pEngineName = FULLENGINENAME;
app.engineVersion = ENGINEVERSION;
app.apiVersion = VK_MAKE_VERSION(1, 0, 2);
app.pApplicationName = FULLENGINENAME;
app.applicationVersion = revision_number(false);
app.pEngineName = "FTE Quake";
app.engineVersion = VK_MAKE_VERSION(FTE_VER_MAJOR, FTE_VER_MINOR, 0);
app.apiVersion = VK_API_MAX_VERSION;
memset(&inst_info, 0, sizeof(inst_info));
inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;

View file

@ -22,7 +22,7 @@ static void *GLVID_getsdlglfunction(char *functionname)
static void IN_GamePadButtonEvent(unsigned int joydevid, int button, int ispressed, int isstandardmapping)
{
int standardmapping[] =
static const int standardmapping[] =
{ //the order of these keys is different from that of xinput
//however, the quake button codes should be the same. I really ought to define some K_ aliases for them.
K_GP_A,
@ -35,8 +35,8 @@ static void IN_GamePadButtonEvent(unsigned int joydevid, int button, int ispress
K_GP_RIGHT_TRIGGER,
K_GP_BACK,
K_GP_START,
K_GP_LEFT_THUMB,
K_GP_RIGHT_THUMB,
K_GP_LEFT_STICK,
K_GP_RIGHT_STICK,
K_GP_DPAD_UP,
K_GP_DPAD_DOWN,
K_GP_DPAD_LEFT,
@ -98,7 +98,7 @@ static void VID_Resized(int width, int height)
}
static unsigned int domkeytoquake(unsigned int code)
{
unsigned char tab[256] =
static const unsigned short tab[256] =
{
/* 0*/ 0,0,0,0,0,0,0,0, K_BACKSPACE,K_TAB,0,0,0,K_ENTER,0,0,
/* 16*/ K_SHIFT,K_CTRL,K_ALT,K_PAUSE,K_CAPSLOCK,0,0,0,0,0,0,K_ESCAPE,0,0,0,0,
@ -133,7 +133,7 @@ static unsigned int domkeytoquake(unsigned int code)
}
static unsigned int domkeytoshift(unsigned int code)
{
unsigned char tab[256] =
static const unsigned short tab[256] =
{
/* 0*/ 0,0,0,0,0,0,0,0, K_BACKSPACE,K_TAB,0,0,0,K_ENTER,0,0,
/* 16*/ K_SHIFT,K_CTRL,K_ALT,K_PAUSE,K_CAPSLOCK,0,0,0,0,0,0,K_ESCAPE,0,0,0,0,
@ -395,3 +395,16 @@ void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type
}
}
void INS_Rumble(int joy, quint16_t amp_low, quint16_t amp_high, quint32_t duration)
{
}
void INS_RumbleTriggers(int joy, quint16_t left, quint16_t right, quint32_t duration)
{
}
void INS_SetLEDColor(int id, vec3_t color)
{
}
void INS_SetTriggerFX(int id, const void *data, size_t size)
{
}