-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathValues.js
160 lines (152 loc) · 3.94 KB
/
Values.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// CDefStrings object
// --------------------------------------------------------------
/* Copyright (c) 1996-2012 Clickteam
*
* This source code is part of the HTML5 exporter for Clickteam Multimedia Fusion 2.
*
* Permission is hereby granted to any person obtaining a legal copy
* of Clickteam Multimedia Fusion 2 to use or modify this source code for
* debugging, optimizing, or customizing applications created with
* Clickteam Multimedia Fusion 2.
* Any other use of this source code is prohibited.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
function CDefStrings()
{
this.nStrings = 0;
this.strings = null;
}
CDefStrings.prototype =
{
load: function (file)
{
this.nStrings = file.readAShort();
this.strings = new Array(this.nStrings);
var n;
for (n = 0; n < this.nStrings; n++)
{
this.strings[n] = file.readAString();
}
}
}
// CDefValues object
// --------------------------------------------------------------
function CDefValues()
{
this.nValues = 0;
this.values = null;
this.flags = 0;
}
CDefValues.prototype =
{
load: function (file, initFlags)
{
this.nValues = file.readAShort();
this.values = new Array(this.nValues);
var n;
for (n = 0; n < this.nValues; n++)
{
this.values[n] = file.readAInt();
}
if (initFlags)
this.flags = file.readAInt();
}
}
// CRVal object
// --------------------------------------------------------------
CRVal.VALUES_NUMBEROF_ALTERABLE_DEFAULT = 26;
CRVal.STRINGS_NUMBEROF_ALTERABLE_DEFAULT = 10;
function CRVal()
{
this.rvValueFlags = 0;
this.rvValues = null;
this.rvStrings = null;
}
CRVal.prototype =
{
init: function (ho, ocPtr, cob)
{
this.rvValueFlags = 0;
var nValues = CRVal.VALUES_NUMBEROF_ALTERABLE_DEFAULT;
if (ocPtr.ocValues != null && ocPtr.ocValues.nValues > nValues)
nValues = ocPtr.ocValues.nValues;
this.rvValues = new Array(nValues);
var nStrings = CRVal.STRINGS_NUMBEROF_ALTERABLE_DEFAULT;
if (ocPtr.ocStrings != null && ocPtr.ocStrings.nStrings > nStrings)
nStrings = ocPtr.ocStrings.nStrings;
this.rvStrings = new Array(nStrings);
var n;
for (n = 0; n < this.rvValues.length; n++)
this.rvValues[n] = 0;
for (n = 0; n < this.rvStrings.length; n++)
this.rvStrings[n] = "";
if (ocPtr.ocValues != null)
{
this.rvValueFlags = ocPtr.ocValues.flags;
for (n = 0; n < ocPtr.ocValues.nValues; n++)
this.rvValues[n] = ocPtr.ocValues.values[n];
}
if (ocPtr.ocStrings != null)
{
for (n = 0; n < ocPtr.ocStrings.nStrings; n++)
this.rvStrings[n] = ocPtr.ocStrings.strings[n];
}
},
kill: function (bFast)
{
var n;
for (n = 0; n < this.rvValues.length; n++)
this.rvValues[n] = 0;
for (n = 0; n < this.rvStrings.length; n++)
this.rvStrings[n] = null;
},
getValue: function (n)
{
if (n < this.rvValues.length)
return this.rvValues[n];
return 0;
},
getString: function (n)
{
if (n < this.rvStrings.length)
return this.rvStrings[n];
return "";
},
setString: function (n, s)
{
if (n >= this.rov.rvStrings.length)
this.growStrings(n + 10);
this.rvStrings[n] = s;
},
setValue: function (n, v)
{
if (n >= this.rov.rvValues.length)
this.growValues(n + 10);
this.rvValues[n] = v;
},
growValues: function(num)
{
if (num > this.rvValues.length)
{
var n;
for (n = this.rvValues.length; n < num; n++)
this.rvValues[n] = 0;
}
},
growStrings: function(num)
{
if (num > this.rvStrings.length)
{
var n;
for (n = this.rvStrings.length; n < num; n++)
this.rvStrings[n] = "";
}
}
}