Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
/*
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: SubdualDamageHelper.h ////////////////////////////////////////////////////////////////////////
// Author: Graham Smallwood, June 2003
// Desc: Object helper - Clears subdual status and heals subdual damage since Body modules can't have Updates
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h"
#include "Common/Xfer.h"
#include "GameLogic/Object.h"
#include "GameLogic/Module/BodyModule.h"
#include "GameLogic/Module/SubdualDamageHelper.h"
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
SubdualDamageHelper::SubdualDamageHelper( Thing *thing, const ModuleData *modData ) : ObjectHelper( thing, modData )
{
m_healingStepCountdown = 0;
setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER);
}
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
SubdualDamageHelper::~SubdualDamageHelper( void )
{
}
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
UpdateSleepTime SubdualDamageHelper::update()
{
BodyModuleInterface *body = getObject()->getBodyModule();
m_healingStepCountdown--;
if( m_healingStepCountdown > 0 )
return UPDATE_SLEEP_NONE;
m_healingStepCountdown = body->getSubdualDamageHealRate();
DamageInfo removeSubdueDamage;
removeSubdueDamage.in.m_damageType = DAMAGE_SUBDUAL_UNRESISTABLE;
removeSubdueDamage.in.m_amount = -body->getSubdualDamageHealAmount();
body->attemptDamage(&removeSubdueDamage);
if( body->hasAnySubdualDamage() )
return UPDATE_SLEEP_NONE;
else
return UPDATE_SLEEP_FOREVER;
}
// ------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------
void SubdualDamageHelper::notifySubdualDamage( Real amount )
{
if( amount > 0 )
{
m_healingStepCountdown = getObject()->getBodyModule()->getSubdualDamageHealRate();
setWakeFrame(getObject(), UPDATE_SLEEP_NONE);
}
}
// ------------------------------------------------------------------------------------------------
/** CRC */
// ------------------------------------------------------------------------------------------------
void SubdualDamageHelper::crc( Xfer *xfer )
{
// object helper crc
ObjectHelper::crc( xfer );
} // end crc
// ------------------------------------------------------------------------------------------------
/** Xfer method
* Version Info;
* 1: Initial version */
// ------------------------------------------------------------------------------------------------
void SubdualDamageHelper::xfer( Xfer *xfer )
{
// version
XferVersion currentVersion = 1;
XferVersion version = currentVersion;
xfer->xferVersion( &version, currentVersion );
// object helper base class
ObjectHelper::xfer( xfer );
xfer->xferUnsignedInt( &m_healingStepCountdown );
} // end xfer
// ------------------------------------------------------------------------------------------------
/** Load post process */
// ------------------------------------------------------------------------------------------------
void SubdualDamageHelper::loadPostProcess( void )
{
// object helper base class
ObjectHelper::loadPostProcess();
} // end loadPostProcess