enum E_EventAttribute CEvent::QueryAttribute( int32 index ) const { switch (Command()) { case EvtType_Note: switch (index) { case 0: return EvAttr_Pitch; case 1: return EvAttr_AttackVelocity; case 2: return EvAttr_ReleaseVelocity; } break; case EvtType_NoteOff: switch (index) { case 0: return EvAttr_Pitch; case 1: return EvAttr_ReleaseVelocity; } break; case EvtType_ChannelATouch: switch (index) { case 0: return EvAttr_AfterTouch; case 1: return EvAttr_UpdatePeriod; } case EvtType_PolyATouch: switch (index) { case 0: return EvAttr_Pitch; case 1: return EvAttr_AfterTouch; } break; case EvtType_Controller: switch (index) { case 0: return EvAttr_ControllerNumber; case 1: uint8 ctl; ctl = controlChange.controller; // REM: An experiment. if (ctl == 1) return EvAttr_Modulation; if ( ctl <= 31 || ctl >= 98 && ctl <= 101) { return EvAttr_ControllerValue16; } // Most channel mode messages have NO editable parameter... if (ctl == 121 || ctl >= 123) return EvAttr_None; // Otherwise, we have an 8-bit controller. return EvAttr_ControllerValue8; case 2: return EvAttr_UpdatePeriod; } break; case EvtType_ProgramChange: switch (index) { case 0: return EvAttr_Program; case 1: return EvAttr_ProgramBank; } break; case EvtType_PitchBend: switch (index) { case 0: return EvAttr_InitialBend; case 1: return EvAttr_BendValue; case 2: return EvAttr_UpdatePeriod; } break; // MIDI system events case EvtType_SysEx: case EvtType_Text: case EvtType_UserEvent: return (index == 0) ? EvAttr_DataSize : EvAttr_None; // Global control events // EvtType_Stop, // stop the sequencer // EvtType_Go, // start the sequencer // EvtType_Locate, // locate to "duration" time // EvtType_Cue, // trigger a cue point // EvtType_MTCCue, // trigger an MTC cue point // EvtType_MuteVChannel, // mute a vChannel // EvtType_MuteTrack, // mute a track // EvtType_SpliceIn, // a "splice" event for overdub // EvtType_SpliceOut, // a "splice" event for overdub // Programmable event types for plug-ins // EvtType_UserEvent, // has type and data fields // Track control events case EvtType_Repeat: // repeat a section return (index == 0) ? EvAttr_RepeatCount : EvAttr_None; break; case EvtType_Sequence: // play another track switch (index) { case 0: return EvAttr_SequenceNumber; case 1: return EvAttr_Transposition; } break; // EvtType_Branch, // conditional branch to track // EvtType_Erase, // erase notes on channel // EvtType_Punch, // punch in over track // Clock control events case EvtType_Tempo: // change time signature event return (index == 0) ? EvAttr_TempoValue : EvAttr_None; break; case EvtType_TimeSig: // change time signature event switch (index) { case 0: return EvAttr_TSigBeatCount; case 1: return EvAttr_TSigBeatSize; } break; // EvtType_VelocityContour, // velocity contour event // EvtType_Transpose, // transposition for vChannel // Only used on playback stack // EvtType_EndSequence, // end of a play track // EvtType_EndErase, // end of erase event // EvtType_EndPunch, // end of a "punch" event // EvtType_TaskMarker, // indicates task is ready /* some future event ideas... EvtType_KeySig, -- key signature EvtType_BarLine, -- for std midi files? . EvtType_Locate, -- "jump to" a particular clock time (not in track?) EvtType_Map, -- change output map or key map. EvtType_Switch, -- set switches like MTC on EvtType_Config, -- set program configuration EvtType_LaunchScript,-- send ARexx msg EvtType_Dump, -- send patch dump (pause music...) ?? -- trigger a cue point in the program (via MTC?) */ } return EvAttr_None; }
void CCommandAI::GiveAllowedCommand(const Command& c, bool fromSynced) { if (ExecuteStateCommand(c)) { return; } switch (c.GetID()) { case CMD_SELFD: { if (owner->unitDef->canSelfD) { if (!(c.options & SHIFT_KEY) || commandQue.empty()) { if (owner->selfDCountdown != 0) { owner->selfDCountdown = 0; } else { owner->selfDCountdown = owner->unitDef->selfDCountdown*2+1; } } else if (commandQue.back().GetID() == CMD_SELFD) { commandQue.pop_back(); } else { commandQue.push_back(c); } } return; } case CMD_SET_WANTED_MAX_SPEED: { if (CanSetMaxSpeed() && (commandQue.empty() || (commandQue.back().GetID() != CMD_SET_WANTED_MAX_SPEED))) { // bail early, do not check for overlaps or queue cancelling commandQue.push_back(c); if (commandQue.size()==1 && !owner->beingBuilt) { SlowUpdate(); } } return; } case CMD_WAIT: { GiveWaitCommand(c); return; } case CMD_INSERT: { ExecuteInsert(c, fromSynced); return; } case CMD_REMOVE: { ExecuteRemove(c); return; } } // flush the queue for immediate commands // NOTE: CMD_STOP can be a queued order (!) if (!(c.options & SHIFT_KEY)) { waitCommandsAI.ClearUnitQueue(owner, commandQue); ClearTargetLock((commandQue.empty())? Command(CMD_STOP): commandQue.front()); ClearCommandDependencies(); SetOrderTarget(NULL); // if c is an attack command, the actual order-target // gets set via ExecuteAttack (called from SlowUpdate // at the end of this function) commandQue.clear(); assert(commandQue.empty()); inCommand = false; } AddCommandDependency(c); if (c.GetID() == CMD_PATROL) { CCommandQueue::iterator ci = commandQue.begin(); for (; ci != commandQue.end() && ci->GetID() != CMD_PATROL; ++ci) { // just increment } if (ci == commandQue.end()) { if (commandQue.empty()) { Command c2(CMD_PATROL, c.options, owner->pos); commandQue.push_back(c2); } else { do { --ci; if (ci->params.size() >= 3) { Command c2(CMD_PATROL, c.options); c2.params = ci->params; commandQue.push_back(c2); break; } else if (ci == commandQue.begin()) { Command c2(CMD_PATROL, c.options, owner->pos); commandQue.push_back(c2); break; } } while (ci != commandQue.begin()); } } } // cancel duplicated commands bool first; if (CancelCommands(c, commandQue, first) > 0) { if (first) { Command stopCommand(CMD_STOP); commandQue.push_front(stopCommand); SlowUpdate(); } return; } // do not allow overlapping commands if (!GetOverlapQueued(c).empty()) { return; } if (c.GetID() == CMD_ATTACK) { // avoid weaponless units moving to 0 distance when given attack order if (owner->weapons.empty() && (!owner->unitDef->canKamikaze)) { Command c2(CMD_STOP); commandQue.push_back(c2); return; } } commandQue.push_back(c); if (commandQue.size() == 1 && !owner->beingBuilt && !owner->IsStunned()) { SlowUpdate(); } }
void GCode::Read(Model *model, ViewProgress *progress, string filename) { clear(); ifstream file; file.open(filename.c_str()); //open a file file.seekg (0, ios::end); double filesize = double(file.tellg()); file.seekg (0); progress->start(_("Loading GCode"), filesize); int progress_steps=(int)(filesize/1000); if (progress_steps==0) progress_steps=1; buffer_zpos_lines.clear(); if(!file.good()) { // MessageBrowser->add(str(boost::format("Error opening file %s") % Filename).c_str()); return; } uint LineNr = 0; string s; Vector3d globalPos(0,0,0); Min.set(99999999.0,99999999.0,99999999.0); Max.set(-99999999.0,-99999999.0,-99999999.0); std::vector<Command> loaded_commands; double lastZ=0.; double lastE=0.; double lastF=0.; layerchanges.clear(); bool belowzero = false; stringstream alltext; while(getline(file,s)) { alltext << s << endl; LineNr++; unsigned long fpos = file.tellg(); if (fpos%progress_steps==0) if (!progress->update(fpos)) break; Command command; try { command = Command(s, globalPos); } catch (Glib::OptionError e) { if (!belowzero) // only once cerr << "GCode below zero!"<< endl;// ; //alert("GCode problem"); belowzero = true; } if (command.e==0) command.e= lastE; else lastE=command.e; if (command.f==0) command.f= lastF; else lastF=command.f; // cout << s << endl; //cerr << command.info()<< endl; if(command.where.x() < -100) continue; if(command.where.y() < -100) continue; globalPos = command.where; if(command.where.x() < Min.x()) Min.x() = command.where.x(); if(command.where.y() < Min.y()) Min.y() = command.where.y(); if(command.where.z() < Min.z()) Min.z() = command.where.z(); if(command.where.x() > Max.x()) Max.x() = command.where.x(); if(command.where.y() > Max.y()) Max.y() = command.where.y(); if(command.where.z() > Max.z()) Max.z() = command.where.z(); if (command.where.z() > lastZ) { // if (lastZ > 0){ // don't record first layer unsigned long num = loaded_commands.size(); layerchanges.push_back(num); // } lastZ = command.where.z(); buffer_zpos_lines.push_back(LineNr-1); } else if (command.where.z() < lastZ) { lastZ=command.where.z(); if (layerchanges.size()>0) layerchanges.erase(layerchanges.end()-1); } loaded_commands.push_back(command); } commands = loaded_commands; buffer->set_text(alltext.str()); Center.x() = (Max.x() + Min.x() )/2; Center.y() = (Max.y() + Min.y() )/2; Center.z() = (Max.z() + Min.z() )/2; model->m_signal_gcode_changed.emit(); double time = GetTimeEstimation(); int h = (int)time/3600; int min = ((int)time%3600)/60; int sec = ((int)time-3600*h-60*min); cout << "GCode Time Estimation "<< h <<"h "<<min <<"m " <<sec <<"s" <<endl; //??? to statusbar or where else? }
void CGnuplot::SetYRange(const double y_min, const double y_max) { Command("set yrange [%f:%f]", y_min, y_max); }
std::string GenAudioID::Usage() const { return Command() + " [src dir] [dst file]"; }
Command getCommand() { // Get the command followed by the parameters int param = 1; string param_buffer = ""; string command_buffer = ""; bool on_param = true; bool on_command = false; // need a map/tree that matches commands to characters while(TRUE) { char ch = getch(); // ESC key clears the buffers if(ch == 27) { param = 1; param_buffer = ""; command_buffer = ""; on_param = true; on_command = false; continue; } // if a non-number was pushed, convert the // param_buffer to int and look for the command if(ch > 57 || ch < 48) { on_command = true; on_param = false; if(param_buffer.length()) param = atoi(param_buffer.c_str()); } // Start by looking for numbers if(on_param) { param_buffer += ch; } // if we are looking for a command if(on_command) { command_buffer += ch; if(!command_buffer.compare("q")) return Command(QUIT, param); if(!command_buffer.compare("s")) return Command(SCROLLMODE, param); if(!command_buffer.compare("j")) return Command(SCROLLDOWN, param); if(!command_buffer.compare("J")) return Command(SCROLLBOTTOM, param); if(!command_buffer.compare("k")) return Command(SCROLLUP, param); if(!command_buffer.compare("K")) return Command(SCROLLTOP, param); if(!command_buffer.compare("h")) return Command(SCROLLLEFT, param); if(!command_buffer.compare("l")) return Command(SCROLLRIGHT, param); if(!command_buffer.compare("H")) return Command(SHOWHELP, param); if(!command_buffer.compare("g")) return Command(GOTOBEGIN, param); if(!command_buffer.compare("w")) { if(param_buffer.length() == 0) { param = 0; } return Command(CHANGEFOCUS, param); } if(!command_buffer.compare("G")) { if(param_buffer.length()) { return Command(GOTO, param); } else { return Command(GOTOEND, param); } } if(!command_buffer.compare("d")) return Command(DISPLAYMODE, param); if(!command_buffer.compare("f")) return Command(SETFRAME, param); if(!command_buffer.compare("n")) return Command(NAMEWIDTH, param); if(!command_buffer.compare(";")) return Command(SPECIAL, param); if(!command_buffer.compare("c")) return Command(COMPARE, param); // if no matches, clear the buffers param_buffer = ""; command_buffer = ""; on_command = false; on_param = true; param = 1; } } }
void CGnuplot::SetYLabel(const char* format) { Command("set ylabel '%s'", format); }
void FieldExcinguish(uchar x, uchar y) { Command ret=Command(255,4,256*x+y); if(activegame)emit ServerCommand(ret); }
void FieldChange(uchar x, uchar y,uchar newtype) { Command ret=Command(255,6,256*256*newtype+256*x+y); if(activegame)emit ServerCommand(ret); }
void GlobalCommands_insert(const char* name, const Callback& callback, const Accelerator& accelerator) { bool added = g_commands.insert(Commands::value_type(name, Command(callback, GlobalShortcuts_insert(name, accelerator)))).second; ASSERT_MESSAGE(added, "command already registered: " << makeQuoted(name)); }
void FieldBurning(uchar x, uchar y,uchar size, uchar id,uchar direction) { Command ret=Command(id,3,256*256*direction+256*x+y); if(activegame)emit ServerCommand(ret); }
bool CEvent::SetAttribute( enum E_EventAttribute inAttr, int32 inValue ) { uint8 cmd = Command(); switch (inAttr) { case EvAttr_StartTime: // start time SetStart( inValue ); return true; case EvAttr_Duration: // event duration if (HasProperty( Prop_Duration )) { SetDuration(1 > inValue ? 1 : inValue); return true; } return false; case EvAttr_StopTime: // event stop time return false; // Can't set stop -- must set duration case EvAttr_Type: // event type SetCommand( CLAMP( EvtType_End, inValue, EvtType_Count - 1 ) ); return true; case EvAttr_Selected: // Whether it's selected or not SetSelected( inValue != 0 ); return true; case EvAttr_Channel: // virtual channel number if (HasProperty( Prop_Channel )) SetVChannel( CLAMP( 0L, inValue, Max_Destinations ) ); return true; case EvAttr_Pitch: // pitch attribute if ( cmd == EvtType_Note || cmd == EvtType_NoteOff) { note.pitch = CLAMP( 0L, inValue, 127 ); return true; } else if (cmd == EvtType_PolyATouch) { aTouch.pitch = CLAMP( 0L, inValue, 127 ); return true; } else return false; case EvAttr_AttackVelocity: // attack velocity if ( cmd == EvtType_Note || cmd == EvtType_NoteOff) { note.attackVelocity = CLAMP( 1L, inValue, 127 ); return true; } else return false; case EvAttr_ReleaseVelocity: // release velocity if ( cmd == EvtType_Note || cmd == EvtType_NoteOff) { note.releaseVelocity = CLAMP( 0L, inValue, 127 ); return true; } else return false; case EvAttr_AfterTouch: // aftertouch value if ( cmd == EvtType_PolyATouch) { aTouch.value = CLAMP( 0L, inValue, 127 ); return true; } else return false; case EvAttr_Program: // program number attribute if ( cmd == EvtType_ProgramChange) { programChange.program = CLAMP( 0L, inValue, 127 ); return true; } return false; case EvAttr_ProgramBank: // program bank number if ( cmd == EvtType_ProgramChange) { inValue = CLAMP( 0L, inValue, 0x3fff ); programChange.bankMSB = inValue >> 7; programChange.bankLSB = inValue & 0x7f; return true; } return false; case EvAttr_VPos: // arbitrary vertical position if (HasProperty( Prop_VertPos )) repeat.vPos = CLAMP( 0L, inValue, 63 ); return false; case EvAttr_ControllerNumber: // controller number if (cmd == EvtType_Controller) { controlChange.controller = CLAMP( 0L, inValue, 127 ); } return false; case EvAttr_ControllerValue8: // 8-bit controller value if (cmd == EvtType_Controller) { controlChange.MSB = CLAMP( 0L, inValue, 127 ); controlChange.LSB = 0; } return false; case EvAttr_ControllerValue16: // 16-bit controller value if ( cmd == EvtType_Controller) { inValue = CLAMP( 0L, inValue, 0x3fff ); controlChange.MSB = inValue >> 7; controlChange.LSB = inValue & 0x7f; return true; }
int32 CEvent::GetAttribute( enum E_EventAttribute inAttr ) const { uint8 cmd = Command(); switch (inAttr) { case EvAttr_StartTime: // start time return Start(); case EvAttr_Duration: // event duration if (HasProperty( Prop_Duration )) return Duration(); return -1; case EvAttr_StopTime: // event stop time if (HasProperty( Prop_Duration )) return Stop(); return -1; case EvAttr_Type: // event type return Command(); case EvAttr_Selected: // Whether it's selected or not return IsSelected(); case EvAttr_Channel: // virtual channel number if (HasProperty( Prop_Channel )) return GetVChannel(); return -1; case EvAttr_Pitch: // pitch attribute if ( cmd == EvtType_Note || cmd == EvtType_NoteOff) return note.pitch; else if (cmd == EvtType_PolyATouch) return aTouch.pitch; else return -1; case EvAttr_AttackVelocity: // attack velocity if ( cmd == EvtType_Note || cmd == EvtType_NoteOff) return note.attackVelocity; else return -1; case EvAttr_ReleaseVelocity: // release velocity if ( cmd == EvtType_Note || cmd == EvtType_NoteOff) return note.releaseVelocity; else return -1; case EvAttr_AfterTouch: // aftertouch value if ( cmd == EvtType_PolyATouch) return aTouch.value; else return -1; case EvAttr_Program: // program number attribute if ( cmd == EvtType_ProgramChange) return programChange.program; else return -1; case EvAttr_ProgramBank: // program bank number if ( cmd == EvtType_ProgramChange) return (programChange.bankMSB << 7) | programChange.bankLSB; else return -1; case EvAttr_VPos: // arbitrary vertical position if (HasProperty( Prop_VertPos )) return repeat.vPos; return -1; case EvAttr_ControllerNumber: // controller number if (cmd == EvtType_Controller) return controlChange.controller; return -1; case EvAttr_ControllerValue8: // 8-bit controller value if (cmd == EvtType_Controller) return controlChange.MSB; return -1; case EvAttr_ControllerValue16: // 16-bit controller value if (cmd == EvtType_Controller) return (controlChange.MSB << 7) | controlChange.LSB; return -1; case EvAttr_BendValue: // 16-bit pitch-bend value if (cmd == EvtType_PitchBend) return pitchBend.targetBend - 0x2000; return -1; case EvAttr_InitialBend: // 16-bit pitch-bend value if (cmd == EvtType_PitchBend) return pitchBend.startBend - 0x2000; return -1; case EvAttr_UpdatePeriod: // update period in ticks if (cmd == EvtType_PitchBend || cmd == EvtType_Controller || cmd == EvtType_ChannelATouch) return pitchBend.updatePeriod; return -1; case EvAttr_TempoValue: // tempo value if (cmd == EvtType_Tempo) return tempo.newTempo; return -1; case EvAttr_RepeatCount: // repeat count if (cmd == EvtType_Repeat) return repeat.repeatCount; return -1; case EvAttr_SequenceNumber: // sequence number if (cmd == EvtType_Sequence) return sequence.sequence; return -1; case EvAttr_Transposition: // transposition if (cmd == EvtType_Sequence) return sequence.transposition; return -1; case EvAttr_Modulation: // Modulation value if ( cmd == EvtType_Controller && controlChange.controller == 1) { return (controlChange.MSB << 7) | controlChange.LSB; } return -1; case EvAttr_TSigBeatCount: if (cmd == EvtType_TimeSig) return sigChange.numerator; return -1; case EvAttr_TSigBeatSize: if (cmd == EvtType_TimeSig) return sigChange.denominator; return -1; case EvAttr_CountourLevel: // level for countour events case EvAttr_DataSize: // Size of extended data default: return -1; } }
bool CEvent::HasAttribute( enum E_EventAttribute inAttr ) const { uint8 cmd = Command(); switch (inAttr) { case EvAttr_StartTime: // start time case EvAttr_Type: // event type case EvAttr_Selected: // Whether it's selected or not return true; case EvAttr_Duration: // event duration case EvAttr_StopTime: // event stop time return HasProperty( Prop_Duration ); case EvAttr_Channel: // virtual channel number return HasProperty( Prop_Channel ); case EvAttr_Pitch: // pitch attribute return ( cmd == EvtType_Note || cmd == EvtType_NoteOff || cmd == EvtType_PolyATouch) ; case EvAttr_AttackVelocity: // attack velocity case EvAttr_ReleaseVelocity: // release velocity return ( cmd == EvtType_Note || cmd == EvtType_NoteOff) ; case EvAttr_AfterTouch: // aftertouch value return ( cmd == EvtType_ChannelATouch || cmd == EvtType_PolyATouch) ; case EvAttr_Program: // program number attribute case EvAttr_ProgramBank: // program bank number return (cmd == EvtType_ProgramChange) ; case EvAttr_ControllerNumber: // controller number return (cmd == EvtType_Controller) ; case EvAttr_ControllerValue8: // 8-bit controller value if (cmd == EvtType_Controller) { // uint8 ctl = controlChange.controller; // Questionable...for now I assume that all 16-bit controllers // can in fact be set with just the MSB only return true; } return false; case EvAttr_ControllerValue16: // 16-bit controller value if (cmd == EvtType_Controller) { uint8 ctl = controlChange.controller; return ( ctl <= 31 || ctl >= 98 && ctl <= 101); } return false; case EvAttr_Modulation: // Modulation value return ( cmd == EvtType_Controller && controlChange.controller == 1 ); case EvAttr_BendValue: // 16-bit pitch-bend value case EvAttr_InitialBend: // 16-bit pitch-bend initial value return (cmd == EvtType_PitchBend) ; case EvAttr_UpdatePeriod: // 16-bit update period return ( cmd == EvtType_PitchBend || cmd == EvtType_Controller || cmd == EvtType_ChannelATouch) ; case EvAttr_TempoValue: // tempo value return (cmd == EvtType_Tempo) ; case EvAttr_RepeatCount: // repeat count return (cmd == EvtType_Repeat) ; case EvAttr_DataSize: // Size of extended data return (cmd == EvtType_SysEx || cmd == EvtType_Text || EvtType_UserEvent) ; case EvAttr_SequenceNumber: // sequence number return (cmd == EvtType_Sequence); case EvAttr_Transposition: // transposition return (cmd == EvtType_Sequence); case EvAttr_TSigBeatCount: case EvAttr_TSigBeatSize: return (cmd == EvtType_TimeSig); case EvAttr_VPos: return HasProperty( Prop_VertPos ); case EvAttr_CountourLevel: // level for countour events default: return false; } }
std::string VerifyJson::Usage() const { return Command() + " [dir path]"; }
void PlayerBlast(uchar id) { Command ret=Command(id,5,256); if(activegame)emit ServerCommand(ret); }
Command ObjectMoveCommand::to_command() { return Command(impl); }
void ChangeBonus(uchar x, uchar y, uchar type,uchar visibleorstate) { Command ret=Command(0,7,(visibleorstate*256*256*256)+(256*256*type)+(256*x)+y); if(activegame)emit ServerCommand(ret); }
void CGnuplot::DrawFunc(const char* format) { Command("plot %s", format); }
void PlayerInvisibility(uchar playerid,bool visible) { Command ret=Command(playerid,7,(((visible?3:4))*256*256*256)); if(activegame)emit ServerCommand(ret); }
void CGnuplot::SetXRange(const double x_min, const double x_max) { Command("set xrange [%f:%f]", x_min, x_max); }
void lcm_ILI9325_setup( void ) { #define Command(gw_cmd) *pcmd = gw_cmd #define Data(gw_data) *pdata = gw_data dispReg_t *pdispReg = (dispReg_t *)(LOGI_ADDR_DISP_REG); volatile unsigned short *pcmd = (volatile unsigned short *) &pdispReg->dispLcmPgmIo00; volatile unsigned short *pdata = (volatile unsigned short *) &pdispReg->dispLcmPgmIo10;//dispLcmPgmIo30; // Start Initial Sequence Command(0x00E3); Data(0x3008); // Set internal timing Command(0x00E7); Data(0x0012); // Set internal timing Command(0x00EF); Data(0x1231); // Set internal timing Command(0x0001); Data(0x0100); // set SS and SM bit Command(0x0002); Data(0x0700); // set 1 line inversion Command(0x0003); Data(0x1018); // set GRAM write direction and BGR=1. Command(0x0004); Data(0x0000); // Resize register Command(0x0008); Data(0x0207); // set the back porch and front porch Command(0x0009); Data(0x0000); // set non-display area refresh cycle ISC[3:0] Command(0x000A); Data(0x0000); // FMARK function Command(0x000C); Data(0x0000); // RGB interface setting Command(0x000D); Data(0x0000); // Frame marker Position Command(0x000F); Data(0x0000); // RGB interface polarity // Power On sequence Command(0x0010); Data(0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB Command(0x0011); Data(0x0007); // DC1[2:0], DC0[2:0], VC[2:0] Command(0x0012); Data(0x0000); // VREG1OUT voltage Command(0x0013); Data(0x0000); // VDV[4:0] for VCOM amplitude mdelay(10); // Dis-charge capacitor power voltage Command(0x0010); Data(0x1490); // SAP, BT[3:0], AP, DSTB, SLP, STB Command(0x0011); Data(0x0227); // DC1[2:0], DC0[2:0], VC[2:0] mdelay(10); // Delay 50ms Command(0x0012); Data(0x001D); // Internal reference voltage= Vci; mdelay(10); // Delay 50ms Command(0x0013); Data(0x0800); // Set VDV[4:0] for VCOM amplitude Command(0x0029); Data(0x0045); // Set VCM[5:0] for VCOMH Command(0x002B); Data(0x000D); // Set Frame Rate mdelay(10); // Delay 50ms Command(0x0020); Data(0x0000); // GRAM horizontal Address Command(0x0021); Data(0x0000); // GRAM Vertical Address // Adjust the Gamma Curve Command(0x0030); Data(0x0007); Command(0x0031); Data(0x0707); Command(0x0032); Data(0x0006); Command(0x0035); Data(0x0704); Command(0x0036); Data(0x1F04); Command(0x0037); Data(0x0004); Command(0x0038); Data(0x0000); Command(0x0039); Data(0x0706); Command(0x003C); Data(0x0701); Command(0x003D); Data(0x000F); // Set GRAM area Command(0x0050); Data(0x0000); // Horizontal GRAM Start Address Command(0x0051); Data(0x00EF); // Horizontal GRAM End Address Command(0x0052); Data(0x0000); // Vertical GRAM Start Address Command(0x0053); Data(0x013F); // Vertical GRAM Start Address Command(0x0060); Data(0xA700); // Gate Scan Line Command(0x0061); Data(0x0001); // NDL,VLE, REV Command(0x006A); Data(0x0000); // set scrolling line // Partial Display Control Command(0x0080); Data(0x0000); Command(0x0081); Data(0x0000); Command(0x0082); Data(0x0000); Command(0x0083); Data(0x0000); Command(0x0084); Data(0x0000); Command(0x0085); Data(0x0000); // Panel Control Command(0x0090); Data(0x0010); Command(0x0092); Data(0x0600); Command(0x0093); Data(0x0003); Command(0x0095); Data(0x0110); Command(0x0097); Data(0x0000); Command(0x0098); Data(0x0000); Command(0x0007); Data(0x0133); // 262K color and display ON Command(0x0022); }
void CGnuplot::Replot() { Command("replot"); }
std::string FixMirror::Usage() const { return Command() + " [dir]"; }
CGConsole::CGConsole(void) { // All recognised commands m_commands.push_back( Command("pull", "Pulling all coins toward the player.", "Launches all coins to the player.", Pull) ); m_commands.push_back( Command("bounce", "Bouncing.", "Bounces all throwables up into the air.", BounceUp) ); m_commands.push_back( Command("set_bounce", "Bouncing set.", "Pass an int boolean to set the bounciness of all throwables.", SetBouncy) ); m_commands.push_back( Command("toggle_pull", "Pull toggled. When enabled, press 1 to pull all coins toward the player.", "Toggles the pull ability. Activate by pressing hotkey: 1", TogglePull) ); m_commands.push_back( Command("mag", "Magnetism Toggled", "Toggles player magnetism, making it easier to collect coins.", ToggleMagnetism) ); m_commands.push_back( Command("smash", "Smash Activated.", "Simulates the 'Smash' Ability.", Smash) ); m_commands.push_back( Command("smash_wave", "Wave Smash activated.", "Simulates the 'Smash Wave' Ability.", SmashWave) ); m_commands.push_back( Command("mute", "Muted all sounds.", "Mutes coin collection sound effects.", Mute) ); m_commands.push_back( Command("unmute", "Restored all sounds.", "Restores all coin collection sound effects.", Unmute) ); m_commands.push_back( Command("add_coins", "Coins added.", "Adds a specified number of coins to the player's wallet.", AddCoins) ); m_commands.push_back( Command("max", "Coins added. So many coins.", "Adds 999999999 coins to the player's wallet.", AddCoins_Large) ); m_commands.push_back( Command("double_coins", "Coins have been doubled", "Doubles the player's coins in their wallet.", DoubleCoins) ); m_commands.push_back( Command("dispense", "Dispensing...", "Dispenses a specified number of coins directly into the game. May be unstable.", Dispense) ); m_commands.push_back( Command("home", "Homing in on player.", "Sets all collectables' homing property to true.", HomeIn) ); m_commands.push_back( Command("calc", "Calculating: ", "Performs a calculation. May change depending on the developer's choice of debug calculation.", Calc) ); m_commands.push_back( Command("offset", "Setting the offset ", "Gives a manual value to the rendering offset values, x and y respectively.", SetRenderOffset) ); m_commands.push_back( Command("j", "Yes sir.", "Jordan's preset of debug calls. Changes upon his mood. Originally [mag], [toggle_pull] and [mute].", j) ); m_commands.push_back( Command("exp", "Exploding particles", "Adds a small, standard explosion of simple particles at (320,320).", ParticleExplosion) ); m_commands.push_back( Command("talk", "", "Tests speech bubbles by making the player talk", Talk) ); m_commands.push_back( Command("collision_debug", "", "Draws the player's hit box and AABB for collision debugging.", ShowPlayerCollisionBoxes) ); m_commands.push_back( Command("damage", "Ow!", "Damages the player.", DamagePlayer) ); m_commands.push_back( Command("cost", "", "Prints the cost of the current room's dispenser.", PrintCost) ); m_commands.push_back( Command("wallet", "", "Prints the wallet for the current room.", PrintWallet) ); }
/** * Compute the route from current position to specified position, * and setup the system to go there. */ void NavSystem::go(Vector new_pos) { nav_act.resetStateTime(); Vector tracking_pos = current_pos; Vector tracking_dir = current_dir; if (current_pos == START_POS) { commands.insert(Command(FOLLOW_LIMIT)); desired_dir = WEST; desired_pos = new_pos; next(); return; } commands.insert(Command(BACK_UP)); commands.insert(Command(TURN_AROUND)); tracking_dir = -tracking_dir; commands.insert(Command(FOLLOW_COUNT, 1)); tracking_pos += tracking_dir; int dist_along_center = new_pos.x - tracking_pos.x; int turn_dir = tracking_dir.cross(Vector{dist_along_center,0}); if (turn_dir > 0) { commands.insert(Command(FORWARD)); commands.insert(Command(TURN_LEFT)); tracking_dir.rotate(LEFT); } else if (turn_dir < 0) { commands.insert(Command(FORWARD)); commands.insert(Command(TURN_RIGHT)); tracking_dir.rotate(RIGHT); } if (abs(dist_along_center) > 0) { commands.insert(Command(FOLLOW_COUNT, abs(dist_along_center))); } turn_dir = tracking_dir.cross(Vector{0, new_pos.y}); if (turn_dir > 0) { commands.insert(Command(FORWARD)); commands.insert(Command(TURN_LEFT)); tracking_dir.rotate(LEFT); } else if (turn_dir < 0) { commands.insert(Command(FORWARD)); commands.insert(Command(TURN_RIGHT)); tracking_dir.rotate(RIGHT); } // Every navigation ends at a limit commands.insert(Command(FOLLOW_LIMIT)); desired_dir = tracking_dir; desired_pos = new_pos; next(); }
void CFactoryCAI::GiveCommandReal(const Command& c, bool fromSynced) { const int cmdID = c.GetID(); // move is always allowed for factories (passed to units it produces) if ((cmdID == CMD_SET_WANTED_MAX_SPEED) || ((cmdID != CMD_MOVE) && !AllowedCommand(c, fromSynced))) { return; } map<int, BuildOption>::iterator boi = buildOptions.find(cmdID); // not a build order (or a build order we do not support, eg. if multiple // factories of different types were selected) so queue it to built units if (boi == buildOptions.end()) { if (cmdID < 0) return; if ((nonQueingCommands.find(cmdID) != nonQueingCommands.end()) || (cmdID == CMD_INSERT) || (cmdID == CMD_REMOVE) || (!(c.options & SHIFT_KEY) && ((cmdID == CMD_WAIT) || (cmdID == CMD_SELFD)))) { CCommandAI::GiveAllowedCommand(c); return; } if (!(c.options & SHIFT_KEY)) { waitCommandsAI.ClearUnitQueue(owner, newUnitCommands); CCommandAI::ClearCommandDependencies(); newUnitCommands.clear(); } CCommandAI::AddCommandDependency(c); if (cmdID != CMD_STOP) { if ((cmdID == CMD_WAIT) || (cmdID == CMD_SELFD)) { if (!newUnitCommands.empty() && (newUnitCommands.back().GetID() == cmdID)) { if (cmdID == CMD_WAIT) { waitCommandsAI.RemoveWaitCommand(owner, c); } newUnitCommands.pop_back(); } else { newUnitCommands.push_back(c); } } else { bool dummy; if (CancelCommands(c, newUnitCommands, dummy) > 0) { return; } else { if (GetOverlapQueued(c, newUnitCommands).empty()) { newUnitCommands.push_back(c); } else { return; } } } } // the first new-unit build order can not be WAIT or SELFD while (!newUnitCommands.empty()) { const Command& newUnitCommand = newUnitCommands.front(); const int id = newUnitCommand.GetID(); if ((id == CMD_WAIT) || (id == CMD_SELFD)) { if (cmdID == CMD_WAIT) { waitCommandsAI.RemoveWaitCommand(owner, c); } newUnitCommands.pop_front(); } else { break; } } return; } BuildOption& bo = boi->second; int numItems = 1; if (c.options & SHIFT_KEY) { numItems *= 5; } if (c.options & CONTROL_KEY) { numItems *= 20; } if (c.options & RIGHT_MOUSE_KEY) { bo.numQued -= numItems; bo.numQued = std::max(bo.numQued, 0); int numToErase = numItems; if (c.options & ALT_KEY) { for (unsigned int cmdNum = 0; cmdNum < commandQue.size() && numToErase; ++cmdNum) { if (commandQue[cmdNum].GetID() == cmdID) { commandQue[cmdNum] = Command(CMD_STOP); numToErase--; } } } else { for (int cmdNum = commandQue.size() - 1; cmdNum != -1 && numToErase; --cmdNum) { if (commandQue[cmdNum].GetID() == cmdID) { commandQue[cmdNum] = Command(CMD_STOP); numToErase--; } } } UpdateIconName(cmdID, bo); SlowUpdate(); } else { if (c.options & ALT_KEY) { for (int a = 0; a < numItems; ++a) { if (repeatOrders) { Command nc(c); nc.options |= INTERNAL_ORDER; if (commandQue.empty()) { commandQue.push_front(nc); } else { commandQue.insert(commandQue.begin()+1, nc); } } else { commandQue.push_front(c); } } if (!repeatOrders) { CFactory* fac = static_cast<CFactory*>(owner); fac->StopBuild(); } } else { for (int a = 0; a < numItems; ++a) { commandQue.push_back(c); } } bo.numQued += numItems; UpdateIconName(cmdID, bo); SlowUpdate(); } }
std::string ChangeComplexOrigin::Usage() const { return Command() + " [dir]"; }
// Main dialog procedure UINT EmMainDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { NMHDR *n; RPC *r = (RPC *)param; UINT i; char *name; // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: EmMainInit(hWnd, r); break; case WM_COMMAND: switch (wParam) { case IDOK: // Edit i = LvGetSelected(hWnd, L_LIST); if (i != INFINITE) { wchar_t *tmp; tmp = LvGetStr(hWnd, L_LIST, i, 0); if (tmp != NULL) { name = CopyUniToStr(tmp); EmAdd(hWnd, r, name); Free(tmp); Free(name); } } break; case B_PASSWORD: // Admin password Dialog(hWnd, D_EM_PASSWORD, EmPasswordDlg, r); break; case B_LICENSE: // Admin password Dialog(hWnd, D_EM_LICENSE, EmLicenseDlg, r); break; case B_ADD: // Add EmAdd(hWnd, r, NULL); EmMainRefresh(hWnd, r); break; case B_DELETE: // Delete i = LvGetSelected(hWnd, L_LIST); if (i != INFINITE) { wchar_t *tmp; tmp = LvGetStr(hWnd, L_LIST, i, 0); if (tmp != NULL) { RPC_DELETE_DEVICE t; wchar_t msg[MAX_SIZE]; name = CopyUniToStr(tmp); UniFormat(msg, sizeof(msg), _UU("EM_DELETE_CONFIRM"), name); if (MsgBox(hWnd, MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2, msg) == IDYES) { Zero(&t, sizeof(t)); StrCpy(t.DeviceName, sizeof(t.DeviceName), name); if (CALL(hWnd, EcDelDevice(r, &t))) { EmMainRefresh(hWnd, r); } } Free(tmp); Free(name); } } break; case IDCANCEL: Close(hWnd); break; } break; case WM_TIMER: switch (wParam) { case 1: KillTimer(hWnd, 1); EmMainRefresh(hWnd, r); SetTimer(hWnd, 1, 1000, NULL); break; } break; case WM_NOTIFY: n = (NMHDR *)lParam; switch (n->code) { case NM_DBLCLK: switch (n->idFrom) { case L_LIST: if (IsEnable(hWnd, IDOK)) { Command(hWnd, IDOK); } break; } break; case LVN_ITEMCHANGED: switch (n->idFrom) { case L_LIST: EmMainUpdate(hWnd, r); break; } break; } break; case WM_CLOSE: EndDialog(hWnd, 0); break; } return 0; }
CR_RESERVED(16), CR_POSTLOAD(PostLoad) )); CR_BIND_DERIVED(CWaitCommandsAI::TimeWait, CWaitCommandsAI::Wait, (1,0)); CR_REG_METADATA_SUB(CWaitCommandsAI,TimeWait , ( CR_MEMBER(unit), CR_MEMBER(enabled), CR_MEMBER(duration), CR_MEMBER(endFrame), CR_MEMBER(factory), CR_RESERVED(16) )); CR_BIND_DERIVED(CWaitCommandsAI::DeathWait, CWaitCommandsAI::Wait, (Command())); CR_REG_METADATA_SUB(CWaitCommandsAI,DeathWait , ( CR_MEMBER(waitUnits), CR_MEMBER(deathUnits), CR_MEMBER(unitPos), CR_RESERVED(16) )); CR_BIND_DERIVED(CWaitCommandsAI::SquadWait, CWaitCommandsAI::Wait, (Command())); CR_REG_METADATA_SUB(CWaitCommandsAI,SquadWait , ( CR_MEMBER(squadCount), CR_MEMBER(buildUnits), CR_MEMBER(waitUnits), CR_MEMBER(stateText),