Example #1
0
void CSceneTitle::FrameMove(CSceneManager* pManager, float et)
{
	if( (GetInput().KEY(DIK_UP)) )		  // 위
	{
		GetSound().PlaySound2D("Sound/MBtMouseClick.mp3",false);
		if( m_nCurrentSelect == START ) m_nCurrentSelect = END;
		else m_nCurrentSelect--;
	} 
	else if( (GetInput().KEY(DIK_DOWN)) ) // 아래
	{
		GetSound().PlaySound2D("Sound/MBtMouseClick.mp3",false);
		if( m_nCurrentSelect == END ) m_nCurrentSelect = START;
		else m_nCurrentSelect++;
	} 
	else if(GetInput().KEY(DIK_RETURN))	  // 엔터키
	{
		GetSound().PlaySound2D("Sound/WorldSelect.mp3",false);
		// 게임 시작
		if(m_nCurrentSelect == START){
			GetSound().StopAllSound2D();
			ChangeScene(pManager,CSceneCharacter::GetSingleton());
		}
		// 이어 하기
		if(m_nCurrentSelect == CONTINUE){
			printf("Not implemented yet : Continue\n");
		}
		// 게임 종료
		if(m_nCurrentSelect == END){
			PostMessage(g_pApp->GethWnd(), WM_DESTROY, 0,0);
		}
	}
}
Example #2
0
CSceneTitle::~CSceneTitle()
{
	SAFE_DELETE(m_pFont);
	GetSound().RemoveSpecificSound("Title.mp3");
	GetSound().RemoveSpecificSound("MBtMouseClick.mp3");
	GetSound().RemoveSpecificSound("WorldSelect.mp3");
}
Example #3
0
//************************************************************************
void CNutDropScene::OnLButtonDown (HWND hWnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
//************************************************************************
{
	if (m_SoundPlaying == IntroPlaying)
	{
		m_SoundPlaying = NotPlaying;
	 	m_pSound->StopChannel (NORMAL_CHANNEL);
		StartGame();
	}	
	else
	if (m_SoundPlaying == SuccessPlaying)
	{
		m_SoundPlaying = NotPlaying;
	 	GetSound()->StopChannel(NORMAL_CHANNEL);
		// Start the looping soundtrack if one is defined
		FNAME szFileName;
		if (GetSound() && m_szSoundTrack[0] != '\0')
			GetSound()->StartFile (GetPathName (szFileName, m_szSoundTrack), YES/*bLoop*/,
							MUSIC_CHANNEL, FALSE);
		// If Play mode, go to the next scene
		if (m_nSceneNo == IDD_NUTDROPI)
			FORWARD_WM_COMMAND (m_hWnd, IDC_NEXT, NULL, m_nNextSceneNo, PostMessage);
		else
			StartGame();
	}	
}
Example #4
0
//************************************************************************
void CNutDropScene::CheckObjectCollision (LPSPRITE lpSprite)
//************************************************************************
{
	if (!m_lpPlayerSprite || !m_pAnimator)
		return;

	// See if they've picked enough already
	if (m_nGoodPicks >= m_nMatchesNeeded)
		return;

	static BOOL fBusy = FALSE;
	if (fBusy)
		return;
	fBusy = TRUE;

	RECT rBasket, rBasketX;
	rBasket = (m_WalkDir == WALKLEFT ? m_rLeftBasket : m_rRightBasket );
	m_lpPlayerSprite->Location (&rBasketX);
	OffsetRect( &rBasket, rBasketX.left, rBasketX.top );
	IntersectRect( &rBasket, &rBasket, &rBasketX );

	if (m_pAnimator->CheckCollision (m_lpPlayerSprite, lpSprite, &rBasket))
	{
		int idx = GetObjectIndex (lpSprite);
		if (idx == -1 || m_ObjectList[idx].m_nState == StateGoodPick)
		{
			fBusy = FALSE;
			return;
		}

		m_ObjectList[idx].m_nState = StateGoodPick;
		m_nGoodPicks++;

		// Play the got one sound if one is defined
		FNAME szFileName;
		GetPathName (szFileName, m_szGotOneWave);
		if (m_nGoodPicks < m_nMatchesNeeded)
		{
			if (GetSound() && m_szGotOneWave[0] != '\0')
			{
				GetSound()->StopChannel (NORMAL_CHANNEL);
				GetSound()->StartFile (szFileName, NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, FALSE);
			}
		}
		else
			PlaySound(szFileName, FALSE); // how to play with wait AND wavemix

		// Hide this object
		lpSprite->Show (FALSE);

		// Update the caught score
		UpdateSpriteScore (m_lpCaughtScore[0], m_lpCaughtScore[1], m_nGoodPicks);
		
		// See if they've picked enough to win this level
		if (m_nGoodPicks >= m_nMatchesNeeded)
			PlayLevelSuccessWave();
	}
	fBusy = FALSE;
}
Example #5
0
/*virtual*/ void SoundInstanceCommon::Tick() {
  PROFILE_FUNCTION;

  if (GetSound()->GetIs3D()) {
    Tick3D();
  }

  SetVolume(m_Attenuation * GetBaseVolume() * GetSound()->GetBaseVolume() *
            GetCategoryVolume() * GetMasterVolume());
}
Example #6
0
void CPlayerObject::InitAttack()
{
	m_nAttackType = rand()%5;
	if(m_nAttackType<3) GetSound().PlaySound2D("Sound/swordL.mp3",false);
	else GetSound().PlaySound2D("Sound/swordS.mp3",false);

	m_bIsAttack = true;
	m_bIsAlert  = true;
	ResetTimer();

	ApplyAttack();
}
Example #7
0
//************************************************************************
void CNutDropScene::PlayIntro(HWND hWnd/*NULL for no WOM_DONE*/)
//************************************************************************
{
	FNAME szFileName;

	// Play the intro wave if one is defined
	if (GetSound() && m_szIntroWave[0] != '\0')
	{
		m_SoundPlaying = IntroPlaying;
		GetSound()->StopChannel (NORMAL_CHANNEL);
		GetSound()->StartFile (GetPathName (szFileName, m_szIntroWave), NO/*bLoop*/, 
								NORMAL_CHANNEL/*iChannel*/, FALSE, hWnd);
	}
}
Example #8
0
//************************************************************************
BOOL CGBScene::PlaySound(LPCTSTR lpWaveFile, BOOL fHint)
//************************************************************************
{
	LPSOUND pSound = GetSound();
	if ( !pSound )
		return( FALSE );

	BOOL fRet;
	if ( !pSound->IsMixing() )
		fRet = pSound->StartFile((LPSTR)lpWaveFile, FALSE/*bLoop*/, -1, TRUE/*bWait*/);
	else
	{
		// this nonsense is here because in order to make buttons
		// in action strip play the click wave when they are clicked
		// on we need to synchronously play the sound so the click
		// happens while the button is down.  WaveMix does not play
		// sounds synchronously, so we deactivate WaveMix and use
		// sndPlaySound stuff.
		CSound sound;
		pSound->Activate(FALSE);
		fRet = sound.StartFile((LPSTR)lpWaveFile, FALSE/*bLoop*/, -1, TRUE/*bWait*/);
		pSound->Activate(TRUE);
	}

	return(fRet);
}
Example #9
0
/// Send the new weather to all players in the zone
bool Weather::UpdateWeather()
{
    Player* player = sWorld.FindPlayerInZone(m_zone);
    if (!player)
        return false;

    ///- Send the weather packet to all players in this zone
    uint32 sound = GetSound();

    if (m_grade >= 1)
        m_grade = 0.9999f;
    else if (m_grade < 0)
        m_grade = 0.0001f;


    WorldPacket data(SMSG_WEATHER, (4 + 4 + 4));
    data << (uint32)m_type << (float)m_grade << (uint32)sound;
    player->SendMessageToSet(&data, true);

    ///- Log the event
    char const* wthstr;
    switch (sound)
    {
        case WEATHER_RAINLIGHT:
            wthstr = "light rain";
            break;
        case WEATHER_RAINMEDIUM:
            wthstr = "medium rain";
            break;
        case WEATHER_RAINHEAVY:
            wthstr = "heavy rain";
            break;
        case WEATHER_SNOWLIGHT:
            wthstr = "light snow";
            break;
        case WEATHER_SNOWMEDIUM:
            wthstr = "medium snow";
            break;
        case WEATHER_SNOWHEAVY:
            wthstr = "heavy snow";
            break;
        case WEATHER_SANDSTORMLIGHT:
            wthstr = "light sandstorm";
            break;
        case WEATHER_SANDSTORMMEDIUM:
            wthstr = "medium sandstorm";
            break;
        case WEATHER_SANDSTORMHEAVY:
            wthstr = "heavy sandstorm";
            break;
        case WEATHER_NOSOUND:
        default:
            wthstr = "fine";
            break;
    }

    DETAIL_FILTER_LOG(LOG_FILTER_WEATHER, "Change the weather of zone %u to %s.", m_zone, wthstr);

    return true;
}
Example #10
0
int DDAudio::Play(const char* name, bool loop)
{
    dsprintf("Being asked to play [%s] Loop: [%s]\n", name, loop? "true" : "false");

    int buffer = GetSound(name);


    int channel = FindNextFreeChannel();
    alSourceStop(channel);
    if(channel == -1)
    {
        printf("Couldn't find free channel.\n");
        return -1;
    }


    alSourcei(channel, AL_BUFFER, buffer);

    alSourcef(channel, AL_PITCH, 1);
    alSourcef(channel, AL_GAIN, 1);
    alSource3f(channel, AL_POSITION, 0, 0, 0);
    alSource3f(channel, AL_VELOCITY, 0, 0, 0);
    alSourcei(channel, AL_LOOPING, loop);

    alSourcePlay(channel);

    int error = alGetError();
    if(error != AL_NO_ERROR)
    {
        return -1;
    }

    return channel;
}
Example #11
0
BOOL C_DrawList::Process(long ID,short HitType)
{
	gSoundMgr->PlaySound(GetSound(HitType));
	if(Last_ && Last_->Owner)
		return(Last_->Owner->Process(ID,HitType));
	return(FALSE);
}
Example #12
0
//************************************************************************
void CNutDropScene::PlayLevelSuccessWave()
//************************************************************************
{
	// Get the sound to play based on the level
	int iCount = 0;
	for (int i = 0 ; i < MAX_SUCCESSWAVES ; i++)
	{
		if (m_szSuccessLevel[i][0] != '\0')
			iCount++;
	}

	LPSTR lpWave;
	if (iCount <= 0)
	{
		lpWave = m_szSuccessLevel[0];
	}
	else
	{
		i = GetRandomNumber (iCount);
		lpWave = m_szSuccessLevel[i];
	}

	if (*lpWave != '\0')
	{
		FNAME szFileName;
		if (GetSound() )
		{
			m_SoundPlaying = SuccessPlaying;
			GetSound()->StopChannel(NORMAL_CHANNEL);
			if (m_nSceneNo == IDD_NUTDROPI)
			{ // Play this wave without wavemix
				LPSOUND lpSound = new CSound;
				if ( lpSound )
				{
					GetSound()->Activate (FALSE);
					lpSound->StartFile( GetPathName(szFileName, lpWave),
						NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, TRUE/*bWait*/, m_hWnd);
					delete lpSound;
					GetSound()->Activate (TRUE);
					FORWARD_WM_COMMAND (m_hWnd, IDC_NEXT, NULL, m_nNextSceneNo, PostMessage);
				}
			}
			else
				GetSound()->StartFile(GetPathName (szFileName, lpWave), NO/*bLoop*/, NORMAL_CHANNEL/*iChannel*/, FALSE/*bWait*/, m_hWnd);
		}
	}
}
Example #13
0
BOOL C_Custom::Process(long ID,short HitType)
{
	gSoundMgr->PlaySound(GetSound(HitType));
	if(Callback_)
		(*Callback_)(ID,HitType,this);

	return(TRUE);
}
Example #14
0
void Weather::SendWeatherUpdateToPlayer(Player* player)
{
    uint32 sound = GetSound();                              // for 1.12
    WorldPacket data(SMSG_WEATHER, (4 + 4 + 4));

    data << (uint32)m_type << (float)m_grade << (uint32)sound;
    player->GetSession()->SendPacket(&data);
}
void AllegroSoundSample5::SetVolume( float value )
{
	if ( !m_pInstance )
		return;

	al_set_sample_instance_gain( m_pInstance, value * GetSound().GetMasterVolume() );
	m_volume = value;
}
Example #16
0
void CSceneTitle::Init()
{
	m_pFont = new CD3DXFont("굴림체", 20);
	m_SelectPos.x = 0;
	m_SelectPos.y = POS_START;
	m_nCurrentSelect = START;

	m_pImage[0] = CImage::CreateImage("cloud.png", g_szPackName,0,0,m_iCTWidth,438);
	m_pImage[1] = CImage::CreateImage("MapleLogo.png", g_szPackName,0,0,306,152);
	m_pImage[2] = CImage::CreateImage("title.png", g_szPackName,0,0,945,600);
	m_pImage[3] = CImage::CreateImage("select.png", g_szPackName,0,0,945,20);

	GetSound().CreateSoundFromFile("Sound/Title.mp3", 1.0f);
	GetSound().CreateSoundFromFile("Sound/MBtMouseClick.mp3", 1.0f);
	GetSound().CreateSoundFromFile("Sound/WorldSelect.mp3", 1.0f);
	GetSound().PlaySound2D("Sound/Title.mp3",true);
}
Example #17
0
void Role::swapWeaponLocal(int swapTo)
{
	currentWpn = swapTo;
	swapWeaponTimer = 0.5f;

	if (this->role == 2 && GetSound())
	{
		if (currentWpn == 1)
		{
			GetSound()->playUserGeneratedSound(SOUNDS::soundEffectStalkerChange, CATEGORY::Guns);
		}
		else
		{
			GetSound()->playUserGeneratedSound(SOUNDS::soundEffectStalkerChangeBack, CATEGORY::Guns);
		}
		
	}
}
Example #18
0
    /// Populates this collection of assets with more specific types
    /// of data as specified in the generic collection of assets.
    /// @param[in]  assets - The generic asset data to populate from.
    /// @return True if all assets are successfully populated; false otherwise.
    bool Assets::Populate(const std::vector<Asset>& assets)
    {
        for (const auto& asset : assets)
        {
            switch (asset.Type)
            {
                case RESOURCES::AssetType::FONT:
                {
                    std::shared_ptr<GRAPHICS::GUI::Font> font = GetFont(asset.Id, asset.BinaryData);
                    if (!font)
                    {
                        return false;
                    }
                    break;
                }
                case RESOURCES::AssetType::MUSIC:
                {
                    std::shared_ptr<sf::Music> music = GetMusic(asset.Id, asset.BinaryData);
                    if (!music)
                    {
                        return false;
                    }
                    break;
                }
                case RESOURCES::AssetType::SHADER:
                {
                    std::shared_ptr<sf::Shader> shader = GetShader(asset.Id, asset.BinaryData);
                    if (!shader)
                    {
                        return false;
                    }
                    break;
                }
                case RESOURCES::AssetType::SOUND_EFFECT:
                {
                    std::shared_ptr<sf::SoundBuffer> sound = GetSound(asset.Id, asset.BinaryData);
                    if (!sound)
                    {
                        return false;
                    }
                    break;
                }
                case RESOURCES::AssetType::TEXTURE:
                {
                    std::shared_ptr<GRAPHICS::Texture> texture = GetTexture(asset.Id, asset.BinaryData);
                    if (!texture)
                    {
                        return false;
                    }
                    break;
                }
            }
        }

        return true;
    }
Example #19
0
static int sound_dispose(lua_State *L)
{
	Mix_Chunk *sound = GetSound(L, 1);
	if ( sound ) {
		Mix_FreeChunk(sound);
		*(Mix_Chunk **)lua_touserdata(L, 1) = NULL;
		printf("freed sound\n");
	}
	return 0;
}
Example #20
0
void BuildWeatherPacket(WorldPacket * data, uint32 Effect, float Density )
{
    data->Initialize(SMSG_WEATHER);
    if(Effect == 0 ) // set all parameter to 0 for sunny.
        *data << uint32(0) << float(0) << uint32(0) << uint8(0);
    else if (Effect == 1) // No sound/density for fog
        *data << Effect << float(0) << uint32(0) << uint8(0);
    else
        *data << Effect << Density << GetSound(Effect,Density) << uint8(0) ;
}
Example #21
0
void CMonsterSoundMemory::GetSound(SoundElem &s, bool &bDangerous)
{
	VERIFY(!Sounds.empty());

	// возврат самого опасного
	s = GetSound();

	if (s.type > WEAPON_EMPTY_CLICKING) bDangerous = false;
	else bDangerous = true;
}
Example #22
0
//************************************************************************
void CCreditsScene::ToonInitDone()
//************************************************************************
{
	if ( m_pAnimator )
	{
		m_pAnimator->StopAll();

		m_pAnimator->SetClipRect(&m_rGameArea);

		if (GetSound() && lstrlen(m_szSoundTrack))
		{
			FNAME szFileName;

			GetPathName(szFileName, m_szSoundTrack);
			GetSound()->StartFile(szFileName, TRUE, -1); 
		}
		StartNext();
		m_pAnimator->StartAll();
	}
}
Example #23
0
BOOL C_ATO_Package::Process(long ID,short HitType)
{
    gSoundMgr->PlaySound(GetSound(HitType));
    if(HitType == C_TYPE_LMOUSEUP)
    {
        if(Section_)
            SetWPState(static_cast<short>(WPState_ ^ 1));
    }
    if(Callback_)
        (*Callback_)(ID,HitType,this);
    return(FALSE);
}
Example #24
0
void Weather::SendWeatherUpdateToPlayer(Player* player)
{
    NormalizeGrade();

    WorldPacket data(SMSG_WEATHER, 4 + 4 + 4 + 1);
    data << uint32(m_type);
    data << float(m_grade);
    data << uint32(GetSound()); // 1.12 soundid
    data << uint8(0);       // 1 = instant change, 0 = smooth change

    player->GetSession()->SendPacket(data);
}
Example #25
0
void CPlayerObject::Init()
{
	CAnimFileLoader SpriteLoader1("player.png",4,64,64);
	CAnimFileLoader SpriteLoader2("player.png",3,80,64);

	m_pObjectSprite->AddAnimation("Wait",SpriteLoader1.GetAnimation(0,2),1,2.0f);
	m_pObjectSprite->AddAnimation("Walk",SpriteLoader1.GetAnimation(4,7),0,4.0f);
	m_pObjectSprite->AddAnimation("LieDown",SpriteLoader1.GetAnimation(8,8),0,4.0f);
	m_pObjectSprite->AddAnimation("Jump",SpriteLoader1.GetAnimation(10,10),0,4.0f);
	m_pObjectSprite->AddAnimation("AlertWait",SpriteLoader1.GetAnimation(12,14),1,2.0f);

	m_pObjectSprite->AddAnimation("Swing1",SpriteLoader2.GetAnimation(12,14),2,3.0f);
	m_pObjectSprite->AddAnimation("Swing2",SpriteLoader1.GetAnimation(20,22),2,3.0f);
	m_pObjectSprite->AddAnimation("Swing3",SpriteLoader2.GetAnimation(18,20),2,3.0f);
	m_pObjectSprite->AddAnimation("stab1",SpriteLoader2.GetAnimation(21,22),2,2.0f);
	m_pObjectSprite->AddAnimation("stab2",SpriteLoader2.GetAnimation(24,25),2,2.0f);
	m_pObjectSprite->PlayAnimation("Wait");

	GetSound().CreateSoundFromFile("Sound/Jump.mp3", 1.0f);
	GetSound().CreateSoundFromFile("Sound/swordL.mp3", 1.0f);
	GetSound().CreateSoundFromFile("Sound/swordS.mp3", 1.0f);
}
Example #26
0
void PlaySound(const std::string& name, float gain)
{
	const static ALfloat fz[] = { 0.0f, 0.0f, 0.0f };
	ALuint buf    = GetSound(name);
	ALuint source = GetFreeSource();
	LOG("Sound", LOG_NOTICE, "playing sound %s on channel %d", name.c_str(), source);
	alSourcei(source, AL_BUFFER, buf);
	alSourcei(source, AL_SOURCE_RELATIVE, AL_TRUE);
	alSourcef(source, AL_GAIN, gain);
	alSourcefv(source, AL_POSITION, fz);
	alSourcefv(source, AL_VELOCITY, fz);
	alSourcePlay(source);
}
Example #27
0
	void SoundSystem::PlayPauseSound(const std::string& name) {
		auto s = GetSound(name);
		if (s)
		{
			if (s->getStatus() == sf::Sound::Status::Paused)
			{
				s->play();
			} else
			{
				s->pause();
			}
		}
	}
Example #28
0
WorldPacket * BuildWeatherPacket(uint32 Effect, float Density )
{
	WorldPacket * data = new WorldPacket(SMSG_WEATHER, 13);
	if(Effect == 0 ) // set all parameter to 0 for sunny.
		*data << uint32(0) << float(0) << uint32(0) << uint8(0);		
	else if (Effect == 1) // No sound/density for fog
		*data << Effect << float(0) << uint32(0) << uint8(0);		
	else
		*data << Effect << Density << GetSound(Effect,Density) << uint8(0) ;

	return data;
	//	OUT_DEBUG("Send Weather Update %d, Density %f, Sound %d, uint8(0)", Effect,Density,GetSound(Effect,Density));
}
Example #29
0
void PlaySoundPositional(const std::string& name, vec2 pos, vec2 vel, float gain)
{
	ALfloat fpos[] = {pos.X(), pos.Y(), 0.0f};
	ALfloat fvel[] = {vel.X(), vel.Y(), 0.0f};
	ALuint buf    = GetSound(name);
	ALuint source = GetFreeSource();
	alSourcei(source, AL_BUFFER, buf);
	alSourcei(source, AL_SOURCE_RELATIVE, AL_FALSE);
	alSourcefv(source, AL_POSITION, fpos);
	alSourcefv(source, AL_VELOCITY, fvel);
	alSourcef(source, AL_REFERENCE_DISTANCE, 50.0);
	alSourcef(source, AL_GAIN, gain);
	alSourcePlay(source);
}
BOOL C_ServerItem::Process(long ID,short HitType)
{
	gSoundMgr->PlaySound(GetSound(HitType));
	if(HitType == C_TYPE_LMOUSEUP)
	{
		SetState(static_cast<short>(GetState() | 1));
		Refresh();
	}

	if(Callback_)
		(*Callback_)(ID,HitType,this);

	return(FALSE);
}