CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

FLASHER.CPP (7854B)


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