예제 #1
0
int DoZillaDeathMelt(short SpriteNum)
{
    SPRITEp sp = &sprite[SpriteNum];
    USERp u = User[SpriteNum];
    static SWBOOL alreadydid = FALSE;

    if (RANDOM_RANGE(1000) > 800)
        SpawnGrenadeExp(SpriteNum);

    u->ID = ZILLA_RUN_R0;
    RESET(u->Flags, SPR_JUMPING|SPR_FALLING|SPR_MOVED);

    //DoMatchEverything(NULL, sp->lotag, ON);
    if (!SW_SHAREWARE && gs.MusicOn && !alreadydid)
    {
        PlaySong(0, RedBookSong[Level], TRUE, TRUE);
        alreadydid = TRUE;
    }

    //KeepActorOnFloor(SpriteNum);
    getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz);
    u->lo_sectp = &sector[sp->sectnum];
    u->hi_sectp = &sector[sp->sectnum];
    u->lo_sp = NULL;
    u->hi_sp = NULL;
    sp->z = u->loz;

    BossSpriteNum[2] = -2;
    return 0;
}
예제 #2
0
파일: wasap.c 프로젝트: Erikhht/TCPMP
static void LoadFile(HWND hWnd)
{
	HANDLE fh;
	static unsigned char module[65000];
	DWORD module_len;
	fh = CreateFile(strFile, GENERIC_READ, 0, NULL, OPEN_EXISTING,
	                FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
	if (fh == INVALID_HANDLE_VALUE)
		return;
	if (!ReadFile(fh, module, sizeof(module), &module_len, NULL)) {
		CloseHandle(fh);
		return;
	}
	CloseHandle(fh);
	WaveOut_Close();
	if (ASAP_Load(strFile, module, (unsigned int) module_len)) {
		if (!WaveOut_Open(FREQUENCY, use_16bit, ASAP_GetChannels())) {
			SetSongs(0);
			Tray_Modify(hWnd, hStopIcon);
			MessageBox(hWnd, "Error initalizing WaveOut", APP_TITLE,
					   MB_OK | MB_ICONERROR);
			return;
		}
		SetSongs(ASAP_GetSongs());
		PlaySong(hWnd, ASAP_GetDefSong());
	}
	else {
		SetSongs(0);
		Tray_Modify(hWnd, hStopIcon);
		MessageBox(hWnd, "Unsupported file format", APP_TITLE,
		           MB_OK | MB_ICONERROR);
	}
}
예제 #3
0
파일: main.cpp 프로젝트: xuxiaojing/antares
void MainScreen::become_front() {
    InterfaceScreen::become_front();
    if (Preferences::preferences()->play_idle_music() && !SongIsPlaying()) {
        LoadSong(kTitleSongID);
        SetSongVolume(kMaxMusicVolume);
        PlaySong();
    }
}
예제 #4
0
EGameMode CMatch::Update (void) 
{
    // Increase elapsed time since mode has started
    m_ModeTime += m_pTimer->GetDeltaTime();
    
    // If we have to make the first black screen
    if (m_ModeTime <= BLACKSCREEN_DURATION)
    {

    }
    // If the first black screen is done and we have to make a little 
    // pause to allow the players to see the arena before playing
    else if (m_ModeTime <= BLACKSCREEN_DURATION + PAUSE_BEGIN)
    {

    }
    // If match is currently playing and it's not over
    else if (!m_MatchOver)
    {   
        PlaySong ();                        //!< @see PlaySong()
        ProcessPlayerCommands ();           //!< @see ProcessPlayerCommands()
        ManagePauseMessage ();              //!< @see ManagePauseMessage()
        UpdateMatch ();                     //!< @see UpdateMatch()
        ManageHurryUpMessage ();            //!< @see ManageHurryUpMessage()
        ManageMatchOver ();                 //!< @see ManageMatchOver()
    }
    // If the match is over and we have make a pause before the last black screen
    else if (m_ModeTime <= m_ExitModeTime)
    {
        // Update the match
        m_Board.Update ();
        m_Arena.Update (m_pTimer->GetDeltaTime());
    }
    // If the pause is over and we have to make the last black screen
    else if (m_ModeTime <= m_ExitModeTime + BLACKSCREEN_DURATION)
    {

    }
    // If the last black screen is over then ask for another game mode
    else
    {
        // If it's a draw game
        if (m_WinnerPlayer == NO_WINNER_PLAYER)
        {
            // Ask for a game mode change to draw game screen
            return GAMEMODE_DRAWGAME;
        }
        // If there is a winner
        else
        {
            // Ask for a game mode change to winner screen
            return GAMEMODE_WINNER;
        }
    }

    // Stay in this game mode
    return GAMEMODE_MATCH; 
}
예제 #5
0
void PlaySongCurrPos(struct Tracker_Windows *window){
	struct Blocks *block;
	struct WBlocks *wblock;
	Place *place;
	int playpos;
	bool changeblock=false;

	wblock=window->wblock;

	PlayStopReally(false);

	root->setfirstpos=false;

	playpos=root->curr_playlist;
                
	block=BL_GetBlockFromPos(playpos);
	if(block==NULL) return;

	if(wblock->l.num!=block->l.num){
		wblock=ListFindElement1(&window->wblocks->l,block->l.num);
		changeblock=true;
		root->setfirstpos=true;
	}

	if(
		! changeblock &&
		playpos==root->song->length-1 &&
		wblock->curr_realline==wblock->num_reallines  // ??. Never supposed to happen.
	){
		return;
	}

	if(wblock->curr_realline==0) root->setfirstpos=true;


	debug("contsong, playpos: %d , root->curr_block: %d\n",playpos,root->curr_block);

	if(changeblock){
		place=PlaceGetFirstPos();
		pc->seqtime=0;
	}else{
		place=&wblock->reallines[wblock->curr_realline]->l.p;
		pc->seqtime=-Place2STime(wblock->block,place);
	}
	debug("contsong, time: %d, playpos: %d , root->curr_block: %d\n",pc->seqtime,playpos,root->curr_block);

	place->line++;
	debug("nextline: %d\n",Place2STime(wblock->block,place));
	place->line--;

	PlaySong(place,playpos);
}
예제 #6
0
void CSoundManager::FadeSong(int Nr, float Speed, int End, bool Paused)
{
	if (false == InitSuccessfull)
		return;

	its_Songs[Nr]->FadingVolume	= Speed;
	its_Songs[Nr]->FadingEnd	= (int)(its_GlobalMusicVolume * End / 100.0f);
	its_Songs[Nr]->FadingPaused = Paused;

	// Einfaden ? Dann ggf den Song erst mal starten, je nach Angabe
	// neu von Anfang an oder Pausierung aufheben
	if (Speed > 0.0f)
		PlaySong(Nr, Paused);

} // FadeSong
예제 #7
0
EGameMode CDemo::Update (void) 
{
    // Increase elapsed time since mode has started
    m_ModeTime += m_pTimer->GetDeltaTime();
    
    // If we have to make the first black screen
    if (m_ModeTime <= BLACKSCREEN_DURATION)
    {

    }
    // If the first black screen is done and we have to make a little 
    // pause to allow the players to see the arena before playing
    else if (m_ModeTime <= BLACKSCREEN_DURATION + PAUSE_BEGIN)
    {

    }
    // If match is currently playing and it's not over
    else if (!m_MatchOver)
    {
        PlaySong();
        ProcessPlayerCommands();
        ManageExit();
        UpdateMatch();
        UpdateDemoText();
        ManageHurryUpMessage();
        ManageMatchOver();        
    }
    // If the match is over and we have make a pause before the last black screen
    else if (m_ModeTime <= m_ExitModeTime)
    {
        m_Board.Update ();
        m_Arena.Update (m_pTimer->GetDeltaTime());
    }
    // If the pause is over and we have to make the last black screen
    else if (m_ModeTime <= m_ExitModeTime + BLACKSCREEN_DURATION)
    {

    }
    // If the last black screen is over then ask for another game mode
    else
    {
        // Ask for a switch to the title screen
        return GAMEMODE_TITLE;
    }

    // Stay in this game mode
    return GAMEMODE_DEMO; 
}
예제 #8
0
void PlaySongFromStart(struct Tracker_Windows *window){
	PlayStopReally(false);

	BS_SelectPlaylistPos(0);
	debug("root->curr_block: %d\n",root->curr_block);
	root->setfirstpos=true;
	pc->seqtime=0;

	InitAllInstrumentsForPlaySongFromStart();

        {
          Place place;
          PlaceSetFirstPos(&place);
          PlaySong(&place,0);
        }
}
예제 #9
0
int DoDeathSpecial(short SpriteNum)
{
    SPRITEp sp = &sprite[SpriteNum];
    USERp u = User[SpriteNum];
    static SWBOOL alreadydid = FALSE;

    DoMatchEverything(NULL, sp->lotag, ON);

    if (!SW_SHAREWARE && gs.MusicOn && !alreadydid)
    {
        PlaySong(0, RedBookSong[Level], TRUE, TRUE);
        alreadydid = TRUE;
    }

    BossSpriteNum[0] = -2;
    return 0;
}
예제 #10
0
void audio::AudioEngineFmod::Update(math::Real deltaTime)
{
	if (m_currentSong != nullptr)
	{
		if (fade_states::FADE_IN == m_fade)
		{
			float volume;
			m_currentSong->getVolume(&volume);
			auto nextVolume = volume + deltaTime / M_SONG_FADE_IN_TIME;
			if (nextVolume >= 1.0f)
			{
				nextVolume = 1.0f;
				m_fade = fade_states::FADE_NONE;
			}
			DEBUG_LOG_AUDIO("Increasing volume by ", nextVolume - volume, ". Current volume = ", nextVolume);
			m_currentSong->setVolume(nextVolume);
		}
		else if (fade_states::FADE_OUT == m_fade)
		{
			float volume;
			m_currentSong->getVolume(&volume);
			const auto nextVolume = volume - deltaTime / M_SONG_FADE_IN_TIME;
			if (nextVolume <= 0.0f)
			{
				m_currentSong->stop();
				m_currentSong = nullptr;
				m_currentSongPath.clear();
				m_fade = fade_states::FADE_NONE;
			}
			else
			{
				m_currentSong->setVolume(nextVolume);
			}
		}
	}
	else if (!m_nextSongPath.empty())
	{
		PlaySong(m_nextSongPath);
		m_nextSongPath.clear();
	}

	FMOD_RESULT fmodResult = m_system->update();
	CHECK_CONDITION_ALWAYS_AUDIO(fmodResult == FMOD_OK, utility::logging::ERR, "Updating audio system has ended with error code ", fmodResult, ". ", FMOD_ErrorString(fmodResult));
}
예제 #11
0
void ScrollTextScreen::become_front() {
    // If a song was requested, play it.
    if (_play_song && Preferences::preferences()->play_idle_music()) {
        if (SongIsPlaying()) {
            StopAndUnloadSong();
        }
        LoadSong(_song_id);
        SetSongVolume(kMaxMusicVolume);
        PlaySong();
    }

    _start = now_usecs();
    _next_shift = _start;

    _clip = Rect(0, 0, world.width(), kScrollTextHeight);
    _clip.center_in(world);

    _position = _build_pix.size().as_rect();
    _position.center_in(_clip);
    _position.offset(0, _clip.bottom - _position.top);
}
예제 #12
0
파일: main.c 프로젝트: evakimox/EC450stuff
void main(void) {
    //Use WDT to control how long each tone is
    WDTCTL = (WDTPW + WDTTMSEL + WDTCNTCL + 1);
    IE1 |= WDTIE;

    BCSCTL1 = CALBC1_1MHZ;
    DCOCTL = CALDCO_1MHZ;

    //Call timers, buttons interrupts
    initializebuttons();
    initTimerA();
    TimeCount=0;

    _bis_SR_register(GIE);

    //call to play song
    while(1) {
        if (playflag) {
            PlaySong();
            playflag=0;
        }	//play only once
    }
}
int main()
{
	system("COLOR 1A");
	Queue *snake = Queue_Init();

	COORD screenResolution = {WIDTH, HEIGHT};
	SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), screenResolution);

	SetConsoleTitle("TU-Snake");

	COORD directions[4] = {
		{0, -1},
		{0, 1},
		{1, 0},
		{-1, 0},
	};

	Direction direction = LEFT;

	unsigned int keyboardInput = 0;
	double snakeSpeed = SnakeSpeed;

	COORD food = {RandomNumber(0, WIDTH), RandomNumber(0, HEIGHT)};
	int centerX = WIDTH / 2;
	int centerY = HEIGHT / 2;

	//InitSnake
	for (int i = 0; i < SnakeInitializeSize; i++)
	{
		COORD position = { centerX - i , centerY};
		Queue_Push(snake, position);
	}

	PrintSnake(snake);

	while (1)
	{
		if (_kbhit() == 1)
		{
			keyboardInput = _getch();

			switch (keyboardInput)
			{
			case 119 : //up
				if (direction != DOWN)
					direction = UP;
				break;
			case 115 : //down
				if (direction != UP)
					direction = DOWN;
				break;
			case 97 : //left
				if (direction != RIGHT)
					direction = LEFT;
				break;
			case 100 : //right
				if (direction != LEFT)
					direction = RIGHT;
				break;
			default:
				break;
			}
		}
		
		COORD snakeHead = Queue_Back(snake);
		COORD nextDirection = directions[direction];
		COORD snakeNewHead = {snakeHead.X + nextDirection.X, snakeHead.Y + nextDirection.Y};

		//check for collisions
		if (snakeNewHead.X < 0 || snakeNewHead.Y < 0 || 
			snakeNewHead.X > WIDTH || snakeNewHead.Y > HEIGHT || Queue_Contains (snake, snakeNewHead))
		{
			char text[] = "!!!Game is over!!!";
			COORD startPoint = {centerX - strlen(text)/2, centerY};
			GoToPosition(startPoint);
			system("COLOR CF");
			printf("%s", text);
			PlaySong();
			break;
		}

		//add new head to snake
		Queue_Push(snake, snakeNewHead);

		//check for grow
		if (snakeNewHead.X == food.X && snakeNewHead.Y == food.Y)
		{
			food.X = RandomNumber(0, WIDTH);
			food.Y = RandomNumber(0, HEIGHT);
			if (snakeSpeed - 1 > 1)
				snakeSpeed--;
		}
		else
		{
			Queue_Pop(snake);	
		}

		PrintSnake(snake);

		GoToPosition(food);
		printf("%c", SnakeFood);


		if (snakeSpeed - 0.1 > 1)
			snakeSpeed -= 0.1;
		Sleep((int)snakeSpeed);
		ClearScreen;
	}

	system("pause > ''");
	return 0;
}
예제 #14
0
파일: wasap.c 프로젝트: Erikhht/TCPMP
static LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
                                    LPARAM lParam)
{
	UINT idc;
	POINT pt;
	PCOPYDATASTRUCT pcds;
	switch (msg) {
	case WM_COMMAND:
		if (opening)
			break;
		idc = LOWORD(wParam);
		switch (idc) {
		case IDM_OPEN:
			SelectAndLoadFile(hWnd);
			break;
		case IDM_STOP:
			WaveOut_Stop();
			Tray_Modify(hWnd, hStopIcon);
			break;
		case IDM_ABOUT:
			MessageBox(hWnd,
				ASAP_CREDITS
				"WASAP icons (C) 2005 Lukasz Sychowicz\n\n"
				ASAP_COPYRIGHT,
				APP_TITLE " " ASAP_VERSION,
				MB_OK | MB_ICONINFORMATION);
			break;
		case IDM_EXIT:
			PostQuitMessage(0);
			break;
		default:
			if (idc >= IDM_SONG1 && idc < IDM_SONG1 + songs) {
				WaveOut_Stop();
				PlaySong(hWnd, idc - IDM_SONG1);
			}
			else if (idc >= IDM_QUALITY_RF && idc <= IDM_QUALITY_MB3)
				SetQuality(hWnd, use_16bit, idc - IDM_QUALITY_RF);
			else if (idc >= IDM_8BIT && idc <= IDM_16BIT)
				SetQuality(hWnd, idc - IDM_8BIT, quality);
			break;
		}
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case MYWM_NOTIFYICON:
		if (opening) {
			SetForegroundWindow(GetLastActivePopup(hWnd));
			break;
		}
		switch (lParam) {
		case WM_LBUTTONDOWN:
			SelectAndLoadFile(hWnd);
			break;
		case WM_RBUTTONDOWN:
			GetCursorPos(&pt);
			SetForegroundWindow(hWnd);
			TrackPopupMenu(hTrayMenu,
				TPM_RIGHTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON,
				pt.x, pt.y, 0, hWnd, NULL);
			PostMessage(hWnd, WM_NULL, 0, 0);
			break;
		default:
			break;
		}
		break;
	case WM_COPYDATA:
		pcds = (PCOPYDATASTRUCT) lParam;
		if (pcds->dwData == 'O' && pcds->cbData <= sizeof(strFile)) {
			memcpy(strFile, pcds->lpData, pcds->cbData);
			LoadFile(hWnd);
		}
		break;
	default:
		return DefWindowProc(hWnd, msg, wParam, lParam);
	}
	return 0;
}
void ClientSongManager::HandleMessage(MsgEntry* message)
{
    uint8_t msgType = message->GetType();

    // Playing
    if(msgType == MSGTYPE_PLAY_SONG)
    {
        uint songHandleID;
        csVector3 playerPos;
        iSoundManager* sndMngr;

        psPlaySongMessage playMsg(message);

        // getting player's position
        playerPos = psengine->GetCelClient()->FindObject(playMsg.songID)->GetMesh()->GetMovable()->GetFullPosition();

        // if sounds are not active the song will still be heard by players around
        sndMngr = psengine->GetSoundManager();
        if(sndMngr->IsSoundActive(iSoundManager::INSTRUMENT_SNDCTRL))
        {
            // playing
            if(playMsg.toPlayer)
            {
                songHandleID = PlaySong(sheet, playMsg.instrName, playerPos);
            }
            else
            {
                // decompressing score
                csString uncompressedScore;
                psMusic::ZDecompressSong(playMsg.musicalScore, uncompressedScore);

                songHandleID = PlaySong(uncompressedScore, playMsg.instrName, playerPos);
            }

            // handling instrument not defined
            if(songHandleID == 0)
            {
                // stopping song, informing server and player
                if(playMsg.toPlayer)
                {
                    // noticing server
                    StopMainPlayerSong(true);

                    // noticing user
                    psSystemMessage msg(0, MSG_ERROR, PawsManager::GetSingleton().Translate("You cannot play this song!"));
                    msg.FireEvent();
                }

                return;
            }

            // saving song ID
            if(playMsg.toPlayer)
            {
                mainSongID = songHandleID;
            }
            else
            {
                songMap.Put(playMsg.songID, songHandleID);
            }
        }
        else
        {
            mainSongID = NO_SONG;
        }
    }

    // Stopping
    else if(msgType == MSGTYPE_STOP_SONG)
    {
        psStopSongMessage stopMsg(message);

        if(stopMsg.toPlayer)
        {
            csString errorStr;

            if(mainSongID == (uint)PENDING) // no instrument equipped, invalid MusicXML or low skill
            {
                // updating mainSongId
                mainSongID = NO_SONG;

                // updating listeners
                TriggerListeners();
            }
            else if(mainSongID == NO_SONG) // sound are deactivated or song has ended
            {
                TriggerListeners();
            }
            else // player's mode has changed
            {
                StopMainPlayerSong(false);
            }

            // noticing user
            switch(stopMsg.errorCode)
            {
            case psStopSongMessage::ILLEGAL_SCORE:
                errorStr = "Illegal musical score!";
                break;
            case psStopSongMessage::NO_INSTRUMENT:
                errorStr = "You do not have an equipped musical instrument!";
                break;
            }

            if(!errorStr.IsEmpty())
            {
                psSystemMessage msg(0, MSG_ERROR, PawsManager::GetSingleton().Translate(errorStr));
                msg.FireEvent();
            }
        }
        else if(songMap.Contains(stopMsg.songID))
        {
            StopSong(songMap.Get(stopMsg.songID, 0));
            songMap.DeleteAll(stopMsg.songID);
        }
    }
}