Пример #1
0
void CGameApp::StartFadeIn( const CPalette& aPalette )
{
	iEffectData->iStarted=TimerCounter;
	iEffectData->iDuration=KTimerFreq/2;
	iEffectData->iPalette=&aPalette;

	iEffectData->iStateTransition=false;
	iEffectData->iFadeIn = true;
	iEffectData->iEnabled = true;

	iEffectData->iFaderMethod = &CGraphicsFader::FadeIn;
	saveTimer();
}
Пример #2
0
void CGameApp::StartFadeOut(CState aNextState)
{
	iEffectData->iFaderMethod = &CGraphicsFader::FadeOut;
	iEffectData->iStarted=TimerCounter;
	iEffectData->iDuration=KTimerFreq/2;
	iGGI->GD()->GetPalette(iEffectData->iSparePalette);
	iEffectData->iPalette=&iEffectData->iSparePalette;
	iEffectData->iNextState=aNextState;
	iEffectData->iStateTransition=true;
	iEffectData->iFadeIn = false;
	iEffectData->iEnabled = true;

	saveTimer();
}
Пример #3
0
void timer::runTimer()
{
    pthread_mutex_lock( &mutex );
    std::multimap<time_t, struct timer_entry>::iterator it = timer_list.begin();
    struct timer_entry act_timer = (*it).second;

    if (act_timer.starttime > time(0))
    {
        pthread_mutex_unlock( &mutex );

        return;
    }

    timer_list.erase(it);
    pthread_mutex_unlock( &mutex );

    saveTimer();

    if (act_timer.type == 0)
        (*hardware_obj).shutdown();
    else if (act_timer.type == 1)
        (*hardware_obj).reboot();
    else if (act_timer.type == 2)
    {
        //int last_channel = (*channels_obj).getCurrentChannelNumber();
        (*channels_obj).setCurrentChannel(act_timer.channel);
        (*channels_obj).zapCurrentChannel();
        /*if (act_timer.duration != 0)
        	addTimer(time(0) + act_timer.duration, 2, 0, last_channel);*/
        (*channels_obj).setCurrentOSDProgramInfo();
        (*hardware_obj).fnc(0);
        (*hardware_obj).fnc(2);

        (*channels_obj).receiveCurrentEIT();
        (*channels_obj).setCurrentOSDProgramEIT();
        (*channels_obj).updateCurrentOSDProgramAPIDDescr();

        vars->addEvent("VCR_START");
        //std::cout << "Starttime: " << act_timer.starttime << std::endl << "Duration: " << act_timer.duration << std::endl;
        ////std::cout << (act_timer.starttime + (act_timer.duration / 60)) << std::endl;
        addTimer((act_timer.starttime + act_timer.duration ) - 1, 3, "stop-vcr");
    }
    else if (act_timer.type == 3)
    {
        vars->addEvent("VCR_STOP");
    }
}
Пример #4
0
void CGameSubStateOngoing::CheckUserInput() 
{
	char text[100];
	float temp;
    int a;
	int key;

	CEventHandler* eh = iStateController->EventHandler();
	
	if (!iDynData->MessageWritingMode()&&eh->Kbhit())
	{
		key=eh->Getch().sym;

		if (key==SDLK_RETURN && iDynData->NetworkMode()!=ENetworkModeNone) 
		{
			eh->State(SDLK_RETURN)=0;
			iDynData->SetMessageWritingMode(true);
			iDynData->NetMsgReset();
		}
		else
			if (key==SDLK_ESCAPE)
			{
				eh->State(SDLK_ESCAPE)=0;
				eh->GrabInputs(false);
				iStateController->GUIStateController()->State()->SetStateAndSave(CState(CState::EMainStateGame,EGameStateQuit));
				saveTimer();
				eh->ResetStack();
			}
	}

	if (iDynData->MessageWritingMode())
	{
		WriteNetworkMessage( eh );
	}
	
	if (eh->State(SDLK_PAGEUP)) 
	{
        if (iStateController->GUIStateController()->Options()->Data().iMouseSensitivity<KMouseSensitivityMax) 
			iStateController->GUIStateController()->Options()->Data().iMouseSensitivity+=KMouseSensitivityStep; 
	        ASSERT(EF_SNPRINTF(text,100,"Mouse sensitivity %.2f",iStateController->GUIStateController()->Options()->Data().iMouseSensitivity*100)>0);
		iStateController->GUIStateController()->MessageBoard()->AddMessage(text);
		eh->State(SDLK_PAGEUP)=0;
    }

	if (eh->State(SDLK_PAGEDOWN)) 
	{
        if (iStateController->GUIStateController()->Options()->Data().iMouseSensitivity>KMouseSensitivityMin) 
			iStateController->GUIStateController()->Options()->Data().iMouseSensitivity-=KMouseSensitivityStep; 

	        ASSERT(EF_SNPRINTF(text,100,"Mouse sensitivity %.2f",iStateController->GUIStateController()->Options()->Data().iMouseSensitivity*100)>0);
			iStateController->GUIStateController()->MessageBoard()->AddMessage(text);
        eh->State(SDLK_PAGEDOWN)=0;
    }

    if (eh->State(SDLK_F4))
	{
		++iStateController->GUIStateController()->Options()->Data().iMouseMode%=iDynData->LocalPlayers().size()+1;
		iDynData->UpdateMouseOwner();
		ASSERT(EF_SNPRINTF(text,100,"Mouse mode: %s",iStateController->GUIStateController()->Options()->MouseModeText())>0);
		iStateController->GUIStateController()->MessageBoard()->AddMessage(text);
        eh->State(SDLK_F4)=0;
    }
	
	// Hide/Show Map
	if (eh->State(SDLK_F5)) 
	{
		iDynData->iShowMap=!iDynData->iShowMap;
		eh->State(SDLK_F5)=0;
	}

	// Hide/Show framerate
	if (eh->State(SDLK_F6)) 
	{
		iDynData->iDrawFrames=!iDynData->iDrawFrames;
		eh->State(SDLK_F6)=0;
	}

	// Player key handling
	for(a=0; a<iDynData->LocalPlayers().size(); a++) 
		if (!iDynData->LocalPlayers()[a]->iDead) 
			iDynData->LocalPlayers()[a]->CheckKeys(a,eh, 
			iDynData->PlayerDrawRect(a));

	/* Handle mouse input */
	if (iDynData->MouseOwner()&&
		!iDynData->MouseOwner()->iDead)
		{
			temp=eh->GetMouse().XRel()*((float)iStateController->GUIStateController()->Options()->Data().iMouseSensitivity);

			if (temp<-KMaxMouseRotationPerFrame) temp=-KMaxMouseRotationPerFrame;
			if (temp>KMaxMouseRotationPerFrame)  temp=KMaxMouseRotationPerFrame;

			iDynData->MouseOwner()->Rotate(temp);
			eh->GetMouse().SetXRel(0);
			eh->GetMouse().SetYRel(0);

				// Check mouse wheel down
			if (eh->GetMouse().Button(CMouse::EButtonWheelDown))
			{
				iDynData->MouseOwner()->ChangeWeapon(false);
				eh->GetMouse().DecButton(CMouse::EButtonWheelDown);
			}

			// Check mouse wheel up
			if (eh->GetMouse().Button(CMouse::EButtonWheelUp))
			{
				iDynData->MouseOwner()->ChangeWeapon(true);
				eh->GetMouse().DecButton(CMouse::EButtonWheelUp);
			}
		}
}