ADemo1

From OPU Wiki

(Redirected from Ademo1.dll)


Below is a source file that, when compiled, will create the "mission" ADemo1.dll

See also:

ADemo1.cpp


/*

File:        ADemo1.cpp
Author:      Dynamix/Sierra Online
Description: Original AutoDemo file

Source extracted by Eddy-B

*/

#include <windows.h>
#include "Outpost2DLL.h"

#define EXPORT extern "C" __declspec(dllexport)


EXPORT char MapName[]      = "eden04.map";
EXPORT char LevelDesc[]    = "AutoDemo #1        "; 
EXPORT char TechtreeName[] = "PLY_TEK.TXT";
EXPORT SDescBlock DescBlock= { AutoDemo, 2, 8, false };


// a UnitRecord is a set of units (buildings and/or vehicles)
// that are predefined, and can be used mroe then once.
// to create them, use a UnitBlock (see below)

UnitRecord base[]=
{
  { mapConVec,       44,49,0,0,mapNone,16,0,0 },
  { mapAgridome,     49,49,0,0,mapNone,16,0,0 },
  { mapTokamak,      37,46,0,0,mapNone,16,0,0 },
  { mapCommandCenter,49,45,0,0,mapNone,16,0,0 },

  // a line of zeroes ends the list
  { mapNone,          0, 0,0,0,mapNone, 0,0,0 }
};

// this UnitBlock is EXPORTED (=can be accessed from outside this DLL)
// to access it, use it exactly as typed (including Capitals)

EXPORT UnitBlock Group1(base); 



// ------------------------
// == Module entry point ==
// ------------------------

BOOL APIENTRY DllMain(HANDLE,DWORD,LPVOID)
{
   return TRUE;
}



// ---------------------
// == Other functions ==
// ---------------------

void SetupMiningRoute()
{
  Unit u,smelter,mine;
  MiningGroup grp;

  // create base, using the earlier defined UnitBlock
  TethysGame::CreateUnitBlock(Player[1],"Group1",0);

  // create the smelter & mine
  TethysGame::CreateUnit(smelter,mapCommonOreSmelter,LOCATION(44,45),1,mapNone,0);
  TethysGame::CreateUnit(mine,mapCommonOreMine,LOCATION(38,33),1,mapNone,0);

  // create the mining group, and add the smelter & mine to it
  grp=CreateMiningGroup(Player[1]);
  grp.Setup(mine,smelter,MAP_RECT(38,37,40,43));

  // create 2 trucks, and put them in the mining group
  TethysGame::CreateUnit(u,mapCargoTruck,LOCATION(41,42),1,mapNone,0);
  grp.TakeUnit(u);
  TethysGame::CreateUnit(u,mapCargoTruck,LOCATION(46,46),1,mapNone,0);
  grp.TakeUnit(u);
}

// this function is EXPORTED (=can be accessed from outside this DLL)
// to call it, use it exactly as typed (including Capitals)
EXPORT void Tornado1()
{
  // 34,33   start tornado at (3,34)
  // 17      tornado duration=17 
  // 50,52   have it move towards (19,53)
  // 1       and make it appear right away

  TethysGame::SetTornado(34,33, 17, 50,52, 1);
}



// ----------------------
// == Required exports ==
// ----------------------

EXPORT void AIProc()
{
}

EXPORT int  StatusProc()
{
  return 0;
}

EXPORT void NoResponseToTrigger()
{
}



// --------------
// == InitProc ==
// --------------

EXPORT int InitProc()
{
  // Player[0] is the human player
  // Player[1] is the first "AI" player
  Player[0].GoPlymouth();
  Player[1].GoEden();
  Player[1].SetColorNumber(5);

  // connect buildings
  TethysGame::CreateWallOrTube(47,45,0,mapTube);
  TethysGame::CreateWallOrTube(49,47,0,mapTube);

  // create a mining beaco
  TethysGame::CreateBeacon(mapMiningBeacon,37,33,0,1,-1);

  // create base & set up the mining route
  SetupMiningRoute();

  // set initial stuff
  Player[1].SetWorkers(45);
  Player[1].SetScientists(25);
  Player[1].SetKids(20);
  Player[1].SetFoodStored(100);
  Player[1].SetOre(3000);
  Player[1].SetRareOre(2000);

  // Morale will be poor
  TethysGame::ForceMoralePoor(-1);

  // this is a demo. make sure we can see everything
  Player[0].CenterViewOn(42,44);

  // make everything dark
  TethysGame::SetDaylightEverywhere(0);

  // disable cheats (they don't work anyway)
  TethysGame::SetCheatFastUnits(0);
  TethysGame::SetCheatFastProduction(0);
  TethysGame::SetCheatUnlimitedResources(0);
  TethysGame::SetCheatProduceAll(0);

  // wait 1200 ticks (=12 marks), then call the VictoryCondition
  Trigger trig=CreateTimeTrigger(1,1,1200,"NoResponseToTrigger");
  CreateVictoryCondition(1,1,trig,
    "      Outpost 2 demo mode.\n\nPress any key to return to the Main Menu.");

  // wait 100 ticks, then call "Tornado1"
  CreateTimeTrigger(1,1,100,"Tornado1");

  return 1;
}

Personal tools