Example #1
0
void C4SoundEffect::Clear() {
  while (FirstInst) RemoveInst(FirstInst);
#ifdef HAVE_LIBSDL_MIXER
  if (pSample) Mix_FreeChunk(pSample);
#endif
#ifdef HAVE_LIBSDL_MIXER
  pSample = NULL;
#endif
}
Example #2
0
void C4SoundEffect::Execute() {
  // check for instances that have stopped and volume changes
  for (C4SoundInstance *pInst = FirstInst; pInst;) {
    C4SoundInstance *pNext = pInst->pNext;
    if (!pInst->Playing())
      RemoveInst(pInst);
    else
      pInst->Execute();
    pInst = pNext;
  }
}
Example #3
0
//-------------------------------------------------------------------------------
//
//-------------------------------------------------------------------------------
void tDataSourcesDialog::CreateActions()
{
    /* Create these in order of importance.
    As many as possible will be added to the softkey bar in this order */

    m_pSelectAct = new tAction( tr( "Select" ), this );
    Connect( m_pSelectAct, SIGNAL( triggered() ), this, SLOT( Select() ) );
    m_ActionList << m_pSelectAct;

    m_pConfigureAct = new tAction( tr( "Configure device" ), this );
    Connect( m_pConfigureAct, SIGNAL( triggered() ), this, SLOT( ConfigureDevice() ) );
    m_ActionList << m_pConfigureAct;

    QString scopeName = tProductSettings::Instance().FullSimnetAllowed() ?
        tr( "Group", "The extent or effective range of a selection or setting" ) :
        tr( "Scope", "The extent or effective range of a selection or setting" );
    m_pScopeAct = new tListAction( scopeName, QStringList(), 0, Action::AutoShowPopup, this );
    SetScopeList( m_pScopeAct, true, true, true );
    Connect( m_pScopeAct, SIGNAL( ValueFinalised( int ) ), this, SLOT( OnScopeChanged( int ) ) );
    if (tHAL::Instance()->FeaturePresent(tHAL::ePF_NMEA2000) == true)
    {
        m_ActionList << m_pScopeAct;
    }

    m_pRenameAct = new tAction( tr( "Rename" ), this );
    Connect( m_pRenameAct, SIGNAL( triggered() ), this, SLOT( RenameInst() ) );
    m_ActionList << m_pRenameAct;

    m_pNewInstanceAct = new tAction( tr( "New" ), this );
    Connect( m_pNewInstanceAct, SIGNAL( triggered() ), this, SLOT( NewInstance() ) );
    m_ActionList << m_pNewInstanceAct;

    m_pRemoveAct = new tAction( tr( "Remove" ), this );
    Connect( m_pRemoveAct, SIGNAL( triggered() ), this, SLOT( RemoveInst() ) );
    m_ActionList << m_pRemoveAct;

    QStringList numEnginesList = NumericStringList( 8 );
    m_pEngineNumSetAct = new tListAction( tr("Number of Engines"), numEnginesList, 0, Action::AutoShowPopup, this);
    Connect( m_pEngineNumSetAct, SIGNAL( ValueFinalised( int ) ), this, SLOT( OnUINumEnginesChanged( int ) ) );
    m_ActionList << m_pEngineNumSetAct;

    m_pTransNumSetAct = new tListAction( tr("Number of Transmissions"), numEnginesList, 0, Action::AutoShowPopup, this);
    Connect( m_pTransNumSetAct, SIGNAL( ValueFinalised( int ) ), this, SLOT( OnUINumTransChanged( int ) ) );
    m_ActionList << m_pTransNumSetAct;

    QStringList numTanksList = NumericStringList( 5 );
    m_pTankNumSetAct = new tListAction( tr("Number of Tanks"), numTanksList, 0, Action::AutoShowPopup, this);
    Connect( m_pTankNumSetAct, SIGNAL( ValueFinalised( int ) ), this, SLOT( OnUINumTanksChanged( int ) ) );
    m_ActionList << m_pTankNumSetAct;

    QStringList numTrimTabsList = NumericStringList( 3 );
    m_pTrimTabsNumSetAct = new tListAction( tr("Number of Trim Tabs"), numTrimTabsList, 0, Action::AutoShowPopup, this);
    Connect( m_pTrimTabsNumSetAct, SIGNAL( ValueFinalised( int ) ), this, SLOT( OnNumTrimTabsChanged( int ) ) );
    m_ActionList << m_pTrimTabsNumSetAct;

    if( tProductSettings::Instance().FullSimnetAllowed() )
    {
        m_pAutoSelectAct = new tAction( tr( "Auto Select" ), this );
        Connect( m_pAutoSelectAct, SIGNAL( triggered() ), this, SLOT( OnAutoSelect() ) );
        if (tHAL::Instance()->FeaturePresent(tHAL::ePF_NMEA2000) == true)
        {
            m_ActionList << m_pAutoSelectAct;
        }
    }
    else
    {
        m_pAutoConfigureAct = new tAction( tr( "Auto Configure" ), this );
        Connect( m_pAutoConfigureAct, SIGNAL( triggered() ), this, SLOT( AutoConfigure() ) );
        if (tHAL::Instance()->FeaturePresent(tHAL::ePF_NMEA2000) == true)
        {
            m_ActionList << m_pAutoConfigureAct;
        }
    }

    m_pGlobalResetAct = new tAction( tr( "Reset Global" ), this ); 
    Connect( m_pGlobalResetAct, SIGNAL( triggered() ), this, SLOT( ResetGlobal() ) );
        if (tHAL::Instance()->FeaturePresent(tHAL::ePF_NMEA2000) == true)
    {
        m_ActionList << m_pGlobalResetAct;
    }

    m_pLocalResetAct = new tAction( tr( "Reset Local" ), this );
    Connect( m_pLocalResetAct, SIGNAL( triggered() ), this, SLOT( ResetLocal() ) );
        if (tHAL::Instance()->FeaturePresent(tHAL::ePF_NMEA2000) == true)
    {
        m_ActionList << m_pLocalResetAct;
    }

    // Add as many actions as possible to the softkey bar
    m_KeyList.clear();
    for( int i = 0; (i < m_NumKeys - 1) && (i < m_ActionList.size()); i++ )
    {
        m_KeyList << m_ActionList[i];
    }

    if ( HasTitleCloseButton() == false )
    {
        m_pCloseAct = new tAction( tr( "Close", "Text of the exit dialog button." ), this );
        Connect( m_pCloseAct, SIGNAL( triggered() ),  this, SIGNAL( CloseRequested() ) );
        m_KeyList << m_pCloseAct;
    }    

    // NSW-10765
    // Change what actions are displayed for Cougar
    // This should be done a better way - this will do for now.
    //
    // Configure Device
    // Scope
    // Rename
    // New
    // Remove
    // Auto Configure
    // Reset -> Sub menu
    //          Global
    //          Local

    if( tProductSettings::Instance().GetProductFamily() == tProductSettings::HDSGen2TouchFamily ||
        tProductSettings::Instance().GetProductFamily() == tProductSettings::HDSGen3TouchFamily )
    {
        m_KeyList.clear();

        m_KeyList << m_pConfigureAct;
        m_KeyList << m_pScopeAct;
        m_KeyList << m_pRenameAct;
        m_KeyList << m_pNewInstanceAct;
        m_KeyList << m_pRemoveAct;
        m_KeyList << m_pAutoConfigureAct;

        QList<tAction*> resetSubActions;
        resetSubActions << m_pGlobalResetAct;
        resetSubActions << m_pLocalResetAct;

        m_pResetAct = new tAction( tr("Reset") );
        m_pResetAct->SetSubActions(resetSubActions);
        m_ActionList << m_pSelectAct;

        m_KeyList << m_pResetAct;
    }

}
Example #4
0
static
PCODEBLOCK SetBlockBreakAndRetrunLevels(PINTERMEDIATE_STATE psState, PCODEBLOCK psStartBlock, IMG_UINT32 uBrkNestingLevel, IMG_UINT32 uRetNestingLevel, CODEBLOCK** ppsEnabledEndAfterEarlyRetBlock)
{
	while(psStartBlock->uNumSuccs > 0)
	{
		if (psStartBlock->psBody != NULL)
		{
			switch (psStartBlock->psBody->eOpcode)
			{
				case ICNDST:
				{
					uBrkNestingLevel++;
					uRetNestingLevel++;
					psStartBlock = psStartBlock->asSuccs[0].psDest;
					break;
				}
				case ICNDEF:
				{
					psStartBlock = psStartBlock->asSuccs[0].psDest;
					break;
				}
				case ICNDEND:
				{
					uBrkNestingLevel--;
					uRetNestingLevel--;
					psStartBlock = psStartBlock->asSuccs[0].psDest;
					break;
				}
				case ICNDSTLOOP:
				{
					uRetNestingLevel += 2; 
					psStartBlock = SetLoopBreakAndRetrunLevels(psState, psStartBlock->asSuccs[0].psDest, uRetNestingLevel, ppsEnabledEndAfterEarlyRetBlock);
					uRetNestingLevel -= 2;
					break;
				}
				case ICNDLT:
				{
					return psStartBlock->asSuccs[1].psDest;
				}
				case IBREAK:
				{
					PINST psInstToRemove;
					psInstToRemove = psStartBlock->psBody;
					RemoveInst(psState, psStartBlock, psStartBlock->psBody);
					FreeInst(psState, psInstToRemove);
					AppendExecPredInst(psState, psStartBlock, ICNDSM, USC_PREDREG_NONE, IMG_TRUE, USC_PREDREG_NONE, uBrkNestingLevel + 2);
					psStartBlock->u.sCond.bDontGenBranch = IMG_TRUE;
					psStartBlock = psStartBlock->asSuccs[1].psDest;
					break;
				}
				case ICONTINUE:
				{
					PINST psInstToRemove;
					psInstToRemove = psStartBlock->psBody;
					RemoveInst(psState, psStartBlock, psStartBlock->psBody);
					FreeInst(psState, psInstToRemove);
					AppendExecPredInst(psState, psStartBlock, ICNDSM, USC_PREDREG_NONE, IMG_TRUE, USC_PREDREG_NONE, uBrkNestingLevel + 1);
					psStartBlock = psStartBlock->asSuccs[1].psDest;
					break;
				}
				case IRETURN:
				{
					if (((*ppsEnabledEndAfterEarlyRetBlock) == NULL) && (psStartBlock->psOwner->psExit->psBody != NULL))
					{
						PCODEBLOCK psCndExeEndBlock = AllocateBlock(psState, psStartBlock->psOwner);						
						AppendExecPredInst(psState, psCndExeEndBlock, ICNDEND, USC_PREDREG_NONE, IMG_FALSE /* uCondPredInv */, USC_PREDREG_NONE, 1);
						RedirectEdgesFromPredecessors(psState, psStartBlock->psOwner->psExit, psCndExeEndBlock, IMG_FALSE);
						SetBlockUnconditional(psState, psCndExeEndBlock, psStartBlock->psOwner->psExit);						
						*ppsEnabledEndAfterEarlyRetBlock = psCndExeEndBlock;
					}
					{
						PINST psInstToRemove;
						psInstToRemove = psStartBlock->psBody;
						RemoveInst(psState, psStartBlock, psStartBlock->psBody);
						FreeInst(psState, psInstToRemove);
						AppendExecPredInst(psState, psStartBlock, ICNDSM, USC_PREDREG_NONE, IMG_TRUE, USC_PREDREG_NONE, uRetNestingLevel);
						psStartBlock->u.sCond.bDontGenBranch = IMG_TRUE;
						if ((*ppsEnabledEndAfterEarlyRetBlock) == NULL)
						{
							SetBlockConditionalExecPred(psState, psStartBlock, psStartBlock->psOwner->psExit, psStartBlock->asSuccs[0].psDest, IMG_FALSE);
						}
						else
						{
							SetBlockConditionalExecPred(psState, psStartBlock, *ppsEnabledEndAfterEarlyRetBlock, psStartBlock->asSuccs[0].psDest, IMG_FALSE);
						}
						psStartBlock = psStartBlock->asSuccs[1].psDest;
					}
					break;
				}
				default:
				{
					ASSERT(psStartBlock->uNumSuccs == 1);
					psStartBlock = psStartBlock->asSuccs[0].psDest;
				}
			}
		}
		else
		{
			ASSERT(psStartBlock->uNumSuccs == 1);
			psStartBlock = psStartBlock->asSuccs[0].psDest;
		}
	}
	return psStartBlock;
}