Skip to content

Commit

Permalink
[MP] Remove BASE_COMPAT define (JACoders#1211)
Browse files Browse the repository at this point in the history
* move BASE_COMPAT flag behind cmake option BuildMPWithCompatMode, add g_fixWeaponAttackAnim making use of CS_LEGACY_FIXES

* remove BASE_COMPAT and BuildMPWithCompatMode, add g_fixRunWalkAnims

* actually remove BuildMPWithCompatMode

(cherry picked from commit 1e8a799)
  • Loading branch information
Razish authored and taysta committed Feb 26, 2024
1 parent 8992e6a commit 3a46c7a
Show file tree
Hide file tree
Showing 16 changed files with 180 additions and 197 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ if(WIN64)
endif()

if (APPLE)
set(SharedDefines "MACOS_X")
set(SharedDefines ${SharedDefines} "MACOS_X")
endif()

if (NOT WIN32 AND NOT APPLE)
set(SharedDefines "ARCH_STRING=\"${Architecture}\"")
set(SharedDefines ${SharedDefines} "ARCH_STRING=\"${Architecture}\"")
endif()

if(CMAKE_SYSTEM_NAME MATCHES "BSD")
Expand Down
2 changes: 0 additions & 2 deletions codemp/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -3852,7 +3852,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
//
// powerup events
//
#ifdef BASE_COMPAT
case EV_POWERUP_QUAD:
DEBUGNAME("EV_POWERUP_QUAD");
if ( es->number == cg.snap->ps.clientNum ) {
Expand All @@ -3869,7 +3868,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
}
//trap->S_StartSound (NULL, es->number, CHAN_ITEM, cgs.media.protectSound );
break;
#endif // BASE_COMPAT

case EV_FORCE_DRAINED:
DEBUGNAME("EV_FORCE_DRAINED");
Expand Down
1 change: 1 addition & 0 deletions codemp/cgame/cg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3228,6 +3228,7 @@ Ghoul2 Insert End
CG_ParseEntitiesFromString();

BG_FixSaberMoveData();
BG_FixWeaponAttackAnim();
}

//makes sure returned string is in localized format
Expand Down
8 changes: 3 additions & 5 deletions codemp/cgame/cg_players.c
Original file line number Diff line number Diff line change
Expand Up @@ -5261,11 +5261,9 @@ static void CG_PlayerPowerups( centity_t *cent, refEntity_t *torso ) {
return;
}

#ifdef BASE_COMPAT
// quad gives a dlight
if ( powerups & ( 1 << PW_QUAD ) )
trap->R_AddLightToScene( cent->lerpOrigin, 200 + (rand()&31), 0.2f, 0.2f, 1 );
#endif // BASE_COMPAT
// quad gives a dlight
if ( powerups & ( 1 << PW_QUAD ) )
trap->R_AddLightToScene( cent->lerpOrigin, 200 + (rand()&31), 0.2f, 0.2f, 1 );

if (cent->currentState.eType == ET_NPC)
assert(cent->npcClient);
Expand Down
3 changes: 2 additions & 1 deletion codemp/cgame/cg_servercmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,9 @@ static void CG_ConfigStringModified( void ) {
CG_ShaderStateChanged();
}
else if ( num == CS_LEGACY_FIXES ) {
// LEGACYFIX_SABERMOVEDATA may have changed
// LEGACYFIX_SABERMOVEDATA etc may have changed
BG_FixSaberMoveData();
BG_FixWeaponAttackAnim();
}
else if ( num >= CS_LIGHT_STYLES && num < CS_LIGHT_STYLES + (MAX_LIGHT_STYLES * 3))
{
Expand Down
10 changes: 4 additions & 6 deletions codemp/cgame/cg_weapons.c
Original file line number Diff line number Diff line change
Expand Up @@ -2399,12 +2399,10 @@ void CG_FireWeapon( centity_t *cent, qboolean altFire ) {
}
}

#ifdef BASE_COMPAT
// play quad sound if needed
if ( cent->currentState.powerups & ( 1 << PW_QUAD ) ) {
//trap->S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.media.quadSound );
}
#endif // BASE_COMPAT
// play quad sound if needed
if ( cent->currentState.powerups & ( 1 << PW_QUAD ) ) {
//trap->S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.media.quadSound );
}


// play a sound
Expand Down
8 changes: 2 additions & 6 deletions codemp/game/NPC_AI_GalakMech.c
Original file line number Diff line number Diff line change
Expand Up @@ -1181,9 +1181,7 @@ void NPC_BSGM_Attack( void )
//if ( NPC->client->ps.powerups[PW_GALAK_SHIELD] > 0 )
if (0)
{
#ifdef BASE_COMPAT
NPCS.NPC->client->ps.powerups[PW_BATTLESUIT] = level.time + ARMOR_EFFECT_TIME;
#endif
NPCS.NPC->client->ps.powerups[PW_BATTLESUIT] = level.time + ARMOR_EFFECT_TIME;
G_Damage( NPCS.NPC->enemy, NPCS.NPC, NPCS.NPC, NULL, NPCS.NPC->r.currentOrigin, 100, DAMAGE_NO_KNOCKBACK, MOD_UNKNOWN );
}
else
Expand All @@ -1208,9 +1206,7 @@ void NPC_BSGM_Attack( void )
//FIXME: debounce this?
NPCS.NPCInfo->touchedByPlayer = NULL;
//FIXME: some shield effect?
#ifdef BASE_COMPAT
NPCS.NPC->client->ps.powerups[PW_BATTLESUIT] = level.time + ARMOR_EFFECT_TIME;
#endif
NPCS.NPC->client->ps.powerups[PW_BATTLESUIT] = level.time + ARMOR_EFFECT_TIME;

VectorSubtract( NPCS.NPC->enemy->r.currentOrigin, NPCS.NPC->r.currentOrigin, smackDir );
smackDir[2] += 30;
Expand Down
40 changes: 32 additions & 8 deletions codemp/game/bg_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,40 @@ int WeaponAttackAnim[WP_NUM_WEAPONS] =
BOTH_THERMAL_THROW,//WP_THERMAL,
BOTH_ATTACK3,//BOTH_ATTACK11,//WP_TRIP_MINE,
BOTH_ATTACK3,//BOTH_ATTACK12,//WP_DET_PACK,
BOTH_ATTACK3,//WP_CONCUSSION,
BOTH_ATTACK3,//WP_CONCUSSION,
BOTH_ATTACK2,//WP_BRYAR_OLD,

//NOT VALID (e.g. should never really be used):
BOTH_STAND1,//WP_EMPLACED_GUN,
BOTH_ATTACK1//WP_TURRET,
};

void BG_FixWeaponAttackAnim(void) {
#if defined(_GAME)
const qboolean doFix = !!g_fixWeaponAttackAnim.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_WEAPONATTACKANIM));
#elif defined(UI_BUILD)
const qboolean doFix = qtrue; // no chance of prediction error from UI code
#endif
int *move;

for (move = WeaponAttackAnim; move - WeaponAttackAnim < ARRAY_LEN(WeaponAttackAnim); move++) {
const weapon_t wpIndex = (weapon_t)(move - WeaponAttackAnim);
if (wpIndex == WP_CONCUSSION) {
*move = doFix ? BOTH_ATTACK3 : BOTH_ATTACK2;
} else if (wpIndex == WP_BRYAR_OLD) {
*move = doFix ? BOTH_ATTACK2 : BOTH_STAND1;
} else if (wpIndex == WP_EMPLACED_GUN) {
*move = doFix ? BOTH_STAND1 : BOTH_ATTACK1;
} else if (wpIndex == WP_TURRET) {
*move = doFix ? BOTH_ATTACK1 : BOTH_ATTACK2; // better than UB?
}
}
}

qboolean BG_FileExists( const char *fileName ) {
if ( fileName && fileName[0] ) {
fileHandle_t f = NULL_FILE;
Expand Down Expand Up @@ -799,7 +825,7 @@ qboolean BG_LegalizedForcePowers(char *powerOut, size_t powerOutSize, int maxRan

//[JAPRO - Serverside - Saber - Allow server to cap block level - End]
#ifdef _GAME
if (g_maxSaberDefense.integer && (final_Powers[FP_SABER_DEFENSE] > g_maxSaberDefense.integer))//my block is middle[2], forced max is 2,
if (g_maxSaberDefense.integer && (final_Powers[FP_SABER_DEFENSE] > g_maxSaberDefense.integer))//my block is middle[2], forced max is 2,
final_Powers[FP_SABER_DEFENSE] = g_maxSaberDefense.integer;
#endif
//[JAPRO - Serverside - Saber - Allow server to cap block level - End]
Expand Down Expand Up @@ -2021,7 +2047,7 @@ gitem_t *BG_FindItemForWeapon( weapon_t weapon ) {

#ifdef _GAME
//Debug this crash
Com_Printf("BG_FindItemForWeapon crash\n");
Com_Printf("BG_FindItemForWeapon crash\n");
Svcmd_GameMem_f();
if (it->classname)
Com_Printf("Last classname %s type %i, tag %i, end: %i\n", it->classname, it->giType, it->giTag, it);
Expand Down Expand Up @@ -2412,7 +2438,7 @@ qboolean BG_CanItemBeGrabbed( int gametype, const entityState_t *ent, const play
(item->giTag == PW_NEUTRALFLAG && ent->modelindex2) ||
(item->giTag == PW_NEUTRALFLAG && ps->powerups[PW_NEUTRALFLAG]))
return qtrue;
}
}
}
else if (gametype == GT_FFA || gametype == GT_TEAM)
{
Expand Down Expand Up @@ -2694,10 +2720,8 @@ const char *eventnames[EV_NUM_ENTITY_EVENTS] = {
"EV_DEATH3",
"EV_OBITUARY",

#ifdef BASE_COMPAT
"EV_POWERUP_QUAD",
"EV_POWERUP_BATTLESUIT",
#endif // BASE_COMPAT
"EV_POWERUP_QUAD",
"EV_POWERUP_BATTLESUIT",
//"EV_POWERUP_REGEN",

"EV_FORCE_DRAINED",
Expand Down
Loading

0 comments on commit 3a46c7a

Please sign in to comment.