//draws the bomb animation frames from the bomb sprites array based on the bombs state (alive, ignition, dead, blast) sf::Sprite Bomb::bombFrame(){ //if last frame of animation set bomb ignite to true if(frame == 14){ setIgnite(true); loopMode( 6, 10); } //once at final blast frame set used to true so bomb can be marked for removal from the bomb list by another function //once an isBlast is false && ignition and used is true then the function to create a set amount of blastlets is called in the player function //these will be handled differently, this is also the case for a blastlet if(frame == 9){ setUsed(true); } if(frame == 4){ setUsed(true); } //if the last frame in bomb fuse animation is not rolling then play the bomb fuse anim if(!getIgnite()){ //animates the first 5 frames of bomb to iterate over 1 fifth of each set amount //of time it takes before bomb detonation, last frame is miscounted because I think its ugly if(getTicks(getBombTicks()/4)){ //the array Frames has a bomb image stored at index 10 to 15 this will get the next frame return getNext(); //else return the normal static frame, this function cannot fail to return a //sprite to the function that called it else the program will crash }else{ //returns present frame and not next frame return showFrame(); } //now that the bomb frame anim is over the bomb has detonated, play the blast animation, set the bomb type to deadly and //call used after the animation is over, ignition set to true is the trigger for the create blast event in player, this too will // be on the bomb array however, so all players can either be killed or collide with bombs when all bomb collisions are checked against every //future player }else{ return getNext(); } }
int THaCrateMap::setBank(int crate, int slot, int bank) { assert( crate >= 0 && crate < MAXROC && slot >= 0 && slot < MAXSLOT ); incrNslot(crate); setUsed(crate,slot); crdat[crate].bank[slot] = bank; return CM_OK; }
inline T ParameterGroup::getDefault(const std::string& name, const T& default_value, const Requirement& r) const { setUsed(); std::pair<std::string, std::string> name_path = split(name); map_type::const_iterator it = map_.find(name_path.first); if (it == map_.end()) { if (parent_ != 0) { // If we have a parent, ask it instead. if (output_is_enabled_) { //TermColors::Red(); std::cout << name; //TermColors::Normal(); std::cout << " not found at " << (path() + ID_delimiter_path) << ", asking parent." << std::endl; } return parent_->getDefault<T>(name, default_value, r); } else { // We check the requirement for the default value std::string requirement_result = r(default_value); if (requirement_result != "") { std::cerr << "ERROR: The default value for the " << " element named '" << name << "' in the group '" << this->path() << "' failed to meet a requirenemt.\n"; std::cerr << "The requirement enforcer returned the following message:\n" << requirement_result << "\n"; throw RequirementFailedException<Requirement>(); } } if (output_is_enabled_) { //TermColors::Blue(); std::cout << name; //TermColors::Normal(); std::cout << " not found. Using default value '" << to_string(default_value) << "'." << std::endl; } return default_value; } if (name_path.second == "") { T val = this->translate<T>(*it, r); it->second->setUsed(); if (output_is_enabled_) { //TermColors::Green(); std::cout << name; //TermColors::Normal(); std::cout << " found at " << (path() + ID_delimiter_path) << ", value is '" << to_string(val) << "'." << std::endl; } return val; } else { ParameterGroup& pg = dynamic_cast<ParameterGroup&>(*(*it).second); pg.setUsed(); return pg.getDefault<T>(name_path.second, default_value, r); } }
int THaCrateMap::setHeader(int crate, int slot, int head) { assert( crate >= 0 && crate < MAXROC && slot >= 0 && slot < MAXSLOT ); incrNslot(crate); setUsed(crate,slot); crdat[crate].header[slot] = head; return CM_OK; }
void RundownHttpGetWidget::executePlay() { request.sendGet(this->command.getUrl(), this->command.getHttpData()); if (this->markUsedItems) setUsed(true); }
bool RundownGroupWidget::executeOscCommand(Playout::PlayoutType type) { if (this->parentWidget()->parentWidget() == NULL) return true; QTreeWidget* treeWidgetRundown = dynamic_cast<QTreeWidget*>(this->parentWidget()->parentWidget()); for (int i = 0; i < treeWidgetRundown->invisibleRootItem()->childCount(); i++) { QTreeWidgetItem* child = treeWidgetRundown->invisibleRootItem()->child(i); QWidget* widget = treeWidgetRundown->itemWidget(child, 0); if (widget == this) { EventManager::getInstance().fireExecuteRundownItemEvent(ExecuteRundownItemEvent(type, child)); if (type == Playout::PlayoutType::Play || type == Playout::PlayoutType::PlayNow) { EventManager::getInstance().fireDurationChangedEvent(DurationChangedEvent(this->command.getDuration())); if (this->markUsedItems) setUsed(true); } break; } } return true; }
EWAShowPolicy::EWAShowPolicy( bool bFinded, const QRegExp& rx, bool bUsed, QObject *pParent ) :QObject( pParent ) { setShowIfChanged( bFinded ); setRegExp( rx ); setUsed( bUsed ); }
void RundownSonyPresetWidget::executePlay() { this->device->selectPreset(this->command.getAddress(), this->command.getPreset()); if (this->markUsedItems) setUsed(true); }
void RundownPlayoutCommandWidget::executePlay() { if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Stop)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F1, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Play)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F2, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::PlayNow)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F2, Qt::ShiftModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Load)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F3, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Pause)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F4, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Next)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F5, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Update)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F6, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Invoke)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F7, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Preview)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F8, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::Clear)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F10, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::ClearVideolayer)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F11, Qt::NoModifier)); else if (this->command.getPlayoutCommand() == Playout::toString(Playout::PlayoutType::ClearChannel)) EventManager::getInstance().fireExecutePlayoutCommandEvent(ExecutePlayoutCommandEvent(QEvent::KeyPress, Qt::Key_F12, Qt::NoModifier)); if (this->markUsedItems) setUsed(true); }
void TLFrame::setKey( bool in_is_key ) { is_key = in_is_key; if ( is_key ) setUsed( true ); update(); }
void TLFrame::setHasDrawing( bool in_has_drawing ) { has_drawing = in_has_drawing; if ( has_drawing ) setUsed( true ); update(); }
void TLFrame::setLast( bool in_is_last ) { is_last = in_is_last; if ( is_last ) setUsed( true ); update(); }
int THaCrateMap::setMask(int crate, int slot, int mask) { assert( crate >= 0 && crate < MAXROC && slot >= 0 && slot < MAXSLOT ); incrNslot(crate); setUsed(crate,slot); crdat[crate].headmask[slot] = mask; return CM_OK; }
bool RundownGroupWidget::executeCommand(Playout::PlayoutType type) { if (this->active) this->animation->start(1); if (type == Playout::PlayoutType::Play || type == Playout::PlayoutType::PlayNow) { if (this->command.getDuration() > 0) EventManager::getInstance().fireDurationChangedEvent(DurationChangedEvent(this->command.getDuration())); if (this->markUsedItems) setUsed(true); } else if (type == Playout::PlayoutType::Stop) { if (this->command.getDuration() > 0) EventManager::getInstance().fireDurationChangedEvent(DurationChangedEvent(0)); } else if (type == Playout::PlayoutType::Clear || type == Playout::PlayoutType::ClearVideoLayer || type == Playout::PlayoutType::ClearChannel) { EventManager::getInstance().fireDurationChangedEvent(DurationChangedEvent(0)); // Reset counter. } return true; }
bool Sudoku::backTrack(){ int i, j, loc, dir, tmp_q[9][9], tmp_a[9][9]; bool onlySol=true, confirm[9][9]; //initialize data for DFS(low) for(i=0; i<9; i++) for(j=0; j<9; j++){ if(grid[i][j]!=0) confirm[i][j]=true; else confirm[i][j]=false; tmp_q[i][j]=grid[i][j]; } initUsed(); //backtrack(low) for(loc=0, dir=1; loc<=80; loc+=dir){ i=loc/9; j=loc%9; if(confirm[i][j]) continue; dir=1; if(grid[i][j]>0) setUsed(i, j, grid[i][j], false); do{ grid[i][j]++;}while(used(i, j, grid[i][j])); if(grid[i][j]<10) setUsed(i, j, grid[i][j], true); else{ grid[i][j]=0; dir=-1;} } //store the answer for comparing //initialize data for backtrack(high) for(i=0; i<9; i++) for(j=0; j<9; j++){ tmp_a[i][j]=grid[i][j]; grid[i][j]=(tmp_q[i][j]!=0)? tmp_q[i][j]: 10; } initUsed(); //backtrack(high) for(loc=0, dir=1; loc<=80; loc+=dir){ i=loc/9; j=loc%9; if(confirm[i][j]) continue; dir=1; if(grid[i][j]<10) setUsed(i, j, grid[i][j], false); do{ grid[i][j]--;}while(used(i, j, grid[i][j])); if(grid[i][j]>0) setUsed(i, j, grid[i][j], true); else{ grid[i][j]=10; dir=-1;} } //(answer match)?(only-solution):(multi-solution); for(i=0; i<=80; i++) if(grid[i/9][i%9]!=tmp_a[i/9][i%9]){ onlySol=false; break; } return onlySol; }
EWAShowPolicy& EWAShowPolicy::operator=( const EWAShowPolicy *pOther ) { setShowIfChanged( pOther->showIfChanged() ); setRegExp( pOther->getRegExp() ); setUsed( pOther->isUsed() ); return *this; }
void ColorCorrection::dataToFrontend() { auto _tuning = dataModel()->tunings().current(); setAllChannels(); if (!_tuning) return; setUsed(_tuning->colorCorrection().isUsed()); }
void TLFrame::setMotion( bool in_is_motion ) { is_motion = in_is_motion; if ( is_motion ) { setUsed( true ); setUnknownMotion( false ); } update(); }
void TLFrame::setUseProperties( TLFrame *in_frame ) { Q_CHECK_PTR( in_frame ); setUsed( in_frame -> isUsed() ); setKey( in_frame -> isKey() ); setLast( in_frame -> isLast() ); setUnknownMotion( in_frame -> isUnknownMotion() ); setMotion( in_frame -> isMotion() ); setHasDrawing( in_frame -> hasDrawing() ); }
int THaCrateMap::setModel(int crate, int slot, UShort_t mod, UShort_t nc, UShort_t nd ) { assert( crate >= 0 && crate < MAXROC && slot >= 0 && slot < MAXSLOT ); setUsed(crate,slot); crdat[crate].model[slot] = mod; if( !SetModelSize( crate, slot, mod )) { crdat[crate].nchan[slot] = nc; crdat[crate].ndata[slot] = nd; } return CM_OK; }
Void testhash::Parent::init() { setChildTableUsed(0); setFirstFreeParent(Parent()); setFirst__ChildTableBlock__Parent(Parent()); setLast__ChildTableBlock__Parent(Parent()); setNumFreeParents(0); setNum__ChildTableBlock__Parents(0); setUsed(0); reallocInstances(INITIAL_OBJECT_RESERVE); reallocChildTable(INITIAL_OBJECT_RESERVE); }
void UmlOperation::defaultDef() { if (cppDecl().isEmpty()) set_CppDecl(CppSettings::operationDecl()); if (isAbstract()) set_CppDef(""); else if (cppDef().isEmpty()) set_CppDef(CppSettings::operationDef()); setUsed(); }
void Sudoku::initUsed(){ int i, j; for(i=0; i<9; i++) for(j=0; j<11; j++){ rowUsed[i][j]=false; colUsed[i][j]=false; cellUsed[i/3][i%3][j]=false; } for(i=0; i<9; i++) for(j=0; j<9; j++) if(grid[i][j]>0 && grid[i][j]<10) setUsed(i, j, grid[i][j], true); }
CBin::t_size CBin::Insert( CBin::t_size x_nBytes, CBin::t_size x_nOffset = 0 ) {_STT(); if ( !x_nBytes ) return 0; // Is it past the end? if ( !getUsed() || x_nOffset >= getUsed() ) { // Resize the buffer Resize( x_nOffset + x_nBytes ); // Zero space between end of buffer and offset t_size over = x_nOffset - getUsed(); if ( over ) oexZeroMemory( _Ptr( getUsed() ), over ); // Update used value setUsed( x_nOffset + x_nBytes ); return getUsed(); } // end if // Allocate space Resize( getUsed() + x_nBytes ); // Move block ( can't use memcpy because blocks overlap ) t_size copy = getUsed() - x_nOffset; if ( copy ) { t_byte *dst = _Ptr( x_nOffset + x_nBytes + copy - 1 ), *src = _Ptr( x_nOffset + copy - 1 ); while ( copy-- ) *dst-- = *src--; } // end if // Set new size setUsed( getUsed() + x_nBytes ); return getUsed(); }
testlist::Child testlist::Child::create() { if(instanceCount() == 0) return Child(); Child result = popFreeChild(); if(!result.isValid()) { if(getUsed() >= instanceCount()) reallocInstances(instanceCount() << 1); result = Child(getUsed()); setUsed(getUsed() + 1); } result.reset(); result.onCreate(); return result; }
testlist::Parent testlist::Parent::create() { if(instanceCount() == 0) return Parent(); Parent result = popFreeParent(); if(!result.isValid()) { if(getUsed() >= instanceCount()) reallocInstances(instanceCount() << 1); result = Parent(getUsed()); setUsed(getUsed() + 1); } result.reset(); result.onCreate(); return result; }
simplest::Simple simplest::Simple::create() { if(instanceCount() == 0) return Simple(); Simple result = popFreeSimple(); if(!result.isValid()) { if(getUsed() >= instanceCount()) reallocInstances(instanceCount() << 1); result = Simple(getUsed()); setUsed(getUsed() + 1); } result.reset(); result.onCreate(); return result; }
inline T ParameterGroup::get(const std::string& name, const Requirement& r) const { setUsed(); std::pair<std::string, std::string> name_path = split(name); map_type::const_iterator it = map_.find(name_path.first); if (it == map_.end()) { if (parent_ != 0) { // If we have a parent, ask it instead. if (output_is_enabled_) { //TermColors::Red(); std::cout << name; //TermColors::Normal(); std::cout << " not found at " << (path() + ID_delimiter_path) << ", asking parent." << std::endl; } return parent_->get<T>(name, r); } else { // We are at the top, name has not been found. std::cerr << "ERROR: The group '" << this->path() << "' does not contain an element named '" << name << "'.\n"; throw NotFoundException(); } } if (name_path.second == "") { T val = this->translate<T>(*it, r); it->second->setUsed(); if (output_is_enabled_) { //TermColors::Green(); std::cout << name; //TermColors::Normal(); std::cout << " found at " << (path() + ID_delimiter_path) << ", value is " << to_string(val) << std::endl; } return val; } else { ParameterGroup& pg = dynamic_cast<ParameterGroup&>(*(*it).second); pg.setUsed(); return pg.get<T>(name_path.second, r); } }
void RundownOscOutputWidget::executePlay() { OscOutputModel model = DatabaseManager::getInstance().getOscOutputByName(this->command.getOutput()); if (this->command.getType() == "Boolean") OscDeviceManager::getInstance().getOscSender()->send(model.getAddress(), model.getPort(), this->command.getPath(), (this->command.getMessage() == "true") ? true : false); else if (this->command.getType() == "Double") OscDeviceManager::getInstance().getOscSender()->send(model.getAddress(), model.getPort(), this->command.getPath(), this->command.getMessage().toDouble()); else if (this->command.getType() == "Float") OscDeviceManager::getInstance().getOscSender()->send(model.getAddress(), model.getPort(), this->command.getPath(), this->command.getMessage().toFloat()); else if (this->command.getType() == "Integer") OscDeviceManager::getInstance().getOscSender()->send(model.getAddress(), model.getPort(), this->command.getPath(), this->command.getMessage().toInt()); else if (this->command.getType() == "String") OscDeviceManager::getInstance().getOscSender()->send(model.getAddress(), model.getPort(), this->command.getPath(), this->command.getMessage()); if (this->markUsedItems) setUsed(true); }
Bomb::Bomb(int _X, int _Y, int _F, int _T): Sprites("Balst.png",3 , 5){ //set fuse animation loop loopMode(true, 10 ,15); //initialises the objects member variables setPosX(_X); setPosY(_Y); setPos(getPosX(), getPosY()); setBombTicks(_T); setFlame(_F); setWH(20 ,20); //not used yet setUsed(false); //not igniting setIgnite(false); //is a bomb not a blast setBlast(false); }