Created
April 9, 2018 16:33
-
-
Save barncastle/3b6172e34c12aa035f22822ee435ad96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char CGGameObject_C::IsValidOpenAction(CGGameObject_C *this, int action) | |
{ | |
const uint32_t GO_FLAG_LOCKED = 0x2; | |
CGGameObjectData gameObject = this->m_gameObj; | |
GOState state = this->m_gameObj->m_state; | |
if ( action == 4 ) | |
return ( state == GO_STATE_ACTIVE_ALTERNATIVE ? 1 : 0 ); | |
if ( state == GO_STATE_ACTIVE_ALTERNATIVE ) | |
return 0; | |
if ( action != 2 && state != GO_STATE_READY ) | |
return 0; | |
if ( action != 0 ) | |
{ | |
if ( action == 1 ) | |
{ | |
if ( ( gameObject->m_flags & GO_FLAG_LOCKED ) != 0 ) | |
return 0; | |
} | |
else if ( action == 2 && state != GO_STATE_ACTIVE ) | |
{ | |
return 0; | |
} | |
} | |
else if ( ( gameObject->m_flags & GO_FLAG_LOCKED ) != 0 ) | |
{ | |
return 0; | |
} | |
return 1; | |
} | |
// taken from Trinity | |
enum GOState | |
{ | |
GO_STATE_ACTIVE = 0, // used and not reset (closed door is open) | |
GO_STATE_READY = 1, // ready (closed door is closed) | |
GO_STATE_ACTIVE_ALTERNATIVE = 2, // used and not reset by a scripted event (deadmines cannon door is open) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment