void CBoidsProxy::ProcessEvent( SEntityEvent &event ) { switch (event.event) { case ENTITY_EVENT_XFORM: if (m_pFlock) m_pFlock->SetPos( m_pEntity->GetWorldPos() ); break; case ENTITY_EVENT_PRE_SERIALIZE: if (m_pFlock) m_pFlock->DeleteEntities(true); break; case ENTITY_EVENT_ENTERAREA: OnTrigger(true,event); break; case ENTITY_EVENT_LEAVEAREA: OnTrigger(false,event); break; case ENTITY_EVENT_RESET: if (m_pFlock) m_pFlock->Reset(); break; case ENTITY_EVENT_HIDE: case ENTITY_EVENT_INVISIBLE: m_pFlock->HideAllBoids(true); break; case ENTITY_EVENT_UNHIDE: case ENTITY_EVENT_VISIBLE: m_pFlock->HideAllBoids(false); break; } }
bool CChar::FollowersUpdate( CChar * pChar, short iFollowerSlots, bool bCheckOnly ) { ADDTOCALLSTACK("CChar::FollowersUpdate"); // Attemp to update followers on this character based on pChar // bSustract = true for pet's release, shrink, etc ... // This is supossed to be called only when OF_PetSlots is enabled, so no need to check it here. if ( !bCheckOnly && IsTrigUsed(TRIGGER_FOLLOWERSUPDATE) ) { CScriptTriggerArgs Args; Args.m_iN1 = (iFollowerSlots > 0) ? 0 : 1; Args.m_iN2 = abs(iFollowerSlots); if ( OnTrigger(CTRIG_FollowersUpdate, pChar, &Args) == TRIGRET_RET_TRUE ) return false; iFollowerSlots = static_cast<short>(Args.m_iN2); } short iCurFollower = static_cast<short>(GetDefNum("CURFOLLOWER", true, true)); short iMaxFollower = static_cast<short>(GetDefNum("MAXFOLLOWER", true, true)); short iSetFollower = iCurFollower + iFollowerSlots; if ( (iSetFollower > iMaxFollower) && !IsPriv(PRIV_GM) ) return false; if ( !bCheckOnly ) { SetDefNum("CURFOLLOWER", maximum(iSetFollower, 0)); UpdateStatsFlag(); } return true; }
//**関数*************************************************************************** // 概要 : あたり判定 //********************************************************************************* void CObjButton::CheckCollision() { // 未使用時は処理なし if(m_nStatus == eButtonState::INACTIVE) return; CDXInput* pInput = MANAGER.GetInput(); switch(m_nStatus) { case eButtonState::DEFAULT: if(CCalc::IntersectBox2D(this->GetHitRect() , pInput->GetMouseHitRect())) SetState(eButtonState::HOVER); break; case eButtonState::HOVER: if(! (CCalc::IntersectBox2D(this->GetHitRect() , pInput->GetMouseHitRect() )) ) SetState(eButtonState::DEFAULT); if(pInput->GetMouseTrigger(0)) OnTrigger(); else if(pInput->GetMouseRelease(0)) OnRelease(); break; case eButtonState::ACTIVE: if(pInput->GetMouseTrigger(0)) OnTrigger(); else if(pInput->GetMouseRelease(0)) OnRelease(); break; default: // エラー break; } return; }
void kexTrigger::Tick(void) { if(((timeStamp - currentTime) / 1000.0f) > delayTime) { bTriggered = false; currentCounter = 0; if(maxTriggers > 0) { maxTriggers--; } } if(scriptComponent.onThink) { scriptComponent.CallFunction(scriptComponent.onThink); } if(bActionTrigger && actionName.Length() > 0) { kexLocalPlayer *p = &gameManager.localPlayer; int heldTime = p->ActionHeldTime(actionName); if(p->ActionDown(actionName) && heldTime > actionHeldTime) { OnTrigger(); } } }
void CChar::NPC_PetDesert() { ADDTOCALLSTACK("CChar::NPC_PetDesert"); CChar * pCharOwn = NPC_PetGetOwner(); if ( !pCharOwn ) return; if ( IsTrigUsed(TRIGGER_PETDESERT) ) { if ( OnTrigger( CTRIG_PetDesert, pCharOwn, NULL ) == TRIGRET_RET_TRUE ) return; } NPC_PetClearOwners(); if ( ! pCharOwn->CanSee(this)) pCharOwn->SysMessagef(g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_DESERTED), GetName()); TCHAR *pszMsg = Str_GetTemp(); sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_NPC_PET_DECIDE_MASTER), GetName()); Speak(pszMsg); // free to do as i wish ! Skill_Start( SKILL_NONE ); }
bool CScriptObj::r_Verb( CScript & s, CTextConsole * pSrc ) // Execute command from script { LOCKDATA; EXC_TRY(("r_Verb('%s %s',%x)", s.GetKey(), s.GetArgStr(), pSrc)); int index; LPCTSTR pszKey = s.GetKey(); ASSERT( pSrc ); CScriptObj * pRef; if ( r_GetRef( pszKey, pRef )) { if ( pszKey[0] ) { if ( !pRef ) return true; CScript script( pszKey, s.GetArgStr()); return pRef->r_Verb( script, pSrc ); } // else just fall through. as they seem to be setting the pointer !? } if ( s.IsKeyHead( "SRC.", 4 )) { pszKey += 4; pRef = dynamic_cast <CScriptObj*> (pSrc->GetChar()); // if it can be converted . if ( ! pRef ) { pRef = dynamic_cast <CScriptObj*> (pSrc); if ( ! pRef ) return( false ); } CScript script( pszKey, s.GetArgStr()); return pRef->r_Verb( script, pSrc ); } index = FindTableSorted( s.GetKey(), sm_szVerbKeys, COUNTOF( sm_szVerbKeys )-1 ); switch (index) { case SSV_OBJ: g_World.m_uidObj = s.GetArgVal(); if ( !g_World.m_uidObj.ObjFind() ) g_World.m_uidObj = 0; return( true ); case SSV_NEW: g_World.m_uidNew = s.GetArgVal(); if ( !g_World.m_uidNew.ObjFind() ) g_World.m_uidNew = 0; return( true ); case SSV_DUMPKEYS: r_DumpLoadKeys( pSrc ); return( true ); case SSV_DUMPVERBS: r_DumpVerbKeys( pSrc ); return( true ); case SSV_SHOW: { CGString sVal; if ( ! r_WriteVal( s.GetArgStr(), sVal, pSrc )) return( false ); TCHAR *pszMsg = Str_GetTemp(); sprintf(pszMsg, "'%s' for '%s' is '%s'\n", (LPCTSTR) s.GetArgStr(), (LPCTSTR) GetName(), (LPCTSTR) sVal ); pSrc->SysMessage(pszMsg); } return( true ); case SSV_TRIGGER: { // This is effectively a goto to an alternate trigger. (for this same object) TCHAR * pszVals[2]; // CScriptTriggerArgs * pArgs = NULL ? if ( Str_ParseCmds( s.GetArgStr(), pszVals, COUNTOF(pszVals))) { TRIGRET_TYPE tRet = OnTrigger( pszVals[0], pSrc, NULL ); return( true ); } } return( false ); } return r_LoadVal( s ); // default to loading values. EXC_CATCH("CScriptObj"); return false; }