Formatting/Info

This commit is contained in:
ChocoTaco 2019-02-18 23:24:42 -05:00
parent 487dd94044
commit 98e7ff7170

View file

@ -2,6 +2,8 @@
// - To Further Randomize Map Rotation
// - Keep Track of maps so they arnt chosin again
//
// - Set $Host::ClassicRandomMissions to 2 to activate
// - $Host::ClassicRandomMissions = 2;
package DarkTigerMapRotation
{
@ -22,6 +24,7 @@ function getNextMission( %misName, %misType )
echo("Error: Could not find matching game type in function " @ "getNextMission( " @ %misName @", " @%misType @ " ).\n");
return -1;
}
%EvoTempMissionListLength = 0;
%EvoCurrentMissionIndex = -1;
@ -111,14 +114,17 @@ function buildMissionList()
{
%search = "missions/*.mis";
%fobject = new FileObject();
for(%file = findFirstFile(%search); %file !$= ""; %file = findNextFile(%search))
{
// get the name
%name = fileBase(%file);
%idx = $HostMissionCount;
$HostMissionCount++;
$HostMissionFile[%idx] = %name;
$HostMissionName[%idx] = %name;
if(!%fobject.openForRead(%file))
continue;
@ -218,6 +224,7 @@ function getRSGN(%min,%max,%id)
}
%rng = getRandom(%min,%max - $rngCount[%id] ); // find random number - the total number we have done
for(%i = %min; %i <= %max; %i++) // loop cycle though all possable numbers
{
if($RngList[%id,%i]) // skip over ones that we have all ready used
@ -225,17 +232,22 @@ function getRSGN(%min,%max,%id)
continue;
}
%c++; // skip counter
if(%rng == %c) // onces the skip counter matches the rng number we have landed on a valid number that we havent used yet
{
break; // kill the loop
}
}
$rngList[%id,%i] = 1;// this marks said number as used
$rngCount[%id]++;// up are total used numbers
$rngLast[%id] = %i; // for when the list resets it wont pick the same number twice
if(%i > %max || %i < %min){ // fail safe
if(%i > %max || %i < %min)
{ // fail safe
return %max;
}
return %i; // return the one we stoped on
}
@ -250,6 +262,7 @@ function addRotationMap(%file, %type, %ffa, %cycle)
{
%cycle = %ffa;
}
if(isFile("missions/" @ %file @ ".mis"))
{
if(%type $= "TR2" && !$Host::ClassicLoadTR2Gametype) // load TR2 gametype?