From 03752786710213015d82bcf093aec9e744434562 Mon Sep 17 00:00:00 2001 From: Razish Date: Sun, 8 Oct 2023 22:59:58 +1100 Subject: [PATCH 1/3] reconcile game module changes with the SDK release by diffing codemp/game * revert saberMoveData changes to match basejka, provide a new cvar (g_fixSaberMoveData) to patch it if desired * introduce a new configstring (26: CS_LEGACY_FIXES) to inform the client of which fixes it should also apply, e.g. saberMoveData * client module obtains gamestate (including configstrings) earlier to prevent use before initialisation, which is now checked for in debug builds * revert a change to saber disarm bonus calculation if g_fixSaberDisarmBonus is not enabled * G_CanBeEnemy considers private duels once again (removed from modbase before its git history) --- codemp/cgame/cg_draw.c | 2 +- codemp/cgame/cg_main.c | 11 +- codemp/cgame/cg_servercmds.c | 5 + codemp/game/NPC_AI_MineMonster.c | 2 +- codemp/game/NPC_combat.c | 6 +- codemp/game/bg_g2_utils.c | 20 --- codemp/game/bg_misc.c | 3 +- codemp/game/bg_public.h | 8 +- codemp/game/bg_saber.c | 57 ++++-- codemp/game/g_bot.c | 3 + codemp/game/g_cmds.c | 6 + codemp/game/g_cvar.c | 21 ++- codemp/game/g_main.c | 5 + codemp/game/g_xcvar.h | 287 ++++++++++++++++--------------- codemp/game/w_saber.c | 16 +- 15 files changed, 258 insertions(+), 194 deletions(-) diff --git a/codemp/cgame/cg_draw.c b/codemp/cgame/cg_draw.c index 8b793c1593..8d373d49d7 100644 --- a/codemp/cgame/cg_draw.c +++ b/codemp/cgame/cg_draw.c @@ -3064,7 +3064,7 @@ static float CG_DrawEnemyInfo ( float y ) clientNum = cgs.duelWinner; } - if ( clientNum >= MAX_CLIENTS || !(&cgs.clientinfo[ clientNum ]) ) + if ( clientNum < 0 || clientNum >= MAX_CLIENTS || !cgs.clientinfo[clientNum].infoValid ) { return y; } diff --git a/codemp/cgame/cg_main.c b/codemp/cgame/cg_main.c index b9c926d787..35fb68c12f 100644 --- a/codemp/cgame/cg_main.c +++ b/codemp/cgame/cg_main.c @@ -1623,6 +1623,9 @@ CG_ConfigString ================= */ const char *CG_ConfigString( int index ) { + // don't read configstrings before initialisation + assert( cgs.gameState.dataCount != 0 ); + if ( index < 0 || index >= MAX_CONFIGSTRINGS ) { trap->Error( ERR_DROP, "CG_ConfigString: bad index: %i", index ); } @@ -2449,6 +2452,9 @@ Ghoul2 Insert End memset( &cgs, 0, sizeof( cgs ) ); memset( cg_weapons, 0, sizeof(cg_weapons) ); + // get the gamestate from the client system + trap->GetGameState( &cgs.gameState ); + cg.clientNum = clientNum; cgs.processedSnapshotNum = serverMessageNum; @@ -2555,9 +2561,6 @@ Ghoul2 Insert End cgs.screenXScale = cgs.glconfig.vidWidth / 640.0; cgs.screenYScale = cgs.glconfig.vidHeight / 480.0; - // get the gamestate from the client system - trap->GetGameState( &cgs.gameState ); - CG_TransitionPermanent(); //rwwRMG - added // check version @@ -2626,6 +2629,8 @@ Ghoul2 Insert End cg.distanceCull = trap->R_GetDistanceCull(); CG_ParseEntitiesFromString(); + + BG_FixSaberMoveData(); } //makes sure returned string is in localized format diff --git a/codemp/cgame/cg_servercmds.c b/codemp/cgame/cg_servercmds.c index 82f4e20254..c10ffbaadf 100644 --- a/codemp/cgame/cg_servercmds.c +++ b/codemp/cgame/cg_servercmds.c @@ -27,6 +27,7 @@ along with this program; if not, see . // be a valid snapshot this frame #include "cg_local.h" +#include "game/bg_public.h" #include "ui/menudef.h" #include "ghoul2/G2.h" #include "ui/ui_public.h" @@ -909,6 +910,10 @@ static void CG_ConfigStringModified( void ) { else if ( num == CS_SHADERSTATE ) { CG_ShaderStateChanged(); } + else if ( num == CS_LEGACY_FIXES ) { + // LEGACYFIX_SABERMOVEDATA may have changed + BG_FixSaberMoveData(); + } else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES * 3)) { CG_SetLightstyle(num - CS_LIGHT_STYLES); diff --git a/codemp/game/NPC_AI_MineMonster.c b/codemp/game/NPC_AI_MineMonster.c index 3c801728d1..5342a640ed 100644 --- a/codemp/game/NPC_AI_MineMonster.c +++ b/codemp/game/NPC_AI_MineMonster.c @@ -90,7 +90,7 @@ void MineMonster_Patrol( void ) } //rwwFIXMEFIXME: Care about all clients, not just client 0 - //OJKFIXME: clietnum 0 + //OJKFIXME: clientnum 0 VectorSubtract( g_entities[0].r.currentOrigin, NPCS.NPC->r.currentOrigin, dif ); if ( VectorLengthSquared( dif ) < 256 * 256 ) diff --git a/codemp/game/NPC_combat.c b/codemp/game/NPC_combat.c index 7b855edc0c..67d169d1a1 100644 --- a/codemp/game/NPC_combat.c +++ b/codemp/game/NPC_combat.c @@ -1494,7 +1494,7 @@ gentity_t *NPC_PickEnemy( gentity_t *closestTo, int enemyTeam, qboolean checkVis minVis = VIS_360; } - //OJKFIXME: care about clients other than 0 + //OJKFIXME: clientnum 0 //OJKFIXME: choice[] is not size checked? if( findPlayersFirst ) {//try to find a player first @@ -2178,7 +2178,7 @@ qboolean NPC_EvaluateShot( int hit, qboolean glassOK ) return qfalse; } - if ( hit == NPCS.NPC->enemy->s.number || (&g_entities[hit] != NULL && (g_entities[hit].r.svFlags&SVF_GLASS_BRUSH)) ) + if ( hit == NPCS.NPC->enemy->s.number || (g_entities[hit].inuse && (g_entities[hit].r.svFlags&SVF_GLASS_BRUSH)) ) {//can hit enemy or will hit glass, so shoot anyway return qtrue; } @@ -2452,7 +2452,7 @@ float IdealDistance ( gentity_t *self ) case WP_THERMAL: ideal += 50; break; - + case WP_SABER: case WP_BRYAR_PISTOL: // case WP_BLASTER_PISTOL: diff --git a/codemp/game/bg_g2_utils.c b/codemp/game/bg_g2_utils.c index f8e6739a95..e4ba4dda19 100644 --- a/codemp/game/bg_g2_utils.c +++ b/codemp/game/bg_g2_utils.c @@ -42,26 +42,14 @@ void BG_AttachToRancor( void *ghoul2, float rancYaw, vec3_t rancOrigin, int time // Getting the bolt here if ( inMouth ) {//in mouth - #if defined(_GAME) boltIndex = trap->G2API_AddBolt(ghoul2, 0, "jaw_bone"); - #elif defined(_CGAME) - boltIndex = trap->G2API_AddBolt(ghoul2, 0, "jaw_bone"); - #endif } else {//in right hand - #if defined(_GAME) - boltIndex = trap->G2API_AddBolt(ghoul2, 0, "*r_hand"); - #elif defined(_CGAME) boltIndex = trap->G2API_AddBolt(ghoul2, 0, "*r_hand"); - #endif } VectorSet( rancAngles, 0, rancYaw, 0 ); -#if defined(_GAME) trap->G2API_GetBoltMatrix( ghoul2, 0, boltIndex, &boltMatrix, rancAngles, rancOrigin, time, modelList, modelScale ); -#elif defined(_CGAME) - trap->G2API_GetBoltMatrix( ghoul2, 0, boltIndex, &boltMatrix, rancAngles, rancOrigin, time, modelList, modelScale ); -#endif // Storing ent position, bolt position, and bolt axis if ( out_origin ) { @@ -112,11 +100,7 @@ void BG_AttachToRancor( void *ghoul2, float rancYaw, vec3_t rancOrigin, int time #define MAX_VARIANTS 8 qboolean BG_GetRootSurfNameWithVariant( void *ghoul2, const char *rootSurfName, char *returnSurfName, int returnSize ) { -#if defined(_GAME) - if ( !ghoul2 || !trap->G2API_GetSurfaceRenderStatus( ghoul2, 0, rootSurfName ) ) -#elif defined(_CGAME) if ( !ghoul2 || !trap->G2API_GetSurfaceRenderStatus( ghoul2, 0, rootSurfName ) ) -#endif {//see if the basic name without variants is on Q_strncpyz( returnSurfName, rootSurfName, returnSize ); return qtrue; @@ -127,11 +111,7 @@ qboolean BG_GetRootSurfNameWithVariant( void *ghoul2, const char *rootSurfName, for ( i = 0; i < MAX_VARIANTS; i++ ) { Com_sprintf( returnSurfName, returnSize, "%s%c", rootSurfName, 'a'+i ); - #if defined(_GAME) - if ( !trap->G2API_GetSurfaceRenderStatus( ghoul2, 0, returnSurfName ) ) - #elif defined(_CGAME) if ( !trap->G2API_GetSurfaceRenderStatus( ghoul2, 0, returnSurfName ) ) - #endif { return qtrue; } diff --git a/codemp/game/bg_misc.c b/codemp/game/bg_misc.c index b7fc7ba955..fb6181812f 100644 --- a/codemp/game/bg_misc.c +++ b/codemp/game/bg_misc.c @@ -2056,8 +2056,7 @@ qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const play {//force powers and saber only if ( item->giType != IT_TEAM //not a flag && item->giType != IT_ARMOR//not shields - && (item->giType != IT_WEAPON - || item->giTag != WP_SABER)//not a saber + && (item->giType != IT_WEAPON || item->giTag != WP_SABER)//not a saber && (item->giType != IT_HOLDABLE || item->giTag != HI_SEEKER)//not a seeker && (item->giType != IT_POWERUP || item->giTag == PW_YSALAMIRI) )//not a force pick-up { diff --git a/codemp/game/bg_public.h b/codemp/game/bg_public.h index e3da414b2f..f47b3db46e 100644 --- a/codemp/game/bg_public.h +++ b/codemp/game/bg_public.h @@ -111,7 +111,7 @@ along with this program; if not, see . #define CS_FLAGSTATUS 23 // string indicating flag status in CTF #define CS_SHADERSTATE 24 #define CS_BOTINFO 25 - +#define CS_LEGACY_FIXES 26 #define CS_ITEMS 27 // string of 0's and 1's that tell which items are present #define CS_CLIENT_JEDIMASTER 28 // current jedi master @@ -156,6 +156,10 @@ Ghoul2 Insert End #error overflow: (CS_MAX) > MAX_CONFIGSTRINGS #endif +typedef enum legacyFixes_e { + LEGACYFIX_SABERMOVEDATA = 0, +} legacyFixes_t; + typedef enum { G2_MODELPART_HEAD = 10, G2_MODELPART_WAIST, @@ -1717,6 +1721,8 @@ qboolean BG_InDeathAnim( int anim ); qboolean BG_InSaberLockOld( int anim ); qboolean BG_InSaberLock( int anim ); +void BG_FixSaberMoveData( void ); + void BG_SaberStartTransAnim( int clientNum, int saberAnimLevel, int weapon, int anim, float *animSpeed, int broken ); void BG_ForcePowerDrain( playerState_t *ps, forcePowers_t forcePower, int overrideAmt ); diff --git a/codemp/game/bg_saber.c b/codemp/game/bg_saber.c index e59413515b..7abb1642fd 100644 --- a/codemp/game/bg_saber.c +++ b/codemp/game/bg_saber.c @@ -26,6 +26,12 @@ along with this program; if not, see . #include "bg_local.h" #include "w_saber.h" +#if defined(_GAME) + #include "g_local.h" // for cvars +#elif defined(_CGAME) + #include "cgame/cg_local.h" // for configstrings +#endif + extern qboolean BG_SabersOff( playerState_t *ps ); saberInfo_t *BG_MySaber( int clientNum, int saberNum ); @@ -316,30 +322,23 @@ saberMoveData_t saberMoveData[LS_MOVE_MAX] = {// NB:randomized {"BParry Top", BOTH_H1_S1_T_, Q_T, Q_B, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_UP, {"BParry UR", BOTH_H1_S1_TR, Q_TR, Q_BL, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_UR, {"BParry UL", BOTH_H1_S1_TL, Q_TL, Q_BR, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_UL, - {"BParry LR", BOTH_H1_S1_BR, Q_BL, Q_TR, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_LR, + {"BParry LR", BOTH_H1_S1_BL, Q_BL, Q_TR, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_LR, {"BParry Bot", BOTH_H1_S1_B_, Q_B, Q_T, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_LR - {"BParry LL", BOTH_H1_S1_BL, Q_BR, Q_TL, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_LL - //{"BParry LR", BOTH_H1_S1_BL, Q_BL, Q_TR, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_LR, - //{"BParry Bot", BOTH_H1_S1_B_, Q_B, Q_T, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_LL - //{"BParry LL", BOTH_H1_S1_BR, Q_BR, Q_TL, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_LL + {"BParry LL", BOTH_H1_S1_BR, Q_BR, Q_TL, AFLAG_ACTIVE, 50, BLK_NO, LS_READY, LS_READY, 150 }, // LS_PARRY_LL // Knockaways {"Knock Top", BOTH_K1_S1_T_, Q_R, Q_T, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_BL2TR, LS_T1_T__BR, 150 }, // LS_PARRY_UP, {"Knock UR", BOTH_K1_S1_TR, Q_R, Q_TR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_BL2TR, LS_T1_TR__R, 150 }, // LS_PARRY_UR, {"Knock UL", BOTH_K1_S1_TL, Q_R, Q_TL, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_BR2TL, LS_T1_TL__L, 150 }, // LS_PARRY_UL, - {"Knock LR", BOTH_K1_S1_BR, Q_R, Q_BL, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TL2BR, LS_T1_BL_TL, 150 }, // LS_PARRY_LR, - {"Knock LL", BOTH_K1_S1_BL, Q_R, Q_BR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TR2BL, LS_T1_BR_TR, 150 }, // LS_PARRY_LL - //{"Knock LR", BOTH_K1_S1_BL, Q_R, Q_BL, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TL2BR, LS_T1_BL_TL, 150 }, // LS_PARRY_LR, - //{"Knock LL", BOTH_K1_S1_BR, Q_R, Q_BR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TR2BL, LS_T1_BR_TR, 150 }, // LS_PARRY_LL + {"Knock LR", BOTH_K1_S1_BL, Q_R, Q_BL, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TL2BR, LS_T1_BL_TL, 150 }, // LS_PARRY_LR, + {"Knock LL", BOTH_K1_S1_BR, Q_R, Q_BR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TR2BL, LS_T1_BR_TR, 150 }, // LS_PARRY_LL // Parry {"Parry Top", BOTH_P1_S1_T_, Q_R, Q_T, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_BL2TR, LS_A_T2B, 150 }, // LS_PARRY_UP, {"Parry UR", BOTH_P1_S1_TR, Q_R, Q_TL, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_BL2TR, LS_A_TR2BL, 150 }, // LS_PARRY_UR, {"Parry UL", BOTH_P1_S1_TL, Q_R, Q_TR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_BR2TL, LS_A_TL2BR, 150 }, // LS_PARRY_UL, - {"Parry LR", BOTH_P1_S1_BR, Q_R, Q_BR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TL2BR, LS_A_BR2TL, 150 }, // LS_PARRY_LR, - {"Parry LL", BOTH_P1_S1_BL, Q_R, Q_BL, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TR2BL, LS_A_BL2TR, 150 }, // LS_PARRY_LL - //{"Parry LR", BOTH_P1_S1_BL, Q_R, Q_BR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TL2BR, LS_A_BR2TL, 150 }, // LS_PARRY_LR, - //{"Parry LL", BOTH_P1_S1_BR, Q_R, Q_BL, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TR2BL, LS_A_BL2TR, 150 }, // LS_PARRY_LL + {"Parry LR", BOTH_P1_S1_BL, Q_R, Q_BR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TL2BR, LS_A_BR2TL, 150 }, // LS_PARRY_LR, + {"Parry LL", BOTH_P1_S1_BR, Q_R, Q_BL, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TR2BL, LS_A_BL2TR, 150 }, // LS_PARRY_LL // Reflecting a missile {"Reflect Top", BOTH_P1_S1_T_, Q_R, Q_T, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_BL2TR, LS_A_T2B, 300 }, // LS_PARRY_UP, @@ -349,6 +348,38 @@ saberMoveData_t saberMoveData[LS_MOVE_MAX] = {// NB:randomized {"Reflect LL", BOTH_P1_S1_BL, Q_R, Q_BR, AFLAG_ACTIVE, 50, BLK_WIDE, LS_R_TL2BR, LS_A_BR2TL, 300 }, // LS_PARRY_LL, }; +void BG_FixSaberMoveData(void) { +#if defined(_GAME) + const qboolean doFix = !!g_fixSaberMoveData.integer; +#elif defined(_CGAME) + const char *cs = CG_ConfigString(CS_LEGACY_FIXES); + const uint32_t legacyFixes = strtoul(cs, NULL, 0); + const qboolean doFix = !!(legacyFixes & (1 << LEGACYFIX_SABERMOVEDATA)); +#endif + saberMoveData_t *move; + + for (move = saberMoveData; move - saberMoveData < ARRAY_LEN(saberMoveData); move++) { + if (!strcmp(move->name, "BParry LR")) { + move->animToUse = doFix ? BOTH_H1_S1_BR : BOTH_H1_S1_BL; + } + else if (!strcmp(move->name, "BParry LL")) { + move->animToUse = doFix ? BOTH_H1_S1_BL : BOTH_H1_S1_BR; + } + else if (!strcmp(move->name, "Knock LR")) { + move->animToUse = doFix ? BOTH_K1_S1_BR : BOTH_K1_S1_BL; + } + else if (!strcmp(move->name, "Knock LL")) { + move->animToUse = doFix ? BOTH_K1_S1_BL : BOTH_K1_S1_BR; + } + else if (!strcmp(move->name, "Parry LR")) { + move->animToUse = doFix ? BOTH_P1_S1_BR : BOTH_P1_S1_BL; + } + else if (!strcmp(move->name, "Parry LL")) { + move->animToUse = doFix ? BOTH_P1_S1_BL : BOTH_P1_S1_BR; + } + } +} + int transitionMove[Q_NUM_QUADS][Q_NUM_QUADS] = { { LS_NONE, LS_T1_BR__R, LS_T1_BR_TR, LS_T1_BR_T_, LS_T1_BR_TL, LS_T1_BR__L, LS_T1_BR_BL, LS_NONE }, diff --git a/codemp/game/g_bot.c b/codemp/game/g_bot.c index 474370b3cb..8d065d141d 100644 --- a/codemp/game/g_bot.c +++ b/codemp/game/g_bot.c @@ -139,6 +139,9 @@ int G_GetMapTypeBits(char *type) typeBits |= (1 << GT_TEAM); typeBits |= (1 << GT_JEDIMASTER); } + if( strstr( type, "team" ) ) { + typeBits |= (1 << GT_TEAM); + } if( strstr( type, "holocron" ) ) { typeBits |= (1 << GT_HOLOCRON); } diff --git a/codemp/game/g_cmds.c b/codemp/game/g_cmds.c index e5c7e24d29..8227f5ee3f 100644 --- a/codemp/game/g_cmds.c +++ b/codemp/game/g_cmds.c @@ -2358,6 +2358,12 @@ void Cmd_CallTeamVote_f( gentity_t *ent ) { char arg1[MAX_CVAR_VALUE_STRING] = {0}; char arg2[MAX_CVAR_VALUE_STRING] = {0}; + if ( g_gametype.integer < GT_TEAM ) + { + trap->SendServerCommand( ent-g_entities, "print \"Cannot call a team vote in a non-team gametype!\n\"" ); + return; + } + if ( team == TEAM_RED ) cs_offset = 0; else if ( team == TEAM_BLUE ) diff --git a/codemp/game/g_cvar.c b/codemp/game/g_cvar.c index ea8f8d0468..c0839be5e7 100644 --- a/codemp/game/g_cvar.c +++ b/codemp/game/g_cvar.c @@ -21,18 +21,29 @@ along with this program; if not, see . =========================================================================== */ +#include + #include "g_local.h" +#include "game/bg_public.h" // // Cvar callbacks // -/* -static void CVU_Derpity( void ) { - // ... -} -*/ +static void CVU_FixSaberMoveData(void) { + BG_FixSaberMoveData(); + char sLegacyFixes[32]; + trap->GetConfigstring(CS_LEGACY_FIXES, sLegacyFixes, sizeof(sLegacyFixes)); + + uint32_t legacyFixes = strtoul(sLegacyFixes, NULL, 0); + if (g_fixSaberMoveData.integer) { + legacyFixes |= (1 << LEGACYFIX_SABERMOVEDATA); + } else { + legacyFixes &= ~(1 << LEGACYFIX_SABERMOVEDATA); + } + trap->SetConfigstring(CS_LEGACY_FIXES, va("%" PRIu32, legacyFixes)); +} // // Cvar table diff --git a/codemp/game/g_main.c b/codemp/game/g_main.c index 31715742ad..a8d33959e1 100644 --- a/codemp/game/g_main.c +++ b/codemp/game/g_main.c @@ -28,6 +28,7 @@ along with this program; if not, see . #include "g_nav.h" #include "bg_saga.h" #include "b_local.h" +#include "game/bg_public.h" #include "qcommon/q_version.h" NORETURN_PTR void (*Com_Error)( int level, const char *error, ... ); @@ -202,6 +203,10 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { trap->Print ("gamename: %s\n", GAMEVERSION); trap->Print ("gamedate: %s\n", SOURCE_DATE); + // init as zero, to be updated by the following cvar registration + // relevant cvars call their update func to modify CS_LEGACY_FIXES when necessary + trap->SetConfigstring(CS_LEGACY_FIXES, "0"); + G_RegisterCvars(); G_ProcessIPBans(); diff --git a/codemp/game/g_xcvar.h b/codemp/game/g_xcvar.h index dca8c3ccd8..b21a6c430c 100644 --- a/codemp/game/g_xcvar.h +++ b/codemp/game/g_xcvar.h @@ -23,159 +23,160 @@ along with this program; if not, see . #include "qcommon/q_version.h" -#ifdef XCVAR_PROTO +#if defined(XCVAR_PROTO) #define XCVAR_DEF( name, defVal, update, flags, announce ) extern vmCvar_t name; -#endif - -#ifdef XCVAR_DECL +#elif defined(XCVAR_DECL) #define XCVAR_DEF( name, defVal, update, flags, announce ) vmCvar_t name; -#endif - -#ifdef XCVAR_LIST +#elif defined(XCVAR_LIST) #define XCVAR_DEF( name, defVal, update, flags, announce ) { & name , #name , defVal , update , flags , announce }, +#else + #warning "missing XCVAR expansion def" + #define XCVAR_DEF( ... ) #endif -XCVAR_DEF( bg_fighterAltControl, "0", NULL, CVAR_SYSTEMINFO, qtrue ) -XCVAR_DEF( capturelimit, "8", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) -XCVAR_DEF( com_optvehtrace, "0", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( d_altRoutes, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_asynchronousGroupAI, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_break, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_JediAI, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_noGroupAI, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_noroam, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_npcai, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_npcaiming, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_npcfreeze, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_noIntermissionWait, "0", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( d_patched, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_perPlayerGhoul2, "0", NULL, CVAR_CHEAT, qtrue ) -XCVAR_DEF( d_powerDuelPrint, "0", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( d_projectileGhoul2Collision, "1", NULL, CVAR_CHEAT, qtrue ) -XCVAR_DEF( d_saberAlwaysBoxTrace, "0", NULL, CVAR_CHEAT, qtrue ) -XCVAR_DEF( d_saberBoxTraceSize, "0", NULL, CVAR_CHEAT, qtrue ) -XCVAR_DEF( d_saberCombat, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( d_saberGhoul2Collision, "1", NULL, CVAR_CHEAT, qtrue ) -XCVAR_DEF( d_saberInterpolate, "0", NULL, CVAR_CHEAT, qtrue ) -XCVAR_DEF( d_saberKickTweak, "1", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( d_saberSPStyleDamage, "1", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( d_saberStanceDebug, "0", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( d_siegeSeekerNPC, "0", NULL, CVAR_CHEAT, qtrue ) -XCVAR_DEF( dedicated, "0", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( developer, "0", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( dmflags, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( duel_fraglimit, "10", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) -XCVAR_DEF( fraglimit, "20", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) -XCVAR_DEF( g_adaptRespawn, "1", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_allowDuelSuicide, "1", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_allowHighPingDuelist, "1", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_allowNPC, "1", NULL, CVAR_CHEAT, qtrue ) -XCVAR_DEF( g_allowTeamVote, "1", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_allowVote, "-1", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_antiFakePlayer, "1", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_armBreakage, "0", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_austrian, "0", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_autoMapCycle, "0", NULL, CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) -XCVAR_DEF( g_banIPs, "", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_charRestrictRGB, "1", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_duelWeaponDisable, "1", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qtrue ) -XCVAR_DEF( g_debugAlloc, "0", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_debugDamage, "0", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_debugMelee, "0", NULL, CVAR_SERVERINFO, qtrue ) -XCVAR_DEF( g_debugMove, "0", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_debugSaberLocks, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( g_debugServerSkel, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( bg_fighterAltControl, "0", NULL, CVAR_SYSTEMINFO, qtrue ) +XCVAR_DEF( capturelimit, "8", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) +XCVAR_DEF( com_optvehtrace, "0", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( d_altRoutes, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_asynchronousGroupAI, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_break, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_JediAI, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_noGroupAI, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_noroam, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_npcai, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_npcaiming, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_npcfreeze, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_noIntermissionWait, "0", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( d_patched, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_perPlayerGhoul2, "0", NULL, CVAR_CHEAT, qtrue ) +XCVAR_DEF( d_powerDuelPrint, "0", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( d_projectileGhoul2Collision, "1", NULL, CVAR_CHEAT, qtrue ) +XCVAR_DEF( d_saberAlwaysBoxTrace, "0", NULL, CVAR_CHEAT, qtrue ) +XCVAR_DEF( d_saberBoxTraceSize, "0", NULL, CVAR_CHEAT, qtrue ) +XCVAR_DEF( d_saberCombat, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( d_saberGhoul2Collision, "1", NULL, CVAR_CHEAT, qtrue ) +XCVAR_DEF( d_saberInterpolate, "0", NULL, CVAR_CHEAT, qtrue ) +XCVAR_DEF( d_saberKickTweak, "1", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( d_saberSPStyleDamage, "1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( d_saberStanceDebug, "0", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( d_siegeSeekerNPC, "0", NULL, CVAR_CHEAT, qtrue ) +XCVAR_DEF( dedicated, "0", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( developer, "0", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( dmflags, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( duel_fraglimit, "10", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) +XCVAR_DEF( fraglimit, "20", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) +XCVAR_DEF( g_adaptRespawn, "1", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_allowDuelSuicide, "1", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_allowHighPingDuelist, "1", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_allowNPC, "1", NULL, CVAR_CHEAT, qtrue ) +XCVAR_DEF( g_allowTeamVote, "1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_allowVote, "-1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_antiFakePlayer, "1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_armBreakage, "0", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_austrian, "0", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_autoMapCycle, "0", NULL, CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) +XCVAR_DEF( g_banIPs, "", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_charRestrictRGB, "1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_duelWeaponDisable, "1", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qtrue ) +XCVAR_DEF( g_debugAlloc, "0", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_debugDamage, "0", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_debugMelee, "0", NULL, CVAR_SERVERINFO, qtrue ) +XCVAR_DEF( g_debugMove, "0", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_debugSaberLocks, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( g_debugServerSkel, "0", NULL, CVAR_CHEAT, qfalse ) #ifdef _DEBUG -XCVAR_DEF( g_disableServerG2, "0", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_disableServerG2, "0", NULL, CVAR_NONE, qtrue ) #endif -XCVAR_DEF( g_dismember, "0", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_doWarmup, "0", NULL, CVAR_NONE, qtrue ) -//XCVAR_DEF( g_engineModifications, "1", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_ff_objectives, "0", NULL, CVAR_CHEAT|CVAR_NORESTART, qtrue ) -XCVAR_DEF( g_filterBan, "1", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_forceBasedTeams, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qfalse ) -XCVAR_DEF( g_forceClientUpdateRate, "250", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_forceDodge, "1", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_forcePowerDisable, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qtrue ) -XCVAR_DEF( g_forceRegenTime, "200", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_forceRespawn, "60", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_fraglimitVoteCorrection, "1", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_friendlyFire, "0", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_friendlySaber, "0", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_g2TraceLod, "3", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_gametype, "0", NULL, CVAR_SERVERINFO|CVAR_LATCH, qfalse ) -XCVAR_DEF( g_gravity, "800", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_inactivity, "0", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_jediVmerc, "0", NULL, CVAR_SERVERINFO|CVAR_LATCH|CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_knockback, "1000", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_locationBasedDamage, "1", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_log, "games.log", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_logClientInfo, "0", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_logSync, "0", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_maxConnPerIP, "3", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_maxForceRank, "7", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qfalse ) -XCVAR_DEF( g_maxGameClients, "0", NULL, CVAR_SERVERINFO|CVAR_LATCH|CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_maxHolocronCarry, "3", NULL, CVAR_LATCH, qfalse ) -XCVAR_DEF( g_motd, "", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_needpass, "0", NULL, CVAR_SERVERINFO|CVAR_ROM, qfalse ) -XCVAR_DEF( g_noSpecMove, "0", NULL, CVAR_SERVERINFO, qtrue ) -XCVAR_DEF( g_npcspskill, "0", NULL, CVAR_ARCHIVE|CVAR_INTERNAL, qfalse ) -XCVAR_DEF( g_password, "", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_powerDuelEndHealth, "90", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_powerDuelStartHealth, "150", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_privateDuel, "1", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_randFix, "1", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_restarted, "0", NULL, CVAR_ROM, qfalse ) -XCVAR_DEF( g_saberBladeFaces, "1", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_saberDamageScale, "1", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_dismember, "0", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_doWarmup, "0", NULL, CVAR_NONE, qtrue ) +//XCVAR_DEF( g_engineModifications, "1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_ff_objectives, "0", NULL, CVAR_CHEAT|CVAR_NORESTART, qtrue ) +XCVAR_DEF( g_filterBan, "1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_fixSaberDisarmBonus, "1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_fixSaberMoveData, "1", CVU_FixSaberMoveData, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_forceBasedTeams, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qfalse ) +XCVAR_DEF( g_forceClientUpdateRate, "250", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_forceDodge, "1", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_forcePowerDisable, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qtrue ) +XCVAR_DEF( g_forceRegenTime, "200", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_forceRespawn, "60", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_fraglimitVoteCorrection, "1", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_friendlyFire, "0", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_friendlySaber, "0", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_g2TraceLod, "3", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_gametype, "0", NULL, CVAR_SERVERINFO|CVAR_LATCH, qfalse ) +XCVAR_DEF( g_gravity, "800", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_inactivity, "0", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_jediVmerc, "0", NULL, CVAR_SERVERINFO|CVAR_LATCH|CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_knockback, "1000", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_locationBasedDamage, "1", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_log, "games.log", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_logClientInfo, "0", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_logSync, "0", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_maxConnPerIP, "3", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_maxForceRank, "7", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qfalse ) +XCVAR_DEF( g_maxGameClients, "0", NULL, CVAR_SERVERINFO|CVAR_LATCH|CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_maxHolocronCarry, "3", NULL, CVAR_LATCH, qfalse ) +XCVAR_DEF( g_motd, "", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_needpass, "0", NULL, CVAR_SERVERINFO|CVAR_ROM, qfalse ) +XCVAR_DEF( g_noSpecMove, "0", NULL, CVAR_SERVERINFO, qtrue ) +XCVAR_DEF( g_npcspskill, "0", NULL, CVAR_ARCHIVE|CVAR_INTERNAL, qfalse ) +XCVAR_DEF( g_password, "", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_powerDuelEndHealth, "90", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_powerDuelStartHealth, "150", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_privateDuel, "1", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_randFix, "1", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_restarted, "0", NULL, CVAR_ROM, qfalse ) +XCVAR_DEF( g_saberBladeFaces, "1", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_saberDamageScale, "1", NULL, CVAR_ARCHIVE, qtrue ) #ifdef DEBUG_SABER_BOX -XCVAR_DEF( g_saberDebugBox, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( g_saberDebugBox, "0", NULL, CVAR_CHEAT, qfalse ) #endif #ifndef FINAL_BUILD -XCVAR_DEF( g_saberDebugPrint, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( g_saberDebugPrint, "0", NULL, CVAR_CHEAT, qfalse ) #endif -XCVAR_DEF( g_saberDmgDelay_Idle, "350", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_saberDmgDelay_Wound, "0", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_saberDmgVelocityScale, "0", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_saberLockFactor, "2", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_saberLocking, "1", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_saberLockRandomNess, "2", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_saberRealisticCombat, "0", NULL, CVAR_CHEAT, qfalse ) -XCVAR_DEF( g_saberRestrictForce, "0", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_saberTraceSaberFirst, "0", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_saberWallDamageScale, "0.4", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_securityLog, "1", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_showDuelHealths, "0", NULL, CVAR_SERVERINFO, qfalse ) -XCVAR_DEF( g_siegeRespawn, "20", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_siegeTeam1, "none", NULL, CVAR_ARCHIVE|CVAR_SERVERINFO, qfalse ) -XCVAR_DEF( g_siegeTeam2, "none", NULL, CVAR_ARCHIVE|CVAR_SERVERINFO, qfalse ) -XCVAR_DEF( g_siegeTeamSwitch, "1", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_slowmoDuelEnd, "0", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_smoothClients, "1", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_spawnInvulnerability, "3000", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_speed, "250", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_statLog, "0", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_statLogFile, "statlog.log", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_stepSlideFix, "1", NULL, CVAR_SERVERINFO, qtrue ) -XCVAR_DEF( g_synchronousClients, "0", NULL, CVAR_SYSTEMINFO, qfalse ) -XCVAR_DEF( g_teamAutoJoin, "0", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_teamForceBalance, "0", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_timeouttospec, "70", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_userinfoValidate, "25165823", NULL, CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( g_useWhileThrowing, "1", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( g_voteDelay, "3000", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( g_warmup, "20", NULL, CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( g_weaponDisable, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qtrue ) -XCVAR_DEF( g_weaponRespawn, "5", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( gamedate, SOURCE_DATE, NULL, CVAR_ROM, qfalse ) -XCVAR_DEF( gamename, GAMEVERSION, NULL, CVAR_SERVERINFO|CVAR_ROM, qfalse ) -XCVAR_DEF( pmove_fixed, "0", NULL, CVAR_SYSTEMINFO|CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( pmove_float, "0", NULL, CVAR_SYSTEMINFO|CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( pmove_msec, "8", NULL, CVAR_SYSTEMINFO|CVAR_ARCHIVE, qtrue ) -XCVAR_DEF( RMG, "0", NULL, CVAR_NONE, qtrue ) -XCVAR_DEF( sv_cheats, "1", NULL, CVAR_NONE, qfalse ) -XCVAR_DEF( sv_fps, "40", NULL, CVAR_ARCHIVE|CVAR_SERVERINFO, qtrue ) -XCVAR_DEF( sv_maxclients, "8", NULL, CVAR_SERVERINFO|CVAR_LATCH|CVAR_ARCHIVE, qfalse ) -XCVAR_DEF( timelimit, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) +XCVAR_DEF( g_saberDmgDelay_Idle, "350", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_saberDmgDelay_Wound, "0", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_saberDmgVelocityScale, "0", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_saberLockFactor, "2", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_saberLocking, "1", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_saberLockRandomNess, "2", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_saberRealisticCombat, "0", NULL, CVAR_CHEAT, qfalse ) +XCVAR_DEF( g_saberRestrictForce, "0", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_saberTraceSaberFirst, "0", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_saberWallDamageScale, "0.4", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_securityLog, "1", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_showDuelHealths, "0", NULL, CVAR_SERVERINFO, qfalse ) +XCVAR_DEF( g_siegeRespawn, "20", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_siegeTeam1, "none", NULL, CVAR_ARCHIVE|CVAR_SERVERINFO, qfalse ) +XCVAR_DEF( g_siegeTeam2, "none", NULL, CVAR_ARCHIVE|CVAR_SERVERINFO, qfalse ) +XCVAR_DEF( g_siegeTeamSwitch, "1", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_slowmoDuelEnd, "0", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_smoothClients, "1", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_spawnInvulnerability, "3000", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_speed, "250", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_statLog, "0", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_statLogFile, "statlog.log", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_stepSlideFix, "1", NULL, CVAR_SERVERINFO, qtrue ) +XCVAR_DEF( g_synchronousClients, "0", NULL, CVAR_SYSTEMINFO, qfalse ) +XCVAR_DEF( g_teamAutoJoin, "0", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_teamForceBalance, "0", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_timeouttospec, "70", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_userinfoValidate, "25165823", NULL, CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( g_useWhileThrowing, "1", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( g_voteDelay, "3000", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( g_warmup, "20", NULL, CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( g_weaponDisable, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH, qtrue ) +XCVAR_DEF( g_weaponRespawn, "5", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( gamedate, SOURCE_DATE, NULL, CVAR_ROM, qfalse ) +XCVAR_DEF( gamename, GAMEVERSION, NULL, CVAR_SERVERINFO|CVAR_ROM, qfalse ) +XCVAR_DEF( pmove_fixed, "0", NULL, CVAR_SYSTEMINFO|CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( pmove_float, "0", NULL, CVAR_SYSTEMINFO|CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( pmove_msec, "8", NULL, CVAR_SYSTEMINFO|CVAR_ARCHIVE, qtrue ) +XCVAR_DEF( RMG, "0", NULL, CVAR_NONE, qtrue ) +XCVAR_DEF( sv_cheats, "1", NULL, CVAR_NONE, qfalse ) +XCVAR_DEF( sv_fps, "40", NULL, CVAR_ARCHIVE|CVAR_SERVERINFO, qtrue ) +XCVAR_DEF( sv_maxclients, "8", NULL, CVAR_SERVERINFO|CVAR_LATCH|CVAR_ARCHIVE, qfalse ) +XCVAR_DEF( timelimit, "0", NULL, CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_NORESTART, qtrue ) #undef XCVAR_DEF diff --git a/codemp/game/w_saber.c b/codemp/game/w_saber.c index 5561b3ed8d..b143eae0b8 100644 --- a/codemp/game/w_saber.c +++ b/codemp/game/w_saber.c @@ -109,6 +109,16 @@ qboolean G_CanBeEnemy( gentity_t *self, gentity_t *enemy ) if ( !self->inuse || !enemy->inuse || !self->client || !enemy->client ) return qfalse; + if (self->client->ps.duelInProgress && self->client->ps.duelIndex != enemy->s.number) + { //dueling but not with this person + return qfalse; + } + + if (enemy->client->ps.duelInProgress && enemy->client->ps.duelIndex != self->s.number) + { //other guy dueling but not with me + return qfalse; + } + if (level.gametype < GT_TEAM) return qtrue; @@ -6745,7 +6755,8 @@ qboolean saberCheckKnockdown_DuelLoss(gentity_t *saberent, gentity_t *saberOwner if ( other && other->client ) { disarmChance += other->client->saber[0].disarmBonus; - if ( other->client->saber[1].model[0] + if ( g_fixSaberDisarmBonus.integer + && other->client->saber[1].model[0] && !other->client->ps.saberHolstered ) { disarmChance += other->client->saber[1].disarmBonus; @@ -6829,7 +6840,8 @@ qboolean saberCheckKnockdown_BrokenParry(gentity_t *saberent, gentity_t *saberOw if ( other && other->client ) { disarmChance += other->client->saber[0].disarmBonus; - if ( other->client->saber[1].model[0] + if ( g_fixSaberDisarmBonus.integer + && other->client->saber[1].model[0] && !other->client->ps.saberHolstered ) { disarmChance += other->client->saber[1].disarmBonus; From 6b9c79d1d15e8c77601d26863aadd54c658afa0b Mon Sep 17 00:00:00 2001 From: Razish Date: Mon, 9 Oct 2023 00:26:43 +1100 Subject: [PATCH 2/3] add disclaimer to legacyFixes_e --- codemp/game/bg_public.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/codemp/game/bg_public.h b/codemp/game/bg_public.h index f47b3db46e..4cb83fe577 100644 --- a/codemp/game/bg_public.h +++ b/codemp/game/bg_public.h @@ -158,6 +158,18 @@ Ghoul2 Insert End typedef enum legacyFixes_e { LEGACYFIX_SABERMOVEDATA = 0, + /* + m m ""# " m m + # # mmm m m # mmm mmm mm#mm mmm m mm # + #mmmm# #" # "m m" # # # " # #" # #" # # + # # #"""" #m# # # """m # #"""" # # " + # # "#mm" "# # "mm mm#mm "mmm" "mm "#mm" # # # + m" " + "" + Forks of OpenJK should NOT add to or modify the legacy fixes values + Removal, replacement or adding of new flags might lead to incompatibilities + Forks should define their own configstring or serverinfo cvar instead of modifying this + */ } legacyFixes_t; typedef enum { From a76fc2617df3cda09e65860254f7f6ea5d2b6ce4 Mon Sep 17 00:00:00 2001 From: Razish Date: Fri, 16 Feb 2024 03:17:04 +1100 Subject: [PATCH 3/3] revert: client module obtains gamestate (including configstrings) earlier to prevent use before initialisation this was causing issues loading incorrect clientinfo --- codemp/cgame/cg_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/codemp/cgame/cg_main.c b/codemp/cgame/cg_main.c index 35fb68c12f..b7fcdcb01f 100644 --- a/codemp/cgame/cg_main.c +++ b/codemp/cgame/cg_main.c @@ -1623,8 +1623,8 @@ CG_ConfigString ================= */ const char *CG_ConfigString( int index ) { - // don't read configstrings before initialisation - assert( cgs.gameState.dataCount != 0 ); + // FIXME: don't read configstrings before initialisation + // assert( cgs.gameState.dataCount != 0 ); if ( index < 0 || index >= MAX_CONFIGSTRINGS ) { trap->Error( ERR_DROP, "CG_ConfigString: bad index: %i", index ); @@ -2452,9 +2452,6 @@ Ghoul2 Insert End memset( &cgs, 0, sizeof( cgs ) ); memset( cg_weapons, 0, sizeof(cg_weapons) ); - // get the gamestate from the client system - trap->GetGameState( &cgs.gameState ); - cg.clientNum = clientNum; cgs.processedSnapshotNum = serverMessageNum; @@ -2561,6 +2558,9 @@ Ghoul2 Insert End cgs.screenXScale = cgs.glconfig.vidWidth / 640.0; cgs.screenYScale = cgs.glconfig.vidHeight / 480.0; + // get the gamestate from the client system + trap->GetGameState( &cgs.gameState ); + CG_TransitionPermanent(); //rwwRMG - added // check version