Example #1
0
//-----------------------------------------------------------------------------
// Purpose: Start the buzzer's engine sound.
//-----------------------------------------------------------------------------
void C_ASW_Buzzer::OnDataChanged( DataUpdateType_t type )
{
	BaseClass::OnDataChanged( type );

	if (( m_nEnginePitch1 <= 0 ) )
	{
		SoundShutdown();
	}
	else
	{
		SoundInit();		
	}
	UpdateFireEmitters();

	if ( type == DATA_UPDATE_CREATED )
	{
		// We want to think every frame.
		SetNextClientThink( CLIENT_THINK_ALWAYS );

		if ( !m_pTrailEffect )
		{
			m_pTrailEffect = this->ParticleProp()->Create( "buzzer_trail", PATTACH_ABSORIGIN_FOLLOW );
		}
	}
}
Example #2
0
void MusicStartup( void )
   {
   int32 status;
   int musicdevicetype;

   // if they chose None lets return
   if (MusicDevice < 0) {
      return;
   } else if (MusicDevice == 0) {
      musicdevicetype = ASS_AutoDetect;
   } else {
      musicdevicetype = MusicDevice - 1;
   }
   
   status = MUSIC_Init( musicdevicetype, 0 );

   if ( status == MUSIC_Ok )
      {
      MUSIC_SetVolume( MusicVolume );
      }
   else
   {
      initprintf("Couldn't find selected sound card, or, error w/ sound card itself.\n");

      SoundShutdown();
      uninittimer();
      uninitengine();
      CONTROL_Shutdown();
      CONFIG_WriteSetup();
      KB_Shutdown();
      uninitgroupfile();
      //unlink("duke3d.tmp");
      exit(-1);
   }
}
Example #3
0
void ShutDown( void )
{
    KB_Shutdown();
    TIME_RemoveTimer( timerhandle );
    SoundShutdown();
    MusicShutdown();
    CONFIG_WriteSetup();
}
Example #4
0
//-----------------------------------------------------------------------------
// Purpose: Start the buzzer's engine sound.
//-----------------------------------------------------------------------------
void C_ASW_Buzzer::UpdateOnRemove( void )
{
	BaseClass::UpdateOnRemove();
	SoundShutdown();
	m_bOnFire = false;
	UpdateFireEmitters();

	if ( m_pTrailEffect )
	{
		ParticleProp()->StopEmission( m_pTrailEffect, false, true, false );
		m_pTrailEffect = NULL;
	}
}
Example #5
0
void soundexit(char *s)
{
    SoundShutdown();
    uninittimer();
    uninitengine();
    CONTROL_Shutdown();
    CONFIG_WriteSetup();
    KB_Shutdown();
    uninitgroupfile();
    unlink("duke3d.tmp");
    puts(s);
    exit(-1);
}
Example #6
0
void MusicStartup( void )
{
    int32 status;

    // if they chose None lets return
    if ((MusicDevice == NumSoundCards) || (eightytwofifty && numplayers > 1) ) {
        return;
    }

    // satisfy AWE32 and WAVEBLASTER stuff
    BlasterConfig.Midi = MidiPort;

    // Do special Sound Blaster, AWE32 stuff
    if (
        ( FXDevice == SoundBlaster ) ||
        ( FXDevice == Awe32 )
    ) {
        int MaxVoices;
        int MaxBits;
        int MaxChannels;

        FX_SetupSoundBlaster
        (
            BlasterConfig, (int *)&MaxVoices, (int *)&MaxBits, (int *)&MaxChannels
        );
    }
    status = MUSIC_Init( MusicDevice, MidiPort );

    if ( status == MUSIC_Ok ) {
        MUSIC_SetVolume( MusicVolume );
    } else {
        SoundShutdown();
        uninittimer();
        uninitengine();
        CONTROL_Shutdown();
        CONFIG_WriteSetup();
        KB_Shutdown();
        uninitgroupfile();
        unlink("duke3d.tmp");
        Error(EXIT_FAILURE, "Couldn't find selected sound card, or, error w/ sound card itself\n");
    }
}
Example #7
0
//-----------------------------------------------------------------------------
// Purpose: Start the manhack's engine sound.
//-----------------------------------------------------------------------------
void C_NPC_Manhack::OnDataChanged( DataUpdateType_t type )
{
	BaseClass::OnDataChanged( type );

	if (( m_nEnginePitch1 < 0 ) || ( m_nEnginePitch2 < 0 ) )
	{
		SoundShutdown();
	}
	else
	{
		SoundInit();
		if ( m_pEngineSound1 && m_pEngineSound2 )
		{
			float dt = ( m_flEnginePitch1Time >= gpGlobals->curtime ) ? m_flEnginePitch1Time - gpGlobals->curtime : 0.0f;
			CSoundEnvelopeController::GetController().SoundChangePitch( m_pEngineSound1, m_nEnginePitch1, dt );
			dt = ( m_flEnginePitch2Time >= gpGlobals->curtime ) ? m_flEnginePitch2Time - gpGlobals->curtime : 0.0f;
			CSoundEnvelopeController::GetController().SoundChangePitch( m_pEngineSound2, m_nEnginePitch2, dt );
		}
	}
}
void C_ASW_AOEGrenade_Projectile::UpdateOnRemove()
{
	BaseClass::UpdateOnRemove();
	SoundShutdown();
}
Example #9
0
//-----------------------------------------------------------------------------
// Purpose: Find a point on my path near to the target and move toward it
//-----------------------------------------------------------------------------
void CTankTrainAI::Think( void )
{
	CFuncTrackTrain *pTrain = m_hTrain;

	if ( !pTrain || pTrain->m_lifeState != LIFE_ALIVE )
	{
		SoundShutdown();
		if ( pTrain )
			UTIL_RemoveHierarchy( pTrain );
		UTIL_Remove( this );
		return;
	}

	int desired = 0;
	CBaseEntity *pTarget = m_hTargetEntity;
	if ( pTarget )
	{
		desired = PathFindDirection( pTrain->m_ppath, pTrain->GetLocalOrigin(), pTarget->GetLocalOrigin() );
	}

	// If the train wants to stop, figure out throttle
	// otherwise, just throttle in the indicated direction and let the train logic
	// clip the speed
	if ( !desired )
	{
		if ( pTrain->m_flSpeed > 0 )
		{
			desired = -1;
		}
		else if ( pTrain->m_flSpeed < 0 )
		{
			desired = 1;
		}
	}
	
	// UNDONE: Align the think time with arrival, and bump this up to a few seconds
	SetNextThink( gpGlobals->curtime + 0.5f );

	if ( desired != 0 )
	{
		int wasMoving = (pTrain->m_flSpeed == 0) ? false : true;
		// chaser wants train to move, send message
		pTrain->SetSpeed( desired );
		int isMoving = (pTrain->m_flSpeed == 0) ? false : true;

		if ( !isMoving && wasMoving )
		{
			SoundEngineStop();
		}
		else if ( isMoving )
		{
			if ( !wasMoving )
			{
				SoundEngineStart();
			}
		}
	}
	else
	{
		SoundEngineStop();
		// UNDONE: Align the think time with arrival, and bump this up to a few seconds
		SetNextThink( gpGlobals->curtime + 1.0f );
	}
}
Example #10
0
void
UnInitSound(void)
{
    SoundShutdown();
    MusicShutdown();
}
Example #11
0
Sound::~Sound()
{
	SoundShutdown();
}
void C_ASW_Flare_Projectile::UpdateOnRemove()
{
	BaseClass::UpdateOnRemove();
	SoundShutdown();
}
Example #13
0
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    // Window

    WNDCLASSEX wc = { sizeof(wc) };

    wc.lpszClassName = L"MainWnd";
    wc.lpfnWndProc = MainWndProc;
    wc.hIcon = LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(IDI_LD24));
    wc.hCursor = LoadCursor(0, MAKEINTRESOURCE(IDC_ARROW));

    RegisterClassEx(&wc);

    DWORD	style	= WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU;
    DWORD	styleEx = WS_EX_WINDOWEDGE;
    RECT	rcWin	= { 0, 0, kWinWidth * 4, kWinHeight * 4 };

    AdjustWindowRectEx(&rcWin, style, FALSE, styleEx);
    OffsetRect(&rcWin, 100, 100);

    gMainWnd = CreateWindowEx(styleEx, wc.lpszClassName, L"LD24 - Super Conga Kat", style, rcWin.left, rcWin.top, rcWin.right - rcWin.left, rcWin.bottom - rcWin.top, 0, 0, 0, 0);

    ShowWindow(gMainWnd, SW_SHOWNORMAL);

    // Graphics

    if ((gD3d = Direct3DCreate9(D3D_SDK_VERSION)) == 0)
    {
        Panic("D3DCreate failed - do you have D3D9 installed?");
    }

    D3DPRESENT_PARAMETERS pp = { };

    pp.Windowed			= TRUE;
    pp.SwapEffect		= D3DSWAPEFFECT_DISCARD;
    pp.BackBufferWidth	= kWinWidth;
    pp.BackBufferHeight	= kWinHeight;
    pp.BackBufferFormat	= D3DFMT_A8R8G8B8;
    pp.hDeviceWindow	= gMainWnd;
    pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;

    if (FAILED(gD3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, gMainWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, &gDevice)))
    {
        Panic("D3D CreateDevice failed - do you have D3D9 installed?");
    }

    D3DVIEWPORT9 vp;
    vp.Width = kWinWidth;
    vp.Height = kWinHeight;
    vp.MinZ = 0.0f;
    vp.MaxZ = 1.0f;
    vp.X = 0;
    vp.Y = 0;

    gDevice->SetViewport(&vp);

    gpu::Init();

    // Audio

    SoundInit();

    // Keys

    int locKeyW = MapVirtualKey(0x11, MAPVK_VSC_TO_VK);
    int locKeyS = MapVirtualKey(0x1F, MAPVK_VSC_TO_VK);
    int locKeyA = MapVirtualKey(0x1E, MAPVK_VSC_TO_VK);
    int locKeyD = MapVirtualKey(0x20, MAPVK_VSC_TO_VK);
    int locKeyZ = MapVirtualKey(0x2C, MAPVK_VSC_TO_VK);

    // Main

    void RenderInit();
    RenderInit();

    void GameInit();
    GameInit();

    for(;;)
    {
        MSG msg;
        if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
        {
            if (msg.message == WM_QUIT)
                break;

            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        else
        {
            if (gDevice)
            {
                gDevice->BeginScene();

                void RenderPreUpdate();
                RenderPreUpdate();

                gKeyUp		= gHasFocus && (((GetAsyncKeyState(VK_UP) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyW) & 0x8000) != 0));
                gKeyDown	= gHasFocus && (((GetAsyncKeyState(VK_DOWN) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyS) & 0x8000) != 0));
                gKeyLeft	= gHasFocus && (((GetAsyncKeyState(VK_LEFT) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyA) & 0x8000) != 0));
                gKeyRight	= gHasFocus && (((GetAsyncKeyState(VK_RIGHT) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyD) & 0x8000) != 0));
                gKeyFire	= gHasFocus && (((GetAsyncKeyState(VK_SPACE) & 0x8000) != 0) || ((GetAsyncKeyState(VK_RETURN) & 0x8000) != 0) || ((GetAsyncKeyState(locKeyZ) & 0x8000) != 0));

                void GameUpdate();
                GameUpdate();

                void RenderGame();
                RenderGame();

                gDevice->EndScene();
                gDevice->Present(0, 0, 0, 0);
            }

            Sleep(gHasFocus ? 0 : 250);
        }
    }

    gDevice->SetVertexDeclaration(0);
    gDevice->SetVertexShader(0);
    gDevice->SetPixelShader(0);
    gDevice->SetTexture(0, 0);

    SoundShutdown();

    void RenderShutdown();
    RenderShutdown();

    gDevice->Release();
    gD3d->Release();

    DestroyWindow(gMainWnd);

    return 0;
}
Example #14
0
//-----------------------------------------------------------------------------
// Purpose: Start the manhack's engine sound.
//-----------------------------------------------------------------------------
void C_NPC_Manhack::UpdateOnRemove( void )
{
	BaseClass::UpdateOnRemove();
	SoundShutdown();
}
 PyObject* LMF_SoundShutdown (PyObject *self, PyObject *args){
	SoundShutdown();
	Py_RETURN_NONE;
}