Merge store enums as enums changes from cyp/cpp to master.
parent
0e6cb3ef93
commit
17b834b2cf
|
@ -44,6 +44,7 @@ EXTRA_DIST = \
|
|||
bin_PROGRAMS = warzone2100
|
||||
noinst_HEADERS = \
|
||||
action.h \
|
||||
actiondef.h \
|
||||
advvis.h \
|
||||
aiexperience.h \
|
||||
ai.h \
|
||||
|
|
53
src/action.h
53
src/action.h
|
@ -24,6 +24,7 @@
|
|||
#ifndef __INCLUDED_SRC_ACTION_H__
|
||||
#define __INCLUDED_SRC_ACTION_H__
|
||||
|
||||
#include "actiondef.h"
|
||||
#include "droiddef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -38,58 +39,6 @@ extern "C"
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* What a droid is currently doing. Not necessarily the same as its order as the micro-AI may get a droid to do
|
||||
* something else whilst carrying out an order.
|
||||
*/
|
||||
typedef enum _droid_action
|
||||
{
|
||||
DACTION_NONE, ///< 0 not doing anything
|
||||
DACTION_MOVE, ///< 1 moving to a location
|
||||
DACTION_BUILD, ///< 2 building a structure
|
||||
DACTION_BUILD_FOUNDATION, ///< 3 building a foundation for a structure
|
||||
DACTION_DEMOLISH, ///< 4 demolishing a structure
|
||||
DACTION_REPAIR, ///< 5 repairing a structure
|
||||
DACTION_ATTACK, ///< 6 attacking something
|
||||
DACTION_OBSERVE, ///< 7 observing something
|
||||
DACTION_FIRESUPPORT, ///< 8 attacking something visible by a sensor droid
|
||||
DACTION_SULK, ///< 9 refuse to do anything aggresive for a fixed time
|
||||
DACTION_DESTRUCT, ///< 10 self destruct
|
||||
DACTION_TRANSPORTOUT, ///< 11 move transporter offworld
|
||||
DACTION_TRANSPORTWAITTOFLYIN, ///< 12 wait for timer to move reinforcements in
|
||||
DACTION_TRANSPORTIN, ///< 13 move transporter onworld
|
||||
DACTION_DROIDREPAIR, ///< 14 repairing a droid
|
||||
DACTION_RESTORE, ///< 15 restore resistance points of a structure
|
||||
DACTION_CLEARWRECK, ///< clearing building wreckage
|
||||
|
||||
// The states below are used by the action system
|
||||
// but should not be given as an action
|
||||
DACTION_MOVEFIRE, ///< 17
|
||||
DACTION_MOVETOBUILD, ///< 18 moving to a new building location
|
||||
DACTION_MOVETODEMOLISH, ///< 19 moving to a new demolition location
|
||||
DACTION_MOVETOREPAIR, ///< 20 moving to a new repair location
|
||||
DACTION_BUILDWANDER, ///< 21 moving around while building
|
||||
DACTION_FOUNDATION_WANDER, ///< 22 moving around while building the foundation
|
||||
DACTION_MOVETOATTACK, ///< 23 moving to a target to attack
|
||||
DACTION_ROTATETOATTACK, ///< 24 rotating to a target to attack
|
||||
DACTION_MOVETOOBSERVE, ///< 25 moving to be able to see a target
|
||||
DACTION_WAITFORREPAIR, ///< 26 waiting to be repaired by a facility
|
||||
DACTION_MOVETOREPAIRPOINT, ///< 27 move to repair facility repair point
|
||||
DACTION_WAITDURINGREPAIR, ///< 28 waiting to be repaired by a facility
|
||||
DACTION_MOVETODROIDREPAIR, ///< 29 moving to a new location next to droid to be repaired
|
||||
DACTION_MOVETORESTORE, ///< 30 moving to a low resistance structure
|
||||
DACTION_MOVETOCLEAR, ///< 31 moving to a building wreck location
|
||||
DACTION_MOVETOREARM, ///< 32 moving to a rearming pad - VTOLS
|
||||
DACTION_WAITFORREARM, ///< 33 waiting for rearm - VTOLS
|
||||
DACTION_MOVETOREARMPOINT, ///< 34 move to rearm point - VTOLS - this actually moves them onto the pad
|
||||
DACTION_WAITDURINGREARM, ///< 35 waiting during rearm process- VTOLS
|
||||
DACTION_VTOLATTACK, ///< 36 a VTOL droid doing attack runs
|
||||
DACTION_CLEARREARMPAD, ///< 37 a VTOL droid being told to get off a rearm pad
|
||||
DACTION_RETURNTOPOS, ///< 38 used by scout/patrol order when returning to route
|
||||
DACTION_FIRESUPPORT_RETREAT, ///< 39 used by firesupport order when sensor retreats
|
||||
DACTION_CIRCLE = 41, ///< 41 circling while engaging
|
||||
} DROID_ACTION;
|
||||
|
||||
const char* getDroidActionName(DROID_ACTION action);
|
||||
|
||||
/** After failing a route ... this is the amount of time that the droid goes all defensive until it can start going aggressive. */
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
This file is part of Warzone 2100.
|
||||
Copyright (C) 1999-2004 Eidos Interactive
|
||||
Copyright (C) 2005-2010 Warzone 2100 Project
|
||||
|
||||
Warzone 2100 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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Warzone 2100 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 Warzone 2100; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/** @file
|
||||
* Data types for droid actions
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDED_SRC_ACTIONDEF_H__
|
||||
#define __INCLUDED_SRC_ACTIONDEF_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif //__cplusplus
|
||||
|
||||
/**
|
||||
* What a droid is currently doing. Not necessarily the same as its order as the micro-AI may get a droid to do
|
||||
* something else whilst carrying out an order.
|
||||
*/
|
||||
typedef enum _droid_action
|
||||
{
|
||||
DACTION_NONE, ///< 0 not doing anything
|
||||
DACTION_MOVE, ///< 1 moving to a location
|
||||
DACTION_BUILD, ///< 2 building a structure
|
||||
DACTION_BUILD_FOUNDATION, ///< 3 building a foundation for a structure
|
||||
DACTION_DEMOLISH, ///< 4 demolishing a structure
|
||||
DACTION_REPAIR, ///< 5 repairing a structure
|
||||
DACTION_ATTACK, ///< 6 attacking something
|
||||
DACTION_OBSERVE, ///< 7 observing something
|
||||
DACTION_FIRESUPPORT, ///< 8 attacking something visible by a sensor droid
|
||||
DACTION_SULK, ///< 9 refuse to do anything aggresive for a fixed time
|
||||
DACTION_DESTRUCT, ///< 10 self destruct
|
||||
DACTION_TRANSPORTOUT, ///< 11 move transporter offworld
|
||||
DACTION_TRANSPORTWAITTOFLYIN, ///< 12 wait for timer to move reinforcements in
|
||||
DACTION_TRANSPORTIN, ///< 13 move transporter onworld
|
||||
DACTION_DROIDREPAIR, ///< 14 repairing a droid
|
||||
DACTION_RESTORE, ///< 15 restore resistance points of a structure
|
||||
DACTION_CLEARWRECK, ///< clearing building wreckage
|
||||
|
||||
// The states below are used by the action system
|
||||
// but should not be given as an action
|
||||
DACTION_MOVEFIRE, ///< 17
|
||||
DACTION_MOVETOBUILD, ///< 18 moving to a new building location
|
||||
DACTION_MOVETODEMOLISH, ///< 19 moving to a new demolition location
|
||||
DACTION_MOVETOREPAIR, ///< 20 moving to a new repair location
|
||||
DACTION_BUILDWANDER, ///< 21 moving around while building
|
||||
DACTION_FOUNDATION_WANDER, ///< 22 moving around while building the foundation
|
||||
DACTION_MOVETOATTACK, ///< 23 moving to a target to attack
|
||||
DACTION_ROTATETOATTACK, ///< 24 rotating to a target to attack
|
||||
DACTION_MOVETOOBSERVE, ///< 25 moving to be able to see a target
|
||||
DACTION_WAITFORREPAIR, ///< 26 waiting to be repaired by a facility
|
||||
DACTION_MOVETOREPAIRPOINT, ///< 27 move to repair facility repair point
|
||||
DACTION_WAITDURINGREPAIR, ///< 28 waiting to be repaired by a facility
|
||||
DACTION_MOVETODROIDREPAIR, ///< 29 moving to a new location next to droid to be repaired
|
||||
DACTION_MOVETORESTORE, ///< 30 moving to a low resistance structure
|
||||
DACTION_MOVETOCLEAR, ///< 31 moving to a building wreck location
|
||||
DACTION_MOVETOREARM, ///< 32 moving to a rearming pad - VTOLS
|
||||
DACTION_WAITFORREARM, ///< 33 waiting for rearm - VTOLS
|
||||
DACTION_MOVETOREARMPOINT, ///< 34 move to rearm point - VTOLS - this actually moves them onto the pad
|
||||
DACTION_WAITDURINGREARM, ///< 35 waiting during rearm process- VTOLS
|
||||
DACTION_VTOLATTACK, ///< 36 a VTOL droid doing attack runs
|
||||
DACTION_CLEARREARMPAD, ///< 37 a VTOL droid being told to get off a rearm pad
|
||||
DACTION_RETURNTOPOS, ///< 38 used by scout/patrol order when returning to route
|
||||
DACTION_FIRESUPPORT_RETREAT, ///< 39 used by firesupport order when sensor retreats
|
||||
DACTION_CIRCLE = 41, ///< 41 circling while engaging
|
||||
} DROID_ACTION;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif // __INCLUDED_SRC_ACTIONDEF_H__
|
|
@ -27,8 +27,10 @@
|
|||
#include "lib/gamelib/animobj.h"
|
||||
|
||||
#include "stringdef.h"
|
||||
#include "actiondef.h"
|
||||
#include "basedef.h"
|
||||
#include "movedef.h"
|
||||
#include "orderdef.h"
|
||||
#include "statsdef.h"
|
||||
#include "weapondef.h"
|
||||
|
||||
|
@ -87,7 +89,7 @@ typedef struct _component
|
|||
|
||||
typedef struct _order_list
|
||||
{
|
||||
SDWORD order;
|
||||
DROID_ORDER order;
|
||||
void* psOrderTarget; ///< this needs to cope with objects and stats
|
||||
UWORD x, y, x2, y2; ///< line build requires two sets of coords
|
||||
uint16_t direction; ///< Needed to align structures with viewport.
|
||||
|
@ -172,7 +174,7 @@ typedef struct DROID
|
|||
unsigned listPendingEnd; ///< Index of last order which might not yet have been synchronised, plus one.
|
||||
|
||||
/* Order data */
|
||||
SDWORD order;
|
||||
DROID_ORDER order;
|
||||
UWORD orderX, orderY;
|
||||
UWORD orderX2, orderY2;
|
||||
uint16_t orderDirection;
|
||||
|
@ -193,7 +195,7 @@ typedef struct DROID
|
|||
UDWORD secondaryOrder;
|
||||
|
||||
/* Action data */
|
||||
SDWORD action;
|
||||
DROID_ACTION action;
|
||||
UDWORD actionX, actionY;
|
||||
BASE_OBJECT* psActionTarget[DROID_MAXWEAPS]; ///< Action target object
|
||||
UDWORD actionStarted; ///< Game time action started
|
||||
|
|
51
src/order.h
51
src/order.h
|
@ -24,6 +24,7 @@
|
|||
#ifndef __INCLUDED_SRC_ORDER_H__
|
||||
#define __INCLUDED_SRC_ORDER_H__
|
||||
|
||||
#include "droiddef.h"
|
||||
#include "orderdef.h"
|
||||
#include "structuredef.h"
|
||||
|
||||
|
@ -35,53 +36,6 @@ extern "C"
|
|||
//turn off the build queue availability until desired release date!
|
||||
//#define DISABLE_BUILD_QUEUE
|
||||
|
||||
// The droid orders
|
||||
typedef enum _droid_order
|
||||
{
|
||||
DORDER_NONE, // no order set
|
||||
|
||||
DORDER_STOP, // stop the current order
|
||||
DORDER_MOVE, // 2 - move to a location
|
||||
DORDER_ATTACK, // attack an enemy
|
||||
DORDER_BUILD, // 4 - build a structure
|
||||
DORDER_HELPBUILD, // help to build a structure
|
||||
DORDER_LINEBUILD, // 6 - build a number of structures in a row (walls + bridges)
|
||||
DORDER_DEMOLISH, // demolish a structure
|
||||
DORDER_REPAIR, // 8 - repair a structure
|
||||
DORDER_OBSERVE, // keep a target in sensor view
|
||||
DORDER_FIRESUPPORT, // 10 - attack whatever the linked sensor droid attacks
|
||||
DORDER_RETREAT, // return to the players retreat position
|
||||
DORDER_DESTRUCT, // 12 - self destruct
|
||||
DORDER_RTB, // return to base
|
||||
DORDER_RTR, // 14 - return to repair at any repair facility
|
||||
DORDER_RUN, // run away after moral failure
|
||||
DORDER_EMBARK, // 16 - board a transporter
|
||||
DORDER_DISEMBARK, // get off a transporter
|
||||
DORDER_ATTACKTARGET, // 18 - a suggestion to attack something
|
||||
// i.e. the target was chosen because the droid could see it
|
||||
DORDER_COMMAND, // a command droid issuing orders to it's group
|
||||
DORDER_BUILDMODULE, // 20 - build a module (power, research or factory)
|
||||
DORDER_RECYCLE, // return to factory to be recycled
|
||||
DORDER_TRANSPORTOUT, // 22 - offworld transporter order
|
||||
DORDER_TRANSPORTIN, // onworld transporter order
|
||||
DORDER_TRANSPORTRETURN, // 24 - transporter return after unloading
|
||||
DORDER_GUARD, // guard a structure
|
||||
DORDER_DROIDREPAIR, // 26 - repair a droid
|
||||
DORDER_RESTORE, // restore resistance points for a structure
|
||||
DORDER_SCOUT, // 28 - same as move, but stop if an enemy is seen
|
||||
DORDER_RUNBURN, // run away on fire
|
||||
DORDER_CLEARWRECK, // 30 - constructor droid to clear up building wreckage
|
||||
DORDER_PATROL, // move between two way points
|
||||
DORDER_REARM, // 32 - order a vtol to rearming pad
|
||||
DORDER_MOVE_ATTACKWALL, // move to a location taking out a blocking wall on the way
|
||||
DORDER_SCOUT_ATTACKWALL, // 34 - scout to a location taking out a blocking wall on the way
|
||||
DORDER_RECOVER, // pick up an artifact
|
||||
DORDER_LEAVEMAP, // 36 - vtol flying off the map
|
||||
DORDER_RTR_SPECIFIED, // return to repair at a specified repair center
|
||||
DORDER_CIRCLE = 40, // circles target location and engage
|
||||
DORDER_TEMP_HOLD, // hold position until given next order
|
||||
} DROID_ORDER;
|
||||
|
||||
// secondary orders for droids
|
||||
typedef enum _secondary_order
|
||||
{
|
||||
|
@ -146,6 +100,9 @@ typedef enum _secondary_state
|
|||
#define DSS_FIREDES_MASK 0x800000
|
||||
#define DSS_CIRCLE_MASK 0x400100
|
||||
|
||||
extern RUN_DATA asRunData[MAX_PLAYERS]; // retreat positions for the players
|
||||
extern void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder);
|
||||
|
||||
//call this *AFTER* every mission so it gets reset
|
||||
extern void initRunData(void);
|
||||
|
||||
|
|
|
@ -27,13 +27,59 @@
|
|||
#include "lib/framework/vector.h"
|
||||
|
||||
#include "basedef.h"
|
||||
#include "droiddef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif //__cplusplus
|
||||
|
||||
// The droid orders
|
||||
typedef enum _droid_order
|
||||
{
|
||||
DORDER_NONE, // no order set
|
||||
|
||||
DORDER_STOP, // stop the current order
|
||||
DORDER_MOVE, // 2 - move to a location
|
||||
DORDER_ATTACK, // attack an enemy
|
||||
DORDER_BUILD, // 4 - build a structure
|
||||
DORDER_HELPBUILD, // help to build a structure
|
||||
DORDER_LINEBUILD, // 6 - build a number of structures in a row (walls + bridges)
|
||||
DORDER_DEMOLISH, // demolish a structure
|
||||
DORDER_REPAIR, // 8 - repair a structure
|
||||
DORDER_OBSERVE, // keep a target in sensor view
|
||||
DORDER_FIRESUPPORT, // 10 - attack whatever the linked sensor droid attacks
|
||||
DORDER_RETREAT, // return to the players retreat position
|
||||
DORDER_DESTRUCT, // 12 - self destruct
|
||||
DORDER_RTB, // return to base
|
||||
DORDER_RTR, // 14 - return to repair at any repair facility
|
||||
DORDER_RUN, // run away after moral failure
|
||||
DORDER_EMBARK, // 16 - board a transporter
|
||||
DORDER_DISEMBARK, // get off a transporter
|
||||
DORDER_ATTACKTARGET, // 18 - a suggestion to attack something
|
||||
// i.e. the target was chosen because the droid could see it
|
||||
DORDER_COMMAND, // a command droid issuing orders to it's group
|
||||
DORDER_BUILDMODULE, // 20 - build a module (power, research or factory)
|
||||
DORDER_RECYCLE, // return to factory to be recycled
|
||||
DORDER_TRANSPORTOUT, // 22 - offworld transporter order
|
||||
DORDER_TRANSPORTIN, // onworld transporter order
|
||||
DORDER_TRANSPORTRETURN, // 24 - transporter return after unloading
|
||||
DORDER_GUARD, // guard a structure
|
||||
DORDER_DROIDREPAIR, // 26 - repair a droid
|
||||
DORDER_RESTORE, // restore resistance points for a structure
|
||||
DORDER_SCOUT, // 28 - same as move, but stop if an enemy is seen
|
||||
DORDER_RUNBURN, // run away on fire
|
||||
DORDER_CLEARWRECK, // 30 - constructor droid to clear up building wreckage
|
||||
DORDER_PATROL, // move between two way points
|
||||
DORDER_REARM, // 32 - order a vtol to rearming pad
|
||||
DORDER_MOVE_ATTACKWALL, // move to a location taking out a blocking wall on the way
|
||||
DORDER_SCOUT_ATTACKWALL, // 34 - scout to a location taking out a blocking wall on the way
|
||||
DORDER_RECOVER, // pick up an artifact
|
||||
DORDER_LEAVEMAP, // 36 - vtol flying off the map
|
||||
DORDER_RTR_SPECIFIED, // return to repair at a specified repair center
|
||||
DORDER_CIRCLE = 40, // circles target location and engage
|
||||
DORDER_TEMP_HOLD, // hold position until given next order
|
||||
} DROID_ORDER;
|
||||
|
||||
// data for barbarians retreating
|
||||
typedef struct _run_data
|
||||
{
|
||||
|
@ -53,10 +99,6 @@ typedef struct _droid_order_data
|
|||
BASE_STATS *psStats;
|
||||
} DROID_ORDER_DATA;
|
||||
|
||||
|
||||
extern RUN_DATA asRunData[MAX_PLAYERS]; // retreat positions for the players
|
||||
extern void orderDroidBase(DROID *psDroid, DROID_ORDER_DATA *psOrder);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
|
|
@ -261,23 +261,14 @@ typedef struct _structure
|
|||
/* The common structure elements for all objects */
|
||||
BASE_ELEMENTS(struct _structure);
|
||||
|
||||
STRUCTURE_STATS* pStructureType; /* pointer to the structure stats for this
|
||||
type of building */
|
||||
UBYTE status; /* defines whether the structure is being
|
||||
built, doing nothing or performing a function*/
|
||||
SWORD currentBuildPts; /* the build points currently assigned to this
|
||||
structure */
|
||||
SWORD currentPowerAccrued; /* the power accrued for building this structure*/
|
||||
SWORD resistance; /* current resistance points
|
||||
0 = cannot be attacked electrically*/
|
||||
UDWORD lastResistance; /* time the resistance was last increased*/
|
||||
STRUCTURE_STATS *pStructureType; /* pointer to the structure stats for this type of building */
|
||||
STRUCT_STATES status; /* defines whether the structure is being built, doing nothing or performing a function */
|
||||
SWORD currentBuildPts; /* the build points currently assigned to this structure */
|
||||
SWORD currentPowerAccrued; /* the power accrued for building this structure */
|
||||
SWORD resistance; /* current resistance points, 0 = cannot be attacked electrically */
|
||||
UDWORD lastResistance; /* time the resistance was last increased*/
|
||||
FUNCTIONALITY *pFunctionality; /* pointer to structure that contains fields necessary for functionality */
|
||||
|
||||
/* The other structure data. These are all derived from the functions
|
||||
* but stored here for easy access - will need to add more for variable stuff!
|
||||
*/
|
||||
|
||||
FUNCTIONALITY *pFunctionality; /* pointer to structure that contains fields
|
||||
necessary for functionality */
|
||||
/* The weapons on the structure */
|
||||
UWORD numWeaps;
|
||||
WEAPON asWeaps[STRUCT_MAXWEAPS];
|
||||
|
|
Loading…
Reference in New Issue