Skip to content

Commit

Permalink
Merge branch 'master' into example/camo-pants_get-surface-shader
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Nov 23, 2019
2 parents 6c3d662 + 3432015 commit a2ee75a
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ endif
export CROSS_COMPILING

ifndef VERSION
VERSION=1.0.0
VERSION=1.0.2
endif

ifndef VM_PREFIX
Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ static cvarTable_t cgameCvarTable[] = {
{ &cg_forceBitmapFonts, "cg_forceBitmapFonts", "0", CVAR_ARCHIVE | CVAR_LATCH, RANGE_BOOL },
{ &cg_drawGrappleHook, "cg_drawGrappleHook", "1", CVAR_ARCHIVE, RANGE_BOOL },
{ &cg_drawBBox, "cg_drawBBox", "0", CVAR_CHEAT, RANGE_BOOL },
{ &cg_consoleFont, "cg_consoleFont", "fonts/LiberationMono-Bold.ttf", CVAR_ARCHIVE | CVAR_LATCH, RANGE_ALL },
{ &cg_consoleFont, "cg_consoleFont", "fonts/LiberationMono-Regular.ttf", CVAR_ARCHIVE | CVAR_LATCH, RANGE_ALL },
{ &cg_consoleFontSize, "cg_consoleFontSize", "8", CVAR_ARCHIVE | CVAR_LATCH, RANGE_INT( 4, 24 ) },
{ &cg_hudFont, "cg_hudFont", "fonts/LiberationSans-Bold.ttf", CVAR_ARCHIVE | CVAR_LATCH, RANGE_ALL },
{ &cg_hudFontBorder, "cg_hudFontBorder", "2", CVAR_ARCHIVE | CVAR_LATCH, RANGE_FLOAT( 0, 10 ) },
Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_newdraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void CG_SelectPrevPlayer( int localPlayerNum ) {
team = cg.snap->pss[ localPlayerNum ].persistant[PERS_TEAM];

CG_CheckOrderPending( localPlayerNum );
if (cg_currentSelectedPlayer[ localPlayerNum ].integer > 0 && cg_currentSelectedPlayer[ localPlayerNum ].integer < numSortedTeamPlayers[team]) {
if (cg_currentSelectedPlayer[ localPlayerNum ].integer > 0 && cg_currentSelectedPlayer[ localPlayerNum ].integer <= numSortedTeamPlayers[team]) {
cg_currentSelectedPlayer[ localPlayerNum ].integer--;
} else {
cg_currentSelectedPlayer[ localPlayerNum ].integer = numSortedTeamPlayers[team];
Expand Down
15 changes: 6 additions & 9 deletions code/cgame/cg_weapons.c
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,11 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
}

// make sure we aren't looking at cg.cur_lc->predictedPlayerEntity for LG
nonPredictedCent = &cg_entities[cent->currentState.playerNum];
if ( cent == &cg.cur_lc->predictedPlayerEntity ) {
nonPredictedCent = &cg_entities[cent->currentState.playerNum];
} else {
nonPredictedCent = cent;
}

if ( !weapon->weaponModel || !weapon->flashModel ) {
// use default flash origin when no flash model
Expand All @@ -1252,7 +1256,7 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
VectorCopy( nonPredictedCent->pe.flashOrigin, flash.origin );
}

if ( ( cg.cur_lc->predictedPlayerState.eFlags & EF_FIRING )
if ( ( nonPredictedCent->currentState.eFlags & EF_FIRING )
&& ( ps || cg.cur_lc->renderingThirdPerson
|| cent->currentState.number != cg.cur_lc->predictedPlayerState.playerNum ) ) {
// special hack for lightning gun...
Expand Down Expand Up @@ -1314,13 +1318,6 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
CG_AddWeaponWithPowerups( &barrel, cent->currentState.powerups );
}

// if the index of the nonPredictedCent is not the same as the playerNum
// then this is a fake player (like on the single player podiums), so
// go ahead and use the cent
if( ( nonPredictedCent - cg_entities ) != cent->currentState.playerNum ) {
nonPredictedCent = cent;
}

memset( &flash, 0, sizeof( flash ) );
VectorCopy( parent->lightingOrigin, flash.lightingOrigin );
flash.shadowPlane = parent->shadowPlane;
Expand Down
65 changes: 58 additions & 7 deletions code/game/bg_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'E':
flags |= DP_F_UP;
case 'e':
/* ZTM: TODO: %e is missing exponent notation */
if (cflags == DP_C_LDOUBLE)
fvalue = va_arg (args, LDOUBLE);
else
Expand All @@ -1742,7 +1743,11 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args)
case 'G':
flags |= DP_F_UP;
case 'g':
flags |= DP_F_STRIP_TRAILING_ZEROS;
/* ZTM: TODO: Unlike %f, %g percision ("max" variable) isn't suppose
to count leading zeros in value and suppose to switch
to exponent notation if value has four leading zeros */
if (!(flags & DP_F_NUM))
flags |= DP_F_STRIP_TRAILING_ZEROS;
if (cflags == DP_C_LDOUBLE)
fvalue = va_arg (args, LDOUBLE);
else
Expand Down Expand Up @@ -2059,17 +2064,63 @@ static int fmtfp (char *buffer, size_t *currlen, size_t maxlen,
{
int i;

#ifdef DEBUG_SNPRINTF_G_FORMAT
trap_Print( " Before strip trailing zeros: " );

for (i = fplace-1; i >= 0; i--) {
char str[2];
str[0] = fconvert[i];
str[1] = '\0';
trap_Print( str );
}
trap_Print( "\n" );

trap_Print( " Found non-zero at: " );
#endif

/* fconvert is reverse order... */
for ( i = 1; i < fplace && i < max; i++ ) {
if ( fconvert[fplace-i] == '0' || fconvert[fplace-i] == '\0' ) {
for (i = 0; i < fplace; i++)
{
if (fconvert[i] != '0')
{
#ifdef DEBUG_SNPRINTF_G_FORMAT
char str[2];
str[0] = "0123456789abcdef"[i];
str[1] = '\0';
trap_Print( str );
#endif

break;
}
}
i--;
if ( i > 0 ) {
memmove( &fconvert[0], &fconvert[fplace-i], sizeof(char) * fplace-i );

#ifdef DEBUG_SNPRINTF_G_FORMAT
trap_Print( "\n" );
#endif

if (i == fplace)
{
/* fractional part is zero, don't display it */
max = fplace = 0;
}
else
{
max -= i;
fplace -= i;
memmove(&fconvert[0], &fconvert[i], sizeof(char) * (fplace+1));
}

#ifdef DEBUG_SNPRINTF_G_FORMAT
trap_Print( " After strip trailing zeros: " );

for (i = fplace-1; i >= 0; i--) {
char str[2];
str[0] = fconvert[i];
str[1] = '\0';
trap_Print( str );
}
max = fplace = i;
trap_Print( "\n" );
#endif
}

/* -1 for decimal point, another -1 if we are printing a sign */
Expand Down
2 changes: 1 addition & 1 deletion code/game/bg_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Suite 120, Rockville, Maryland 20850 USA.

// Keep this in-sync with VERSION in Makefile.
#ifndef PRODUCT_VERSION
#define PRODUCT_VERSION "1.0.0"
#define PRODUCT_VERSION "1.0.2"
#endif

// because games can change separately from the main system protocol, we need a
Expand Down
16 changes: 4 additions & 12 deletions code/game/g_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1255,9 +1255,7 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) {
// insult someone who just killed you
if (ent->enemy && ent->enemy->player && ent->enemy->player->lastkilled_player == ent->s.number) {
// i am a dead corpse
if (!(ent->enemy->r.svFlags & SVF_BOT)) {
G_Voice( ent, ent->enemy, SAY_TELL, VOICECHAT_DEATHINSULT, qfalse );
}
G_Voice( ent, ent->enemy, SAY_TELL, VOICECHAT_DEATHINSULT, qfalse );
ent->enemy = NULL;
return;
}
Expand All @@ -1267,13 +1265,9 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) {
if (who->player) {
// who is the person I just killed
if (who->player->lasthurt_mod == MOD_GAUNTLET) {
if (!(who->r.svFlags & SVF_BOT)) {
G_Voice( ent, who, SAY_TELL, VOICECHAT_KILLGAUNTLET, qfalse ); // and I killed them with a gauntlet
}
G_Voice( ent, who, SAY_TELL, VOICECHAT_KILLGAUNTLET, qfalse ); // and I killed them with a gauntlet
} else {
if (!(who->r.svFlags & SVF_BOT)) {
G_Voice( ent, who, SAY_TELL, VOICECHAT_KILLINSULT, qfalse ); // and I killed them with something else
}
G_Voice( ent, who, SAY_TELL, VOICECHAT_KILLINSULT, qfalse ); // and I killed them with something else
}
ent->player->lastkilled_player = -1;
return;
Expand All @@ -1286,9 +1280,7 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) {
who = g_entities + i;
if (who->player && who != ent && who->player->sess.sessionTeam == ent->player->sess.sessionTeam) {
if (who->player->rewardTime > level.time) {
if (!(who->r.svFlags & SVF_BOT)) {
G_Voice( ent, who, SAY_TELL, VOICECHAT_PRAISE, qfalse );
}
G_Voice( ent, who, SAY_TELL, VOICECHAT_PRAISE, qfalse );
return;
}
}
Expand Down
30 changes: 15 additions & 15 deletions code/q3_ui/ui_controls2.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ enum {
ID_AUTOSWITCH,
ID_MOUSESPEED,
ID_SELECTJOY,
ID_JOYANALOG,
ID_JOYTHRESHOLD,
ID_JOYANALOG,
ID_SMOOTHMOUSE
};

Expand Down Expand Up @@ -234,8 +234,8 @@ typedef struct
menuaction_s togglemenu;

menutext_s selectjoy;
menuradiobutton_s joyanalog;
menuslider_s joythreshold;
menuradiobutton_s joyanalog;
int section;
char playerModel[MAX_QPATH];
char playerHead[MAX_QPATH];
Expand Down Expand Up @@ -1044,8 +1044,8 @@ static void Controls_GetConfig( void )
s_controls.alwaysrun.curvalue = Com_Clamp( 0, 1, Controls_GetCvarValue( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "cl_run" ) ) );
s_controls.cyclepastgauntlet.curvalue = Com_Clamp( 0, 1, Controls_GetCvarValue( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "cg_cyclePastGauntlet" ) ) );
s_controls.autoswitch.curvalue = Com_Clamp( 0, 1, Controls_GetCvarValue( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "cg_autoswitch" ) ) );
s_controls.joyanalog.curvalue = Com_Clamp( 0, 1, Controls_GetCvarValue( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "in_joystickUseAnalog" ) ) );
s_controls.joythreshold.curvalue = Com_Clamp( 0.05f, 0.75f, Controls_GetCvarValue( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "in_joystickThreshold" ) ) );
s_controls.joyanalog.curvalue = Com_Clamp( 0, 1, Controls_GetCvarValue( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "in_joystickUseAnalog" ) ) );
}

/*
Expand Down Expand Up @@ -1093,8 +1093,8 @@ static void Controls_SetConfig( void )
trap_Cvar_SetValue( Com_LocalPlayerCvarName( s_controls.localPlayerNum, "cl_run" ), s_controls.alwaysrun.curvalue );
trap_Cvar_SetValue( Com_LocalPlayerCvarName( s_controls.localPlayerNum, "cg_cyclePastGauntlet" ), s_controls.cyclepastgauntlet.curvalue );
trap_Cvar_SetValue( Com_LocalPlayerCvarName( s_controls.localPlayerNum, "cg_autoswitch" ), s_controls.autoswitch.curvalue );
trap_Cvar_SetValue( Com_LocalPlayerCvarName( s_controls.localPlayerNum, "in_joystickUseAnalog" ), s_controls.joyanalog.curvalue );
trap_Cvar_SetValue( Com_LocalPlayerCvarName( s_controls.localPlayerNum, "in_joystickThreshold" ), s_controls.joythreshold.curvalue );
trap_Cvar_SetValue( Com_LocalPlayerCvarName( s_controls.localPlayerNum, "in_joystickUseAnalog" ), s_controls.joyanalog.curvalue );
}

/*
Expand Down Expand Up @@ -1132,8 +1132,8 @@ static void Controls_SetDefaults( void )
s_controls.autoswitch.curvalue = Controls_GetCvarDefault( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "cg_autoswitch" ) );
trap_Cvar_SetValue(Com_LocalPlayerCvarName(s_controls.localPlayerNum, "in_joystick"), 0);
trap_Cvar_SetValue(Com_LocalPlayerCvarName(s_controls.localPlayerNum, "in_joystickNo"), 0);
s_controls.joyanalog.curvalue = Controls_GetCvarDefault( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "in_joystickUseAnalog" ) );
s_controls.joythreshold.curvalue = Controls_GetCvarDefault( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "in_joystickThreshold" ) );
s_controls.joyanalog.curvalue = Controls_GetCvarDefault( Com_LocalPlayerCvarName(s_controls.localPlayerNum, "in_joystickUseAnalog" ) );
}

/*
Expand Down Expand Up @@ -1410,8 +1410,8 @@ static void Controls_MenuEvent( void* ptr, int event )
case ID_ALWAYSRUN:
case ID_CYCLEPASTGAUNTLET:
case ID_AUTOSWITCH:
case ID_JOYANALOG:
case ID_JOYTHRESHOLD:
case ID_JOYANALOG:
if (event == QM_ACTIVATED)
{
s_controls.changesmade = qtrue;
Expand Down Expand Up @@ -1919,14 +1919,6 @@ static void Controls_MenuInit( int localPlayerNum )
s_controls.selectjoy.color = text_color_normal;
s_controls.selectjoy.style = UI_RIGHT|UI_SMALLFONT;

s_controls.joyanalog.generic.type = MTYPE_RADIOBUTTON;
s_controls.joyanalog.generic.flags = QMF_SMALLFONT;
s_controls.joyanalog.generic.x = SCREEN_WIDTH/2;
s_controls.joyanalog.generic.name = "analog input";
s_controls.joyanalog.generic.id = ID_JOYANALOG;
s_controls.joyanalog.generic.callback = Controls_MenuEvent;
s_controls.joyanalog.generic.statusbar = Controls_StatusBar;

s_controls.joythreshold.generic.type = MTYPE_SLIDER;
s_controls.joythreshold.generic.x = SCREEN_WIDTH/2;
s_controls.joythreshold.generic.flags = QMF_SMALLFONT;
Expand All @@ -1937,6 +1929,14 @@ static void Controls_MenuInit( int localPlayerNum )
s_controls.joythreshold.maxvalue = 0.75f;
s_controls.joythreshold.generic.statusbar = Controls_StatusBar;

s_controls.joyanalog.generic.type = MTYPE_RADIOBUTTON;
s_controls.joyanalog.generic.flags = QMF_SMALLFONT;
s_controls.joyanalog.generic.x = SCREEN_WIDTH/2;
s_controls.joyanalog.generic.name = "analog input";
s_controls.joyanalog.generic.id = ID_JOYANALOG;
s_controls.joyanalog.generic.callback = Controls_MenuEvent;
s_controls.joyanalog.generic.statusbar = Controls_StatusBar;

s_controls.name.generic.type = MTYPE_PTEXT;
s_controls.name.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE;
s_controls.name.generic.x = 320;
Expand Down Expand Up @@ -1967,8 +1967,8 @@ static void Controls_MenuInit( int localPlayerNum )
Menu_AddItem( &s_controls.menu, &s_controls.centerview );
Menu_AddItem( &s_controls.menu, &s_controls.zoomview );
Menu_AddItem( &s_controls.menu, &s_controls.selectjoy );
Menu_AddItem( &s_controls.menu, &s_controls.joyanalog );
Menu_AddItem( &s_controls.menu, &s_controls.joythreshold );
Menu_AddItem( &s_controls.menu, &s_controls.joyanalog );

Menu_AddItem( &s_controls.menu, &s_controls.alwaysrun );
Menu_AddItem( &s_controls.menu, &s_controls.run );
Expand Down
10 changes: 6 additions & 4 deletions code/q3_ui/ui_teamorders.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ static void UI_TeamOrdersMenu_BuildBotList( void ) {
int numPlayers;
int isBot;
int n;
char playerTeam = '3';
char playerTeam;
char botTeam;
char info[MAX_INFO_STRING];

Expand All @@ -408,14 +408,16 @@ static void UI_TeamOrdersMenu_BuildBotList( void ) {
numPlayers = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
teamOrdersMenuInfo.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) );

for( n = 0; n < numPlayers && teamOrdersMenuInfo.numBots < 9; n++ ) {
trap_GetConfigString( CS_PLAYERS + n, info, MAX_INFO_STRING );
trap_GetConfigString( CS_PLAYERS + cg.localPlayers[0].playerNum, info, MAX_INFO_STRING );
playerTeam = *Info_ValueForKey( info, "t" );

for( n = 0; n < numPlayers && teamOrdersMenuInfo.numBots < 9; n++ ) {
if( n == cg.localPlayers[0].playerNum ) {
playerTeam = *Info_ValueForKey( info, "t" );
continue;
}

trap_GetConfigString( CS_PLAYERS + n, info, MAX_INFO_STRING );

isBot = atoi( Info_ValueForKey( info, "skill" ) );
if( !isBot ) {
continue;
Expand Down

0 comments on commit a2ee75a

Please sign in to comment.