-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge MP branch into SP #378
base: develop
Are you sure you want to change the base?
Merge MP branch into SP #378
Conversation
0692992
to
d20762c
Compare
d20762c
to
be96c2b
Compare
f342980
to
8cae4f3
Compare
What was I thinking is merge Mapbase to MP Branch since it has more few features (due the engine differences) |
Mapbase is still going to be ported to the MP branch. This PR is just a way of getting to that point. By synchronizing files between the SP and MP branches, their code can be kept in sync. Changes made in one branch can be directly copied to the other. This would (ideally) make it easier to maintain both branches at once. |
Since opening this PR, I've decided to limit the scope of this merge. Most of the gated changes in engine interfaces are redundant because those files have no reason to change under Mapbase, and thus have no reason to be synchronized. This means changes to all files in the For now, only the following directories have had code ported from the MP branch and may be synchronized with their MP branch counterparts:
Mapbase-specific files which do not exist in vanilla MP (e.g. the In addition, I've gated a bunch of other changes in the game code to become MP-only. I used the following criteria to determine which changes to exclude:
During this process, I did a complete rereview of all of this PR's changes, and I kept track of notable changes which I've decided to retain. Here's a preliminary changelog separated by code project: Client
Server
Shared
Shaders
VBSP
A more complete and revised version of this will probably appear in whatever update includes these changes. |
d5e4807
to
44d5c94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a bunch of comments to help aid potential reviewers.
For reference, many changes are gated within preprocessors for TF2 and/or STAGING_ONLY
. These changes can be ignored. There are also many changes to multiplayer-exclusive files (e.g. hud_vote.cpp
) that I did not review as thoroughly or explore legacy support for due to their presumed lack of use in SP branch mods.
if( !pAnimatedTextureVarName ) | ||
return false; | ||
|
||
bool foundVar; | ||
m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false ); | ||
if( !foundVar ) | ||
return false; | ||
|
||
char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" ); | ||
if( !pAnimatedTextureFrameNumVarName ) | ||
return false; | ||
if( pAnimatedTextureVarName ) | ||
{ | ||
bool foundVar; | ||
|
||
m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false ); | ||
if( !foundVar ) | ||
return false; | ||
m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false ); | ||
if( foundVar ) | ||
{ | ||
char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" ); | ||
|
||
if( pAnimatedTextureFrameNumVarName ) | ||
{ | ||
m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false ); | ||
|
||
if( foundVar ) | ||
{ | ||
m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 ); | ||
m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 ); | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
|
||
m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 ); | ||
m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 ); | ||
return true; | ||
// Error - null out pointers. | ||
Cleanup(); | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff isn't very clear on this, but this basically consolidates all fail cases into one that calls Cleanup()
, which removes the pointers for material vars. This apparently happens if some vars are valid and obtained, but others are not, causing the proxy to retain material vars despite failing to initialize.
sp/src/game/client/bsp_utils.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file and its header do not appear to be used in the MP branch, and I suspect that it's used in TF2's workshop code. Perhaps it could be removed from SP and be excepted from any potential synchronization script/hook?
@@ -153,9 +153,13 @@ void C_AI_BaseNPC::OnDataChanged( DataUpdateType_t type ) | |||
} | |||
} | |||
|
|||
void C_AI_BaseNPC::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) | |||
bool C_AI_BaseNPC::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a comment regarding this function in c_baseanimating.h
.
void ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTime ); | ||
virtual void GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ); | ||
bool ForceSetupBonesAtTime( matrix3x4_t *pBonesOut, float flTime ); | ||
virtual bool GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matrix3x4_t *pDeltaBones1, matrix3x4_t *pCurrentBones, float boneDt ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mixed feelings about this because it changes the return value of a virtual function. If there are any SP mod classes which override this function, then they will have to adapt.
I decided to leave it as-is for the following reasons:
- Mods are unlikely to override
GetRagdollInitBoneArrays
. - Gating every instance of this change being utilized would be time-consuming.
I'm open to input on this.
//----------------------------------------------------------------------------- | ||
// Returns the health fraction | ||
//----------------------------------------------------------------------------- | ||
float C_BaseEntity::HealthFraction() const | ||
{ | ||
if (GetMaxHealth() == 0) | ||
return 1.0f; | ||
|
||
float flFraction = (float)GetHealth() / (float)GetMaxHealth(); | ||
flFraction = clamp( flFraction, 0.0f, 1.0f ); | ||
return flFraction; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved to baseentity_shared.cpp
.
@@ -194,7 +194,6 @@ class CGlobalEntityList : public CBaseEntityList | |||
|
|||
CBaseEntity *FindEntityNearestFacing( const Vector &origin, const Vector &facing, float threshold); | |||
CBaseEntity *FindEntityClassNearestFacing( const Vector &origin, const Vector &facing, float threshold, char *classname); | |||
CBaseEntity *FindEntityByNetname( CBaseEntity *pStartEntity, const char *szModelName ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function did not have a body and was not used by any other code.
sp/src/game/server/nav.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files prefixed with nav
are used for navmeshes, which are not used in default HL2 or Mapbase.
sp/src/game/server/sceneentity.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff in this file is a little hard to read, but the change to NPC interjections appears to only be a refactor and they function identically to before.
//----------------------------------------------------------------------------- | ||
// Purpose: | ||
//----------------------------------------------------------------------------- | ||
void CBaseCombatWeapon::PoseParameterOverride( bool bReset ) | ||
{ | ||
CBaseCombatCharacter *pOwner = GetOwner(); | ||
if ( !pOwner ) | ||
return; | ||
|
||
CStudioHdr *pStudioHdr = pOwner->GetModelPtr(); | ||
if ( !pStudioHdr ) | ||
return; | ||
|
||
int iCount = 0; | ||
poseparamtable_t *pPoseParamList = PoseParamList( iCount ); | ||
if ( pPoseParamList ) | ||
{ | ||
for ( int i=0; i<iCount; ++i ) | ||
{ | ||
int iPoseParam = pOwner->LookupPoseParameter( pStudioHdr, pPoseParamList[i].pszName ); | ||
|
||
if ( iPoseParam != -1 ) | ||
pOwner->SetPoseParameter( iPoseParam, bReset ? 0 : pPoseParamList[i].flValue ); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pose parameter overrides seem to be a new type of table weapons can define, similar to activity lists. I have not tested this feature, but I've decided to leave it in.
#ifdef SDK_MP | ||
virtual void ReloadScheme( bool flushLowLevel ); | ||
#else | ||
virtual void ReloadScheme( bool flushLowLevel = false ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flushLowLevel
is non-functional in SP, but the parameter is still implemented so that code which calls the function can be one-to-one between SP and MP.
1e527f1
to
69d7747
Compare
69d7747
to
3e2e4cd
Compare
This PR merges all SDK code changes in the Source 2013 MP branch into the Source 2013 SP branch. Ideally, this will put code in the
sp
andmp
folders into a position where they can be partially synchronized. Changes which cannot be ported due to engine interfaces, incompatible specifications, etc. are gated behind a newSDK_MP
preprocessor.Most of these changes are very small or are limited to areas that are not commonly used, although the number of changes alone could potentially have far-reaching consequences.
I started working on this for two reasons:
point_spotlight
keyvalue from the MP branch, although I don't think there's any other enhancements on a similar level which we haven't ported already.This PR is a draft for many reasons. I have been able to build and test this locally, but I have yet to thoroughly test the compatibility of this branch with other mods, or on Linux.
If you have any input or objections to this PR, whether that's with specific parts of this implementation or with the idea as a whole, then please feel free to comment or reach out to me directly.
Note that this pull request will be squashed when it is merged.
PR Checklist
develop
branch OR targets another branch with a specific goal in mind