diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index 58456f78ca..a9a35dabc2 100644 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -256,7 +256,7 @@ JSBool issueCommand( JSContext* cx, JSObject*, uint argc, jsval* argv, jsval* rv //Destroy old notifiers if we're explicitly being reassigned for ( size_t i=0; i < entities.size(); i++) { - if ( entities[i]->m_destroyNotifiers ) + if ( entities[i]->entf_get(ENTF_DESTROY_NOTIFIERS)) entities[i]->DestroyAllNotifiers(); } std::vector messages; diff --git a/source/simulation/Entity.cpp b/source/simulation/Entity.cpp index 99dd86e77b..4847106e10 100644 --- a/source/simulation/Entity.cpp +++ b/source/simulation/Entity.cpp @@ -38,6 +38,8 @@ std::map CEntity::m_AttributeTable; CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, const std::set& actorSelections, CStrW building ) { + ent_flags = 0; + if(m_AttributeTable.size() == 0) // not nice { initAttributes(this); @@ -124,7 +126,7 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, cons m_bounds = NULL; m_lastState = -1; - m_transition = true; + entf_set(ENTF_TRANSITION); m_fsm_cyclepos = NOT_IN_CYCLE; m_base = base; @@ -140,24 +142,24 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, cons m_graphics_position = m_position; m_graphics_orientation = m_orientation; - m_actor_transform_valid = false; - m_hasRallyPoint = false; + m_actor_transform_valid = false; + entf_clear(ENTF_HAS_RALLY_POINT); - m_destroyed = false; + entf_clear(ENTF_DESTROYED); m_selected = false; - m_isRunning = false; - m_shouldRun = false; - m_triggerRun = false; + entf_clear(ENTF_IS_RUNNING); + entf_clear(ENTF_SHOULD_RUN); + entf_clear(ENTF_TRIGGER_RUN); - m_healthDecay = false; + entf_clear(ENTF_HEALTH_DECAY); m_frameCheck = 0; m_lastCombatTime = 0; m_lastRunTime = 0; m_currentNotification = 0; m_currentRequest = 0; - m_destroyNotifiers = true; + entf_set(ENTF_DESTROY_NOTIFIERS); m_formationSlot = -1; m_formation = -1; @@ -193,7 +195,7 @@ CEntity::~CEntity() } m_auras.clear(); - m_destroyNotifiers=true; + entf_set(ENTF_DESTROY_NOTIFIERS); for ( size_t i=0; iDestroyNotifier( this ); DestroyAllNotifiers(); @@ -319,7 +321,7 @@ void CEntity::kill() CEntity* remove = this; g_FormationManager.RemoveUnit(remove); - m_destroyNotifiers=true; + entf_set(ENTF_DESTROY_NOTIFIERS); for ( size_t i=0; iDestroyNotifier( this ); DestroyAllNotifiers(); @@ -330,7 +332,7 @@ void CEntity::kill() m_extant = false; - m_destroyed = true; + entf_set(ENTF_DESTROYED); //Shutdown(); // PT: tentatively removed - this seems to be called by ~CJSComplex, and we don't want to do it twice if( m_actor ) @@ -464,13 +466,13 @@ void CEntity::update( size_t timestep ) CalculateRun( timestep ); CalculateHealth( timestep ); - if ( m_triggerRun ) + if ( entf_get(ENTF_TRIGGER_RUN) ) m_frameCheck++; if ( m_frameCheck != 0 ) { - m_shouldRun = true; - m_triggerRun = false; + entf_set(ENTF_SHOULD_RUN); + entf_clear(ENTF_TRIGGER_RUN); m_frameCheck = 0; } @@ -494,7 +496,7 @@ void CEntity::update( size_t timestep ) PROFILE_START( "state processing" ); - if( m_isRunning ) + if( entf_get(ENTF_IS_RUNNING) ) { m_lastRunTime = g_Game->GetTime(); } @@ -505,7 +507,7 @@ void CEntity::update( size_t timestep ) if( current->m_type != m_lastState ) { - m_transition = true; + entf_set(ENTF_TRANSITION); m_fsm_cyclepos = NOT_IN_CYCLE; PROFILE( "state transition / order" ); @@ -533,7 +535,7 @@ void CEntity::update( size_t timestep ) } else { - m_transition = false; + entf_clear(ENTF_TRANSITION); } switch( current->m_type ) @@ -598,8 +600,8 @@ void CEntity::update( size_t timestep ) if( m_orderQueue.empty() ) { // If we have no orders, stop running - m_isRunning = false; - m_shouldRun = false; + entf_clear(ENTF_IS_RUNNING); + entf_clear(ENTF_SHOULD_RUN); } PROFILE_END( "state processing" ); @@ -872,7 +874,7 @@ int CEntity::DestroyNotifier( CEntity* target ) } void CEntity::DestroyAllNotifiers() { - debug_assert(m_destroyNotifiers); + debug_assert(entf_get(ENTF_DESTROY_NOTIFIERS)); //Make them stop listening to us while ( ! m_notifiers.empty() ) DestroyNotifier( m_notifiers[0] ); @@ -1417,7 +1419,7 @@ void CEntity::renderRallyPoint() if( !m_visible ) return; - if ( !m_hasRallyPoint || g_Selection.m_unitUITextures.find(m_rallyTexture) == + if ( !entf_get(ENTF_HAS_RALLY_POINT) || g_Selection.m_unitUITextures.find(m_rallyTexture) == g_Selection.m_unitUITextures.end() ) { return; @@ -1445,7 +1447,7 @@ void CEntity::CalculateRun(float timestep) { if( m_staminaMax > 0 ) { - if ( m_isRunning && m_runDecayRate > 0 ) + if ( entf_get(ENTF_IS_RUNNING) && m_runDecayRate > 0 ) { m_staminaCurr = max( 0.0f, m_staminaCurr - timestep / 1000.0f / m_runDecayRate * m_staminaMax ); } @@ -1458,7 +1460,7 @@ void CEntity::CalculateRun(float timestep) void CEntity::CalculateHealth(float timestep) { - if ( m_healthDecay && m_healthDecayRate > 0 ) + if ( entf_get(ENTF_HEALTH_DECAY) && m_healthDecayRate > 0 ) { m_healthCurr = max( 0.0f, m_healthCurr - timestep / 1000.0f / m_healthDecayRate * m_healthMax ); } @@ -1656,11 +1658,11 @@ bool CEntity::Order( JSContext* cx, uintN argc, jsval* argv, bool Queued ) return( false ); } if ( orderCode == CEntityOrder::ORDER_RUN ) - m_triggerRun = true; + entf_set(ENTF_TRIGGER_RUN); //It's not a notification order if ( argc == 3 ) { - if ( m_destroyNotifiers ) + if ( entf_get(ENTF_DESTROY_NOTIFIERS) ) { m_currentRequest=0; DestroyAllNotifiers(); @@ -1692,7 +1694,7 @@ bool CEntity::Order( JSContext* cx, uintN argc, jsval* argv, bool Queued ) //It's not a notification order if ( argc == 3 ) { - if ( m_destroyNotifiers ) + if ( entf_get(ENTF_DESTROY_NOTIFIERS) ) { m_currentRequest=0; DestroyAllNotifiers(); @@ -1974,7 +1976,7 @@ bool CEntity::RequestNotification( JSContext* cx, uintN argc, jsval* argv ) CEntity *target = ToNative( argv[0] ); (int&)notify.m_type = ToPrimitive( argv[1] ); bool tmpDestroyNotifiers = ToPrimitive( argv[2] ); - m_destroyNotifiers = !ToPrimitive( argv[3] ); + entf_set_to(ENTF_DESTROY_NOTIFIERS, !ToPrimitive( argv[3] )); if (target == this) return false; @@ -1985,7 +1987,7 @@ bool CEntity::RequestNotification( JSContext* cx, uintN argc, jsval* argv ) if ( tmpDestroyNotifiers ) DestroyAllNotifiers(); //If new request is not the same and we're destroy notifiers, reset - else if ( !(notify.m_type & m_currentRequest) && m_destroyNotifiers ) + else if ( !(notify.m_type & m_currentRequest) && entf_get(ENTF_DESTROY_NOTIFIERS)) DestroyAllNotifiers(); m_currentRequest = notify.m_type; @@ -2113,7 +2115,7 @@ jsval CEntity::DestroyNotifier( JSContext* cx, uintN argc, jsval* argv ) jsval CEntity::TriggerRun( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(argv) ) { - m_triggerRun = true; + entf_set(ENTF_TRIGGER_RUN); return JSVAL_VOID; } @@ -2124,13 +2126,14 @@ jsval CEntity::SetRun( JSContext* cx, uintN argc, jsval* argv ) JS_ReportError( cx, "Too few parameters" ); return( false ); } - m_shouldRun = ToPrimitive ( argv[0] ); - m_isRunning = m_shouldRun; + bool should_run = ToPrimitive ( argv[0] ); + entf_set_to(ENTF_SHOULD_RUN, should_run); + entf_set_to(ENTF_IS_RUNNING, should_run); return JSVAL_VOID; } jsval CEntity::GetRunState( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(argv) ) { - return BOOLEAN_TO_JSVAL( m_shouldRun ); + return BOOLEAN_TO_JSVAL( entf_get(ENTF_SHOULD_RUN) ); } jsval CEntity::GetFormationPenalty( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(argv) ) { @@ -2229,7 +2232,7 @@ jsval CEntity::FindSector( JSContext* cx, uintN argc, jsval* argv ) } jsval CEntity::HasRallyPoint( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(argv) ) { - return ToJSVal( m_hasRallyPoint ); + return ToJSVal( entf_get(ENTF_HAS_RALLY_POINT) ); } jsval CEntity::GetRallyPoint( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(argv) ) { @@ -2237,7 +2240,7 @@ jsval CEntity::GetRallyPoint( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* } jsval CEntity::SetRallyPoint( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(argv) ) { - m_hasRallyPoint = true; + entf_set(ENTF_HAS_RALLY_POINT); m_rallyPoint = g_Game->GetView()->GetCamera()->GetWorldCoordinates(); return JS_TRUE; } diff --git a/source/simulation/Entity.h b/source/simulation/Entity.h index 83441a9856..cd1a2f86a3 100644 --- a/source/simulation/Entity.h +++ b/source/simulation/Entity.h @@ -53,6 +53,32 @@ class CTerritory; class CEntityFormation; + +// +enum EntityFlags +{ + // If this unit has been removed from the gameworld but has still + // has references. + ENTF_DESTROYED = 0x0001, + + // State transition in the FSM (animations should be reset) + ENTF_TRANSITION = 0x0002, + + ENTF_HAS_RALLY_POINT = 0x0004, + + ENTF_HEALTH_DECAY = 0x0008, + + // if set, we destroy them; otherwise, the script does. + ENTF_DESTROY_NOTIFIERS = 0x0010, + + // is it actually running + ENTF_IS_RUNNING = 0x0020, + // if run was issued, it will remain true until it is stopped + ENTF_SHOULD_RUN = 0x0040, + // used in SetRun, corrects 1 frame stamina imbalance + ENTF_TRIGGER_RUN = 0x0080 +}; + // TODO MT: Put this is /some/ sort of order... class CEntity : public CJSComplex, public IEventTarget @@ -100,12 +126,19 @@ public: bool m_selected; i32 m_grouped; - int m_formation; //Indice of which formation we're in - int m_formationSlot; //The slot of the above formation + int m_formation; // Index of which formation we're in + int m_formationSlot; // The slot of the above formation - // If this unit has been removed from the gameworld but has still - // has references. - bool m_destroyed; + uint ent_flags; + bool entf_get(uint desired_flag) const { return (ent_flags & desired_flag) != 0; } + void entf_set(uint desired_flag) { ent_flags |= desired_flag; } + void entf_clear(uint desired_flag) { ent_flags &= ~desired_flag; } + void entf_set_to(uint desired_flag, bool value) + { + ent_flags &= ~desired_flag; + const uint mask = value? ~0u : 0; + ent_flags |= desired_flag & mask; + } // If this unit is still active in the gameworld - i.e. not a corpse. bool m_extant; @@ -113,9 +146,6 @@ public: // If this is false, the unit will not be drawn and cannot be interacted with using the mouse. bool m_visible; - bool m_isRunning; //is it actually running - bool m_shouldRun; //if run was issued, it will remain true until it is stopped - bool m_triggerRun; //used in SetRun, corrects 1 frame stamina imbalance int m_frameCheck; //counts the frame float m_lastCombatTime; @@ -139,9 +169,6 @@ public: float m_rallyWidth; float m_rallyHeight; - bool m_healthDecay; - - // LOS int m_los; bool m_permanent; @@ -172,8 +199,7 @@ public: CVector2D m_orientation_unclamped; - CVector3D m_rallyPoint; - bool m_hasRallyPoint; + CVector3D m_rallyPoint; // valid iff ENT_HAS_RALLY_POINT // If the actor's current transform data is valid (i.e. the entity hasn't // moved since it was last calculated, and the terrain hasn't been changed). @@ -192,9 +218,7 @@ public: CUnit* m_actor; std::set m_actorSelections; - // State transition in the FSM (animations should be reset) - bool m_transition; - int m_lastState; + int m_lastState; // used in animation FSM // Position in the current state's cycle static const size_t NOT_IN_CYCLE = (size_t)-1; @@ -209,7 +233,6 @@ public: std::vector m_notifiers; int m_currentNotification; //Current order in the form of a notification code int m_currentRequest; //Notification we our notifiers are sending - bool m_destroyNotifiers; //True: we destroy them. False: the script does. /* JW: these have all been 'moved' (1) into BaseEntity: 1: were already present there, just removed from here diff --git a/source/simulation/EntityHandles.cpp b/source/simulation/EntityHandles.cpp index 98c32c26d1..9b75028036 100644 --- a/source/simulation/EntityHandles.cpp +++ b/source/simulation/EntityHandles.cpp @@ -53,7 +53,7 @@ HEntity::operator bool() const return( false ); debug_assert( g_EntityManager.m_entities[m_handle].m_refcount ); - return( !g_EntityManager.m_entities[m_handle].m_entity->m_destroyed ); + return( !g_EntityManager.m_entities[m_handle].m_entity->entf_get(ENTF_DESTROYED) ); } bool HEntity::operator!() const @@ -62,7 +62,7 @@ bool HEntity::operator!() const return( true ); debug_assert( g_EntityManager.m_entities[m_handle].m_refcount ); - return( g_EntityManager.m_entities[m_handle].m_entity->m_destroyed ); + return( g_EntityManager.m_entities[m_handle].m_entity->entf_get(ENTF_DESTROYED) ); } void HEntity::addRef() diff --git a/source/simulation/EntityManager.cpp b/source/simulation/EntityManager.cpp index 97063ec3c3..7a82671139 100644 --- a/source/simulation/EntityManager.cpp +++ b/source/simulation/EntityManager.cpp @@ -156,7 +156,7 @@ std::vector* CEntityManager::matches( EntityPredicate predicate, void* { std::vector* matchlist = new std::vector; for( int i = 0; i < MAX_HANDLES; i++ ) - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) ) if( predicate( m_entities[i].m_entity, userdata ) ) matchlist->push_back( HEntity( i ) ); return( matchlist ); @@ -166,7 +166,7 @@ std::vector* CEntityManager::getExtant() { std::vector* activelist = new std::vector; for( int i = 0; i < MAX_HANDLES; i++ ) - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) ) activelist->push_back( HEntity( i ) ); return( activelist ); } @@ -175,7 +175,7 @@ void CEntityManager::GetExtant( std::vector& results ) { results.clear(); for( int i = 0; i < MAX_HANDLES; i++ ) - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed && m_entities[i].m_entity->m_extant ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) && m_entities[i].m_entity->m_extant ) results.push_back( m_entities[i].m_entity ); } @@ -234,7 +234,7 @@ void CEntityManager::InitializeAll() for( int i = 0; i < MAX_HANDLES; i++ ) { - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) ) { // [2006-06-26 2780ms total] CEntity* e = m_entities[i].m_entity; @@ -249,7 +249,7 @@ void CEntityManager::InitializeAll() void CEntityManager::TickAll() { for( int i = 0; i < MAX_HANDLES; i++ ) - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed && m_entities[i].m_entity->m_extant ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) && m_entities[i].m_entity->m_extant ) m_entities[i].m_entity->Tick(); } @@ -278,7 +278,7 @@ void CEntityManager::updateAll( size_t timestep ) PROFILE_START( "update all" ); for( int i = 0; i < MAX_HANDLES; i++ ) - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) ) m_entities[i].m_entity->update( timestep ); PROFILE_END( "update all" ); } @@ -286,14 +286,14 @@ void CEntityManager::updateAll( size_t timestep ) void CEntityManager::interpolateAll( float relativeoffset ) { for( int i = 0; i < MAX_HANDLES; i++ ) - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) ) m_entities[i].m_entity->interpolate( relativeoffset ); } void CEntityManager::renderAll() { for( int i = 0; i < MAX_HANDLES; i++ ) - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) ) m_entities[i].m_entity->render(); } void CEntityManager::conformAll() @@ -301,7 +301,7 @@ void CEntityManager::conformAll() PROFILE_START("conform all"); for ( int i=0; i < MAX_HANDLES; i++ ) { - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) ) { CEntity* entity = m_entities[i].m_entity; CVector2D targetXZ = g_Game->GetWorld()->GetTerrain()->getSlopeAngleFace( entity->m_position.X, entity->m_position.Z, entity ); @@ -324,7 +324,7 @@ void CEntityManager::conformAll() void CEntityManager::invalidateAll() { for( int i = 0; i < MAX_HANDLES; i++ ) - if( m_entities[i].m_refcount && !m_entities[i].m_entity->m_destroyed ) + if( m_entities[i].m_refcount && !m_entities[i].m_entity->entf_get(ENTF_DESTROYED) ) m_entities[i].m_entity->invalidateActor(); } diff --git a/source/simulation/EntityStateProcessing.cpp b/source/simulation/EntityStateProcessing.cpp index 338bcdb5de..07e3b09005 100644 --- a/source/simulation/EntityStateProcessing.cpp +++ b/source/simulation/EntityStateProcessing.cpp @@ -34,8 +34,8 @@ enum EGotoSituation float CEntity::processChooseMovement( float distance ) { // Should we run or walk - if (m_shouldRun && m_staminaCurr > 0 && distance < m_run.m_MaxRange && - ( distance > m_run.m_MinRange || m_isRunning ) ) + if (entf_get(ENTF_SHOULD_RUN) && m_staminaCurr > 0 && distance < m_run.m_MaxRange && + ( distance > m_run.m_MinRange || entf_get(ENTF_IS_RUNNING) ) ) { if ( m_actor ) { @@ -46,7 +46,7 @@ float CEntity::processChooseMovement( float distance ) // Animation desync m_actor->GetModel()->Update( rand( 0, 1000 ) / 1000.0f ); - m_isRunning = true; + entf_set(ENTF_IS_RUNNING); } } return m_runSpeed; @@ -63,7 +63,7 @@ float CEntity::processChooseMovement( float distance ) // Animation desync m_actor->GetModel()->Update( rand( 0, 1000 ) / 1000.0f ); - m_isRunning = false; + entf_clear(ENTF_IS_RUNNING); } } return m_speed; @@ -255,8 +255,8 @@ bool CEntity::processGotoNoPathing( CEntityOrder* current, size_t timestep_milli else { m_orderQueue.pop_front(); - //m_isRunning = false; - //m_shouldRun = false; + //entf_clear(ENTF_IS_RUNNING); + //entf_clear(ENTF_SHOULD_RUN); } return( false ); case COLLISION_OVERLAPPING_OBJECTS: @@ -264,8 +264,8 @@ bool CEntity::processGotoNoPathing( CEntityOrder* current, size_t timestep_milli case COLLISION_WITH_DESTINATION: // We're here... m_orderQueue.pop_front(); - //m_isRunning = false; - //m_shouldRun = false; + //entf_clear(ENTF_IS_RUNNING); + //entf_clear(ENTF_SHOULD_RUN); return( false ); case COLLISION_NEAR_DESTINATION: @@ -329,8 +329,8 @@ bool CEntity::processGotoNoPathing( CEntityOrder* current, size_t timestep_milli case WOULD_LEAVE_MAP: // Just stop here, repath if necessary. m_orderQueue.pop_front(); - //m_isRunning = false; - //m_shouldRun = false; + //entf_clear(ENTF_IS_RUNNING); + //entf_clear(ENTF_SHOULD_RUN); return( false ); default: @@ -349,7 +349,7 @@ bool CEntity::processContactAction( CEntityOrder* current, size_t UNUSED(timeste if( Distance < action->m_MaxRange ) { (int&)current->m_type = transition; - m_isRunning = false; + entf_clear(ENTF_IS_RUNNING); return( true ); } @@ -374,7 +374,7 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times // Start the animation. Actual damage/gather will be done in a // few hundred ms, at the 'action point' of the animation we're // now setting. - m_isRunning = false; + entf_clear(ENTF_IS_RUNNING); // TODO: this is set to be looping, because apparently it otherwise // plays one frame of 'idle' after e.g. attacks. But this way means // animations sometimes play ~1.5 times then repeat, which looks @@ -395,8 +395,8 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times { // Cancel current order popOrder(); - m_isRunning = false; - m_shouldRun = false; + entf_clear(ENTF_IS_RUNNING); + entf_clear(ENTF_SHOULD_RUN); m_actor->SetEntitySelection( L"idle" ); m_actor->SetRandomAnimation( "idle" ); return( false ); @@ -422,8 +422,8 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times //heal or if defensive stance), the unit should expand and continue the order. popOrder(); - m_isRunning = false; - m_shouldRun = false; + entf_clear(ENTF_IS_RUNNING); + entf_clear(ENTF_SHOULD_RUN); return( false ); } @@ -438,8 +438,8 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times if( delta.within( adjMinRange ) ) { // Too close... do nothing. - m_isRunning = false; - m_shouldRun = false; + entf_clear(ENTF_IS_RUNNING); + entf_clear(ENTF_SHOULD_RUN); return( false ); } } @@ -508,7 +508,7 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times // Close enough, but turn to face them. m_orientation.Y = atan2( delta.x, delta.y ); m_ahead = delta.normalize(); - m_isRunning = false; + entf_clear(ENTF_IS_RUNNING); } // Pick our animation, calculate the time to play it, and start the timer. @@ -534,7 +534,7 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times { // If we've just transitioned, play idle. Otherwise, let the previous animation complete, if it // hasn't already. - if( m_transition ) + if( entf_get(ENTF_TRANSITION) ) { // (don't change actor's entity-selection) m_actor->SetRandomAnimation( "idle" ); @@ -593,8 +593,8 @@ bool CEntity::processGoto( CEntityOrder* current, size_t UNUSED(timestep_millis) // Let's just check we're going somewhere... if( Distance < 0.1f ) { - //m_isRunning = false; - //m_shouldRun = false; + //entf_clear(ENTF_IS_RUNNING); + //entf_clear(ENTF_SHOULD_RUN); return( false ); } @@ -617,8 +617,8 @@ bool CEntity::processGotoWaypoint( CEntityOrder* current, size_t UNUSED(timestep // Let's just check we're going somewhere... if( Distance < 0.1f ) { - m_isRunning = false; - //m_shouldRun = false; + entf_clear(ENTF_IS_RUNNING); + //entf_clear(ENTF_SHOULD_RUN); return( false ); } diff --git a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp index c3b929a72e..8f3ceaa489 100644 --- a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp @@ -657,7 +657,7 @@ BEGIN_COMMAND(DeleteObject) if (unit->GetEntity()) { // HACK: I don't know the proper way of undoably deleting entities... - unit->GetEntity()->m_destroyed = true; + unit->GetEntity()->entf_set(ENTF_DESTROYED); } g_UnitMan.RemoveUnit(unit); @@ -667,7 +667,7 @@ BEGIN_COMMAND(DeleteObject) void Undo() { if (m_UnitInLimbo->GetEntity()) - m_UnitInLimbo->GetEntity()->m_destroyed = false; + m_UnitInLimbo->GetEntity()->entf_clear(ENTF_DESTROYED); g_UnitMan.AddUnit(m_UnitInLimbo); m_UnitInLimbo = NULL;