260 changes: 96 additions & 164 deletions src/cgame/cg_players.cpp

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions src/cgame/cg_skeleton_modifier.h
@@ -0,0 +1,36 @@
/*
===========================================================================
Daemon GPL Source Code
Copyright (C) 2016 Unvanquished Developers
Daemon is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Daemon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
===========================================================================
*/
#ifndef CG_SKELETON_MODIFIER_H
#define CG_SKELETON_MODIFIER_H

// Forward declare due to circular dependency.
struct clientInfo_t;

class SkeletonModifier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this abstraction? Seems like a case of over engineering.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The motivation behind this abstraction is that there are several types of modifiers we apply to the skeleton. Some legit and some hacks. I'd like to turn all of these into modifiers so that we don't have ugly if statements littered around in our main code path. For instance, I want to make a modifier for when we combine the leg skeleton and the torso skeleton and some modifiers for our general hacks like how we prevent the taunt animation from clipping through the body and how we limit the pitch angle of the player to prevent the player arms from clipping through the model.

{
public:
virtual ~SkeletonModifier() {}
virtual bool ParseConfiguration( clientInfo_t*, const char*, const char**) { return false; }
virtual bool LoadData( clientInfo_t* ) { return true; }
virtual void Apply(const entityState_t*, refSkeleton_t*) {}
};
#endif // CG_SKELETON_MODIFIER_H