コード例 #1
0
/*------------------------------------------------------------------------------------------------*/
bool HaveLinePartAtReg (Point16 *pA, Point16 *pB, const Rect16 *pRc, const int32_t Skew
    , const int NearHor, const int NearVer)
{
    Point16 Cur_A = {0}, Cur_B = {0};
    /*  Обрезаем низ  */
    Cur_A.x = pA->x;
    Cur_A.y = pA->y;
    ::Deskew (Cur_A, -Skew);
    Cur_B.x = pB->x;
    Cur_B.y = pB->y;
    ::Deskew (Cur_B, -Skew);
    int Lev_A = Cur_A.y;
    int Lev_B = Cur_B.y;
    int Lev = pRc->top;
    bool ret = CanUse (pA, pB, Lev, Lev_A, Lev_B, false, NearHor);
    if (!ret)
        return ret;
    /*  Обрезаем верх  */
    Cur_A.x = pA->x;
    Cur_A.y = pA->y;
    ::Deskew (Cur_A, -Skew);
    Lev_A = Cur_A.y;
    Lev = pRc->bottom;
    ret = CanUse (pA, pB, Lev, Lev_A, Lev_B, true, NearHor);
    if (!ret)
        return ret;
    /*  Обрезаем слева  */
    Cur_B.x = pB->x;
    Cur_B.y = pB->y;
    ::Deskew (Cur_B, -Skew);
    Lev_A = Cur_A.x;
    Lev_B = Cur_B.x;
    Lev = pRc->left;
    ret = CanUse (pA, pB, Lev, Lev_A, Lev_B, false, NearVer);
    if (!ret)
        return ret;
    /*  Обрезаем справа  */
    Cur_A.x = pA->x;
    Cur_A.y = pA->y;
    ::Deskew (Cur_A, -Skew);
    Lev_A = Cur_A.x;
    Lev = pRc->right;
    ret = CanUse (pA, pB, Lev, Lev_A, Lev_B, true, NearVer);
    if (!ret)
        return ret;
    return true;
}
コード例 #2
0
ファイル: TreeRow.cpp プロジェクト: firef0xff/YZPM_KTPP
bool         TreeRow::UpdateVal         (void)
{
String sql;
if (idparent>=0)
    {
    sql="call constructions.UpdateRowInfo('"+String(idparent)+"','"+String(id)+"','"+String(LUser)+"')";
    }else
    {
    sql="Call constructions.LoadDet('"+String(id)+"','"+String(LUser)+"')";
    }
TADOQuery *rez=DB->SendSQL(sql);
if (rez&&rez->RecordCount)
    {
    //базовый класс
    SetId(rez->FieldByName("idchild")->Value);
    SpRazd=rez->FieldByName("razdSPID")->Value;    
    SetObd(rez->FieldByName("obd")->Value.operator UnicodeString());    
    Name=rez->FieldByName("name")->Value.operator UnicodeString();
    SpRazdName=rez->FieldByName("Razdname")->Value;
    //текущий классс
    idparent=rez->FieldByName("idparent")->Value;    
    pp=rez->FieldByName("pp")->Value.operator UnicodeString().ToInt();
    ppp=rez->FieldByName("ppp")->Value.operator UnicodeString().ToInt();
    ei=rez->FieldByName("ei")->Value.operator UnicodeString().ToInt();    
    state=rez->FieldByName("state")->Value;    
    UserID=rez->FieldByName("UserID")->Value;
    SetObu(rez->FieldByName("obu")->Value.operator UnicodeString());    
    format=rez->FieldByName("format")->Value;    
    pos=rez->FieldByName("pos")->Value;    
    prim=rez->FieldByName("prim")->Value;
    zona=rez->FieldByName("zona")->Value;    
    ppName=rez->FieldByName("ppName")->Value.operator UnicodeString();    
    eiName=rez->FieldByName("eiName")->Value;        
    User=rez->FieldByName("User")->Value;
    CondName=rez->FieldByName("CondName")->Value;    
    DetCreator=rez->FieldByName("DetCreator")->Value;    
    DetUpdater=rez->FieldByName("DetUpdater")->Value;    
    RowCreator=rez->FieldByName("RowCreator")->Value;
    RowUpdater=rez->FieldByName("RowUpdater")->Value;
    kol=rez->FieldByName("kol")->Value;    
    Arhive=rez->FieldByName("arhive")->Value;
    CanChild=rez->FieldByName("CanChild")->Value;    
    Accept=rez->FieldByName("Accept")->Value;    
    if (!rez->FieldByName("DetCreated")->Value.IsNull()){DetCreated=rez->FieldByName("DetCreated")->Value.operator TDateTime();}
    if (!rez->FieldByName("DetUpdated")->Value.IsNull()){DetUpdated=rez->FieldByName("DetUpdated")->Value.operator TDateTime();}
    if (!rez->FieldByName("RowCreated")->Value.IsNull()){RowCreated=rez->FieldByName("RowCreated")->Value.operator TDateTime();}
    if (!rez->FieldByName("RowUpdated")->Value.IsNull()){RowUpdated=rez->FieldByName("RowUpdated")->Value.operator TDateTime();}    
    delete rez;
    }else
    {
    Obd::init();
    init();
    delete rez;
    }
return CanUse();
} 
コード例 #3
0
ファイル: TreeRow.cpp プロジェクト: firef0xff/YZPM_KTPP
bool         TreeRow::SetData(
                    const int &_id,    const int &_idparent,const int &_SpRazd,    const int &_pp,
                    const int &_ppp,    const int &_ei,        const int &_state,    const int &_UserID,
                    const String &_Obd,        const String &_Obu,
                    const String &_Name,    const String &_SpRazdName,
                    const String &_format,    const String &_pos,        const String &_prim,
                    const String &_zona,        const String &_ppName,    const String &_eiName,
                    const String &_User,        const String &_CondName,    const String &_DetCreator,
                    const String &_DetUpdater,    const String &_RowCreator,
                    const String &_RowUpdater,    const double &_kol,
                    const bool &_arhive,    const bool &_CanChild,    const bool &_Accept,
                    const TDateTime  &_DetCreated,    const TDateTime  &_DetUpdated,
                    const TDateTime  &_RowCreated,    const TDateTime  &_RowUpdated
                    )
{
if (ItTrueClassName())
    {
    SetId(_id);// базовый класс
    SpRazd=_SpRazd;
    SetObd(_Obd);
    Name=_Name.Trim();
    SpRazdName=_SpRazdName.Trim();
    // текущий класс
    idparent=_idparent;
    pp=_pp;
    ppp=_ppp;
    ei=_ei;
    state=_state;
    UserID=_UserID;
    SetObu(_Obu);
    format=_format.Trim();
    pos=_pos.Trim();
    prim=_prim.Trim();
    zona=_zona.Trim();
    ppName=_ppName.Trim();
    eiName=_eiName.Trim();
    User=_User.Trim();
    CondName=_CondName.Trim();
    DetCreator=_DetCreator.Trim();
    DetUpdater=_DetUpdater.Trim();
    RowCreator=_RowCreator.Trim();
    RowUpdater=_RowUpdater.Trim();
    kol=_kol;
    Arhive=_arhive;
    Set_Force(false);
    CanChild=_CanChild;
    Accept=_Accept;
    DetCreated=_DetCreated;
    DetUpdated=_DetUpdated;
    RowCreated=_RowCreated;
    RowUpdated=_RowUpdated;    
    }
return CanUse();
}                    
コード例 #4
0
ファイル: cBlizzard.cpp プロジェクト: serment7/WuwaFantasy
void cBlizzard::Start()
{
	if (!CanUse())
		return;
	m_fPassedTime = 0.0f;
	SetCast(true);
	SetCoolDown(true);
	m_fNextHitTime = 0.0f;
	m_fCoolDownPassedTime = 0.0f;
	g_pMessageDispatcher->Dispatch(m_ownerID, m_ownerID, 0.0f, Msg_AttackEnd, NULL);
}
コード例 #5
0
ファイル: IRCCmd.cpp プロジェクト: conan513/Infinity_MaNGOS-1
int IRCCmd::ParamsValid(_CDATA *CD, int pCnt, int rLev)
{
    //CD->PCOUNT = pCnt;
    if(!CanUse(CD->USER, rLev))
        return E_AUTH;
    else if(pCnt == 0)
        return E_OK;
    else if(CD->PARAMS.size() == 0)
        return E_SIZE;
    else if(!ValidParams(CD->PARAMS, pCnt))
        return E_SIZE;
    return E_OK;
}
コード例 #6
0
ファイル: CCharUse.cpp プロジェクト: DarkLotus/Source
bool CChar::Use_Cannon_Feed( CItem * pCannon, CItem * pFeed )
{
	ADDTOCALLSTACK("CChar::Use_Cannon_Feed");
	if ( pFeed && pCannon && pCannon->IsType(IT_CANNON_MUZZLE) )
	{
		if ( !CanUse(pCannon, false) )
			return false;
		if ( !CanUse(pFeed, true) )
			return false;

		if ( pFeed->GetID() == ITEMID_REAG_SA )
		{
			if ( pCannon->m_itCannon.m_Load & 1 )
			{
				SysMessageDefault(DEFMSG_ITEMUSE_CANNON_HPOWDER);
				return false;
			}
			pCannon->m_itCannon.m_Load |= 1;
			SysMessageDefault(DEFMSG_ITEMUSE_CANNON_LPOWDER);
			return true;
		}

		if ( pFeed->IsType(IT_CANNON_BALL) )
		{
			if ( pCannon->m_itCannon.m_Load & 2 )
			{
				SysMessageDefault(DEFMSG_ITEMUSE_CANNON_HSHOT);
				return false;
			}
			pCannon->m_itCannon.m_Load |= 2;
			SysMessageDefault(DEFMSG_ITEMUSE_CANNON_LSHOT);
			return true;
		}
	}

	SysMessageDefault(DEFMSG_ITEMUSE_CANNON_EMPTY);
	return false;
}
コード例 #7
0
ファイル: BeginnerHelper.cpp プロジェクト: KingMew/stepmania
void BeginnerHelper::AddPlayer( PlayerNumber pn, const NoteData &ns )
{
	ASSERT( !m_bInitialized );
	ASSERT( pn >= 0 && pn < NUM_PLAYERS );
	ASSERT( GAMESTATE->IsHumanPlayer(pn) );

	if( !CanUse() )
		return;
	
	const Character *Character = GAMESTATE->m_pCurCharacters[pn];
	ASSERT( Character != NULL );
	if( !DoesFileExist(Character->GetModelPath()) )
		return;

	m_NoteData[pn].CopyAll( ns );
	m_bPlayerEnabled[pn] = true;
}
コード例 #8
0
void CPickup::Callback_OnCollision ( CColShape& Shape, CElement& Element )
{
    if ( IS_PLAYER ( &Element ) )
    {
        CPlayer& Player = static_cast < CPlayer& > ( Element );

        // Is he alive?
        if ( !Player.IsDead () )
        {
            // Matching interior
            if ( GetInterior () == Element.GetInterior () )
            {
                // Matching dimension
                if ( GetDimension () == Element.GetDimension () )
                {
                    // Call the onPickupHit event
                    CLuaArguments Arguments;
                    Arguments.PushElement ( &Player );
                    bool bContinue1 = CallEvent ( "onPickupHit", Arguments );

                    CLuaArguments Arguments2;
                    Arguments2.PushElement ( this );       // pickup
                    bool bContinue2 = Element.CallEvent ( "onPlayerPickupHit", Arguments2 );

                    if ( bContinue1 && bContinue2 )
                    {
                        // Does it still exist?
                        if ( !IsBeingDeleted () )
                        {
                            // Can we USE the pickup?
                            if ( CanUse ( Player ) )
                            {
                                // USE the pickup
                                Use ( Player );
                            }
                        }
                    }
                }
            }
        }
    }
}
コード例 #9
0
ファイル: DiscoverCmd.cpp プロジェクト: molip/Eclipsoid
Cmd::ProcessResult DiscoverCmd::Process(const Input::CmdMessage& msg, CommitSession& session)
{
	auto& m = VerifyCastInput<const Input::CmdDiscovery>(msg);
	
	VERIFY_INPUT(m.m_action != Input::CmdDiscovery::Action::None);

	auto& game = session.GetGame();

	bool use = m.m_action == Input::CmdDiscovery::Action::Use;
	VERIFY_INPUT(!use || CanUse(game));

	if (use && m_discovery == DiscoveryType::AncientTech)
		return ProcessResult(new ResearchDiscoveryCmd(m_colour, game, GetAncientTechs(game)));

	DiscoveryType discovery = m.m_action == Input::CmdDiscovery::Action::Points ? DiscoveryType::None : m_discovery;
	DoRecord(RecordPtr(new DiscoveryRecord(m_colour, discovery, m_idHex)), session);

	if (use && Discovery::GetClass(m_discovery) == DiscoveryClass::ShipPart)
		return ProcessResult(new UpgradeDiscoveryCmd(m_colour, session.GetGame(), Discovery::GetShipPart(m_discovery)));

	return ProcessResult(nullptr);
}
コード例 #10
0
ファイル: BeginnerHelper.cpp プロジェクト: KingMew/stepmania
bool BeginnerHelper::Init( int iDancePadType )
{
	ASSERT( !m_bInitialized );
	if( !CanUse() )
		return false;

	// If no players were successfully added, bail.
	{
		bool bAnyLoaded = false;
		for( int pn=0; pn<NUM_PLAYERS; pn++ )
			if( m_bPlayerEnabled[pn] )
				bAnyLoaded = true;

		if( !bAnyLoaded )
			return false;
	}

	// Load the Background and flash. Flash only shows if the BG does.
	if( m_bShowBackground )
	{
		m_sBackground.Load( THEME->GetPathG("BeginnerHelper","background") );
		this->AddChild( m_sBackground );
		//m_sBackground.SetXY( 1, 1 );

		m_sFlash.Load( THEME->GetPathG("BeginnerHelper","flash") );
		m_sFlash.SetXY( 0, 0 );
		m_sFlash.SetDiffuseAlpha( 0 );
	}

	// Load StepCircle graphics
	for( int lsc=0; lsc<NUM_PLAYERS; lsc++ )
	{
		for( int lsce=0; lsce<4; lsce++ )
		{
			m_sStepCircle[lsc][lsce].Load( THEME->GetPathG("BeginnerHelper","stepcircle") );
			m_sStepCircle[lsc][lsce].SetZoom( 0 );	// Hide until needed.
			this->AddChild(&m_sStepCircle[lsc][lsce]);

			// Set StepCircle coordinates
			switch( lsce )
			{
			case 0: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)-80),HELPER_Y);	break;	// Left
			case 1: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)+80),HELPER_Y);	break;	// Right
			case 2: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y-60));	break;	// Up
			case 3: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y+60));	break;	// Down
			}
		}
	}

	SHOW_DANCE_PAD.Load( "BeginnerHelper","ShowDancePad" );
	// Load the DancePad
	if( SHOW_DANCE_PAD )
	{
		switch( iDancePadType )
		{
		case 0: break; // No pad
		case 1: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break;
		case 2: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break;
		}

		m_pDancePad->SetName("DancePad");
		m_pDancePad->SetX( HELPER_X );
		m_pDancePad->SetY( HELPER_Y );
		ActorUtil::LoadAllCommands( m_pDancePad, "BeginnerHelper" );
	}

	for( int pl=0; pl<NUM_PLAYERS; pl++ )	// Load players
	{
		// Skip if not enabled
		if( !m_bPlayerEnabled[pl] )
			continue;

		// Load character data
		const Character *Character = GAMESTATE->m_pCurCharacters[pl];
		ASSERT( Character != NULL );

		m_pDancer[pl]->SetName( ssprintf("PlayerP%d",pl+1) );

		// Load textures
		m_pDancer[pl]->LoadMilkshapeAscii( Character->GetModelPath() );

		// Load needed animations
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-LEFT",	GetAnimPath(ANIM_LEFT) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-DOWN",	GetAnimPath(ANIM_DOWN) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-UP", 	GetAnimPath(ANIM_UP) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-RIGHT", 	GetAnimPath(ANIM_RIGHT) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "Step-JUMPLR", 	GetAnimPath(ANIM_JUMPLR) );
		m_pDancer[pl]->LoadMilkshapeAsciiBones( "rest",		Character->GetRestAnimationPath() );
		m_pDancer[pl]->SetDefaultAnimation( "rest" );		// Stay bouncing after a step has finished animating
		m_pDancer[pl]->PlayAnimation( "rest" );
		m_pDancer[pl]->SetX( HELPER_X+PLAYER_X(pl) );
		m_pDancer[pl]->SetY( HELPER_Y+10 );
		ActorUtil::LoadAllCommandsAndOnCommand( m_pDancer[pl], "BeginnerHelper" );
		// many of the models floating around have the vertex order flipped, so force this.
		m_pDancer[pl]->SetCullMode( CULL_NONE );
	}

	m_bInitialized = true;
	return true;
}
コード例 #11
0
ファイル: CCharUse.cpp プロジェクト: DarkLotus/Source
bool CChar::Use_Repair( CItem * pItemArmor )
{
	ADDTOCALLSTACK("CChar::Use_Repair");
	// Attempt to repair the item.
	// If it is repairable.

	if ( !pItemArmor || !pItemArmor->Armor_IsRepairable() )
	{
		SysMessageDefault(DEFMSG_REPAIR_NOT);
		return false;
	}

	if ( pItemArmor->IsItemEquipped() )
	{
		SysMessageDefault(DEFMSG_REPAIR_WORN);
		return false;
	}
	if ( !CanUse(pItemArmor, true) )
	{
		SysMessageDefault(DEFMSG_REPAIR_REACH);
		return false;
	}

	// Quickly use arms lore skill, but don't gain any skill until later on
	int iArmsLoreDiff = Calc_GetRandVal(30);
	if ( !Skill_UseQuick(SKILL_ARMSLORE, iArmsLoreDiff, false) )
	{
		// apply arms lore skillgain for failure
		Skill_Experience(SKILL_ARMSLORE, -iArmsLoreDiff);
		SysMessageDefault(DEFMSG_REPAIR_UNK);
		return false;
	}

	if ( pItemArmor->m_itArmor.m_Hits_Cur >= pItemArmor->m_itArmor.m_Hits_Max )
	{
		SysMessageDefault(DEFMSG_REPAIR_FULL);
		return false;
	}

	m_Act_p = g_World.FindItemTypeNearby(GetTopPoint(), IT_ANVIL, 2, false);
	if ( !m_Act_p.IsValidPoint() )
	{
		SysMessageDefault(DEFMSG_REPAIR_ANVIL);
		return false;
	}

	CItemBase *pItemDef = pItemArmor->Item_GetDef();
	ASSERT(pItemDef);

	// Use up some raw materials to repair.
	int iTotalHits = pItemArmor->m_itArmor.m_Hits_Max;
	int iDamageHits = pItemArmor->m_itArmor.m_Hits_Max - pItemArmor->m_itArmor.m_Hits_Cur;
	int iDamagePercent = IMULDIV(100, iDamageHits, iTotalHits);

	size_t iMissing = ResourceConsumePart(&(pItemDef->m_BaseResources), 1, iDamagePercent / 2, true);
	if ( iMissing != pItemDef->m_BaseResources.BadIndex() )
	{
		// Need this to repair.
		const CResourceDef *pCompDef = g_Cfg.ResourceGetDef(pItemDef->m_BaseResources.GetAt(iMissing).GetResourceID());
		SysMessagef(g_Cfg.GetDefaultMsg(DEFMSG_REPAIR_LACK_1), pCompDef ? pCompDef->GetName() : g_Cfg.GetDefaultMsg(DEFMSG_REPAIR_LACK_2));
		return false;
	}

	UpdateDir(m_Act_p);
	UpdateAnimate(ANIM_ATTACK_1H_SLASH);

	// quarter the skill to make it.
	// + more damaged items should be harder to repair.
	// higher the percentage damage the closer to the skills to make it.

	size_t iRes = pItemDef->m_SkillMake.FindResourceType(RES_SKILL);
	if ( iRes == pItemDef->m_SkillMake.BadIndex() )
		return false;

	CResourceQty RetMainSkill = pItemDef->m_SkillMake[iRes];
	int iSkillLevel = static_cast<int>(RetMainSkill.GetResQty()) / 10;
	int iDifficulty = IMULDIV(iSkillLevel, iDamagePercent, 100);
	if ( iDifficulty < iSkillLevel / 4 )
		iDifficulty = iSkillLevel / 4;

	// apply arms lore skillgain now
	LPCTSTR pszText;
	Skill_Experience(SKILL_ARMSLORE, iArmsLoreDiff);
	bool fSuccess = Skill_UseQuick(static_cast<SKILL_TYPE>(RetMainSkill.GetResIndex()), iDifficulty);
	if ( fSuccess )
	{
		pItemArmor->m_itArmor.m_Hits_Cur = static_cast<WORD>(iTotalHits);
		pszText = g_Cfg.GetDefaultMsg(DEFMSG_REPAIR_1);
	}
	else
	{
		/*****************************
		// not sure if this is working!
		******************************/
		// Failure
		if ( !Calc_GetRandVal(6) )
		{
			pszText = g_Cfg.GetDefaultMsg(DEFMSG_REPAIR_2);
			pItemArmor->m_itArmor.m_Hits_Max--;
			pItemArmor->m_itArmor.m_Hits_Cur--;
		}
		else if ( !Calc_GetRandVal(3) )
		{
			pszText = g_Cfg.GetDefaultMsg(DEFMSG_REPAIR_3);
			pItemArmor->m_itArmor.m_Hits_Cur--;
		}
		else
			pszText = g_Cfg.GetDefaultMsg( DEFMSG_REPAIR_4 );

		iDamagePercent = Calc_GetRandVal(iDamagePercent);	// some random amount
	}

	ResourceConsumePart(&(pItemDef->m_BaseResources), 1, iDamagePercent / 2, false);
	if ( pItemArmor->m_itArmor.m_Hits_Cur <= 0 )
		pszText = g_Cfg.GetDefaultMsg(DEFMSG_REPAIR_5);

	TCHAR *pszMsg = Str_GetTemp();
	sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_REPAIR_MSG), pszText, pItemArmor->GetName());
	Emote(pszMsg);

	if ( pItemArmor->m_itArmor.m_Hits_Cur <= 0 )
		pItemArmor->Delete();
	else
		pItemArmor->UpdatePropertyFlag(AUTOTOOLTIP_FLAG_DURABILITY);

	return fSuccess;
}
コード例 #12
0
ファイル: CCharUse.cpp プロジェクト: DarkLotus/Source
bool CChar::Use_Key( CItem * pKey, CItem * pItemTarg )
{
	ADDTOCALLSTACK("CChar::Use_Key");
	ASSERT(pKey);
	ASSERT(pKey->IsType(IT_KEY));
	if ( !pItemTarg )
	{
		SysMessageDefault(DEFMSG_MSG_KEY_TARG);
		return false;
	}

	if ( pKey != pItemTarg && pItemTarg->IsType(IT_KEY) )
	{
		// We are trying to copy a key ?
		if ( !CanUse(pItemTarg, true) )
		{
			SysMessageDefault(DEFMSG_MSG_KEY_TARG_REACH);
			return false;
		}

		if ( !pKey->m_itKey.m_lockUID && !pItemTarg->m_itKey.m_lockUID )
		{
			SysMessageDefault(DEFMSG_MSG_KEY_BLANKS);
			return false;
		}
		if ( pItemTarg->m_itKey.m_lockUID && pKey->m_itKey.m_lockUID )
		{
			SysMessageDefault(DEFMSG_MSG_KEY_NOTBLANKS);
			return false;
		}

		// Need tinkering tools ???
		if ( !Skill_UseQuick(SKILL_TINKERING, 30 + Calc_GetRandLLVal(40)) )
		{
			SysMessageDefault(DEFMSG_MSG_KEY_FAILC);
			return false;
		}
		if ( pItemTarg->m_itKey.m_lockUID )
			pKey->m_itKey.m_lockUID = pItemTarg->m_itKey.m_lockUID;
		else
			pItemTarg->m_itKey.m_lockUID = pKey->m_itKey.m_lockUID;
		return true;
	}

	if ( !pKey->m_itKey.m_lockUID )
	{
		SysMessageDefault(DEFMSG_MSG_KEY_ISBLANK);
		return false;
	}
	if ( pKey == pItemTarg )	// rename the key
	{
		if ( IsClient() )
			GetClient()->addPromptConsole(CLIMODE_PROMPT_NAME_KEY, g_Cfg.GetDefaultMsg(DEFMSG_MSG_KEY_SETNAME), pKey->GetUID());
		return false;
	}

	if ( !CanUse(pItemTarg, false) )
	{
		SysMessageDefault(DEFMSG_MSG_KEY_CANTREACH);
		return false;
	}

	if ( m_pArea->GetResourceID() == pKey->m_itKey.m_lockUID )
	{
		if ( Use_MultiLockDown(pItemTarg) )
			return true;
	}

	if ( !pItemTarg->m_itContainer.m_lockUID )	// or m_itContainer.m_lockUID
	{
		SysMessageDefault(DEFMSG_MSG_KEY_NOLOCK);
		return false;
	}
	if ( !pKey->IsKeyLockFit(pItemTarg->m_itContainer.m_lockUID) )	// or m_itKey
	{
		SysMessageDefault(DEFMSG_MSG_KEY_WRONGLOCK);
		return false;
	}

	return Use_KeyChange(pItemTarg);
}
コード例 #13
0
ファイル: DiscoverCmd.cpp プロジェクト: molip/Eclipsoid
void DiscoverCmd::UpdateClient(const Controller& controller, const LiveGame& game) const
{
	controller.SendMessage(Output::ChooseDiscovery(m_discovery, CanKeep(), CanUse(game)), GetPlayer(game));
}
コード例 #14
0
ファイル: BeginnerHelper.cpp プロジェクト: BitMax/openitg
bool BeginnerHelper::Initialize( int iDancePadType )
{
	ASSERT( !m_bInitialized );
	if(!CanUse())
		return false;

	// If no players were successfully added, bail.
	{
		bool bAnyLoaded = false;
		for(int pn=0; pn<NUM_PLAYERS; pn++)
			if(m_bPlayerEnabled[pn])
				bAnyLoaded = true;

		if(!bAnyLoaded)
			return false;
	}
	
	// Load the Background and flash.. Flash only shows if the BG does.
	if(m_bShowBackground)
	{
		m_sBackground.Load( THEME->GetPathG("BeginnerHelper","background") );
		this->AddChild(&m_sBackground);
		m_sBackground.SetXY(1,1);
		m_sFlash.Load(THEME->GetPathG("BeginnerHelper","flash"));
		m_sFlash.SetXY(0,0);
		m_sFlash.SetDiffuseAlpha(0);
	}
	
	// Load StepCircle graphics
	for(int lsc=0; lsc<NUM_PLAYERS; lsc++)
		for(int lsce=0; lsce<4; lsce++)
		{
			m_sStepCircle[lsc][lsce].Load(THEME->GetPathG("BeginnerHelper","stepcircle"));
			m_sStepCircle[lsc][lsce].SetZoom(0);	// Hide until needed.
			this->AddChild(&m_sStepCircle[lsc][lsce]);
			
			// Set coordinates of StepCircle
			switch(lsce)
			{
				case 0: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)-80),HELPER_Y);	break;	// Left
				case 1: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)+80),HELPER_Y);	break;	// Right
				case 2: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y-60));	break;	// Up
				case 3: m_sStepCircle[lsc][lsce].SetXY((HELPER_X+PLAYER_X(lsc)),(HELPER_Y+60));	break;	// Down
			}
		}

	// Load the DancePad
	switch(iDancePadType)
	{
		case 0: break; // No pad
		case 1: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PAD)); break;
		case 2: m_pDancePad->LoadMilkshapeAscii(GetAnimPath(ANIM_DANCE_PADS)); break;
	}
	
	m_pDancePad->SetHorizAlign( align_left );
	m_pDancePad->SetRotationX( DANCEPAD_ANGLE );
	m_pDancePad->SetX(HELPER_X);
	m_pDancePad->SetY(HELPER_Y);
	m_pDancePad->SetZoom(23);	// Pad should always be 3 units bigger in zoom than the dancer.

	for( int pl=0; pl<NUM_PLAYERS; pl++ )	// Load players
	{
		// Skip if not enabled
		if(!m_bPlayerEnabled[pl])
			continue;

		// Load character data
		const Character *Character = GAMESTATE->m_pCurCharacters[pl];
		ASSERT( Character != NULL );

		// Load textures
		m_pDancer[pl]->SetHorizAlign( align_left );
		m_pDancer[pl]->LoadMilkshapeAscii( Character->GetModelPath() );

		// Load needed animations
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-LEFT",		GetAnimPath(ANIM_LEFT));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-DOWN",		GetAnimPath(ANIM_DOWN));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-UP", 		GetAnimPath(ANIM_UP));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-RIGHT", 	GetAnimPath(ANIM_RIGHT));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("Step-JUMPLR", 	GetAnimPath(ANIM_JUMPLR));
		m_pDancer[pl]->LoadMilkshapeAsciiBones("rest",			Character->GetRestAnimationPath());
		m_pDancer[pl]->SetDefaultAnimation("rest");
		m_pDancer[pl]->PlayAnimation("rest");
		m_pDancer[pl]->SetRotationX(PLAYER_ANGLE);
		m_pDancer[pl]->SetX(HELPER_X+PLAYER_X(pl));
		m_pDancer[pl]->SetY(HELPER_Y+10);
		m_pDancer[pl]->SetZoom(20);
		m_pDancer[pl]->SetCullMode(CULL_NONE);	// many of the DDR PC character models have the vertex order flipped
		m_pDancer[pl]->m_bRevertToDefaultAnimation = true;		// Stay bouncing after a step has finished animating->
	}

	m_bInitialized = true;
	return true;
}