Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
- #include <windows.h>
- // Include important header files needed to interface with Outpost 2
- // Include header files to make it easier to build levels
- #include "..\OP2Helper\OP2Helper.h"
- // Include base layout data
- // Note: Editing this file is a good way to build bases.
- #include "BaseData.h"
- char MapName[] = "frozenwaste.map"; // The .map file used for this level
- char LevelDesc[] = "Outcaster Mission 1"; // Description appearing in the game list box
- char TechtreeName[] = "LOPTEK.TXT"; // File to use for the tech tree
- SDescBlock DescBlock = { Colony, 2, 4, 0 }; // Important level details
- // Note: This is the DLL entry point which is called by Windows when the
- // DLL is first loaded into a processes address space or unloaded
- // from the process address space. This function also be called for
- // each thread owned by the process, but this has been disabled
- // for efficiency reasons by the DisableThreadLibraryCalls during
- // the first time the method is run.
- // Note: You most likely do NOT need to edit this and unless you really
- // know what you're doing you probably shouldn't.
- BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
- {
- if (fdwReason == DLL_PROCESS_ATTACH)
- {
- DisableThreadLibraryCalls(hinstDLL);
- }
- return TRUE;
- }
- // Note: The following function is called once by Outpost2.exe when the
- // level is first initialized. This is where you want to create
- // all the initial units and structures as well as setup any
- // map/level environment settings such as day and night.
- int InitProc()
- {
- Unit x;
- //outcaster's starting units
- TethysGame::CreateBeacon(mapMiningBeacon, 54+31, 37-1, 0, 1, 1);
- TethysGame::CreateUnit(x, mapCommandCenter, LOCATION(40+31, 16-1), 0, mapNone, 0);
- TethysGame::CreateUnit(x, mapConVec, LOCATION(37+31, 8-1), 0, mapNone, 3);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapStructureFactory, LOCATION(40+31, 4-1), 0, mapBasicLab, 0);
- TethysGame::CreateUnit(x, mapTokamak, LOCATION(36+31, 22-1), 0, mapNone, 0);
- TethysGame::CreateUnit(x, mapCommonOreSmelter, LOCATION(51+31, 31-1), 0, mapNone, 0);
- TethysGame::CreateUnit(x, mapAgridome, LOCATION(60+31, 6-1), 0, mapNone, 0);
- TethysGame::CreateUnit(x, mapCommonStorage, LOCATION(45+31, 5-1), 0, mapNone, 0);
- TethysGame::CreateUnit(x, mapLightTower, LOCATION(31+31, 20-1), 0, mapNone, 0);
- TethysGame::CreateUnit(x, mapCargoTruck, LOCATION(47+31, 25-1), 0, mapNone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapCargoTruck, LOCATION(47+31, 27-1), 0, mapNone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapEarthworker, LOCATION(44+31, 26-1), 0, mapNone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapRoboMiner, LOCATION(32+31, 11-1), 0, mapNone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapRoboSurveyor, LOCATION(30+31, 11-1), 0, mapNone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapScout, LOCATION(30+31, 9-1), 0, mapNone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapEvacuationTransport, LOCATION(30+31, 7-1), 0, mapNone, 0);
- x.DoSetLights(1);
- CreateTubeOrWallLine(40+31, 7-1, 40+31, 14-1, mapTube);
- CreateTubeOrWallLine(43+31, 4-1, 44+31, 4-1, mapTube);
- CreateTubeOrWallLine(43+31, 16-1, 58+31, 16-1, mapTube);
- CreateTubeOrWallLine(60+31, 14-1, 60+31, 7-1, mapTube);
- CreateTubeOrWallLine(40+31, 18-1, 40+31, 20-1, mapTube);
- CreateTubeOrWallLine(39+31, 20-1, 39+31, 25-1, mapTube);
- CreateTubeOrWallLine(38+31, 25-1, 36+31, 25-1, mapTube);
- CreateTubeOrWallLine(36+31, 26-1, 36+31, 30-1, mapTube);
- CreateTubeOrWallLine(36+31, 31-1, 48+31, 31-1, mapTube);
- CreateTubeOrWallLine(36+31, 32-1, 34+31, 32-1, mapTube);
- CreateTubeOrWallLine(38+31, 20-1, 32+31, 20-1, mapTube);
- Player[0].GoPlymouth();
- Player[0].SetColorNumber(3);
- // Place all bases on the map
- // Misc initialization
- TethysGame::CreateWreck(95, 63, (map_id)11999, 0); // Tech #11999 - tiger speed upgrade
- TethysGame::ForceMoraleGood(-1);
- TethysGame::FreeMoraleLevel(-1);
- TethysGame::SetDaylightEverywhere(0);
- GameMap::SetInitialLightLevel(-32);
- CreateLastOneStandingVictoryCondition();
- return 1; // return 1 if OK; 0 on failure
- }
- // Note: The following function seems to be intended for use in
- // controlling an AI. It is called once every game cycle.
- // Use it for whatever code needs to run on a continual basis.
- // Note: The standard level DLLs released by Sierra leave this function
- // empty and handle all AI controls through triggers.
- void AIProc()
- {
- }
- Trigger Trig;
- CreateResourceTrigger(1, 1, resColonists, 200, 0, mapAny, mapAny, 0, cmpGreaterEqual, "NoResponseToTrigger");
- CreateVictoryCondition(1, 1, trig, "Have200colonists");
- // of a buffer that is saved to saved game files. Outpost2.exe
- // calls this function and passes it a pointer to a structure
- // which describes this buffer. This function is required to set
- // the fields of this structure. If no buffer needs to be saved
- // to a saved game file, then the buffer pointer needs to be set
- // to 0, and the length should also be set to 0.
- // Note: This function is called once when the DLL is first initialized.
- // This means that all data to be saved must have space reserved
- // ahead of time at the start of the level. (Static sized storage)
- // In other words, there is no way to dynamically grow the size of
- // the buffer if more space is needed than originally specified.
- // Note: You can probably stretch the above limitation by saving the
- // pointer to the buffer description passed by Outpost2.exe. This
- // may allow you to increase the buffer size dynamically but the
- // idea is yet untested. Keep in mind that you have no idea when
- // a game may be saved (or just loaded).
- void __cdecl GetSaveRegions(struct BufferDesc &bufDesc)
- {
- bufDesc.bufferStart = &SD; // Pointer to a buffer that needs to be saved
- bufDesc.length = sizeof(SD); // sizeof(buffer)
- }
- // Note: These last two functions aren't absolutely required by a level
- // but they found in almost all DLLs anyways.
- // Note: This export usually exists, but does nothing other than return 0.
- // It's use may have been for checking for victory/failure conditions
- // that are not easily checked for by using triggers.
- int StatusProc()
- {
- return 0; // must return 0
- }
- // Note: This is a trigger callback function. This function is
- // intentionally left empty and is used as the trigger
- // callback function for triggers that don't want or need
- // any special callback function.
- // Note: The use of SCRIPT_API is used by all trigger functions
- // to ensure they are exported correctly. (Although,
- // technically it's not needed in this case since this
- // function has a function prototype defined in
- // RequiredExports.h which contains the SCRIPT_API macro
- // in it. However, most other trigger callback functions
- // won't have a function prototype anywhere (and you really
- // don't need to declare a function prototype since you
- // should never be calling a callback function yourself)
- // so you should use the SCRIPT_API macro when you define
- // the function.
- // Might as well set a good example. =)
- SCRIPT_API void NoResponseToTrigger()
- {#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
- #include <windows.h>
- // Include important header files needed to interface with Outpost 2
- // Include header files to make it easier to build levels
- // Include base layout data
- // Note: Editing this file is a good way to build bases.
- #include "BaseData.h"
- // Note: These exports are required by Outpost2.exe from every level
- // DLL. They give values for the map and tech trees used by the
- // level and a description to place in the level listbox. The
- // last export is used to define characteristics of the level.
- // See RequiredExports.h for more details.
- // ** Be sure to set these when you build your own level**
- char MapName[] = "frozenwaste.map"; // The .map file used for this level
- char LevelDesc[] = "Outcaster Mission 1"; // Description appearing in the game list box
- char TechtreeName[] = "LOPTEK.TXT"; // File to use for the tech tree
- SDescBlock DescBlock = { Colony, 1, 4, 0 }; // Important level details
- // Note: This is the DLL entry point which is called by Windows when the
- // DLL is first loaded into a processes address space or unloaded
- // from the process address space. This function also be called for
- // each thread owned by the process, but this has been disabled
- // for efficiency reasons by the DisableThreadLibraryCalls during
- // the first time the method is run.
- // Note: You most likely do NOT need to edit this and unless you really
- // know what you're doing you probably shouldn't.
- BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
- {
- if (fdwReason == DLL_PROCESS_ATTACH)
- {
- DisableThreadLibraryCalls(hinstDLL);
- }
- return TRUE;
- }
- // Note: The following function is called once by Outpost2.exe when the
- // level is first initialized. This is where you want to create
- // all the initial units and structures as well as setup any
- // map/level environment settings such as day and night.
- int InitProc()
- {
- int i;
- //outcaster's starting units
- TethysGame::CreateUnit(x, mapCommandCenter, int(40+31, 16-1), 0, mapNone, 0);
- TethysGame::CreateUnit(x, mapConVec, int(37+31, 8-1), 0, mapnone, 3);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapStructureFactory, int(40+31 4-1), 0, mapBasicLab, 0);
- TethysGame::CreateUnit(x, mapTokamak, int(36+31 22-1), 0, mapnone, 0);
- TethysGame::CreateUnit(x, mapCommonOreSmelter, int(51+31 31-1), 0, mapnone, 0);
- TethysGame::CreateUnit(x, mapAgridome, int(60+31 6-1), 0, mapnone, 0);
- TethysGame::CreateUnit(x, mapCommonStorage, int(45+31 5-1), 0, mapnone, 0);
- TethysGame::CreateUnit(x, mapLightTower, int(31+31 20-1), 0, mapnone, 0);
- TethysGame::CreateUnit(x, mapCargoTruck, int(47+31 25-1), 0, mapnone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapCargoTruck, int(47+31 27-1), 0, mapnone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapEarthWorker, int(44+31 26-1), 0, mapnone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapRoboMiner, int(32+31 11-1), 0, mapnone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapRoboSurveyor, int(30+31 11-1), 0, mapnone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapScout, int(30+31 9-1), 0, mapnone, 0);
- x.DoSetLights(1);
- TethysGame::CreateUnit(x, mapEvacuationTransport, int(30+31 7-1), 0, mapnone, 0);
- x.DoSetLights(1);
- CreateTubeOrWallLine(40+31, 7-1, 40+31, 14-1, mapTube);
- CreateTubeOrWallLine(43+31, 4-1, 44+31, 4-1, mapTube);
- CreateTubeOrWallLine(43+31, 16-1, 58+31, 16-1, mapTube);
- CreateTubeOrWallLine(60+31, 14-1, 60+31, 7-1, mapTube);
- CreateTubeOrWallLine(40+31, 18-1, 40+31, 20-1, mapTube);
- CreateTubeOrWallLine(39+31, 20-1, 39+31, 25-1, mapTube);
- CreateTubeOrWallLine(38+31, 25-1, 36+31, 25-1, mapTube);
- CreateTubeOrWallLine(36+31, 26-1, 36+31, 30-1, mapTube);
- CreateTubeOrWallLine(36+31, 31-1, 48+31, 31-1, mapTube);
- CreateTubeOrWallLine(36+31, 32-1, 34+31, 32-1, mapTube);
- CreateTubeOrWallLine(38+31, 20-1, 32+31, 20-1, mapTube);
- Player[0].GoPlymouth();
- Player[0].SetColorNumber(3);
- // Place all bases on the map
- for (i = 0; i < TethysGame::NoPlayers(); i++)
- {
- InitPlayerResources(i);
- StartLocation &sLoc = startLocation[i];
- CreateBase(i, sLoc.x, sLoc.y, *sLoc.baseInfo);
- Player[i].CenterViewOn(sLoc.x, sLoc.y);
- }
- // Misc initialization
- TethysGame::CreateWreck(95, 63, (map_id)11999, 0); // Tech #11999 - tiger speed upgrade
- TethysGame::ForceMoraleGood(-1);
- if (TethysGame::UsesMorale())
- TethysGame::FreeMoraleLevel(-1);
- TethysGame::SetDaylightEverywhere(TethysGame::UsesDayNight() == 0);
- TethysGame::SetDaylightMoves(0);
- GameMap::SetInitialLightLevel(-32);
- return 1; // return 1 if OK; 0 on failure
- }
- // Note: The following function seems to be intended for use in
- // controlling an AI. It is called once every game cycle.
- // Use it for whatever code needs to run on a continual basis.
- // Note: The standard level DLLs released by Sierra leave this function
- // empty and handle all AI controls through triggers.
- void AIProc()
- {
- }
- void CreateMiningLocations()
- {
- GetMapSize();
- TethysGame::reateBeacon(mapMiningBeacon, 54+31, 37-1, 0, 1, 1);
- // Nif(Player[0].Workers() + Player[0].Scientists() + Player[0].Kids() == 0)
- {
- CreateFailureCondition(1, 0, CreateCountTrigger(1, 0, -1, mapAny, mapAny, 0, cmpGreaterEqual, "NoResponseToTrigger"), "");
- }
- if(Player[0].hasActiveCommand() == 0)
- {
- CreateFailureCondition(1, 0, CreateCountTrigger(1, 0, -1, mapAny, mapAny, 0, cmpGreaterEqual, "NoResponseToTrigger"), "");
- }//note: This function is called by Outpost2.exe to obtain a description
- Trigger Trig:
- CreateResourceTrigger(1, 1, resColonists, 200, 0, mapAny, mapAny, 0, cmpGreaterEqual, "NoResponseToTrigger");
- CreateVictoryCondition(1, 1, trig, "Have 200 colonists");
- // of a buffer that is saved to saved game files. Outpost2.exe
- // calls this function and passes it a pointer to a structure
- // which describes this buffer. This function is required to set
- // the fields of this structure. If no buffer needs to be saved
- // to a saved game file, then the buffer pointer needs to be set
- // to 0, and the length should also be set to 0.
- // Note: This function is called once when the DLL is first initialized.
- // This means that all data to be saved must have space reserved
- // ahead of time at the start of the level. (Static sized storage)
- // In other words, there is no way to dynamically grow the size of
- // the buffer if more space is needed than originally specified.
- // Note: You can probably stretch the above limitation by saving the
- // pointer to the buffer description passed by Outpost2.exe. This
- // may allow you to increase the buffer size dynamically but the
- // idea is yet untested. Keep in mind that you have no idea when
- // a game may be saved (or just loaded).
- void __cdecl GetSaveRegions(struct BufferDesc &bufDesc)
- {
- bufDesc.bufferStart = &SD; // Pointer to a buffer that needs to be saved
- bufDesc.length = sizeof(SD); // sizeof(buffer)
- }
- // Note: These last two functions aren't absolutely required by a level
- // but they found in almost all DLLs anyways.
- // Note: This export usually exists, but does nothing other than return 0.
- // It's use may have been for checking for victory/failure conditions
- // that are not easily checked for by using triggers.
- int StatusProc()
- {
- return 0; // must return 0
- }
- // Note: This is a trigger callback function. This function is
- // intentionally left empty and is used as the trigger
- // callback function for triggers that don't want or need
- // any special callback function.
- // Note: The use of SCRIPT_API is used by all trigger functions
- // to ensure they are exported correctly. (Although,
- // technically it's not needed in this case since this
- // function has a function prototype defined in
- // RequiredExports.h which contains the SCRIPT_API macro
- // in it. However, most other trigger callback functions
- // won't have a function prototype anywhere (and you really
- // don't need to declare a function prototype since you
- // should never be calling a callback function yourself)
- // so you should use the SCRIPT_API macro when you define
- // the function.
- // Might as well set a good example. =)
- SCRIPT_API void NoResponseToTrigger()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement