예제 #1
0
void daKoopaThrow::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
	if (Type == 5) {
		PlaySoundAsync(this, currentInfo->breakSound);
		S16Vec nullRot = {0,0,0};
		Vec efScale = {3.0f, 3.0f, 3.0f};
		SpawnEffect(currentInfo->deathEffect, 0, &this->pos, &nullRot, &efScale);
		// dStageActor_c *spawned = CreateActor(EN_ITEM, 0x20000063, this->pos, 0, 0);
		// spawned->pos.x = this->pos.x;
		// spawned->pos.y = this->pos.y;

		int p = CheckExistingPowerup(apOther->owner);
		if (p == 0 || p == 3) {	// Powerups - 0 = small; 1 = big; 2 = fire; 3 = mini; 4 = prop; 5 = peng; 6 = ice; 7 = hammer
			dAcPy_c__ChangePowerupWithAnimation(apOther->owner, 1);
		}

		this->Delete(1);

		return;
	}

	DamagePlayer(this, apThis, apOther);

	if (Type == 1 || Type == 2) {
		PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST);

		S16Vec nullRot = {0,0,0};
		Vec efScale = {0.75f, 0.75f, 0.75f};
		SpawnEffect("Wm_en_burst_s", 0, &this->pos, &nullRot, &efScale);
		Vec hitScale = {1.25f, 1.25f, 1.25f};
		SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &nullRot, &hitScale);
		this->Delete(1);
	}
}
예제 #2
0
bool daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {
	S16Vec nullRot = {0,0,0};
	Vec oneVec = {1.0f, 1.0f, 1.0f};
	SpawnEffect("Wm_ob_cmnboxgrain", 0, &this->pos, &nullRot, &oneVec);
	SpawnEffect("Wm_en_obakedoor_sm", 0, &this->pos, &nullRot, &oneVec);

	PlaySound(this, SE_BOSS_JR_FLOOR_BREAK);

	//FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void)
	this->Delete(1);
	return true;
}
예제 #3
0
bool daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
	S16Vec nullRot = {0,0,0};
	Vec oneVec = {1.0f, 1.0f, 1.0f};
	SpawnEffect("Wm_en_explosion", 0, &this->pos, &nullRot, &oneVec);
	Vec smokeScale = {3.0f, 3.0f, 3.0f};
	SpawnEffect("Wm_en_explosion_smk", 0, &this->pos, &nullRot, &smokeScale);

	PlaySound(this, SE_OBJ_EMY_FIRE_DISAPP);
	this->Delete(1);

	return true;
}
예제 #4
0
	void daBalboa_c::beginState_BackDown() {

		bindAnimChr_and_setUpdateRate("throw_5", 1, 0.0, 1.0);

		this->timer = 0;

		PlaySound(this, 0x221);

		S16Vec nullRot = {0,0,0};
		Vec efScale = {2.0f, 1.0f, 1.0f};
		SpawnEffect("Wm_mr_sanddive_out", 0, &this->pos, &nullRot, &efScale);
		SpawnEffect("Wm_mr_sanddive_smk", 0, &this->pos, &nullRot, &efScale);
	}
예제 #5
0
bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) {
	S16Vec nullRot = {0,0,0};
	Vec scale15 = {1.5f, 1.5f, 1.5f};
	SpawnEffect("Wm_ob_cmnicekira", 0, &this->pos, &nullRot, &scale15);
	Vec oneVec = {1.0f, 1.0f, 1.0f};
	SpawnEffect("Wm_ob_icebreakwt", 0, &this->pos, &nullRot, &oneVec);
	SpawnEffect("Wm_ob_iceattack", 0, &this->pos, &nullRot, &scale15);

	PlaySound(this, SE_OBJ_PNGN_ICE_BREAK);

	this->Delete(1);
	return true;
}
예제 #6
0
bool daKoopaThrow::collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) {
	DamagePlayer(this, apThis, apOther);

	if (Type == 1 || Type == 2) {
		PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST);

		S16Vec nullRot = {0,0,0};
		Vec burstScale = {0.75f, 0.75f, 0.75f};
		SpawnEffect("Wm_en_burst_s", 0, &this->pos, &nullRot, &burstScale);
		Vec hitScale = {1.25f, 1.25f, 1.25f};
		SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &nullRot, &hitScale);
		this->Delete(1);
	}
	return true;
}
예제 #7
0
bool HoldableItemTransporter::use( void )
{
	Entity *spawnPoint;

	if ( _owner )
	{
		if ( !_owner->isSubclassOf( Player ) )
			return false;

		Player *player;

		player = (Player *)_owner;

		if ( multiplayerManager.inMultiplayer() )
		{
			spawnPoint = multiplayerManager.getSpawnPoint( player );

			if ( spawnPoint )
			{
				if ( _modelToSpawn.length() > 0 )
				{
					SpawnEffect( _modelToSpawn, player->origin, vec_zero, 1.0f );
				}

				player->WarpToPoint( spawnPoint );

				KillBox( player );
				return true;
			}
		}
	}

	return false;
}
예제 #8
0
	bool daBalboa_c::collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) {

		dActor_c *block = apOther->owner;
		dEn_c *mario = (dEn_c*)block;

		S16Vec nullRot = {0,0,0};
		Vec oneVec = {1.0f, 1.0f, 1.0f};
		SpawnEffect("Wm_en_vshit", 0, &mario->pos, &nullRot, &oneVec);

		mario->speed.y = -mario->speed.y;
		mario->pos.y += mario->speed.y;

		if (mario->direction == 0) { mario->speed.x = 4.0; }
		else					  { mario->speed.x = -4.0; }

		mario->doSpriteMovement();
		mario->doSpriteMovement();

		if (isRevenging) {
			_vf220(apOther->owner);
		} else {
			this->damage -= 1;

			apOther->someFlagByte |= 2;

			PlaySoundAsync(this, SE_EMY_PENGUIN_DAMAGE);

			doStateChange(&StateID_Damage);
		}

		return true;
	}
예제 #9
0
void AdaptiveArmor::_PlayAdaptionFX(const Vector &direction , const Vector &position )
{
	Vector dir;
	Vector newDir;
	Vector fxOrigin;
	Vector PosDelta;
	Entity *theFX;
	
	
	dir = direction;
	dir *= -1;
	dir.normalize();
	
	fxOrigin  = dir * 15;
	fxOrigin += position;
	
	dir = dir.toAngles();
	
	PosDelta = _currentFXPosition - fxOrigin;
	
	if ( PosDelta.length() > FX_CHANGE_DELTA )
	{
		_changeFX();
		_currentFXPosition = fxOrigin;
	}
		
	theFX = SpawnEffect(_AdaptionFX, fxOrigin , dir , _fxTime );	
	theFX->bind( owner );

	theFX->PostEvent( EV_SetOriginEveryFrame , FRAMETIME );	
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_ResourceSpawner::ClientThink( void )
{
	SetNextClientThink( gpGlobals->curtime + random->RandomFloat( 2.0, 10.0 ) );

	// Don't do random puffs if I'm not active
	if ( !m_bActive )
		return;

	// Occasionally spurt as if I was making a chunk
	if ( random->RandomInt(0, 20) == 5 )
	{
		SpawnEffect( true );
	}
	else
	{
		SpawnEffect( false );
	}
}
예제 #11
0
void daMegaGoomba_c::dieOther_Execute() {
	bodyModel._vf1C();
	if (counter_500 == 0) {
		S16Vec nullRot = {0,0,0};
		Vec vecFive = {5.0f, 5.0f, 5.0f};
		SpawnEffect("Wm_ob_icebreaksmk", 0, &pos, &nullRot, &vecFive);
		Delete(1);
	}
}
예제 #12
0
bool daWrench::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
	S16Vec nullRot = {0,0,0};
	Vec efScale = {0.5f, 0.5f, 0.5f};
	SpawnEffect("Wm_ob_cmnboxgrain", 0, &this->pos, &nullRot, &efScale);

	PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK);
	this->Delete(1);
	return true;
}
예제 #13
0
bool daKoopaThrow::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
	if (Type == 1 || Type == 2) {
		S16Vec nullRot = {0,0,0};
		Vec burstScale = {0.75f, 0.75f, 0.75f};
		SpawnEffect("Wm_en_burst_s", 0, &this->pos, &nullRot, &burstScale);
		Vec hitScale = {1.25f, 1.25f, 1.25f};
		SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &nullRot, &hitScale);
	}
	else {
		S16Vec nullRot = {0,0,0};
		Vec efScale = {0.5f, 0.5f, 0.5f};
		SpawnEffect("Wm_ob_cmnboxgrain", 0, &this->pos, &nullRot, &efScale);
	}

	PlaySoundAsync(this, currentInfo->breakSound);
	this->Delete(1);
	return true;
}
예제 #14
0
void daFakeStarCoin::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {

	PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU);
	S16Vec nullRot = {0,0,0};
	Vec oneVec = {1.0f, 1.0f, 1.0f};
	SpawnEffect("Wm_en_obakedoor", 0, &this->pos, &nullRot, &oneVec);

	//FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void)
	this->Delete(1);
}
예제 #15
0
bool daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {

	if (apOther->owner->name == 412) { // Check if it's a glow block
		dEn_c *blah = (dEn_c*)apOther->owner;
		if (blah->_12C & 3 || strcmp(blah->acState.getCurrentState()->getName(), "daLightBlock_c::StateID_Throw")) {
			return true;
		}

		S16Vec nullRot = {0,0,0};
		Vec oneVec = {1.0f, 1.0f, 1.0f};
		SpawnEffect("Wm_en_obakedoor_sm", 0, &apOther->owner->pos, &nullRot, &oneVec);
		SpawnEffect("Wm_mr_yoshistep", 0, &apOther->owner->pos, &nullRot, &oneVec);

		fleeFast = true;
		doStateChange(&StateID_Flee);
		//FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void)
		apOther->owner->Delete(1);
		return true;
	}
	return false;
}
예제 #16
0
void CFire::Start()
{
	float boxWidth = (m_flFireSize * (FIRE_WIDTH/FIRE_HEIGHT))*0.5f;
	UTIL_SetSize(this, Vector(-boxWidth,-boxWidth,0),Vector(boxWidth,boxWidth,m_flFireSize));

	//Spawn the client-side effect
	SpawnEffect( (fireType_e)m_nFireType, FIRE_SCALE_FROM_SIZE(m_flFireSize) );
	m_OnIgnited.FireOutput( this, this );
	SetThink( &CFire::BurnThink );
	m_flDamageTime = 0;
	// think right now
	BurnThink();
}
예제 #17
0
void daWrench::executeState_Straight() {

	speed.y = speed.y - 0.01875;

	HandleXSpeed();
	HandleYSpeed();
	doSpriteMovement();

	cmgr_returnValue = collMgr.isOnTopOfTile();
	collMgr.calculateBelowCollisionWithSmokeEffect();

	if (collMgr.isOnTopOfTile()) {
		// hit the ground
		PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK);

		S16Vec nullRot = {0,0,0};
		Vec efScale = {0.75f, 0.75f, 0.75f};
		SpawnEffect("Wm_en_burst_s", 0, &this->pos, &nullRot, &efScale);
		this->Delete(1);
	}
	if (collMgr.outputMaybe & (0x15 << direction)) {
		// hit the wall
		PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK);

		S16Vec nullRot = {0,0,0};
		Vec efScale = {0.75f, 0.75f, 0.75f};
		SpawnEffect("Wm_en_burst_s", 0, &this->pos, &nullRot, &efScale);
		this->Delete(1);
	}

	if (this->direction == 1) { // directions 1 spins clockwise, fly rightwards
		this->rot.z -= 0x1000; }
	else {						// directions 0 spins anti-clockwise, fly leftwards
		this->rot.z += 0x1000; }

	PlayWrenchSound(this);

}
예제 #18
0
void MeteorPhysicsCallback(dMeteor *self, dEn_c *other) {
	if (other->name == 657) {
		OSReport("CANNON COLLISION");

		S16Vec nullRot = {0,0,0};
		Vec oneVec = {1.0f, 1.0f, 1.0f};
		SpawnEffect("Wm_en_explosion", 0, &other->pos, &nullRot, &oneVec);
		SpawnEffect("Wm_en_explosion_smk", 0, &other->pos, &nullRot, &oneVec);
		PlaySound(other, SE_OBJ_TARU_BREAK);
		other->Delete(1);

		switch ((self->settings >> 24) & 3) {
			case 1:
				dStageActor_c::create(EN_HATENA_BALLOON, 0x100, &self->pos, 0, self->currentLayerID);
				break;
			case 2:
				VEC3 coinPos = {self->pos.x - 16.0f, self->pos.y, self->pos.z};
				dStageActor_c::create(EN_COIN, 9, &coinPos, 0, self->currentLayerID);
				break;
		}

		self->kill();
	}
예제 #19
0
void dWMShop_c::executeState_CoinCountdown() {
	timerForCoinCountdown--;
	if (timerForCoinCountdown <= 0) {

		SaveBlock *save = GetSaveFile()->GetBlock(-1);
		save->spentStarCoins++;

		// load the coin count
		int scCount = getUnspentStarCoinCount();
		WriteNumberToTextBox(&scCount, CoinCount, false);
		WriteNumberToTextBox(&scCount, CoinCountShadow, false);

		layout.enableNonLoopAnim(COUNT_COIN);
		VEC3 efPos = {
			CoinCount->effectiveMtx[0][3],
			CoinCount->effectiveMtx[1][3],
			0.0f};

		// ARGHHHHHHHHHHHHHHHHh.
		if (IsWideScreen()) {
			float div = 5.0f;
			if (scCount < 100)
				div = 3.6f;
			if (scCount < 10)
				div = 2.7f;
			efPos.x -= (CoinCount->size.x / div);
			efPos.y -= (CoinCount->size.y / 2.0f);
		} else {
			float div = 5.8f;
			if (scCount < 100)
				div = 8.2f;
			if (scCount < 10)
				div = 14.5f;
			efPos.x += (CoinCount->size.x / div);
			efPos.y -= (CoinCount->size.y / 2.8f);
		}

		VEC3 efScale = {0.7f, 0.7f, 0.7f};
		SpawnEffect("Wm_2d_moviecoinvanish", 0, &efPos, 0, &efScale);

		coinsRemaining--;
		if (coinsRemaining <= 0) {
			MapSoundPlayer(SoundRelatedClass, SE_PLY_GET_ITEM_AGAIN, 1);
			state.setState(&StateID_Wait);
		} else {
			MapSoundPlayer(SoundRelatedClass, SE_SYS_STAR_COIN_PAY, 1);
			beginState_CoinCountdown();
		}
	}
}
예제 #20
0
bool daFuzzyBear_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {

	dActor_c *block = apOther->owner;
	dEn_c *blah = (dEn_c*)block;

	//OSReport("Fuzzy was hit by an actor %d (%p); its field 12C is %x\n", block->name, block, blah->_12C);
	if (block->name == AC_LIGHT_BLOCK) {
		//OSReport("It's a light block, and its state is %s\n", blah->acState.getCurrentState()->getName());
		if (blah->_12C & 3 || strcmp(blah->acState.getCurrentState()->getName(), "daLightBlock_c::StateID_Throw")) {
			//OSReport("Ignoring this!\n");
			return true;
		}
	}

	if (blah->direction == 0) { blah->direction = 1; this->roly = 1; }
	else					  { blah->direction = 0; this->roly = 0; }

	blah->speed.x = -blah->speed.x;
	blah->pos.x += blah->speed.x;

	if (blah->speed.y < 0) {
		blah->speed.y = -blah->speed.y; }

	blah->doSpriteMovement();
	blah->doSpriteMovement();

	if (this->isInvulnerable == 1) {

		if (blah->direction == 0) { blah->direction = 1; }
		else					  { blah->direction = 0; }

		return true;
	}

	this->pos.x += blah->speed.x;

	this->timer = 0;
	this->damage = this->damage + 5;


	PlaySound(this, SE_EMY_BLOW_PAKKUN_DOWN);
	S16Vec nullRot = {0,0,0};
	Vec oneVec = {1.0f, 1.0f, 1.0f};
	SpawnEffect("Wm_mr_kickhit", 0, &blah->pos, &nullRot, &oneVec);

	if (this->damage > 14) { doStateChange(&StateID_Outro); }
	else { doStateChange(&StateID_RolyPoly); }
	return true;
}
예제 #21
0
bool daFuzzyBear_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
	return true; // added by skawo request

	if (this->isInvulnerable == 1) { return true; }

	this->timer = 0;
	PlaySound(this, SE_BOSS_KOOPA_FIRE_DISAPP);

	S16Vec nullRot = {0,0,0};
	Vec oneVec = {1.0f, 1.0f, 1.0f};
	SpawnEffect("Wm_mr_fireball_hit", 0, &apOther->owner->pos, &nullRot, &oneVec);
	this->damage++;
	if (this->damage > 14) { doStateChange(&StateID_Outro); }
	return true;
}
예제 #22
0
//------------------------------------------------------------------------
void CItem::OnHit(float damage, const char* damageType)
{
    if(!m_properties.hitpoints)
        return;

    if(damageType && !stricmp(damageType, "repair"))
    {
        if (m_stats.health < m_properties.hitpoints) //repair only to maximum
        {
            bool destroyed = m_stats.health<=0.f;
            m_stats.health = min(float(m_properties.hitpoints),m_stats.health+damage);

            UpdateDamageLevel();

            if(destroyed && m_stats.health>0.f)
                OnRepaired();
        }
    }
    else
    {
        if (m_stats.health > 0.0f)
        {
            m_stats.health -= damage;

            UpdateDamageLevel();

            if (m_stats.health <= 0.0f)
            {
                m_stats.health = 0.0f;
                OnDestroyed();

                int n=(int)m_damageLevels.size();
                for (int i=0; i<n; ++i)
                {
                    SDamageLevel &level=m_damageLevels[i];
                    if (level.min_health==0 && level.max_health==0)
                    {
                        int slot=(m_stats.viewmode&eIVM_FirstPerson)?eIGS_FirstPerson:eIGS_ThirdPerson;

                        SpawnEffect(slot, level.effect, level.helper, Vec3Constants<float>::fVec3_Zero,
                                    Vec3Constants<float>::fVec3_OneZ, level.scale);
                    }
                }
            }
        }
    }
}
예제 #23
0
bool daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {

	if (this->isInvulnerable == 1) { return true; }

	dActor_c *block = apOther->owner;
	dEn_c *blah = (dEn_c*)block;

	if (blah->direction == 0) { blah->direction = 1; this->roly = 1; }
	else					  { blah->direction = 0; this->roly = 0; }

	PlaySound(this, SE_EMY_BIG_PAKKUN_DAMAGE_1);
	this->timer = 0;
	this->damage += 5;

	S16Vec nullRot = {0,0,0};
	Vec oneVec = {1.0f, 1.0f, 1.0f};
	SpawnEffect("Wm_mr_kick_glow", 0, &apOther->owner->pos, &nullRot, &oneVec);

	if (this->damage > 14) { doStateChange(&StateID_Outro); }
	else { doStateChange(&StateID_RolyPoly); }
	return true;
}
예제 #24
0
//
// Name:        ResolveDamage() 
// Class:       BasicAmor
//
// Description: Resolves the damage.
//
// Parameters:  float damage -- The initial damage.
//
// Returns:     float newDamage -- The new damage after armor factor is taken into account
//
float ShieldArmor::ResolveDamage( float damage , int meansOfDeath , const Vector &direction , const Vector &position , Entity *attacker )
{
	Q_UNUSED(attacker);

	//Shield Armor basically acts as a "life meter" for a shield.  If the armor is actor 
	//and he have an armor value greater than 0, then we take 0 damage.  The as soon as the 
	//amount is less than 0, then we start taking full damage.
	if ( !_active ) return damage;
	
	int inNoProtectionList = 0;

	inNoProtectionList = _noProtectionList.IndexOfObject( meansOfDeath );

	if ( inNoProtectionList )
		return damage;

	if ( meansOfDeath == MOD_ARMOR_PIERCING )
		return damage;
	
	if ( amount <= 0 )
	{
		amount = 0.0f;
		return damage;
	}
	

	if ( _useDirection )
		{
		Vector directionAngle = direction.toAngles();
		float directionYaw = AngleNormalize180( directionAngle[YAW] );
		if ( (directionYaw > _directionMax) || (directionYaw < _directionMin) )
			{
			return damage;
			}
		}

	amount -= damage;
	
	if ( amount < 0 )
		amount = 0.0f;
	
	if ( amount > 0 )
	{
		// We blocked so spawn an effect
		
		str modelName;
		Vector effectAngles;
		
		effectAngles = direction;
		effectAngles.toAngles();
		
		modelName = "ReflectionModel-";
		modelName += MOD_NumToName( meansOfDeath );
		modelName += ".gdb";
		
		SpawnEffect( modelName, position, vec_zero, 1.0f );
		
		return (damage * _multiplier);
	}		
	
	return damage;	
}
예제 #25
0
//------------------------------------------------------------------------
tSoundID CItem::PlayAction(const ItemString &actionName, int layer, bool loop, uint32 flags, float speedOverride)
{
	if(!m_enableAnimations || !IsOwnerInGame())
		return (tSoundID)-1;

	TActionMap::iterator it = m_sharedparams->actions.find(CONST_TEMPITEM_STRING(actionName));

	if(it == m_sharedparams->actions.end())
	{
//		GameWarning("Action '%s' not found on item '%s'!", actionName, GetEntity()->GetName());

		for(int i=0; i<eIGS_Last; i++)
		{
			m_animationTime[i]=0;
			m_animationSpeed[i]=1.0f;
			m_animationEnd[i]=0;
		}

		return 0;
	}

	bool fp = m_stats.fp;

	if(m_parentId)
	{
		CItem *pParent=static_cast<CItem *>(m_pItemSystem->GetItem(m_parentId));

		if(pParent)
			fp=pParent->GetStats().fp;
	}

	if(flags&eIPAF_ForceFirstPerson)
		fp = true;

	if(flags&eIPAF_ForceThirdPerson)
		fp = false;

	int sid=fp?eIGS_FirstPerson:eIGS_ThirdPerson;
	SAction &action = it->second;

	tSoundID result = INVALID_SOUNDID;

	if((flags&eIPAF_Sound) && !action.sound[sid].name.empty() && IsSoundEnabled() && g_pGameCVars->i_soundeffects)
	{
		int nSoundFlags = FLAG_SOUND_DEFAULT_3D;
		nSoundFlags |= flags&eIPAF_SoundStartPaused?FLAG_SOUND_START_PAUSED:0;
		IEntitySoundProxy *pSoundProxy = GetSoundProxy(true);

		//GetSound proxy from dualwield master if neccesary
		if(IsDualWieldSlave())
		{
			CItem *pMaster = static_cast<CItem *>(GetDualWieldMaster());

			if(pMaster)
			{
				pSoundProxy = pMaster->GetSoundProxy(true);
			}
		}

		EntityId pSkipEnts[3];
		int nSkipEnts = 0;

		// TODO for Marcio :)
		// check code changes

		// Skip the Item
		pSkipEnts[nSkipEnts] = GetEntity()->GetId();
		++nSkipEnts;

		// Skip the Owner
		if(GetOwner())
		{
			pSkipEnts[nSkipEnts] = GetOwner()->GetId();
			++nSkipEnts;
		}

		if(pSoundProxy)
		{

			TempResourceName name;
			FixResourceName(action.sound[sid].name, name, flags);
			//nSoundFlags = nSoundFlags | (fp?FLAG_SOUND_DEFAULT_3D|FLAG_SOUND_RELATIVE:FLAG_SOUND_DEFAULT_3D);
			Vec3 vOffset(0,0,0);

			if(fp)
				vOffset.x = 0.3f; // offset for first person weapon to the front

			if(!g_pGameCVars->i_staticfiresounds)
			{
				result = pSoundProxy->PlaySoundEx(name, vOffset, FORWARD_DIRECTION, nSoundFlags, 1.0f, 0, 0, eSoundSemantic_Weapon, pSkipEnts, nSkipEnts);
				ISound *pSound = pSoundProxy->GetSound(result);

				if(pSound && action.sound[sid].sphere>0.0f)
					pSound->SetSphereSpec(action.sound[sid].sphere);
			}
			else
			{
				SInstanceAudio *pInstanceAudio=0;

				if(action.sound[sid].isstatic)
				{
					TInstanceActionMap::iterator iit = m_instanceActions.find(CONST_TEMPITEM_STRING(actionName));

					if(iit == m_instanceActions.end())
					{
						std::pair<TInstanceActionMap::iterator, bool> insertion=m_instanceActions.insert(TInstanceActionMap::value_type(actionName, SInstanceAction()));
						pInstanceAudio=&insertion.first->second.sound[sid];
					}
					else
						pInstanceAudio=&iit->second.sound[sid];
				}

				if(pInstanceAudio && (pInstanceAudio->id != INVALID_SOUNDID) && (name != pInstanceAudio->static_name))
					ReleaseStaticSound(pInstanceAudio);

				if(!pInstanceAudio || pInstanceAudio->id == INVALID_SOUNDID)
				{
					result = pSoundProxy->PlaySoundEx(name, vOffset, FORWARD_DIRECTION, nSoundFlags, 1.0f, 0, 0, eSoundSemantic_Weapon, pSkipEnts, nSkipEnts);
					ISound *pSound = pSoundProxy->GetSound(result);

					if(pSound && action.sound[sid].sphere>0.0f)
						pSound->SetSphereSpec(action.sound[sid].sphere);
				}

				if(action.sound[sid].isstatic)
				{
					if(pInstanceAudio->id == INVALID_SOUNDID)
					{
						if(pSoundProxy->SetStaticSound(result, true))
						{
							pInstanceAudio->id = result;
							pInstanceAudio->static_name = name;
							pInstanceAudio->synch = action.sound[sid].issynched;
						}
					}
					else
					{
						ISound *pSound = pSoundProxy->GetSound(pInstanceAudio->id);

						if(pSound)
							pSound->Play(1.0, true, true, pSoundProxy);
					}
				}
			}

			if(gEnv->pAISystem && action.sound[sid].airadius > 0.0f)
			{
				EntityId ownerId = GetOwner() ? GetOwner()->GetId() : 0;

				// associate sound event with vehicle if the shooter is in a vehicle (tank cannon shot, etc)
				if(CActor *pOwnerActor = GetOwnerActor())
				{
					IVehicle *pOwnerVehicle = pOwnerActor->GetLinkedVehicle();

					if(pOwnerVehicle && pOwnerVehicle->GetEntityId())
						ownerId = pOwnerVehicle->GetEntityId();
				}

				SAIStimulus stim(AISTIM_SOUND, AISOUND_WEAPON, ownerId?ownerId:GetEntityId() , 0,
								 GetEntity()->GetWorldPos(), ZERO, action.sound[sid].airadius);

				gEnv->pAISystem->RegisterStimulus(stim);
			}
		}
	}


	if(flags&eIPAF_Animation)
	{
		TempResourceName name;
		// generate random number only once per call to allow animations to
		// match across geometry slots (like first person and third person)
		float randomNumber = Random();

		for(int i=0; i<eIGS_Last; i++)
		{
			if(!(flags&(1<<i)))
				continue;

			int nanimations=action.animation[i].size();

			if(nanimations <= 0)
				continue;

			int anim = int(randomNumber * float(nanimations));

			if(action.animation[i][anim].name.empty())
				continue;

			FixResourceName(action.animation[i][anim].name, name, flags);

			if((i == eIGS_Owner) || (i == eIGS_OwnerLooped))
			{
				if(!action.animation[i][anim].name.empty())
				{
					bool looping=(eIGS_OwnerLooped==i);

					CActor *pOwner = GetOwnerActor();

					if(pOwner)
					{
						if(IsDualWield() && !m_sharedparams->params.dual_wield_pose.empty())
							pOwner->PlayAction(name, m_sharedparams->params.dual_wield_pose.c_str(), looping);
						else
							pOwner->PlayAction(name, m_sharedparams->params.pose.c_str(), looping);
					}
				}

				continue;
			}
			else if(i == eIGS_OffHand)
			{
				if(!action.animation[eIGS_OffHand][anim].name.empty())
				{
					CActor *pOwner = GetOwnerActor();

					if(pOwner)
					{
						CItem *pOffHand = pOwner->GetItemByClass(CItem::sOffHandClass);

						if(pOffHand && pOffHand!=this)
						{
							uint32 ohflags=eIPAF_Default;

							if(action.animation[eIGS_OffHand][anim].blend==0.0f)
								ohflags|=eIPAF_NoBlend;

							pOffHand->PlayAction(action.animation[eIGS_OffHand][anim].name, 0, false, ohflags);
						}
					}
				}

				continue;
			}

			SAnimation &animation=action.animation[i][anim];

			if(!animation.name.empty())
			{
				float blend = animation.blend;

				if(flags&eIPAF_NoBlend)
					blend = 0.0f;

				if(speedOverride > 0.0f)
					PlayAnimationEx(name, i, layer, loop, blend, speedOverride, flags);
				else
					PlayAnimationEx(name, i, layer, loop, blend, animation.speed, flags);
			}

			if((m_stats.fp || m_stats.viewmode&eIVM_FirstPerson) && i==eIGS_FirstPerson && !animation.camera_helper.empty())
			{
				m_camerastats.animating=true;
				m_camerastats.helper=animation.camera_helper;
				m_camerastats.position=animation.camera_pos;
				m_camerastats.rotation=animation.camera_rot;
				m_camerastats.follow=animation.camera_follow;
				m_camerastats.reorient=animation.camera_reorient;
			}
			else if(m_camerastats.animating)
				m_camerastats=SCameraAnimationStats();
		}
	}

	if(flags&eIPAF_Effect && !action.effect[sid].name.empty())
	{
		// change this to attach, if needed
		SpawnEffect(sid, action.effect[sid].name.c_str(), action.effect[sid].helper.c_str());
	}

	if(action.children)
	{
		for(TAccessoryMap::iterator ait=m_accessories.begin(); ait!=m_accessories.end(); ait++)
		{
			EntityId aId=(EntityId)ait->second;
			CItem *pAccessory=static_cast<CItem *>(m_pItemSystem->GetItem(aId));

			if(pAccessory)
				pAccessory->PlayAction(actionName, layer, loop, flags, speedOverride);
		}
	}

	return result;
}
예제 #26
0
void daFuzzyBear_c::executeState_Bounce() {

	float wallDistance, scaleDown, scaleUp, scaleBase;

	if (BigBossFuzzyBear == 0) {
		wallDistance = 32.0;
		scaleDown = 24.0;
		scaleUp = 10.0;
		scaleBase = 2.5;
	}
	else {
		wallDistance = 38.0;
		scaleDown = 32.0;
		scaleUp = 12.0;
		scaleBase = 3.0;
	}


	if (this->falldown == 1) { this->speed.x = 0; this->timer = 0; }


	// Check for walls

	if (this->pos.x <= this->initialPos.x - ((17 * 16.0) + wallDistance))  { // Hit left wall, head right.
		this->speed.x = -this->speed.x;
		this->direction = 1;
		this->pos.x = this->pos.x + 1.0; }

	if (this->pos.x >= this->initialPos.x + ((7.5 * 16.0) - wallDistance))  { // Hit right wall, head left.
		this->speed.x = -this->speed.x;
		this->direction = 0;
		this->pos.x = this->pos.x - 1.0; }


	// Check if we're on the ground.

	if (this->pos.y < this->Baseline) {

		this->falldown = 0;

		this->timer = this->timer + 1;
		if (this->speed.x != 0) {
			this->storeSpeed = this->speed.x; }
		this->speed.x = 0;
		this->speed.y = 0;


		if (this->timer < 10) {
			float modifier;
			modifier = scaleBase - (this->timer * 0.1);

			this->scale.y = modifier;
			this->pos.y = this->pos.y + (scaleDown/10.0);
			if (this->pos.y > this->Baseline) { this->pos.y = this->Baseline - 1.0; }
		}
		else if (this->timer == 10) {
			Vec tempPos = (Vec){this->pos.x, this->pos.y - wallDistance, 5500.0};
			S16Vec nullRot = {0,0,0};
			Vec oneVec = {1.0f, 1.0f, 1.0f};
			SpawnEffect("Wm_mr_beachlandsmk", 0, &tempPos, &nullRot, &oneVec);
		}
		else {
			float modifier;
			modifier = (scaleBase - 1.0) + ((this->timer - 10) * 0.1);

			this->scale.y = modifier;
			this->pos.y = this->pos.y + (scaleUp/10.0);
			if (this->pos.y > this->Baseline) { this->pos.y = this->Baseline - 1.0; }
			PlaySound(this, SE_PLY_JUMPDAI);
		}

		if (this->timer > 20) {

			int randChoice;

			randChoice = GenerateRandomNumber(5);
			if (randChoice == 0) { doStateChange(&StateID_Wait); }

			randChoice = GenerateRandomNumber(4);
			if (randChoice == 0) { this->speed.y = 8.0; }
			else { this->speed.y = 6.0; }

			this->timer = 0;
			this->pos.y = this->Baseline + 1;

			this->speed.x = this->storeSpeed;
		 }
	}

	else { this->speed.y = this->speed.y - 0.1; } // Gravity


	this->HandleXSpeed();
	this->HandleYSpeed();

	this->UpdateObjectPosBasedOnSpeedValuesReal();

}
예제 #27
0
void daFuzzyBear_c::executeState_RolyPoly() {
	float wallDistance, scaleDown, scaleUp;

	PlaySound(this, SE_OBJ_TEKKYU_G_CRASH);

	if (this->pos.y > this->Baseline) { this->pos.y -= 2.0; }
	else {
		this->pos.y = this->Baseline - 1.0;

		Vec tempPos = (Vec){this->pos.x, this->pos.y - 34.0f, 5500.0f};

		if (this->timer & 0x1) {
			S16Vec nullRot = {0,0,0};
			Vec efScale = {0.4f, 0.4f, 0.4f};
			SpawnEffect("Wm_ob_icehitsmk", 0, &tempPos, &nullRot, &efScale);
		}
	 }

	if (this->direction == 0) { // is even
		this->pos.x = this->pos.x - 3.0; }
	else { // is odd
		this->pos.x = this->pos.x + 3.0; }

	if (BigBossFuzzyBear == 0) {
		wallDistance = 38.0;
	}
	else {
		wallDistance = 50.0;
	}

	this->timer += 1;

	if (this->pos.x <= this->initialPos.x - ((17 * 16.0) + wallDistance))  { // Hit left wall, head right.
		this->speed.x = -this->speed.x;
		this->direction = 1;
		this->pos.x = this->pos.x + 1.0;
		this->RolyBounces = this->RolyBounces + 1;
		}

	if (this->pos.x >= this->initialPos.x + ((7.5 * 16.0) - wallDistance))  { // Hit right wall, head left.
		this->speed.x = -this->speed.x;
		this->direction = 0;
		this->pos.x = this->pos.x - 1.0;
		this->RolyBounces = this->RolyBounces + 1;
		}


	if (this->direction == 1) { this->rot.z = this->rot.z - 0x400; }
	else 					  { this->rot.z = this->rot.z + 0x400; }

	if (this->RolyBounces == 2) {
		if ((this->pos.x > this->RolyPos.x -20.0) && (this->pos.x < this->RolyPos.x + 20.0)) {
			this->speed.x = 0;
			if (this->rot.z == 0) { doStateChange(&StateID_Bounce); } }
	}



//	this->HandleXSpeed();
//	this->HandleYSpeed();

//	this->doSpriteMovement();
//	this->UpdateObjectPosBasedOnSpeedValuesReal();

 }
//-----------------------------------------------------------------------------
// Purpose: Receive a spawn message from the server
//-----------------------------------------------------------------------------
void C_ResourceSpawner::ReceiveMessage( const char *msgname, int length, void *data )
{
	// Make some particles
	SpawnEffect( true );
}
예제 #29
0
bool daRamboo_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
	S16Vec nullRot = {0,0,0};
	Vec efScale = {0.5f, 0.5f, 0.5f};
	SpawnEffect("Wm_en_obakedoor_sm", 0, &apOther->owner->pos, &nullRot, &efScale);
	return true;
}