예제 #1
0
bool CChar::NPC_CheckWalkHere( const CPointBase & pt, const CRegionBase * pArea, WORD wBlockFlags ) const
{
	ADDTOCALLSTACK("CChar::NPC_CheckWalkHere");
	UNREFERENCED_PARAMETER(wBlockFlags);
	// Does the NPC want to walk here ? step on this item ?
	if ( !m_pNPC )
		return false;
	if ( !pt.IsValidXY() )
		return true;

	if ( m_pArea != NULL )
	{
		if ( m_pNPC->m_Brain == NPCBRAIN_GUARD && !IsStatFlag(STATF_War) )	// guards will want to stay in guard range
		{
			if ( m_pArea->IsGuarded() && !pArea->IsGuarded() )
				return false;
		}

		if ( Noto_IsCriminal() )
		{
			if ( !m_pArea->IsGuarded() && pArea->IsGuarded() )
				return false;
		}
	}

	// Is there a nasty object here that will hurt us ?
	CWorldSearch AreaItems(pt);
	for (;;)
	{
		CItem * pItem = AreaItems.GetItem();
		if ( pItem == NULL )
			break;

		if ( abs(pItem->GetTopZ() - pt.m_z) > 5 )
			continue;

		switch ( pItem->GetType() )
		{
			case IT_WEB:
				return (GetDispID() == CREID_GIANT_SPIDER) ? true : false;
			case IT_FIRE:
				return Can(CAN_C_FIRE_IMMUNE);
			case IT_TRAP:
			case IT_TRAP_ACTIVE:
			case IT_MOONGATE:
			case IT_TELEPAD:
				return false;
			default:
				break;
		}
	}
	return true;
}
예제 #2
0
void ShootingCans::reset() {
    resetGame();

    cans.clear();
    shootedCans.clear();

    int width = ofGetWidth();
    int height = ofGetHeight();

    for (int i = 0; i < 3; i++) {
        cans.push_back(Can((4 + i * 2) * width / 12, height / 4 + 5, &canTexture, 150, 125, 1, 3));
    }
    for (int i = 1; i <= 4; i++) {
        cans.push_back(Can(i * width / 5, height / 2 - 20, &canTexture, 150, 125, 1, 3));
    }
    for (int i = 0; i < 3; i++) {
        cans.push_back(Can((4 + i * 2) * width / 12, height / 4 * 3 - 45, &canTexture, 150, 125, 1, 3));
    }

    gameStarted = false;
    screenTime = 120;

    ofBackground(0xe3, 0xcb, 0xcc);
}