home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 October
/
Chip_2002-10_cd1.bin
/
zkuste
/
dwarf
/
download
/
_SETUP.1
/
vmhtm23.js
< prev
next >
Wrap
Text File
|
2002-05-31
|
45KB
|
1,817 lines
//*********************************************************************************//
// (C) Copyright Virtual Mechanics 1999-2002 Version 2.4a, All rights reserved. //
// All copies of any portions of this software must include this Copyright notice. //
//*********************************************************************************//
objStep = new Array();
objTime = new Array();
noStep = new Array();
TotTime = new Array();
maxTime = new Array();
noStep = new Array();
Mctl = new Array();
workX = new Array();
workY = new Array();
var Version = 0;
var newPage = 0;
var pgScObj =-1;
var pageObj = 0;
var mW;
var mH;
nm = new Array();
Active = new Array();
ob = new Array();
cpox = new Array();
cpoy = new Array();
spox = new Array();
spoy = new Array();
epox = new Array();
epoy = new Array();
crot = new Array();
cscx = new Array();
cscy = new Array();
rotate= new Array();
scale= new Array();
rate = new Array();
var Lpox;
var Lpoy;
dpox = new Array();
dpoy = new Array();
atDis = new Array();
DisPt = new Array();
disStep = new Array();
Plen = new Array();
Path = new Array();
obRef= new Array();
Gtyp = new Array();
Gnpt=new Array();
//Gnam = new Array();
Glen = new Array();
Gszx = new Array();
Gszy = new Array();
Gorx = new Array();
Gory = new Array();
Gpxl = new Array();
Gpyl = new Array();
Gbrl = new Array();
Gbrt = new Array();
Gbrr = new Array();
Gbrb = new Array();
Grps = new Array();
Grpl = new Array();
Gspt = new Array();
Snam = new Array();
Scnt = new Array();
PathCount = new Array();
LastPt = new Array();
lstVal = new Array();
TimeLeft = new Array();
AEvent = new Array();
WDEvent = new Array();
WAEvent = new Array();
AValue = new Array();
ATime = new Array();
AEnter = new Array();
ALeave = new Array();
AKey = new Array();
IKey = new Array();
DEvent = new Array();
DValue = new Array();
DTime = new Array();
DEnter = new Array();
DLeave = new Array();
DAKey = new Array();
DIKey = new Array();
WASOp = new Array();
WAGOp = new Array();
OpForm = new Array();
WAAObj = new Array();
WADObj = new Array();
WAForm = new Array();
WASVal = new Array();
WAGVal = new Array();
WACgeo = new Array();
WACsnd = new Array();
WACact = new Array();
WACevt = new Array();
WACatt = new Array();
WACobj = new Array();
WANobj = new Array();
WALink = new Array();
WDAObj = new Array();
WDDObj = new Array();
EndPath = new Array();
MType = new Array();
MPath = new Array();
MRate = new Array();
MTime = new Array();
MDelay = new Array();
MStart = new Array();
MRepeat= new Array();
MCount = new Array();
MPLen = new Array();
MDir = new Array();
MGWst = new Array();
MGNth = new Array();
MGEst = new Array();
MGSth = new Array();
MALst = new Array();
MRotate= new Array();
MScale = new Array();
MShade = new Array();
MFlags = new Array();
eDELAY = (1);
eDELAY_TIME = (2);
eMOUSE = (4);
eMOUSE_OVER = (8);
eLMOUSE = (16);
eRMOUSE = (32);
eKEY = (64);
eOBJECT_ENTER = (128);
eOBJECT_ENTER_LIST = (256);
eOBJECT_LEAVE = (512);
eOBJECT_LEAVE_LIST = (1024);
eLT_VALUE = (2048);
eEQ_VALUE = (4096);
eGT_VALUE = (8192);
eVALUE = (16384);
eENDPATH = (32768);
eACTIVATE_1 = (65536);
eACTIVATE_2 = (131072);
eANDtest = (1<<30);
var pageTime = -1;// link timer
var Cobj;
var Csty;
var Catt;
var Cact;
var Cevt;
var Cgrp;
var Cgeo;
var Csnd;
var Cpob;
var Gpgo;
var gcx;
var gcy;
var gcx;
var gcy;
var cmx = 0;
var cmy = 0;
var smx = -9999;
var smy = -9999;
var slm = 0;
var llm = -9999;
var sky = " ";
var lstsnd = -1;
var fact;
var ifact;
var lmx = -9999;
var lmy = -9999;
var lky = 0;
var totObj;
var mS;
var mW;
var fps = 30;
var waitTime = 20;
var tickTime = 1;
var strDate;
var curDate;
var GEO_TYPE = 7;
var GEO_OPEN = 8;
var GEO_COUNT= 32;
ACT_XPATH_STOP =(0);
ACT_XPATH_OBJPTH =(1<<0);
ACT_XPATH_OBJXYZ =(1<<1);
ACT_XPATH_LEFT =(1<<2);
ACT_XPATH_RIGHT =(1<<3);
ACT_XPATH_MOUSE =(1<<4);
ACT_XPATH_KEYPTH =(1<<5);
ACT_YPATH_STOP =(0);
ACT_YPATH_OBJPTH =(1<<8);
ACT_YPATH_OBJXYZ =(1<<9);
ACT_YPATH_UP =(1<<10);
ACT_YPATH_DOWN =(1<<11);
ACT_YPATH_MOUSE =(1<<12);
ACT_ZPATH_STOP =(0);
ACT_ZPATH_OBJPTH =(1<<16);
ACT_ZPATH_OBJXYZ =(1<<17);
ACT_ZPATH_IN =(1<<18);
ACT_ZPATH_OUT =(1<<19);
ACT_ZPATH_KEY =(1<<20);
ACT_PATH_STOP =(0);
ACT_PATH_START =(1<<24);
ACT_PATH_CENTER =(1<<25);
ACT_PATH_END =(1<<26);
ACT_GEO_WEST =(1<<28);
ACT_GEO_EAST =(1<<29);
ACT_GEO_NORTH =(1<<30);
ACT_GEO_SOUTH =(1<<31);
ACT_SETX =(0xffffff00);
ACT_SETY =(0xffff00ff);
ACT_SETZ =(0xff00ffff);
ACT_SETO =(0xf0ffffff);
ACT_SETF =(0x0fffffff);
ACT_GETX =(0x000000ff);
ACT_GETY =(0x0000ff00);
ACT_GETZ =(0x00ff0000);
ACT_GETO =(0x0f000000);
ACT_GETF =(0xf0000000);
/**************************************************************************/
var isNav4 = false, isIE4 = false, isIE5 = false, isNC6 = false;
if (document.getElementById)
{
isIE5 = true;// NN6, IE5, Opera 5
if(!document.all)
{
isNC6 = true; //nc6 && ie5 possible
}
}
else if (document.all)
{
isIE4 = true;// IE4
}
else if (document.layers)
{
isNav4 = true;// NN4
}
///////////////////////////////////////
if (isIE4 || isIE5) {
if(isNC6)
{
window.document.onmousemove = NNmouseMove;
window.document.onmousedown = NNmouseDown;
window.document.onmouseup = NNmouseUp;
window.document.onkeypress = NNkeyPress;
window.document.ondragstart = IECancelEvent;
}
else
{
window.document.onmousemove = IEmouseMove;
window.document.onmousedown = IEmouseDown;
window.document.onmouseup = IEmouseUp;
window.document.onkeypress = IEkeyPress;
window.document.onkeydown = IEkeyPress;
window.document.ondragstart = IECancelEvent;
}
}
else if (isNav4) {
window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN|Event.MOUSEMOVE|Event.KEYPRESS);
window.onmousedown=NNmouseDown;
window.onmouseup=NNmouseUp;
window.onmousemove=NNmouseMove;
window.onkeypress=NNkeyPress;
}
/////////////////////////////////////
function NNmouseMove(e) {
cmx = e.pageX;
cmy = e.pageY;
sclx = window.pageXOffset;
scly = window.pageYOffset;
}
function NNmouseDown(e) {
slm = slm | 1;
document.onmousemove=drag;
document.onmouseup=enddrag;
smx=e.pageX;
smy=e.pageY;
return true;
}
function NNmouseUp(e) {
slm = slm | 2;
smx = e.pageX;
smy = e.pageY;
}
function NNkeyPress(e) {
if(isNC6){
sky = e.which;
}
else{
sky = String.fromCharCode(e.which);
}
}
function enddrag(e) {
slm = slm | 2;
smx = e.pageX + window.pageXOffset;
smy = e.pageY + window.pageYOffset;
document.onmousemove=0;
document.releaseEvents(Event.MOUSEMOVE);
document.releaseEvents(Event.MOUSEUP);
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEDOWN|Event.KEYPRESS);
return false;
}
function drag(e) {
cmx = e.pageX + window.pageXOffset;
cmy = e.pageY + window.pageYOffset;
}
/////////////////////////
function IEmouseMove() {
cmx = window.event.clientX + document.body.scrollLeft;
cmy = window.event.clientY + document.body.scrollTop;
sclx = document.body.scrollLeft;
scly = document.body.scrollTop;
}
function IEmouseDown() {
slm = slm | 1;
smx = window.event.clientX + document.body.scrollLeft;
smy = window.event.clientY + document.body.scrollTop;
}
function IEmouseUp() {
slm = slm | 2;
smx = window.event.clientX + document.body.scrollLeft;
smy = window.event.clientY + document.body.scrollTop;
}
function IEkeyPress() {
sky = window.event.keyCode;
}
function IECancelEvent() {
window.event.returnValue=false;
}
////////////////////////
function Setup() {
// setup defaults
tmCount=0;
strDate = new Date();
waitTime = 1000 / fps;
frmTime = 0;
tickTime = 0;
obRef[0] = 0;
ob[0] = new Array();
ob[0] = 0;
ob[0].geom = "Geo0";
ob[0].geo = 0;
ob[0].att = 0;
ob[0].evt = 0;
ob[0].act = 0;
ob[0].grp = 0;
ob[0].cpox =0.000000;
ob[0].cpoy =0.000000;
ob[0].cscx =1.000000;
ob[0].cscy =1.000000;
ob[0].crot =0.000000;
ob[0].flg = 0;
MPath[0] = 0;
MStart[0] = 0;
MCount[0] = 0;
fact = 1.0;
ifact= 0.0;
for(nob=0; nob < pageObj; nob++) {
Cobj = pObjLst[nob];
spox[Cobj] = ob[Cobj].cpox;
spoy[Cobj] = ob[Cobj].cpoy;
SetPath(Cobj);
if(ob[Cobj].grp == 0)
reset(Cobj);
if(ob[Cobj].flg & 16)
Active[Cobj] = 4; // set to initial active state
}
}
function doObjectList() {
curDate = new Date();
tickTime = (curDate - strDate) * 0.1;
frmTime++;
if(newPage != 0) window.location=WALink[newPage];
newPage = 0;
if(pageTime >= 0)
{
tmCount++;
if(tmCount > pageTime * tickTime)
{
window.location=pgLink;
pageTime = -1;
}
}
if(lmx == smx) smx = -99999;
if(lmy == smy) smy = -99999;
if(lky == sky) sky = " ";
llt = 0;
if((llm & 2) == (slm & 2)) slm = (slm & ~2);
if((llm & 1) == (slm & 1)) slm = (slm & ~1);
lmx = smx;
lmy = smy;
lky = sky;
llm = slm;
MoOvrTst();
for(nob=0; nob < pageObj; nob++) {
// ref = pObjLst[nob];
gcx = 0;
gcy = 0;
cobj = pObjLst[nob]
Cgrp = ob[cobj].grp;
if(!Cgrp) doObject(cobj);
}
}
function doObject(cobj)
{
Cobj = cobj;
Cgeo = ob[Cobj].geo;
Csnd = ob[Cobj].snd;
Cevt = ob[Cobj].evt;
Catt = ob[Cobj].att;
Cact = ob[Cobj].act;
Gpgo = ob[Cobj].gem;
Csty = ob[Cobj].style;
if(Cact)
{
Cpob = MPath[Cact];
if(Cpob)
Cpgo = ob[Cpob].geo;
else
Cpgo = 0;
}
else
{
Cpob = 0;
Cpgo = 0;
}
if(Cevt) Evtest();
if (Active[Cobj] == 4) whenActive();
else if(Active[Cobj] == 2) whenDeactive();
else if(Active[Cobj] == 1) isActive();
else if(Active[Cobj] == 0) isDeactive();
// if(Cgeo && (Gtyp[Cgeo] & (1<<4)))
// {
// doGroup(Cgeo);
// return;
// }
}
function doGroup(cgrp)
{
var gobj;
gcx = cpox[Cobj];
gcy = cpoy[Cobj];
gobj = Cobj;
for(i = 0; i < Grps[cgrp]; i++)
{
doObject(Grpl[cgrp][i]);
ob[Cobj].style.left=gcx+cpox[Cobj] - Gszx[Cgeo] * ob[Cobj].cscx;
ob[Cobj].style.top =gcy+cpoy[Cobj] - Gszy[Cgeo] * ob[Cobj].cscy;
}
return;
}
function setVisibility(code)
{
if(Gtyp[Cgeo] & (1<<6)) return;
if(Cgeo && (Gtyp[Cgeo] & (1<<4))) {
for(i = 0; i < Grps[Cgeo]; i++) {
ob[Grpl[Cgeo][i]].style.visibility = code;
}
ob[Grpl[Cgeo][i]].style.visibility = code;
}
else
ob[Cobj].style.visibility = code;
}
function UpdGeo() {
var drx = Lpox - cpox[Cobj];
var dry = Lpoy - cpoy[Cobj];
if(Math.abs(dry) > Math.abs(drx))
{
if ((dry < 0) && (MDir[Cobj] != 270))
{
if(MType[Cact] & (ACT_GEO_SOUTH))
{
ob[Cobj].geo.src = Gspt[MGSth[Cact]].src;
}
MDir[Cobj] = 270;
}
else if((dry >= 0) && MDir[Cobj] != 90)
{
if(MType[Cact] & (ACT_GEO_NORTH))
{
ob[Cobj].geom.src = Gspt[MGNth[Cact]].src;
}
MDir[Cobj] = 90;
}
}
else
{
if ((drx > 0) && (MDir[Cobj] != 0))
{
if(MType[Cact] & (ACT_GEO_WEST))
{
ob[Cobj].geom.src = Gspt[MGWst[Cact]].src;
}
MDir[Cobj] = 0;
}
else if((drx <= 0) && MDir[Cobj] != 180)
{
if(MType[Cact] & (ACT_GEO_EAST))
{
//window.status = " Cobj=" + Cobj + " Cact=" + Cact + " MGEst[Cact]=" + MGEst[Cact] + "Gspt[MGEst[Cact]].src " + Gspt[MGEst[Cact]];
//window.status = " Cobj=" + Cobj + " Cact=" + Cact + " MGEst[Cact]=" + MGEst[Cact] + "Gspt[MGEst[Cact]].src " + Gspt[MGEst[Cact]];
//window.status = " ob[Cobj]=" + ob[Cobj] + " ob[Cobj].geom=" + ob[Cobj].geom.src;
ob[Cobj].geom.src = Gspt[MGEst[Cact]].src;
}
MDir[Cobj] = 180;
}
}
return;
}
function UpdStr() {
if(lstVal[Cobj] == ob[Cobj].val) return;
lstVal[Cobj] = ob[Cobj].val;
if(isIE4 || isIE5)
ob[Cobj].geom.innerText = ob[Cobj].val;
else
window.status = "Object " + ob[Cobj].geom + " Counter=" + ob[Cobj].val;
return;
}
function UpdAudio(on)
{
if(isIE4 || isIE5)
{
if(on > 0)
{
if(Scnt[Csnd] < 0) Scnt[Csnd] = 9999;
SoundEffect.loop= Scnt[Csnd];
SoundEffect.src = Snam[Csnd];
// SoundEffect.autostart=1;
lstsnd = Csnd;
}
else
{
if(lstsnd != Csnd) return;
SoundEffect.src= " ";
SoundEffect.loop= 0;
SoundEffect.autostart=0;
}
}
else if(isNav4)
{
// <embed id = BackMusic src=Snam[Csnd] autostart=true loop= Scnt[Csnd] hidden=true></embed>
}
}
/****************************************************************************/
function Evtest()
{
if(Active[Cobj] == 0)
{
if(AEvent[Cevt] & eANDtest)
ActANDTest();
else
ActORTest();
}
else if(Active[Cobj] == 1) {
if(DEvent[Cevt] & eANDtest)
DeactANDTest();
else
DeactORTest();
}
return;
}
/***************************************************************************/
function ActORTest()
{
if(((AEvent[Cevt] & eDELAY) && TimeCount() <= 0 ) ||
( (AEvent[Cevt] & eOBJECT_ENTER) && ObjectEnter(AEnter[Cevt]) ) ||
( (AEvent[Cevt] & eOBJECT_LEAVE) && ObjectLeave(ALeave[Cevt]) ) ||
( (AEvent[Cevt] & eMOUSE) && MouseSelect() > 0 ) ||
( (AEvent[Cevt] & eMOUSE_OVER) && MouseOver() ) ||
( (AEvent[Cevt] & eLMOUSE) && IsMouseLClick() ) ||
( (AEvent[Cevt] & eKEY) && KeyChar() ) ||
( (AEvent[Cevt] & eLT_VALUE) && ob[Cobj].val < AValue[Cevt]) ||
( (AEvent[Cevt] & eEQ_VALUE) && ob[Cobj].val == AValue[Cevt]) ||
( (AEvent[Cevt] & eGT_VALUE) && ob[Cobj].val > AValue[Cevt]) ||
( (AEvent[Cevt] & eENDPATH) && EndPath[Cobj] ) )
Active[Cobj] = 4;
}
/***************************************************************************/
function ActANDTest()
{
if(((AEvent[Cevt] & eDELAY) && !(TimeCount() <= 0) ) ||
( (AEvent[Cevt] & eOBJECT_ENTER) && !ObjectEnter(AEnter[Cevt]) ) ||
( (AEvent[Cevt] & eOBJECT_LEAVE) && !ObjectLeave(ALeave[Cevt]) ) ||
( (AEvent[Cevt] & eMOUSE) && !(MouseSelect() > 0) ) ||
( (AEvent[Cevt] & eMOUSE_OVER) && !MouseOver() ) ||
( (AEvent[Cevt] & eLMOUSE) && !IsMouseLClick() ) ||
( (AEvent[Cevt] & eKEY) && !KeyChar() ) ||
( (AEvent[Cevt] & eLT_VALUE) && !(ob[Cobj].val < AValue[Cevt])) ||
( (AEvent[Cevt] & eEQ_VALUE) && !(ob[Cobj].val == AValue[Cevt])) ||
( (AEvent[Cevt] & eGT_VALUE) && !(ob[Cobj].val > AValue[Cevt])) ||
( (AEvent[Cevt] & eENDPATH) && !EndPath[Cobj] ) )
{} else Active[Cobj] = 4;
}
/***************************************************************************/
function DeactORTest()
{
if(((DEvent[Cevt] & eDELAY) && TimeCount() <= 0 ) ||
( (DEvent[Cevt] & eOBJECT_ENTER) && ObjectEnter(DEnter[Cevt]) ) ||
( (DEvent[Cevt] & eOBJECT_LEAVE) && ObjectLeave(DLeave[Cevt]) ) ||
( (DEvent[Cevt] & eMOUSE) && MouseUp() > 0 ) ||
( (DEvent[Cevt] & eMOUSE_OVER) && !MouseOver() ) ||
( (DEvent[Cevt] & eLMOUSE) && IsMouseLClick() ) ||
( (DEvent[Cevt] & eKEY) && DKeyChar() ) ||
( (DEvent[Cevt] & eLT_VALUE) && ob[Cobj].val < AValue[Cevt]) ||
( (DEvent[Cevt] & eEQ_VALUE) && ob[Cobj].val == AValue[Cevt]) ||
( (DEvent[Cevt] & eGT_VALUE) && ob[Cobj].val > AValue[Cevt]) ||
( (DEvent[Cevt] & eENDPATH) && EndPath[Cobj] ) )
Active[Cobj] = 2;
}
/***************************************************************************/
function DeactANDTest()
{
if(((DEvent[Cevt] & eDELAY) && !(TimeCount() <= 0) ) ||
( (DEvent[Cevt] & eOBJECT_ENTER) && !ObjectEnter(DEnter[Cevt]) ) ||
( (DEvent[Cevt] & eOBJECT_LEAVE) && !ObjectLeave(DLeave[Cevt]) ) ||
( (DEvent[Cevt] & eMOUSE) && !(MouseUp() > 0) ) ||
( (DEvent[Cevt] & eMOUSE_OVER) && !MouseOver() ) ||
( (DEvent[Cevt] & eLMOUSE) && !IsMouseLClick() ) ||
( (DEvent[Cevt] & eKEY) && !DKeyChar() ) ||
( (DEvent[Cevt] & eLT_VALUE) && !(ob[Cobj].val < AValue[Cevt])) ||
( (DEvent[Cevt] & eEQ_VALUE) && !(ob[Cobj].val == AValue[Cevt])) ||
( (DEvent[Cevt] & eGT_VALUE) && !(ob[Cobj].val > AValue[Cevt])) ||
( (DEvent[Cevt] & eENDPATH) && !EndPath[Cobj] ) )
{} else Active[Cobj] = 2;
}
/**************************************************************************/
function TimeCount() {
return (TimeLeft[Cobj] - tickTime);
}
function ObjectEnter(eobj) {
x = Gszx[Cgeo] * ob[Cobj].cscx;
y = Gszy[Cgeo] * ob[Cobj].cscy;
if ( cpox[eobj] >= (cpox[Cobj] - x) && cpox[eobj] <= (cpox[Cobj]) + x &&
cpoy[eobj] >= (cpoy[Cobj] - y) && cpoy[eobj] <= (cpoy[Cobj]) + y )
return 1;
return 0;
}
function ObjectLeave(eobj) {
x = Gszx[Cgeo] * ob[Cobj].cscx;
y = Gszy[Cgeo] * ob[Cobj].cscy;
if ( cpox[eobj] >= cpox[Cobj] - x && cpox[eobj] <= cpox[Cobj] + x &&
cpoy[eobj] >= cpoy[Cobj] - y && cpoy[eobj] <= cpoy[Cobj] + y )
return 0;
return 1;
}
function MouseSelect() {
var val = 0;
if(smx == -99999) return val;
x = Gszx[Cgeo] * ob[Cobj].cscx;
y = Gszy[Cgeo] * ob[Cobj].cscy;
if ( smx >= cpox[Cobj] - x && smx <= cpox[Cobj] + x &&
smy >= cpoy[Cobj] - y && smy <= cpoy[Cobj] + y )
return val = 1;
return val;
}
function MouseOver() {
x = Gszx[Cgeo] * ob[Cobj].cscx;
y = Gszy[Cgeo] * ob[Cobj].cscy;
if ( cmx >= cpox[Cobj] - x && cmx <= cpox[Cobj] + x &&
cmy >= cpoy[Cobj] - y && cmy <= cpoy[Cobj] + y ) {
return 1;
}
return 0;
}
function IsMouseLClick() {
return (slm && 1);
}
function MouseUp() {
return (slm && 2);
}
function KeyChar() {
if(!sky) return 0;
if(isNav4 && (AKey[Cevt] == lky)) return 1;
if((isIE4 || isIE5) && (IKey[Cevt] == lky)) return 1;
return 0;
}
function DKeyChar() {
if(!sky) return 0;
if(isNav4 && (DAKey[Cevt] == sky)) return 1;
if((isIE4 || isIE5) && (DIKey[Cevt] == sky)) return 1;
return 0;
}
function MoOvrTst() {
for(i=0; i < MoLNo; i++) {
Cobj = Molst[i];
Cgeo = ob[Cobj].geo;
if(Version <= 105)
{
if(MouseOver() == 1) {
if(ob[Cobj].flg & 256) setVisibility("visible");
else setVisibility("hidden");
}
else {
if(ob[Cobj].flg & 128) setVisibility("visible");
else setVisibility("hidden");
}
}
else if(ob[Cobj].flg & 512)
{
if(MouseOver() == 1)
{
if(ob[Cobj].flg & 128) setVisibility("visible");
else setVisibility("hidden");
}
else
{
if(ob[Cobj].flg & 256) setVisibility("visible");
else setVisibility("hidden");
}
}
}}
/***************************************************************************/
function isDeactive() {
if(PathCount[Cobj] != 0) UpdPos();
if(Gtyp[Cgeo] & GEO_COUNT) UpdStr();
return;
}
function isActive() {
if(PathCount[Cobj] != 0) UpdPos();
if(Gtyp[Cgeo] & GEO_COUNT) UpdStr();
return;
}
function whenActive()
{
Active[Cobj] = 1;
EndPath[Cobj] = 0;
// set default active events
if(!Cevt)
{
TimeLeft[Cobj] = 0;
PathCount[Cobj] = 0;
setVisibility("visible")
}
else
{
// if(WAEvent[Cevt] & (1<<14)) window.location=WALink[Cevt];
// if(WAEvent[Cevt] & (1<<15)) window.location=WALink[Cevt];
if(WAEvent[Cevt] & (1<<14) || WAEvent[Cevt] & (1<<15))
{
newPage = Cevt;
}
if(Csnd > 0) UpdAudio((WAEvent[Cevt] & 16));
// if(WAEvent[Cevt] & 16) UpdAudio(); //sound
if(WAEvent[Cevt] & 8) setVisibility("visible");
else setVisibility("hidden");
TimeLeft[Cobj] = tickTime + (DTime[Cevt]);
// TimeLeft[Cobj] = (DTime[Cevt]);
if(WAEvent[Cevt] & (1<<5)) Active[WAAObj[Cevt]] = 4;
if(WAEvent[Cevt] & (1<<7)) Active[WADObj[Cevt]] = 2;
// apply value
if(WAEvent[Cevt] & (1<<13)) {
if ((OpForm[Cevt] & 0x000f) == 0)
ob[Cobj].val = WAForm[Cevt];
else if((OpForm[Cevt] & 0x000f) == 1)
ob[Cobj].val += WAForm[Cevt];
else if((OpForm[Cevt] & 0x000f) == 2)
ob[Cobj].val -= WAForm[Cevt];
else if((OpForm[Cevt] & 0x000f) == 3)
ob[Cobj].val *= WAForm[Cevt];
else if((OpForm[Cevt] & 0x000f) == 4)
if(WAForm[Cevt] != 0) ob[Cobj].val /= WAForm[Cevt];
}
// get value
if(WAEvent[Cevt] & (1<<11)) {
if ((WAGOp[Cevt] & 0x000f) == 0)
ob[Cobj].val = ob[WAGVal[Cevt]].val;
else if((WAGOp[Cevt] & 0x000f) == 1)
ob[Cobj].val += ob[WAGVal[Cevt]].val;
else if((WAGOp[Cevt] & 0x000f) == 2)
ob[Cobj].val -= ob[WAGVal[Cevt]].val;
else if((WAGOp[Cevt] & 0x000f) == 3)
ob[Cobj].val*= ob[WAGVal[Cevt]].val;
else if((WAGOp[Cevt] & 0x000f) == 4)
if(ob[WAGVal[Cevt]].val != 0) ob[Cobj].val /= ob[WAGVal[Cevt]].val;
}
// send result
if(WAEvent[Cevt] & (1<<9)) {
if ((WASOp[Cevt] & 0x000f) == 0)
ob[WASVal[Cevt]].val = ob[Cobj].val;
else if((WASOp[Cevt] & 0x000f) == 1)
ob[WASVal[Cevt]].val += ob[Cobj].val;
else if((WASOp[Cevt] & 0x000f) == 2)
ob[WASVal[Cevt]].val -= ob[Cobj].val;
else if((WASOp[Cevt] & 0x000f) == 3)
ob[WASVal[Cevt]].val *= ob[Cobj].val;
else if((WASOp[Cevt] & 0x000f) == 4)
if(ob[Cobj].val != 0) ob[WASVal[Cobj]].val /= ob[Cobj].val;
}
// motion
if(WAEvent[Cevt] & 4) PathCount[Cobj] = MCount[Cact];
else PathCount[Cobj] = 0; // motion
// replace current object components
if(WAEvent[Cevt] & (1<<17))
{
if(WAEvent[Cevt] & (1<<18)) {
ob[Cobj].geom = Gspt[WACgeo[Cevt]].src;
ob[Cobj].geo = WACgeo[Cevt];
}
if(WAEvent[Cevt] & (1<<18)) ob[Cobj].geo = WACgeo[Cevt];
if(WAEvent[Cevt] & (1<<18)) ob[Cobj].geom.src = Gspt[ob[Cobj].geo].src;
if(WAEvent[Cevt] & (1<<19)) ob[Cobj].att = WACatt[Cevt];
if(WAEvent[Cevt] & (1<<20)) ob[Cobj].act = WACact[Cevt];
if(WAEvent[Cevt] & (1<<22)) ob[Cobj].evt = WACevt[Cevt];
spox[Cobj] = cpox[Cobj];
spoy[Cobj] = cpoy[Cobj];
SetPath(Cobj);
}
// replace additional object components
for(ref=0; ref< WACobj[Cevt]; ref++) {
if(WAEvent[Cevt] & (1<<18)) {
ob[WANobj[Cevt][ref]].geom = Gspt[WACgeo[Cevt]].src;
ob[WANobj[Cevt][ref]].geo = WACgeo[Cevt];
}
if(WAEvent[Cevt] & (1<<18)) ob[WANobj[Cevt][ref]].geo = WACgeo[Cevt];
if(WAEvent[Cevt] & (1<<18)) ob[WANobj[Cevt][ref]].geom.src = Gspt[ob[Cobj].geo].src;
if(WAEvent[Cevt] & (1<<19)) ob[WANobj[Cevt][ref]].att = WACatt[Cevt];
if(WAEvent[Cevt] & (1<<20)) ob[WANobj[Cevt][ref]].act = WACact[Cevt];
if(WAEvent[Cevt] & (1<<22)) ob[WANobj[Cevt][ref]].evt = WACevt[Cevt];
spox[WANobj[Cevt][ref]] = cpox[Cobj];
spoy[WANobj[Cevt][ref]] = cpoy[Cobj];
SetPath(WANobj[Cevt][ref]);
}
if(WAEvent[Cevt] & (1<<30)) reset(Cobj);
}
}
function whenDeactive()
{
EndPath[Cobj] = 0;
Active[Cobj] = -1; // is disabled unless reset
if(!Cevt)
{
PathCount[Cobj] = -1;
TimeLeft[Cobj] = 0;
setVisibility("hidden");
}
else
{
if(WDEvent[Cevt] & 4) PathCount[Cobj] = MCount[Cact]; // motion
if(WDEvent[Cevt] & (1<<30)) reset(Cobj);
if(Csnd > 0) UpdAudio((WDEvent[Cevt] & 16)); //sound
if(WDEvent[Cevt] & 8) setVisibility("visible");
else setVisibility("hidden");
TimeLeft[Cobj] = tickTime + (ATime[Cevt]);
// TimeLeft[Cobj] = (ATime[Cevt]);
if(WDEvent[Cevt] & 4) PathCount[Cobj] = MCount[Cact]; // motion
else PathCount[Cobj] = 0;
if(WDEvent[Cevt] & (1<<5)) Active[WDAObj[Cevt]] = 4;
if(WDEvent[Cevt] & (1<<7)) Active[WDDObj[Cevt]] = 2;
}
}
//**************************************************************************
function reset(cobj) {
Cobj = cobj;
Csty = ob[cobj].style;
Cevt = ob[cobj].evt;
Catt = ob[cobj].att;
Cact = ob[cobj].act;
Cgrp = ob[cobj].grp;
Cgeo = ob[cobj].geo;
Active[cobj] = 0; // is deactive
if(Cevt)
{
if(WDEvent[Cevt] & 8) setVisibility("visible");
else setVisibility("hidden");
if(WDEvent[Cevt] & (1<<31)) {
PathCount[cobj] = MCount[Cact]; // restart path
cpox[cobj] = spox[cobj];
cpoy[cobj] = spoy[cobj];
cscx[cobj] = ob[cobj].cscx;
cscy[cobj] = ob[cobj].cscy;
crot[cobj] = ob[cobj].crot;
LastPt[cobj] = 0;
// atDis[cobj] = 0;
DisPt[cobj] = 0;
EndPath[cobj] = 0;
}
if(!(WDEvent[Cevt] & 4)) PathCount[cobj] = 0; // no motion
TimeLeft[cobj] = tickTime + (ATime[Cevt]);
// TimeLeft[cobj] = (ATime[Cevt]);
}
else if(Cgeo)
{
if(ob[cobj].flg & 64)
setVisibility("visible");
else
setVisibility("hidden");
// set action variables
if(Cact) PathCount[cobj] = MCount[Cact]; // motion
else PathCount[cobj] = 0;
TimeLeft[cobj] = 0;
cpox[cobj] = spox[cobj];
cpoy[cobj] = spoy[cobj];
LastPt[cobj] = 0;
// atDis[cobj] = 0;
DisPt[cobj] = 0;
EndPath[cobj] = 0;
// resetMatrix();
// appTrans(cobj);
// if(Cact) appMtrx();
}
return;
}
function SetPath(cobj) {
Cobj = cobj;
Csty = ob[Cobj].sty; // Style
Cevt = ob[Cobj].evt; // Objects event
Catt = ob[Cobj].att; // Objects attribute
Cact = ob[Cobj].act; // Objects action
Cgrp = ob[Cobj].grp; // Objects group
Cgeo = ob[Cobj].geo; // Objects geometry
Csnd = ob[Cobj].snd; // Objects sound
Cpob = MPath[Cact]; // Object actions path object
Cpgo = ob[Cpob].geo; // Path objects geometry
lstVal[Cobj] = ob[Cobj].val - 100;
MDir[Cobj] = -1;
// rotation and scaling
cscx[Cobj] = ob[Cobj].cscx;
cscy[Cobj] = ob[Cobj].cscy;
crot[Cobj] = ob[Cobj].crot;
rotate[Cobj]= MRotate[Cact];
scale[Cobj] = MScale[Cact];
cscx[Cobj] = ob[Cobj].cscx;
cscy[Cobj] = ob[Cobj].cscy;
scale[Cobj]= MScale[Cact];
if(!Cact) {
Plen[Cobj] = 0;
noStep[Cobj] = 0;
disStep[Cobj] = 0;
dpox[Cobj] = 0;
dpoy[Cobj] = 0;
PathCount[Cobj] = 0;
}
else {
// if(Version > 206)
// rate[Cobj] = MRate[Cact] * 0.1 / fps;
// else
// rate[Cobj] = MRate[Cact];
if(Version > 206)
rate[Cobj] = MRate[Cact] * 0.01;
else
rate[Cobj] = MRate[Cact];
PathCount[Cobj] = MCount[Cact];
if(MType[Cact] & ACT_XPATH_MOUSE || MType[Cact] & ACT_YPATH_MOUSE) {
Plen[Cobj] = 1;
noStep[Cobj] = 1;
disStep[Cobj] = 1;
dpox[Cobj] = 0;
dpoy[Cobj] = 0;
}
else if(MType[Cact] & ACT_XPATH_OBJPTH || MType[Cact] & ACT_XPATH_OBJXYZ) {
objPath(Cobj,Cpob,Cpgo);
}
else if(MType[Cact] & ACT_XPATH_KEYPTH) {
motionSetup(Cobj,Cpob,Cpgo);
}
else
{
linPath(Cobj);
}
}
cpox[Cobj] = spox[Cobj];
cpoy[Cobj] = spoy[Cobj];
LastPt[Cobj] = 0;
atDis[Cobj] = 0;
DisPt[Cobj] = 0;
EndPath[Cobj] = 0;
GetStartPos();
// atDis[Cobj] = Plen[Cobj] * MStart[Cact];
objStep[Cobj] = 0;
if(MFlags[Cact] & (1<<20))
{
noStep[Cobj] = MPLen[Cact] * 30;
}
noStep[Cobj] *= (MPLen[Cact] / 100.);
resetMatrix();
appTrans(Cobj);
// appMtrx();
return;
}
function getPathLenth(Cobj,Cpob,Cgeo)
// return lenth of transformed path
{
var i, x = 0.0, y = 0.0;
Plen[Cobj] = 0;
// find length of rectangle
if ((Gtyp[Cgeo] & GEO_TYPE) == 1) {
Plen[Cobj] = 2 * (Gpxl[Cgeo][1] - Gpxl[Cgeo][0]) * ob[Cpob].cscx
+ 2 * (Gpyl[Cgeo][1] - Gpyl[Cgeo][0]) * ob[Cpob].cscy;
}
// find length of ellipse
else if ((Gtyp[Cgeo] & GEO_TYPE) == 2) {
Plen[Cobj] = 360;
}
// find length of polygon
else if ((Gtyp[Cgeo] & GEO_TYPE) == 3) {
for ( i = 1; i < Gnpt[Cgeo]; i++)
{
x = (Gpxl[Cgeo][i] - Gpxl[Cgeo][i-1]) * ob[Cpob].cscx;
y = (Gpyl[Cgeo][i] - Gpyl[Cgeo][i-1]) * ob[Cpob].cscy;
Plen[Cobj] += Math.sqrt(x*x + y*y);
}
if(!(Gtyp[Cgeo] & GEO_OPEN))
{
x = (Gpxl[Cgeo][Gnpt[Cgeo]-1] - Gpxl[Cgeo][0]) * ob[Cpob].cscx;
y = (Gpyl[Cgeo][Gnpt[Cgeo]-1] - Gpyl[Cgeo][0]) * ob[Cpob].cscy;
Plen[Cobj] += Math.sqrt(x*x + y*y);
}
}
}
function linPath(Cobj) {
epox[Cobj] = spox[Cobj];
epoy[Cobj] = spoy[Cobj];
var lh = mH * (MPLen[Cact] / 100.);
var lw = mW * (MPLen[Cact] / 100.);
if(MType[Cact] & ACT_YPATH_UP) {
if(MType[Cact] & ACT_PATH_CENTER) {
spoy[Cobj] += lh;
epoy[Cobj] -= lh;
}
else if(MType[Cact] & ACT_PATH_END) {
spoy[Cobj] += lh;
}
else if(MType[Cact] & ACT_PATH_START) {
epoy[Cobj] -= lh;
}
}
else if(MType[Cact] & ACT_YPATH_DOWN) {
if(MType[Cact] & ACT_PATH_START) {
epoy[Cobj] += lh;
}
else if(MType[Cact] & ACT_PATH_END) {
spoy[Cobj] -= lh;
}
else if(MType[Cact] & ACT_PATH_CENTER) {
spoy[Cobj] -= lh;
epoy[Cobj] += lh;
}
}
else if(MType[Cact] & ACT_YPATH_MOUSE) {
Plen[Cobj] = 1;
noStep[Cobj] = 1;
disStep[Cobj] = 1;
dpoy[Cobj] = 0;
spoy[Cobj] = cpoy[Cobj];
}
if(MType[Cact] & ACT_XPATH_LEFT) {
if(MType[Cact] & ACT_PATH_CENTER) {
spox[Cobj] += lw;
epox[Cobj] -= lw;
}
else if(MType[Cact] & ACT_PATH_END) {
spox[Cobj] += lw;
}
else if(MType[Cact] & ACT_PATH_START) {
epox[Cobj] -= lw;
}
}
else if(MType[Cact] & ACT_XPATH_RIGHT) {
if(MType[Cact] & ACT_PATH_START) {
epox[Cobj] += lw;
}
else if(MType[Cact] & ACT_PATH_END) {
spox[Cobj] -= lw;
}
else if(MType[Cact] & ACT_PATH_CENTER) {
spox[Cobj] -= lw;
epox[Cobj] += lw;
}
}
else if(MType[Cact] & ACT_YPATH_MOUSE) {
Plen[Cobj] = 1;
noStep[Cobj] = 1;
disStep[Cobj] = 1;
dpox[Cobj] = 0;
spox[Cobj] = cpox[Cobj];
}
var x = epox[Cobj] - spox[Cobj];
var y = epoy[Cobj] - spoy[Cobj];
if(x+y)
{
Plen[Cobj] = Math.sqrt(x*x + y*y);
noStep[Cobj] = Math.abs(Plen[Cobj] / rate[Cobj]);
if(noStep[Cobj] < 1) noStep[Cobj] = 1;
disStep[Cobj] = Plen[Cobj] / noStep[Cobj];
dpox[Cobj] = x / noStep[Cobj];
dpoy[Cobj] = y / noStep[Cobj];
}
else
{
Plen[Cobj] = 0;
dpox[Cobj] = 0;
dpoy[Cobj] = 0;
disStep[Cobj] = 0;
}
return
}
function objPath(Cobj,Cpob,Cpgo)
{
if ((Gtyp[Cpgo] & GEO_TYPE) == 1) {
spox[Cobj] = Gpxl[Cpgo][0] * ob[Cpob].cscx + ob[Cpob].cpox;
spoy[Cobj] = Gpyl[Cpgo][0] * ob[Cpob].cscy + ob[Cpob].cpoy;
epox[Cobj] = spox[Cobj];
epoy[Cobj] = spoy[Cobj];
}
else if ((Gtyp[Cpgo] & GEO_TYPE) == 2) {
spox[Cobj] = Gpxl[Cpgo][0] * ob[Cpob].cscx + ob[Cpob].cpox;
// spoy[Cobj] = Gpyl[Cpgo][0] * ob[Cpob].cscy + ob[Cpob].cpoy + Gszy[Cpob] * ob[Cpob].cscy;
spoy[Cobj] = (Gpyl[Cpgo][0] + Gszy[Cpgo]) * ob[Cpob].cscy + ob[Cpob].cpoy;
epox[Cobj] = spox[Cobj];
epoy[Cobj] = spoy[Cobj];
}
else if ((Gtyp[Cpgo] & GEO_TYPE) == 3) {
spox[Cobj] = Gpxl[Cpgo][0] * ob[Cpob].cscx + ob[Cpob].cpox;
spoy[Cobj] = Gpyl[Cpgo][0] * ob[Cpob].cscy + ob[Cpob].cpoy;
if(Gtyp[Cpgo] & GEO_OPEN)
{
epox[Cobj] = Gpxl[Cpgo][Gnpt[Cpgo]-1] * ob[Cpob].cscx + ob[Cpob].cpox;
epoy[Cobj] = Gpyl[Cpgo][Gnpt[Cpgo]-1] * ob[Cpob].cscy + ob[Cpob].cpoy;
}
else
{
epox[Cobj] = spox[Cobj];
epoy[Cobj] = spoy[Cobj];
}
}
getPathLenth(Cobj,Cpob,Cpgo);
if(Cact)
noStep[Cobj] = Math.abs(Plen[Cobj] / rate[Cobj]);
else
noStep[Cobj] = 0;
if(noStep[Cobj] < 1) noStep[Cobj] = 1;
disStep[Cobj] = Plen[Cobj] / noStep[Cobj];
return;
}
function GetStartPos()
{
if(Plen[Cobj] == 0 || (MType[Cact] & ACT_XPATH_OBJXYZ)) return;
while(atDis[Cobj] < (Plen[Cobj] * MStart[Cact]))
{
if(MType[Cact] & ACT_XPATH_OBJPTH)
{
if ((Gtyp[Cpgo] & GEO_TYPE) == 1)
GetRectLoc();
else if((Gtyp[Cpgo] & GEO_TYPE) == 2)
{
GetArcLoc();
}
else if((Gtyp[Cpgo] & GEO_TYPE) == 3)
{
GetPathLoc();
}
cpox[Cobj] += cpox[Cpob];
cpoy[Cobj] += cpoy[Cpob];
}
else
{
if(MType[Cact] & ACT_XPATH_MOUSE)
cpox[Cobj] = cmx;
else
cpox[Cobj] += dpox[Cobj];
if(MType[Cact] & ACT_YPATH_MOUSE)
cpoy[Cobj] = cmy;
else
cpoy[Cobj] += dpoy[Cobj];
}
atDis[Cobj] += disStep[Cobj];
}
}
function motionSetup(Cobj,Cpob,Cpgo)
{
if(!Cobj || !Cpgo || !Cact) return;
objStep[Cobj] = 0;
objTime[Cobj] = -MDelay[Cact];
maxTime[Cobj] = Mctl[Cpgo][Gnpt[Cpgo]-1].tim;
if(MRepeat[Cact] >= 0)
TotTime[Cobj] = MRepeat[Cact] * maxTime[Cobj];
else
TotTime[Cobj] = -1;
}
/////////////////////////////////////////////////
function UpdPos() {
if(MType[Cact] & ACT_XPATH_KEYPTH)
motionUpdate();
else
animateUpdate();
}
function motionUpdate()
{
var res;
objTime[Cobj] = tickTime - MDelay[Cact];
if(objTime[Cobj] > maxTime[Cobj]) objStep[Cobj] = 0;
if((TotTime[Cobj] < 0 || tickTime < TotTime[Cobj]) && objTime[Cobj] > 0 && maxTime[Cobj] > 0)
objTime[Cobj] = objTime[Cobj] % (maxTime[Cobj]+1);
else if(objTime[Cobj] > maxTime[Cobj])
objTime[Cobj] = maxTime[Cobj];
else if(objTime[Cobj] < 0)
objTime[Cobj] = 0;
res = pathUpdate();
if(res == 0)
{
resetMatrix();
x = cpox[Cobj] - ob[Cobj].corx;
y = cpoy[Cobj] - ob[Cobj].cory;
cpox[Cobj] = x * ob[Cpob].m0 + y * ob[Cpob].m2 + ob[Cpob].m4;
cpoy[Cobj] = x * ob[Cpob].m1 + y * ob[Cpob].m3 + ob[Cpob].m5;
appTrans(Cobj);
if(Cact) appMtrx();
}
return res;
}
function pathUpdate()
{
if(objTime[Cobj] < Mctl[Cpgo][0].tim) return -1;
if(objTime[Cobj] > Mctl[Cpgo][Gnpt[Cpgo]-1].tim) return 1;
while(objTime[Cobj] > Mctl[Cpgo][objStep[Cobj]+1].tim)
{
if((objStep[Cobj] + 1) >= Gnpt[Cpgo]-1) {
objStep[Cobj] = Gnpt[Cpgo]-1;
return 1;
}
else
objStep[Cobj]++;
}
var cStep = objStep[Cobj];
var fact = (objTime[Cobj] - Mctl[Cpgo][cStep].tim) / (Mctl[Cpgo][cStep+1].tim-Mctl[Cpgo][cStep].tim);
if(fact < 0) fact = 0;
else if(fact > 1) fact = 1.0;
var ifact = 1.0 - fact;
cpox[Cobj] = Gpxl[Cpgo][cStep] + ((Gpxl[Cpgo][cStep+1] - Gpxl[Cpgo][cStep]) * fact);
cpoy[Cobj] = Gpyl[Cpgo][cStep] + ((Gpyl[Cpgo][cStep+1] - Gpyl[Cpgo][cStep]) * fact);
cscx[Cobj] = Mctl[Cpgo][cStep].sclx + (Mctl[Cpgo][cStep+1].sclx - Mctl[Cpgo][cStep].sclx) * fact;
cscy[Cobj] = Mctl[Cpgo][cStep].scly + (Mctl[Cpgo][cStep+1].scly - Mctl[Cpgo][cStep].scly) * fact;
crot[Cobj] = Mctl[Cpgo][cStep].rot + (Mctl[Cpgo][cStep+1].rot - Mctl[Cpgo][cStep].rot) * fact;
return 0;
}
function animateUpdate() {
Lpox = cpox[Cobj];
Lpoy = cpoy[Cobj];
// end of path condition
if(noStep[Cobj] > 0 && objStep[Cobj] >= noStep[Cobj])
{
objStep[Cobj] = 0;
atDis[Cobj] = Plen[Cobj] * MStart[Cact];
DisPt[Cobj] = 0;
LastPt[Cobj] = 0;
cpox[Cobj] = spox[Cobj];
cpoy[Cobj] = spoy[Cobj];
// reverse path, scaling, rotation, shading
if(MFlags[Cact] & (1<<11))
rate[Cobj] *= -1;
if(MFlags[Cact] & (1<<13))
rotate[Cobj] *= -1;
else
crot[cobj] = ob[cobj].crot;
if(MFlags[Cact] & (1<<19))
scale[Cobj] *= -1;
else
{
cscx[cobj] = ob[cobj].cscx;
cscy[cobj] = ob[cobj].cscy;
}
}
tranUpdate();
if(Plen[Cobj] != 0) atDis[Cobj] += disStep[Cobj];
objStep[Cobj]++;
if(noStep[Cobj] > 0 && objStep[Cobj] >= noStep[Cobj])
{
if(PathCount[Cobj] > 0) PathCount[Cobj]--;
if(PathCount[Cobj] == 0) {
EndPath[Cobj] = 1;
}
}
if(Cact) UpdGeo();
if(Cobj == pgScObj) {
var x = cpox[Cobj]-mW*0.5;
var y = cpoy[Cobj]-mH*0.5;
window.scrollTo(x,y);
}
return;
}
function tranUpdate()
{
resetMatrix();
// calculate rotation
if(rotate[Cobj] != 0)
{
if(MFlags[Cact] & (1<<12))
crot[Cobj] += rotate[Cobj] * 4;
else
crot[Cobj] = rotate[Cobj] * fact * 360;
}
// calculate scaling
if(scale[Cobj] != 0)
{
if(MFlags[Cact] & (1<<18))
{
cscx[Cobj] += scale[Cobj] / 360.;
cscy[Cobj] += scale[Cobj] / 360.;
}
else
{
var flt = (scale[Cobj] > 0) ? fact : ifact;
cscx[Cobj] = ob[Cobj].cscx * (flt + 1.);
cscy[Cobj] = ob[Cobj].cscy * (flt + 1.);
}
var fsize = 12 * cscx[Cobj];
}
// attached to the position of another Object
if(MType[Cact] & ACT_XPATH_OBJXYZ)
{
cpox[Cobj] = cpox[Cpob] - ob[Cobj].corx;
cpoy[Cobj] = cpoy[Cpob] - ob[Cobj].corx;
}
// trace an Object path
else if(MType[Cact] & ACT_XPATH_OBJPTH)
{
if ((Gtyp[Cpgo] & GEO_TYPE) == 1)
GetRectLoc();
else if((Gtyp[Cpgo] & GEO_TYPE) == 2)
{
GetArcLoc();
}
else if((Gtyp[Cpgo] & GEO_TYPE) == 3)
{
GetPathLoc();
}
x = cpox[Cobj] - ob[Cobj].corx;
y = cpoy[Cobj] - ob[Cobj].cory;
cpox[Cobj] = x * ob[Cpob].m0 + y * ob[Cpob].m2 + ob[Cpob].m4;
cpoy[Cobj] = x * ob[Cpob].m1 + y * ob[Cpob].m3 + ob[Cpob].m5;
}
// trace the mouse
else
{
if(MType[Cact] & ACT_XPATH_MOUSE)
cpox[Cobj] = cmx - ob[Cobj].corx;
else
cpox[Cobj] += dpox[Cobj]; //^^ is this STOP?
if(MType[Cact] & ACT_YPATH_MOUSE)
cpoy[Cobj] = cmy - ob[Cobj].cory;
else
cpoy[Cobj] += dpoy[Cobj];
}
appTrans(Cobj);
if(Cact) appMtrx();
}
function GetArcLoc() {
if(rate[Cobj] > 0)
{
cpox[Cobj] = (Math.sin(0.017453292*(-atDis[Cobj]-90)) * (Gszx[Cpgo] * 0.5));
cpoy[Cobj] = (Math.cos(0.017453292*(-atDis[Cobj]-90)) * (Gszy[Cpgo] * 0.5));
}
else
{
cpox[Cobj] = (Math.sin(0.017453292*(atDis[Cobj]-90)) * (Gszx[Cpgo] * 0.5));
cpoy[Cobj] = (Math.cos(0.017453292*(atDis[Cobj]-90)) * (Gszy[Cpgo] * 0.5));
}
return;
}
function GetPathLoc() {
var cPt, nPt, x, y, dis=0.0, ratio=0.0, ct = 0;
if(rate[Cobj] > 0)
{
while(ct <= Gnpt[Cpgo])
{
ct ++;
if(LastPt[Cobj]+1 < Gnpt[Cpgo])
{
cPt = LastPt[Cobj];
nPt = cPt + 1;
}
else
{
if(Gtyp[Cpgo] & GEO_OPEN)
{
LastPt[Cobj] = 0;
cPt = 0;
nPt = 1;
}
else
{
LastPt[Cobj] = Gnpt[Cpgo]-1;
cPt = LastPt[Cobj];
nPt = 0;
}
}
x = (Gpxl[Cpgo][nPt] - Gpxl[Cpgo][cPt]);
y = (Gpyl[Cpgo][nPt] - Gpyl[Cpgo][cPt]);
dis = Math.sqrt(x*x + y*y);
if(atDis[Cobj] < (dis + DisPt[Cobj])) break;
DisPt[Cobj] += dis;
LastPt[Cobj]++;
if(LastPt[Cobj] >= Gnpt[Cpgo])
{
cPt = 0;
nPt = 1;
LastPt[Cobj] = 0;
}
}
ratio = (atDis[Cobj] - DisPt[Cobj]) / dis;
cpox[Cobj] = Gpxl[Cpgo][cPt] + x * ratio;
cpoy[Cobj] = Gpyl[Cpgo][cPt] + y * ratio;
return;
}
else
{
while(ct <= Gnpt[Cpgo])
{
ct ++;
if(LastPt[Cobj]+1 < Gnpt[Cpgo])
{
cPt = Gnpt[Cpgo] - LastPt[Cobj] - 1;
nPt = cPt - 1;
}
else
{
if(Gtyp[Cpgo] & GEO_OPEN)
{
LastPt[Cobj] = Gnpt[Cpgo] - 1;
cPt = Gnpt[Cpgo] - 1;
nPt = cPt - 1;
}
else
{
LastPt[Cobj] = Gnpt[Cpgo];
cPt = 0;
nPt = LastPt[Cobj] - 1;
}
}
x = (Gpxl[Cpgo][nPt] - Gpxl[Cpgo][cPt]);
y = (Gpyl[Cpgo][nPt] - Gpyl[Cpgo][cPt]);
dis = Math.sqrt(x*x + y*y);
if(atDis[Cobj] <= (dis + DisPt[Cobj])) break;
DisPt[Cobj] += dis;
LastPt[Cobj]++;
if(LastPt[Cobj] >= Gnpt[Cpgo])
{
cPt = 0;
nPt = 1;
LastPt[Cobj] = 0;
}
}
ratio = (atDis[Cobj] - DisPt[Cobj]) / dis;
cpox[Cobj] = Gpxl[Cpgo][cPt] + x * ratio;
cpoy[Cobj] = Gpyl[Cpgo][cPt] + y * ratio;
return;
}
}
function GetRectLoc()
{
var dis = 0.0;
while (0==0)
{
if(rate[Cobj] > 0)
{
if(LastPt[Cobj] == 0)
{
dis = (Gpxl[Cpgo][1] - Gpxl[Cpgo][0]);
if((DisPt[Cobj] + dis) > atDis[Cobj])
{
cpox[Cobj] = Gpxl[Cpgo][0] + (atDis[Cobj]-DisPt[Cobj]);
cpoy[Cobj] = Gpyl[Cpgo][0];
break;
}
LastPt[Cobj] = 1;
DisPt[Cobj] += dis;
}
if(LastPt[Cobj] == 1)
{
dis = (Gpyl[Cpgo][1] - Gpyl[Cpgo][0]);
if((DisPt[Cobj] + dis) > atDis[Cobj])
{
cpox[Cobj] = Gpxl[Cpgo][1];
cpoy[Cobj] = Gpyl[Cpgo][0] + (atDis[Cobj]-DisPt[Cobj]);
break;
}
DisPt[Cobj] += dis;
LastPt[Cobj] = 2;
}
if(LastPt[Cobj] == 2)
{
dis = (Gpxl[Cpgo][1] - Gpxl[Cpgo][0]);
if((DisPt[Cobj] + dis) > atDis[Cobj])
{
cpox[Cobj] = Gpxl[Cpgo][1] - (atDis[Cobj]-DisPt[Cobj]);
cpoy[Cobj] = Gpyl[Cpgo][1];
break;
}
DisPt[Cobj] += dis;
LastPt[Cobj] = 3;
}
if(LastPt[Cobj] == 3)
{
dis = (Gpyl[Cpgo][1] - Gpyl[Cpgo][0]);
if((DisPt[Cobj] + dis) > atDis[Cobj])
{
cpox[Cobj] = Gpxl[Cpgo][0];
cpoy[Cobj] = Gpyl[Cpgo][1] - (atDis[Cobj]-DisPt[Cobj]);
break;
}
DisPt[Cobj] += dis;
LastPt[Cobj] = 0;
}
}
else
{
if(LastPt[Cobj] == 0)
{
dis = (Gpyl[Cpgo][1] - Gpyl[Cpgo][0]);
if((DisPt[Cobj] + dis) > atDis[Cobj])
{
cpox[Cobj] = Gpxl[Cpgo][0];
cpoy[Cobj] = Gpyl[Cpgo][0] + (atDis[Cobj]-DisPt[Cobj]);
break;
}
LastPt[Cobj] = 3;
DisPt[Cobj] += dis;
}
if(LastPt[Cobj] == 3)
{
dis = (Gpxl[Cpgo][1] - Gpxl[Cpgo][0]);
if((DisPt[Cobj] + dis) > atDis[Cobj])
{
cpox[Cobj] = Gpxl[Cpgo][0] + (atDis[Cobj]-DisPt[Cobj]);
cpoy[Cobj] = Gpyl[Cpgo][1];
break;
}
DisPt[Cobj] += dis;
LastPt[Cobj] = 2;
}
if(LastPt[Cobj] == 2)
{
dis = (Gpyl[Cpgo][1] - Gpyl[Cpgo][0]);
if((DisPt[Cobj] + dis) > atDis[Cobj])
{
cpox[Cobj] = Gpxl[Cpgo][1];
cpoy[Cobj] = Gpyl[Cpgo][1] - (atDis[Cobj]-DisPt[Cobj]);
break;
}
DisPt[Cobj] += dis;
LastPt[Cobj] = 1;
}
if(LastPt[Cobj] == 1)
{
dis = (Gpxl[Cpgo][1] - Gpxl[Cpgo][0]);
if((DisPt[Cobj] + dis) > atDis[Cobj])
{
cpox[Cobj] = Gpxl[Cpgo][1] - (atDis[Cobj]-DisPt[Cobj]);
cpoy[Cobj] = Gpyl[Cpgo][0];
break;
}
DisPt[Cobj] += dis;
LastPt[Cobj] = 0;
}
}
}
return;
}
function resetMatrix() {
cM = 0;
ob[Cobj].m0 = 1;
ob[Cobj].m1 = 0;
ob[Cobj].m2 = 0;
ob[Cobj].m3 = 1;
ob[Cobj].m4 = 0;
ob[Cobj].m5 = 0;
}
function appTrans(obj) {
resetMatrix();
moveMatrix(cpox[obj]+ob[Cobj].corx, cpoy[obj]+ob[Cobj].cory);
rotateMatrix(crot[obj]);
scaleMatrix(cscx[obj],cscy[obj]);
moveMatrix(-ob[Cobj].corx, -ob[Cobj].cory);
}
function moveMatrix(x, y) {
ob[Cobj].m4 += x * ob[Cobj].m0 + y * ob[Cobj].m2;
ob[Cobj].m5 += x * ob[Cobj].m1 + y * ob[Cobj].m3;
}
function scaleMatrix(x, y) {
ob[Cobj].m0 *= x;
ob[Cobj].m1 *= x;
ob[Cobj].m2 *= y;
ob[Cobj].m3 *= y;
}
function rotateMatrix(ang) {
//var cosAng = Math.cos(0.017453292*ang);
//var sinAng = Math.sin(0.017453292*ang);
var cosAng = Math.cos(ang);
var sinAng = Math.sin(ang);
var a = ob[Cobj].m0;
var b = ob[Cobj].m1;
var c = ob[Cobj].m2;
var d = ob[Cobj].m3;
var e = ob[Cobj].m4;
var f = ob[Cobj].m5;
ob[Cobj].m0 = a * cosAng + c * sinAng;
ob[Cobj].m1 = b * cosAng + d * sinAng;
ob[Cobj].m2 = a * -sinAng + c * cosAng;
ob[Cobj].m3 = b * -sinAng + d * cosAng;
}
function tranMatrix(cpob) {
var a = ob[Cobj].m0;
var b = ob[Cobj].m1;
var c = ob[Cobj].m2;
var d = ob[Cobj].m3;
var tx= ob[Cobj].m4;
var ty= ob[Cobj].m5;
ob[Cobj].m0 = a * ob[cpob].m0 + b * ob[cpob].m2;
ob[Cobj].m1 = a * ob[cpob].m1 + b * ob[cpob].m3;
ob[Cobj].m2 = c * ob[cpob].m0 + d * ob[cpob].m2;
ob[Cobj].m3 = c * ob[cpob].m1 + d * ob[cpob].m3;
ob[Cobj].m4 = tx * ob[cpob].m0 + ty * ob[cpob].m2 + ob[cpob].m4;
ob[Cobj].m5 = tx * ob[cpob].m1 + ty * ob[cpob].m3 + ob[cpob].m5;
}
function transPt(x1,y1,i) {
workX[i] = x1 * ob[Cobj].m0 + y1 * ob[Cobj].m2 + ob[Cobj].m4;
workY[i] = x1 * ob[Cobj].m1 + y1 * ob[Cobj].m3 + ob[Cobj].m5;
}
function appMtrx() {
if(Math.abs(cscx[Cobj]) < 0.01) cscx[Cobj] = 0.01;
if(Math.abs(cscy[Cobj]) < 0.01) cscy[Cobj] = 0.01;
var x = Gszx[Cgeo] * 0.5;
var y = Gszy[Cgeo] * 0.5;
transPt(x,y,0);
transPt(-x,y,1);
transPt(-x,-y,2);
transPt(x,-y,3);
xl = workX[0];
yl = workY[0];
xh = workX[0];
yh = workY[0];
for(i=1;i<4;i++) {
if(workX[i] < xl) xl = workX[i];
if(workY[i] < yl) yl = workY[i];
if(workX[i] > xh) xh = workX[i];
if(workY[i] > yh) yh = workY[i];
}
var width = xh - xl;
var height= yh - yl;
if(isNav4)
ob[Cobj].style.resizeTo(width, height);
else
{
ob[Cobj].geom.width = width;
ob[Cobj].geom.height = height;
}
//window.status = " Cobj=" + Cobj + " x=" + x + " y=" + y + " width=" + width + " height=" + height;
ob[Cobj].style.left=cpox[Cobj] - width*0.5;
ob[Cobj].style.top =cpoy[Cobj] - height*0.5;
}
//window.status = " Cobj=" + Cobj + " epox[Cobj]=" + epox[Cobj] + " Cgeo=" + Cgeo;
//window.status = " Deact Cobj=" + Cobj + " WDEvent[Cevt] & (1<<5)=" + WDEvent[Cevt] & (1<<5) + " Active[WDAObj[Cevt]]=" + Active[WDAObj[Cevt]];
//if(Math.abs(cscx[Cobj]) < 0.01) cscx[Cobj] = 0.01;
//if(Math.abs(cscy[Cobj]) < 0.01) cscy[Cobj] = 0.01;
//var x = Gszx[Cgeo] * 0.5;
//var y = Gszy[Cgeo] * 0.5;
//var x1 = -x * ob[Cobj].m0 + y * ob[Cobj].m2;
//var y1 = -x * ob[Cobj].m1 + y * ob[Cobj].m3;
//var width = x1;
//var height= y1;
//var x1 = x * ob[Cobj].m0 + y * ob[Cobj].m2;
//var y1 = x * ob[Cobj].m1 + y * ob[Cobj].m3;
//if(x1 > width) width = x1;
//if(y1 > height) height = y1;
//x1 = x * ob[Cobj].m0 + -y * ob[Cobj].m2;
//y1 = x * ob[Cobj].m1 + -y * ob[Cobj].m3;
//if(x1 > width) width = x1;
//if(y1 > height) height = y1;
//x1 = -x * ob[Cobj].m0 + -y * ob[Cobj].m2;
//y1 = -x * ob[Cobj].m1 + -y * ob[Cobj].m3;
//if(x1 > width) width = x1;
//if(y1 > height) height = y1;
//window.status = " Cgeo=" + Cgeo + " Gszx[Cgeo]=" + Gszx[Cgeo] + " Gszy[Cgeo]=" + Gszy[Cgeo] +" width=" + width + " height=" + height;
//width = width * 2;
//height = height* 2;