Skip to content

Commit

Permalink
[MP] Remove BASE_COMPAT define (#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
  • Loading branch information
Razish authored Feb 20, 2024
1 parent 142e0b7 commit 1e8a799
Show file tree
Hide file tree
Showing 16 changed files with 353 additions and 346 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ option(BuildMPGame "Whether to create projects for the MP server-side gamecode (
option(BuildMPCGame "Whether to create projects for the MP clientside gamecode (cgamex86.dll)" ON)
option(BuildMPUI "Whether to create projects for the MP UI code (uix86.dll)" ON)
option(BuildMPRend2 "Whether to create projects for the EXPERIMENTAL MP rend2 renderer (rd-rend2_x86.dll)" ON)

option(BuildSPEngine "Whether to create projects for the SP engine (openjk_sp.exe)" ON)
option(BuildSPGame "Whether to create projects for the SP gamecode (jagamex86.dll)" ON)
option(BuildSPRdVanilla "Whether to create projects for the SP default renderer (rdsp-vanilla_x86.dll)" ON)
Expand Down Expand Up @@ -193,11 +194,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 @@ -3341,7 +3341,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 @@ -3358,7 +3357,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 @@ -2631,6 +2631,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 @@ -4499,11 +4499,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 @@ -911,8 +911,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 @@ -1910,12 +1910,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
36 changes: 29 additions & 7 deletions codemp/game/bg_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,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,
#ifndef BASE_COMPAT
BOTH_ATTACK3,//WP_CONCUSSION,
#endif // BASE_COMPAT
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 @@ -2439,10 +2463,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 1e8a799

Please sign in to comment.