Jump to content

UI Editing


johnnylump

Recommended Posts

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

I just started looking into modifying the SWF files yesterday and I'm way behind with what's happened over the past couple of months, so I'm struggling to keep up with everything!

 

Are people still using dumbo111's method of stripping the SWFs out of the UPKs manually, one by one and replacing the first 3 bytes with FWS? If you haven't already found a SWF extractor, I could write one if it'd be useful and you aren't already using a tool that does this.

 

It's funny you mention the gfxXComIcons directory because I have it open at the moment and is where I found the perk icons I'm using for the Perk Tree Builder, so I doubt you'll find the icons in the SWF files too, but I could be wrong, I currently know very little about SWF editing :smile:

 

I'm not sure if you already know, but you can use Umodel to extract the game assets (including textures) from the UPKs, if that's what you're after :smile:

 

There are so many things I want to look into, but I want to get this Perk Tree builder finished first. Hopefully once that's done, I'll be of more use helping with other bits, although I've got a lot of catching up to do! :smile:

 

RI-08FieldMarshall.tga

http://i.imgur.com/NkZ5TdG.jpg

 

See, this is what we can accomplish when we all work together! :biggrin:

 

I poked around on the web for a tool to get the icons out, but couldn't find one.... THANK YOU!

 

As to stripping out the SWF files ... so far I've just bootstrapped off of johnnylump's extracted files, which he sent me.

 

If you were to write the extraction code, EliotVU might even include it in a future release of UE Explorer :smile:

 

A slightly easier way to find the SWF files to extract is based on information here: http://www-lehre.inf.uos.de/~fbstark/diplom/docs/swf/Intro.htm -- which decribes the SWF header structure.

 

The SWF ascii characters are replaced by GFX, and the version number for GFX appears to usually be 8 or 9 (instead of 3 or 4 for flash), but the next 4 byte integer is the file size. Here is the more automated way to get the SWF file out:

 

1) Search for GFX (all caps).

2) Skip next byte -- it is version number

3) Next four bytes are the SWF file size.

4) Add the file size to the hex location of the "G" in GFX

5) resultant position is end of embedded SWF file

6) As a double check, four bytes immediately following the embedded SWF file should be FF FF FF FF

Link to comment
Share on other sites

There also appears to be a mission SWF file somewhere. I can't find any of the AS_ commands for the interception engagements.

 

Examples include:

  • AS_DisplayEffectEvent
  • AS_AttackEvent
  • AS_MovementEvent

These are all called from XcomStrategyGame.upk >> UIInterceptionEngagement

 

 

I did find 20 additional SWF files embedded into XcomShell.upk:

 

The part in parentheses appears to be the SWF file name (it appears soon after the GFX characters). The other bits are included packages ... they appear just BEFORE the GFX characters.

 

1) (AnchoredMessageMgrD) gfxComponents.components.....gfxxcomicons.xcomicons
2) (GameplayTogglesD) gfxComponents.components.....gfxGamepadIcons.GamepadIcons
3) (InputDialogueD) gfxComponents.components
4) (ItemCardsD) gfxXComIcons.XComIcons.....gfxComponents.components
5) (MapListD) gfxComponents.components
6) (MessageMgrD)
7) (MiniLoadoutEditorD) gfxGamepadIcons.GamepadIcons.....gfxComponents.components
8 ) (MultiplayerCustomMatchD) gfxGamepadIcons.GamepadIcons.....gfxComponents.components
9) (MultiplayerLeaderboards) gfxComponents.components.....gfxGamepadIcons.GamepadIcons
10) (MultiplayerLoadoutD) gfxGamepadIcons.GamepadIcons.....gfxComponents.components
11) (MultiplayerPlayerStats) gfxComponents.components
12) (MultiplayerServerBrowserD) gfxcomponents.components.....gfxGamepadIcons.GamepadIcons.....gfxXComIcons.XComIcons
13) (MultiplayerSetupD) gfxComponents.components.....gfxGamepadIcons.GamepadIcons
14) (MultiplayerShellD) gfxComponents.components
15) (SaveExplanationScreenD) gfxGamepadIcons.GamepadIcons.....gfxComponents.components.....gfxxcomicons.xcomicons
16) (ServerBrowserD) gfxComponents.components.....gfxGamepadIcons.GamepadIcons
17) (ShellD)
18) (SinglePlayerLoadoutD) gfxComponents.components
19) (SPMiniLoadoutEditorD) gfxComponents.components
20) (StartScreenD) -- gfxGamepadIcons.GamepadIcons.....gfxComponents.components
Link to comment
Share on other sites

There also appears to be a mission SWF file somewhere. I can't find any of the AS_ commands for the interception engagements.

 

Examples include:

  • AS_DisplayEffectEvent
  • AS_AttackEvent
  • AS_MovementEvent
These are all called from XcomStrategyGame.upk >> UIInterceptionEngagement

 

 

gfxInterception_SF.upk > gfxInterception_SF_00 (the first SWF in the file) > InterceptionEngagement.as

 

:smile:

Link to comment
Share on other sites

Oh ... regarding the perk tree ... I found enough space to build a full perk tree with up to three icons per level. (Actually, I found enough space that I could build FOUR icons per level, but I'm thinking I'll stick with three).

 

After I get that in, the next step is to modify the upk files so that an icon will only load if the ability set by XcomPerkManager.GetPerkInTree<class> returns a non-zero value. (The icon will be invisible otherwise). This will allow more dynamic customization of both the type AND number of perks in the perk tree.

 

The idea is that there will be a 'right', 'center', and 'left' icon available for each level. To keep things pretty, if a level only has one perk choice, then use 'center'. If it has two, then use 'right' and 'left'. And of course use all three if there are three.

 

So far I've only been able to squeeze 17 perk choices into the GetPerkInTree<class> functions by using case statements. This means that at max 3 levels could have 3 perks and the other 4 levels could have 2 perks (3*3 + 4*2 = 17), but with 21 icon locations the selection of which levels get the perks will be more open.

 

If anyone can figure out how to squeeze more perk choices into those functions (while still allowing returning zero for any perk slots specified as "inactive"), I'd appreciate it!

Link to comment
Share on other sites

 

 

There also appears to be a mission SWF file somewhere. I can't find any of the AS_ commands for the interception engagements.

 

Examples include:

  • AS_DisplayEffectEvent
  • AS_AttackEvent
  • AS_MovementEvent
These are all called from XcomStrategyGame.upk >> UIInterceptionEngagement

gfxInterception_SF.upk > gfxInterception_SF_00 (the first SWF in the file) > InterceptionEngagement.as

 

:smile:

I thought sure that was it, too. However, there are no text strings matching "AttackEvent", "MovementEvent", etc in that file, which indicates that these are not scripts as in the other UI SWF files. I'm not sure how they are linked.

 

Anyhow, I'm going to back to trying to finish up this Perk tree sprite to allow 21 perk icons to be displayed. Keep getting sidetracked by other UI editing possibilities, though ~_~

Edited by Amineri
Link to comment
Share on other sites

Oh ... regarding the perk tree ... I found enough space to build a full perk tree with up to three icons per level. (Actually, I found enough space that I could build FOUR icons per level, but I'm thinking I'll stick with three).

 

After I get that in, the next step is to modify the upk files so that an icon will only load if the ability set by XcomPerkManager.GetPerkInTree<class> returns a non-zero value. (The icon will be invisible otherwise). This will allow more dynamic customization of both the type AND number of perks in the perk tree.

 

The idea is that there will be a 'right', 'center', and 'left' icon available for each level. To keep things pretty, if a level only has one perk choice, then use 'center'. If it has two, then use 'right' and 'left'. And of course use all three if there are three.

 

So far I've only been able to squeeze 17 perk choices into the GetPerkInTree<class> functions by using case statements. This means that at max 3 levels could have 3 perks and the other 4 levels could have 2 perks (3*3 + 4*2 = 17), but with 21 icon locations the selection of which levels get the perks will be more open.

 

If anyone can figure out how to squeeze more perk choices into those functions (while still allowing returning zero for any perk slots specified as "inactive"), I'd appreciate it!

Not sure if you've seen it, that answers my question in this thread :smile: . As I mentioned there, I might have a way to enable more perks in the UPK, but it's just a theory at the moment, will have to work it out. I'll keep you posted in that thread :)

I thought sure that was it, too. However, there are no text strings matching "AttackEvent", "MovementEvent", etc in that file, which indicates that these are not scripts as in the other UI SWF files. I'm not sure how they are linked.

Are you sure? :wink:

 

 

class InterceptionEngagement extends Screen implements IDisposable

{

var playerClosedIn, damageLabel, localToGlobal, weaponContainer, combatContainer, damageDiagram, abilityStatusBox, statusBox, statusBoxTextFieldStartY, theResultsPanel, resultsPanel, txtAborting, abortingPanel, enemyEscapeTimer, establishingLinkBox, establishingLinkPanel, btnAbort, abortBtn, btnDodge, dodgeBtn, btnAim, aimBtn, btnTrack, trackBtn, trackingMC, alienShip, playerShip, playerEscapeLocationInShipSpace, enemyEscapeLocationInShipSpace, standardShotDistance, introSequenceNumSweeps, combatMask, sweepAnimation, closeDistanceLocation, activeAlienWeaponIDs;

function InterceptionEngagement()

{

super();

playerClosedIn = false;

if (_global.debugging)

{

Environment.instance().setMouseActive(false);

} // end if

} // End of the function

function onLoad()

{

super.onLoad();

damageLabel.text = "";

var _loc4 = new flash.geom.Point();

this.localToGlobal(_loc4);

weaponContainer._x = _loc4.x;

weaponContainer._x = _loc4.y;

combatContainer = combatContainer;

combatContainer._visible = _global.debugging == true ? (true) : (false);

combatContainer._visible = false;

damageDiagram = damageDiagram;

statusBox = abilityStatusBox;

statusBoxTextFieldStartY = statusBox.textField._y;

statusBox._visible = false;

resultsPanel = theResultsPanel;

(XComButton)(resultsPanel.leaveReportButton).setStyle(XComButton.STYLE_HOTLINK_BUTTON, XComButton.FONT_SIZE_3D, false);

this.SetResultsTitleLabels();

abortingPanel = txtAborting;

enemyEscapeTimer = enemyEscapeTimer;

establishingLinkPanel = establishingLinkBox;

establishingLinkPanel._visible = false;

abortBtn = btnAbort;

abortBtn._visible = false;

dodgeBtn = btnDodge;

dodgeBtn._visible = false;

aimBtn = btnAim;

aimBtn._visible = false;

trackBtn = btnTrack;

trackBtn._visible = false;

trackingMC = enemyEscapeTimer.trackingText.mcWithin;

trackingMC.txtField.autoSize = true;

this.SetTrackingLabel();

resultsPanel._visible = false;

abortingPanel._visible = false;

ALIEN_TRACKING_ENABLED = false;

INTERCEPTOR_AIM_ENABLED = false;

INTERCEPTOR_DODGING_ENABLED = false;

} // End of the function

function InitializeData(playerShipType, alienShipType, _damageLabel, establishingLinkLabel, timeSufix)

{

trace ("IntercetionEngagement - InitializeData: enemyShip=\"" + AlienShip.getShipLabel(alienShipType) + "\"");

shipScaleModifier = AlienShip.getCombatScale(alienShipType);

combatContainer.gotoAndStop(AlienShip.getShipLabel(alienShipType));

combatContainer._xscale = 100 * InterceptionEngagement.shipScaleModifier;

combatContainer._yscale = 100 * InterceptionEngagement.shipScaleModifier;

alienShip = combatContainer.alienTarget;

playerShip = combatContainer.playerShip;

playerEscapeLocationInShipSpace = new flash.geom.Point(combatContainer.playerEscapeLocationSquare._x, combatContainer.playerEscapeLocationSquare._y);

enemyEscapeLocationInShipSpace = new flash.geom.Point(combatContainer.ufoEscapeLocationSquare._x, combatContainer.ufoEscapeLocationSquare._y);

combatContainer.localToGlobal(playerEscapeLocationInShipSpace);

combatContainer.localToGlobal(enemyEscapeLocationInShipSpace);

var _loc4 = new flash.geom.Point(playerShip._x, playerShip._y);

var _loc3 = new flash.geom.Point(alienShip._x, alienShip._y);

playerShip._x = 0;

playerShip._y = 0;

playerShip.globalToLocal(playerEscapeLocationInShipSpace);

alienShip._x = 0;

alienShip._y = 0;

alienShip.globalToLocal(enemyEscapeLocationInShipSpace);

playerShip._x = _loc4.x;

playerShip._y = _loc4.y;

alienShip._x = _loc3.x;

alienShip._y = _loc3.y;

alienShip.Initialize(0, true, this);

playerShip.Initialize(0, false, this);

alienShip.SetShipType(alienShipType);

playerShip.SetShipType(playerShipType);

playerShip.UpdateFiringLocation();

alienShip.UpdateFiringLocation();

var _loc7 = alienShip.GetGlobalFiringLocation();

var _loc6 = playerShip.GetGlobalFiringLocation();

var _loc8 = _loc6.subtract(_loc7);

standardShotDistance = _loc8.length;

damageLabel.text = _damageLabel;

this.ShowEstablishingLinkLabel(establishingLinkLabel);

introSequenceNumSweeps = 0;

if (_global.debugging)

{

combatMask.gotoAndPlay("_intro");

} // end if

} // End of the function

function BeginIntroSequence(trackingText)

{

this.SetTrackingLabel(trackingText);

sweepAnimation.onSweepMiddle = mx.utils.Delegate.create(this, function ()

{

++introSequenceNumSweeps;

if (introSequenceNumSweeps == InterceptionEngagement.INTRO_SEQUENCE_NUM_SWEEPS - 1)

{

} // end if

if (introSequenceNumSweeps <= InterceptionEngagement.INTRO_SEQUENCE_NUM_SWEEPS)

{

}

else

{

delete sweepAnimation.onSweepMiddle;

} // end else if

});

sweepAnimation.onSweepComplete = mx.utils.Delegate.create(this, function ()

{

if (introSequenceNumSweeps == InterceptionEngagement.INTRO_SEQUENCE_NUM_SWEEPS - 1)

{

this.SetTrackingLabel("");

this.ShowEstablishingLinkLabel("");

setTimeout(mx.utils.Delegate.create(this, function ()

{

combatContainer._visible = true;

combatMask.gotoAndPlay("_intro");

}), 850);

} // end if

if (introSequenceNumSweeps > InterceptionEngagement.INTRO_SEQUENCE_NUM_SWEEPS)

{

sweepAnimation.stop();

sweepAnimation._visible = false;

delete sweepAnimation.onSweepMiddle;

delete sweepAnimation.onSweepComplete;

this.SetTrackingLabel("");

this.ShowEstablishingLinkLabel("");

flash.external.ExternalInterface.call("FlashRaiseCommand", String(this), "IntroSequenceComplete");

} // end if

});

} // End of the function

function AttackEvent(sourceShipID, targetShipID, weapon, weaponID, newTargetHP, attackDuration, hit)

{

trace ("AttackEvent: sourceShip=" + sourceShipID + ", targetShip=" + targetShipID + ", weapon=" + weapon + ", weaponID=" + weaponID + ", attackDuration=" + attackDuration + ", hit=" + hit);

if (playerClosedIn && hit)

{

attackDuration = this.CalculateDurationOffsetBasedOnDistance(attackDuration);

} // end if

if (sourceShipID == 0)

{

if (!alienShip.IsDead() || _global.debugging)

{

alienShip.Fire(playerShip, weapon, weaponID, newTargetHP, attackDuration, hit);

} // end if

}

else if (!playerShip.IsDead() || _global.debugging)

{

playerShip.Fire(alienShip, weapon, weaponID, newTargetHP, attackDuration, hit);

} // end else if

} // End of the function

function CalculateDurationOffsetBasedOnDistance(duration)

{

playerShip.UpdateFiringLocation();

var _loc4 = alienShip.GetGlobalFiringLocation();

var _loc3 = playerShip.GetGlobalFiringLocation();

var _loc6 = _loc3.subtract(_loc4);

var _loc5 = _loc6.length;

var _loc2 = duration * _loc5 / standardShotDistance;

return (_loc2);

} // End of the function

function MovementEvent(sourceShipID, moveEventType, moveDuration)

{

if (moveEventType == InterceptionEngagement.eUFO_Escape)

{

}

else if (moveEventType == InterceptionEngagement.ePlayer_CloseDistance)

{

if (!playerShip.IsDead())

{

playerClosedIn = true;

playerShip.ShipMoveToLocation(closeDistanceLocation, moveDuration);

}

else

{

trace ("ERROR: Attempted to process \'ePlayer_CloseDistance\' event while player ship is dead.");

} // end else if

} // end else if

} // End of the function

function DisplayEffectEvent(displayEffectType, effectDescription, enabled, effectData)

{

switch (displayEffectType)

{

case InterceptionEngagement.eEnhancedAccuracy:

{

INTERCEPTOR_AIM_ENABLED = enabled;

playerShip.EnableDisableAim(enabled, alienShip, effectData);

if (enabled)

{

this.SetAbilityState(aimBtn, InterceptionEngagement.ABILITY_ACTIVE);

}

else

{

this.SetAbilityState(aimBtn, InterceptionEngagement.ABILITY_DISABLED);

effectDescription = "";

} // end else if

break;

}

case InterceptionEngagement.eDodgeHits:

{

INTERCEPTOR_DODGING_ENABLED = enabled;

playerShip.EnableDisableDodging(enabled);

if (enabled)

{

this.SetAbilityState(dodgeBtn, InterceptionEngagement.ABILITY_ACTIVE);

INTERCEPTOR_BULLETS_LEFT_TO_DODGE = effectData;

}

else

{

this.SetAbilityState(dodgeBtn, InterceptionEngagement.ABILITY_DISABLED);

LAST_DODGED_BULLET_ID = effectData;

INTERCEPTOR_BULLETS_LEFT_TO_DODGE = 0;

effectDescription = "";

} // end else if

break;

}

case InterceptionEngagement.eTrack:

{

ALIEN_TRACKING_ENABLED = enabled;

playerShip.EnableDisableTracking(enabled);

if (enabled)

{

this.SetAbilityState(trackBtn, InterceptionEngagement.ABILITY_ACTIVE);

}

else

{

this.SetAbilityState(trackBtn, InterceptionEngagement.ABILITY_DISABLED);

effectDescription = "";

} // end else if

break;

}

default:

{

trace ("ERROR: Incorrect parameter [" + displayEffectType + "] passed to InterceptionEngagement::DisplayEffectEvent() - valid range=" + InterceptionEngagement.eEnhancedAccuracy + " - " + InterceptionEngagement.eTrack);

}

} // End of switch

if (effectDescription != undefined)

{

this.SetAbilityStatusText(effectDescription);

} // end if

} // End of the function

function OnChildMouseEvent(target, type)

{

switch (type)

{

case Input.MOUSE_IN:

case Input.MOUSE_UP:

{

flash.external.ExternalInterface.call("FlashRaiseMouseEvent", String(this), type, String(target));

break;

}

} // End of switch

} // End of the function

function SetResultsTitleLabels(title, subtitle)

{

resultsPanel.titleField.text = title != undefined ? (title) : ("");

resultsPanel.subtitleField.text = subtitle != undefined ? (subtitle) : ("");

} // End of the function

function ShowResults(_report, _gameResult, btnHelpLabel)

{

var _loc2 = resultsPanel.leaveReportButton;

var _loc3 = resultsPanel.report;

var _loc4 = resultsPanel.destroyedTextField;

this.SetAbilityStatusText("");

_loc3.text = _report;

_loc2.setText(btnHelpLabel);

_loc2.setIcon(Environment.instance().GetAdvanceButtonIcon());

resultsPanel._visible = true;

_loc4._visible = false;

trace ("ShowResults: result=" + _gameResult + ", playerDead=" + playerShip.IsDead());

if (!playerShip.IsDead())

{

playerShip.MatchOver();

} // end if

switch (_gameResult)

{

case InterceptionEngagement.eUFO_Destroyed:

{

alienShip.effectsMC.gotoAndPlay("_doestryed");

caurina.transitions.Tweener.addTween(playerShip, {_x: enemyEscapeLocationInShipSpace.x, delay: InterceptionEngagement.WIN_EXIT_DELAY, time: InterceptionEngagement.WIN_EXIT_DURATION, transition: "easeinquad"});

caurina.transitions.Tweener.addTween(playerShip, {_y: enemyEscapeLocationInShipSpace.y, delay: InterceptionEngagement.WIN_EXIT_DELAY, time: InterceptionEngagement.WIN_EXIT_DURATION, transition: "easeinquad"});

break;

}

case InterceptionEngagement.eUFO_Escaped:

{

alienShip.effectsMC.gotoAndPlay("_lostContact");

caurina.transitions.Tweener.addTween(playerShip, {_x: playerEscapeLocationInShipSpace.x, delay: InterceptionEngagement.LOSE_EXIT_DELAY, time: InterceptionEngagement.LOSE_EXIT_DURATION, transition: "easeinquad"});

caurina.transitions.Tweener.addTween(playerShip, {_y: playerEscapeLocationInShipSpace.y, delay: InterceptionEngagement.LOSE_EXIT_DELAY, time: InterceptionEngagement.LOSE_EXIT_DURATION, transition: "easeinquad"});

break;

}

case InterceptionEngagement.ePlayer_Aborted:

{

caurina.transitions.Tweener.addTween(playerShip, {_x: playerEscapeLocationInShipSpace.x, time: InterceptionEngagement.RETREAT_DURATION, transition: "easeinquad"});

caurina.transitions.Tweener.addTween(playerShip, {_y: playerEscapeLocationInShipSpace.y, time: InterceptionEngagement.RETREAT_DURATION, transition: "easeinquad"});

setTimeout(mx.utils.Delegate.create(this, function ()

{

alienShip.effectsMC.gotoAndPlay("_lostContact");

}), InterceptionEngagement.ALIEN_WIN_FADE_DELAY * 1000);

break;

}

case InterceptionEngagement.ePlayer_Destroyed:

{

if (alienShip.IsDead())

{

trace ("SUPER MEGA ERROR: Alien Ship somehow won after UI simulation doestroyed it. MEGA BUG!");

}

else

{

caurina.transitions.Tweener.addTween(alienShip, {_x: enemyEscapeLocationInShipSpace.x, time: InterceptionEngagement.ALIEN_RETREAT_DURATION, transition: "easeinquad"});

caurina.transitions.Tweener.addTween(alienShip, {_y: enemyEscapeLocationInShipSpace.y, time: InterceptionEngagement.ALIEN_RETREAT_DURATION, transition: "easeinquad"});

setTimeout(mx.utils.Delegate.create(this, function ()

{

alienShip.effectsMC.gotoAndPlay("_lostContact");

}), InterceptionEngagement.ALIEN_WIN_FADE_DELAY * 1000);

} // end else if

break;

}

} // End of switch

resultsPanel.gotoAndPlay("_intro");

} // End of the function

function SetTrackingLabel(txt)

{

if (txt != undefined && txt != "")

{

trackingMC.txtField.text = txt;

trackingMC._visible = true;

}

else

{

trackingMC._visible = false;

} // end else if

} // End of the function

function ShowEstablishingLinkLabel(txt)

{

if (txt != undefined && txt != "")

{

establishingLinkPanel.txtField.text = txt;

establishingLinkPanel._visible = true;

}

else if (establishingLinkPanel._visible == true)

{

establishingLinkPanel.gotoAndPlay("_outro");

} // end else if

} // End of the function

function SetAbortLabel(txt)

{

abortingPanel.txtField.text = txt;

abortingPanel._visible = true;

} // End of the function

function SetAbortButtonText(txt)

{

abortBtn.textField.text = txt;

if (Environment.instance().IsMouseActive())

{

abortBtn.gamepadHelpIcon._visible = false;

}

else

{

abortBtn.gamepadHelpIcon.gotoAndStop(Environment.instance().GetBackButtonIcon());

} // end else if

abortBtn._visible = true;

} // End of the function

function SetDodgeButton(buttonLabel, state)

{

dodgeBtn.textField.htmlText = "" + buttonLabel + "";

dodgeBtn.originalTxt = buttonLabel;

if (Environment.instance().IsMouseActive())

{

dodgeBtn.gamepadHelpIcon._visible = false;

}

else

{

dodgeBtn.gamepadHelpIcon.gotoAndStop(Environment.instance().GetAdvanceButtonIcon());

} // end else if

this.SetAbilityState(dodgeBtn, state);

} // End of the function

function SetTrackButton(buttonLabel, trackingText, state)

{

trackBtn.textField.htmlText = "" + buttonLabel + "";

trackBtn.originalTxt = buttonLabel;

trackingMC.txtField.text = trackingText;

if (Environment.instance().IsMouseActive())

{

trackBtn.gamepadHelpIcon._visible = false;

}

else

{

trackBtn.gamepadHelpIcon.gotoAndStop("Icon_Y_TRIANGLE");

} // end else if

this.SetAbilityState(trackBtn, state);

} // End of the function

function SetAimButton(buttonLabel, state)

{

aimBtn.textField.htmlText = "" + buttonLabel + "";

aimBtn.originalTxt = buttonLabel;

if (Environment.instance().IsMouseActive())

{

aimBtn.gamepadHelpIcon._visible = false;

}

else

{

aimBtn.gamepadHelpIcon.gotoAndStop("Icon_X_SQUARE");

} // end else if

this.SetAbilityState(aimBtn, state);

} // End of the function

function SetAbilityState(abilityMC, state)

{

switch (state)

{

case InterceptionEngagement.ABILITY_AVAILABLE:

{

abilityMC._visible = true;

abilityMC.gotoAndPlay("_normal");

break;

}

case InterceptionEngagement.ABILITY_ACTIVE:

{

abilityMC._visible = true;

abilityMC.ActivateAbility();

break;

}

case InterceptionEngagement.ABILITY_DISABLED:

{

abilityMC._visible = true;

abilityMC.DeactivateAbility();

if (abilityMC.originalTxt != undefined)

{

abilityMC.textField.htmlText = "" + abilityMC.originalTxt + "";

} // end if

break;

}

case InterceptionEngagement.ABILITY_UNAVAILABLE:

{

abilityMC._visible = false;

break;

}

default:

{

trace ("ERROR: Incorrect parameter [" + state + "] passed to InterceptionEngagement::SetAbilityState() - valid range=" + InterceptionEngagement.ABILITY_AVAILABLE + " - " + InterceptionEngagement.ABILITY_UNAVAILABLE);

}

} // End of switch

} // End of the function

function AbortAttempted()

{

activeAlienWeaponIDs = alienShip.GetActiveWeaponIDs();

} // End of the function

function SetEnemyEscapeTimerLabels(title, secondsSufix)

{

enemyEscapeTimer.SetTitleAndSufix(title, secondsSufix);

} // End of the function

function SetEnemyEscapeTimer(timeLeft, secondsSufix)

{

if (enemyEscapeTimer.IsActive())

{

enemyEscapeTimer.SetTimeLeft(timeLeft);

}

else

{

enemyEscapeTimer.InitializeTimer(timeLeft);

} // end else if

} // End of the function

function IsMatchOver()

{

return (resultsPanel._visible == true);

} // End of the function

function AlienTakeDamage(damage)

{

if (!alienShip.IsDead())

{

var _loc2 = Number(alienShip.currHP - damage);

if (_loc2 <= 0)

{

_loc2 = 0.100000;

} // end if

trace ("Alien take damage: newHp=" + _loc2);

alienShip.SetHP(_loc2);

} // end if

} // End of the function

function PlayerTakeDamage(damage)

{

if (!playerShip.IsDead() && !InterceptionEngagement.INTERCEPTOR_DODGING_ENABLED)

{

var _loc2 = Number(playerShip.currHP - damage);

if (_loc2 <= 0)

{

_loc2 = 0.010000;

} // end if

trace ("Player take damage: newHp=" + _loc2);

if (!this.IsMatchOver())

{

playerShip.SetHP(_loc2);

} // end if

} // end if

} // End of the function

function SetHP(targetShipID, HP, initialize, weaponID)

{

if (HP < 0)

{

HP = 0;

} // end if

if (targetShipID == InterceptionEngagement.ALIEN_SHIP_ID)

{

if (initialize == true || HP <= 0)

{

trace ("Set Alien Ship HP from Unreal: newHP=" + HP + ", isDead=" + Boolean(HP <= 0));

alienShip.SetHP(HP);

} // end if

if (weaponID != -1)

{

playerShip.RemoveWeaponFromID(weaponID);

} // end if

}

else

{

if (initialize == true || HP <= 0)

{

trace ("Set Player Ship HP from Unreal: newHP=" + HP + ", isDead=" + Boolean(HP <= 0));

playerShip.SetHP(HP);

} // end if

if (weaponID != -1)

{

alienShip.RemoveWeaponFromID(weaponID);

} // end if

} // end else if

} // End of the function

function SetAbilityStatusText(txt)

{

trace ("SetAbilityStatusText() _visible=" + statusBox._visible + ", txt=" + txt);

if (statusBox._visible == true)

{

var _loc2 = statusBox.textField.htmlText;

statusBox.outroComplete = DelegateWithParams.create(this, SetAbilityStatusText, txt);

statusBox.gotoAndPlay("_outro");

statusBox.textField.htmlText = _loc2;

}

else

{

statusBox._visible = true;

statusBox.gotoAndPlay("_intro");

statusBox.textField.htmlText = txt;

trace ("TextHeight = " + statusBox.textField.textHeight);

if (statusBox.textField.textHeight > 24)

{

statusBox.textField._y = statusBoxTextFieldStartY - (statusBox.textField.textHeight - 24);

}

else

{

statusBox.textField._y = statusBoxTextFieldStartY;

} // end else if

} // end else if

} // End of the function

function MayDisengage()

{

var _loc3 = false;

if (!alienShip.IsDead() && activeAlienWeaponIDs != undefined)

{

for (var _loc2 = 0; _loc2 < activeAlienWeaponIDs.length; ++_loc2)

{

if (alienShip.IsWeaponActiveFromID(activeAlienWeaponIDs[_loc2]))

{

_loc3 = true;

continue;

} // end if

trace ("MayDisengage: weapon [" + activeAlienWeaponIDs[_loc2] + "] not in array, removing element.");

activeAlienWeaponIDs.splice(_loc2, 1);

--_loc2;

} // end of for

} // end if

return (!_loc3 ? (1) : (0));

} // End of the function

function SetCloseDistanceLocation(globalPoint)

{

closeDistanceLocation = globalPoint;

} // End of the function

function debugRandomFire(weaponType, alienFire)

{

if (!_global.debugging)

{

return;

} // end if

var _loc3 = random(50) < 24 ? (true) : (false);

debug_weapon_id = ++InterceptionEngagement.debug_weapon_id;

if (alienFire)

{

this.AttackEvent(0, 1, weaponType, InterceptionEngagement.debug_weapon_id, 1, _loc3 ? (0.300000) : (0.650000), _loc3);

return;

} // end if

this.AttackEvent(1, 0, weaponType, InterceptionEngagement.debug_weapon_id, 1, _loc3 ? (0.300000) : (0.650000), _loc3);

} // End of the function

function randRange(min, max)

{

var _loc1 = Math.floor(Math.random() * (max - min + 1)) + min;

return (_loc1);

} // End of the function

function onInput(code, action)

{

if (!_global.debugging)

{

return;

} // end if

switch (code)

{

case Input.KEY_1:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Avalanche);

break;

}

case Input.KEY_2:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Cannon);

break;

}

case Input.KEY_3:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Plasma);

break;

}

case Input.KEY_4:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Laser);

break;

}

case Input.KEY_5:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Fusion);

break;

}

case Input.KEY_6:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_UFOPlasmaI, true);

break;

}

case Input.KEY_7:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_UFOPlasmaII, true);

break;

}

case Input.KEY_8:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_UFOFusion, true);

break;

}

case Input.KEY_9:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Stingray, true);

break;

}

case Input.KEY_l:

{

this.SetAbortLabel("UFO Destroyed");

this.ShowResults("UFO Destroyed Result Test", InterceptionEngagement.eUFO_Destroyed, "LEAVE REPORT");

break;

}

case Input.KEY_n:

{

this.ShowResults("UFO Escape Result Test", InterceptionEngagement.eUFO_Escaped, "LEAVE REPORT");

break;

}

case Input.KEY_m:

{

this.SetHP(1, 0, false);

this.ShowResults("Player Destroyed Result Test\n\nPlayer Shot Down", InterceptionEngagement.ePlayer_Destroyed, "LEAVE REPORT");

break;

}

case Input.KEY_r:

{

this.ShowResults("Player Retreated Result Test\n\nPlayer Aborted", InterceptionEngagement.ePlayer_Aborted, "LEAVE REPORT");

break;

}

case Input.KEY_t:

{

this.DisplayEffectEvent(InterceptionEngagement.eTrack, "TRACK: Halts enemy escape for 5 seconds.\nReduces approach time for short range weapons.", !InterceptionEngagement.ALIEN_TRACKING_ENABLED);

break;

}

case Input.KEY_d:

{

this.DisplayEffectEvent(InterceptionEngagement.eDodgeHits, "DODGE: Causes pilot to evade next 2 enemy hits.", !InterceptionEngagement.INTERCEPTOR_DODGING_ENABLED);

break;

}

case Input.KEY_a:

case Input.BUTTON_A:

{

this.DisplayEffectEvent(InterceptionEngagement.eEnhancedAccuracy, "AIM: Guarantees next 2 shots will hit the target.", !InterceptionEngagement.INTERCEPTOR_AIM_ENABLED);

break;

}

case Input.KEY_q:

{

this.SetAbilityStatusText("ABILITY 1: This is a description of ability 1\'s effects.");

break;

}

case Input.KEY_w:

{

this.SetAbilityStatusText("ABILITY 2: This is a slightly longer description of ability 2\'s effects.");

break;

}

case Input.KEY_e:

{

this.SetAbilityStatusText("ABILITY 3: This is a much longer and in depth description of ability 3\'s effects which covers lots of little tiny details or something.");

break;

}

case Input.KEY_DELETE:

{

this.SetHP(0, 0, false);

this.ShowResults("UFO Destroyed Result Test", InterceptionEngagement.eUFO_Destroyed, "LEAVE REPORT");

break;

}

case Input.KEY_END:

{

this.SetHP(1, 0, false);

break;

}

case Input.KEY_0:

{

this.MovementEvent(1, InterceptionEngagement.ePlayer_CloseDistance, 3);

break;

}

} // End of switch

} // End of the function

function onPopulateDebugData()

{

if (!_global.debugging)

{

return;

} // end if

this.InitializeData(Ship.eShip_Interceptor, Ship.eShip_UFOAbductor, "SET IN INITIALIZE", "ESTABLISHING LINK...");

this.SetHP(0, 10, true, -1);

this.SetHP(1, 10, true, -1);

this.SetResultsTitleLabels("Interception Engagement", "STATUS REPORT");

this.SetAbortButtonText("ABORT");

this.SetAimButton("AIM", InterceptionEngagement.ABILITY_AVAILABLE);

this.SetDodgeButton("DODGE", InterceptionEngagement.ABILITY_AVAILABLE);

this.SetTrackButton("TRACK", "TRACKING", InterceptionEngagement.ABILITY_AVAILABLE);

this.SetEnemyEscapeTimerLabels("CONTACT LOST IN:", "s");

this.SetEnemyEscapeTimer(15);

this.BeginIntroSequence();

} // End of the function

static var INTRO_SEQUENCE_NUM_SWEEPS = 3;

static var ALIEN_SHIP_ID = 0;

static var MAX_NUM_PLAYER_SHIPS = 2;

static var RETREAT_DURATION = 1.500000;

static var WIN_EXIT_DELAY = 1.500000;

static var WIN_EXIT_DURATION = 4;

static var LOSE_EXIT_DURATION = 3.500000;

static var LOSE_EXIT_DELAY = 0.800000;

static var ALIEN_RETREAT_DURATION = 4;

static var ALIEN_WIN_FADE_DELAY = 1.500000;

static var ABILITY_AVAILABLE = 0;

static var ABILITY_ACTIVE = 1;

static var ABILITY_DISABLED = 2;

static var ABILITY_UNAVAILABLE = 3;

static var eUFO_Escape = 0;

static var ePlayer_CloseDistance = 1;

static var eUFO_Escaped = 0;

static var eUFO_Destroyed = 1;

static var ePlayer_Aborted = 2;

static var ePlayer_Destroyed = 3;

static var eEnhancedAccuracy = 0;

static var eDodgeHits = 1;

static var eTrack = 2;

static var ALIEN_TRACKING_ENABLED = false;

static var INTERCEPTOR_AIM_ENABLED = false;

static var INTERCEPTOR_DODGING_ENABLED = false;

static var INTERCEPTOR_BULLETS_LEFT_TO_DODGE = 0;

static var LAST_DODGED_BULLET_ID = -1;

static var shipScaleModifier = 1;

static var debug_weapon_id = 0;

} // End of Class

 

 

Edited by bokauk
Link to comment
Share on other sites

Are you sure? :wink:

 

 

class InterceptionEngagement extends Screen implements IDisposable

{

var playerClosedIn, damageLabel, localToGlobal, weaponContainer, combatContainer, damageDiagram, abilityStatusBox, statusBox, statusBoxTextFieldStartY, theResultsPanel, resultsPanel, txtAborting, abortingPanel, enemyEscapeTimer, establishingLinkBox, establishingLinkPanel, btnAbort, abortBtn, btnDodge, dodgeBtn, btnAim, aimBtn, btnTrack, trackBtn, trackingMC, alienShip, playerShip, playerEscapeLocationInShipSpace, enemyEscapeLocationInShipSpace, standardShotDistance, introSequenceNumSweeps, combatMask, sweepAnimation, closeDistanceLocation, activeAlienWeaponIDs;

function InterceptionEngagement()

{

super();

playerClosedIn = false;

if (_global.debugging)

{

Environment.instance().setMouseActive(false);

} // end if

} // End of the function

function onLoad()

{

super.onLoad();

damageLabel.text = "";

var _loc4 = new flash.geom.Point();

this.localToGlobal(_loc4);

weaponContainer._x = _loc4.x;

weaponContainer._x = _loc4.y;

combatContainer = combatContainer;

combatContainer._visible = _global.debugging == true ? (true) : (false);

combatContainer._visible = false;

damageDiagram = damageDiagram;

statusBox = abilityStatusBox;

statusBoxTextFieldStartY = statusBox.textField._y;

statusBox._visible = false;

resultsPanel = theResultsPanel;

(XComButton)(resultsPanel.leaveReportButton).setStyle(XComButton.STYLE_HOTLINK_BUTTON, XComButton.FONT_SIZE_3D, false);

this.SetResultsTitleLabels();

abortingPanel = txtAborting;

enemyEscapeTimer = enemyEscapeTimer;

establishingLinkPanel = establishingLinkBox;

establishingLinkPanel._visible = false;

abortBtn = btnAbort;

abortBtn._visible = false;

dodgeBtn = btnDodge;

dodgeBtn._visible = false;

aimBtn = btnAim;

aimBtn._visible = false;

trackBtn = btnTrack;

trackBtn._visible = false;

trackingMC = enemyEscapeTimer.trackingText.mcWithin;

trackingMC.txtField.autoSize = true;

this.SetTrackingLabel();

resultsPanel._visible = false;

abortingPanel._visible = false;

ALIEN_TRACKING_ENABLED = false;

INTERCEPTOR_AIM_ENABLED = false;

INTERCEPTOR_DODGING_ENABLED = false;

} // End of the function

function InitializeData(playerShipType, alienShipType, _damageLabel, establishingLinkLabel, timeSufix)

{

trace ("IntercetionEngagement - InitializeData: enemyShip=\"" + AlienShip.getShipLabel(alienShipType) + "\"");

shipScaleModifier = AlienShip.getCombatScale(alienShipType);

combatContainer.gotoAndStop(AlienShip.getShipLabel(alienShipType));

combatContainer._xscale = 100 * InterceptionEngagement.shipScaleModifier;

combatContainer._yscale = 100 * InterceptionEngagement.shipScaleModifier;

alienShip = combatContainer.alienTarget;

playerShip = combatContainer.playerShip;

playerEscapeLocationInShipSpace = new flash.geom.Point(combatContainer.playerEscapeLocationSquare._x, combatContainer.playerEscapeLocationSquare._y);

enemyEscapeLocationInShipSpace = new flash.geom.Point(combatContainer.ufoEscapeLocationSquare._x, combatContainer.ufoEscapeLocationSquare._y);

combatContainer.localToGlobal(playerEscapeLocationInShipSpace);

combatContainer.localToGlobal(enemyEscapeLocationInShipSpace);

var _loc4 = new flash.geom.Point(playerShip._x, playerShip._y);

var _loc3 = new flash.geom.Point(alienShip._x, alienShip._y);

playerShip._x = 0;

playerShip._y = 0;

playerShip.globalToLocal(playerEscapeLocationInShipSpace);

alienShip._x = 0;

alienShip._y = 0;

alienShip.globalToLocal(enemyEscapeLocationInShipSpace);

playerShip._x = _loc4.x;

playerShip._y = _loc4.y;

alienShip._x = _loc3.x;

alienShip._y = _loc3.y;

alienShip.Initialize(0, true, this);

playerShip.Initialize(0, false, this);

alienShip.SetShipType(alienShipType);

playerShip.SetShipType(playerShipType);

playerShip.UpdateFiringLocation();

alienShip.UpdateFiringLocation();

var _loc7 = alienShip.GetGlobalFiringLocation();

var _loc6 = playerShip.GetGlobalFiringLocation();

var _loc8 = _loc6.subtract(_loc7);

standardShotDistance = _loc8.length;

damageLabel.text = _damageLabel;

this.ShowEstablishingLinkLabel(establishingLinkLabel);

introSequenceNumSweeps = 0;

if (_global.debugging)

{

combatMask.gotoAndPlay("_intro");

} // end if

} // End of the function

function BeginIntroSequence(trackingText)

{

this.SetTrackingLabel(trackingText);

sweepAnimation.onSweepMiddle = mx.utils.Delegate.create(this, function ()

{

++introSequenceNumSweeps;

if (introSequenceNumSweeps == InterceptionEngagement.INTRO_SEQUENCE_NUM_SWEEPS - 1)

{

} // end if

if (introSequenceNumSweeps <= InterceptionEngagement.INTRO_SEQUENCE_NUM_SWEEPS)

{

}

else

{

delete sweepAnimation.onSweepMiddle;

} // end else if

});

sweepAnimation.onSweepComplete = mx.utils.Delegate.create(this, function ()

{

if (introSequenceNumSweeps == InterceptionEngagement.INTRO_SEQUENCE_NUM_SWEEPS - 1)

{

this.SetTrackingLabel("");

this.ShowEstablishingLinkLabel("");

setTimeout(mx.utils.Delegate.create(this, function ()

{

combatContainer._visible = true;

combatMask.gotoAndPlay("_intro");

}), 850);

} // end if

if (introSequenceNumSweeps > InterceptionEngagement.INTRO_SEQUENCE_NUM_SWEEPS)

{

sweepAnimation.stop();

sweepAnimation._visible = false;

delete sweepAnimation.onSweepMiddle;

delete sweepAnimation.onSweepComplete;

this.SetTrackingLabel("");

this.ShowEstablishingLinkLabel("");

flash.external.ExternalInterface.call("FlashRaiseCommand", String(this), "IntroSequenceComplete");

} // end if

});

} // End of the function

function AttackEvent(sourceShipID, targetShipID, weapon, weaponID, newTargetHP, attackDuration, hit)

{

trace ("AttackEvent: sourceShip=" + sourceShipID + ", targetShip=" + targetShipID + ", weapon=" + weapon + ", weaponID=" + weaponID + ", attackDuration=" + attackDuration + ", hit=" + hit);

if (playerClosedIn && hit)

{

attackDuration = this.CalculateDurationOffsetBasedOnDistance(attackDuration);

} // end if

if (sourceShipID == 0)

{

if (!alienShip.IsDead() || _global.debugging)

{

alienShip.Fire(playerShip, weapon, weaponID, newTargetHP, attackDuration, hit);

} // end if

}

else if (!playerShip.IsDead() || _global.debugging)

{

playerShip.Fire(alienShip, weapon, weaponID, newTargetHP, attackDuration, hit);

} // end else if

} // End of the function

function CalculateDurationOffsetBasedOnDistance(duration)

{

playerShip.UpdateFiringLocation();

var _loc4 = alienShip.GetGlobalFiringLocation();

var _loc3 = playerShip.GetGlobalFiringLocation();

var _loc6 = _loc3.subtract(_loc4);

var _loc5 = _loc6.length;

var _loc2 = duration * _loc5 / standardShotDistance;

return (_loc2);

} // End of the function

function MovementEvent(sourceShipID, moveEventType, moveDuration)

{

if (moveEventType == InterceptionEngagement.eUFO_Escape)

{

}

else if (moveEventType == InterceptionEngagement.ePlayer_CloseDistance)

{

if (!playerShip.IsDead())

{

playerClosedIn = true;

playerShip.ShipMoveToLocation(closeDistanceLocation, moveDuration);

}

else

{

trace ("ERROR: Attempted to process \'ePlayer_CloseDistance\' event while player ship is dead.");

} // end else if

} // end else if

} // End of the function

function DisplayEffectEvent(displayEffectType, effectDescription, enabled, effectData)

{

switch (displayEffectType)

{

case InterceptionEngagement.eEnhancedAccuracy:

{

INTERCEPTOR_AIM_ENABLED = enabled;

playerShip.EnableDisableAim(enabled, alienShip, effectData);

if (enabled)

{

this.SetAbilityState(aimBtn, InterceptionEngagement.ABILITY_ACTIVE);

}

else

{

this.SetAbilityState(aimBtn, InterceptionEngagement.ABILITY_DISABLED);

effectDescription = "";

} // end else if

break;

}

case InterceptionEngagement.eDodgeHits:

{

INTERCEPTOR_DODGING_ENABLED = enabled;

playerShip.EnableDisableDodging(enabled);

if (enabled)

{

this.SetAbilityState(dodgeBtn, InterceptionEngagement.ABILITY_ACTIVE);

INTERCEPTOR_BULLETS_LEFT_TO_DODGE = effectData;

}

else

{

this.SetAbilityState(dodgeBtn, InterceptionEngagement.ABILITY_DISABLED);

LAST_DODGED_BULLET_ID = effectData;

INTERCEPTOR_BULLETS_LEFT_TO_DODGE = 0;

effectDescription = "";

} // end else if

break;

}

case InterceptionEngagement.eTrack:

{

ALIEN_TRACKING_ENABLED = enabled;

playerShip.EnableDisableTracking(enabled);

if (enabled)

{

this.SetAbilityState(trackBtn, InterceptionEngagement.ABILITY_ACTIVE);

}

else

{

this.SetAbilityState(trackBtn, InterceptionEngagement.ABILITY_DISABLED);

effectDescription = "";

} // end else if

break;

}

default:

{

trace ("ERROR: Incorrect parameter [" + displayEffectType + "] passed to InterceptionEngagement::DisplayEffectEvent() - valid range=" + InterceptionEngagement.eEnhancedAccuracy + " - " + InterceptionEngagement.eTrack);

}

} // End of switch

if (effectDescription != undefined)

{

this.SetAbilityStatusText(effectDescription);

} // end if

} // End of the function

function OnChildMouseEvent(target, type)

{

switch (type)

{

case Input.MOUSE_IN:

case Input.MOUSE_UP:

{

flash.external.ExternalInterface.call("FlashRaiseMouseEvent", String(this), type, String(target));

break;

}

} // End of switch

} // End of the function

function SetResultsTitleLabels(title, subtitle)

{

resultsPanel.titleField.text = title != undefined ? (title) : ("");

resultsPanel.subtitleField.text = subtitle != undefined ? (subtitle) : ("");

} // End of the function

function ShowResults(_report, _gameResult, btnHelpLabel)

{

var _loc2 = resultsPanel.leaveReportButton;

var _loc3 = resultsPanel.report;

var _loc4 = resultsPanel.destroyedTextField;

this.SetAbilityStatusText("");

_loc3.text = _report;

_loc2.setText(btnHelpLabel);

_loc2.setIcon(Environment.instance().GetAdvanceButtonIcon());

resultsPanel._visible = true;

_loc4._visible = false;

trace ("ShowResults: result=" + _gameResult + ", playerDead=" + playerShip.IsDead());

if (!playerShip.IsDead())

{

playerShip.MatchOver();

} // end if

switch (_gameResult)

{

case InterceptionEngagement.eUFO_Destroyed:

{

alienShip.effectsMC.gotoAndPlay("_doestryed");

caurina.transitions.Tweener.addTween(playerShip, {_x: enemyEscapeLocationInShipSpace.x, delay: InterceptionEngagement.WIN_EXIT_DELAY, time: InterceptionEngagement.WIN_EXIT_DURATION, transition: "easeinquad"});

caurina.transitions.Tweener.addTween(playerShip, {_y: enemyEscapeLocationInShipSpace.y, delay: InterceptionEngagement.WIN_EXIT_DELAY, time: InterceptionEngagement.WIN_EXIT_DURATION, transition: "easeinquad"});

break;

}

case InterceptionEngagement.eUFO_Escaped:

{

alienShip.effectsMC.gotoAndPlay("_lostContact");

caurina.transitions.Tweener.addTween(playerShip, {_x: playerEscapeLocationInShipSpace.x, delay: InterceptionEngagement.LOSE_EXIT_DELAY, time: InterceptionEngagement.LOSE_EXIT_DURATION, transition: "easeinquad"});

caurina.transitions.Tweener.addTween(playerShip, {_y: playerEscapeLocationInShipSpace.y, delay: InterceptionEngagement.LOSE_EXIT_DELAY, time: InterceptionEngagement.LOSE_EXIT_DURATION, transition: "easeinquad"});

break;

}

case InterceptionEngagement.ePlayer_Aborted:

{

caurina.transitions.Tweener.addTween(playerShip, {_x: playerEscapeLocationInShipSpace.x, time: InterceptionEngagement.RETREAT_DURATION, transition: "easeinquad"});

caurina.transitions.Tweener.addTween(playerShip, {_y: playerEscapeLocationInShipSpace.y, time: InterceptionEngagement.RETREAT_DURATION, transition: "easeinquad"});

setTimeout(mx.utils.Delegate.create(this, function ()

{

alienShip.effectsMC.gotoAndPlay("_lostContact");

}), InterceptionEngagement.ALIEN_WIN_FADE_DELAY * 1000);

break;

}

case InterceptionEngagement.ePlayer_Destroyed:

{

if (alienShip.IsDead())

{

trace ("SUPER MEGA ERROR: Alien Ship somehow won after UI simulation doestroyed it. MEGA BUG!");

}

else

{

caurina.transitions.Tweener.addTween(alienShip, {_x: enemyEscapeLocationInShipSpace.x, time: InterceptionEngagement.ALIEN_RETREAT_DURATION, transition: "easeinquad"});

caurina.transitions.Tweener.addTween(alienShip, {_y: enemyEscapeLocationInShipSpace.y, time: InterceptionEngagement.ALIEN_RETREAT_DURATION, transition: "easeinquad"});

setTimeout(mx.utils.Delegate.create(this, function ()

{

alienShip.effectsMC.gotoAndPlay("_lostContact");

}), InterceptionEngagement.ALIEN_WIN_FADE_DELAY * 1000);

} // end else if

break;

}

} // End of switch

resultsPanel.gotoAndPlay("_intro");

} // End of the function

function SetTrackingLabel(txt)

{

if (txt != undefined && txt != "")

{

trackingMC.txtField.text = txt;

trackingMC._visible = true;

}

else

{

trackingMC._visible = false;

} // end else if

} // End of the function

function ShowEstablishingLinkLabel(txt)

{

if (txt != undefined && txt != "")

{

establishingLinkPanel.txtField.text = txt;

establishingLinkPanel._visible = true;

}

else if (establishingLinkPanel._visible == true)

{

establishingLinkPanel.gotoAndPlay("_outro");

} // end else if

} // End of the function

function SetAbortLabel(txt)

{

abortingPanel.txtField.text = txt;

abortingPanel._visible = true;

} // End of the function

function SetAbortButtonText(txt)

{

abortBtn.textField.text = txt;

if (Environment.instance().IsMouseActive())

{

abortBtn.gamepadHelpIcon._visible = false;

}

else

{

abortBtn.gamepadHelpIcon.gotoAndStop(Environment.instance().GetBackButtonIcon());

} // end else if

abortBtn._visible = true;

} // End of the function

function SetDodgeButton(buttonLabel, state)

{

dodgeBtn.textField.htmlText = "" + buttonLabel + "";

dodgeBtn.originalTxt = buttonLabel;

if (Environment.instance().IsMouseActive())

{

dodgeBtn.gamepadHelpIcon._visible = false;

}

else

{

dodgeBtn.gamepadHelpIcon.gotoAndStop(Environment.instance().GetAdvanceButtonIcon());

} // end else if

this.SetAbilityState(dodgeBtn, state);

} // End of the function

function SetTrackButton(buttonLabel, trackingText, state)

{

trackBtn.textField.htmlText = "" + buttonLabel + "";

trackBtn.originalTxt = buttonLabel;

trackingMC.txtField.text = trackingText;

if (Environment.instance().IsMouseActive())

{

trackBtn.gamepadHelpIcon._visible = false;

}

else

{

trackBtn.gamepadHelpIcon.gotoAndStop("Icon_Y_TRIANGLE");

} // end else if

this.SetAbilityState(trackBtn, state);

} // End of the function

function SetAimButton(buttonLabel, state)

{

aimBtn.textField.htmlText = "" + buttonLabel + "";

aimBtn.originalTxt = buttonLabel;

if (Environment.instance().IsMouseActive())

{

aimBtn.gamepadHelpIcon._visible = false;

}

else

{

aimBtn.gamepadHelpIcon.gotoAndStop("Icon_X_SQUARE");

} // end else if

this.SetAbilityState(aimBtn, state);

} // End of the function

function SetAbilityState(abilityMC, state)

{

switch (state)

{

case InterceptionEngagement.ABILITY_AVAILABLE:

{

abilityMC._visible = true;

abilityMC.gotoAndPlay("_normal");

break;

}

case InterceptionEngagement.ABILITY_ACTIVE:

{

abilityMC._visible = true;

abilityMC.ActivateAbility();

break;

}

case InterceptionEngagement.ABILITY_DISABLED:

{

abilityMC._visible = true;

abilityMC.DeactivateAbility();

if (abilityMC.originalTxt != undefined)

{

abilityMC.textField.htmlText = "" + abilityMC.originalTxt + "";

} // end if

break;

}

case InterceptionEngagement.ABILITY_UNAVAILABLE:

{

abilityMC._visible = false;

break;

}

default:

{

trace ("ERROR: Incorrect parameter [" + state + "] passed to InterceptionEngagement::SetAbilityState() - valid range=" + InterceptionEngagement.ABILITY_AVAILABLE + " - " + InterceptionEngagement.ABILITY_UNAVAILABLE);

}

} // End of switch

} // End of the function

function AbortAttempted()

{

activeAlienWeaponIDs = alienShip.GetActiveWeaponIDs();

} // End of the function

function SetEnemyEscapeTimerLabels(title, secondsSufix)

{

enemyEscapeTimer.SetTitleAndSufix(title, secondsSufix);

} // End of the function

function SetEnemyEscapeTimer(timeLeft, secondsSufix)

{

if (enemyEscapeTimer.IsActive())

{

enemyEscapeTimer.SetTimeLeft(timeLeft);

}

else

{

enemyEscapeTimer.InitializeTimer(timeLeft);

} // end else if

} // End of the function

function IsMatchOver()

{

return (resultsPanel._visible == true);

} // End of the function

function AlienTakeDamage(damage)

{

if (!alienShip.IsDead())

{

var _loc2 = Number(alienShip.currHP - damage);

if (_loc2 <= 0)

{

_loc2 = 0.100000;

} // end if

trace ("Alien take damage: newHp=" + _loc2);

alienShip.SetHP(_loc2);

} // end if

} // End of the function

function PlayerTakeDamage(damage)

{

if (!playerShip.IsDead() && !InterceptionEngagement.INTERCEPTOR_DODGING_ENABLED)

{

var _loc2 = Number(playerShip.currHP - damage);

if (_loc2 <= 0)

{

_loc2 = 0.010000;

} // end if

trace ("Player take damage: newHp=" + _loc2);

if (!this.IsMatchOver())

{

playerShip.SetHP(_loc2);

} // end if

} // end if

} // End of the function

function SetHP(targetShipID, HP, initialize, weaponID)

{

if (HP < 0)

{

HP = 0;

} // end if

if (targetShipID == InterceptionEngagement.ALIEN_SHIP_ID)

{

if (initialize == true || HP <= 0)

{

trace ("Set Alien Ship HP from Unreal: newHP=" + HP + ", isDead=" + Boolean(HP <= 0));

alienShip.SetHP(HP);

} // end if

if (weaponID != -1)

{

playerShip.RemoveWeaponFromID(weaponID);

} // end if

}

else

{

if (initialize == true || HP <= 0)

{

trace ("Set Player Ship HP from Unreal: newHP=" + HP + ", isDead=" + Boolean(HP <= 0));

playerShip.SetHP(HP);

} // end if

if (weaponID != -1)

{

alienShip.RemoveWeaponFromID(weaponID);

} // end if

} // end else if

} // End of the function

function SetAbilityStatusText(txt)

{

trace ("SetAbilityStatusText() _visible=" + statusBox._visible + ", txt=" + txt);

if (statusBox._visible == true)

{

var _loc2 = statusBox.textField.htmlText;

statusBox.outroComplete = DelegateWithParams.create(this, SetAbilityStatusText, txt);

statusBox.gotoAndPlay("_outro");

statusBox.textField.htmlText = _loc2;

}

else

{

statusBox._visible = true;

statusBox.gotoAndPlay("_intro");

statusBox.textField.htmlText = txt;

trace ("TextHeight = " + statusBox.textField.textHeight);

if (statusBox.textField.textHeight > 24)

{

statusBox.textField._y = statusBoxTextFieldStartY - (statusBox.textField.textHeight - 24);

}

else

{

statusBox.textField._y = statusBoxTextFieldStartY;

} // end else if

} // end else if

} // End of the function

function MayDisengage()

{

var _loc3 = false;

if (!alienShip.IsDead() && activeAlienWeaponIDs != undefined)

{

for (var _loc2 = 0; _loc2 < activeAlienWeaponIDs.length; ++_loc2)

{

if (alienShip.IsWeaponActiveFromID(activeAlienWeaponIDs[_loc2]))

{

_loc3 = true;

continue;

} // end if

trace ("MayDisengage: weapon [" + activeAlienWeaponIDs[_loc2] + "] not in array, removing element.");

activeAlienWeaponIDs.splice(_loc2, 1);

--_loc2;

} // end of for

} // end if

return (!_loc3 ? (1) : (0));

} // End of the function

function SetCloseDistanceLocation(globalPoint)

{

closeDistanceLocation = globalPoint;

} // End of the function

function debugRandomFire(weaponType, alienFire)

{

if (!_global.debugging)

{

return;

} // end if

var _loc3 = random(50) < 24 ? (true) : (false);

debug_weapon_id = ++InterceptionEngagement.debug_weapon_id;

if (alienFire)

{

this.AttackEvent(0, 1, weaponType, InterceptionEngagement.debug_weapon_id, 1, _loc3 ? (0.300000) : (0.650000), _loc3);

return;

} // end if

this.AttackEvent(1, 0, weaponType, InterceptionEngagement.debug_weapon_id, 1, _loc3 ? (0.300000) : (0.650000), _loc3);

} // End of the function

function randRange(min, max)

{

var _loc1 = Math.floor(Math.random() * (max - min + 1)) + min;

return (_loc1);

} // End of the function

function onInput(code, action)

{

if (!_global.debugging)

{

return;

} // end if

switch (code)

{

case Input.KEY_1:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Avalanche);

break;

}

case Input.KEY_2:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Cannon);

break;

}

case Input.KEY_3:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Plasma);

break;

}

case Input.KEY_4:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Laser);

break;

}

case Input.KEY_5:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Fusion);

break;

}

case Input.KEY_6:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_UFOPlasmaI, true);

break;

}

case Input.KEY_7:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_UFOPlasmaII, true);

break;

}

case Input.KEY_8:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_UFOFusion, true);

break;

}

case Input.KEY_9:

{

this.debugRandomFire(InterceptionWeapon.eShipWeapon_Stingray, true);

break;

}

case Input.KEY_l:

{

this.SetAbortLabel("UFO Destroyed");

this.ShowResults("UFO Destroyed Result Test", InterceptionEngagement.eUFO_Destroyed, "LEAVE REPORT");

break;

}

case Input.KEY_n:

{

this.ShowResults("UFO Escape Result Test", InterceptionEngagement.eUFO_Escaped, "LEAVE REPORT");

break;

}

case Input.KEY_m:

{

this.SetHP(1, 0, false);

this.ShowResults("Player Destroyed Result Test\n\nPlayer Shot Down", InterceptionEngagement.ePlayer_Destroyed, "LEAVE REPORT");

break;

}

case Input.KEY_r:

{

this.ShowResults("Player Retreated Result Test\n\nPlayer Aborted", InterceptionEngagement.ePlayer_Aborted, "LEAVE REPORT");

break;

}

case Input.KEY_t:

{

this.DisplayEffectEvent(InterceptionEngagement.eTrack, "TRACK: Halts enemy escape for 5 seconds.\nReduces approach time for short range weapons.", !InterceptionEngagement.ALIEN_TRACKING_ENABLED);

break;

}

case Input.KEY_d:

{

this.DisplayEffectEvent(InterceptionEngagement.eDodgeHits, "DODGE: Causes pilot to evade next 2 enemy hits.", !InterceptionEngagement.INTERCEPTOR_DODGING_ENABLED);

break;

}

case Input.KEY_a:

case Input.BUTTON_A:

{

this.DisplayEffectEvent(InterceptionEngagement.eEnhancedAccuracy, "AIM: Guarantees next 2 shots will hit the target.", !InterceptionEngagement.INTERCEPTOR_AIM_ENABLED);

break;

}

case Input.KEY_q:

{

this.SetAbilityStatusText("ABILITY 1: This is a description of ability 1\'s effects.");

break;

}

case Input.KEY_w:

{

this.SetAbilityStatusText("ABILITY 2: This is a slightly longer description of ability 2\'s effects.");

break;

}

case Input.KEY_e:

{

this.SetAbilityStatusText("ABILITY 3: This is a much longer and in depth description of ability 3\'s effects which covers lots of little tiny details or something.");

break;

}

case Input.KEY_DELETE:

{

this.SetHP(0, 0, false);

this.ShowResults("UFO Destroyed Result Test", InterceptionEngagement.eUFO_Destroyed, "LEAVE REPORT");

break;

}

case Input.KEY_END:

{

this.SetHP(1, 0, false);

break;

}

case Input.KEY_0:

{

this.MovementEvent(1, InterceptionEngagement.ePlayer_CloseDistance, 3);

break;

}

} // End of switch

} // End of the function

function onPopulateDebugData()

{

if (!_global.debugging)

{

return;

} // end if

this.InitializeData(Ship.eShip_Interceptor, Ship.eShip_UFOAbductor, "SET IN INITIALIZE", "ESTABLISHING LINK...");

this.SetHP(0, 10, true, -1);

this.SetHP(1, 10, true, -1);

this.SetResultsTitleLabels("Interception Engagement", "STATUS REPORT");

this.SetAbortButtonText("ABORT");

this.SetAimButton("AIM", InterceptionEngagement.ABILITY_AVAILABLE);

this.SetDodgeButton("DODGE", InterceptionEngagement.ABILITY_AVAILABLE);

this.SetTrackButton("TRACK", "TRACKING", InterceptionEngagement.ABILITY_AVAILABLE);

this.SetEnemyEscapeTimerLabels("CONTACT LOST IN:", "s");

this.SetEnemyEscapeTimer(15);

this.BeginIntroSequence();

} // End of the function

static var INTRO_SEQUENCE_NUM_SWEEPS = 3;

static var ALIEN_SHIP_ID = 0;

static var MAX_NUM_PLAYER_SHIPS = 2;

static var RETREAT_DURATION = 1.500000;

static var WIN_EXIT_DELAY = 1.500000;

static var WIN_EXIT_DURATION = 4;

static var LOSE_EXIT_DURATION = 3.500000;

static var LOSE_EXIT_DELAY = 0.800000;

static var ALIEN_RETREAT_DURATION = 4;

static var ALIEN_WIN_FADE_DELAY = 1.500000;

static var ABILITY_AVAILABLE = 0;

static var ABILITY_ACTIVE = 1;

static var ABILITY_DISABLED = 2;

static var ABILITY_UNAVAILABLE = 3;

static var eUFO_Escape = 0;

static var ePlayer_CloseDistance = 1;

static var eUFO_Escaped = 0;

static var eUFO_Destroyed = 1;

static var ePlayer_Aborted = 2;

static var ePlayer_Destroyed = 3;

static var eEnhancedAccuracy = 0;

static var eDodgeHits = 1;

static var eTrack = 2;

static var ALIEN_TRACKING_ENABLED = false;

static var INTERCEPTOR_AIM_ENABLED = false;

static var INTERCEPTOR_DODGING_ENABLED = false;

static var INTERCEPTOR_BULLETS_LEFT_TO_DODGE = 0;

static var LAST_DODGED_BULLET_ID = -1;

static var shipScaleModifier = 1;

static var debug_weapon_id = 0;

} // End of Class

 

 

 

Oh, this is going to drive me crazy ... I searched through that hex file with the hex editor looking for those strings and came up empty. Live and learn, I guess!

 

I really have to push this back and finish up some of the other mods I'm close to finishing ... the generic damage reduction and regeneration, plus the FC Request rework I've been planning. Too many options!

 

It's a good thing, though ^_^

Link to comment
Share on other sites

How about allowing players to pick the class of the soldiers?

 

*dives behind some +40 defense cover and hunkers down*

 

Hmmm, with what I know now it might just barely be possible. Perhaps if I took over another UI window and rewrote it. In general each UI windows requires the following to function:

1) XG<UI_name>UI class ... this handles managing data structures and calculating information on the upk side

2) UI<UI_name> class ... this handles calling the AS_functions and does some limited data collecting

3) An SWF file with sprites and actionscript files ... there may be several actionscript functions.

 

For example, the abilities window interface has:

1) XGSoldierUI -- contains code for managing data structure for the soldier view, used in the barracks for abilities, psi, loadout, customization, and dismissing soldiers

2) UISoldierPromotion -- contains code for calling the actionscript, including calls to AS_InitializeTree, AS_SetAbilityIcon, as well as 'helper functions" to call the AS functions, such as UpdateAbilityData

3) SWF File (embedded into Command1.upk)

 

Unless I could find an existing UI that works so well for picking class that it could be reused without hardly any mods, it seems pretty unlikely that it could be modded for selecting class without breaking its original functionality.

 

The abduction selection UI seems like a decent choice, at least for the Long War mod, which only presents one Abduction site at a time. The Abduction selection UI could be removed, so that clicking on the "Abduction Site" main button would work the same as a downed UFO mission, or Terror mission.

 

Then the abduction selection UI could be reworked to allow for soldier selection. It could likely be expanded to show 4 windows -- it would mean some significant rewriting in the actionscript side, however, as well as in the UPKs.

 

I'll ponder it some more and see if I come up with a more general solution.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...