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
3.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Base combat character with no AI
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #include "cbase.h"
  14. #include "ai_squadslot.h"
  15. #include "ai_basenpc.h"
  16. #include "stringregistry.h"
  17. // memdbgon must be the last include file in a .cpp file!!!
  18. #include "tier0/memdbgon.h"
  19. //=============================================================================
  20. // Init static variables
  21. //=============================================================================
  22. CAI_GlobalNamespace CAI_BaseNPC::gm_SquadSlotNamespace;
  23. //-----------------------------------------------------------------------------
  24. // Purpose: Given and SquadSlot name, return the SquadSlot ID
  25. //-----------------------------------------------------------------------------
  26. int CAI_BaseNPC::GetSquadSlotID(const char* slotName)
  27. {
  28. return gm_SquadSlotNamespace.SymbolToId(slotName);
  29. }
  30. //-----------------------------------------------------------------------------
  31. // Purpose: Given and SquadSlot name, return the SquadSlot ID
  32. //-----------------------------------------------------------------------------
  33. const char* CAI_BaseNPC::GetSquadSlotDebugName( int iSquadSlot )
  34. {
  35. switch( iSquadSlot )
  36. {
  37. case SQUAD_SLOT_NONE: return "None";
  38. break;
  39. case SQUAD_SLOT_ATTACK1: return "SQUAD_SLOT_ATTACK1";
  40. break;
  41. case SQUAD_SLOT_ATTACK2: return "SQUAD_SLOT_ATTACK2";
  42. break;
  43. case SQUAD_SLOT_INVESTIGATE_SOUND: return "SQUAD_SLOT_INVESTIGATE_SOUND";
  44. break;
  45. case SQUAD_SLOT_EXCLUSIVE_HANDSIGN: return "SQUAD_SLOT_EXCLUSIVE_HANDSIGN";
  46. break;
  47. case SQUAD_SLOT_EXCLUSIVE_RELOAD: return "SQUAD_SLOT_EXCLUSIVE_RELOAD";
  48. break;
  49. case SQUAD_SLOT_PICKUP_WEAPON1: return "SQUAD_SLOT_PICKUP_WEAPON1";
  50. break;
  51. case SQUAD_SLOT_PICKUP_WEAPON2: return "SQUAD_SLOT_PICKUP_WEAPON2";
  52. break;
  53. case SQUAD_SLOT_SPECIAL_ATTACK: return "SQUAD_SLOT_SPECIAL_ATTACK";
  54. break;
  55. default:
  56. // If we default, that means that our derived class (which has already been called)
  57. // didn't provide text for a squad slot that isn't part of the base ai squad slots.
  58. // OR someone added a squad slot to base AI and didn't update here.
  59. return "Failed to specify!";
  60. break;
  61. }
  62. }
  63. //-----------------------------------------------------------------------------
  64. // Purpose:
  65. // Input :
  66. // Output :
  67. //-----------------------------------------------------------------------------
  68. void CAI_BaseNPC::InitDefaultSquadSlotSR(void)
  69. {
  70. gm_SquadSlotNamespace.AddSymbol( "SQUAD_SLOT_ATTACK1", AI_RemapToGlobal(SQUAD_SLOT_ATTACK1) );
  71. gm_SquadSlotNamespace.AddSymbol( "SQUAD_SLOT_ATTACK2", AI_RemapToGlobal(SQUAD_SLOT_ATTACK2) );
  72. gm_SquadSlotNamespace.AddSymbol( "SQUAD_SLOT_INVESTIGATE_SOUND", AI_RemapToGlobal(SQUAD_SLOT_INVESTIGATE_SOUND) );
  73. gm_SquadSlotNamespace.AddSymbol( "SQUAD_SLOT_EXCLUSIVE_HANDSIGN", AI_RemapToGlobal(SQUAD_SLOT_EXCLUSIVE_HANDSIGN) );
  74. gm_SquadSlotNamespace.AddSymbol( "SQUAD_SLOT_EXCLUSIVE_RELOAD", AI_RemapToGlobal(SQUAD_SLOT_EXCLUSIVE_RELOAD) );
  75. gm_SquadSlotNamespace.AddSymbol( "SQUAD_SLOT_PICKUP_WEAPON1", AI_RemapToGlobal(SQUAD_SLOT_PICKUP_WEAPON1) );
  76. gm_SquadSlotNamespace.AddSymbol( "SQUAD_SLOT_PICKUP_WEAPON2", AI_RemapToGlobal(SQUAD_SLOT_PICKUP_WEAPON2) );
  77. gm_SquadSlotNamespace.AddSymbol( "SQUAD_SLOT_SPECIAL_ATTACK", AI_RemapToGlobal(SQUAD_SLOT_SPECIAL_ATTACK) );
  78. }