Topic: EAW & OP?  (Read 2378 times)

0 Members and 1 Guest are viewing this topic.

Remus

  • Guest
EAW & OP?
« on: March 09, 2004, 12:52:00 am »
Are there any major differences between the EAW and the OP API's? For example, if I had a script that ran on EAW, how much work would it take to make it run on OP (with the OP api of course)?

Thanks in advance
 

FPF_TraceyG

  • Guest
Re: EAW & OP?
« Reply #1 on: March 09, 2004, 08:24:03 pm »
The EAW API is a subset of the OP API. Generally, any scripts written for EAW will compile in OP, however, there are a few differences that you need to be aware of.
Firstly, EAW does not have any Pirate Cartels, so you need to change anything race specific (like mission briefings) to include the cartels. There are extra functions you can use in the OP API (such as mSetFighters).

Dave passed the following on to me awhile back in regard to OP/EAW mission portability:

Quote:


(1) In the "main" script .h file, add the following code snippet (a nice little OP-detection gimmick courtesy of Magnumman)

Code:
--------------------------------------------------------------------------------

// For EAW/OP detection
#include "soundnums.h"
#ifdef kSndPhaserFire
#define EAW 1
#else
#define OP 1
#endif


--------------------------------------------------------------------------------


(2) In the "main" script .cpp file, modify the mDefineBriefings method so that if the mission is compiled under OP the cartels get their briefings. Here's a pretty typical example:

Code:
--------------------------------------------------------------------------------

void tMet_13Monster::mDefineBriefings( void )
{
   eRace lastteam = kMirak;

// update the briefing list if this is being compiled for OP
#ifdef OP
   lastteam = kOrionCamboro;
#endif

   for ( int32 j = kFederation; j <= lastteam; j++ )
   {

      fBriefingIndex[kDefendTeam1][j] = kBriefing_msg;
      fBriefingIndex[kDefendTeam2][j] = kBriefing_msg;
      fBriefingIndex[kDefendTeam3][j] = kBriefing_msg;
   }
}
For most missions that's all that is required - you can now compile the mission under OP or EAW. The only exceptions are missions that require shiptypes the cartels don't have - i.e. bases and frds. For those missions I usually generate a (non-playable) Orion base or whatever.






Hope this helps.

Karnak

  • Guest
Re: EAW & OP?
« Reply #2 on: March 09, 2004, 09:03:10 pm »
I always thought the above  OP settings was a bit of over-kill. Since, I like to use lotsa different pre-processor definitions, I would just make one for OP (ie. I made up SFCOP).  It's a little more labor-intensive but I like to do it cuz I always know that my own user-defined pre-processor definition will control whether to use OP-specific script code rather than rely on the API in case it's ever changed.

Really all you need to do is to goto the main file of your script and put in this code for the briefing messages:


void tMainFile::mDefineBriefings( void )
{
#ifdef SFCOP
   for ( int32 j = kFederation; j <= kOrionCamboro; j++ )
#else
   for ( int32 j = kFederation; j <= kMirak; j++ )
#endif
   {
      for ( int32 i = kDefendTeam1; i <= kAttackTeam3; i++ )
      {
         fBriefingIndex[j] = kBriefing_msg;
      }
   }
}

and you are done.

Basically, I just made up a pre-processor definition called SFCOP and compiled the code for OP.  Just remove the SFCOP pre-processor definition when compiling for EAW which will probably never happen.

Plus, the era settings work in OP so you can use the following code in the team files:

#ifdef SFCOP
      int32 iEra = fMissionInfo->mGetEra();
      if (iEra == 0)
          {do Early Era stuff}
                                          else if (iEra == 1)
                                               {do Middle Era Stuff}
                                         else if (iEra == 2)
                                              {do Late Era stuff}
                                         else
                                              {can't remember if Advanced Era works but no one likes this era. Since no one uses this era it shows how much it's worth playing with when I forgot tests I did with this era 8 months ago.  }
#endif
                                     

 
« Last Edit: December 31, 1969, 06:00:00 pm by Karnak »

Remus

  • Guest
Re: EAW & OP?
« Reply #3 on: March 10, 2004, 08:27:37 am »
That's what I needed. Thanks guys