Map Edgepoints.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef __MAP_EDGEPOINTS_H
  2. #define __MAP_EDGEPOINTS_H
  3. #include "types.h"
  4. #include "Fileman.h"
  5. typedef struct MAPEDGEPOINTINFO
  6. {
  7. UINT8 ubNumPoints;
  8. UINT8 ubStrategicInsertionCode;
  9. UINT16 sGridNo[ 32 ];
  10. }MAPEDGEPOINTINFO;
  11. UINT16 ChooseMapEdgepoint( UINT8 ubStrategicInsertionCode );
  12. void ChooseMapEdgepoints( MAPEDGEPOINTINFO *pMapEdgepointInfo, UINT8 ubStrategicInsertionCode, UINT8 ubNumDesiredPoints );
  13. void GenerateMapEdgepoints();
  14. void SaveMapEdgepoints( HWFILE fp );
  15. BOOLEAN LoadMapEdgepoints( INT8 **hBuffer );
  16. void TrashMapEdgepoints();
  17. //dynamic arrays that contain the valid gridno's for each edge
  18. extern INT16 *gps1stNorthEdgepointArray;
  19. extern INT16 *gps1stEastEdgepointArray;
  20. extern INT16 *gps1stSouthEdgepointArray;
  21. extern INT16 *gps1stWestEdgepointArray;
  22. //contains the size for each array
  23. extern UINT16 gus1stNorthEdgepointArraySize;
  24. extern UINT16 gus1stEastEdgepointArraySize;
  25. extern UINT16 gus1stSouthEdgepointArraySize;
  26. extern UINT16 gus1stWestEdgepointArraySize;
  27. //contains the index value for the first array index of the second row of each edgepoint array.
  28. //Because each edgepoint side has two rows, the outside most row is calculated first, then the inside row.
  29. //For purposes of AI, it may become necessary to avoid this.
  30. extern UINT16 gus1stNorthEdgepointMiddleIndex;
  31. extern UINT16 gus1stEastEdgepointMiddleIndex;
  32. extern UINT16 gus1stSouthEdgepointMiddleIndex;
  33. extern UINT16 gus1stWestEdgepointMiddleIndex;
  34. //dynamic arrays that contain the valid gridno's for each edge
  35. extern INT16 *gps2ndNorthEdgepointArray;
  36. extern INT16 *gps2ndEastEdgepointArray;
  37. extern INT16 *gps2ndSouthEdgepointArray;
  38. extern INT16 *gps2ndWestEdgepointArray;
  39. //contains the size for each array
  40. extern UINT16 gus2ndNorthEdgepointArraySize;
  41. extern UINT16 gus2ndEastEdgepointArraySize;
  42. extern UINT16 gus2ndSouthEdgepointArraySize;
  43. extern UINT16 gus2ndWestEdgepointArraySize;
  44. //contains the index value for the first array index of the second row of each edgepoint array.
  45. //Because each edgepoint side has two rows, the outside most row is calculated first, then the inside row.
  46. //For purposes of AI, it may become necessary to avoid this.
  47. extern UINT16 gus2ndNorthEdgepointMiddleIndex;
  48. extern UINT16 gus2ndEastEdgepointMiddleIndex;
  49. extern UINT16 gus2ndSouthEdgepointMiddleIndex;
  50. extern UINT16 gus2ndWestEdgepointMiddleIndex;
  51. //This is the search code that will determine the closest map edgepoint to a given gridno and
  52. //a strategic insertion code. You must call the begin...() first, the call SearchForClosestMapEdgepoint()
  53. //for each soldier that is looking. After you are completely finished, call the end..(). The return value
  54. //will return NOWHERE if the information is invalid (no edgepoint info for that particular side, or all
  55. //spots are reserved. There are only 20 spots that can be reserved (one for each player soldier). This
  56. //code shouldn't be used for enemies or anybody else.
  57. void BeginMapEdgepointSearch();
  58. void EndMapEdgepointSearch();
  59. INT16 SearchForClosestPrimaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode );
  60. INT16 SearchForClosestSecondaryMapEdgepoint( INT16 sGridNo, UINT8 ubInsertionCode );
  61. //There are two classes of edgepoints.
  62. //PRIMARY : The default list of edgepoints. This list includes edgepoints that are easily accessible from the
  63. // strategic level.
  64. //SECONDARY : The isolated list of edgepoints. Certain areas of the game are blocked off, but tactically traversing
  65. // to these areas is possible. Examples would be isolated sections of Grumm or Alma, which you can't
  66. // immediately
  67. //
  68. UINT8 CalcMapEdgepointClassInsertionCode( INT16 sGridNo );
  69. #ifdef JA2EDITOR
  70. void ShowMapEdgepoints();
  71. void HideMapEdgepoints();
  72. #endif
  73. #endif