Пример #1
0
/*
====================
Key_GetBindingBuf
====================
*/
void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
	char	*value;

	value = Key_GetBinding( keynum );
	if ( value ) {
		Q_strncpyz( buf, value, buflen );
	}
	else {
		*buf = 0;
	}
}
Пример #2
0
static void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
#else
void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
#endif // RTCW_XX

	const char    *value;

	value = Key_GetBinding( keynum );
	if ( value ) {
		Q_strncpyz( buf, value, buflen );
	} else {
		*buf = 0;
	}
}

/*
====================
Key_GetCatcher
====================
*/
int Key_GetCatcher( void ) {
	return cls.keyCatchers;
}

/*
====================
Ket_SetCatcher
====================
*/
void Key_SetCatcher( int catcher ) {

#if defined RTCW_SP
	cls.keyCatchers = catcher;
#else
	// NERVE - SMF - console overrides everything
	if ( cls.keyCatchers & KEYCATCH_CONSOLE ) {
		cls.keyCatchers = catcher | KEYCATCH_CONSOLE;
	} else {
		cls.keyCatchers = catcher;
	}
#endif // RTCW_XX

}
Пример #3
0
/**
 * @sa Com_MacroExpandString
 * @todo we should review this code, '*' doesn't work very well for all the needed things
 */
const char *UI_GetReferenceString (const uiNode_t* const node, const char *ref)
{
	if (!ref)
		return NULL;

	/* its a cvar */
	if (ref[0] == '*') {
		const char *token;

		/* get the reference and the name */
		token = Com_MacroExpandString(ref);
		if (token) {
			if (token[0] == '_') {
				token++;
				return _(token);
			}
			return token;
		}

		/* skip the star */
		token = ref + 1;
		if (token[0] == '\0')
			return NULL;

		if (char const* const binding = Q_strstart(token, "binding:")) {
			return Key_GetBinding(binding, cls.state != ca_active ? KEYSPACE_UI : KEYSPACE_GAME);
		}

		Sys_Error("UI_GetReferenceString: unknown reference %s", token);
	/* translatable string */
	} else if (ref[0] == '_') {
		ref++;
		return _(ref);
	}

	/* just a string */
	return ref;
}