Filename: action.c(all droids actions) void actionAddVtolAttackRun(DROID *psDroid) Description: this function adds 1 attackrun action to VTOL via function moveDroidToDirect(droid,x,y) void actionAlignTurret(DROID *psDroid) Description: this function makes a droid's turret(s) to turn to target position void actionAlignTurret(DROID *psDroid) Description: this function makes a droid's turret(s) to turn to target position void actionDroid(DROID *psDroid) Description: this function gives specified droid action void actionDroidLoc(DROID *psDroid, DROID_ACTION action, UDWORD x, UDWORD y) Description: this function orders the droid to do action with action coords void actionDroidObj(DROID *psDroid, DROID_ACTION action, BASE_OBJECT *psObj) Description: this function orders the droid to do action on object(guard,follow,repair etc) void actionDroidObjLoc(DROID *psDroid, DROID_ACTION action, BASE_OBJECT *psObj, UDWORD x, UDWORD y) Description: this function orders the droid to do action on object(guard,follow,repair etc) with additional coords info void actionUpdateDroid(DROID *psDroid) Description: this function is the most interesting function in action.c(and the biggest), it handles the action state of the droid,it's the central of all actions including build,command,repair building,repair unit,attack. int actionVisibleTarget(DROID *psDroid, BASE_OBJECT *psTarget) Description: this function tests the droid's visibility to target specified and return int as result Return format: target is visible for weapon slot 'weapon_slot',result += (1 << (weapon_slot + 1)) returns '1' if non of the weapon has visibility to target. Example: A droid has 3 weapons and all weapon has visibility to target specified: result = 1 + 2 + 4 + 8 = 15 BOOL actionTargetTurret(BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, UWORD *pRotation, UWORD *pPitch, WEAPON_STATS *psWeapStats, BOOL bInvert, int weapon_slot) Description: this function tests whether the specified weapon on weapon_slot slot is targetted on 'psTarget' or not. Return format: TRUE if targetted FALSE if not targetted int actionInRange(DROID *psDroid, BASE_OBJECT *psObj) Description: this function tests if the target specified is in droid's weapon(s)'s range return int as result Return format: target is in range for weapon slot 'weapon_slot',result += (1 << (weapon_slot + 1)) returns '1' if target is not in range for all weapons. Example: A droid has 3 weapons and the target specified is in range with all weapons: result = 1 + 2 + 4 + 8 = 15 int actionInAttackRange(DROID *psDroid, BASE_OBJECT *psObj) Description: this function tests if the target specified is in droid's weapon(s)'s attack range return int as result Return format: target is in range for weapon slot 'weapon_slot',result += (1 << (weapon_slot + 1)) returns '1' if target is not in attack range for all weapons. Example: A droid has 3 weapons and the target specified is in attack range with all weapons: result = 1 + 2 + 4 + 8 = 15 Filename: ai.c(ai update functions) BOOL aiCheckAlliances(UDWORD s1,UDWORD s2) Description: this function checks whether the player Id s1 and player Id s2 are allied or not. Return format: TRUE if they are in an alliance FALSE if not BOOL aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot) Description: this function looks for a best target for a droid's weapon on weapon slot 'weapon_slot' Return format: TRUE if found best target FALSE if not BOOL aiStructHasRange(STRUCTURE *psStruct, BASE_OBJECT *psTarget, int weapon_slot) Description: this function checks whether the 'psTarget' is in Structure's attack range or not. Return format: TRUE if in range FALSE if not BOOL aiChooseTarget(BASE_OBJECT *psObj, BASE_OBJECT **ppsTarget,int weapon_slot) Description: this function chooses a target for combat droid/structure's weapon slot 'weapon_slot' and store the chosen target in ppsTarget. Return format: TRUE if chosen one FALSE if not BOOL aiChooseSensorTarget(BASE_OBJECT *psObj, BASE_OBJECT **ppsTarget) Description: this function chooses a target for sensor droid/structure's weapon slot 'weapon_slot' and store the chosen target in ppsTarget. Return format: TRUE if chosen one FALSE if not void aiUpdateDroid(DROID *psDroid) Description: this function tests whether the specified droid should look for target or not int validTarget(BASE_OBJECT *psObject, BASE_OBJECT *psTarget) Description: this function checks whether the target specified is valid for droid's return int as result Return format: target is valid for weapon slot 'weapon_slot',result += (1 << (weapon_slot + 1)) returns '1' if target is invalid for all weapons. Example: A droid has 3 weapons and the target specified is valid with all weapons: result = 1 + 2 + 4 + 8 = 15 Filename:combat.c(pre-projectile stuff and calculate miss offset and target prediction) void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, int weapon_slot) Description: this function calculates the target x,y,z coords and send projectile on weapon slot 'weapon_slot' to pre-calculated position.