Skip to content

Commit

Permalink
reconcile with SDK, add g_fixSaberDisarmBonus and g_fixSaberMoveData (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Razish authored Oct 19, 2023
1 parent 8a7c26a commit 7df0369
Show file tree
Hide file tree
Showing 19 changed files with 242 additions and 202 deletions.
7 changes: 6 additions & 1 deletion cgame/cg_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions cgame/cg_servercmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
13 changes: 6 additions & 7 deletions cgame/cg_xcvar.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 1 addition & 3 deletions game/NPC_AI_Grenadier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions game/NPC_AI_Jedi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion game/NPC_combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion game/SpeederNPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion game/bg_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 0 additions & 2 deletions game/bg_panimate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion game/bg_pmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 7df0369

Please sign in to comment.