mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Forgot to commit the source changes in the last commit. Sorry. So, here they are.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5999 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,221 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="ModularizedTacticalAI"
|
||||||
|
ProjectGUID="{FF0A809E-A370-4640-A301-17B76D7A5B4E}"
|
||||||
|
RootNamespace="ModularizedTacticalAI"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
InheritedPropertySheets="..\ja2.vsprops"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="..\ja2_VS2008.vsprops"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
AdditionalIncludeDirectories=""C:\Documents and Settings\jcd\Desktop\ja2_v1.13\Build\ext\VFS\include""
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\LegacyAIPlan.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\LegacyAIPlanFactory.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\NullPlan.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\NullPlanFactory.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\PlanFactoryLibrary.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\AbstractPlanFactory.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\LegacyAIPlan.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\LegacyAIPlanFactory.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\NullPlan.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\NullPlanFactory.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\Plan.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\PlanFactoryLibrary.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||||
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ABSTRACT_PLAN_FACTORY_H_
|
||||||
|
#define ABSTRACT_PLAN_FACTORY_H_
|
||||||
|
|
||||||
|
class SOLDIERTYPE;
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
/**@class AIInputData
|
||||||
|
* @brief Wrapper class around the environmental data required to build an AI plan
|
||||||
|
*
|
||||||
|
* At the moment, simply a wrapper around SOLDIERTYPE. Future versions might require more data; without the
|
||||||
|
* wrapper, *every* Concrete Factory ever created would need to be changed in this event. With the wrapper, no
|
||||||
|
* change is required at all.
|
||||||
|
*/
|
||||||
|
struct AIInputData
|
||||||
|
{
|
||||||
|
SOLDIERTYPE* npc_to_plan_for_;
|
||||||
|
};
|
||||||
|
class Plan;
|
||||||
|
/**@class AbstractPlanFactory
|
||||||
|
* @brief Abstract Factory. Base class for all plan factories.
|
||||||
|
*
|
||||||
|
* The Abstract Factory design pattern is used to create instances of Plan object hierarchies. The concrete
|
||||||
|
* factories differ not necessarily in the concrete product they produce (as is otherwise the case when using
|
||||||
|
* this design pattern), but in the structure of the compositions (plans are Composites) instead. Public
|
||||||
|
* inheritance is required for two reasons: (a) several sub-class instances are packed in a container, and this
|
||||||
|
* abstract class serves as the container's data type. And (b) implementation of create_plan() and update_plan()
|
||||||
|
* is forced for concrete subclasses.
|
||||||
|
*/
|
||||||
|
class AbstractPlanFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
bool initialize_called_;
|
||||||
|
public:
|
||||||
|
AbstractPlanFactory() : initialize_called_(false) { }
|
||||||
|
bool initialize_called() const { return initialize_called_; }
|
||||||
|
/**@brief Used for delayed initialization of ressource-intensive initialization tasks
|
||||||
|
*
|
||||||
|
* Due to the design of the modularized AI, each factory's constructor must be called, even if the
|
||||||
|
* factory is not used. Therefore, memory- and cpu intensive tasks should not be performed in the
|
||||||
|
* constructor, but in this function instead. It will only be called if the factory is actually
|
||||||
|
* referenced in the AI.ini file.
|
||||||
|
*/
|
||||||
|
virtual void initialize() { };
|
||||||
|
/**@brief Abstract Plan object hierarchy creation function
|
||||||
|
*
|
||||||
|
* The subclasses (i.e., Concrete Factories) implpmenting this routine contain
|
||||||
|
* the decision-making AI core.
|
||||||
|
*
|
||||||
|
* @param input A pointer to a structure containing all required input data in order for the AI
|
||||||
|
* algorithms to perform their task. At the moment, simply a wrapper around SOLDIERTYPE. Future versions
|
||||||
|
* might require other datatypes; without the wrapper, *every* Concrete Factory ever created would need
|
||||||
|
* to be changed in this event.
|
||||||
|
* @return A Plan object tree representing the produced strategy
|
||||||
|
*/
|
||||||
|
virtual Plan* create_plan(const AIInputData& input) = 0;
|
||||||
|
/**@brief Abstract Plan object hierarchy update function, called in order to update an already created
|
||||||
|
* plan
|
||||||
|
*
|
||||||
|
* @param input A pointer to a structure containing all required input data in order for the AI
|
||||||
|
* algorithms to perform their task
|
||||||
|
* @param plan_to_change The Plan object hierarchy that is to be updated
|
||||||
|
*/
|
||||||
|
virtual void update_plan(const AIInputData& input, Plan* plan_to_change) = 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LEGACY_AI_PLAN_H_
|
||||||
|
#define LEGACY_AI_PLAN_H_
|
||||||
|
|
||||||
|
#include "Plan.h"
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
/**@class LegacyAIPlan
|
||||||
|
* @brief Component/Concrete Product. Generates a Plan that executes the AI as it was before modularization.
|
||||||
|
*
|
||||||
|
* A simple encapsulation of the functions TurnBasedHandleNPCAI() and RTHandleAI(), defined in
|
||||||
|
* TacticalAI/AIMain.cpp and TacticalAI/Realtime.cpp, respectively. The AI handles decisions for all kinds of
|
||||||
|
* NPCs (enemies, zombies, civilians, ...)
|
||||||
|
*/
|
||||||
|
class LegacyAIPlan: public Plan
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
virtual void execute(bool turn_based, PlanInputData& manipulated_object);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LEGACY_AI_PLAN_FACTORY_H_
|
||||||
|
#define LEGACY_AI_PLAN_FACTORY_H_
|
||||||
|
|
||||||
|
#include "AbstractPlanFactory.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
/**@class LegacyAIPlanFactory
|
||||||
|
* @brief Concrete Factory. Generates the LegacyAIPlan, making NPCs do exactly what it did before this AI
|
||||||
|
* modularization/re-write.
|
||||||
|
*/
|
||||||
|
class LegacyAIPlanFactory : public AbstractPlanFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
static std::string get_name() {return "LegacyAIPlanFactory";}
|
||||||
|
virtual Plan* create_plan(const AIInputData& input);
|
||||||
|
virtual void update_plan(const AIInputData& input, Plan* plan_to_change);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NULL_PLAN_H_
|
||||||
|
#define NULL_PLAN_H_
|
||||||
|
|
||||||
|
#include "Plan.h"
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
/**@class NullPlan
|
||||||
|
* @brief Component/Concrete Product. The NullPlan lets makes the NPC executing it do absolutely nothing.
|
||||||
|
*
|
||||||
|
* The purpose of this plan is two-fold. Firstly, it is a good starting point for new plans; to use it
|
||||||
|
* as such, perform a
|
||||||
|
|
||||||
|
* - \c svn copy include/NullPlan.h include/YourPlan.h
|
||||||
|
* - \c svn copy src/NullPlan.cpp src/YourPlan.cpp
|
||||||
|
*
|
||||||
|
* Remember to
|
||||||
|
*
|
||||||
|
* - Adjust the include guards
|
||||||
|
* - A concrete factory using this plan is required in order for it to be used
|
||||||
|
*
|
||||||
|
* And secondly, it is a debugging tool (cf. NullPlanFactory)
|
||||||
|
*/
|
||||||
|
class NullPlan: public Plan
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
virtual void execute(bool turn_based, PlanInputData& manipulated_object);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NULL_PLAN_FACTORY_H_
|
||||||
|
#define NULL_PLAN_FACTORY_H_
|
||||||
|
|
||||||
|
#include "AbstractPlanFactory.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
/**@class NullPlanFactory
|
||||||
|
* @brief Concrete Factory. Generates the NullPlan, making a NPC do absolutely nothing.
|
||||||
|
*
|
||||||
|
* The purpose of this factory is two-fold. Firstly, it is a good starting point for new plan factories; to use
|
||||||
|
* it as such, perform a
|
||||||
|
|
||||||
|
* \c svn copy include/NullPlanFactory.h include/YourPlanFactory.h\n
|
||||||
|
* \c svn copy src/NullPlanFactory.cpp src/YourPlanFactory.cpp
|
||||||
|
*
|
||||||
|
* Remember to
|
||||||
|
* - Adjust the include guards
|
||||||
|
* - Adjust the string returned by get_name()
|
||||||
|
* - Add a line in PlanFactoryLibrary.cpp to create an instance of the new factory in the library's
|
||||||
|
* constructor; otherwise, it won't be accessible via the configuration file.
|
||||||
|
*
|
||||||
|
* And secondly, it is a debugging tool. Change the configuration file to use this AI factory for a certain
|
||||||
|
* AI_INDEX to have said group do... nothing (e.g. to measure performance differences).
|
||||||
|
*/
|
||||||
|
class NullPlanFactory : public AbstractPlanFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
static std::string get_name() {return "NullPlanFactory";}
|
||||||
|
virtual Plan* create_plan(const AIInputData& input);
|
||||||
|
virtual void update_plan(const AIInputData& input, Plan* plan_to_change);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PLAN_H_
|
||||||
|
#define PLAN_H_
|
||||||
|
|
||||||
|
class SOLDIERTYPE;
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
/**@class PlanInputData
|
||||||
|
* @brief Wrapper class around the entity manipulated through plan execution
|
||||||
|
*
|
||||||
|
* At the moment, simply a wrapper around SOLDIERTYPE. Future versions might require other datatypes; without
|
||||||
|
* the wrapper, *every* Plan subclass ever created would need to be changed in this event. With the wrapper, no
|
||||||
|
* change is required at all.
|
||||||
|
*/
|
||||||
|
struct PlanInputData
|
||||||
|
{
|
||||||
|
SOLDIERTYPE* controlled_npc_;
|
||||||
|
};
|
||||||
|
/**@class Plan
|
||||||
|
* @brief Composite/Abstract Product. Base class for all plan compositions and components.
|
||||||
|
*
|
||||||
|
* The Plan class provides a common interface for both plan compositions and plan components.
|
||||||
|
*/
|
||||||
|
class Plan
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
public:
|
||||||
|
/** @brief Plan execution is the encapsulation of an action sequence, making up higher-level building blocks
|
||||||
|
*
|
||||||
|
* Each plan objects represents a high-level action, implemented by means of lower-level actions. These
|
||||||
|
* lower level actions can be other Plans subtypes; at some point, a Plan object has no further
|
||||||
|
* sub-plans, i.e., the objet is no composition, but a component, forming a leaf in the Plan hierarchy.
|
||||||
|
* The components' lower level actions are formed by the fundamental npc actions made available outside
|
||||||
|
* the AI framework.
|
||||||
|
*
|
||||||
|
* @param turn_based true if turn-based mode is active, false for real-time mode
|
||||||
|
* @param manipulated_object Encapsulation of around object(s) a plan may manipulate.
|
||||||
|
*/
|
||||||
|
virtual void execute(bool turn_based, PlanInputData& manipulated_object) = 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PLAN_FACTORY_LIBRARY_H_
|
||||||
|
#define PLAN_FACTORY_LIBRARY_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
// forward declarations
|
||||||
|
class AbstractPlanFactory;
|
||||||
|
class Plan;
|
||||||
|
struct AIInputData;
|
||||||
|
|
||||||
|
/**@class PlanFactoryLibrary
|
||||||
|
* @brief Singleton. A "library" containing all available PlanFactories, accessible via the strings returned by
|
||||||
|
* their get_name() function.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class PlanFactoryLibrary
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
static PlanFactoryLibrary* instance_;
|
||||||
|
std::map<std::string, AbstractPlanFactory*> registred_factories_;
|
||||||
|
std::deque<AbstractPlanFactory*> ai_index_to_factory_mapping_;
|
||||||
|
PlanFactoryLibrary();
|
||||||
|
public:
|
||||||
|
static PlanFactoryLibrary* instance();
|
||||||
|
Plan* create_plan(size_t index, AIInputData& input) const;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
API Documentation
|
||||||
|
=================
|
||||||
|
The API documentation is available in the source code repository under
|
||||||
|
./Developer_Docs/ModularizedAI/html/index.html
|
||||||
|
|
||||||
|
|
||||||
|
Coding style guidelines
|
||||||
|
=======================
|
||||||
|
When modifying or adding to the code in ModularizedTacticalAI, plese adhere to
|
||||||
|
the following rules in order to keep the place tidy.
|
||||||
|
|
||||||
|
- Do indent code blocks by 4 spaces
|
||||||
|
- Do not use tabs; they are interpreted differently on each platform, messing up the indention
|
||||||
|
- Do not #include compilation units (cpp files). Doing so will lead to you facing the firing squad.
|
||||||
|
- Do try to limit the number of include files to what is really needed. If a lot is needed, consider using the Pimpl
|
||||||
|
idiom.
|
||||||
|
- Do not use leading underscores or double underscores. They are reserved for compiler implementation.
|
||||||
|
- Do document your code using Doxygen-style comments, and update the doxygen documentation by running doxygen in the
|
||||||
|
ModularizedTacticalAI directory.
|
||||||
|
- Do use identifier names that reflect what you are doing.
|
||||||
|
- Do use CamelCase for classes, and all_lowercase_characters() for function names and attributes
|
||||||
|
- Do use one trailing underscore for class_members_
|
||||||
|
- Do not event think about adding a global variable, goto, macros (unless absolutely needed) or other BS.
|
||||||
|
- Do follow the C++ specifications, as in ISO 14882
|
||||||
|
- Do, if you feel that these guidelines are an impediment for your work, discuss alternatives at bears-pit.com
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../include/LegacyAIPlan.h"
|
||||||
|
|
||||||
|
#include "../../TacticalAI/ai.h" // for EndAIGuysTurn
|
||||||
|
|
||||||
|
|
||||||
|
// Forward declarations for the two legacy functions called here
|
||||||
|
void RTHandleAI( SOLDIERTYPE * pSoldier ); // defined in TacticalAI/Realtime.cpp
|
||||||
|
void TurnBasedHandleNPCAI(SOLDIERTYPE *pSoldier); // defined in TacticalAI/AIMain.cpp
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
void LegacyAIPlan::execute(bool turn_based, PlanInputData& manipulated_object)
|
||||||
|
{
|
||||||
|
if(turn_based)
|
||||||
|
TurnBasedHandleNPCAI(manipulated_object.controlled_npc_);
|
||||||
|
else
|
||||||
|
RTHandleAI(manipulated_object.controlled_npc_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
#include "../include/LegacyAIPlanFactory.h"
|
||||||
|
#include "../include/LegacyAIPlan.h"
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
Plan* LegacyAIPlanFactory::create_plan(const AIInputData& input)
|
||||||
|
{
|
||||||
|
return new LegacyAIPlan();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LegacyAIPlanFactory::update_plan(const AIInputData& input, Plan* plan_to_change)
|
||||||
|
{
|
||||||
|
// TODO: currently, everything is handled in the LegacyAIPlan. The goal is to modularize the AI, so that in
|
||||||
|
// the end, the LegacyAIPlan is split into so many "new" AI Plan subclasses, that every case is covered.
|
||||||
|
// Then the behavior of the old AI would be implemented here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../include/NullPlan.h"
|
||||||
|
|
||||||
|
#include "../../TacticalAI/ai.h" // for EndAIGuysTurn
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
/// Simply end the turn for the npc passed in the manipulated_object wrapper, then return.
|
||||||
|
void NullPlan::execute(bool turn_based, PlanInputData& manipulated_object)
|
||||||
|
{
|
||||||
|
EndAIGuysTurn(manipulated_object.controlled_npc_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../include/NullPlanFactory.h"
|
||||||
|
#include "../include/NullPlan.h"
|
||||||
|
#include "../Tactical/Soldier Control.h"
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
Plan* NullPlanFactory::create_plan(const AIInputData& input)
|
||||||
|
{
|
||||||
|
return new NullPlan();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NullPlanFactory::update_plan(const AIInputData& input, Plan* plan_to_change)
|
||||||
|
{
|
||||||
|
// the idea is to do nothing, so let's do it...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @author feynman (bears-pit.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../include/PlanFactoryLibrary.h"
|
||||||
|
#include "../include/NullPlanFactory.h"
|
||||||
|
#include "../include/LegacyAIPlanFactory.h"
|
||||||
|
// XXX Add includes for new factories here XXX
|
||||||
|
|
||||||
|
|
||||||
|
#include "../../Utils/INIReader.h"
|
||||||
|
|
||||||
|
#undef max // Who the fuck writes MACROS not using CAPITAL LETTERS??? You, sir, have lost your coding license. Please hand over your compiler and leave. Now.
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <limits>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
PlanFactoryLibrary* PlanFactoryLibrary::instance_ = 0;
|
||||||
|
|
||||||
|
/*@brief Initialize all PlanFactories and map them to the slots defined by the configuration file
|
||||||
|
*
|
||||||
|
* This is the place where new factories need to be "registred" in order for them to be available using the
|
||||||
|
* settings in AI.ini
|
||||||
|
*/
|
||||||
|
PlanFactoryLibrary::PlanFactoryLibrary()
|
||||||
|
{
|
||||||
|
|
||||||
|
// ================================================================================
|
||||||
|
// XXX vv Add new factory registrations here vv XXX
|
||||||
|
|
||||||
|
registred_factories_[NullPlanFactory::get_name()] = new NullPlanFactory();
|
||||||
|
registred_factories_[LegacyAIPlanFactory::get_name()] = new LegacyAIPlanFactory();
|
||||||
|
|
||||||
|
// XXX ^^ Add new factory registrations here ^^ XXX
|
||||||
|
// ================================================================================
|
||||||
|
|
||||||
|
CIniReader ini_reader("AI.ini", true);
|
||||||
|
size_t num_slots = ini_reader.ReadInteger("Modularized Tactical AI", "NumFactories", 0, 0, std::numeric_limits<int>::max());
|
||||||
|
for(size_t i(0); i<num_slots; ++i)
|
||||||
|
{
|
||||||
|
std::stringstream slot_index;
|
||||||
|
slot_index<<"Factory_"<<i;
|
||||||
|
std::string factory_name = ini_reader.ReadString("Modularized Tactical AI", const_cast<char*>(slot_index.str().c_str()), "LegacyAIFactory");
|
||||||
|
ai_index_to_factory_mapping_.push_back(registred_factories_[factory_name]);
|
||||||
|
if(!ai_index_to_factory_mapping_.back()->initialize_called())
|
||||||
|
ai_index_to_factory_mapping_.back()->initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @brief If no instance exists yet, create it. Return a pointer to the only existing instance of this library.
|
||||||
|
* @return Pointer to the only instance of the PlanFactoryLibrary
|
||||||
|
*/
|
||||||
|
PlanFactoryLibrary* PlanFactoryLibrary::instance()
|
||||||
|
{
|
||||||
|
if(instance_ == 0)
|
||||||
|
instance_ = new PlanFactoryLibrary();
|
||||||
|
return instance_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**@brief Create a plan for the given input using the factory at the given index
|
||||||
|
* @param index Index of the concrete plan factory to use, set in the constructor via ini settings
|
||||||
|
* @param input The environmental data required for a factory to plan
|
||||||
|
* @throws std::out_of_range for invalid index
|
||||||
|
* @throws std::logic_error for valid index, but undefined factory (most likely due to typo in AI.ini)
|
||||||
|
* @return Pointer to the only instance of the PlanFactoryLibrary
|
||||||
|
*/
|
||||||
|
Plan* PlanFactoryLibrary::create_plan(size_t index, AIInputData& input) const
|
||||||
|
{
|
||||||
|
if(index >= ai_index_to_factory_mapping_.size())
|
||||||
|
throw std::out_of_range("PlanFactoryLibrary detected invalid factory index");
|
||||||
|
if(!ai_index_to_factory_mapping_[index])
|
||||||
|
throw std::logic_error("PlanFactoryLibrary encountered a nullptr for a valid index (typo in AI.ini?)");
|
||||||
|
return ai_index_to_factory_mapping_[index]->create_plan(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -2029,6 +2029,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile)
|
|||||||
numBytesRead = ReadFieldByField(hFile, &this->bOverTurnAPS, sizeof(bOverTurnAPS), sizeof(INT16), numBytesRead);
|
numBytesRead = ReadFieldByField(hFile, &this->bOverTurnAPS, sizeof(bOverTurnAPS), sizeof(INT16), numBytesRead);
|
||||||
numBytesRead = ReadFieldByField(hFile, &this->sMTActionGridNo, sizeof(sMTActionGridNo), sizeof(INT32), numBytesRead);
|
numBytesRead = ReadFieldByField(hFile, &this->sMTActionGridNo, sizeof(sMTActionGridNo), sizeof(INT32), numBytesRead);
|
||||||
numBytesRead = ReadFieldByField(hFile, &this->usMultiTurnAction, sizeof(usMultiTurnAction), sizeof(UINT8), numBytesRead);
|
numBytesRead = ReadFieldByField(hFile, &this->usMultiTurnAction, sizeof(usMultiTurnAction), sizeof(UINT8), numBytesRead);
|
||||||
|
numBytesRead = ReadFieldByField(hFile, &this->bAIIndex, sizeof(bAIIndex), sizeof(UINT16), numBytesRead);
|
||||||
|
|
||||||
numBytesRead = ReadFieldByField(hFile, &this->ubFiller, sizeof(ubFiller), sizeof(UINT8), numBytesRead);
|
numBytesRead = ReadFieldByField(hFile, &this->ubFiller, sizeof(ubFiller), sizeof(UINT8), numBytesRead);
|
||||||
}
|
}
|
||||||
@@ -2037,6 +2038,7 @@ BOOLEAN SOLDIERTYPE::Load(HWFILE hFile)
|
|||||||
this->bOverTurnAPS = 0;
|
this->bOverTurnAPS = 0;
|
||||||
this->sMTActionGridNo = NOWHERE;
|
this->sMTActionGridNo = NOWHERE;
|
||||||
this->usMultiTurnAction = 0;
|
this->usMultiTurnAction = 0;
|
||||||
|
this->bAIIndex = 0;
|
||||||
|
|
||||||
// as we added new variables, fillersize was reduced, here we account for that. We have to also read the existing fillers that now do not exist anymore
|
// as we added new variables, fillersize was reduced, here we account for that. We have to also read the existing fillers that now do not exist anymore
|
||||||
const UINT8 tmp = sizeof(bOverTurnAPS) + sizeof(this->sMTActionGridNo) + sizeof(usMultiTurnAction);
|
const UINT8 tmp = sizeof(bOverTurnAPS) + sizeof(this->sMTActionGridNo) + sizeof(usMultiTurnAction);
|
||||||
|
|||||||
@@ -73,4 +73,4 @@ Screens GameScreens[MAX_SCREENS] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ QuestDebugScreenInit, QuestDebugScreenHandle, QuestDebugScreenShutdown }
|
{ QuestDebugScreenInit, QuestDebugScreenHandle, QuestDebugScreenShutdown }
|
||||||
};
|
};
|
||||||
@@ -12,8 +12,6 @@
|
|||||||
#include "MemMan.h"
|
#include "MemMan.h"
|
||||||
#include "Debug Control.h"
|
#include "Debug Control.h"
|
||||||
#include "mapscreen.h"
|
#include "mapscreen.h"
|
||||||
|
|
||||||
#include "Soldier Create.cpp"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_CHAR_DATA_LENGTH 500
|
#define MAX_CHAR_DATA_LENGTH 500
|
||||||
|
|||||||
+8056
-8240
File diff suppressed because it is too large
Load Diff
+176
-226
@@ -6,215 +6,193 @@
|
|||||||
#include "Soldier Control.h"
|
#include "Soldier Control.h"
|
||||||
#include "overhead types.h"
|
#include "overhead types.h"
|
||||||
#include "soldier find.h"
|
#include "soldier find.h"
|
||||||
#define ADD_SOLDIER_NO_PROFILE_ID 200
|
#define ADD_SOLDIER_NO_PROFILE_ID 200
|
||||||
|
|
||||||
#define MAX_REALTIME_SPEED_VAL 10
|
#define MAX_REALTIME_SPEED_VAL 10
|
||||||
|
|
||||||
/*
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
TOPTION_SUBTITLES,
|
|
||||||
TOPTION_SPEECH,
|
|
||||||
TOPTION_KEY_ADVANCE_SPEECH,
|
|
||||||
TOPTION_RTCONFIRM,
|
|
||||||
TOPTION_HIDE_BULLETS,
|
|
||||||
TOPTION_TRACKING_MODE,
|
|
||||||
TOPTION_CONFIRM_MOVE,
|
|
||||||
TOPTION_MUTE_CONFIRMATIONS,
|
|
||||||
TOPTION_SHADOWS,
|
|
||||||
TOPTION_BLOOD_N_GORE,
|
|
||||||
|
|
||||||
NUM_TOPTIONS
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Enums for waiting for mercs to finish codes
|
// Enums for waiting for mercs to finish codes
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
NO_WAIT_EVENT = 0,
|
NO_WAIT_EVENT = 0,
|
||||||
WAIT_FOR_MERCS_TO_WALKOFF_SCREEN,
|
WAIT_FOR_MERCS_TO_WALKOFF_SCREEN,
|
||||||
WAIT_FOR_MERCS_TO_WALKON_SCREEN,
|
WAIT_FOR_MERCS_TO_WALKON_SCREEN,
|
||||||
WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO
|
WAIT_FOR_MERCS_TO_WALK_TO_GRIDNO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TACTICAL ENGINE STATUS FLAGS
|
// TACTICAL ENGINE STATUS FLAGS
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT8 bFirstID;
|
UINT8 bFirstID;
|
||||||
UINT8 bLastID;
|
UINT8 bLastID;
|
||||||
COLORVAL RadarColor;
|
COLORVAL RadarColor;
|
||||||
INT8 bSide;
|
INT8 bSide;
|
||||||
INT8 bMenInSector;
|
INT8 bMenInSector;
|
||||||
UINT8 ubLastMercToRadio;
|
UINT8 ubLastMercToRadio;
|
||||||
INT8 bTeamActive;
|
INT8 bTeamActive;
|
||||||
INT8 bAwareOfOpposition;
|
INT8 bAwareOfOpposition;
|
||||||
INT8 bHuman;
|
INT8 bHuman;
|
||||||
} TacticalTeamType;
|
} TacticalTeamType;
|
||||||
|
|
||||||
//for use with TacticalStatusType.ubEnemyIntention
|
//for use with TacticalStatusType.ubEnemyIntention
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
INTENTION_SCOUTING,
|
INTENTION_SCOUTING,
|
||||||
INTENTION_PATROLLING,
|
INTENTION_PATROLLING,
|
||||||
INTENTION_ATTACKING,
|
INTENTION_ATTACKING,
|
||||||
INTENTION_DEFENDING,
|
INTENTION_DEFENDING,
|
||||||
INTENTION_RETREATING
|
INTENTION_RETREATING
|
||||||
};
|
};
|
||||||
|
|
||||||
//for use with TacticalStatusType.ubEnemyIntendedRetreatDirection
|
//for use with TacticalStatusType.ubEnemyIntendedRetreatDirection
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
RETREAT_NORTH,
|
RETREAT_NORTH,
|
||||||
RETREAT_EAST,
|
RETREAT_EAST,
|
||||||
RETREAT_SOUTH,
|
RETREAT_SOUTH,
|
||||||
RETREAT_WEST
|
RETREAT_WEST
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PANIC_BOMBS_HERE 0x01
|
#define PANIC_BOMBS_HERE 0x01
|
||||||
#define PANIC_TRIGGERS_HERE 0x02
|
#define PANIC_TRIGGERS_HERE 0x02
|
||||||
|
#define NUM_PANIC_TRIGGERS 3
|
||||||
#define NUM_PANIC_TRIGGERS 3
|
|
||||||
|
|
||||||
#define ENEMY_OFFERED_SURRENDER 0x01
|
#define ENEMY_OFFERED_SURRENDER 0x01
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT32 uiFlags;
|
UINT32 uiFlags;
|
||||||
TacticalTeamType Team[ MAXTEAMS ];
|
TacticalTeamType Team[ MAXTEAMS ];
|
||||||
UINT8 ubCurrentTeam;
|
UINT8 ubCurrentTeam;
|
||||||
INT32 sSlideTarget;
|
INT32 sSlideTarget;
|
||||||
INT16 sSlideReason;
|
INT16 sSlideReason;
|
||||||
UINT32 uiTimeSinceMercAIStart;
|
UINT32 uiTimeSinceMercAIStart;
|
||||||
INT8 fPanicFlags;
|
INT8 fPanicFlags;
|
||||||
INT32 sPanicTriggerGridNoUnused;
|
INT32 sPanicTriggerGridNoUnused;
|
||||||
INT16 sHandGrid;
|
INT16 sHandGrid;
|
||||||
UINT8 ubSpottersCalledForBy;
|
UINT8 ubSpottersCalledForBy;
|
||||||
UINT8 ubTheChosenOne;
|
UINT8 ubTheChosenOne;
|
||||||
UINT32 uiTimeOfLastInput;
|
UINT32 uiTimeOfLastInput;
|
||||||
UINT32 uiTimeSinceDemoOn;
|
UINT32 uiTimeSinceDemoOn;
|
||||||
UINT32 uiCountdownToRestart;
|
UINT32 uiCountdownToRestart;
|
||||||
BOOLEAN fGoingToEnterDemo;
|
BOOLEAN fGoingToEnterDemo;
|
||||||
BOOLEAN fNOTDOLASTDEMO;
|
BOOLEAN fNOTDOLASTDEMO;
|
||||||
BOOLEAN fMultiplayer;
|
BOOLEAN fMultiplayer;
|
||||||
BOOLEAN fCivGroupHostile[ NUM_CIV_GROUPS ];
|
BOOLEAN fCivGroupHostile[ NUM_CIV_GROUPS ];
|
||||||
UINT8 ubLastBattleSectorX;
|
UINT8 ubLastBattleSectorX;
|
||||||
UINT8 ubLastBattleSectorY;
|
UINT8 ubLastBattleSectorY;
|
||||||
BOOLEAN fLastBattleWon;
|
BOOLEAN fLastBattleWon;
|
||||||
INT8 bOriginalSizeOfEnemyForce;
|
INT8 bOriginalSizeOfEnemyForce;
|
||||||
INT8 bPanicTriggerIsAlarmUnused;
|
INT8 bPanicTriggerIsAlarmUnused;
|
||||||
BOOLEAN fVirginSector;
|
BOOLEAN fVirginSector;
|
||||||
BOOLEAN fEnemyInSector;
|
BOOLEAN fEnemyInSector;
|
||||||
BOOLEAN fInterruptOccurred;
|
BOOLEAN fInterruptOccurred;
|
||||||
INT8 bRealtimeSpeed;
|
INT8 bRealtimeSpeed;
|
||||||
UINT8 ubEnemyIntention;
|
UINT8 ubEnemyIntention;
|
||||||
UINT8 ubEnemyIntendedRetreatDirection;
|
UINT8 ubEnemyIntendedRetreatDirection;
|
||||||
UINT8 ubEnemySightingOnTheirTurnEnemyID;
|
UINT8 ubEnemySightingOnTheirTurnEnemyID;
|
||||||
UINT8 ubEnemySightingOnTheirTurnPlayerID;
|
UINT8 ubEnemySightingOnTheirTurnPlayerID;
|
||||||
BOOLEAN fEnemySightingOnTheirTurn;
|
BOOLEAN fEnemySightingOnTheirTurn;
|
||||||
BOOLEAN fAutoBandageMode;
|
BOOLEAN fAutoBandageMode;
|
||||||
UINT8 ubAttackBusyCount;
|
UINT8 ubAttackBusyCount;
|
||||||
INT8 bNumEnemiesFoughtInBattleUnused;
|
INT8 bNumEnemiesFoughtInBattleUnused;
|
||||||
UINT8 ubEngagedInConvFromActionMercID;
|
UINT8 ubEngagedInConvFromActionMercID;
|
||||||
UINT16 usTactialTurnLimitCounter;
|
UINT16 usTactialTurnLimitCounter;
|
||||||
BOOLEAN fInTopMessage;
|
BOOLEAN fInTopMessage;
|
||||||
UINT8 ubTopMessageType;
|
UINT8 ubTopMessageType;
|
||||||
CHAR16 zTopMessageString[20];
|
CHAR16 zTopMessageString[20];
|
||||||
UINT16 usTactialTurnLimitMax;
|
UINT16 usTactialTurnLimitMax;
|
||||||
UINT32 uiTactialTurnLimitClock;
|
UINT32 uiTactialTurnLimitClock;
|
||||||
BOOLEAN fTactialTurnLimitStartedBeep;
|
BOOLEAN fTactialTurnLimitStartedBeep;
|
||||||
INT8 bBoxingState;
|
INT8 bBoxingState;
|
||||||
INT8 bConsNumTurnsNotSeen;
|
INT8 bConsNumTurnsNotSeen;
|
||||||
UINT8 ubArmyGuysKilled;
|
UINT8 ubArmyGuysKilled;
|
||||||
|
|
||||||
INT32 sPanicTriggerGridNo[ NUM_PANIC_TRIGGERS ];
|
INT32 sPanicTriggerGridNo[ NUM_PANIC_TRIGGERS ];
|
||||||
INT8 bPanicTriggerIsAlarm[ NUM_PANIC_TRIGGERS ];
|
INT8 bPanicTriggerIsAlarm[ NUM_PANIC_TRIGGERS ];
|
||||||
UINT8 ubPanicTolerance[ NUM_PANIC_TRIGGERS ];
|
UINT8 ubPanicTolerance[ NUM_PANIC_TRIGGERS ];
|
||||||
BOOLEAN fAtLeastOneGuyOnMultiSelect;
|
BOOLEAN fAtLeastOneGuyOnMultiSelect;
|
||||||
BOOLEAN fSaidCreatureFlavourQuote;
|
BOOLEAN fSaidCreatureFlavourQuote;
|
||||||
BOOLEAN fHaveSeenCreature;
|
BOOLEAN fHaveSeenCreature;
|
||||||
BOOLEAN fKilledEnemyOnAttack;
|
BOOLEAN fKilledEnemyOnAttack;
|
||||||
UINT8 ubEnemyKilledOnAttack;
|
UINT8 ubEnemyKilledOnAttack;
|
||||||
INT8 bEnemyKilledOnAttackLevel;
|
INT8 bEnemyKilledOnAttackLevel;
|
||||||
UINT16 ubEnemyKilledOnAttackLocation;
|
UINT16 ubEnemyKilledOnAttackLocation;
|
||||||
BOOLEAN fItemsSeenOnAttack;
|
BOOLEAN fItemsSeenOnAttack;
|
||||||
BOOLEAN ubItemsSeenOnAttackSoldier;
|
BOOLEAN ubItemsSeenOnAttackSoldier;
|
||||||
BOOLEAN fBeenInCombatOnce;
|
BOOLEAN fBeenInCombatOnce;
|
||||||
BOOLEAN fSaidCreatureSmellQuote;
|
BOOLEAN fSaidCreatureSmellQuote;
|
||||||
UINT32 usItemsSeenOnAttackGridNo;
|
UINT32 usItemsSeenOnAttackGridNo;
|
||||||
BOOLEAN fLockItemLocators;
|
BOOLEAN fLockItemLocators;
|
||||||
UINT8 ubLastQuoteSaid;
|
UINT8 ubLastQuoteSaid;
|
||||||
UINT8 ubLastQuoteProfileNUm;
|
UINT8 ubLastQuoteProfileNUm;
|
||||||
BOOLEAN fCantGetThrough;
|
BOOLEAN fCantGetThrough;
|
||||||
INT32 sCantGetThroughGridNo;
|
INT32 sCantGetThroughGridNo;
|
||||||
INT32 sCantGetThroughSoldierGridNo;
|
INT32 sCantGetThroughSoldierGridNo;
|
||||||
UINT8 ubCantGetThroughID;
|
UINT8 ubCantGetThroughID;
|
||||||
BOOLEAN fDidGameJustStart;
|
BOOLEAN fDidGameJustStart;
|
||||||
BOOLEAN fStatChangeCheatOn;
|
BOOLEAN fStatChangeCheatOn;
|
||||||
UINT8 ubLastRequesterTargetID;
|
UINT8 ubLastRequesterTargetID;
|
||||||
BOOLEAN fGoodToAllowCrows;
|
BOOLEAN fGoodToAllowCrows;
|
||||||
UINT8 ubNumCrowsPossible;
|
UINT8 ubNumCrowsPossible;
|
||||||
UINT32 uiTimeCounterForGiveItemSrc;
|
UINT32 uiTimeCounterForGiveItemSrc;
|
||||||
BOOLEAN fUnLockUIAfterHiddenInterrupt;
|
BOOLEAN fUnLockUIAfterHiddenInterrupt;
|
||||||
INT8 bNumFoughtInBattle[ MAXTEAMS ];
|
INT8 bNumFoughtInBattle[ MAXTEAMS ];
|
||||||
UINT32 uiDecayBloodLastUpdate;
|
UINT32 uiDecayBloodLastUpdate;
|
||||||
UINT32 uiTimeSinceLastInTactical;
|
UINT32 uiTimeSinceLastInTactical;
|
||||||
BOOLEAN fHasAGameBeenStarted;
|
BOOLEAN fHasAGameBeenStarted;
|
||||||
INT8 bConsNumTurnsWeHaventSeenButEnemyDoes;
|
INT8 bConsNumTurnsWeHaventSeenButEnemyDoes;
|
||||||
BOOLEAN fSomeoneHit;
|
BOOLEAN fSomeoneHit;
|
||||||
UINT8 ubPaddingSmall;
|
UINT8 ubPaddingSmall;
|
||||||
UINT32 uiTimeSinceLastOpplistDecay;
|
UINT32 uiTimeSinceLastOpplistDecay;
|
||||||
INT8 bMercArrivingQuoteBeingUsed;
|
INT8 bMercArrivingQuoteBeingUsed;
|
||||||
UINT8 ubEnemyKilledOnAttackKiller;
|
UINT8 ubEnemyKilledOnAttackKiller;
|
||||||
BOOLEAN fCountingDownForGuideDescription;
|
BOOLEAN fCountingDownForGuideDescription;
|
||||||
INT8 bGuideDescriptionCountDown;
|
INT8 bGuideDescriptionCountDown;
|
||||||
UINT8 ubGuideDescriptionToUse;
|
UINT8 ubGuideDescriptionToUse;
|
||||||
INT8 bGuideDescriptionSectorX;
|
INT8 bGuideDescriptionSectorX;
|
||||||
INT8 bGuideDescriptionSectorY;
|
INT8 bGuideDescriptionSectorY;
|
||||||
INT8 fEnemyFlags;
|
INT8 fEnemyFlags;
|
||||||
BOOLEAN fAutoBandagePending;
|
BOOLEAN fAutoBandagePending;
|
||||||
BOOLEAN fHasEnteredCombatModeSinceEntering;
|
BOOLEAN fHasEnteredCombatModeSinceEntering;
|
||||||
BOOLEAN fDontAddNewCrows;
|
BOOLEAN fDontAddNewCrows;
|
||||||
UINT8 ubMorePadding;
|
UINT8 ubMorePadding;
|
||||||
UINT16 sCreatureTenseQuoteDelay;
|
UINT16 sCreatureTenseQuoteDelay;
|
||||||
UINT32 uiCreatureTenseQuoteLastUpdate;
|
UINT32 uiCreatureTenseQuoteLastUpdate;
|
||||||
// SANDRO - added these
|
// SANDRO - added these
|
||||||
UINT8 ubLastRequesterSurgeryTargetID;
|
UINT8 ubLastRequesterSurgeryTargetID;
|
||||||
UINT8 ubInterruptPending;
|
UINT8 ubInterruptPending;
|
||||||
|
|
||||||
// PADDING GONE!!!!!
|
// PADDING GONE!!!!!
|
||||||
|
|
||||||
} TacticalStatusType;
|
} TacticalStatusType;
|
||||||
|
|
||||||
|
|
||||||
extern UINT8 gbPlayerNum;
|
extern UINT8 gbPlayerNum;
|
||||||
extern INT8 gbShowEnemies;
|
extern INT8 gbShowEnemies;
|
||||||
|
|
||||||
extern UINT16 gusSelectedSoldier;
|
extern UINT16 gusSelectedSoldier;
|
||||||
extern UINT16 gusOldSelectedSoldier;
|
extern UINT16 gusOldSelectedSoldier;
|
||||||
|
|
||||||
extern CHAR8 gzAlertStr[][ 30 ];
|
extern CHAR8 gzAlertStr[][ 30 ];
|
||||||
extern CHAR8 gzActionStr[][ 30 ];
|
extern CHAR8 gzActionStr[][ 30 ];
|
||||||
extern CHAR8 gzDirectionStr[][ 30 ];
|
extern CHAR8 gzDirectionStr[][ 30 ];
|
||||||
|
|
||||||
// TEMP FOR E3
|
// TEMP FOR E3
|
||||||
extern UINT8 gubCurrentScene;
|
extern UINT8 gubCurrentScene;
|
||||||
extern CHAR8 *GetSceneFilename( );
|
extern CHAR8 *GetSceneFilename( );
|
||||||
extern INT8 ubLevelMoveLink[ 10 ];
|
extern INT8 ubLevelMoveLink[ 10 ];
|
||||||
|
|
||||||
// Soldier List used for all soldier overhead interaction
|
// Soldier List used for all soldier overhead interaction
|
||||||
extern SOLDIERTYPE Menptr[ TOTAL_SOLDIERS ];
|
extern SOLDIERTYPE Menptr[ TOTAL_SOLDIERS ];
|
||||||
extern SOLDIERTYPE *MercPtrs[ TOTAL_SOLDIERS ];
|
extern SOLDIERTYPE *MercPtrs[ TOTAL_SOLDIERS ];
|
||||||
|
|
||||||
// MERC SLOTS - A LIST OF ALL ACTIVE MERCS
|
// MERC SLOTS - A LIST OF ALL ACTIVE MERCS
|
||||||
extern SOLDIERTYPE *MercSlots[ TOTAL_SOLDIERS ];
|
extern SOLDIERTYPE *MercSlots[ TOTAL_SOLDIERS ];
|
||||||
extern UINT32 guiNumMercSlots;
|
extern UINT32 guiNumMercSlots;
|
||||||
|
|
||||||
extern BOOLEAN gfMovingAnimation;
|
extern BOOLEAN gfMovingAnimation;
|
||||||
|
|
||||||
|
|
||||||
extern TacticalStatusType gTacticalStatus;
|
extern TacticalStatusType gTacticalStatus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -226,7 +204,7 @@ BOOLEAN InitOverhead( );
|
|||||||
BOOLEAN ShutdownOverhead( );
|
BOOLEAN ShutdownOverhead( );
|
||||||
BOOLEAN GetSoldier( SOLDIERTYPE **ppSoldier, UINT16 usSoldierIndex );
|
BOOLEAN GetSoldier( SOLDIERTYPE **ppSoldier, UINT16 usSoldierIndex );
|
||||||
|
|
||||||
UINT32 CountNonVehiclesOnPlayerTeam( void );
|
UINT32 CountNonVehiclesOnPlayerTeam( );
|
||||||
|
|
||||||
INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel );
|
INT16 NewOKDestination( SOLDIERTYPE * pCurrSoldier, INT32 sGridNo, BOOLEAN fPeopleToo, INT8 bLevel );
|
||||||
|
|
||||||
@@ -237,7 +215,7 @@ extern BOOLEAN FlatRoofAboveGridNo( INT32 iMapIndex );
|
|||||||
|
|
||||||
|
|
||||||
BOOLEAN ExecuteOverhead( );
|
BOOLEAN ExecuteOverhead( );
|
||||||
BOOLEAN ResetAllAnimationCache( );
|
BOOLEAN ResetAllAnimationCache( );
|
||||||
|
|
||||||
void EndTurn( );
|
void EndTurn( );
|
||||||
void EndTurn( UINT8 ubNextTeam );
|
void EndTurn( UINT8 ubNextTeam );
|
||||||
@@ -245,7 +223,7 @@ void EndTurn( UINT8 ubNextTeam );
|
|||||||
void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode );
|
void StartPlayerTeamTurn( BOOLEAN fDoBattleSnd, BOOLEAN fEnteringCombatMode );
|
||||||
void EndTacticalDemo( );
|
void EndTacticalDemo( );
|
||||||
|
|
||||||
void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect );
|
void SelectSoldier( UINT16 usSoldierID, BOOLEAN fAcknowledge, BOOLEAN fForceReselect );
|
||||||
|
|
||||||
//Kaiden: Function declaration from UB to reveal all items after combat.
|
//Kaiden: Function declaration from UB to reveal all items after combat.
|
||||||
void RevealAllDroppedEnemyItems();
|
void RevealAllDroppedEnemyItems();
|
||||||
@@ -282,93 +260,66 @@ void SelectNextAvailSoldier( SOLDIERTYPE *pSoldier );
|
|||||||
BOOLEAN TeamMemberNear(INT8 bTeam, INT32 sGridNo, INT32 iRange);
|
BOOLEAN TeamMemberNear(INT8 bTeam, INT32 sGridNo, INT32 iRange);
|
||||||
BOOLEAN IsValidTargetMerc( UINT8 ubSoldierID );
|
BOOLEAN IsValidTargetMerc( UINT8 ubSoldierID );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// FUNCTIONS FOR MANIPULATING MERC SLOTS - A LIST OF ALL ACTIVE MERCS
|
// FUNCTIONS FOR MANIPULATING MERC SLOTS - A LIST OF ALL ACTIVE MERCS
|
||||||
INT32 GetFreeMercSlot(void);
|
INT32 GetFreeMercSlot( );
|
||||||
void RecountMercSlots(void);
|
INT32 AddMercSlot( SOLDIERTYPE *pSoldier );
|
||||||
INT32 AddMercSlot( SOLDIERTYPE *pSoldier );
|
BOOLEAN RemoveMercSlot( SOLDIERTYPE *pSoldier );
|
||||||
BOOLEAN RemoveMercSlot( SOLDIERTYPE *pSoldier );
|
|
||||||
|
|
||||||
INT32 AddAwaySlot( SOLDIERTYPE *pSoldier );
|
INT32 AddAwaySlot( SOLDIERTYPE *pSoldier );
|
||||||
BOOLEAN RemoveAwaySlot( SOLDIERTYPE *pSoldier );
|
BOOLEAN RemoveAwaySlot( SOLDIERTYPE *pSoldier );
|
||||||
INT32 MoveSoldierFromMercToAwaySlot( SOLDIERTYPE * pSoldier );
|
INT32 MoveSoldierFromMercToAwaySlot( SOLDIERTYPE * pSoldier );
|
||||||
INT32 MoveSoldierFromAwayToMercSlot( SOLDIERTYPE * pSoldier );
|
INT32 MoveSoldierFromAwayToMercSlot( SOLDIERTYPE * pSoldier );
|
||||||
|
|
||||||
void EnterCombatMode( UINT8 ubStartingTeam );
|
void EnterCombatMode( UINT8 ubStartingTeam );
|
||||||
void ExitCombatMode( );
|
void ExitCombatMode( );
|
||||||
|
|
||||||
void HandleTeamServices( UINT8 ubTeamNum );
|
void HandleTeamServices( UINT8 ubTeamNum );
|
||||||
void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier );
|
void HandlePlayerServices( SOLDIERTYPE *pTeamSoldier );
|
||||||
|
|
||||||
void SetEnemyPresence( );
|
void SetEnemyPresence( );
|
||||||
|
|
||||||
void CycleThroughKnownEnemies( );
|
void CycleThroughKnownEnemies( );
|
||||||
|
|
||||||
BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen );
|
BOOLEAN CheckForEndOfCombatMode( BOOLEAN fIncrementTurnsNotSeen );
|
||||||
|
|
||||||
SOLDIERTYPE * FreeUpAttacker( );
|
SOLDIERTYPE * FreeUpAttacker( );
|
||||||
|
|
||||||
BOOLEAN PlayerTeamFull( );
|
BOOLEAN PlayerTeamFull( );
|
||||||
|
void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 );
|
||||||
void SetActionToDoOnceMercsGetToLocation( UINT8 ubActionCode, INT8 bNumMercsWaiting, UINT32 uiData1, UINT32 uiData2, UINT32 uiData3 );
|
|
||||||
|
|
||||||
void ResetAllMercSpeeds( );
|
void ResetAllMercSpeeds( );
|
||||||
|
|
||||||
BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLEAN fInitialMove, UINT16 usAnimState );
|
BOOLEAN HandleGotoNewGridNo( SOLDIERTYPE *pSoldier, BOOLEAN *pfKeepMoving, BOOLEAN fInitialMove, UINT16 usAnimState );
|
||||||
|
|
||||||
SOLDIERTYPE * ReduceAttackBusyCount( );
|
SOLDIERTYPE * ReduceAttackBusyCount( );
|
||||||
|
|
||||||
// HEADROCK HAM B2.6: Made this public so it can be used elsewhere.
|
// HEADROCK HAM B2.6: Made this public so it can be used elsewhere.
|
||||||
INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier );
|
INT8 CalcSuppressionTolerance( SOLDIERTYPE * pSoldier );
|
||||||
// HEADROCK HAM 3.2: A new function for checking the condition of nearby friendlies and returning a modifier.
|
// HEADROCK HAM 3.2: A new function for checking the condition of nearby friendlies and returning a modifier.
|
||||||
INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier );
|
INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier );
|
||||||
|
|
||||||
void CommonEnterCombatModeCode( );
|
void CommonEnterCombatModeCode( );
|
||||||
|
|
||||||
void CheckForPotentialAddToBattleIncrement( SOLDIERTYPE *pSoldier );
|
void CheckForPotentialAddToBattleIncrement( SOLDIERTYPE *pSoldier );
|
||||||
|
void CencelAllActionsForTimeCompression( );
|
||||||
void CencelAllActionsForTimeCompression( void );
|
|
||||||
|
|
||||||
BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated );
|
BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated );
|
||||||
|
|
||||||
void AddManToTeam( INT8 bTeam );
|
void AddManToTeam( INT8 bTeam );
|
||||||
|
|
||||||
void RemoveManFromTeam( INT8 bTeam );
|
void RemoveManFromTeam( INT8 bTeam );
|
||||||
|
|
||||||
void RemoveSoldierFromTacticalSector( SOLDIERTYPE *pSoldier, BOOLEAN fAdjustSelected );
|
void RemoveSoldierFromTacticalSector( SOLDIERTYPE *pSoldier, BOOLEAN fAdjustSelected );
|
||||||
|
|
||||||
void MakeCivHostile( SOLDIERTYPE *pSoldier, INT8 bNewSide );
|
void MakeCivHostile( SOLDIERTYPE *pSoldier, INT8 bNewSide );
|
||||||
|
|
||||||
#define REASON_NORMAL_ATTACK 1
|
#define REASON_NORMAL_ATTACK 1
|
||||||
#define REASON_EXPLOSION 2
|
#define REASON_EXPLOSION 2
|
||||||
|
|
||||||
BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** ppTarget, INT8 bReason );
|
BOOLEAN ProcessImplicationsOfPCAttack( SOLDIERTYPE * pSoldier, SOLDIERTYPE ** ppTarget, INT8 bReason );
|
||||||
|
|
||||||
INT32 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier, INT32 * psAdjustedTargetGridNo, UINT8 * pubDirection );
|
INT32 FindAdjacentPunchTarget( SOLDIERTYPE * pSoldier, SOLDIERTYPE * pTargetSoldier, INT32 * psAdjustedTargetGridNo, UINT8 * pubDirection );
|
||||||
|
|
||||||
SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked );
|
SOLDIERTYPE * CivilianGroupMemberChangesSides( SOLDIERTYPE * pAttacked );
|
||||||
void CivilianGroupChangesSides( UINT8 ubCivilianGroup );
|
void CivilianGroupChangesSides( UINT8 ubCivilianGroup );
|
||||||
|
|
||||||
void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier );
|
void CycleVisibleEnemies( SOLDIERTYPE *pSrcSoldier );
|
||||||
UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked );
|
UINT8 CivilianGroupMembersChangeSidesWithinProximity( SOLDIERTYPE * pAttacked );
|
||||||
|
void PauseAITemporarily( );
|
||||||
void PauseAITemporarily( void );
|
void PauseAIUntilManuallyUnpaused( );
|
||||||
void PauseAIUntilManuallyUnpaused( void );
|
void UnPauseAI( );
|
||||||
void UnPauseAI( void );
|
void DoPOWPathChecks( );
|
||||||
|
BOOLEAN HostileCiviliansWithGunsPresent( );
|
||||||
void DoPOWPathChecks( void );
|
BOOLEAN HostileCiviliansPresent( );
|
||||||
|
BOOLEAN HostileBloodcatsPresent( );
|
||||||
BOOLEAN HostileCiviliansWithGunsPresent( void );
|
|
||||||
BOOLEAN HostileCiviliansPresent( void );
|
|
||||||
BOOLEAN HostileBloodcatsPresent( void );
|
|
||||||
|
|
||||||
#ifdef ENABLE_ZOMBIES
|
#ifdef ENABLE_ZOMBIES
|
||||||
BOOLEAN HostileZombiesPresent( void );
|
BOOLEAN HostileZombiesPresent( );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UINT8 NumPCsInSector( void );
|
UINT8 NumPCsInSector( );
|
||||||
|
|
||||||
void SetSoldierNonNeutral( SOLDIERTYPE * pSoldier );
|
void SetSoldierNonNeutral( SOLDIERTYPE * pSoldier );
|
||||||
void SetSoldierNeutral( SOLDIERTYPE * pSoldier );
|
void SetSoldierNeutral( SOLDIERTYPE * pSoldier );
|
||||||
|
|
||||||
@@ -376,13 +327,13 @@ void SetSoldierNeutral( SOLDIERTYPE * pSoldier );
|
|||||||
void HandleThePlayerBeNotifiedOfSomeoneElseInSector();
|
void HandleThePlayerBeNotifiedOfSomeoneElseInSector();
|
||||||
void SetMsgBoxForPlayerBeNotifiedOfSomeoneElseInSector();
|
void SetMsgBoxForPlayerBeNotifiedOfSomeoneElseInSector();
|
||||||
|
|
||||||
void HandleDisplayingOfPlayerLostDialogue( void );
|
void HandleDisplayingOfPlayerLostDialogue( );
|
||||||
|
|
||||||
// UTILITY FUNCTIONS
|
// UTILITY FUNCTIONS
|
||||||
INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam );
|
INT8 NumActiveAndConsciousTeamMembers( UINT8 ubTeam );
|
||||||
UINT8 NumEnemyInSector( );
|
UINT8 NumEnemyInSector( );
|
||||||
UINT8 NumCapableEnemyInSector( );
|
UINT8 NumCapableEnemyInSector( );
|
||||||
INT8 NumMercsOnPlayerTeam( );
|
INT8 NumMercsOnPlayerTeam( );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern BOOLEAN sniperwarning;
|
extern BOOLEAN sniperwarning;
|
||||||
@@ -395,18 +346,17 @@ extern BOOLEAN gogglewarning;
|
|||||||
|
|
||||||
// will a sam site under the players control shoot down an airraid?
|
// will a sam site under the players control shoot down an airraid?
|
||||||
BOOLEAN WillAirRaidBeStopped( INT16 sSectorX, INT16 sSectorY );
|
BOOLEAN WillAirRaidBeStopped( INT16 sSectorX, INT16 sSectorY );
|
||||||
|
|
||||||
// HEADROCK HAM 3.5: Externalized for First Arrival enemy check
|
// HEADROCK HAM 3.5: Externalized for First Arrival enemy check
|
||||||
extern UINT8 NumEnemyInSector();
|
extern UINT8 NumEnemyInSector();
|
||||||
|
|
||||||
#ifdef ENABLE_ZOMBIES
|
#ifdef ENABLE_ZOMBIES
|
||||||
// Flugente
|
// Flugente
|
||||||
extern UINT8 NumZombiesInSector();
|
extern UINT8 NumZombiesInSector();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void HandleSurrenderOffer( SOLDIERTYPE* pSoldier ); // Flugente: offer the enemy the chance to surrender
|
void HandleSurrenderOffer( SOLDIERTYPE* pSoldier ); // Flugente: offer the enemy the chance to surrender
|
||||||
|
|
||||||
// setting fForce to TRUE allows dropping of gear in combat (used in auto-resolve instances)
|
// setting fForce to TRUE allows dropping of gear in combat (used in auto-resolve instances)
|
||||||
void TeamDropAll(UINT8 bTeam, BOOLEAN fForce = FALSE);
|
void TeamDropAll(UINT8 bTeam, BOOLEAN fForce = FALSE);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ub_config.h"
|
#include "ub_config.h"
|
||||||
|
#include "../ModularizedTacticalAI/include/Plan.h" // for plan destructor call
|
||||||
|
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
#include "Ja25_Tactical.h"
|
#include "Ja25_Tactical.h"
|
||||||
@@ -1023,11 +1024,16 @@ SOLDIERTYPE& SOLDIERTYPE::operator=(const OLDSOLDIERTYPE_101& src)
|
|||||||
this->bDrinkLevel = 0;
|
this->bDrinkLevel = 0;
|
||||||
this->usStarveDamageHealth = 0;
|
this->usStarveDamageHealth = 0;
|
||||||
this->usStarveDamageStrength = 0;
|
this->usStarveDamageStrength = 0;
|
||||||
|
this->bAIIndex = 0;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
SOLDIERTYPE::~SOLDIERTYPE() {}
|
SOLDIERTYPE::~SOLDIERTYPE()
|
||||||
|
{
|
||||||
|
if(ai_masterplan_)
|
||||||
|
delete ai_masterplan_;
|
||||||
|
}
|
||||||
|
|
||||||
SOLDIERTYPE::SOLDIERTYPE() {
|
SOLDIERTYPE::SOLDIERTYPE() {
|
||||||
initialize();
|
initialize();
|
||||||
@@ -1061,38 +1067,6 @@ UINT32 SOLDIERTYPE::GetChecksum( )
|
|||||||
return( uiChecksum );
|
return( uiChecksum );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Copy Constructor
|
|
||||||
SOLDIERTYPE::SOLDIERTYPE(const SOLDIERTYPE& src)
|
|
||||||
{
|
|
||||||
memcpy(this, &src, SIZEOF_SOLDIERTYPE_POD);
|
|
||||||
inv = src.inv;
|
|
||||||
aiData = src.aiData;
|
|
||||||
flags = src.flags;
|
|
||||||
timeChanges = src.timeChanges;
|
|
||||||
timeCounters = src.timeCounters;
|
|
||||||
drugs = src.drugs;
|
|
||||||
stats = src.stats;
|
|
||||||
pathing = src.pathing;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assignment operator
|
|
||||||
SOLDIERTYPE& SOLDIERTYPE::operator=(const SOLDIERTYPE& src)
|
|
||||||
{
|
|
||||||
if (this != &src) {
|
|
||||||
memcpy(this, &src, SIZEOF_SOLDIERTYPE_POD);
|
|
||||||
aiData = src.aiData;
|
|
||||||
flags = src.flags;
|
|
||||||
timeChanges = src.timeChanges;
|
|
||||||
timeCounters = src.timeCounters;
|
|
||||||
drugs = src.drugs;
|
|
||||||
stats = src.stats;
|
|
||||||
pathing = src.pathing;
|
|
||||||
inv = src.inv;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the soldier.
|
// Initialize the soldier.
|
||||||
// Use this instead of the old method of calling memset!
|
// Use this instead of the old method of calling memset!
|
||||||
// Note that the constructor does this automatically.
|
// Note that the constructor does this automatically.
|
||||||
@@ -1100,6 +1074,7 @@ void SOLDIERTYPE::initialize()
|
|||||||
{
|
{
|
||||||
memset( this, 0, SIZEOF_SOLDIERTYPE_POD);
|
memset( this, 0, SIZEOF_SOLDIERTYPE_POD);
|
||||||
inv.clear();
|
inv.clear();
|
||||||
|
ai_masterplan_ = 0;
|
||||||
|
|
||||||
memset( &aiData, 0, sizeof(STRUCT_AIData) );
|
memset( &aiData, 0, sizeof(STRUCT_AIData) );
|
||||||
memset( &flags, 0, sizeof(STRUCT_Flags) );
|
memset( &flags, 0, sizeof(STRUCT_Flags) );
|
||||||
@@ -19270,4 +19245,5 @@ BOOLEAN DecideAltAnimForBigMerc( SOLDIERTYPE * pSoldier )
|
|||||||
BOOLEAN TwoStagedTrait( UINT8 uiSkillTraitNumber )
|
BOOLEAN TwoStagedTrait( UINT8 uiSkillTraitNumber )
|
||||||
{
|
{
|
||||||
return( uiSkillTraitNumber > 0 && (uiSkillTraitNumber <= NUM_ORIGINAL_MAJOR_TRAITS || uiSkillTraitNumber == COVERT_NT) );
|
return( uiSkillTraitNumber > 0 && (uiSkillTraitNumber <= NUM_ORIGINAL_MAJOR_TRAITS || uiSkillTraitNumber == COVERT_NT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -723,6 +723,15 @@ public:
|
|||||||
TIMECOUNTER NextTileCounter;
|
TIMECOUNTER NextTileCounter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// forward declaration for modularized tactical ai
|
||||||
|
namespace AI
|
||||||
|
{
|
||||||
|
namespace tactical
|
||||||
|
{
|
||||||
|
class Plan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class STRUCT_Statistics//last edited at version 102
|
class STRUCT_Statistics//last edited at version 102
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -775,10 +784,6 @@ public:
|
|||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
SOLDIERTYPE();
|
SOLDIERTYPE();
|
||||||
// Copy Constructor
|
|
||||||
SOLDIERTYPE(const SOLDIERTYPE&);
|
|
||||||
// Assignment operator
|
|
||||||
SOLDIERTYPE& operator=(const SOLDIERTYPE&);
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~SOLDIERTYPE();
|
~SOLDIERTYPE();
|
||||||
|
|
||||||
@@ -1265,8 +1270,9 @@ public:
|
|||||||
INT32 sMTActionGridNo; // gridno on which we perfrom our multi-turn action
|
INT32 sMTActionGridNo; // gridno on which we perfrom our multi-turn action
|
||||||
UINT8 usMultiTurnAction; // specifies which multi-turn action we are currently performing, 0: none
|
UINT8 usMultiTurnAction; // specifies which multi-turn action we are currently performing, 0: none
|
||||||
|
|
||||||
|
INT16 bAIIndex; // PlanFactory from the modularized tactical AI that shall be used
|
||||||
// Flugente: Decrease this filler by 1 for each new UINT8 / BOOLEAN variable, so we can maintain savegame compatibility!!
|
// Flugente: Decrease this filler by 1 for each new UINT8 / BOOLEAN variable, so we can maintain savegame compatibility!!
|
||||||
UINT8 ubFiller[13];
|
UINT8 ubFiller[11];
|
||||||
|
|
||||||
#ifdef JA2UB
|
#ifdef JA2UB
|
||||||
//ja25
|
//ja25
|
||||||
@@ -1285,6 +1291,7 @@ public:
|
|||||||
// properly until it is all fixed and the files updated.
|
// properly until it is all fixed and the files updated.
|
||||||
|
|
||||||
Inventory inv;
|
Inventory inv;
|
||||||
|
AI::tactical::Plan* ai_masterplan_; // Interface object for ModularizedTacticalAI
|
||||||
|
|
||||||
//data from version 101 wrapped into structs
|
//data from version 101 wrapped into structs
|
||||||
STRUCT_AIData aiData;
|
STRUCT_AIData aiData;
|
||||||
|
|||||||
+150
-220
@@ -1,272 +1,202 @@
|
|||||||
#ifdef PRECOMPILEDHEADERS
|
#ifdef PRECOMPILEDHEADERS
|
||||||
#include "Tactical All.h"
|
#include "Tactical All.h"
|
||||||
#else
|
#else
|
||||||
#include "sgp.h"
|
#include <string.h>
|
||||||
#include "overhead types.h"
|
#include "sgp.h"
|
||||||
#include "Sound Control.h"
|
#include "Sound Control.h"
|
||||||
#include "overhead.h"
|
#include "Debug Control.h"
|
||||||
#include "Event Pump.h"
|
#include "expat.h"
|
||||||
#include "weapons.h"
|
#include "XML.h"
|
||||||
#include "Animation Control.h"
|
|
||||||
#include "sys globals.h"
|
|
||||||
#include "Handle UI.h"
|
|
||||||
#include "Isometric Utils.h"
|
|
||||||
#include "worldman.h"
|
|
||||||
#include "math.h"
|
|
||||||
#include "points.h"
|
|
||||||
#include "ai.h"
|
|
||||||
#include "los.h"
|
|
||||||
#include "renderworld.h"
|
|
||||||
#include "opplist.h"
|
|
||||||
#include "interface.h"
|
|
||||||
#include "message.h"
|
|
||||||
#include "campaign.h"
|
|
||||||
#include "items.h"
|
|
||||||
#include "text.h"
|
|
||||||
#include "Soldier Profile.h"
|
|
||||||
#include "tile animation.h"
|
|
||||||
#include "Dialogue Control.h"
|
|
||||||
#include "SkillCheck.h"
|
|
||||||
#include "explosion control.h"
|
|
||||||
#include "Quests.h"
|
|
||||||
#include "Physics.h"
|
|
||||||
#include "Random.h"
|
|
||||||
#include "Vehicles.h"
|
|
||||||
#include "bullets.h"
|
|
||||||
#include "morale.h"
|
|
||||||
#include "meanwhile.h"
|
|
||||||
#include "SkillCheck.h"
|
|
||||||
#include "gamesettings.h"
|
|
||||||
#include "SaveLoadMap.h"
|
|
||||||
#include "Debug Control.h"
|
|
||||||
#include "expat.h"
|
|
||||||
#include "XML.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char szSoundEffects[MAX_SAMPLES][255];
|
extern char szSoundEffects[MAX_SAMPLES][255];
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
PARSE_STAGE curElement;
|
PARSE_STAGE curElement;
|
||||||
|
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
||||||
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
|
UINT32 maxArraySize;
|
||||||
|
UINT32 curIndex;
|
||||||
UINT32 maxArraySize;
|
UINT32 currentDepth;
|
||||||
UINT32 curIndex;
|
UINT32 maxReadDepth;
|
||||||
UINT32 currentDepth;
|
|
||||||
UINT32 maxReadDepth;
|
|
||||||
}
|
}
|
||||||
typedef soundParseData;
|
typedef soundParseData;
|
||||||
|
|
||||||
static void XMLCALL
|
static void XMLCALL
|
||||||
soundStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
soundStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||||
{
|
{
|
||||||
soundParseData * pData = (soundParseData *)userData;
|
soundParseData * pData = (soundParseData *)userData;
|
||||||
|
|
||||||
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
|
||||||
{
|
{
|
||||||
if(strcmp(name, "SOUNDLIST") == 0 && pData->curElement == ELEMENT_NONE)
|
if(strcmp(name, "SOUNDLIST") == 0 && pData->curElement == ELEMENT_NONE)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT_LIST;
|
pData->curElement = ELEMENT_LIST;
|
||||||
|
|
||||||
pData->maxReadDepth++; //we are not skipping this element
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "SOUND") == 0 && pData->curElement == ELEMENT_LIST)
|
else if(strcmp(name, "SOUND") == 0 && pData->curElement == ELEMENT_LIST)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT;
|
pData->curElement = ELEMENT;
|
||||||
|
|
||||||
pData->maxReadDepth++; //we are not skipping this element
|
pData->maxReadDepth++; //we are not skipping this element
|
||||||
pData->curIndex++;
|
pData->curIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
pData->szCharData[0] = '\0';
|
pData->szCharData[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
pData->currentDepth++;
|
pData->currentDepth++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void XMLCALL
|
static void XMLCALL
|
||||||
soundCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
soundCharacterDataHandle(void *userData, const XML_Char *str, int len)
|
||||||
{
|
{
|
||||||
soundParseData * pData = (soundParseData *)userData;
|
soundParseData * pData = (soundParseData *)userData;
|
||||||
|
|
||||||
if( (pData->currentDepth <= pData->maxReadDepth) &&
|
if((pData->currentDepth <= pData->maxReadDepth) && (strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH))
|
||||||
(strlen(pData->szCharData) < MAX_CHAR_DATA_LENGTH)
|
{
|
||||||
){
|
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
||||||
strncat(pData->szCharData,str,__min((unsigned int)len,MAX_CHAR_DATA_LENGTH-strlen(pData->szCharData)));
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void XMLCALL
|
static void XMLCALL
|
||||||
soundEndElementHandle(void *userData, const XML_Char *name)
|
soundEndElementHandle(void *userData, const XML_Char *name)
|
||||||
{
|
{
|
||||||
soundParseData * pData = (soundParseData *)userData;
|
soundParseData * pData = (soundParseData *)userData;
|
||||||
|
|
||||||
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
|
||||||
{
|
{
|
||||||
if(strcmp(name, "SOUNDLIST") == 0)
|
if(strcmp(name, "SOUNDLIST") == 0)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT_NONE;
|
pData->curElement = ELEMENT_NONE;
|
||||||
}
|
}
|
||||||
else if(strcmp(name, "SOUND") == 0)
|
else if(strcmp(name, "SOUND") == 0)
|
||||||
{
|
{
|
||||||
pData->curElement = ELEMENT_LIST;
|
pData->curElement = ELEMENT_LIST;
|
||||||
|
|
||||||
if(pData->curIndex < pData->maxArraySize)
|
if(pData->curIndex < pData->maxArraySize)
|
||||||
{
|
{
|
||||||
char temp;
|
char temp;
|
||||||
for(int i=0;i<min((int)strlen(pData->szCharData),255);i++)
|
for(int i=0;i<min((int)strlen(pData->szCharData),255);i++)
|
||||||
{
|
{
|
||||||
temp = pData->szCharData[i];
|
temp = pData->szCharData[i];
|
||||||
szSoundEffects[pData->curIndex][i] = temp;
|
szSoundEffects[pData->curIndex][i] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pData->maxReadDepth--;
|
||||||
pData->maxReadDepth--;
|
}
|
||||||
}
|
pData->currentDepth--;
|
||||||
|
|
||||||
pData->currentDepth--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN ReadInSoundArray(STR fileName)
|
BOOLEAN ReadInSoundArray(STR fileName)
|
||||||
{
|
{
|
||||||
HWFILE hFile;
|
HWFILE hFile;
|
||||||
UINT32 uiBytesRead;
|
UINT32 uiBytesRead;
|
||||||
UINT32 uiFSize;
|
UINT32 uiFSize;
|
||||||
CHAR8 * lpcBuffer;
|
CHAR8 * lpcBuffer;
|
||||||
XML_Parser parser = XML_ParserCreate(NULL);
|
XML_Parser parser = XML_ParserCreate(NULL);
|
||||||
|
soundParseData pData;
|
||||||
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",SOUNDSFILENAME ) );
|
||||||
|
|
||||||
soundParseData pData;
|
// Open sounds file
|
||||||
|
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
||||||
|
if ( !hFile )
|
||||||
|
return( FALSE );
|
||||||
|
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Loading %s",SOUNDSFILENAME ) );
|
uiFSize = FileGetSize(hFile);
|
||||||
|
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
||||||
|
//Read in block
|
||||||
|
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
||||||
|
{
|
||||||
|
MemFree(lpcBuffer);
|
||||||
|
return( FALSE );
|
||||||
|
}
|
||||||
|
lpcBuffer[uiFSize] = 0; //add a null terminator
|
||||||
|
FileClose( hFile );
|
||||||
|
|
||||||
// Open sounds file
|
XML_SetElementHandler(parser, soundStartElementHandle, soundEndElementHandle);
|
||||||
hFile = FileOpen( fileName, FILE_ACCESS_READ, FALSE );
|
XML_SetCharacterDataHandler(parser, soundCharacterDataHandle);
|
||||||
if ( !hFile )
|
memset(&pData,0,sizeof(pData));
|
||||||
return( FALSE );
|
pData.maxArraySize = MAX_SAMPLES;
|
||||||
|
pData.curIndex = -1;
|
||||||
uiFSize = FileGetSize(hFile);
|
XML_SetUserData(parser, &pData);
|
||||||
lpcBuffer = (CHAR8 *) MemAlloc(uiFSize+1);
|
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
||||||
|
{
|
||||||
//Read in block
|
CHAR8 errorBuf[511];
|
||||||
if ( !FileRead( hFile, lpcBuffer, uiFSize, &uiBytesRead ) )
|
sprintf(errorBuf, "XML Parser Error in %s.xml: %s at line %d", SOUNDSFILENAME, XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
||||||
{
|
LiveMessage(errorBuf);
|
||||||
MemFree(lpcBuffer);
|
MemFree(lpcBuffer);
|
||||||
return( FALSE );
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
MemFree(lpcBuffer);
|
||||||
lpcBuffer[uiFSize] = 0; //add a null terminator
|
XML_ParserFree(parser);
|
||||||
|
return( TRUE );
|
||||||
FileClose( hFile );
|
|
||||||
|
|
||||||
|
|
||||||
XML_SetElementHandler(parser, soundStartElementHandle, soundEndElementHandle);
|
|
||||||
XML_SetCharacterDataHandler(parser, soundCharacterDataHandle);
|
|
||||||
|
|
||||||
|
|
||||||
memset(&pData,0,sizeof(pData));
|
|
||||||
pData.maxArraySize = MAX_SAMPLES;
|
|
||||||
pData.curIndex = -1;
|
|
||||||
|
|
||||||
XML_SetUserData(parser, &pData);
|
|
||||||
|
|
||||||
|
|
||||||
if(!XML_Parse(parser, lpcBuffer, uiFSize, TRUE))
|
|
||||||
{
|
|
||||||
CHAR8 errorBuf[511];
|
|
||||||
|
|
||||||
sprintf(errorBuf, "XML Parser Error in %s.xml: %s at line %d", SOUNDSFILENAME, XML_ErrorString(XML_GetErrorCode(parser)), XML_GetCurrentLineNumber(parser));
|
|
||||||
LiveMessage(errorBuf);
|
|
||||||
|
|
||||||
MemFree(lpcBuffer);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
MemFree(lpcBuffer);
|
|
||||||
|
|
||||||
|
|
||||||
XML_ParserFree(parser);
|
|
||||||
|
|
||||||
return( TRUE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN WriteSoundArray()
|
BOOLEAN WriteSoundArray()
|
||||||
{
|
{
|
||||||
HWFILE hFile;
|
HWFILE hFile;
|
||||||
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("WriteSoundArray"));
|
DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("WriteSoundArray"));
|
||||||
//Debug code; make sure that what we got from the file is the same as what's there
|
//Debug code; make sure that what we got from the file is the same as what's there
|
||||||
// Open a new file
|
// Open a new file
|
||||||
hFile = FileOpen( "TABLEDATA\\Sounds out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
hFile = FileOpen( "TABLEDATA\\Sounds out.xml", FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
|
||||||
if ( !hFile )
|
if ( !hFile )
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
|
UINT32 cnt;
|
||||||
|
|
||||||
{
|
FilePrintf(hFile,"<SOUNDLIST>\r\n");
|
||||||
UINT32 cnt;
|
for(cnt = 0;cnt < NUM_SAMPLES;cnt++)
|
||||||
|
{
|
||||||
|
FilePrintf(hFile,"\t<SOUND>");
|
||||||
|
STR8 szRemainder = szSoundEffects[cnt]; //the remaining string to be output (for making valid XML)
|
||||||
|
while(szRemainder[0] != '\0')
|
||||||
|
{
|
||||||
|
UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0");
|
||||||
|
char invChar = szRemainder[uiCharLoc];
|
||||||
|
|
||||||
FilePrintf(hFile,"<SOUNDLIST>\r\n");
|
if(uiCharLoc)
|
||||||
for(cnt = 0;cnt < NUM_SAMPLES;cnt++)
|
{
|
||||||
{
|
szRemainder[uiCharLoc] = '\0';
|
||||||
FilePrintf(hFile,"\t<SOUND>");
|
FilePrintf(hFile,"%s",szRemainder);
|
||||||
|
szRemainder[uiCharLoc] = invChar;
|
||||||
|
}
|
||||||
|
szRemainder += uiCharLoc;
|
||||||
|
switch(invChar)
|
||||||
|
{
|
||||||
|
case '&':
|
||||||
|
FilePrintf(hFile,"&");
|
||||||
|
szRemainder++;
|
||||||
|
break;
|
||||||
|
|
||||||
STR8 szRemainder = szSoundEffects[cnt]; //the remaining string to be output (for making valid XML)
|
case '<':
|
||||||
|
FilePrintf(hFile,"<");
|
||||||
|
szRemainder++;
|
||||||
|
break;
|
||||||
|
|
||||||
while(szRemainder[0] != '\0')
|
case '>':
|
||||||
{
|
FilePrintf(hFile,">");
|
||||||
UINT32 uiCharLoc = strcspn(szRemainder,"&<>\'\"\0");
|
szRemainder++;
|
||||||
char invChar = szRemainder[uiCharLoc];
|
break;
|
||||||
|
|
||||||
if(uiCharLoc)
|
case '\'':
|
||||||
{
|
FilePrintf(hFile,"'");
|
||||||
szRemainder[uiCharLoc] = '\0';
|
szRemainder++;
|
||||||
FilePrintf(hFile,"%s",szRemainder);
|
break;
|
||||||
szRemainder[uiCharLoc] = invChar;
|
|
||||||
}
|
|
||||||
|
|
||||||
szRemainder += uiCharLoc;
|
case '\"':
|
||||||
|
FilePrintf(hFile,""");
|
||||||
switch(invChar)
|
szRemainder++;
|
||||||
{
|
break;
|
||||||
case '&':
|
}
|
||||||
FilePrintf(hFile,"&");
|
}
|
||||||
szRemainder++;
|
FilePrintf(hFile,"</SOUND>\r\n");
|
||||||
break;
|
}
|
||||||
|
FilePrintf(hFile,"</SOUNDLIST>\r\n");
|
||||||
case '<':
|
FileClose( hFile );
|
||||||
FilePrintf(hFile,"<");
|
return( TRUE );
|
||||||
szRemainder++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '>':
|
|
||||||
FilePrintf(hFile,">");
|
|
||||||
szRemainder++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '\'':
|
|
||||||
FilePrintf(hFile,"'");
|
|
||||||
szRemainder++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '\"':
|
|
||||||
FilePrintf(hFile,""");
|
|
||||||
szRemainder++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FilePrintf(hFile,"\t\t<SOUND>%s</SOUND>\r\n", szSoundEffects[cnt]);
|
|
||||||
|
|
||||||
FilePrintf(hFile,"</SOUND>\r\n");
|
|
||||||
}
|
|
||||||
FilePrintf(hFile,"</SOUNDLIST>\r\n");
|
|
||||||
}
|
|
||||||
FileClose( hFile );
|
|
||||||
|
|
||||||
return( TRUE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+572
-1136
File diff suppressed because it is too large
Load Diff
+19
-7
@@ -1,22 +1,22 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
# Visual C++ Express 2008
|
# Visual C++ Express 2008
|
||||||
# Visual Studio 2008
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ja2", "ja2_VS2008.vcproj", "{B112F6BA-AF32-489C-B405-916C0F182D10}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ja2", "ja2_VS2008.vcproj", "{B112F6BA-AF32-489C-B405-916C0F182D10}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{0BE7070B-C8C5-409A-82DD-0701D54A1C6C} = {0BE7070B-C8C5-409A-82DD-0701D54A1C6C}
|
{0BE7070B-C8C5-409A-82DD-0701D54A1C6C} = {0BE7070B-C8C5-409A-82DD-0701D54A1C6C}
|
||||||
{99341DB1-FD6E-4E87-919B-25C813F08D18} = {99341DB1-FD6E-4E87-919B-25C813F08D18}
|
{DB40B90D-13F9-4FEC-8F1D-0506CC496586} = {DB40B90D-13F9-4FEC-8F1D-0506CC496586}
|
||||||
{4D6F7570-9A1E-4DB0-8FD7-B9D14DD4E821} = {4D6F7570-9A1E-4DB0-8FD7-B9D14DD4E821}
|
{4B544F1A-6188-4255-8877-69FC312D0D2C} = {4B544F1A-6188-4255-8877-69FC312D0D2C}
|
||||||
{60D5BF89-B609-4A30-A38D-9FE417FB12B6} = {60D5BF89-B609-4A30-A38D-9FE417FB12B6}
|
|
||||||
{96FA90B1-2ABD-42E7-9CAB-14804DFD3240} = {96FA90B1-2ABD-42E7-9CAB-14804DFD3240}
|
|
||||||
{40475E2B-AD37-4A99-85A4-1E507010344C} = {40475E2B-AD37-4A99-85A4-1E507010344C}
|
{40475E2B-AD37-4A99-85A4-1E507010344C} = {40475E2B-AD37-4A99-85A4-1E507010344C}
|
||||||
{8E3BD72D-8791-497B-A38E-D71B255F0A66} = {8E3BD72D-8791-497B-A38E-D71B255F0A66}
|
{8E3BD72D-8791-497B-A38E-D71B255F0A66} = {8E3BD72D-8791-497B-A38E-D71B255F0A66}
|
||||||
{DF8C5F50-6FB1-4AFE-8EF4-6B7F360D9C28} = {DF8C5F50-6FB1-4AFE-8EF4-6B7F360D9C28}
|
{DF8C5F50-6FB1-4AFE-8EF4-6B7F360D9C28} = {DF8C5F50-6FB1-4AFE-8EF4-6B7F360D9C28}
|
||||||
{629F0A55-6A19-4107-8B5C-5B08B2B3949C} = {629F0A55-6A19-4107-8B5C-5B08B2B3949C}
|
{629F0A55-6A19-4107-8B5C-5B08B2B3949C} = {629F0A55-6A19-4107-8B5C-5B08B2B3949C}
|
||||||
{DB40B90D-13F9-4FEC-8F1D-0506CC496586} = {DB40B90D-13F9-4FEC-8F1D-0506CC496586}
|
{4D6F7570-9A1E-4DB0-8FD7-B9D14DD4E821} = {4D6F7570-9A1E-4DB0-8FD7-B9D14DD4E821}
|
||||||
{4B544F1A-6188-4255-8877-69FC312D0D2C} = {4B544F1A-6188-4255-8877-69FC312D0D2C}
|
|
||||||
{9AD14886-DB5C-4EFF-AE17-35F9BD684692} = {9AD14886-DB5C-4EFF-AE17-35F9BD684692}
|
{9AD14886-DB5C-4EFF-AE17-35F9BD684692} = {9AD14886-DB5C-4EFF-AE17-35F9BD684692}
|
||||||
|
{60D5BF89-B609-4A30-A38D-9FE417FB12B6} = {60D5BF89-B609-4A30-A38D-9FE417FB12B6}
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E} = {FF0A809E-A370-4640-A301-17B76D7A5B4E}
|
||||||
{A67922A0-0A3F-497F-A724-19B513EFC078} = {A67922A0-0A3F-497F-A724-19B513EFC078}
|
{A67922A0-0A3F-497F-A724-19B513EFC078} = {A67922A0-0A3F-497F-A724-19B513EFC078}
|
||||||
|
{99341DB1-FD6E-4E87-919B-25C813F08D18} = {99341DB1-FD6E-4E87-919B-25C813F08D18}
|
||||||
|
{96FA90B1-2ABD-42E7-9CAB-14804DFD3240} = {96FA90B1-2ABD-42E7-9CAB-14804DFD3240}
|
||||||
{C63466D6-49B5-4C54-AA0D-864F6171FD9B} = {C63466D6-49B5-4C54-AA0D-864F6171FD9B}
|
{C63466D6-49B5-4C54-AA0D-864F6171FD9B} = {C63466D6-49B5-4C54-AA0D-864F6171FD9B}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
@@ -50,6 +50,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ja2export", "ext\export\ja2
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7z", "ext\VFS\build\7z_VS2008.vcproj", "{9AD14886-DB5C-4EFF-AE17-35F9BD684692}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "7z", "ext\VFS\build\7z_VS2008.vcproj", "{9AD14886-DB5C-4EFF-AE17-35F9BD684692}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ModularizedTacticalAI", "ModularizedTacticalAI\ModularizedTacticalAI.vcproj", "{FF0A809E-A370-4640-A301-17B76D7A5B4E}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
@@ -214,6 +216,16 @@ Global
|
|||||||
{9AD14886-DB5C-4EFF-AE17-35F9BD684692}.Release_WithDebugInfo|Win32.Build.0 = Release_WithDebugInfo|Win32
|
{9AD14886-DB5C-4EFF-AE17-35F9BD684692}.Release_WithDebugInfo|Win32.Build.0 = Release_WithDebugInfo|Win32
|
||||||
{9AD14886-DB5C-4EFF-AE17-35F9BD684692}.Release|Win32.ActiveCfg = Release|Win32
|
{9AD14886-DB5C-4EFF-AE17-35F9BD684692}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{9AD14886-DB5C-4EFF-AE17-35F9BD684692}.Release|Win32.Build.0 = Release|Win32
|
{9AD14886-DB5C-4EFF-AE17-35F9BD684692}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.MapEditor|Win32.ActiveCfg = Release|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.MapEditor|Win32.Build.0 = Release|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.MapEditorD|Win32.ActiveCfg = Release|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.MapEditorD|Win32.Build.0 = Release|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.Release_WithDebugInfo|Win32.ActiveCfg = Release|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.Release_WithDebugInfo|Win32.Build.0 = Release|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{FF0A809E-A370-4640-A301-17B76D7A5B4E}.Release|Win32.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Reference in New Issue
Block a user