GeneralsExpPoints.cpp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: GeneralsExpPoints.cpp /////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Electronic Arts Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2002 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // created: Oct 2002
  34. //
  35. // Filename: GeneralsExpPoints.cpp
  36. //
  37. // author: Chris Huybregts
  38. //
  39. // purpose: File used to populate/update/show/hide the generals exp screen
  40. //
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. //-----------------------------------------------------------------------------
  44. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  45. //-----------------------------------------------------------------------------
  46. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  47. //-----------------------------------------------------------------------------
  48. // USER INCLUDES //////////////////////////////////////////////////////////////
  49. //-----------------------------------------------------------------------------
  50. #include "GameClient/ControlBar.h"
  51. #include "GameClient/GUICallbacks.h"
  52. #include "GameClient/GameWindow.h"
  53. #include "GameClient/Gadget.h"
  54. #include "GameClient/KeyDefs.h"
  55. #include "GameClient/ControlBar.h"
  56. #include "GameClient/InGameUI.h"
  57. //-----------------------------------------------------------------------------
  58. // DEFINES ////////////////////////////////////////////////////////////////////
  59. //-----------------------------------------------------------------------------
  60. //-------------------------------------------------------------------------------------------------
  61. WindowMsgHandledType GeneralsExpPointsInput( GameWindow *window, UnsignedInt msg,
  62. WindowMsgData mData1, WindowMsgData mData2 )
  63. {
  64. switch( msg )
  65. {
  66. // --------------------------------------------------------------------------------------------
  67. case GWM_MOUSE_ENTERING:
  68. //Get rid of any building placement mode!
  69. if( TheInGameUI )
  70. {
  71. TheInGameUI->placeBuildAvailable( NULL, NULL );
  72. }
  73. break;
  74. case GWM_CHAR:
  75. {
  76. UnsignedByte key = mData1;
  77. // UnsignedByte state = mData2;
  78. switch( key )
  79. {
  80. // ----------------------------------------------------------------------------------------
  81. case KEY_ESC:
  82. {
  83. TheControlBar->hidePurchaseScience();
  84. return MSG_HANDLED;
  85. //return MSG_IGNORED;
  86. } // end escape
  87. } // end switch( key )
  88. return MSG_HANDLED;
  89. } // end char
  90. }
  91. return MSG_HANDLED;
  92. } // end DiplomacyInput
  93. //-----------------------------------------------------------------------------
  94. // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
  95. //-----------------------------------------------------------------------------
  96. WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt msg,
  97. WindowMsgData mData1, WindowMsgData mData2 )
  98. {
  99. switch( msg )
  100. {
  101. //---------------------------------------------------------------------------------------------
  102. case GGM_FOCUS_CHANGE:
  103. {
  104. // Bool focus = (Bool) mData1;
  105. //if (focus)
  106. //TheWindowManager->winSetGrabWindow( chatTextEntry );
  107. break;
  108. } // end focus change
  109. //---------------------------------------------------------------------------------------------
  110. case GWM_INPUT_FOCUS:
  111. {
  112. // if we're given the opportunity to take the keyboard focus we must say we don't want it
  113. if( mData1 == TRUE )
  114. *(Bool *)mData2 = FALSE;
  115. return MSG_HANDLED;
  116. }//case GWM_INPUT_FOCUS:
  117. //---------------------------------------------------------------------------------------------
  118. case GBM_SELECTED:
  119. {
  120. GameWindow *control = (GameWindow *)mData1;
  121. NameKeyType controlID = (NameKeyType)control->winGetWindowId();
  122. static NameKeyType buttonExitID = NAMEKEY( "GeneralsExpPoints.wnd:ButtonExit" );
  123. if (controlID == buttonExitID)
  124. {
  125. TheControlBar->hidePurchaseScience();
  126. }
  127. else
  128. TheControlBar->processContextSensitiveButtonClick( control, (GadgetGameMessage)msg );
  129. break;
  130. } // end button selected
  131. //---------------------------------------------------------------------------------------------
  132. default:
  133. return MSG_IGNORED;
  134. } // end switch( msg )
  135. return MSG_HANDLED;
  136. } // end GeneralsExpPointsSystem
  137. //-----------------------------------------------------------------------------
  138. // PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
  139. //-----------------------------------------------------------------------------