Skip to content

Commit

Permalink
Revert "Update w3dmodeldraw.cpp"
Browse files Browse the repository at this point in the history
This reverts commit 43fddfc.
  • Loading branch information
6emmes committed Oct 18, 2024
1 parent 41099fe commit 8554931
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions src/platform/w3dengine/client/drawable/draw/w3dmodeldraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2059,18 +2059,9 @@ void W3DModelDraw::Set_Model_State(ModelConditionInfo const *new_state)
#endif

const ModelConditionInfo *next = nullptr;
<<<<<<< Updated upstream

if (m_curState != nullptr && new_state != nullptr) { //if both states exist
if (m_nextState == new_state) {
=======
// if both states exist
if (m_curState != nullptr && new_state != nullptr) {
// ^first condition is unnecessary
// if both states are equal
if (m_curState == new_state && m_nextState == nullptr || m_curState != nullptr && m_nextState == new_state) {
//^single m_curState == new_state is sufficient
>>>>>>> Stashed changes
#ifdef GAME_DEBUG_STRUCTS
if (Get_Drawable() != nullptr) {
if (Get_Drawable()->Get_Object() != nullptr) {
Expand All @@ -2084,10 +2075,9 @@ void W3DModelDraw::Set_Model_State(ModelConditionInfo const *new_state)
}
#endif

// return early becasue state is not changing
return;
}
// new state allows animation to finish

if (new_state != m_curState && new_state->m_allowToFinishKey != NAMEKEY_INVALID
&& new_state->m_allowToFinishKey == m_curState->m_transitionKey && m_renderObject != nullptr
&& !Is_Animation_Complete(m_renderObject)) {
Expand All @@ -2106,15 +2096,12 @@ void W3DModelDraw::Set_Model_State(ModelConditionInfo const *new_state)

m_nextState = new_state;
m_loopDuration = -1;
//return early to allow animation to finish
return;
}
//unnecessary condition

if (new_state != m_curState) {
//if both states are animations
if (m_curState->m_transitionKey != NAMEKEY_INVALID) {
if (new_state->m_transitionKey != NAMEKEY_INVALID) {
//^both ifs can be merged with &&
const ModelConditionInfo *state =
Find_Transition_For_Sig(Make_Transition(m_curState->m_transitionKey, new_state->m_transitionKey));

Expand Down Expand Up @@ -2148,10 +2135,9 @@ void W3DModelDraw::Set_Model_State(ModelConditionInfo const *new_state)

Stop_Client_Particle_Systems();
Hide_All_Muzzle_Flashes(new_state, m_renderObject);
//if model gains initial state || model changes || turret changes

if (m_curState == nullptr || new_state->m_modelName != m_curState->m_modelName
|| Turret_Names_Differ(new_state, m_curState)) {

if (m_curState == nullptr || new_state->m_modelName != m_curState->m_modelName
|| Turret_Names_Differ(new_state, m_curState)) {
Matrix3D tm;
Nuke_Current_Render(&tm);
Drawable *drawable = Get_Drawable();
Expand Down

0 comments on commit 8554931

Please sign in to comment.