FLASHER.CPP 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/FLASHER.CPP 1 3/03/97 10:24a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : FLASHER.CPP *
  22. * *
  23. * Programmer : Joe L. Bostic *
  24. * *
  25. * Start Date : May 28, 1994 *
  26. * *
  27. * Last Update : October 17, 1994 [JLB] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * FlasherClass::Debug_Dump -- Displays current status to the monochrome screen. *
  32. * FlasherClass::Process -- Performs the logic processing for the flashing ability. *
  33. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  34. #include "function.h"
  35. #ifdef CHEAT_KEYS
  36. /***********************************************************************************************
  37. * FlasherClass::Debug_Dump -- Displays current status to the monochrome screen. *
  38. * *
  39. * This utility function will output the current status of the FlasherClass to the mono *
  40. * screen. It is through this display that bugs may be fixed or detected. *
  41. * *
  42. * INPUT: none *
  43. * *
  44. * OUTPUT: none *
  45. * *
  46. * WARNINGS: none *
  47. * *
  48. * HISTORY: *
  49. * 05/31/1994 JLB : Created. *
  50. *=============================================================================================*/
  51. void FlasherClass::Debug_Dump(MonoClass * mono) const
  52. {
  53. mono->Set_Cursor(50, 7);
  54. mono->Printf("%2d", FlashCount);
  55. }
  56. #endif
  57. /***********************************************************************************************
  58. * FlasherClass::Process -- Performs the logic processing for the flashing ability. *
  59. * *
  60. * The ability for an object to flash is controlled by this logic processing routine. It *
  61. * should be called once per game tick per unit. *
  62. * *
  63. * INPUT: none *
  64. * *
  65. * OUTPUT: bool; Should the associated object be redrawn? *
  66. * *
  67. * WARNINGS: none *
  68. * *
  69. * HISTORY: *
  70. * 05/28/1994 JLB : Created. *
  71. * 06/20/1994 JLB : Is now independent of object it represents. *
  72. *=============================================================================================*/
  73. bool FlasherClass::Process(void)
  74. {
  75. // 2019/09/20 JAS - Flashing info needs to exist per player
  76. for (int i = 0; i < HOUSE_COUNT; i++)
  77. {
  78. if (FlashCountPerPlayer[i])
  79. {
  80. FlashCountPerPlayer[i]--;
  81. }
  82. }
  83. if (FlashCount) {
  84. FlashCount--;
  85. IsBlushing = false;
  86. if (FlashCount & 0x01) {
  87. IsBlushing = true;
  88. }
  89. return(true);
  90. }
  91. return(false);
  92. }
  93. /***********************************************************************************************
  94. * FlasherClass::Get_Flashing_Flags -- *
  95. * *
  96. * Gets the flags tell which players this object should flash for. *
  97. * *
  98. * INPUT: none *
  99. * *
  100. * OUTPUT: unsigned int; Flag representing the players to flash for *
  101. * *
  102. * WARNINGS: none *
  103. * *
  104. * HISTORY: *
  105. * 2019/09/20 JAS : Created. *
  106. *=============================================================================================*/
  107. unsigned int FlasherClass::Get_Flashing_Flags() const
  108. {
  109. unsigned flags = 0;
  110. for (int i = 0; i < HOUSE_COUNT; ++i)
  111. {
  112. if (FlashCountPerPlayer[i] > 0)
  113. {
  114. flags |= (1 << i);
  115. }
  116. }
  117. return flags;
  118. }