Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 15.68 KB | None | 0 0
  1. #define WIN32_LEAN_AND_MEAN     // Exclude rarely-used stuff from Windows headers
  2. #include <windows.h>
  3.  
  4. // Include important header files needed to interface with Outpost 2
  5. // Include header files to make it easier to build levels
  6. #include "..\OP2Helper\OP2Helper.h"
  7.  
  8. // Include base layout data
  9. // Note: Editing this file is a good way to build bases.
  10. #include "BaseData.h"
  11.  
  12.  
  13. char MapName[]          = "frozenwaste.map";                            // The .map file used for this level
  14. char LevelDesc[]        = "Outcaster Mission 1";    // Description appearing in the game list box
  15. char TechtreeName[]     = "LOPTEK.TXT";                     // File to use for the tech tree
  16. SDescBlock DescBlock    = { Colony, 2, 4, 0 }; // Important level details
  17.  
  18.  
  19.  
  20. // Note: This is the DLL entry point which is called by Windows when the
  21. //       DLL is first loaded into a processes address space or unloaded
  22. //       from the process address space. This function also be called for
  23. //       each thread owned by the process, but this has been disabled
  24. //       for efficiency reasons by the DisableThreadLibraryCalls during
  25. //       the first time the method is run.
  26. // Note: You most likely do NOT need to edit this and unless you really
  27. //       know what you're doing you probably shouldn't.
  28.  
  29. BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
  30. {
  31.     if (fdwReason == DLL_PROCESS_ATTACH)
  32.     {
  33.         DisableThreadLibraryCalls(hinstDLL);
  34.     }
  35.  
  36.     return TRUE;
  37. }
  38.  
  39.  
  40.  
  41. // Note: The following function is called once by Outpost2.exe when the
  42. //       level is first initialized. This is where you want to create
  43. //       all the initial units and structures as well as setup any
  44. //       map/level environment settings such as day and night.
  45.  
  46. int InitProc()
  47. {
  48.    
  49.     Unit x;
  50.     //outcaster's starting units
  51.  
  52.     TethysGame::CreateBeacon(mapMiningBeacon, 54+31, 37-1, 0, 1, 1);
  53.  
  54.     TethysGame::CreateUnit(x, mapCommandCenter, LOCATION(40+31, 16-1), 0, mapNone, 0);
  55.  
  56.     TethysGame::CreateUnit(x, mapConVec, LOCATION(37+31, 8-1), 0, mapNone, 3);
  57.     x.DoSetLights(1);
  58.  
  59.     TethysGame::CreateUnit(x, mapStructureFactory, LOCATION(40+31, 4-1), 0, mapBasicLab, 0);
  60.  
  61.     TethysGame::CreateUnit(x, mapTokamak, LOCATION(36+31, 22-1), 0, mapNone, 0);
  62.    
  63.     TethysGame::CreateUnit(x, mapCommonOreSmelter, LOCATION(51+31, 31-1), 0, mapNone, 0);
  64.    
  65.     TethysGame::CreateUnit(x, mapAgridome, LOCATION(60+31, 6-1), 0, mapNone, 0);
  66.  
  67.     TethysGame::CreateUnit(x, mapCommonStorage, LOCATION(45+31, 5-1), 0, mapNone, 0);
  68.    
  69.     TethysGame::CreateUnit(x, mapLightTower, LOCATION(31+31, 20-1), 0, mapNone, 0);
  70.  
  71.     TethysGame::CreateUnit(x, mapCargoTruck, LOCATION(47+31, 25-1), 0, mapNone, 0);
  72.     x.DoSetLights(1);
  73.  
  74.  
  75.     TethysGame::CreateUnit(x, mapCargoTruck, LOCATION(47+31, 27-1), 0, mapNone, 0);
  76.     x.DoSetLights(1);
  77.  
  78.     TethysGame::CreateUnit(x, mapEarthworker, LOCATION(44+31, 26-1), 0, mapNone, 0);
  79.     x.DoSetLights(1);
  80.  
  81.     TethysGame::CreateUnit(x, mapRoboMiner, LOCATION(32+31, 11-1), 0, mapNone, 0);
  82.     x.DoSetLights(1);
  83.  
  84.     TethysGame::CreateUnit(x, mapRoboSurveyor, LOCATION(30+31, 11-1), 0, mapNone, 0);
  85.     x.DoSetLights(1);
  86.  
  87.     TethysGame::CreateUnit(x, mapScout, LOCATION(30+31, 9-1), 0, mapNone, 0);
  88.     x.DoSetLights(1);
  89.  
  90.     TethysGame::CreateUnit(x, mapEvacuationTransport, LOCATION(30+31, 7-1), 0, mapNone, 0);
  91.     x.DoSetLights(1);
  92.  
  93.    
  94.     CreateTubeOrWallLine(40+31, 7-1, 40+31, 14-1, mapTube);
  95.  
  96.     CreateTubeOrWallLine(43+31, 4-1, 44+31, 4-1, mapTube);
  97.    
  98.     CreateTubeOrWallLine(43+31, 16-1, 58+31, 16-1, mapTube);
  99.  
  100.     CreateTubeOrWallLine(60+31, 14-1, 60+31, 7-1, mapTube);
  101.  
  102.     CreateTubeOrWallLine(40+31, 18-1, 40+31, 20-1, mapTube);
  103.  
  104.     CreateTubeOrWallLine(39+31, 20-1, 39+31, 25-1, mapTube);
  105.  
  106.     CreateTubeOrWallLine(38+31, 25-1, 36+31, 25-1, mapTube);
  107.  
  108.     CreateTubeOrWallLine(36+31, 26-1, 36+31, 30-1, mapTube);
  109.  
  110.     CreateTubeOrWallLine(36+31, 31-1, 48+31, 31-1, mapTube);
  111.  
  112.     CreateTubeOrWallLine(36+31, 32-1, 34+31, 32-1, mapTube);
  113.  
  114.     CreateTubeOrWallLine(38+31, 20-1, 32+31, 20-1, mapTube);
  115.  
  116.  
  117.    
  118.     Player[0].GoPlymouth();
  119.     Player[0].SetColorNumber(3);
  120.  
  121.  
  122.     // Place all bases on the map
  123.    
  124.  
  125.  
  126.     // Misc initialization
  127.     TethysGame::CreateWreck(95, 63, (map_id)11999, 0); // Tech #11999 - tiger speed upgrade
  128.  
  129.     TethysGame::ForceMoraleGood(-1);
  130.     TethysGame::FreeMoraleLevel(-1);
  131.     TethysGame::SetDaylightEverywhere(0);
  132.     GameMap::SetInitialLightLevel(-32);
  133.  
  134.     CreateLastOneStandingVictoryCondition();
  135.  
  136.     return 1; // return 1 if OK; 0 on failure
  137. }
  138.  
  139.  
  140. // Note: The following function seems to be intended for use in
  141. //       controlling an AI. It is called once every game cycle.
  142. //       Use it for whatever code needs to run on a continual basis.
  143. // Note: The standard level DLLs released by Sierra leave this function
  144. //       empty and handle all AI controls through triggers.
  145.  
  146. void AIProc()
  147. {
  148. }
  149.  
  150. Trigger Trig;
  151. CreateResourceTrigger(1, 1, resColonists, 200, 0, mapAny, mapAny, 0, cmpGreaterEqual, "NoResponseToTrigger");
  152. CreateVictoryCondition(1, 1, trig, "Have200colonists");
  153. //       of a buffer that is saved to saved game files. Outpost2.exe
  154. //       calls this function and passes it a pointer to a structure
  155. //       which describes this buffer. This function is required to set
  156. //       the fields of this structure. If no buffer needs to be saved
  157. //       to a saved game file, then the buffer pointer needs to be set
  158. //       to 0, and the length should also be set to 0.
  159. // Note: This function is called once when the DLL is first initialized.
  160. //       This means that all data to be saved must have space reserved
  161. //       ahead of time at the start of the level. (Static sized storage)
  162. //       In other words, there is no way to dynamically grow the size of
  163. //       the buffer if more space is needed than originally specified.
  164. // Note: You can probably stretch the above limitation by saving the
  165. //       pointer to the buffer description passed by Outpost2.exe. This
  166. //       may allow you to increase the buffer size dynamically but the
  167. //       idea is yet untested. Keep in mind that you have no idea when
  168. //       a game may be saved (or just loaded).
  169.  
  170. void __cdecl GetSaveRegions(struct BufferDesc &bufDesc)
  171. {
  172. bufDesc.bufferStart = &SD;             // Pointer to a buffer that needs to be saved
  173. bufDesc.length = sizeof(SD);   // sizeof(buffer)
  174. }
  175.  
  176.  
  177.  
  178.  
  179.  
  180. // Note: These last two functions aren't absolutely required by a level
  181. //       but they found in almost all DLLs anyways.
  182.  
  183.  
  184. // Note: This export usually exists, but does nothing other than return 0.
  185. //       It's use may have been for checking for victory/failure conditions
  186. //       that are not easily checked for by using triggers.
  187.  
  188. int StatusProc()
  189. {
  190.     return 0; // must return 0
  191. }
  192.  
  193.  
  194. // Note: This is a trigger callback function. This function is
  195. //       intentionally left empty and is used as the trigger
  196. //       callback function for triggers that don't want or need
  197. //       any special callback function.
  198. // Note: The use of SCRIPT_API is used by all trigger functions
  199. //       to ensure they are exported correctly. (Although,
  200. //       technically it's not needed in this case since this
  201. //       function has a function prototype defined in
  202. //       RequiredExports.h which contains the SCRIPT_API macro
  203. //       in it. However, most other trigger callback functions
  204. //       won't have a function prototype anywhere (and you really
  205. //       don't need to declare a function prototype since you
  206. //       should never be calling a callback function yourself)
  207. //       so you should use the SCRIPT_API macro when you define
  208. //       the function.
  209. //       Might as well set a good example. =)
  210. SCRIPT_API void NoResponseToTrigger()
  211. {#define WIN32_LEAN_AND_MEAN        // Exclude rarely-used stuff from Windows headers
  212. #include <windows.h>
  213.  
  214. // Include important header files needed to interface with Outpost 2
  215. // Include header files to make it easier to build levels
  216.  
  217.  
  218.  
  219. // Include base layout data
  220. // Note: Editing this file is a good way to build bases.
  221. #include "BaseData.h"
  222.  
  223.  
  224.  
  225. // Note: These exports are required by Outpost2.exe from every level
  226. //       DLL. They give values for the map and tech trees used by the
  227. //       level and a description to place in the level listbox. The
  228. //       last export is used to define characteristics of the level.
  229. //       See RequiredExports.h for more details.
  230. //       ** Be sure to set these when you build your own level**
  231.  
  232. char MapName[]          = "frozenwaste.map";                            // The .map file used for this level
  233. char LevelDesc[]        = "Outcaster Mission 1";    // Description appearing in the game list box
  234. char TechtreeName[]     = "LOPTEK.TXT";                     // File to use for the tech tree
  235. SDescBlock DescBlock    = { Colony, 1, 4, 0 }; // Important level details
  236.  
  237.  
  238.  
  239. // Note: This is the DLL entry point which is called by Windows when the
  240. //       DLL is first loaded into a processes address space or unloaded
  241. //       from the process address space. This function also be called for
  242. //       each thread owned by the process, but this has been disabled
  243. //       for efficiency reasons by the DisableThreadLibraryCalls during
  244. //       the first time the method is run.
  245. // Note: You most likely do NOT need to edit this and unless you really
  246. //       know what you're doing you probably shouldn't.
  247.  
  248. BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
  249. {
  250.     if (fdwReason == DLL_PROCESS_ATTACH)
  251.     {
  252.         DisableThreadLibraryCalls(hinstDLL);
  253.     }
  254.  
  255.     return TRUE;
  256. }
  257.  
  258.  
  259.  
  260. // Note: The following function is called once by Outpost2.exe when the
  261. //       level is first initialized. This is where you want to create
  262. //       all the initial units and structures as well as setup any
  263. //       map/level environment settings such as day and night.
  264.  
  265. int InitProc()
  266. {
  267.     int i;
  268.  
  269.     //outcaster's starting units
  270.  
  271.     TethysGame::CreateUnit(x, mapCommandCenter, int(40+31, 16-1), 0, mapNone, 0);
  272.  
  273.     TethysGame::CreateUnit(x, mapConVec, int(37+31, 8-1), 0, mapnone, 3);
  274.     x.DoSetLights(1);
  275.  
  276.     TethysGame::CreateUnit(x, mapStructureFactory, int(40+31 4-1), 0, mapBasicLab, 0);
  277.  
  278.     TethysGame::CreateUnit(x, mapTokamak, int(36+31 22-1), 0, mapnone, 0);
  279.  
  280.     TethysGame::CreateUnit(x, mapCommonOreSmelter, int(51+31 31-1), 0, mapnone, 0);
  281.  
  282.     TethysGame::CreateUnit(x, mapAgridome, int(60+31 6-1), 0, mapnone, 0);
  283.  
  284.     TethysGame::CreateUnit(x, mapCommonStorage, int(45+31 5-1), 0, mapnone, 0);
  285.  
  286.     TethysGame::CreateUnit(x, mapLightTower, int(31+31 20-1), 0, mapnone, 0);
  287.  
  288.     TethysGame::CreateUnit(x, mapCargoTruck, int(47+31 25-1), 0, mapnone, 0);
  289.     x.DoSetLights(1);
  290.  
  291.  
  292.     TethysGame::CreateUnit(x, mapCargoTruck, int(47+31 27-1), 0, mapnone, 0);
  293.     x.DoSetLights(1);
  294.  
  295.     TethysGame::CreateUnit(x, mapEarthWorker, int(44+31 26-1), 0, mapnone, 0);
  296.     x.DoSetLights(1);
  297.  
  298.     TethysGame::CreateUnit(x, mapRoboMiner, int(32+31 11-1), 0, mapnone, 0);
  299.     x.DoSetLights(1);
  300.  
  301.     TethysGame::CreateUnit(x, mapRoboSurveyor, int(30+31 11-1), 0, mapnone, 0);
  302.     x.DoSetLights(1);
  303.  
  304.     TethysGame::CreateUnit(x, mapScout, int(30+31 9-1), 0, mapnone, 0);
  305.     x.DoSetLights(1);
  306.  
  307.     TethysGame::CreateUnit(x, mapEvacuationTransport, int(30+31 7-1), 0, mapnone, 0);
  308.     x.DoSetLights(1);
  309.  
  310.  
  311.     CreateTubeOrWallLine(40+31, 7-1, 40+31, 14-1, mapTube);
  312.  
  313.     CreateTubeOrWallLine(43+31, 4-1, 44+31, 4-1, mapTube);
  314.  
  315.     CreateTubeOrWallLine(43+31, 16-1, 58+31, 16-1, mapTube);
  316.  
  317.     CreateTubeOrWallLine(60+31, 14-1, 60+31, 7-1, mapTube);
  318.  
  319.     CreateTubeOrWallLine(40+31, 18-1, 40+31, 20-1, mapTube);
  320.  
  321.     CreateTubeOrWallLine(39+31, 20-1, 39+31, 25-1, mapTube);
  322.  
  323.     CreateTubeOrWallLine(38+31, 25-1, 36+31, 25-1, mapTube);
  324.  
  325.     CreateTubeOrWallLine(36+31, 26-1, 36+31, 30-1, mapTube);
  326.  
  327.     CreateTubeOrWallLine(36+31, 31-1, 48+31, 31-1, mapTube);
  328.  
  329.     CreateTubeOrWallLine(36+31, 32-1, 34+31, 32-1, mapTube);
  330.  
  331.     CreateTubeOrWallLine(38+31, 20-1, 32+31, 20-1, mapTube);
  332.  
  333.  
  334.  
  335.     Player[0].GoPlymouth();
  336.     Player[0].SetColorNumber(3);
  337.  
  338.    
  339.     // Place all bases on the map
  340.     for (i = 0; i < TethysGame::NoPlayers(); i++)
  341.     {
  342.         InitPlayerResources(i);
  343.  
  344.         StartLocation &sLoc = startLocation[i];
  345.         CreateBase(i, sLoc.x, sLoc.y, *sLoc.baseInfo);
  346.         Player[i].CenterViewOn(sLoc.x, sLoc.y);
  347.     }
  348.  
  349.  
  350.     // Misc initialization
  351.     TethysGame::CreateWreck(95, 63, (map_id)11999, 0); // Tech #11999 - tiger speed upgrade
  352.  
  353.     TethysGame::ForceMoraleGood(-1);
  354.     if (TethysGame::UsesMorale())
  355.         TethysGame::FreeMoraleLevel(-1);
  356.     TethysGame::SetDaylightEverywhere(TethysGame::UsesDayNight() == 0);
  357.     TethysGame::SetDaylightMoves(0);
  358.     GameMap::SetInitialLightLevel(-32);
  359.  
  360.  
  361.     return 1; // return 1 if OK; 0 on failure
  362. }
  363.  
  364.  
  365. // Note: The following function seems to be intended for use in
  366. //       controlling an AI. It is called once every game cycle.
  367. //       Use it for whatever code needs to run on a continual basis.
  368. // Note: The standard level DLLs released by Sierra leave this function
  369. //       empty and handle all AI controls through triggers.
  370.  
  371. void AIProc()
  372. {
  373. }
  374.  
  375.  
  376. void CreateMiningLocations()
  377. {
  378.     GetMapSize();
  379.     TethysGame::reateBeacon(mapMiningBeacon, 54+31, 37-1, 0, 1, 1);
  380.  
  381. // Nif(Player[0].Workers() + Player[0].Scientists() + Player[0].Kids() == 0)
  382. {
  383.     CreateFailureCondition(1, 0, CreateCountTrigger(1, 0, -1, mapAny, mapAny, 0, cmpGreaterEqual, "NoResponseToTrigger"), "");
  384. }
  385.  
  386. if(Player[0].hasActiveCommand() == 0)
  387. {
  388.     CreateFailureCondition(1, 0, CreateCountTrigger(1, 0, -1, mapAny, mapAny, 0, cmpGreaterEqual, "NoResponseToTrigger"), "");
  389. }//note: This function is called by Outpost2.exe to obtain a description
  390.  
  391. Trigger Trig:
  392. CreateResourceTrigger(1, 1, resColonists, 200, 0, mapAny, mapAny, 0, cmpGreaterEqual, "NoResponseToTrigger");
  393. CreateVictoryCondition(1, 1, trig, "Have 200 colonists");
  394. //       of a buffer that is saved to saved game files. Outpost2.exe
  395. //       calls this function and passes it a pointer to a structure
  396. //       which describes this buffer. This function is required to set
  397. //       the fields of this structure. If no buffer needs to be saved
  398. //       to a saved game file, then the buffer pointer needs to be set
  399. //       to 0, and the length should also be set to 0.
  400. // Note: This function is called once when the DLL is first initialized.
  401. //       This means that all data to be saved must have space reserved
  402. //       ahead of time at the start of the level. (Static sized storage)
  403. //       In other words, there is no way to dynamically grow the size of
  404. //       the buffer if more space is needed than originally specified.
  405. // Note: You can probably stretch the above limitation by saving the
  406. //       pointer to the buffer description passed by Outpost2.exe. This
  407. //       may allow you to increase the buffer size dynamically but the
  408. //       idea is yet untested. Keep in mind that you have no idea when
  409. //       a game may be saved (or just loaded).
  410.  
  411. void __cdecl GetSaveRegions(struct BufferDesc &bufDesc)
  412. {
  413. bufDesc.bufferStart = &SD;             // Pointer to a buffer that needs to be saved
  414. bufDesc.length = sizeof(SD);   // sizeof(buffer)
  415. }
  416.  
  417.  
  418.  
  419.  
  420.  
  421. // Note: These last two functions aren't absolutely required by a level
  422. //       but they found in almost all DLLs anyways.
  423.  
  424.  
  425. // Note: This export usually exists, but does nothing other than return 0.
  426. //       It's use may have been for checking for victory/failure conditions
  427. //       that are not easily checked for by using triggers.
  428.  
  429. int StatusProc()
  430. {
  431.     return 0; // must return 0
  432. }
  433.  
  434.  
  435. // Note: This is a trigger callback function. This function is
  436. //       intentionally left empty and is used as the trigger
  437. //       callback function for triggers that don't want or need
  438. //       any special callback function.
  439. // Note: The use of SCRIPT_API is used by all trigger functions
  440. //       to ensure they are exported correctly. (Although,
  441. //       technically it's not needed in this case since this
  442. //       function has a function prototype defined in
  443. //       RequiredExports.h which contains the SCRIPT_API macro
  444. //       in it. However, most other trigger callback functions
  445. //       won't have a function prototype anywhere (and you really
  446. //       don't need to declare a function prototype since you
  447. //       should never be calling a callback function yourself)
  448. //       so you should use the SCRIPT_API macro when you define
  449. //       the function.
  450. //       Might as well set a good example. =)
  451. SCRIPT_API void NoResponseToTrigger()
  452. {
  453. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement