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.

88 lines
2.3 KiB

  1. //========= Copyright � 1996-2008, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Stub for custom mod lesson actions.
  4. // This is so that mods can do actions
  5. // Remove this file from the mod's vpc and include your own.
  6. //
  7. //=============================================================================//
  8. #include "cbase.h"
  9. #include "c_gameinstructor.h"
  10. #include "c_baselesson.h"
  11. #include "ienginevgui.h"
  12. #include "message.h"
  13. // memdbgon must be the last include file in a .cpp file!!!
  14. #include "tier0/memdbgon.h"
  15. extern ConVar gameinstructor_verbose;
  16. enum Mod_LessonAction
  17. {
  18. // Enum starts from end of LessonAction
  19. LESSON_ACTION_MOD_CUSTOM_ACTION_STUB = LESSON_ACTION_MOD_START,
  20. LESSON_ACTION_TOTAL
  21. };
  22. void CScriptedIconLesson::Mod_PreReadLessonsFromFile( void )
  23. {
  24. // Add custom actions to the map
  25. CScriptedIconLesson::LessonActionMap.Insert( "custom action stub", LESSON_ACTION_MOD_CUSTOM_ACTION_STUB );
  26. }
  27. bool CScriptedIconLesson::Mod_ProcessElementAction( int iAction, bool bNot, const char *pchVarName, EHANDLE &hVar, const CGameInstructorSymbol *pchParamName, float fParam, C_BaseEntity *pParam, const char *pchParam, bool &bModHandled )
  28. {
  29. // Assume we're going to handle the action
  30. bModHandled = true;
  31. C_BaseEntity *pVar;
  32. pVar = hVar.Get();
  33. switch ( iAction )
  34. {
  35. case LESSON_ACTION_MOD_CUSTOM_ACTION_STUB:
  36. {
  37. float flStub = 0.0f; //pVar->GetStubValue();
  38. if ( gameinstructor_verbose.GetInt() > 0 && ShouldShowSpew() )
  39. {
  40. ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, "\t[%s]->GetStubValue() ", pchVarName );
  41. ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%.1f ", flStub );
  42. ConColorMsg( CBaseLesson::m_rgbaVerbosePlain, ( bNot ) ? ( ">= [%s] " ) : ( "< [%s] " ), pchParamName->String() );
  43. ConColorMsg( CBaseLesson::m_rgbaVerboseName, "%.1f\n", fParam );
  44. }
  45. return ( flStub ) ? ( flStub >= fParam ) : ( flStub < fParam );
  46. }
  47. default:
  48. // Didn't handle this action
  49. bModHandled = false;
  50. break;
  51. }
  52. return false;
  53. }
  54. bool C_GameInstructor::Mod_HiddenByOtherElements( void )
  55. {
  56. if ( engine->IsPaused() || enginevgui->IsGameUIVisible() )
  57. {
  58. return true;
  59. }
  60. CHudMessage *pHudMessage = GET_HUDELEMENT( CHudMessage );
  61. if ( pHudMessage && pHudMessage->ShouldDraw() )
  62. {
  63. return true;
  64. }
  65. return false;
  66. }