Author Topic: Outpost 2 Function File: Op2ff  (Read 2361 times)

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Outpost 2 Function File: Op2ff
« on: July 20, 2006, 05:43:01 PM »
I've compiled all of the functions I've wrote to help me code op2 missions into two files to help other people get their missions done faster and easier. I'm going to put the files up here for download to help who ever might want to use them. From time to time I'll update the files with new functions. I've also tried to explain everything as fully as I reasonably can to help new coders get a hold on things, if you need further explaination, feel free to ask me.

File Downloads: Last updated on Tuesday August 8th, 2006

Generic Files:
Op2FF.h - Full Header
Op2FF.h - Abridged Header
Op2FF.cpp - Source

Greenworld Files:
Op2FF.h - Full Header
Op2FF.h - Abridged Header
Op2FF.cpp - Source

To use the files, download them into the folder where you have your CodeBlocks project file. Then open the project and go to Project -> Add files... then select one of the Op2FF files and repeat for the other. Now both of the Op2FF files should be included in your project when it compiles. Finaly, you need to add the line:
Code: [Select]
#include "Op2FF.h"
near the top of Main.cpp (I would normaly put in below the line #include <OP2Helper.h>).

Also, read the Notes section of either header file for additional instructions.

I chose to have the functions availiable in this way over a library file (like op2Extra) to let the coder modify the files to their needs, and to remove the dependence on an independent library file.

If you have any functions you would like included in future versions, please talk to me on the irc.
« Last Edit: August 08, 2006, 11:29:18 AM by Mcshay »

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Outpost 2 Function File: Op2ff
« Reply #1 on: July 20, 2006, 07:30:13 PM »
Looks pretty good, should be pretty useful to many people :)

You might want to note that the EndGame() function ends the game in success (as if you've just won a multiplayer mission).

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Outpost 2 Function File: Op2ff
« Reply #2 on: July 21, 2006, 03:27:27 AM »
Thanks for this work :)

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Outpost 2 Function File: Op2ff
« Reply #3 on: July 21, 2006, 12:02:16 PM »
Today I updated the files.

EndGame would cause an error if you didn't use it in your mission, so I changed some things around (basicaly i had to flip two lines of code, one in the DllMain patch and one in Op2FF.h).

I also made the SetDisasters() function. It will create disasters in your map at hopefuly like in other multiplayer maps if disasters was checked in. However it needs some setup like EndGame. The coder has to change 4 macros in OP2FF.h to reflect the offset for the map ((+31,-1) or (-1,-1)) and the map width and height. The reason for the offsets is also explained.

Edit:

Files updated again to correct a problem in EndGame. It would end the game for everyone, instead of the local player.

I also put a Notes section into Op2FF.h that has important information concerning variables passed to the functions.
« Last Edit: July 21, 2006, 02:35:25 PM by Mcshay »

Offline Mcshay

  • Administrator
  • Sr. Member
  • *****
  • Posts: 404
Outpost 2 Function File: Op2ff
« Reply #4 on: August 08, 2006, 11:31:30 AM »
Added files for GreenWorld (with water) maps. The only new feature for this set of files, is the CheckBridges() function (when a call to it is placed in AIProc), which manages all bridges defined in the header.