void WorldState::beforeLoad(ska::State* lastState) { m_firstState = lastState == nullptr; auto cameraSystem = std::make_unique<ska::CameraSystem>(m_entityManager, m_eventDispatcher, std::make_unique<ska::CameraFollowStrategy>(m_entityManager), m_screenSize.x, m_screenSize.y); m_cameraSystem = cameraSystem.get(); addLogic(std::move(cameraSystem)); auto graphicSystem = std::make_unique<ska::GraphicSystem>(m_entityManager, m_eventDispatcher, *m_cameraSystem); m_graphicSystem = graphicSystem.get(); addGraphic(std::move(graphicSystem)); auto shadowSystem = std::make_unique<ska::ShadowSystem>(m_entityManager, *m_cameraSystem); m_shadowSystem = shadowSystem.get(); addGraphic(std::move(shadowSystem)); auto spaceSystem = std::make_unique<ska::cp::SpaceSystem>(m_entityManager); m_spaceSystem = spaceSystem.get(); addLogic(std::move(spaceSystem)); addLogic(std::make_unique<ska::cp::MovementSystem>(m_entityManager, m_spaceSystem->getSpace())); addLogic(std::make_unique<ska::InputSystem>(m_entityManager, m_eventDispatcher)); addLogic(std::make_unique<ska::DeleterSystem>(m_entityManager)); addLogic(std::make_unique<ska::ZGravityForceSystem>(m_entityManager, 0.90F)); auto animSystemPtr = std::make_unique<PokemonAnimationSystem>(m_entityManager); auto& animSystem = *animSystemPtr.get(); addLogic(std::move(animSystemPtr)); m_walkASM = &animSystem.setup(true, std::make_unique<ska::WalkAnimationStateMachine>(m_entityManager)); animSystem.setup<ska::JumpAnimationStateMachine>(false, std::make_unique<ska::JumpAnimationStateMachine>(m_entityManager)); animSystem.link<ska::WalkAnimationStateMachine, ska::JumpAnimationStateMachine>([&](const ska::EntityId& e) { const auto& pc = m_entityManager.getComponent<ska::PositionComponent>(e); return pc.z > 1; }); animSystem.link<ska::JumpAnimationStateMachine, ska::WalkAnimationStateMachine>([&](const ska::EntityId& e) { const auto& pc = m_entityManager.getComponent<ska::PositionComponent>(e); return pc.z <= 1; }); SettingsChangeEvent sce(SettingsChangeEventType::ALL, m_settings); m_eventDispatcher.ska::Observable<SettingsChangeEvent>::notifyObservers(sce); m_collisionEventSender = std::make_unique<ska::cp::SpaceCollisionEventSender>(m_entityManager, m_spaceSystem->getSpace(), m_eventDispatcher, m_tileset->getTileSize()); }
bool Transaction::isSigned() { for (size_t inp = 0; inp < inputs.size(); ++inp) { try { ScriptExecutor sce(*this, inp); sce.run(); if(sce.getState() == INVALID) return false; } catch(std::exception e) { return false; } } return true; }
void comline(void) { long c1, c2; while(C==' ' || c=='\t') ; comx: if((c1=c) == '\n') return; c2 = C; if(c1=='.' && c2!='.') inmacro = NO; if(msflag && c1 == '['){ refer(c2); return; } if(c2 == '\n') return; if(c1 == '\\' && c2 == '\"') SKIP; else if (filesp==files && c1=='E' && c2=='Q') eqn(); else if(filesp==files && c1=='T' && (c2=='S' || c2=='C' || c2=='&')) { if(msflag) stbl(); else tbl(); } else if(c1=='T' && c2=='E') intable = NO; else if (!inmacro && ((c1 == 'd' && c2 == 'e') || (c1 == 'i' && c2 == 'g') || (c1 == 'a' && c2 == 'm'))) macro(); else if(c1=='s' && c2=='o') { if(iflag) SKIP; else { getfname(); if(fname[0]) { if(infile = opn(fname)) *++filesp = infile; else infile = *filesp; } } } else if(c1=='n' && c2=='x') if(iflag) SKIP; else { getfname(); if(fname[0] == '\0') exits(0); if(Bfildes(&(infile->Biobufhdr)) != 0) Bterm(&(infile->Biobufhdr)); infile = *filesp = opn(fname); } else if(c1 == 't' && c2 == 'm') SKIP; else if(c1=='h' && c2=='w') SKIP; else if(msflag && c1 == 'T' && c2 == 'L') { SKIP_TO_COM; goto comx; } else if(msflag && c1=='N' && c2 == 'R') SKIP; else if(msflag && c1 == 'A' && (c2 == 'U' || c2 == 'I')){ if(mac==MM)SKIP; else { SKIP_TO_COM; goto comx; } } else if(msflag && c1=='F' && c2=='S') { SKIP_TO_COM; goto comx; } else if(msflag && (c1=='S' || c1=='N') && c2=='H') { SKIP_TO_COM; goto comx; } else if(c1 == 'U' && c2 == 'X') { if(wordflag) Bprint(&(bout.Biobufhdr), "UNIX\n"); else Bprint(&(bout.Biobufhdr), "UNIX "); } else if(msflag && c1=='O' && c2=='K') { SKIP_TO_COM; goto comx; } else if(msflag && c1=='N' && c2=='D') SKIP; else if(msflag && mac==MM && c1=='H' && (c2==' '||c2=='U')) SKIP; else if(msflag && mac==MM && c2=='L') { if(disp || c1=='R') sdis('L', 'E'); else { SKIP; Bprint(&(bout.Biobufhdr), " ."); } } else if(!msflag && c1=='P' && c2=='S') { inpic(); } else if(msflag && (c1=='D' || c1=='N' || c1=='K'|| c1=='P') && c2=='S') { sdis(c1, 'E'); } else if(msflag && (c1 == 'K' && c2 == 'F')) { sdis(c1,'E'); } else if(msflag && c1=='n' && c2=='f') sdis('f','i'); else if(msflag && c1=='c' && c2=='e') sce(); else { if(c1=='.' && c2=='.') { if(msflag) { SKIP; return; } while(C == '.') ; } inmacro++; if(c1 <= 'Z' && msflag) regline(YES,ONE); else { if(wordflag) C; regline(YES,TWO); } inmacro--; } }
void Bras::in_state_func() { switch (state) { case RANGE_DEPART : scr(); a0(); spb(); pf(); break; case INT_RANGE : //va bumper scn(); a0(); spb(); pf(); break; case INT2_RANGE : set_time_out(400, trigger_to_be); scn(); a0(); spb(); pf(); break; case GO_ATTENTE : scn(); a1(); spb(); pf(); break; case ATTENTE_ACTIF : scn(); a1(); spb(); pf(); break; case DESCENTE_LAT : scn(); a4(); spb(); pf(); break; case DESCENTE_POMPE_LAT : scn(); a4(); spb(); po(); break; case PRISE_LAT : scn(); a4(); spb(); po(); break; case MONTE_VERT : set_time_out(500, TIME_OUT); scn(); a0(); spv(); po(); break; case MONTE : scn(); a0(); spb(); po(); break; case RANGE_PRISE : set_time_out(2000, TIME_OUT); scl(); a0(); spb(); po(); break; case LACHE : set_time_out(300, TIME_OUT); scl(); a0(); spb(); pf(); break; case MONTE_ECH : scn(); a3(); spb(); po(); break; case MONTE_ECH_VERT : sce(); a3(); spr(); po(); break; case RETOURNE_ECH : call_for_help(); sce(); a3(); spr(); po(); break; case REPLACE_APRES_ECH : set_time_out(300, TIME_OUT); scn(); a3(); spb(); pf(); break; case SEND_MINE : scv(); a4(); spv(); pf(); break; case SENDMASTER_PRET : scv(); a4(); spv(); po(); break; case PRISE_VERT : scv(); a4(); spv(); po(); break; case PRISE_COPAIN : a2(); sce(); spb(); po(); break; } }