bool TriageGame::Init() { // setup OpenGL glClearColor(0.1f,0.1f,0.1f, 1.f); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // set up tools rng_seed(); // setup debug objects debugTextBuffer.SetFont(g_Font.GetFont()); debugTextBuffer.SetAnchor(FF_ANCHOR_CENTER); debugTextBuffer.SetScale(1); fps.SetFont(g_Font.GetFont()); fps.SetColor(FF_COLOR_YELLOW); fps.SetAnchor(FF_ANCHOR_CENTER_RIGHT); // initialise level class level.Init(); // initialise state state.AddState("menu", StatePtr(new StateMenu())); state.AddState("game", StatePtr(new StatePlaying())); state.AddState("edit", StatePtr(new TriageEditor())); state.SetState("menu"); return true; }
void Mind::Think() { // Clear the recyclebin, it might hold a finished state from the last frame _recycleBin = StatePtr(); // greebo: We do not check for NULL pointers in the owner at this point, // as this method is called by the owner itself, it _has_ to exist. idAI* owner = _owner.GetEntity(); assert(owner != NULL); if (_stateQueue.empty()) { // We start with the idle state PushState(owner->backboneStates[ai::ERelaxed]); } // At this point, we MUST have a State assert(_stateQueue.size() > 0); const StatePtr& state = _stateQueue.front(); // Thinking DM_LOG(LC_AI, LT_INFO)LOGSTRING("Mind is thinking... %s\r", owner->name.c_str()); // Should we switch states (i.e. initialise a new one)? if (_switchState) { // Clear the flag _switchState = false; // Initialise the state, this will put the Subsystem Tasks in place state->Init(owner); } if (!_switchState) { // Let the State do its monitoring task state->Think(owner); } // Try to perform the subsystem tasks, skipping inactive subsystems // Maximum number of tries is SubsystemCount. for (int i = 0; i < static_cast<int>(SubsystemCount); i++) { // Increase the iterator and wrap around, if necessary _subsystemIterator = static_cast<SubsystemId>( (static_cast<int>(_subsystemIterator) + 1) % static_cast<int>(SubsystemCount) ); // Subsystems return TRUE when their task was executed if (owner->GetSubsystem(_subsystemIterator)->PerformTask()) { // Task performed, break, iterator will be increased next round break; } } }
void Engine::ShowLogo() { #ifdef _WINDOWS Sleep(200); #endif mLogo = new LogoState(new hgeSprite(mResourceManager->GetTexture("Data/Textures/Logo.png"),0,0,954, 755)); mStateManager->Push(StatePtr(mLogo)); mHGE->System_Start(); #ifdef _WINDOWS Sleep(200); #endif }
StatePtr AgitatedSearchingState::CreateInstance() { return StatePtr(static_cast<State*>(new AgitatedSearchingState)); }
void Game::pushState(State *state) { if (state != NULL) { pushState(StatePtr(state)); } }
StatePtr PainState::CreateInstance() { return StatePtr( new PainState ); }
StatePtr AgitatedSearchingStateLanternBot::CreateInstance() { return StatePtr(new AgitatedSearchingStateLanternBot); }
StatePtr PocketPickedState::CreateInstance() { return StatePtr(new PocketPickedState); }
StatePtr ObservantState::CreateInstance() { return StatePtr(new ObservantState); }
StatePtr FleeDoneState::CreateInstance() { return StatePtr(new FleeDoneState); }
StatePtr KnockedOutState::CreateInstance() { return StatePtr(new KnockedOutState); }
StatePtr UnreachableTargetState::CreateInstance() { return StatePtr(new UnreachableTargetState); }
StatePtr HitByMoveableState::CreateInstance() { return StatePtr(new HitByMoveableState); }
StatePtr IdleSleepState::CreateInstance() { return StatePtr(new IdleSleepState); }
StatePtr TakeCoverState::CreateInstance() { return StatePtr(new TakeCoverState); }
StatePtr CombatState::CreateInstance() { return StatePtr(new CombatState); }
StatePtr LostTrackOfEnemyState::CreateInstance() { return StatePtr(new LostTrackOfEnemyState); }
StatePtr ExamineRopeState::CreateInstance() { return StatePtr(new ExamineRopeState); }
StatePtr SearchingState::CreateInstance() { return StatePtr( new SearchingState ); }
StateManagerSystem::StateManagerSystem() : m_ActiveState(std::move(StatePtr(nullptr))), m_Initialized(false) {}