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
test(gameengine): add temporary JETPROBE logging for the aircraft attack move
Olcay Seygan258fe1260dd2
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cppindex 72a0d88db..fb638d31f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp@@ -3688,6 +3688,16 @@ void AIAttackMoveToState::startEngaging( Object *victim )if (owner->getControllingPlayer()->getPlayerType() == PLAYER_HUMAN)ai->setAllowedToChase(TRUE);+ // TEMPORARY JETPROBE - remove once the aircraft attack move is confirmed in game+ DEBUG_LOG(("JETPROBE %d engage: '%s' air=%d human=%d -> victim '%s' dist=%.0f\n",+ TheGameLogic->getFrame(),+ owner->getTemplate()->getName().str(),+ owner->isUsingAirborneLocomotor() ? 1 : 0,+ owner->getControllingPlayer()->getPlayerType() == PLAYER_HUMAN ? 1 : 0,+ victim->getTemplate()->getName().str(),+ (Real)sqrt(sqr(owner->getPosition()->x - victim->getPosition()->x) ++ sqr(owner->getPosition()->y - victim->getPosition()->y))));+m_attackMoveMachine->setGoalObject(victim);// Note that we picked up this command from the ai. This is set *before* the state change so// that the approach and pursue states see the same command source on the frame they are entered@@ -3720,6 +3730,17 @@ void AIAttackMoveToState::stopEngaging( void )UnsignedInt now = TheGameLogic->getFrame();Object *victim = TheGameLogic->findObjectByID(m_victimID);++ // TEMPORARY JETPROBE - remove once the aircraft attack move is confirmed in game+ DEBUG_LOG(("JETPROBE %d disengage: '%s' air=%d after %d frames, victim %s, flew %.0f\n",+ now,+ owner->getTemplate()->getName().str(),+ owner->isUsingAirborneLocomotor() ? 1 : 0,+ now - m_engageStartFrame,+ victim ? (victim->isEffectivelyDead() ? "DEAD" : "alive") : "gone",+ (Real)sqrt(sqr(owner->getPosition()->x - m_engageOrigin.x) ++ sqr(owner->getPosition()->y - m_engageOrigin.y))));+if (victim && !victim->isEffectivelyDead() && now - m_engageStartFrame < ATTACK_MOVE_DUD_ENGAGE_FRAMES){// we could not touch it (unreachable, cannot attack it, out of ammo) - move on for a second.@@ -3824,6 +3845,10 @@ StateReturnType AIAttackMoveToState::update()JetAIUpdate *jetAI = ai->getJetAIUpdate();if( jetAI && jetAI->isOutOfSpecialReloadAmmo() ){+ // TEMPORARY JETPROBE - remove once the aircraft attack move is confirmed in game+ DEBUG_LOG(("JETPROBE %d OUT OF AMMO: '%s' returning to reload\n", TheGameLogic->getFrame(),+ owner->getTemplate()->getName().str()));+//We need to return to base to reload!return STATE_SUCCESS;}@@ -3832,6 +3857,11 @@ StateReturnType AIAttackMoveToState::update(){if (hasLeftTheLeash()){+ // TEMPORARY JETPROBE - remove once the aircraft attack move is confirmed in game+ DEBUG_LOG(("JETPROBE %d LEASH BROKE for '%s' air=%d\n", TheGameLogic->getFrame(),+ owner->getTemplate()->getName().str(),+ owner->isUsingAirborneLocomotor() ? 1 : 0));+// the victim is walking us off the attack move - let it go and get back on the path.m_attackMoveMachine->setState( AI_IDLE );stopEngaging();diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cppindex bf553e1fc..454560148 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp@@ -1902,6 +1902,10 @@ UpdateSleepTime JetAIUpdate::update()m_mostRecentCommand.reconstitute(parms);setFlag(HAS_PENDING_COMMAND, false);+ // TEMPORARY JETPROBE - remove once the aircraft attack move is confirmed in game+ DEBUG_LOG(("JETPROBE %d RESUME after reload: '%s' cmd=%d\n", TheGameLogic->getFrame(),+ getObject()->getTemplate()->getName().str(), (Int)parms.m_cmd));+aiDoCommand(&parms);}else if (m_returnToBaseFrame != 0 && now >= m_returnToBaseFrame && getFlag(ALLOW_AIR_LOCO))@@ -1927,6 +1931,10 @@ UpdateSleepTime JetAIUpdate::update()if (getFlag(ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD) &&isOutOfSpecialReloadAmmo() && getFlag(ALLOW_AIR_LOCO)){+ // TEMPORARY JETPROBE - remove once the aircraft attack move is confirmed in game+ DEBUG_LOG(("JETPROBE %d RETURN TO RELOAD: '%s', order stored for resume\n",+ TheGameLogic->getFrame(), getObject()->getTemplate()->getName().str()));+setFlag(USE_SPECIAL_RETURN_LOCO, true);setFlag(HAS_PENDING_COMMAND, true);setFlag(ALLOW_INTERRUPT_AND_RESUME_OF_CUR_STATE_FOR_RELOAD, false);