From 7df0369e04cb121b4b3a16c1bb34125956108c94 Mon Sep 17 00:00:00 2001 From: razor Date: Thu, 19 Oct 2023 23:43:27 +1100 Subject: [PATCH] reconcile with SDK, add g_fixSaberDisarmBonus and g_fixSaberMoveData (#448) --- cgame/cg_main.cpp | 7 +- cgame/cg_servercmds.cpp | 5 + cgame/cg_xcvar.h | 13 +- game/NPC_AI_Grenadier.cpp | 4 +- game/NPC_AI_Jedi.cpp | 2 - game/NPC_combat.cpp | 2 +- game/SpeederNPC.cpp | 1 - game/bg_misc.cpp | 5 +- game/bg_panimate.cpp | 2 - game/bg_pmove.cpp | 1 - game/bg_public.h | 242 +++++++++++++++++++------------------- game/bg_saber.cpp | 74 ++++++++---- game/g_ICARUScb.cpp | 1 - game/g_active.cpp | 1 - game/g_main.cpp | 35 ++++-- game/g_xcvar.h | 15 +-- game/w_saber.cpp | 17 ++- package.lua | 4 +- ui/ui_xcvar.h | 13 +- 19 files changed, 242 insertions(+), 202 deletions(-) diff --git a/cgame/cg_main.cpp b/cgame/cg_main.cpp index 7133df4..e914a82 100644 --- a/cgame/cg_main.cpp +++ b/cgame/cg_main.cpp @@ -771,6 +771,9 @@ static void CG_RegisterClients(void) { } 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); return NULL; @@ -1708,6 +1711,8 @@ void CG_Init(int serverMessageNum, int serverCommandSequence, int clientNum, qbo memset(cg_items, 0, sizeof(cg_items)); memset(cg_weapons, 0, sizeof(cg_weapons)); + trap->GetGameState(&cgs.gameState); + trap->RegisterSharedMemory(cg.sharedBuffer); CG_RegisterCvars(); @@ -1758,7 +1763,6 @@ void CG_Init(int serverMessageNum, int serverCommandSequence, int clientNum, qbo cgs.screenYScale = cgs.glconfig.vidHeight / SCREEN_HEIGHT; CG_Set2DRatio(); - trap->GetGameState(&cgs.gameState); s = CG_ConfigString(CS_GAME_VERSION); if (strcmp(s, GAME_VERSION)) { trap->Error(ERR_DROP, "Client/Server game mismatch: " GAME_VERSION "/%s", s); @@ -1853,6 +1857,7 @@ void CG_Init(int serverMessageNum, int serverCommandSequence, int clientNum, qbo } CG_UpdateServerHistory(); + BG_FixSaberMoveData(); } // makes sure returned string is in localized format diff --git a/cgame/cg_servercmds.cpp b/cgame/cg_servercmds.cpp index 90202b3..d38004e 100644 --- a/cgame/cg_servercmds.cpp +++ b/cgame/cg_servercmds.cpp @@ -752,6 +752,11 @@ static void CG_ConfigStringModified(void) { 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/cgame/cg_xcvar.h b/cgame/cg_xcvar.h index 9ca7014..ec09765 100644 --- a/cgame/cg_xcvar.h +++ b/cgame/cg_xcvar.h @@ -1,14 +1,13 @@ -#ifdef XCVAR_PROTO +#if defined(XCVAR_PROTO) #define XCVAR_DEF(name, defVal, update, flags) extern vmCvar_t name; -#endif - -#ifdef XCVAR_DECL +#elif defined(XCVAR_DECL) #define XCVAR_DEF(name, defVal, update, flags) vmCvar_t name; -#endif - -#ifdef XCVAR_LIST +#elif defined(XCVAR_LIST) #define XCVAR_DEF(name, defVal, update, flags) {&name, #name, defVal, update, flags}, +#else +#pragma message("missing XCVAR expansion def") +#define XCVAR_DEF(...) #endif XCVAR_DEF(bg_fighterAltControl, "0", NULL, CVAR_SERVERINFO) diff --git a/game/NPC_AI_Grenadier.cpp b/game/NPC_AI_Grenadier.cpp index 1a04788..36dcccc 100644 --- a/game/NPC_AI_Grenadier.cpp +++ b/game/NPC_AI_Grenadier.cpp @@ -2,8 +2,6 @@ #include "g_nav.h" #include "anims.h" -qboolean BG_SabersOff(playerState_t *ps); - void CG_DrawAlert(vector3 *origin, float rating); void G_AddVoiceEvent(gentity_t *self, int event, int speakDebounceTime); void NPC_TempLookTarget(gentity_t *self, int lookEntNum, int minLookTime, int maxLookTime); @@ -332,7 +330,7 @@ qboolean Grenadier_EvaluateShot(int hit) { } if (hit == NPC->enemy->s.number || - (&g_entities[hit] != NULL && (g_entities[hit].r.svFlags & SVF_GLASS_BRUSH))) { // can hit enemy or will hit glass, so shoot anyway + (g_entities[hit].inuse && (g_entities[hit].r.svFlags & SVF_GLASS_BRUSH))) { // can hit enemy or will hit glass, so shoot anyway return qtrue; } return qfalse; diff --git a/game/NPC_AI_Jedi.cpp b/game/NPC_AI_Jedi.cpp index bc60c75..e0d93c9 100644 --- a/game/NPC_AI_Jedi.cpp +++ b/game/NPC_AI_Jedi.cpp @@ -3,8 +3,6 @@ #include "anims.h" #include "w_saber.h" -qboolean BG_SabersOff(playerState_t *ps); - void CG_DrawAlert(vector3 *origin, float rating); void G_AddVoiceEvent(gentity_t *self, int event, int speakDebounceTime); void ForceJump(gentity_t *self, usercmd_t *ucmd); diff --git a/game/NPC_combat.cpp b/game/NPC_combat.cpp index 9e53819..74514fc 100644 --- a/game/NPC_combat.cpp +++ b/game/NPC_combat.cpp @@ -1742,7 +1742,7 @@ qboolean NPC_EvaluateShot(int hit, qboolean glassOK) { } if (hit == NPC->enemy->s.number || - (&g_entities[hit] != NULL && (g_entities[hit].r.svFlags & SVF_GLASS_BRUSH))) { // can hit enemy or will hit glass, so shoot anyway + (g_entities[hit].inuse && (g_entities[hit].r.svFlags & SVF_GLASS_BRUSH))) { // can hit enemy or will hit glass, so shoot anyway return qtrue; } return qfalse; diff --git a/game/SpeederNPC.cpp b/game/SpeederNPC.cpp index dd9bc34..c542c45 100644 --- a/game/SpeederNPC.cpp +++ b/game/SpeederNPC.cpp @@ -19,7 +19,6 @@ int PM_AnimLength(int index, animNumber_t anim); void BG_SetAnim(playerState_t *ps, animation_t *animations, int setAnimParts, int anim, uint32_t setAnimFlags, int blendTime); int BG_GetTime(void); -qboolean BG_SabersOff(playerState_t *ps); // Alright, actually, most of this file is shared between game and cgame for MP. // I would like to keep it this way, so when modifying for SP please keep in diff --git a/game/bg_misc.cpp b/game/bg_misc.cpp index 036c7f5..7f72443 100644 --- a/game/bg_misc.cpp +++ b/game/bg_misc.cpp @@ -146,7 +146,7 @@ const int forcePowerDarkLight[NUM_FORCE_POWERS] = // 0 == neutral 0, // FP_SABER_OFFENSE, 0, // FP_SABER_DEFENSE, 0 // FP_SABERTHROW, - // NUM_FORCE_POWERS + // NUM_FORCE_POWERS }; const int WeaponReadyAnim[WP_NUM_WEAPONS] = { @@ -2373,6 +2373,9 @@ uint32_t BG_GetMapTypeBits(const char *type) { typeBits |= (1 << GT_JEDIMASTER); typeBits |= (1 << GT_HOLOCRON); } + if (strstr(type, "team")) { + typeBits |= (1 << GT_TEAM); + } if (strstr(type, "coop")) { typeBits |= (1 << GT_SINGLE_PLAYER); } diff --git a/game/bg_panimate.cpp b/game/bg_panimate.cpp index f4d7f7b..b37a219 100644 --- a/game/bg_panimate.cpp +++ b/game/bg_panimate.cpp @@ -10,8 +10,6 @@ #include "cgame/cg_local.h" #endif -saberInfo_t *BG_MySaber(int clientNum, int saberNum); - // Called regardless of pm validity: // VVFIXME - Most of these functions are totally stateless and stupid. // Don't need multiple copies of this, but it's much easier (and less likely to break in the future) if I keep separate diff --git a/game/bg_pmove.cpp b/game/bg_pmove.cpp index 3ad6089..1548c60 100644 --- a/game/bg_pmove.cpp +++ b/game/bg_pmove.cpp @@ -31,7 +31,6 @@ qboolean TryGrapple(gentity_t *ent); // g_cmds.c qboolean BG_FullBodyTauntAnim(int anim); float PM_WalkableGroundDistance(void); qboolean PM_GroundSlideOkay(float zNormal); -saberInfo_t *BG_MySaber(int clientNum, int saberNum); pmove_t *pm; pml_t pml; diff --git a/game/bg_public.h b/game/bg_public.h index 3c734ff..50909b0 100644 --- a/game/bg_public.h +++ b/game/bg_public.h @@ -93,7 +93,7 @@ #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 @@ -138,6 +138,22 @@ Ghoul2 Insert End #error overflow: (CS_MAX) > MAX_CONFIGSTRINGS #endif +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 { G2_MODELPART_HEAD = 10, G2_MODELPART_WAIST, @@ -487,10 +503,6 @@ extern pmove_t *pm; // a repeating animation #define SETANIM_FLAG_PACE 16 // acts like a SETANIM_FLAG_RESTART but only restarts if the animation is over. -// if a full pmove isn't done on the client, you can just update the angles -void PM_UpdateViewAngles(playerState_t *ps, const usercmd_t *cmd); -void Pmove(pmove_t *pmove); - // player_state->stats[] indexes // NOTE: may not have more than 16 typedef enum { @@ -1070,15 +1082,8 @@ typedef struct gitem_s { extern const gitem_t bg_itemlist[]; extern const size_t bg_numItems; -const gitem_t *BG_FindItem(const char *classname); -const gitem_t *BG_FindItemForAmmo(ammo_t ammo); -const gitem_t *BG_FindItemForWeapon(weapon_t wp); -const gitem_t *BG_FindItemForPowerup(powerup_t pw); -const gitem_t *BG_FindItemForHoldable(holdable_t hi); #define ITEM_INDEX(x) ((x)-bg_itemlist) -qboolean BG_CanItemBeGrabbed(int gametype, const entityState_t *ent, const playerState_t *ps); - #define SABER_BLOCK_DUR 150 // number of milliseconds a block animation should take. // dmflags->integer flags @@ -1560,7 +1565,7 @@ typedef struct saberInfo_s { int gloatAnim; // -1 - anim to use when hit "gloat" //***NOTE: you can only have a maximum of 2 "styles" of blades, so this next value, "bladeStyle2Start" is the number of the first blade to use these value - //on... all blades before this use the normal values above, all blades at and after this number use the secondary values below*** + // on... all blades before this use the normal values above, all blades at and after this number use the secondary values below*** int bladeStyle2Start; // 0 - if set, blades from this number and higher use the following values (otherwise, they use the normal values already set) //***The following can be different for the extra blades - not setting them individually defaults them to the value for the whole saber (and first blade)*** @@ -1590,110 +1595,6 @@ typedef struct saberInfo_s { } saberInfo_t; #define MAX_SABERS 2 -bgEntity_t *PM_BGEntForNum(int num); -qboolean BG_KnockDownable(playerState_t *ps); -qboolean BG_LegalizedForcePowers(char *powerOut, size_t powerOutSize, int maxRank, qboolean freeSaber, int teamForce, int gametype, int fpDisabled); - -void BG_GiveMeVectorFromMatrix(mdxaBone_t *boltMatrix, uint32_t flags, vector3 *vec); - -void BG_IK_MoveArm(void *ghoul2, int lHandBolt, int time, entityState_t *ent, int basePose, vector3 *desiredPos, qboolean *ikInProgress, vector3 *origin, - vector3 *angles, vector3 *scale, int blendTime, qboolean forceHalt); - -void BG_G2PlayerAngles(void *ghoul2, int motionBolt, entityState_t *cent, int time, vector3 *cent_lerpOrigin, vector3 *cent_lerpAngles, vector3 legs[3], - vector3 *legsAngles, qboolean *tYawing, qboolean *tPitching, qboolean *lYawing, float *tYawAngle, float *tPitchAngle, float *lYawAngle, - int frametime, vector3 *turAngles, vector3 *modelScale, int ciLegs, int ciTorso, int *corrTime, vector3 *lookAngles, - vector3 *lastHeadAngles, int lookTime, entityState_t *emplaced, int *crazySmoothFactor); -void BG_G2ATSTAngles(void *ghoul2, int time, vector3 *cent_lerpAngles); - -// BG anim utility functions: - -int BG_AnimLength(int index, animNumber_t anim); - -qboolean BG_InSpecialJump(int anim); -qboolean BG_InSaberStandAnim(int anim); -qboolean BG_InReboundJump(int anim); -qboolean BG_InReboundHold(int anim); -qboolean BG_InReboundRelease(int anim); -qboolean BG_InBackFlip(int anim); -qboolean BG_DirectFlippingAnim(int anim); -qboolean BG_SaberInAttack(int move); -qboolean BG_SaberInSpecial(int move); -qboolean BG_KickMove(int move); -qboolean BG_SaberInIdle(int move); -qboolean BG_FlippingAnim(int anim); -qboolean BG_SpinningSaberAnim(int anim); -qboolean BG_SaberInTransitionAny(int move); -qboolean BG_SaberInSpecialAttack(int anim); -qboolean BG_SaberInKata(int saberMove); -qboolean BG_InKataAnim(int anim); -qboolean BG_KickingAnim(int anim); -int BG_InGrappleMove(int anim); -int BG_BrokenParryForAttack(int move); -int BG_BrokenParryForParry(int move); -int BG_KnockawayForParry(int move); -qboolean BG_InKnockDown(int anim); -qboolean BG_InRoll(playerState_t *ps, int anim); -qboolean BG_InDeathAnim(int anim); -qboolean BG_InSaberLockOld(int anim); -qboolean BG_InSaberLock(int anim); - -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); - -void BG_EvaluateTrajectory(const trajectory_t *tr, int atTime, vector3 *result); -void BG_EvaluateTrajectoryDelta(const trajectory_t *tr, int atTime, vector3 *result); - -void BG_AddPredictableEventToPlayerstate(int newEvent, int eventParm, playerState_t *ps); - -void BG_TouchJumpPad(playerState_t *ps, entityState_t *jumppad); - -void BG_PlayerStateToEntityState(playerState_t *ps, entityState_t *s, qboolean snap); -void BG_PlayerStateToEntityStateExtraPolate(playerState_t *ps, entityState_t *s, int time, qboolean snap); - -qboolean BG_PlayerTouchesItem(playerState_t *ps, entityState_t *item, int atTime); - -void BG_InitAnimsets(void); -void BG_ClearAnimsets(void); -int BG_ParseAnimationFile(const char *filename, animation_t *animSet, qboolean isHumanoid); -#ifndef PROJECT_GAME -int BG_ParseAnimationEvtFile(const char *as_filename, int animFileIndex, int eventFileIndex); -#endif - -qboolean BG_HasAnimation(int animIndex, int animation); -int BG_PickAnim(int animIndex, int minAnim, int maxAnim); - -int BG_GetItemIndexByTag(int tag, itemType_t type); - -qboolean BG_IsItemSelectable(playerState_t *ps, int item); - -qboolean BG_HasYsalamiri(int gametype, playerState_t *ps); -qboolean BG_CanUseFPNow(int gametype, playerState_t *ps, int time, forcePowers_t power); - -void *BG_Alloc(int size); -void *BG_AllocUnaligned(int size); -void *BG_TempAlloc(int size); -void BG_TempFree(int size); -char *BG_StringAlloc(const char *source); -qboolean BG_OutOfMemory(void); - -void BG_BLADE_ActivateTrail(bladeInfo_t *blade, float duration); -void BG_BLADE_DeactivateTrail(bladeInfo_t *blade, float duration); -void BG_SI_Activate(saberInfo_t *saber); -void BG_SI_Deactivate(saberInfo_t *saber); -void BG_SI_BladeActivate(saberInfo_t *saber, int iBlade, qboolean bActive); -qboolean BG_SI_Active(saberInfo_t *saber); -void BG_SI_SetLength(saberInfo_t *saber, float length); -void BG_SI_SetDesiredLength(saberInfo_t *saber, float len, int bladeNum); -void BG_SI_SetLengthGradual(saberInfo_t *saber, int time); -float BG_SI_Length(saberInfo_t *saber); -float BG_SI_LengthMax(saberInfo_t *saber); -void BG_SI_ActivateTrail(saberInfo_t *saber, float duration); -void BG_SI_DeactivateTrail(saberInfo_t *saber, float duration); -void BG_AttachToRancor(void *ghoul2, float rancYaw, vector3 *rancOrigin, int time, qhandle_t *modelList, vector3 *modelScale, qboolean inMouth, - vector3 *out_origin, vector3 *out_angles, vector3 out_axis[3]); -void BG_ClearRocketLock(playerState_t *ps); - extern const int WeaponReadyAnim[WP_NUM_WEAPONS]; extern const int WeaponReadyLegsAnim[WP_NUM_WEAPONS]; extern const int WeaponAttackAnim[WP_NUM_WEAPONS]; @@ -1715,17 +1616,106 @@ extern bgEntity_t *pm_entVeh; #define HYPERSPACE_SPEED 10000.0f // was 30000 #define HYPERSPACE_TURN_RATE 45.0f -qboolean BG_InLedgeMove(int anim); -qboolean In_LedgeIdle(int anim); - -float BG_GetTorsoAnimPoint(playerState_t *ps, int AnimIndex); -float BG_GetLegsAnimPoint(playerState_t *ps, int AnimIndex); - extern const char *gametypeStringShort[GT_MAX_GAME_TYPE]; -const char *BG_GetGametypeString(int gametype); + +void *BG_Alloc(int size); +void *BG_AllocUnaligned(int size); +void BG_AddPredictableEventToPlayerstate(int newEvent, int eventParm, playerState_t *ps); +int BG_AnimLength(int index, animNumber_t anim); +void BG_AttachToRancor(void *ghoul2, float rancYaw, vector3 *rancOrigin, int time, qhandle_t *modelList, vector3 *modelScale, qboolean inMouth, + vector3 *out_origin, vector3 *out_angles, vector3 out_axis[3]); +void BG_BLADE_ActivateTrail(bladeInfo_t *blade, float duration); +void BG_BLADE_DeactivateTrail(bladeInfo_t *blade, float duration); +int BG_BrokenParryForAttack(int move); +int BG_BrokenParryForParry(int move); +qboolean BG_CanItemBeGrabbed(int gametype, const entityState_t *ent, const playerState_t *ps); +qboolean BG_CanUseFPNow(int gametype, playerState_t *ps, int time, forcePowers_t power); +void BG_ClearAnimsets(void); +void BG_ClearRocketLock(playerState_t *ps); +qboolean BG_DirectFlippingAnim(int anim); +void BG_EvaluateTrajectory(const trajectory_t *tr, int atTime, vector3 *result); +void BG_EvaluateTrajectoryDelta(const trajectory_t *tr, int atTime, vector3 *result); +const gitem_t *BG_FindItem(const char *classname); +const gitem_t *BG_FindItemForAmmo(ammo_t ammo); +const gitem_t *BG_FindItemForHoldable(holdable_t hi); +const gitem_t *BG_FindItemForPowerup(powerup_t pw); +const gitem_t *BG_FindItemForWeapon(weapon_t wp); +void BG_FixSaberMoveData(void); +qboolean BG_FlippingAnim(int anim); +void BG_ForcePowerDrain(playerState_t *ps, forcePowers_t forcePower, int overrideAmt); +void BG_G2ATSTAngles(void *ghoul2, int time, vector3 *cent_lerpAngles); +void BG_G2PlayerAngles(void *ghoul2, int motionBolt, entityState_t *cent, int time, vector3 *cent_lerpOrigin, vector3 *cent_lerpAngles, vector3 legs[3], + vector3 *legsAngles, qboolean *tYawing, qboolean *tPitching, qboolean *lYawing, float *tYawAngle, float *tPitchAngle, float *lYawAngle, + int frametime, vector3 *turAngles, vector3 *modelScale, int ciLegs, int ciTorso, int *corrTime, vector3 *lookAngles, + vector3 *lastHeadAngles, int lookTime, entityState_t *emplaced, int *crazySmoothFactor); int BG_GetGametypeForString(const char *gametype); +const char *BG_GetGametypeString(int gametype); +int BG_GetItemIndexByTag(int tag, itemType_t type); +float BG_GetLegsAnimPoint(playerState_t *ps, int AnimIndex); uint32_t BG_GetMapTypeBits(const char *type); team_t BG_GetOpposingTeam(team_t team); +float BG_GetTorsoAnimPoint(playerState_t *ps, int AnimIndex); +void BG_GiveMeVectorFromMatrix(mdxaBone_t *boltMatrix, uint32_t flags, vector3 *vec); +qboolean BG_HasAnimation(int animIndex, int animation); +qboolean BG_HasYsalamiri(int gametype, playerState_t *ps); +void BG_IK_MoveArm(void *ghoul2, int lHandBolt, int time, entityState_t *ent, int basePose, vector3 *desiredPos, qboolean *ikInProgress, vector3 *origin, + vector3 *angles, vector3 *scale, int blendTime, qboolean forceHalt); +qboolean BG_InBackFlip(int anim); +qboolean BG_InDeathAnim(int anim); +int BG_InGrappleMove(int anim); +void BG_InitAnimsets(void); +qboolean BG_InKataAnim(int anim); +qboolean BG_InKnockDown(int anim); +qboolean BG_InLedgeMove(int anim); +qboolean BG_InReboundHold(int anim); +qboolean BG_InReboundJump(int anim); +qboolean BG_InReboundRelease(int anim); +qboolean BG_InRoll(playerState_t *ps, int anim); +qboolean BG_InSaberLock(int anim); +qboolean BG_InSaberLockOld(int anim); +qboolean BG_InSaberStandAnim(int anim); +qboolean BG_InSpecialJump(int anim); +qboolean BG_IsItemSelectable(playerState_t *ps, int item); +qboolean BG_KickingAnim(int anim); +qboolean BG_KickMove(int move); +int BG_KnockawayForParry(int move); +qboolean BG_KnockDownable(playerState_t *ps); +qboolean BG_LegalizedForcePowers(char *powerOut, size_t powerOutSize, int maxRank, qboolean freeSaber, int teamForce, int gametype, int fpDisabled); +saberInfo_t *BG_MySaber(int clientNum, int saberNum); +qboolean BG_OutOfMemory(void); +int BG_ParseAnimationFile(const char *filename, animation_t *animSet, qboolean isHumanoid); +void BG_PlayerStateToEntityState(playerState_t *ps, entityState_t *s, qboolean snap); +void BG_PlayerStateToEntityStateExtraPolate(playerState_t *ps, entityState_t *s, int time, qboolean snap); +qboolean BG_PlayerTouchesItem(playerState_t *ps, entityState_t *item, int atTime); +int BG_PickAnim(int animIndex, int minAnim, int maxAnim); +qboolean BG_SaberInAttack(int move); +qboolean BG_SaberInIdle(int move); +qboolean BG_SaberInKata(int saberMove); +qboolean BG_SaberInSpecial(int move); +qboolean BG_SaberInSpecialAttack(int anim); +qboolean BG_SaberInTransitionAny(int move); +void BG_SaberStartTransAnim(int clientNum, int saberAnimLevel, int weapon, int anim, float *animSpeed, int broken); +qboolean BG_SabersOff(playerState_t *ps); +void BG_SI_Activate(saberInfo_t *saber); +void BG_SI_ActivateTrail(saberInfo_t *saber, float duration); +qboolean BG_SI_Active(saberInfo_t *saber); +void BG_SI_BladeActivate(saberInfo_t *saber, int iBlade, qboolean bActive); +void BG_SI_Deactivate(saberInfo_t *saber); +void BG_SI_DeactivateTrail(saberInfo_t *saber, float duration); +float BG_SI_Length(saberInfo_t *saber); +float BG_SI_LengthMax(saberInfo_t *saber); +void BG_SI_SetDesiredLength(saberInfo_t *saber, float len, int bladeNum); +void BG_SI_SetLength(saberInfo_t *saber, float length); +void BG_SI_SetLengthGradual(saberInfo_t *saber, int time); +qboolean BG_SpinningSaberAnim(int anim); +char *BG_StringAlloc(const char *source); +void *BG_TempAlloc(int size); +void BG_TempFree(int size); +void BG_TouchJumpPad(playerState_t *ps, entityState_t *jumppad); +qboolean In_LedgeIdle(int anim); +bgEntity_t *PM_BGEntForNum(int num); +void PM_UpdateViewAngles(playerState_t *ps, const usercmd_t *cmd); +void Pmove(pmove_t *pmove); // returns false if any usable projectile/ammo-consuming weapons are enabled // this ignores melee, saber, stun baton etc @@ -1736,3 +1726,7 @@ bool BG_HasSetSaberOnly( const char *info #endif ); + +#ifndef PROJECT_GAME +int BG_ParseAnimationEvtFile(const char *as_filename, int animFileIndex, int eventFileIndex); +#endif diff --git a/game/bg_saber.cpp b/game/bg_saber.cpp index f285df1..70c3058 100644 --- a/game/bg_saber.cpp +++ b/game/bg_saber.cpp @@ -5,13 +5,12 @@ #include "JAPP/jp_cinfo.h" #include "JAPP/jp_csflags.h" -#ifdef PROJECT_GAME -#include "g_local.h" +#if defined(PROJECT_GAME) +#include "g_local.h" // for cvars +#elif defined(PROJECT_CGAME) +#include "cgame/cg_local.h" // for configstrings #endif -qboolean BG_SabersOff(playerState_t *ps); -saberInfo_t *BG_MySaber(int clientNum, int saberNum); - int PM_irand_timesync(int val1, int val2) { int i; @@ -288,29 +287,27 @@ saberMoveData_t saberMoveData[LS_MOVE_MAX] = { {"Reflected BL", BOTH_V1_BL_S1, Q_BL, Q_BL, AFLAG_ACTIVE, 100, BLK_NO, LS_READY, LS_READY, 150}, // LS_V1_BL {"Reflected B", BOTH_V1_B__S1, Q_B, Q_B, AFLAG_ACTIVE, 100, BLK_NO, LS_READY, LS_READY, 150}, // LS_V1_B_ - // Raz: Animation fix begin // Broken parries {"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 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 // 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 - // Raz: Animation fix end + {"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, @@ -328,6 +325,33 @@ saberMoveData_t saberMoveData[LS_MOVE_MAX] = { {"NewAnimFlipSaberStab", BOTH_NEW_STABER, Q_T, Q_B, AFLAG_ACTIVE, 100, BLK_TIGHT, LS_READY, LS_READY, 200}, // LS_JAPLUS_NEWANIM_FLIPSABERSTAB }; +void BG_FixSaberMoveData(void) { +#if defined(PROJECT_GAME) + const qboolean doFix = !!g_fixSaberMoveData.integer; +#elif defined(PROJECT_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}, {LS_T1__R_BR, LS_NONE, LS_T1__R_TR, LS_T1__R_T_, LS_T1__R_TL, LS_T1__R__L, LS_T1__R_BL, LS_NONE}, @@ -892,17 +916,17 @@ int PM_SaberLockResultAnim(playerState_t *duelist, qboolean superBreak, qboolean #endif if (superBreak && !won) { // if you lose a superbreak, you're defenseless - /* - //Taken care of in SetSaberBoxSize() - //make saberent not block - gentity_t *saberent = &g_entities[duelist->client->ps.saberEntityNum]; - if ( saberent ) - { - VectorClear(saberent->mins); - VectorClear(saberent->maxs); - G_SetOrigin(saberent, duelist->currentOrigin); - } - */ + /* + //Taken care of in SetSaberBoxSize() + //make saberent not block + gentity_t *saberent = &g_entities[duelist->client->ps.saberEntityNum]; + if ( saberent ) + { + VectorClear(saberent->mins); + VectorClear(saberent->maxs); + G_SetOrigin(saberent, duelist->currentOrigin); + } + */ #ifdef PROJECT_GAME if (1) #else @@ -2407,7 +2431,7 @@ void PM_WeaponLightsaber(void) { // if (pm->ps->saberBlocked && pm->ps->torsoAnim != saberMoveData[pm->ps->saberMove].animToUse) // { //rww - keep him in the blocking pose until he can attack again // PM_SetAnim(SETANIM_TORSO,saberMoveData[pm->ps->saberMove].animToUse,saberMoveData[pm->ps->saberMove].animSetFlags|SETANIM_FLAG_HOLD, - //saberMoveData[pm->ps->saberMove].blendTime); return; + // saberMoveData[pm->ps->saberMove].blendTime); return; // } } else { pm->ps->weaponstate = WEAPON_READY; diff --git a/game/g_ICARUScb.cpp b/game/g_ICARUScb.cpp index ef1d42d..b3e8ea8 100644 --- a/game/g_ICARUScb.cpp +++ b/game/g_ICARUScb.cpp @@ -8,7 +8,6 @@ #include "g_nav.h" #include "bg_lua.h" -qboolean BG_SabersOff(playerState_t *ps); extern stringID_table_t WPTable[]; extern stringID_table_t BSTable[]; diff --git a/game/g_active.cpp b/game/g_active.cpp index 26f3ff5..ceccd60 100644 --- a/game/g_active.cpp +++ b/game/g_active.cpp @@ -688,7 +688,6 @@ void G_VehicleAttachDroidUnit(gentity_t *vehEnt) { } // called gameside only from pmove code (convenience) -qboolean BG_SabersOff(playerState_t *ps); void G_CheapWeaponFire(int entNum, int ev) { gentity_t *ent = &g_entities[entNum]; diff --git a/game/g_main.cpp b/game/g_main.cpp index a1c5d36..04e403c 100644 --- a/game/g_main.cpp +++ b/game/g_main.cpp @@ -1,3 +1,4 @@ +#include #include #include "g_local.h" @@ -169,6 +170,19 @@ static void CVU_CInfo(void) { CPM_UpdateSettings(!!(jp_cinfo.bits & CINFO_CPMPHY static void CVU_Motd(void) { Q_ConvertLinefeeds(g_motd.string); } +static void CVU_FixSaberMoveData(void) { + 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)); +} + typedef struct cvarTable_s { vmCvar_t *vmCvar; const char *cvarName, *defaultString; @@ -421,18 +435,14 @@ static void G_SpawnHoleFixes(void) { } void G_InitGame(int levelTime, int randomSeed, int restart) { - int i; - vmCvar_t mapname; - vmCvar_t ckSum; - char cs[MAX_INFO_STRING] = {0}; vmCvar_t japp_crashHandler; - trap->Cvar_Register(&japp_crashHandler, "japp_crashHandler", "1", CVAR_ARCHIVE); - if (japp_crashHandler.integer) { ActivateCrashHandler(); } + srand(randomSeed); + // Clean up any client-server ghoul2 instance attachments that may still exist exe-side trap->G2API_CleanEntAttachments(); @@ -445,7 +455,9 @@ void G_InitGame(int levelTime, int randomSeed, int restart) { // Load external vehicle data BG_VehicleLoadParms(); - srand(randomSeed); + // 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(); @@ -474,6 +486,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart) { else trap->Print("Not logging admin events to disk.\n"); + char cs[MAX_INFO_STRING] = {0}; trap->GetServerinfo(cs, sizeof(cs)); G_LogPrintf(level.log.console, "------------------------------------------------------------\n"); G_LogPrintf(level.log.console, "InitGame: %s\n", cs); @@ -506,7 +519,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart) { level.clients = g_clients; // set client fields on player ents - for (i = 0; i < level.maxclients; i++) { + for (int i = 0; i < level.maxclients; i++) { g_entities[i].client = level.clients + i; } @@ -538,6 +551,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart) { // make sure saber data is loaded before this! (so we can precache the appropriate hilts) InitSiegeMode(); + vmCvar_t mapname, ckSum; trap->Cvar_Register(&mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM); trap->Cvar_Register(&ckSum, "sv_mapChecksum", "", CVAR_ROM); @@ -604,7 +618,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart) { navCalcPathTime = 0; } - for (i = 0; i < MAX_CUSTOM_SIEGE_SOUNDS; i++) { + for (int i = 0; i < MAX_CUSTOM_SIEGE_SOUNDS; i++) { if (!bg_customSiegeSoundNames[i]) { break; } @@ -614,8 +628,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart) { // Raz: JK2 gametypes if (level.gametype == GT_JEDIMASTER) { // make sure that there's a jedimaster saber spawn point. gentity_t *jmsaber = NULL; - int i = 0; - for (i = 0; i < level.num_entities; i++) { // scan for jmsaber + for (int i = 0; i < level.num_entities; i++) { // scan for jmsaber if (g_entities[i].isSaberEntity) { jmsaber = &g_entities[i]; break; diff --git a/game/g_xcvar.h b/game/g_xcvar.h index 590f566..153bfb6 100644 --- a/game/g_xcvar.h +++ b/game/g_xcvar.h @@ -1,14 +1,13 @@ -#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 +#pragma message("missing XCVAR expansion def") +#define XCVAR_DEF(...) #endif XCVAR_DEF(bg_fighterAltControl, "0", NULL, CVAR_SERVERINFO, qtrue) @@ -69,6 +68,8 @@ XCVAR_DEF(g_dismember, "0", NULL, CVAR_ARCHIVE, qtrue) XCVAR_DEF(g_doWarmup, "0", NULL, CVAR_NONE, qtrue) XCVAR_DEF(g_duelWeaponDisable, "1", NULL, CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_LATCH, qtrue) XCVAR_DEF(g_ff_objectives, "0", NULL, CVAR_CHEAT | CVAR_NORESTART, qtrue) +XCVAR_DEF(g_fixSaberDisarmBonus, "1", NULL, CVAR_ARCHIVE, qtrue) +XCVAR_DEF(g_fixSaberMoveData, "1", CVU_FixSaberMoveData, CVAR_ARCHIVE, qtrue) 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) diff --git a/game/w_saber.cpp b/game/w_saber.cpp index 2343aa1..b33eb88 100644 --- a/game/w_saber.cpp +++ b/game/w_saber.cpp @@ -17,7 +17,6 @@ qboolean PM_SaberInBounce(int move); qboolean BG_SaberInReturn(int move); qboolean BG_InKnockDownOnGround(playerState_t *ps); qboolean BG_StabDownAnim(int anim); -qboolean BG_SabersOff(playerState_t *ps); qboolean BG_SaberInAttackPure(int move); qboolean WP_SaberBladeUseSecondBladeStyle(saberInfo_t *saber, int bladeNum); qboolean WP_SaberBladeDoTransitionDamage(saberInfo_t *saber, int bladeNum); @@ -83,6 +82,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; @@ -3856,7 +3865,7 @@ static qboolean CheckSaberDamage(gentity_t *self, int rSaberNum, int rBladeNum, } else if ((selfSaberLevel > FORCE_LEVEL_2) && // if we're doing a special attack, we can send them into a broken parry too (MP only) //( otherOwner->client->ps.fd.forcePowerLevel[FP_SABER_DEFENSE] < selfSaberLevel || //(otherOwner->client->ps.fd.forcePowerLevel[FP_SABER_DEFENSE] == selfSaberLevel && (Q_irand(1, 10) >= - //otherSaberLevel*3 || unblockable)) ) && + // otherSaberLevel*3 || unblockable)) ) && otherSaberLevel >= FORCE_LEVEL_3 && PM_SaberInParry(otherOwner->client->ps.saberMove) && !PM_SaberInBrokenParry(otherOwner->client->ps.saberMove) && !PM_SaberInParry(self->client->ps.saberMove) && !PM_SaberInBrokenParry(self->client->ps.saberMove) && !PM_SaberInBounce(self->client->ps.saberMove) && @@ -5345,7 +5354,7 @@ 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] && !other->client->ps.saberHolstered) { + if (g_fixSaberDisarmBonus.integer && other->client->saber[1].model[0] && !other->client->ps.saberHolstered) { disarmChance += other->client->saber[1].disarmBonus; } } @@ -5416,7 +5425,7 @@ 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] && !other->client->ps.saberHolstered) { + if (g_fixSaberDisarmBonus.integer && other->client->saber[1].model[0] && !other->client->ps.saberHolstered) { disarmChance += other->client->saber[1].disarmBonus; } } diff --git a/package.lua b/package.lua index ec39246..db962f0 100755 --- a/package.lua +++ b/package.lua @@ -11,8 +11,6 @@ require 'lfs' -- lua filesystem - 7z or zip --]] -if lfs == nil then error('missing lua-filesystem (Lua ' .. _VERSION .. ') - try installing with luarocks') end - local function get_platform_details() if package.config:sub(1, 1) == '\\' then -- Windows @@ -37,13 +35,13 @@ local host_platform, arch = get_platform_details() local target_arch = os.getenv('TARGET_ARCH') -- this can override what arch we're packaging arch = target_arch and target_arch or arch -local nixy = true and package.config:find('/') or false local suffix = host_platform .. '_' .. arch local libExt = ({ Linux = '.so', -- Windows = '.dll', -- Darwin = '.dylib', })[host_platform] +local nixy = true and package.config:find('/') or false local extension = nixy and '.zip' or '.pk3' local redirect_stdout = nixy and '>/dev/null' or '>nul' local redirect_all = nixy and '>/dev/null 2>&1' or '>nul 2>&1' diff --git a/ui/ui_xcvar.h b/ui/ui_xcvar.h index 530a67c..481b71e 100644 --- a/ui/ui_xcvar.h +++ b/ui/ui_xcvar.h @@ -1,14 +1,13 @@ -#ifdef XCVAR_PROTO +#if defined(XCVAR_PROTO) #define XCVAR_DEF(name, defVal, update, flags) extern vmCvar_t name; -#endif - -#ifdef XCVAR_DECL +#elif defined(XCVAR_DECL) #define XCVAR_DEF(name, defVal, update, flags) vmCvar_t name; -#endif - -#ifdef XCVAR_LIST +#elif defined(XCVAR_LIST) #define XCVAR_DEF(name, defVal, update, flags) {&name, #name, defVal, update, flags}, +#else +#pragma message("missing XCVAR expansion def") +#define XCVAR_DEF(...) #endif XCVAR_DEF(capturelimit, "0", NULL, CVAR_ARCHIVE | CVAR_NORESTART | CVAR_SERVERINFO) // fixme init'd to 8 in game module