first commit

This commit is contained in:
2026-06-14 01:40:04 +02:00
commit 5511354783
4787 changed files with 103543 additions and 0 deletions
@@ -0,0 +1,155 @@
class AptApiClass
{
static var extern = {DoTrace:0,InGame:0,Cnc3PcDemo:0};
static var debug = new DebugClass("AptApiClass::");
static var m_aptActive = undefined;
var m_codePrefix = "";
function AptApiClass(className, screen)
{
this.m_codePrefix = "Apt" + className + "::";
AptApiClass.m_aptActive = AptApiClass.InGame();
// Checked
this.Call("RegisterScreen",screen._target);
}
static function InGame(Void)
{
if(AptApiClass.m_aptActive == undefined)
{
AptApiClass.m_aptActive = Boolean(Number(AptApiClass.extern.InGame));
}
return AptApiClass.m_aptActive;
}
function __get__Active()
{
return AptApiClass.m_aptActive;
}
function Call(func, params)
{
AptApiClass.debug.Trace("AptCall " + this.m_codePrefix + func + "(" + params + ")");
// Checked
getURL("FSCommand:" add (this.m_codePrefix + func),params);
}
function CallAbs(func, params)
{
AptApiClass.debug.Trace("CallAbs " + func + "(",params,")");
// Never used
// Checked
getURL("FSCommand:" add func,params);
}
function LoadVariables(varName, obj, convertStr)
{
if(AptApiClass.m_aptActive)
{
obj = new Object();
AptApiClass._loadVariables(this.m_codePrefix + varName,obj);
}
if(convertStr != undefined)
{
this.ConvertObjectMembers(obj,convertStr);
}
AptApiClass.debug.Dump(obj,"LoadVariables:" + varName);
return obj;
}
function ConvertObjectMembers(obj, convertStr)
{
var _loc5_ = convertStr.split(",");
var _loc6_ = _loc5_.length;
var _loc2_ = 0;
while(_loc2_ < _loc6_)
{
var _loc4_ = _loc5_[_loc2_].split("=");
var _loc1_ = _loc4_[0];
switch(_loc4_[1])
{
case "Array":
obj[_loc1_] = obj[_loc1_].split(",");
break;
case "Boolean":
obj[_loc1_] = !Number(obj[_loc1_]) ? false : true;
break;
case "Number":
obj[_loc1_] = Number(obj[_loc1_]);
break;
default:
trace("ERROR: AptLoadVariables - Unable to convert : " + _loc5_[_loc2_]);
}
_loc2_ = _loc2_ + 1;
}
}
static function _loadVariables(varName, obj)
{
// Never used
// Checked
loadVariables(varName,obj);
return obj;
}
function GetExtern(ext, testDefault)
{
var _loc2_ = undefined;
ext = this.m_codePrefix + ext;
if(AptApiClass.m_aptActive)
{
_loc2_ = AptApiClass.extern[ext];
}
else
{
if(AptApiClass.extern[ext] == undefined)
{
_loc2_ = testDefault;
}
else
{
_loc2_ = AptApiClass.extern[ext];
}
AptApiClass.debug.Trace("GetExtern(" + ext + ")=>" + _loc2_);
}
return _loc2_;
}
function SetExtern(ext, to)
{
ext = this.m_codePrefix + ext;
AptApiClass.extern[ext] = to;
AptApiClass.debug.Trace("SetExtern(" + ext + ")=>" + to);
}
function ToggleExtern(ext)
{
ext = this.m_codePrefix + ext;
var _loc2_ = !Number(AptApiClass.extern[ext]);
AptApiClass.extern[ext] = _loc2_;
return _loc2_;
}
function PlaySound(name)
{
// Checked
getURL("FSCommand:PlaySound",name);
}
function IsCnc3Demo(testDefault)
{
return !AptApiClass.InGame() ? testDefault : AptApiClass.extern.Cnc3PcDemo != "0";
}
function IsSpecialEdition(testDefault)
{
return !AptApiClass.InGame() ? testDefault : AptApiClass.extern.IsSpecialEdition == "1";
}
function IsSpecialEditionExe(testDefault)
{
trace("============TESTING KANE");
return !AptApiClass.InGame() ? testDefault : AptApiClass.extern.IsSpecialEditionExe == "1";
}
function IsSpectatorClient(testDefault)
{
return !AptApiClass.InGame() ? testDefault : AptApiClass.extern.IsSpectatorClient != "0";
}
static function EnableEngineComponents(path)
{
AptApiClass.debug.Trace("EnableEngineComponents:" + path);
// Checked
getURL("FSCommand:EnableComponents",path);
}
static function DisableEngineComponents(path)
{
AptApiClass.debug.Trace("DisableEngineComponents:" + path);
// Checked
getURL("FSCommand:DisableComponents",path);
}
}
@@ -0,0 +1,57 @@
class AptZombieClass extends MovieClip
{
static var s_classes = new Array();
static var s_objects = new Array();
static var debug = new DebugClass("AptZombieClass::");
function AptZombieClass()
{
super();
this._visible = false;
}
static function AddClass(linkageIdentifier, className)
{
AptZombieClass.s_classes.push(linkageIdentifier);
Object.registerClass(linkageIdentifier,className);
}
static function AddObject(obj)
{
AptZombieClass.debug.Trace("AddObject:" + obj);
AptZombieClass.s_objects.push(obj);
}
static function DeleteClass(className)
{
AptZombieClass.debug.Trace("DeleteClass:" + className);
Object.registerClass(className,null);
delete _global.className;
}
static function DeleteFunctions(obj)
{
AptZombieClass.debug.Trace("DeleteFunctions:" + obj._target);
for(var _loc3_ in obj)
{
var _loc1_ = typeof obj[_loc3_];
AptZombieClass.debug.Trace(" " + _loc3_ + ":" + _loc1_);
if(_loc1_ eq "movieclip")
{
AptZombieClass.DeleteFunctions(obj[_loc3_],true);
}
else if(_loc1_ eq "function")
{
delete obj.register3;
}
}
}
function onUnload()
{
var _loc1_ = 0;
while(_loc1_ < AptZombieClass.s_objects.length)
{
_loc1_ = _loc1_ + 1;
}
_loc1_ = 0;
while(_loc1_ < AptZombieClass.s_classes.length)
{
_loc1_ = _loc1_ + 1;
}
}
}
@@ -0,0 +1,257 @@
class ButtonClass extends MovieClip
{
static var debug = new DebugClass("ButtonClass::");
var m_state = undefined;
var m_mode = undefined;
var m_nextState = undefined;
var m_curStateMc = undefined;
var m_curTextMc = undefined;
var m_curBttnMc = undefined;
var m_sfxClick = "$ClickButton";
var m_sfxRollOver = "$OverButton";
var m_sfxRollOut = "$OutButton";
function ButtonClass()
{
super();
this.m_text = "$" + this._name;
for(var _loc5_ in this)
{
if(this[_loc5_] != undefined)
{
var _loc3_ = this[_loc5_];
var _loc4_ = typeof _loc3_ == "movieclip";
_loc3_._visible = false;
if(_loc4_)
{
if(_loc3_.Show == undefined)
{
_loc3_.Show = function(previous)
{
this.gotoAndPlay(1);
};
}
}
if(_loc5_.indexOf("Text") < 0)
{
if(!(_loc5_.indexOf("State") >= 0 || _loc5_.indexOf("Trans") >= 0))
{
if(_loc5_.indexOf("Bttn") >= 0)
{
_loc3_.onPress = function()
{
this._parent.Press();
};
_loc3_.onRelease = function()
{
this._parent.Release();
};
_loc3_.onRollOver = function()
{
this._parent.RollOver();
};
_loc3_.onRollOut = function()
{
this._parent.RollOut();
};
_loc3_.onDragOut = function()
{
this._parent.DragOut();
};
_loc3_.onDragOver = function()
{
this._parent.DragOver();
};
}
else if(_loc4_)
{
trace("WARNING:ButtonClass:" + this._target + "/" + _loc5_ + " is an unknown movie clip!");
_loc3_._visible = true;
}
}
}
}
}
}
function SetText(textString)
{
this.m_text = textString;
}
function SetSfxClick(sfx)
{
this.m_sfxClick = sfx;
}
function SetSfxRollOver(sfx)
{
this.m_sfxRollOver = sfx;
}
function SetSfxRollOut(sfx)
{
this.m_sfxRollOut = sfx;
}
function SetMode(mode)
{
this.m_mode = mode;
if(this.m_state == undefined)
{
this.m_state = "UpState";
}
this.ChangeState(this.m_state);
}
function ClearMode(Void)
{
this.SetMode("");
}
function GetMode(Void)
{
return this.m_mode;
}
function onUnload()
{
AptZombieClass.DeleteFunctions(this);
}
function ChangeState(stateStr)
{
var _loc3_ = "Button::ChangeState(" + this._name + "):(" + this.m_mode + ")" + this.m_state + "->" + stateStr + " (" + this.m_curStateMc._name + ":" + this.m_curBttnMc._name + ":" + this.m_curTextMc._name + ")->(";
this.m_state = stateStr;
this.m_nextState = undefined;
this.m_curTextMc = this.SwitchObject(this.m_curTextMc,this.GetText(stateStr));
this.m_curBttnMc = this.SwitchObject(this.m_curBttnMc,this.GetBttn(stateStr));
this.m_curStateMc = this.SwitchObject(this.m_curStateMc,this.GetStateClip(stateStr));
}
function StartTransition(transition, nextState)
{
var _loc2_ = this.GetStateClip(transition);
if(_loc2_ != undefined)
{
this.m_state = transition;
this.m_nextState = nextState;
this.m_curBttnMc._visible = false;
this.m_curBttnMc = undefined;
this.m_curTextMc = this.SwitchObject(this.m_curTextMc,this.GetText(transition));
this.m_curStateMc = this.SwitchObject(this.m_curStateMc,_loc2_);
return true;
}
return false;
}
function EndTransition(transition)
{
if(transition == this.m_curStateMc && this.m_nextState != undefined)
{
this.ChangeState(this.m_nextState);
}
}
function SwitchObject(current, next)
{
if(next != undefined)
{
var _loc2_ = current;
var _loc4_ = typeof next == "movieclip";
if(current)
{
current._visible = false;
current.stop();
}
current = next;
current._visible = true;
current.Show(_loc2_);
}
return current;
}
function GetStateClip(stateStr)
{
var _loc2_ = this[this.m_mode + stateStr];
if(_loc2_ == undefined)
{
_loc2_ = this[stateStr];
}
return _loc2_;
}
function GetText(stateStr)
{
var _loc2_ = this.GetObject(stateStr,"Text");
return _loc2_;
}
function GetBttn(stateStr)
{
var _loc2_ = this.GetObject(stateStr,"Bttn");
return _loc2_;
}
function GetObject(stateStr, postfix)
{
var _loc2_ = this[this.m_mode + stateStr + postfix];
if(_loc2_ == undefined)
{
_loc2_ = this[this.m_mode + postfix];
if(_loc2_ == undefined)
{
_loc2_ = this[stateStr + postfix];
if(_loc2_ == undefined)
{
_loc2_ = this[postfix];
}
}
}
return _loc2_;
}
function Press(Void)
{
if(this.Bttn._visible)
{
this.PressCallback();
this.ChangeState("DownState");
// Checked
getURL("FSCommand:PlaySound",this.m_sfxClick);
}
}
function Release(Void)
{
if(this.Bttn._visible)
{
this.ReleaseCallback();
if(!this.StartTransition("ReleaseTrans","UpState"))
{
this.ChangeState("OverState");
}
}
}
function RollOver(Void)
{
if(this.Bttn._visible)
{
this.RollOverCallback();
this.ChangeState("OverState");
// Checked
getURL("FSCommand:PlaySound",this.m_sfxRollOver);
}
}
function RollOut(Void)
{
if(this.Bttn._visible)
{
this.RollOutCallback();
if(!this.StartTransition("RollOutTrans","UpState"))
{
this.ChangeState("UpState");
}
// Checked
getURL("FSCommand:PlaySound",this.m_sfxRollOut);
}
}
function DragOut(Void)
{
if(this.Bttn._visible)
{
this.DragOutCallback();
this.ChangeState("UpState");
this.ChangeState("OutState");
}
}
function DragOver(Void)
{
if(this.Bttn._visible)
{
this.DragOverCallback();
this.ChangeState("DownState");
}
}
}
@@ -0,0 +1,39 @@
class DebugClass
{
var extern = {DoTrace:1,InGame:0};
var m_codePrefix = "";
function DebugClass()
{
}
function InitDebugClass(codePrefix)
{
this.m_codePrefix = codePrefix + ":";
this.Enable(false);
}
function Enable(enable)
{
if(!Boolean(Number(this.extern.InGame)))
{
this.extern.DoTrace = enable;
}
this.m_enabled = Boolean(Number(this.extern.DoTrace));
}
function Trace(show)
{
if(this.m_enabled)
{
trace(this.m_codePrefix + show);
}
}
function Dump(obj, msg)
{
if(this.m_enabled)
{
trace("Dump:" + msg + ":" + typeof obj);
for(var _loc3_ in obj)
{
trace("\t" + _loc3_ + ": " + obj[_loc3_] + " : " + typeof obj[_loc3_]);
}
}
}
}