Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.0 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include <stdio.h>
  8. #include "resource.h"
  9. #include "ChannelProperties.h"
  10. #include "ChoreoView.h"
  11. #include "choreoactor.h"
  12. #include "choreoscene.h"
  13. #include "mdlviewer.h"
  14. static CChannelParams g_Params;
  15. //-----------------------------------------------------------------------------
  16. // Purpose:
  17. // Input : hwndDlg -
  18. // uMsg -
  19. // wParam -
  20. // lParam -
  21. // Output : static BOOL CALLBACK ChannelPropertiesDialogProc
  22. //-----------------------------------------------------------------------------
  23. static BOOL CALLBACK ChannelPropertiesDialogProc ( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
  24. {
  25. switch(uMsg)
  26. {
  27. case WM_INITDIALOG:
  28. // Insert code here to put the string (to find and replace with)
  29. // into the edit controls.
  30. // ...
  31. {
  32. g_Params.PositionSelf( hwndDlg );
  33. SetDlgItemText( hwndDlg, IDC_CHANNELNAME, g_Params.m_szName );
  34. HWND control = GetDlgItem( hwndDlg, IDC_ACTORCHOICE );
  35. if ( !g_Params.m_bShowActors )
  36. {
  37. // Hide the combo box
  38. if ( control )
  39. {
  40. ShowWindow( control, SW_HIDE );
  41. }
  42. control = GetDlgItem( hwndDlg, IDC_STATIC_ACTOR );
  43. if ( control )
  44. {
  45. ShowWindow( control, SW_HIDE );
  46. }
  47. }
  48. else
  49. {
  50. SendMessage( control, CB_RESETCONTENT, 0, 0 );
  51. if ( g_Params.m_pScene )
  52. {
  53. for ( int i = 0 ; i < g_Params.m_pScene->GetNumActors() ; i++ )
  54. {
  55. CChoreoActor *actor = g_Params.m_pScene->GetActor( i );
  56. if ( actor )
  57. {
  58. // add text to combo box
  59. SendMessage( control, CB_ADDSTRING, 0, (LPARAM)actor->GetName() );
  60. }
  61. }
  62. }
  63. SendMessage( control, CB_SETCURSEL, (WPARAM)0, (LPARAM)0 );
  64. }
  65. SetWindowText( hwndDlg, g_Params.m_szDialogTitle );
  66. SetFocus( GetDlgItem( hwndDlg, IDC_CHANNELNAME ) );
  67. }
  68. return FALSE;
  69. case WM_COMMAND:
  70. switch (LOWORD(wParam))
  71. {
  72. case IDOK:
  73. g_Params.m_szName[ 0 ] = 0;
  74. GetDlgItemText( hwndDlg, IDC_CHANNELNAME, g_Params.m_szName, 256 );
  75. if ( g_Params.m_bShowActors )
  76. {
  77. HWND control = GetDlgItem( hwndDlg, IDC_ACTORCHOICE );
  78. if ( control )
  79. {
  80. SendMessage( control, WM_GETTEXT, (WPARAM)sizeof( g_Params.m_szSelectedActor ), (LPARAM)g_Params.m_szSelectedActor );
  81. }
  82. }
  83. EndDialog( hwndDlg, 1 );
  84. break;
  85. case IDCANCEL:
  86. EndDialog( hwndDlg, 0 );
  87. break;
  88. }
  89. return TRUE;
  90. }
  91. return FALSE;
  92. }
  93. //-----------------------------------------------------------------------------
  94. // Purpose:
  95. // Input : *view -
  96. // *actor -
  97. // Output : int
  98. //-----------------------------------------------------------------------------
  99. int ChannelProperties( CChannelParams *params )
  100. {
  101. g_Params = *params;
  102. int retval = DialogBox( (HINSTANCE)GetModuleHandle( 0 ),
  103. MAKEINTRESOURCE( IDD_CHANNELPROPERTIES ),
  104. (HWND)g_MDLViewer->getHandle(),
  105. (DLGPROC)ChannelPropertiesDialogProc );
  106. *params = g_Params;
  107. return retval;
  108. }