void KObj::SetImageDir(int nDir) { #ifdef _SERVER m_cImage.SetCurDir(nDir); SetDir(m_cImage.m_nCurDir * 64 / m_cImage.m_nTotalDir); #else m_cImage.SetCurDir(nDir); SetDir(m_cImage.m_nCurDir * 64 / m_cImage.m_nTotalDir); #endif }
public func Activate(caster, real_caster) { var clonk = caster; if (real_caster) clonk = real_caster; Sound("Magic1"); var iChkEff; if (iChkEff = CheckEffect("FirefistNSpell", 0, 130)) return(iChkEff!=-1 && RemoveObject()); var obj, nocrcnt; if (InLiquid(clonk) && (obj = FindContents(METL, clonk))) { var torpedo; SetDir(DIR_Left(), torpedo=CreateObject(TRP1,-15,+10,-1)); if (torpedo) { torpedo->Launch(torpedo); // Kleiner Trick damit das Torpedo in die richtige Richtung schwimmt torpedo->SetController(GetOwner(clonk)); // Damit eventuelle Tötungen auch gezählt werden } else ++nocrcnt; SetDir(DIR_Right(), torpedo=CreateObject(TRP1,+15,+10,-1)); if (torpedo) { torpedo->Launch(torpedo); torpedo->SetController(GetOwner(clonk)); } else ++nocrcnt; if (nocrcnt < 2) RemoveObject(obj); } else { var firefist=CreateObject(FSHW,-15,0,GetOwner(clonk)); if (firefist) { firefist->SetController(GetOwner(clonk)); ObjectSetAction(firefist,"Left"); } else ++nocrcnt; firefist=CreateObject(FSHW,+15,0,GetOwner(clonk)); if (firefist) { firefist->SetController(GetOwner(clonk)); ObjectSetAction(firefist,"Right"); } else ++nocrcnt; } RemoveObject(); return(nocrcnt < 2); }
void DirMngr::SetProgramDir(QString dir) { QFileInfo applInfo(dir); programDir=applInfo.absolutePath(); if(programDir.right(1)!="\\" && programDir.right(1)!="/")programDir+=DIR_SEP; configDir=programDir; data1Dir=programDir; data2Dir=programDir; data3Dir=programDir; SetDir(QDir::tempPath(),DIR_TEMP); SetDir(QDir::homePath(),DIR_HOME); #ifdef Q_WS_WIN #else SetDir(getenv("HOME"),DIR_HOME); #endif }
protected func Initialize() { // Zufällige Größe if (Random(5)) DoCon(-Random(20) - 40); else DoCon(-Random(50) - 20); // Zufällige Form SetAction("Grass"); SetPhase(Random(2)); if (!Random(20)) SetPhase(2); // Zufällige Richtung if (Random(2)) SetDir(DIR_Right); // Drehung nach Erdoberfläche var x_off = 18 * GetCon() / 100; var y_off = 15 * GetCon() / 100; var slope = GetSolidOffset(-x_off, y_off) - GetSolidOffset(x_off, y_off); SetR(slope); // Höhe anpassen while (!GBackSolid(0, 5)) SetPosition(GetX(), GetY() + 1); // Gras bleibt hinter Bäumen MoveBehindTrees(); ScheduleCall(0, "ListenToTime", 1); }
CLocalTreeView::CLocalTreeView(wxWindow* parent, wxWindowID id, CState *pState, CQueueView *pQueueView) : wxTreeCtrlEx(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTR_EDIT_LABELS | wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxNO_BORDER), CSystemImageList(16), CStateEventHandler(pState), m_pQueueView(pQueueView) { wxGetApp().AddStartupProfileRecord(_T("CLocalTreeView::CLocalTreeView")); #ifdef __WXMAC__ SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); #endif pState->RegisterHandler(this, STATECHANGE_LOCAL_DIR); pState->RegisterHandler(this, STATECHANGE_APPLYFILTER); SetImageList(GetSystemImageList()); #ifdef __WXMSW__ m_pVolumeEnumeratorThread = 0; CreateRoot(); #else wxTreeItemId root = AddRoot(_T("/")); SetItemImage(root, GetIconIndex(dir), wxTreeItemIcon_Normal); SetItemImage(root, GetIconIndex(opened_dir), wxTreeItemIcon_Selected); SetItemImage(root, GetIconIndex(dir), wxTreeItemIcon_Expanded); SetItemImage(root, GetIconIndex(opened_dir), wxTreeItemIcon_SelectedExpanded); SetDir(_T("/")); #endif SetDropTarget(new CLocalTreeViewDropTarget(this)); }
void Ve1ObjectChar::MoveTo(const Vec3f& newpos) { m_newPos = newpos; m_isMoving = true; Vec3f dir = GetPos() - newpos; float sqLen = dir.SqLen(); // TODO Check if distance is greater than last time - if so, we have missed the target! static const float STOP_DIST = ROConfig()->GetFloat("stop-dist", 10.0f); if (sqLen < STOP_DIST) { SetVel(Vec3f(0, 0, 0)); m_isMoving = false; // Not sure why this wasn't here } // TODO enable this when we are reliably resetting sqLenLastTime, otherwise sometimes characters won't move /* else if (sqLen > sqLenLastTime) { SetVel(Vec3f(0, 0, 0)); m_isMoving = false; // Not sure why this wasn't here } */ else { dir.Normalise(); SetVel(-dir * SPEED); // Work out direction to face SetDir(RadToDeg(atan2((double)m_vel.x, (double)m_vel.z))); } sqLenLastTime = sqLen; }
func timer_call() //´s gat it deshalb moch i´s nui { if(!parent) RemoveObject(); SetDir(GetDir(parent)); SetPosition(GetX(parent)-215+430*GetDir(),GetY(parent)+6); return(1); }
void CLocalTreeView::OnStateChange(unsigned int event, const wxString& data) { if (event == STATECHANGE_LOCAL_DIR) SetDir(m_pState->GetLocalDir()); else if (event == STATECHANGE_APPLYFILTER) Refresh(); }
sBool sBrowserList::OnCommand(sU32 cmd) { sDiskItem *di,*dir; switch(cmd) { case sDIC_EXECUTE: if(LastSelection) LastSelection->Cmd(cmd,0,0); return sTRUE; case sBLCMD_POPUP: if(LastSelection) Popup(LastSelection); return sTRUE; case sBLCMD_PARENT: di = Dir->GetParent(); if(di) { dir = Dir; SetDir(di); Select(dir); } return sTRUE; default: return sFALSE; } }
eOSState cCMDDir::New(void) { MYDEBUG("Verzeichnis: Neu"); cFileInfo *info = new cFileInfo(CurrentDir()); if(!info->isWriteable()) { MYDEBUG("Verzeichnis: Neu: Keine Berechtigung in %s", CurrentDir()); OSD_ERRMSG(tr("no rights to create")); } else { State = csDirNew; SetCols(5); SetTitle(CurrentDir()); SetDir(); cMainMenuItem *mItem = (cMainMenuItem*)First(); Ins(new cMenuEditStrItem(tr("New"), Dir, MaxFileName, trVDR(FileNameChars)), true, mItem); while(mItem) { mItem->SetSelectable(false); mItem = (cMainMenuItem*)Next(mItem); } Display(); cOsdMenu::ProcessKey(kRight); } return osContinue; }
SMJS_Plugin *LoadPlugin(const char *dir){ auto plugin = SMJS_Plugin::GetPluginByDir(dir); if(plugin != NULL) return plugin; bool isSandboxed = true; for(auto it = trustedPlugins.begin(); it != trustedPlugins.end(); ++it){ if(strcmp(dir, it->c_str()) == 0){ isSandboxed = false; break; } } plugin = new SMJS_Plugin(isSandboxed); char path[512]; smutils->BuildPath(Path_SM, path, sizeof(path), "plugins.js/%s", dir); plugin->SetDir(dir); plugin->SetPath(path); plugin->LoadModules(); plugin->CheckApi(); if(!plugin->LoadFile("Main.js", true)){ delete plugin; return NULL; } // Late loading if(smutils->IsMapRunning()){ HandleScope handle_scope(plugin->GetIsolate()); Context::Scope context_scope(plugin->GetContext()); auto hooks = plugin->GetHooks("OnMapStart"); for(auto it = hooks->begin(); it != hooks->end(); ++it){ (*it)->Call(plugin->GetContext()->Global(), 0, NULL); } for(int i = 0; i < sizeof(clients) / sizeof(clients[0]); ++i){ if(clients[i] == NULL) continue; v8::Handle<v8::Value> arg = clients[i]->GetWrapper(plugin); hooks = plugin->GetHooks("OnClientConnected"); for(auto it = hooks->begin(); it != hooks->end(); ++it){ (*it)->Call(plugin->GetContext()->Global(), 1, &arg); } if(clients[i]->inGame){ hooks = plugin->GetHooks("OnClientPutInGame"); for(auto it = hooks->begin(); it != hooks->end(); ++it){ (*it)->Call(plugin->GetContext()->Global(), 1, &arg); } } } } return plugin; }
ringDir::ringDir(LPCTSTR szDir) { m_handle = NULL; memset(m_szDir,0,MAX_PATH*sizeof(TCHAR)); memset(m_szCurrDir,0,MAX_PATH*sizeof(TCHAR)); if(szDir) SetDir(szDir); }
void B9Edit::openJob(QString infile) { QSettings settings; if(infile.isEmpty()) { QFileDialog dialog(this); infile = dialog.getOpenFileName(this,"Open B9 Job", settings.value("WorkingDir").toString(),tr("B9 Job Files (*.b9j);;All files (*.*)")); if(infile.isEmpty())//user hits cancel.... return; } if(dirtied) { QMessageBox::StandardButton ret; ret = QMessageBox::warning(this, tr("B9Edit"), tr("The document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (ret == QMessageBox::Yes) { saveJob(); } else if (ret == QMessageBox::Cancel) { return; } } QFile file(infile); SetDir(QFileInfo(file).absolutePath()); if(!cPJ.loadCPJ(&file)) { QMessageBox::warning(this, tr("B9Edit"), QString("Unable To Load Job:\n" +QFileInfo(infile).baseName()),QMessageBox::Ok); return; } currJobFile = infile; emit setVersion(cPJ.getVersion()); emit setName(cPJ.getName()); emit setDescription(cPJ.getDescription()); emit setXYPixel(QString().number(cPJ.getXYPixel().toDouble()*1000)); emit setZLayer(QString().number(cPJ.getZLayer().toDouble()*1000)); dirtied = false; updateSliceIndicator(); updateWindowTitle(); pEditView->ClearUndoBuffer(); pEditView->GoToSlice(0); pEditView->UpdateWidgets(); }
void Cam2d::InitScreenSpaceSize( v2 size ) { ASSERT( size != v2(0.0f) ); SetNearFar( v2(-150.0f, 150.0f) ); SetBounds( -size*0.5f, size*0.5f ); SetPos( v3(size*0.5f) ); SetDir( v3(0.f, 0.f, -1.f) ); }
void xLightsFrame::OnMenuOpenFolderSelected(wxCommandEvent& event) { wxString newdir; if (DirDialog1->ShowModal() == wxID_OK) { newdir=DirDialog1->GetPath(); if (newdir == CurrentDir) return; SetDir(newdir); } }
void CLocalTreeView::OnStateChange(CState* pState, enum t_statechange_notifications notification, const wxString& data, const void* data2) { if (notification == STATECHANGE_LOCAL_DIR) SetDir(m_pState->GetLocalDir().GetPath()); else { wxASSERT(notification == STATECHANGE_APPLYFILTER); Refresh(); } }
int PullPower::Callback(unsigned int msg, unsigned int wParam, int lParam) { switch(msg) { case ENTITYMSG_UPDATE: { EntityCommon *pEntity = (EntityCommon *)IDPageQuery(GetOwner()); if(pEntity) { //////////////////////////////////////////////////////// //set location SetLoc(pEntity->GetLoc()+(m_maxLength*pEntity->GetDir())); //set direction SetDir(-pEntity->GetDir()); //set vel. SetVel(-m_maxLength*pEntity->GetDir()); //move it /*float spd = m_spd.MoveUpdate(g_timeElapse); m_curLength += spd; if(m_curLength >= m_maxLength) { //Poll ourself to death! SetFlag(ENTITY_FLAG_POLLDEATH, true); }*/ } } break; case ENTITYMSG_ENTITYCOLLIDE://, (WPARAM)pEntity { //sigh... EntityCommon *pEntity = (EntityCommon *)wParam; if(pEntity->CheckFlag(ENTITY_FLAG_PULLABLE)) { pEntity->SetLoc(pEntity->GetLoc()); pEntity->SetVel(pEntity->GetVel() +(m_spd.MoveUpdate(g_timeElapse)*GetDir())); } } break; case ENTITYMSG_ALLOWGRAVITY: //simply don't allow gravity return 0; } return RETCODE_SUCCESS; }
int Doodad::Callback(unsigned int msg, unsigned int wParam, int lParam) { switch(msg) { case ENTITYMSG_UPDATE: //Update waypoint if(m_pWayPt) { D3DXVECTOR3 destPt, target, lookDir; //GetCurrentLinearLoc(&destPt); m_pWayPt->GetCurrentCurvedLoc(&destPt, &target); lookDir = target - GetLoc(); //D3DXVec3Normalize(&lookDir, &lookDir); SetDir(lookDir); D3DXVECTOR3 dir(destPt - GetLoc()); float len = D3DXVec3Length(&dir); float spd = m_moveSpd.MoveUpdate(g_timeElapse); if(len > spd) { dir /= len; SetVel(GetVel() + (spd*dir)); } //we are close enough //get to next waypoint node else { SetVel(dir); m_pWayPt->GotoNext(); } //if(m_pWayPt->IsDone()) // RemoveWayPt(); } break; case ENTITYMSG_ALLOWGRAVITY: //simply don't allow gravity return 0; case ENTITYMSG_PROFILEPREP: Show(wParam == 1 ? true : false); break; } return RETCODE_SUCCESS; }
CShape::CShape(void) { m_lRegionID = 0; SetPosX(0.0f); SetPosY(0.0f); SetDir(0); SetPos(0); SetSpeed(2000.f); SetState(STATE_PEACE); SetAction(ACT_STAND); m_CurRgnType = RGN_NORMAL; }
CBillBoardAni::CBillBoardAni(LPDIRECT3DDEVICE9 device):CBillboard(device) { m_tex = NULL; m_type = MUL; m_xFrame = m_frames = 1; m_currFrame = 0; m_aniSpeed = m_currCount = 0; m_changeByCamera = false; m_dir = D3DXVECTOR3(1,0,0); SetDir(m_dir); }
Spit::Spit(const Id & owner, D3DXVECTOR3 loc, float spd, hMDL spitMdl, hTXT trailTxt, BYTE r, BYTE g, BYTE b, bool bBounce, int bounceMax, int sndInd) : _Spit(owner, spd, bBounce, bounceMax, sndInd), m_r(r), m_g(g), m_b(b) { EntityCommon *pEntity = (EntityCommon *)IDPageQuery(owner); if(pEntity) { //set the object SetOBJ(OBJCreate(0, spitMdl, 0,0,0, eOBJ_STILL, 0)); //set location SetLoc(loc); //set direction SetDir(pEntity->GetDir()); //set texture trail m_trailTxt = trailTxt; TextureAddRef(m_trailTxt); //set bound gfxBound bound; OBJGetBounds(GetOBJ(), &bound, true); BoundSetMin(D3DXVECTOR3(bound.min)); BoundSetMax(D3DXVECTOR3(bound.max)); BoundSetRadius(bound.radius); //create particle trail fxGas_init gasFX={0}; gasFX.gasTxt = m_trailTxt; gasFX.r = m_r; gasFX.g = m_g; gasFX.b = m_b; gasFX.maxParticle = 20; gasFX.scaleMax = bound.radius; gasFX.scaleDelayMin = 250; gasFX.scaleDelayMax = 500; gasFX.alphaDelayMin = 250; gasFX.alphaDelayMax = 500; gasFX.bRepeat = true; gasFX.spawnDelay = 100; memcpy(gasFX.min, bound.min, sizeof(bound.min)); memcpy(gasFX.max, bound.max, sizeof(bound.max)); PARFXCreate(ePARFX_GAS, &gasFX, -1, GetOBJ(), -1, 0); } SetFlag(PROJ_FLAG_PUSHBUTTON, true); }
void B9Edit::saveJobAs() { QSettings settings; QFileDialog dialog(this); QString saveFile = dialog.getSaveFileName(this,"Save B9 Job",settings.value("WorkingDir").toString() + "//" + sName,tr("B9 Job Files (*.b9j);;All files (*.*)")); QFile file(saveFile); SetDir(QFileInfo(file).absolutePath()); if(!cPJ.saveCPJ(&file)) return; currJobFile = saveFile; dirtied = false; }
func Launch(string type) { if (MOD_NoBlood()) return RemoveObject(); blood_type = type; SetGraphics(type); SetAction("Flying"); SetDir(Random(5)); ScheduleCall(this, this.Splatter, 1, 1); }
BOOL CGate::InitSetProperty(CServerRegion::tagGateProperty *p) { SetIndex(p->lIndex);//编号 CShape::SetPosXY( (float)(p->lxPos + 0.5),(float)(p->lyPos + 0.5) ); SetDir(p->lDir);//方向 CShape::SetState(p->wOpenState);//打开状态 CShape::SetAction(p->wOpenState);//动作 SetAttackScp(p->strAttack);//受攻击脚本 SetOpen(p->strOpen);//打开脚本 SetClose(p->strClose);//关闭脚本 SetDestoryScp(p->strDestory);//损毁脚本 SetRefreshScp(p->strRefresh);//重刷脚本 return TRUE; }
eOSState cCMDDir::Edit(cMainMenuItem *mItem) { MYDEBUG("Verzeichnis: Edit: %s", mItem->FileName()); cFileInfo *info = new cFileInfo(mItem->FileName()); if(!info->isWriteable()) { DELETENULL(info); info = new cFileInfo(CurrentDir()); if(!info->isWriteable()) { MYDEBUG("Verzeichnis: Edit: Keine Rechte"); OSD_ERRMSG(tr("no rights to rename")); DELETENULL(info); return osContinue; } } DELETENULL(info); info = new cFileInfo(mItem->FileName()); SetDir(info->FileName()); DELETENULL(info); State = csDirEdit; SetCols(11); SetTitle(CurrentDir()); cMainMenuItem *dmItem = NULL; mItem = (cMainMenuItem*)First(); while(mItem) { if(!strcasecmp(mItem->FileName(), LastSelDir())) { MYDEBUG("Verzeichnis: Edit: Item gefunden: %s", mItem->FileName()); Ins(new cMenuEditStrItem(tr("Rename"), Dir, MaxFileName, trVDR(FileNameChars)), true, mItem); dmItem = mItem; } mItem->SetSelectable(false); mItem = (cMainMenuItem*)Next(mItem); } if(dmItem) Del(dmItem->Index()); Display(); cOsdMenu::ProcessKey(kRight); return osContinue; }
protected func Construction() { _inherited(...); SetSkin(0); AddEffect("IntTurn", this, 1, 1, this); AddEffect("IntEyes", this, 1, 35+Random(4), this); AttachBackpack(); iHandMesh = [0,0]; SetAction("Walk"); SetDir(Random(2)); // Broadcast for rules GameCallEx("OnClonkCreation", this); }
CLuaDirSelector::CLuaDirSelector(const char *desc, const char *val) : CBaseLuaWidget(desc) { GtkWidget *hbox = gtk_hbox_new(FALSE, 10); gtk_widget_show(hbox); gtk_container_add(GTK_CONTAINER(GetBox()), hbox); m_pDirInput = gtk_entry_new(); SetDir(val); g_signal_connect(G_OBJECT(m_pDirInput), "changed", G_CALLBACK(InputChangedCB), this); gtk_widget_show(m_pDirInput); gtk_container_add(GTK_CONTAINER(hbox), m_pDirInput); GtkWidget *button = CreateButton(m_pDirButtonLabel = gtk_label_new(GetTranslation("Browse")), GTK_STOCK_OPEN); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(BrowseCB), m_pDirInput); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); }
// 開く bool Open(void){ bool result = false; portENTER_CRITICAL(); if (State != FSTATE_Config){ // コンフィギュレーションを開始 if (SPI::Open() == true){ Reset(); SetDir(PIN_FPGA_nINIT, DIR_IN); // INIT_BをHigh SPI::Close(); State = FSTATE_Config; result = true; xputs("Conf:open\n"); } } portEXIT_CRITICAL(); return result; }
// FPGAをリセット void Reset(void){ portENTER_CRITICAL(); // パイプが使用中でなかったらリセット //SetDir(PIN_FPGA_AUX0, DIR_IN); // M0ピンに繋がっているのでHi-Zにする //SetDir(PIN_FPGA_AUX1, DIR_IN); // MOSIピンに繋がっているのでHi-Zにする SetOut(PIN_FPGA_nPROG, OUT_LOW); // PROG_BをLow SetDir(PIN_FPGA_nINIT, DIR_OUT); // INIT_BをLow State = FSTATE_NoConf; for(int cnt = 20; 0 < cnt; cnt--){ // ウェイト NOP(); } SetOut(PIN_FPGA_nPROG, OUT_HIGH); // PROG_BをHigh portEXIT_CRITICAL(); }
CLocalTreeView::CLocalTreeView(wxWindow* parent, wxWindowID id, CState *pState, CQueueView *pQueueView) : wxTreeCtrl(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTR_EDIT_LABELS | wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxNO_BORDER), CSystemImageList(16), CStateEventHandler(pState, STATECHANGE_LOCAL_DIR | STATECHANGE_APPLYFILTER), m_pQueueView(pQueueView) { m_setSelection = false; SetImageList(GetSystemImageList()); #ifdef __WXMSW__ m_pVolumeEnumeratorThread = 0; CreateRoot(); #else AddRoot(_T("/"), GetIconIndex(dir), GetIconIndex(opened_dir)); SetDir(_T("/")); #endif SetDropTarget(new CLocalTreeViewDropTarget(this)); }