Frontier

Changes On Branch c
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch c Excluding Merge-Ins

This is equivalent to a diff from 0d2a2a6e92 to 178d1570f8

2012-10-10
02:56
Added a couple of long overdue comments. Leaf check-in: 178d1570f8 user: donnyjward@gmail.com tags: c
2012-09-02
07:26
Fixed compile error in Input. check-in: 186e43902a user: donnyjward@gmail.com tags: c
2012-07-26
23:53
Cleared c branch. check-in: 5e538deeed user: donnyjward@gmail.com tags: c
17:28
Added MQ-9 predator which faces the wrong way. Fixed issue with scaling before transforming that was causing scaled objects to move at scaled speeds. Leaf check-in: 0d2a2a6e92 user: donnyjward@gmail.com tags: trunk
16:13
Added missing airplane.obj check-in: b254f5d72a user: donnyjward@gmail.com tags: trunk

Deleted .classpath.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="src" path="test"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
	<classpathentry kind="lib" path="D:/eclipse/workspace/starfighter/lib/jars/lwjgl.jar">
		<attributes>
			<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="D:/eclipse/workspace/starfighter/lib/natives-win"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="lib" path="D:/eclipse/workspace/starfighter/lib/jars/slick-util.jar"/>
	<classpathentry kind="lib" path="D:/eclipse/workspace/starfighter/lib/jars/lwjgl_util.jar"/>
	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
	<classpathentry kind="output" path="bin"/>
</classpath>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























Added .gitignore.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
*~
\#*\#
/.emacs.desktop.
/.emacs.desktop.lock
.elc
auto-save-list
tramp
.\#*
*.exe

# Org-mode
.org-id-locations

*_archive

*.o

Deleted .project.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>starfighter</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
	</natures>
</projectDescription>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































Deleted .settings/org.eclipse.jdt.core.prefs.

1
2
3
4
5
6
7
8
9
10
11
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
<
<
<
<
<
<
<
<
<
<
<






















Added bin/CompiledBinariesGoHere.

Added lib/LibsGoHere.

Deleted lib/jars/lwjgl.jar.

cannot compute difference between binary files

Deleted lib/jars/lwjgl_util.jar.

cannot compute difference between binary files

Deleted lib/jars/slick-util orig.jar.

cannot compute difference between binary files

Deleted lib/jars/slick-util.jar.

cannot compute difference between binary files

Added lib/libglew32.a.

cannot compute difference between binary files

Added lib/liblua.a.

cannot compute difference between binary files

Added lib/liblualinux.a.

cannot compute difference between binary files

Deleted lib/natives-win/OpenAL32.dll.

cannot compute difference between binary files

Deleted lib/natives-win/OpenAL64.dll.

cannot compute difference between binary files

Deleted lib/natives-win/jinput-dx8.dll.

cannot compute difference between binary files

Deleted lib/natives-win/jinput-dx8_64.dll.

cannot compute difference between binary files

Deleted lib/natives-win/jinput-raw.dll.

cannot compute difference between binary files

Deleted lib/natives-win/jinput-raw_64.dll.

cannot compute difference between binary files

Deleted lib/natives-win/lwjgl.dll.

cannot compute difference between binary files

Deleted lib/natives-win/lwjgl64.dll.

cannot compute difference between binary files

Deleted logs/clog2012-07-24_2008PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-24_2009PDT.txt.

1
2
3
4
5
6
7
8
9
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
spectate 0
spectate 0
spectate 1
spectate 0
fov 85
====Sound test... exiting====
<
<
<
<
<
<
<
<
<


















Deleted logs/clog2012-07-24_2058PDT.txt.

1
2
3
4
5
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
spectate 0
====Sound test... exiting====
<
<
<
<
<










Deleted logs/clog2012-07-24_2059PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
<
<
<
<








Deleted logs/clog2012-07-24_2100PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
<
<
<
<








Deleted logs/clog2012-07-24_2102PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-24_2112PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-24_2115PDT.txt.

1
2
----Sound test... started----
====Starfighter Engine Revision -1====
<
<




Deleted logs/clog2012-07-24_2117PDT.txt.

1
2
----Sound test... started----
====Starfighter Engine Revision -1====
<
<




Deleted logs/clog2012-07-24_2119PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
spectate 0
<
<
<
<








Deleted logs/clog2012-07-24_2122PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-24_2123PDT.txt.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
----Sound test... started----
====Starfighter Engine Revision -1====
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.44236442, -0.14449286, -0.88511777], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -5.7494714E-11 1.8779938E-11 1.1503998E-10 1.0, Vector3f[0.73346823, -0.5096363, 0.44977], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[0.95421356, -0.043189723, 0.29598576], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[-0.1535665, -0.91989344, 0.36084726], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[0.95421356, -0.043189723, 0.29598576], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[-0.1535665, -0.91989344, 0.36084726], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[0.95421356, -0.043189723, 0.29598576], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[-0.1535665, -0.91989344, 0.36084726], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[0.95421356, -0.043189723, 0.29598576], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[-0.1535665, -0.91989344, 0.36084726], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[0.95421356, -0.043189723, 0.29598576], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[-0.1535665, -0.91989344, 0.36084726], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[0.95421356, -0.043189723, 0.29598576], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[-0.1535665, -0.91989344, 0.36084726], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[0.95421356, -0.043189723, 0.29598576], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2402054E-10 5.613432E-12 -3.8469707E-11 1.0, Vector3f[-0.1535665, -0.91989344, 0.36084726], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[0.9965356, -0.08013956, 0.022153063], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.295212E-10 1.0415857E-11 -2.8792663E-12 1.0, Vector3f[-0.08268866, -0.9273759, 0.36487484], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[0.9996316, -0.027043976, 0.0012779785], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2992361E-10 3.514946E-12 -1.6610078E-13 1.0, Vector3f[-0.02563899, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[0.9984975, -0.006134559, 0.05442021], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: -1.2977619E-10 7.9731767E-13 -7.073075E-12 1.0, Vector3f[-0.025638983, -0.9304391, 0.36554453], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: 6.440116E-10 2.3509474E-11 8.372271E-11 1.0, Vector3f[-0.991003, -0.0361763, -0.12883224], Vector4f: 0.0 0.0 0.0 0.0
0 length: Quaternion: 6.440116E-10 2.3509474E-11 8.372271E-11 1.0, Vector3f[0.09698014, -0.857547, -0.50518], Vector4f: 0.0 0.0 0.0 0.0
====Sound test... exiting====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































Deleted logs/clog2012-07-24_2153PDT.txt.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
----Sound test... started----
====Starfighter Engine Revision -1====
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -0.1
a1: -0.1
a1: -0.1
a1: -0.1
a1: -0.10000001
a1: -0.1
a1: -0.1
a1: -0.1
a1: -0.099999994
a1: -0.09999999
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.09999999
a1: -0.09999999
a1: -0.09999999
a1: -0.099999994
a1: -0.1
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.099999994
a1: -0.09999999
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.099999994
a1: 0.1
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999997
a1: 0.09999998
a1: 0.09999997
a1: 0.099999964
a1: 0.09999997
a1: 0.09999997
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999997
a1: 0.099999964
a1: 0.09999997
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999999
a1: 0.099999994
a1: 0.09999998
a1: 0.09999998
a1: 0.09999999
a1: 0.099999964
a1: 0.09999997
a1: 0.09999997
a1: 0.099999964
a1: 0.09999998
a1: 0.09999997
a1: 0.099999964
a1: 0.09999996
a1: 0.099999964
a1: 0.09999995
a1: 0.09999996
a1: 0.09999996
a1: 0.09999995
a1: 0.09999996
a1: 0.09999997
a1: 0.099999964
a1: 0.09999996
a1: 0.099999964
a1: 0.09999997
a1: 0.09999997
a1: 0.09999997
a1: 0.09999997
a1: 0.09999997
a1: 0.09999997
a1: 0.099999964
a1: 0.09999995
a1: 0.09999995
a1: 0.09999995
a1: 0.09999995
a1: 0.099999964
a1: 0.09999995
a1: 0.09999995
a1: 0.09999995
a1: 0.099999964
a1: 0.09999995
a1: 0.09999997
a1: 0.099999964
a1: 0.09999996
a1: 0.09999995
a1: 0.09999995
a1: 0.099999964
a1: 0.09999996
a1: 0.099999964
a1: 0.09999995
a1: 0.09999996
a1: 0.09999996
a1: 0.09999995
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.09999995
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.09999997
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.09999997
a1: 0.099999964
a1: 0.09999997
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999997
a1: 0.099999964
a1: 0.09999998
a1: 0.09999997
a1: 0.09999997
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999999
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.10000001
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.1
a1: 0.09999999
a1: 0.099999994
a1: 0.10000001
a1: 0.099999994
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.100000024
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.1
a1: 0.100000024
a1: 0.10000002
a1: 0.10000001
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.10000002
a1: 0.10000001
a1: 0.100000024
a1: 0.10000003
a1: 0.10000002
a1: 0.10000001
a1: 0.1
a1: 0.10000002
a1: 0.10000001
a1: 0.10000001
a1: 0.10000002
a1: 0.10000001
a1: 0.10000001
a1: 0.10000002
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.10000001
a1: 0.10000001
a1: 0.099999994
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.10000001
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.099999994
a1: 0.09999999
a1: 0.099999994
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999997
a1: 0.099999994
a1: 0.09999997
a1: 0.099999964
a1: 0.09999997
a1: 0.09999997
a1: 0.09999996
a1: 0.099999964
a1: 0.09999997
a1: 0.099999964
a1: 0.099999964
a1: 0.09999996
a1: 0.09999995
a1: 0.09999996
a1: 0.09999996
a1: 0.09999995
a1: 0.09999994
a1: 0.09999995
a1: 0.099999964
a1: 0.09999996
a1: 0.09999996
a1: 0.099999964
a1: 0.09999996
a1: 0.09999995
a1: 0.09999994
a1: 0.09999995
a1: 0.09999995
a1: 0.09999995
a1: 0.09999996
a1: 0.09999995
a1: 0.09999995
a1: 0.099999934
a1: 0.09999995
a1: 0.09999995
a1: 0.09999994
a1: 0.09999994
a1: 0.099999934
a1: 0.099999934
a1: 0.099999934
a1: 0.09999993
a1: 0.09999992
a1: 0.09999992
a1: 0.09999993
a1: 0.09999992
a1: 0.09999992
a1: 0.099999905
a1: 0.099999905
a1: 0.09999991
a1: 0.0999999
a1: 0.099999905
a1: 0.0999999
a1: 0.09999991
a1: 0.099999905
a1: 0.099999905
a1: 0.099999905
a1: 0.099999905
a1: 0.099999905
a1: 0.0999999
a1: 0.0999999
a1: 0.09999989
a1: 0.09999989
a1: 0.09999989
a1: 0.099999875
a1: 0.09999989
a1: 0.09999989
a1: 0.09999988
a1: 0.09999989
a1: 0.099999875
a1: 0.099999875
a1: 0.099999875
a1: 0.099999875
a1: 0.09999986
a1: 0.099999875
a1: 0.09999986
a1: 0.09999986
a1: 0.09999986
a1: 0.099999875
a1: 0.099999875
a1: 0.09999985
a1: 0.09999986
a1: 0.09999986
a1: 0.09999986
a1: 0.09999986
a1: 0.09999985
a1: 0.09999985
a1: 0.09999986
a1: 0.099999845
a1: 0.09999985
a1: 0.09999984
a1: 0.099999845
a1: 0.099999845
a1: 0.09999984
a1: 0.099999845
a1: 0.099999845
a1: 0.099999845
a1: 0.099999845
a1: 0.099999845
a1: 0.09999983
a1: 0.09999983
a1: 0.09999984
a1: 0.09999982
a1: 0.09999983
a1: 0.09999982
a1: 0.09999983
a1: 0.09999982
a1: 0.09999983
a1: 0.09999983
a1: 0.09999982
a1: 0.09999982
a1: 0.09999982
a1: 0.09999982
a1: 0.09999984
a1: 0.099999845
a1: 0.09999984
a1: 0.099999845
a1: 0.099999845
a1: 0.09999984
a1: 0.099999845
a1: 0.09999985
a1: 0.09999985
a1: 0.09999985
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: 9.313226E-10
a1: 9.313226E-10
a1: 9.313226E-10
a1: -1.8626451E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.09999985
a1: 0.09999985
a1: 0.09999985
a1: 0.09999986
a1: 0.09999987
a1: 0.09999985
a1: 0.09999985
a1: 0.09999986
a1: 0.09999987
a1: 0.099999875
a1: 0.09999987
a1: 0.099999875
a1: 0.09999987
a1: 0.09999987
a1: 0.09999987
a1: 0.09999987
a1: 0.09999987
a1: 0.09999987
a1: 0.09999986
a1: 0.09999988
a1: 0.099999875
a1: 0.099999875
a1: 0.09999987
a1: 0.09999988
a1: 0.0999999
a1: 0.09999989
a1: 0.0999999
a1: 0.0999999
a1: 0.0999999
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -0.09999991
a1: -0.0999999
a1: -0.0999999
a1: -0.09999989
a1: -0.09999989
a1: -0.09999988
a1: -0.099999875
a1: -0.099999875
a1: -0.09999988
a1: -0.099999875
a1: -0.09999987
a1: -0.099999875
a1: -0.09999987
a1: -0.09999986
a1: -0.09999985
a1: -0.09999985
a1: -0.09999986
a1: -0.09999985
a1: -0.099999845
a1: -0.09999984
a1: -0.09999984
a1: -0.09999984
a1: -0.09999982
a1: -0.099999815
a1: -0.09999981
a1: -0.09999981
a1: -0.0999998
a1: -0.0999998
a1: -0.099999785
a1: -0.0999998
a1: -0.0999998
a1: -0.09999979
a1: -0.099999785
a1: -0.099999785
a1: -0.09999978
a1: -0.09999977
a1: -0.09999978
a1: -0.09999978
a1: -0.09999976
a1: -0.09999976
a1: -0.099999756
a1: -0.09999975
a1: -0.09999974
a1: -0.09999974
a1: -0.09999973
a1: -0.09999973
a1: -0.09999974
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.09999972
a1: -0.09999972
a1: -0.09999972
a1: -0.09999972
a1: -0.0999997
a1: -0.099999696
a1: -0.0999997
a1: -0.0999997
a1: -0.09999969
a1: -0.09999968
a1: -0.09999969
a1: -0.09999968
a1: -0.09999967
a1: -0.09999968
a1: -0.099999666
a1: -0.09999967
a1: -0.09999966
a1: -0.099999666
a1: -0.09999966
a1: -0.099999666
a1: -0.099999666
a1: -0.099999666
a1: -0.09999966
a1: -0.099999666
a1: -0.09999966
a1: -0.09999965
a1: -0.09999964
a1: -0.09999965
a1: -0.099999644
a1: -0.09999965
a1: -0.09999966
a1: -0.09999965
a1: -0.099999644
a1: -0.099999644
a1: -0.099999644
a1: -0.099999644
a1: -0.09999965
a1: -0.09999965
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.09999965
a1: 0.099999644
a1: 0.09999965
a1: 0.09999964
a1: 0.099999644
a1: 0.09999964
a1: 0.09999964
a1: 0.09999965
a1: 0.099999644
a1: 0.099999644
a1: 0.09999964
a1: 0.09999964
a1: 0.09999964
a1: 0.099999644
a1: 0.09999964
a1: 0.09999965
a1: 0.09999966
a1: 0.09999966
a1: 0.09999965
a1: 0.09999966
a1: 0.099999666
a1: 0.099999666
a1: 0.09999965
a1: 0.09999965
a1: 0.09999966
a1: 0.099999666
a1: 0.09999966
a1: 0.09999966
a1: 0.09999966
a1: 0.099999666
a1: 0.099999666
a1: 0.09999967
a1: 0.09999968
a1: 0.09999967
a1: 0.099999666
a1: 0.099999666
a1: 0.09999967
a1: 0.09999968
a1: 0.09999967
a1: 0.09999968
a1: 0.09999969
a1: 0.09999969
a1: 0.09999971
a1: 0.0999997
a1: 0.0999997
a1: 0.09999972
a1: 0.09999971
a1: 0.0999997
a1: 0.09999971
a1: 0.0999997
a1: 0.09999971
a1: 0.099999726
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.09999975
a1: 0.09999975
a1: 0.09999974
a1: 0.099999726
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.099999726
a1: 0.09999974
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 2.7939677E-9
a1: 4.656613E-10
a1: -9.313226E-10
a1: 9.313226E-10
a1: 1.8626451E-9
a1: 4.656613E-9
a1: 3.259629E-9
a1: -9.313226E-10
a1: 9.313226E-10
a1: 1.8626451E-9
a1: 4.656613E-10
a1: 9.313226E-10
a1: 0.0
a1: 3.259629E-9
a1: 9.313226E-10
a1: -4.656613E-10
a1: 1.3969839E-9
a1: 3.7252903E-9
a1: 5.122274E-9
a1: 1.1641532E-9
a1: 3.4924597E-9
a1: -1.6298145E-9
a1: 1.3969839E-9
a1: 3.259629E-9
a1: 3.958121E-9
a1: 4.8894435E-9
a1: 5.122274E-9
a1: 3.7252903E-9
a1: 2.3283064E-10
a1: -1.6298145E-9
a1: 1.8626451E-9
a1: 2.0954758E-9
a1: 1.3969839E-9
a1: 2.3283064E-10
a1: -2.3283064E-10
a1: 1.7462298E-9
a1: 1.8626451E-9
a1: -1.3387762E-9
a1: 6.2282197E-9
a1: 2.7939677E-9
a1: 7.566996E-10
a1: 4.7439244E-9
a1: 6.548362E-10
a1: -2.9704097E-9
a1: 5.355105E-9
a1: 7.566996E-10
a1: 2.2992026E-9
a1: 7.21775E-9
a1: 1.6298145E-9
a1: 1.3969839E-9
a1: -4.656613E-10
a1: 1.5133992E-9
a1: 1.9790605E-9
a1: 2.7939677E-9
a1: 5.005859E-9
a1: 3.8417056E-9
a1: 1.3969839E-9
a1: 6.9849193E-10
a1: 0.0
a1: 3.4924597E-9
a1: 2.0954758E-9
a1: 4.1909516E-9
a1: -1.6298145E-9
a1: 3.4924597E-9
a1: 3.4924597E-9
a1: 2.7939677E-9
a1: 2.0954758E-9
a1: 3.259629E-9
a1: -2.3283064E-10
a1: -1.8626451E-9
a1: 1.3969839E-9
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -5.122274E-9
a1: -2.7939677E-9
a1: 6.9849193E-10
a1: -4.656613E-10
a1: 4.656613E-10
a1: -2.7939677E-9
a1: 6.9849193E-10
a1: -2.7939677E-9
a1: -2.3283064E-10
a1: 2.561137E-9
a1: -3.0267984E-9
a1: -1.1641532E-9
a1: -2.3283064E-9
a1: -3.4924597E-9
a1: -4.8894435E-9
a1: -6.0535967E-9
a1: -4.0745363E-9
a1: -2.4447218E-9
a1: -3.958121E-9
a1: -8.1490725E-10
a1: 2.3283064E-10
a1: -4.1909516E-9
a1: -2.2700988E-9
a1: -2.4447218E-9
a1: -4.2491592E-9
a1: -2.9976945E-9
a1: -1.4260877E-9
a1: 1.193257E-9
a1: -1.6279955E-9
a1: -1.4406396E-9
a1: -1.6880222E-9
a1: -5.005859E-9
a1: 6.9849193E-10
a1: -2.2700988E-9
a1: -1.6298145E-9
a1: -6.9849193E-10
a1: 2.2118911E-9
a1: -2.910383E-9
a1: 1.2805685E-9
a1: -3.0267984E-9
a1: 1.5133992E-9
a1: -2.0954758E-9
a1: 9.313226E-10
a1: -3.0267984E-9
a1: -1.8626451E-9
a1: 1.3969839E-9
a1: -5.122274E-9
a1: -6.9849193E-10
a1: 1.8626451E-9
a1: 9.313226E-10
a1: 1.3969839E-9
a1: 2.3283064E-10
a1: -4.4237822E-9
a1: -1.8626451E-9
a1: -3.259629E-9
a1: -9.313226E-10
a1: -3.7252903E-9
a1: 9.313226E-10
a1: -9.313226E-10
a1: -9.313226E-10
a1: -4.1909516E-9
a1: -1.8626451E-9
a1: -2.3283064E-9
a1: -1.8626451E-9
a1: -4.656613E-10
a1: -3.7252903E-9
a1: 1.3969839E-9
a1: 1.3969839E-9
a1: -2.7939677E-9
a1: -4.656613E-9
a1: -3.259629E-9
a1: 0.0
a1: -1.3969839E-9
a1: -9.313226E-10
a1: -1.3969839E-9
a1: 4.656613E-10
a1: -2.3283064E-9
a1: 1.8626451E-9
a1: 9.313226E-10
a1: -2.7939677E-9
a1: -1.3969839E-9
a1: -9.313226E-10
a1: -1.8626451E-9
a1: -1.3969839E-9
a1: -4.656613E-10
a1: -4.656613E-10
a1: -4.656613E-10
a1: -9.313226E-10
a1: 4.656613E-10
a1: -9.313226E-10
a1: 0.0
a1: 4.656613E-10
a1: 1.3969839E-9
a1: 0.0
a1: 4.656613E-10
a1: 0.0
a1: 9.313226E-10
a1: 9.313226E-10
a1: 0.0
a1: 0.0
a1: -4.656613E-10
a1: -4.656613E-10
a1: 0.0
a1: -4.656613E-10
a1: 0.0
a1: 0.0
a1: 9.313226E-10
a1: 0.0
a1: 9.313226E-10
a1: 0.0
a1: 4.656613E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 9.313226E-10
a1: 9.313226E-10
a1: 9.313226E-10
a1: 0.0
a1: 0.0
a1: 9.313226E-10
a1: -4.656613E-10
a1: 1.3969839E-9
a1: -1.8626451E-9
a1: -9.313226E-10
a1: 9.313226E-10
a1: -1.3969839E-9
a1: 9.313226E-10
a1: 4.656613E-10
a1: 2.3283064E-9
a1: -9.313226E-10
a1: -9.313226E-10
a1: 0.0
a1: -1.3969839E-9
a1: 9.313226E-10
a1: 1.3969839E-9
a1: -4.656613E-10
a1: 0.0
a1: 9.313226E-10
a1: -4.656613E-10
a1: -2.3283064E-9
a1: -9.313226E-10
a1: 4.656613E-10
a1: 1.3969839E-9
a1: 3.259629E-9
a1: -1.3969839E-9
a1: -9.313226E-10
a1: 9.313226E-10
a1: 9.313226E-10
a1: 2.3283064E-9
a1: 0.0
a1: 9.313226E-10
a1: 4.656613E-10
a1: 1.3969839E-9
a1: -1.3969839E-9
a1: -4.656613E-10
a1: -4.656613E-10
a1: -2.3283064E-9
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -2.7939677E-9
a1: -9.313226E-10
a1: -9.313226E-10
a1: 9.313226E-10
a1: 2.7939677E-9
a1: 1.3969839E-9
a1: -2.7939677E-9
a1: -1.3969839E-9
a1: -3.7252903E-9
a1: -9.313226E-10
a1: -2.7939677E-9
a1: -1.3969839E-9
a1: 4.656613E-10
a1: -3.7252903E-9
a1: 1.3969839E-9
a1: -4.656613E-10
a1: 0.0
a1: 1.8626451E-9
a1: 1.3969839E-9
a1: -4.656613E-10
a1: -1.8626451E-9
a1: -1.8626451E-9
a1: 9.313226E-10
a1: -1.3969839E-9
a1: 1.3969839E-9
a1: -1.3969839E-9
a1: -9.313226E-10
a1: -4.656613E-10
a1: -4.656613E-10
a1: 4.656613E-10
a1: -9.313226E-10
a1: 0.0
a1: -9.313226E-10
a1: 0.0
a1: 1.3969839E-9
a1: -4.656613E-10
a1: -4.656613E-10
a1: -9.313226E-10
a1: -4.656613E-10
a1: 4.656613E-10
a1: 9.313226E-10
a1: 4.656613E-10
a1: 4.656613E-10
a1: 0.0
a1: 4.656613E-10
a1: 9.313226E-10
a1: 4.656613E-10
a1: 9.313226E-10
a1: 9.313226E-10
a1: 9.313226E-10
a1: 0.0
a1: 9.313226E-10
a1: 0.0
a1: -9.313226E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 4.656613E-10
a1: 4.656613E-10
a1: 4.656613E-10
a1: -9.313226E-10
a1: 4.656613E-10
a1: 1.3969839E-9
a1: 4.656613E-10
a1: 0.0
a1: 9.313226E-10
a1: -9.313226E-10
a1: 0.0
a1: 0.0
a1: 1.3969839E-9
a1: 0.0
a1: -9.313226E-10
a1: 0.0
a1: 9.313226E-10
a1: 9.313226E-10
a1: 4.656613E-10
a1: 1.3969839E-9
a1: -1.8626451E-9
a1: -4.656613E-10
a1: 1.3969839E-9
a1: -2.3283064E-9
a1: 1.8626451E-9
a1: -4.656613E-10
a1: 1.3969839E-9
a1: 9.313226E-10
a1: 2.3283064E-9
a1: -4.656613E-10
a1: -4.656613E-10
a1: -1.3969839E-9
a1: -1.8626451E-9
a1: -1.8626451E-9
a1: 1.8626451E-9
a1: -1.3969839E-9
a1: 0.0
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: 9.313226E-10
a1: -3.259629E-9
a1: -9.313226E-10
a1: 1.3969839E-9
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: 2.7939677E-9
a1: -4.1909516E-9
a1: 0.0
a1: 3.259629E-9
a1: -4.656613E-10
a1: -9.313226E-10
a1: 0.0
a1: -3.259629E-9
a1: 4.656613E-10
a1: 9.313226E-10
a1: 4.656613E-10
a1: -1.3969839E-9
a1: 0.0
a1: 9.313226E-10
a1: -1.8626451E-9
a1: -2.7939677E-9
a1: 9.313226E-10
a1: 0.0
a1: -1.3969839E-9
a1: -4.656613E-10
a1: -9.313226E-10
a1: 9.313226E-10
a1: 1.3969839E-9
a1: -4.656613E-10
a1: 4.656613E-10
a1: 4.656613E-10
a1: 4.656613E-10
a1: 9.313226E-10
a1: -9.313226E-10
a1: 4.656613E-10
a1: 4.656613E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: -4.656613E-10
a1: -1.8626451E-9
a1: 0.0
a1: -4.656613E-10
a1: 4.656613E-10
a1: -4.656613E-10
a1: -4.656613E-10
a1: 0.0
a1: -9.313226E-10
a1: -1.3969839E-9
a1: 0.0
a1: -9.313226E-10
a1: 0.0
a1: -9.313226E-10
a1: 0.0
a1: -1.8626451E-9
a1: -9.313226E-10
a1: 0.0
a1: 0.0
a1: -9.313226E-10
a1: 9.313226E-10
a1: -1.3969839E-9
a1: -9.313226E-10
a1: -9.313226E-10
a1: -4.656613E-10
a1: 4.656613E-10
a1: -4.656613E-10
a1: -9.313226E-10
a1: -4.656613E-10
a1: 0.0
a1: -1.8626451E-9
a1: 1.3969839E-9
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: 2.3283064E-9
a1: 1.3969839E-9
a1: 1.3969839E-9
a1: 4.656613E-10
a1: 4.656613E-10
a1: 0.0
a1: 1.3969839E-9
a1: 4.656613E-10
a1: 4.656613E-10
a1: 1.8626451E-9
a1: 9.313226E-10
a1: 9.313226E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 4.656613E-10
a1: 0.0
a1: 4.656613E-10
a1: 0.0
a1: 9.313226E-10
a1: -4.656613E-10
a1: 0.0
a1: -4.656613E-10
a1: -4.656613E-10
a1: -4.656613E-10
a1: 0.0
a1: 4.656613E-10
a1: 0.0
a1: 9.313226E-10
a1: 4.656613E-10
a1: -1.3969839E-9
a1: 9.313226E-10
a1: -4.656613E-10
a1: 9.313226E-10
a1: -4.656613E-10
a1: -4.656613E-10
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: 4.656613E-10
a1: 1.3969839E-9
a1: -9.313226E-10
a1: -1.3969839E-9
a1: 4.656613E-10
a1: -4.656613E-10
a1: 0.0
a1: -3.7252903E-9
a1: 1.3969839E-9
a1: 4.656613E-10
a1: -1.8626451E-9
a1: -4.656613E-10
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.099999696
a1: 0.09999969
a1: 0.099999696
a1: 0.09999969
a1: 0.09999969
a1: 0.09999968
a1: 0.09999969
a1: 0.09999968
a1: 0.09999967
a1: 0.09999966
a1: 0.099999666
a1: 0.099999666
a1: 0.09999965
a1: 0.099999666
a1: 0.099999666
a1: 0.09999965
a1: 0.09999966
a1: 0.099999644
a1: 0.09999965
a1: 0.099999644
a1: 0.09999963
a1: 0.09999964
a1: 0.09999963
a1: 0.09999964
a1: 0.09999964
a1: 0.09999963
a1: 0.09999964
a1: 0.09999964
a1: 0.09999964
a1: 0.09999962
a1: 0.09999963
a1: 0.09999963
a1: 0.09999964
a1: 0.09999964
a1: 0.09999963
a1: 0.09999962
a1: 0.09999963
a1: 0.099999614
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.099999614
a1: 0.09999962
a1: 0.09999963
a1: 0.09999964
a1: 0.09999964
a1: 0.09999964
a1: 0.09999963
a1: 0.09999963
a1: 0.099999614
a1: 0.09999962
a1: 0.09999963
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999963
a1: 0.09999962
a1: 0.099999614
a1: 0.09999964
a1: 0.09999963
a1: 0.099999614
a1: 0.09999961
a1: 0.09999961
a1: 0.09999962
a1: 0.09999961
a1: 0.09999961
a1: 0.09999961
a1: 0.099999614
a1: 0.09999962
a1: 0.09999962
a1: 0.09999961
a1: 0.09999961
a1: 0.09999962
a1: 0.099999614
a1: 0.09999962
a1: 0.09999962
a1: 0.099999614
a1: 0.09999962
a1: 0.099999614
a1: 0.099999614
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999963
a1: 0.09999962
a1: 0.09999962
a1: 0.099999614
a1: 0.09999962
a1: 0.09999963
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999964
a1: 0.09999964
a1: 0.099999644
a1: 0.09999964
a1: 0.09999964
a1: 0.09999962
a1: 0.09999964
a1: 0.09999964
a1: 0.099999614
a1: 0.09999964
a1: 0.09999964
a1: 0.09999964
a1: 0.09999964
a1: 0.09999964
a1: 0.09999964
a1: 0.09999965
a1: 0.09999964
a1: 0.099999644
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.099999644
a1: 0.09999964
a1: 0.09999964
a1: 0.09999964
a1: 0.09999963
a1: 0.09999964
a1: 0.09999964
a1: 0.09999962
a1: 0.09999962
a1: 0.09999963
a1: 0.09999962
a1: 0.09999961
a1: 0.099999614
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999964
a1: 0.09999963
a1: 0.09999962
a1: 0.09999964
a1: 0.09999963
a1: 0.09999964
a1: 0.09999963
a1: 0.09999964
a1: 0.09999963
a1: 0.099999644
a1: 0.09999965
a1: 0.099999666
a1: 0.09999965
a1: 0.09999966
a1: 0.09999965
a1: 0.099999666
a1: 0.09999965
a1: 0.099999666
a1: 0.099999666
a1: 0.09999966
a1: 0.099999666
a1: 0.09999966
a1: 0.09999965
a1: 0.09999967
a1: 0.09999966
a1: 0.099999666
a1: 0.09999966
a1: 0.099999666
a1: 0.09999967
a1: 0.099999666
a1: 0.099999666
a1: 0.099999666
a1: 0.099999666
a1: 0.099999666
a1: 0.09999967
a1: 0.09999967
a1: 0.09999967
a1: 0.09999967
a1: 0.09999965
a1: 0.099999644
a1: 0.09999966
a1: 0.099999666
a1: 0.09999966
a1: 0.09999966
a1: 0.099999666
a1: 0.09999967
a1: 0.09999967
a1: 0.09999966
a1: 0.09999965
a1: 0.09999966
a1: 0.099999666
a1: 0.09999965
a1: 0.09999966
a1: -1.8626451E-9
a1: -9.313226E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.099999666
a1: 0.09999965
a1: 0.09999966
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.09999966
a1: 0.09999966
a1: 0.09999966
a1: 0.09999965
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.09999966
a1: 0.099999666
a1: 0.099999666
a1: 0.09999965
a1: 0.09999966
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.09999965
a1: 0.09999966
a1: 0.09999965
a1: 0.099999666
a1: 0.09999968
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.099999666
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -0.099999666
a1: -0.09999967
a1: -0.099999666
a1: -0.09999966
a1: -0.099999666
a1: -0.099999666
a1: -0.09999967
a1: -0.099999666
a1: -0.09999967
a1: -0.099999666
a1: -0.099999666
a1: -0.09999966
a1: -0.09999966
a1: -0.09999966
a1: -0.099999666
a1: -0.09999966
a1: -0.09999966
a1: -0.099999666
a1: -0.099999666
a1: -0.099999666
a1: -0.099999666
a1: -0.09999966
a1: -0.09999965
a1: -0.09999967
a1: -0.09999967
a1: -0.09999966
a1: -0.09999965
a1: -0.09999966
a1: -0.09999967
a1: -0.09999966
a1: -0.099999666
a1: -0.099999666
a1: -0.099999666
a1: -0.09999967
a1: -0.09999968
a1: -0.099999666
a1: -0.09999967
a1: -0.09999966
a1: -0.09999966
a1: -0.09999965
a1: -0.099999666
a1: -0.09999965
a1: -0.099999644
a1: -0.099999644
a1: -0.09999964
a1: -0.09999964
a1: -0.09999964
a1: -0.09999962
a1: -0.09999962
a1: -0.09999962
a1: -0.09999964
a1: -0.099999614
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999959
a1: -0.0999996
a1: -0.09999959
a1: -0.0999996
a1: -0.0999996
a1: -0.09999961
a1: -0.0999996
a1: -0.0999996
a1: -0.09999959
a1: -0.09999961
a1: -0.09999961
a1: -0.09999959
a1: -0.099999584
a1: -0.09999958
a1: -0.09999958
a1: -0.09999958
a1: -0.09999957
a1: -0.09999958
a1: -0.09999957
a1: -0.09999958
a1: -0.09999958
a1: -0.09999958
a1: -0.09999958
a1: -0.09999957
a1: -0.099999584
a1: -0.09999958
a1: -0.09999958
a1: -0.09999958
a1: -0.09999957
a1: -0.09999957
a1: -0.09999957
a1: -0.09999957
a1: -0.09999959
a1: -0.09999957
a1: -0.09999958
a1: -0.09999958
a1: -0.09999956
a1: -0.09999956
a1: -0.09999957
a1: -0.09999958
a1: -0.09999958
a1: -0.09999958
a1: -0.09999957
a1: -0.09999958
a1: -0.09999957
a1: -0.09999959
a1: -0.09999957
a1: -0.09999959
a1: -0.09999958
a1: -0.09999958
a1: -0.099999584
a1: 0.0
a1: 3.7252903E-9
a1: 0.0
a1: 0.0
a1: -3.7252903E-9
a1: 3.7252903E-9
a1: 3.7252903E-9
a1: 0.0
a1: -3.7252903E-9
a1: 3.7252903E-9
a1: 0.0
a1: 0.0
a1: -1.8626451E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.099999584
a1: 0.09999959
a1: 0.099999584
a1: 0.099999584
a1: 0.099999584
a1: 0.09999958
a1: 0.09999959
a1: 0.099999584
a1: 0.099999584
a1: 0.09999958
a1: 0.09999958
a1: 0.09999958
a1: 0.09999958
a1: 0.09999957
a1: 0.09999957
a1: 0.09999957
a1: 0.09999957
a1: 0.09999958
a1: 0.09999957
a1: 0.09999958
a1: 0.0
a1: 0.0
a1: 0.0
a1: -0.09999957
a1: -0.09999957
a1: -0.09999957
a1: -0.099999554
a1: -0.099999554
a1: -0.09999956
a1: -0.09999956
a1: -0.099999554
a1: -0.099999554
a1: -0.099999554
a1: -0.099999554
a1: -0.09999957
a1: -0.09999956
a1: -0.099999554
a1: -0.099999554
a1: -0.09999956
a1: -0.09999956
a1: -0.09999957
a1: -0.09999957
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
====Sound test... exiting====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted logs/clog2012-07-24_2155PDT.txt.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
----Sound test... started----
====Starfighter Engine Revision -1====
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.10000002
a1: 0.1
a1: 0.10000002
a1: 0.10000001
a1: 0.1
a1: 0.099999994
a1: 0.09999999
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.099999994
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.099999994
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999998
a1: 0.09999997
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.099999964
a1: 0.099999964
a1: 0.09999997
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.099999964
a1: -0.099999964
a1: -0.09999996
a1: -0.099999964
a1: -0.09999996
a1: -0.099999964
a1: -0.09999995
a1: -0.09999995
a1: -0.09999995
a1: -0.09999996
a1: -0.099999964
a1: -0.099999964
a1: -0.099999964
a1: -0.099999964
a1: -0.099999964
a1: -0.09999997
a1: -0.09999997
a1: -0.09999997
a1: -0.099999964
a1: -0.09999996
a1: -0.099999964
a1: -0.09999995
a1: -0.09999995
a1: -0.09999996
a1: -0.09999995
a1: -0.09999995
a1: -0.09999996
a1: -0.09999995
a1: -0.099999964
a1: -0.09999995
a1: -0.09999996
a1: -0.09999996
a1: -0.09999995
a1: -0.09999996
a1: -0.099999964
a1: -0.09999996
a1: -0.099999964
a1: -0.09999996
a1: -0.099999964
a1: -0.09999995
a1: -0.099999964
a1: -0.09999996
a1: -0.09999994
a1: -0.09999996
a1: -0.09999996
a1: -0.099999964
a1: -0.09999995
a1: -0.09999996
a1: -0.09999995
a1: -0.09999994
a1: -0.099999964
a1: -0.099999964
a1: -0.09999995
a1: -0.09999995
a1: -0.09999995
a1: -0.09999995
a1: -0.09999995
a1: -0.09999995
a1: -0.09999994
a1: -0.099999934
a1: -0.09999994
a1: -0.09999994
a1: -0.09999994
a1: -0.09999994
a1: -0.099999934
a1: -0.09999994
a1: -0.099999934
a1: -0.09999993
a1: -0.09999994
a1: -0.099999934
a1: -0.09999992
a1: -0.09999993
a1: -0.09999992
a1: -0.09999993
a1: -0.09999992
a1: -0.09999992
a1: -0.09999992
a1: -0.099999905
a1: -0.09999992
a1: -0.09999991
a1: -0.099999905
a1: -0.09999991
a1: -0.099999905
a1: -0.099999905
a1: -0.09999992
a1: -0.099999905
a1: -0.09999991
a1: -0.099999905
a1: -0.09999989
a1: -0.09999989
a1: -0.09999989
a1: -0.099999905
a1: -0.099999905
a1: -0.099999905
a1: -0.09999989
a1: -0.099999905
a1: -0.099999905
a1: -0.099999905
a1: -0.09999989
a1: -0.0999999
a1: -0.099999905
a1: -0.099999905
a1: -0.099999905
a1: -0.099999905
a1: -0.09999989
a1: -0.099999905
a1: -0.0999999
a1: -0.099999905
a1: -0.0999999
a1: -0.099999905
a1: -0.09999989
a1: -0.099999905
a1: -0.0999999
a1: -0.099999905
a1: -0.0999999
a1: -0.0999999
a1: -0.099999905
a1: -0.09999991
a1: -0.099999905
a1: 0.0
a1: -1.8626451E-9
a1: 3.7252903E-9
a1: -3.7252903E-9
a1: 0.0
a1: -1.8626451E-9
a1: 0.0
a1: 1.8626451E-9
a1: -1.8626451E-9
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: -1.8626451E-9
a1: -1.8626451E-9
a1: 0.0
a1: 3.7252903E-9
a1: 0.0
a1: 1.8626451E-9
a1: 0.0
a1: 0.0
a1: -1.8626451E-9
a1: 0.099999905
a1: 0.0999999
a1: 0.0999999
a1: 0.099999905
a1: 0.09999989
a1: 0.0999999
a1: 0.09999989
a1: 0.09999989
a1: 0.0999999
a1: 0.0999999
a1: 0.09999989
a1: 0.09999989
a1: 0.09999989
a1: 0.09999989
a1: 0.09999989
a1: 0.09999988
a1: 0.099999875
a1: 0.09999988
a1: 0.09999989
a1: 0.099999875
a1: 0.099999875
a1: 0.099999875
a1: 0.09999988
a1: 0.099999875
a1: 0.09999987
a1: 0.099999875
a1: 0.099999875
a1: 0.099999875
a1: 0.09999987
a1: 0.099999875
a1: 0.09999986
a1: 0.09999986
a1: 0.09999986
a1: 0.09999986
a1: 0.09999986
a1: 0.099999875
a1: 0.099999875
a1: 0.099999875
a1: 0.099999875
a1: 0.099999875
a1: 0.09999987
a1: 0.09999987
a1: 0.099999875
a1: 0.09999988
a1: 0.099999875
a1: 0.099999875
a1: 0.09999987
a1: 0.099999875
a1: 0.09999987
a1: 0.09999986
a1: 0.099999875
a1: 0.09999987
a1: 0.099999875
a1: 0.099999875
a1: 0.09999986
a1: 0.099999875
a1: 0.09999986
a1: 0.09999986
a1: 0.099999875
a1: 0.099999875
a1: 0.09999987
a1: 0.09999985
a1: 0.099999875
a1: 0.09999985
a1: 0.09999985
a1: 0.09999985
a1: 0.09999985
a1: 0.09999985
a1: 0.09999985
a1: 0.09999987
a1: 0.09999986
a1: 0.09999985
a1: 0.09999986
a1: 0.09999986
a1: 0.09999985
a1: 0.099999845
a1: 0.099999845
a1: 0.09999986
a1: 0.09999985
a1: 0.09999984
a1: 0.09999984
a1: 0.099999845
a1: 0.099999845
a1: 0.09999982
a1: 0.09999983
a1: 0.09999984
a1: 0.09999984
a1: 0.09999983
a1: 0.09999982
a1: 0.09999983
a1: 0.09999983
a1: 0.09999983
a1: 0.099999815
a1: 0.09999983
a1: 0.099999845
a1: 0.099999845
a1: 0.099999845
a1: 0.099999845
a1: 0.09999984
a1: 0.09999984
a1: 0.09999984
a1: 0.09999983
a1: 0.099999845
a1: 0.09999984
a1: 0.09999983
a1: 0.09999983
a1: 0.09999983
a1: 0.09999983
a1: 0.099999845
a1: 0.09999984
a1: 0.09999983
a1: 0.099999845
a1: 0.09999984
a1: 0.09999983
a1: 0.09999983
a1: 0.099999845
a1: 0.09999984
a1: 0.09999984
a1: 0.099999845
a1: 0.09999983
a1: 0.09999983
a1: 0.09999983
a1: 0.09999983
a1: 0.09999984
a1: 0.099999845
a1: 0.09999983
a1: 0.09999983
a1: 0.09999983
a1: 0.09999984
a1: 0.09999984
a1: 0.099999815
a1: 0.09999983
a1: 0.09999984
a1: 0.09999984
a1: 0.09999984
a1: 0.09999982
a1: 0.09999983
a1: 0.09999982
a1: 0.09999983
a1: 0.09999982
a1: 0.09999983
a1: 0.099999815
a1: 0.099999815
a1: 0.099999815
a1: 0.099999815
a1: 0.09999981
a1: 0.09999982
a1: 0.099999815
a1: 0.099999815
a1: 0.09999981
a1: 0.099999815
a1: 0.09999982
a1: 0.099999815
a1: 0.099999815
a1: 0.099999815
a1: 0.09999981
a1: 0.0999998
a1: 0.0999998
a1: 0.0999998
a1: 0.0999998
a1: 0.0999998
a1: 0.0999998
a1: 0.09999981
a1: 0.0999998
a1: 0.09999979
a1: 0.09999979
a1: 0.099999785
a1: 0.0999998
a1: 0.099999785
a1: -0.099999785
a1: -0.09999979
a1: -0.099999785
a1: -0.09999978
a1: -0.099999785
a1: -0.099999785
a1: -0.09999977
a1: -0.09999977
a1: -0.09999976
a1: -0.09999977
a1: -0.09999977
a1: -0.09999976
a1: -0.09999976
a1: -0.09999977
a1: -0.09999977
a1: -0.09999976
a1: -0.099999756
a1: -0.09999977
a1: -0.09999977
a1: -0.09999977
a1: -0.09999977
a1: -0.09999976
a1: -0.09999977
a1: -0.09999977
a1: -0.09999977
a1: -0.09999976
a1: -0.09999976
a1: -0.09999976
a1: -0.099999756
a1: -0.09999977
a1: -0.09999976
a1: -0.09999976
a1: -0.09999976
a1: -0.09999977
a1: -0.09999976
a1: -0.09999977
a1: -0.099999756
a1: -0.099999756
a1: -0.09999977
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.09999975
a1: -0.09999975
a1: -0.099999756
a1: -0.09999975
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.09999975
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.099999726
a1: -0.09999973
a1: -0.099999726
a1: -0.09999974
a1: -0.099999726
a1: -0.09999974
a1: -0.099999726
a1: -0.09999972
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.09999971
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.09999971
a1: -0.0999997
a1: -0.09999971
a1: -0.0999997
a1: -0.09999971
a1: -0.09999971
a1: -0.09999971
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -1.8626451E-9
a1: -5.5879354E-9
a1: -1.8626451E-9
a1: -1.8626451E-9
a1: 3.7252903E-9
a1: 0.0
a1: 1.8626451E-9
a1: 0.0
a1: -3.7252903E-9
a1: -1.8626451E-9
a1: 3.7252903E-9
a1: 0.0
a1: -1.8626451E-9
a1: 0.0
a1: 0.0
a1: 3.7252903E-9
a1: 1.8626451E-9
a1: 3.7252903E-9
a1: 3.7252903E-9
a1: -1.8626451E-9
a1: 3.7252903E-9
a1: 5.5879354E-9
a1: 7.4505806E-9
a1: -3.7252903E-9
a1: 0.0
a1: 3.7252903E-9
a1: 0.0
a1: 3.7252903E-9
a1: 7.4505806E-9
a1: 0.0
a1: 3.7252903E-9
a1: 7.4505806E-9
a1: 0.0
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.099999726
a1: 0.09999974
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999973
a1: 0.09999973
a1: 0.09999975
a1: 0.09999974
a1: 0.099999756
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999975
a1: 0.09999975
a1: 0.09999975
a1: 0.09999975
a1: 0.099999756
a1: 0.099999756
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999975
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.09999976
a1: 0.099999756
a1: 0.09999976
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.09999976
a1: 0.09999977
a1: 0.09999976
a1: 0.09999976
a1: 0.09999977
a1: 0.099999785
a1: 0.09999977
a1: 0.09999977
a1: 0.09999978
a1: 0.09999977
a1: 0.09999978
a1: 0.09999978
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.09999978
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.09999979
a1: 0.099999785
a1: 0.09999978
a1: 0.099999785
a1: 0.09999978
a1: 0.099999785
a1: 0.099999785
a1: 0.09999979
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.09999977
a1: 0.09999978
a1: 0.09999978
a1: 0.099999785
a1: 0.09999977
a1: 0.09999978
a1: 0.099999785
a1: 0.09999977
a1: 0.09999977
a1: 0.09999976
a1: 0.099999756
a1: 0.09999977
a1: 0.09999977
a1: 0.099999756
a1: 0.09999977
a1: 0.09999977
a1: 0.09999976
a1: 0.09999976
a1: 0.099999756
a1: 0.09999976
a1: 0.09999976
a1: 0.09999977
a1: 0.099999756
a1: 0.09999975
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.099999756
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.09999973
a1: 0.099999726
a1: 0.09999973
a1: 0.09999973
a1: 0.09999972
a1: 0.099999726
a1: 0.09999972
a1: 0.09999972
a1: 0.09999971
a1: 0.09999972
a1: 0.09999972
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.09999972
a1: 0.09999971
a1: 0.099999726
a1: 0.09999971
a1: 0.09999971
a1: 0.0999997
a1: 0.0999997
a1: 0.09999971
a1: 0.099999696
a1: 0.099999696
a1: 0.099999696
a1: 0.099999696
a1: 0.099999696
a1: 0.099999696
a1: 0.09999968
a1: 0.099999696
a1: 0.09999968
a1: 0.09999967
a1: 0.09999968
a1: 0.09999967
a1: 0.09999968
a1: 0.09999967
a1: 0.099999666
a1: 0.099999666
a1: 0.099999666
a1: 0.099999666
a1: 0.099999666
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.099999666
a1: 0.099999666
a1: 0.099999666
a1: 0.09999968
a1: 0.09999967
a1: 0.09999966
a1: 0.09999966
a1: 0.09999966
a1: 0.099999666
a1: 0.09999965
a1: 0.09999966
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.09999965
a1: 0.09999966
a1: 0.09999965
a1: 0.09999965
a1: 0.09999964
a1: 0.099999644
a1: 0.099999644
a1: 0.09999964
a1: 0.09999965
a1: 0.099999644
a1: 0.09999963
a1: 0.09999964
a1: 0.09999962
a1: 0.09999962
a1: 0.099999614
a1: 0.09999962
a1: 0.09999963
a1: 0.09999962
a1: 0.09999964
a1: 0.09999962
a1: 0.09999963
a1: 0.099999614
a1: 0.09999962
a1: 0.09999962
a1: 0.09999962
a1: 0.09999961
a1: 0.09999961
a1: 0.0999996
a1: 0.09999959
a1: 0.0999996
a1: 0.09999961
a1: 0.09999959
a1: 0.099999584
a1: 0.099999584
a1: 0.09999958
a1: 0.09999957
a1: 0.09999958
a1: 0.099999584
a1: 0.09999959
a1: 0.09999959
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -0.09999958
a1: -0.09999958
a1: -0.09999959
a1: -0.09999958
a1: -0.09999959
a1: -0.09999961
a1: -0.0999996
a1: -0.09999959
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.099999614
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.0999996
a1: -0.0999996
a1: -0.09999959
a1: -0.0999996
a1: -0.09999961
a1: -0.09999959
a1: -0.0999996
a1: -0.09999959
a1: -0.0999996
a1: -0.0999996
a1: -0.09999961
a1: -0.09999959
a1: -0.09999961
a1: -0.0999996
a1: -0.09999961
a1: -0.0999996
a1: -0.0999996
a1: -0.09999961
a1: -0.0999996
a1: -0.09999959
a1: -0.09999959
a1: -0.0999996
a1: -0.09999959
a1: -0.09999961
a1: -0.0999996
a1: -0.0999996
a1: -0.09999961
a1: -0.0999996
a1: -0.09999961
a1: -0.09999961
a1: -0.0999996
a1: -0.09999961
a1: -0.09999961
a1: -0.0999996
a1: -0.099999614
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999962
a1: -0.0999996
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.0999996
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.09999961
a1: -0.0999996
a1: -0.09999961
a1: -0.09999961
a1: -0.0999996
a1: -0.09999961
a1: -0.09999961
a1: -0.09999959
a1: -0.09999959
a1: -0.09999961
a1: -0.09999959
a1: -0.09999959
a1: -0.09999959
a1: -0.09999959
a1: -0.09999959
a1: -0.09999959
a1: -0.09999959
a1: -0.09999959
a1: -0.09999958
a1: -0.099999584
a1: -0.09999958
a1: -0.099999584
a1: -0.09999957
a1: -0.09999957
a1: -0.09999956
a1: -0.09999957
a1: -0.09999956
a1: -0.09999956
a1: -0.09999956
a1: -0.09999956
a1: -0.09999956
a1: -0.099999554
a1: -0.09999956
a1: -0.09999955
a1: -0.09999954
a1: -0.09999954
a1: -0.09999954
a1: -0.09999953
a1: -0.099999554
a1: -0.09999954
a1: -0.09999953
a1: -0.099999525
a1: -0.09999953
a1: -0.09999954
a1: -0.099999525
a1: -0.09999952
a1: -0.09999952
a1: -0.09999952
a1: -0.09999952
a1: -0.09999951
a1: -0.09999951
a1: -0.0999995
a1: -0.0999995
a1: -0.09999951
a1: -0.09999951
a1: -0.09999951
a1: -0.0999995
a1: -0.09999949
a1: -0.09999949
a1: -0.0999995
a1: -0.09999949
a1: -0.09999948
a1: -0.09999949
a1: -0.09999948
a1: -0.099999465
a1: -0.09999947
a1: -0.09999947
a1: -0.09999946
a1: -0.09999946
a1: -0.09999947
a1: -0.09999947
a1: -0.09999946
a1: -0.09999946
a1: -0.09999946
a1: -0.09999946
a1: -0.09999944
a1: -0.099999435
a1: -0.09999944
a1: -0.09999944
a1: -0.099999435
a1: -0.09999944
a1: -0.099999435
a1: -0.09999943
a1: -0.09999942
a1: -0.09999941
a1: -0.099999405
a1: -0.099999405
a1: -0.09999941
a1: -0.099999405
a1: -0.0999994
a1: -0.0999994
a1: -0.09999938
a1: -0.099999405
a1: -0.0999994
a1: -0.0999994
a1: -0.09999939
a1: -0.09999938
a1: -0.09999938
a1: -0.09999939
a1: -0.09999938
a1: -0.099999376
a1: -0.099999376
a1: -0.099999376
a1: -0.09999938
a1: -0.09999938
a1: -0.099999376
a1: -0.09999937
a1: -0.09999935
a1: -0.09999936
a1: -0.09999937
a1: -0.09999936
a1: -0.09999936
a1: -0.09999937
a1: -0.099999346
a1: -0.09999935
a1: -0.09999935
a1: -0.099999346
a1: -0.09999935
a1: -0.099999346
a1: -0.09999934
a1: -0.09999934
a1: -0.099999346
a1: -0.099999346
a1: -0.09999936
a1: -0.09999934
a1: -0.099999346
a1: -0.09999935
a1: -0.099999346
a1: -0.099999346
a1: -0.09999935
a1: -0.099999346
a1: -0.099999346
a1: -0.09999934
a1: -0.09999934
a1: -0.09999933
a1: -0.09999934
a1: -0.09999934
a1: -0.09999934
a1: -0.09999934
a1: -0.099999346
a1: -0.09999933
a1: -0.09999933
a1: -0.09999932
a1: -0.09999932
a1: -0.09999932
a1: -0.09999932
a1: -0.09999931
a1: -0.09999932
a1: -0.09999932
a1: -0.09999931
a1: -0.09999932
a1: -0.09999931
a1: -0.09999931
a1: -0.099999316
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.09999931
a1: 0.09999931
a1: 0.09999931
a1: 0.09999931
a1: 0.0999993
a1: 0.09999931
a1: 0.09999931
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999928
a1: 0.099999286
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.099999286
a1: 0.09999929
a1: 0.099999286
a1: 0.09999929
a1: 0.09999929
a1: 0.099999286
a1: 0.099999286
a1: 0.099999286
a1: 0.099999286
a1: 0.09999929
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0999993
a1: 0.09999931
a1: 0.0999993
a1: 0.099999286
a1: 0.0999993
a1: 0.099999286
a1: 0.099999286
a1: 0.099999286
a1: 0.09999928
a1: 0.09999928
a1: 0.09999927
a1: 0.099999264
a1: 0.099999264
a1: 0.09999927
a1: 0.09999926
a1: 0.09999926
a1: 0.09999925
a1: 0.09999926
a1: 0.09999925
a1: 0.09999925
a1: 0.09999925
a1: 0.09999924
a1: 0.09999924
a1: 0.099999234
a1: 0.09999925
a1: 0.099999234
a1: 0.099999234
a1: 0.09999923
a1: 0.09999922
a1: 0.09999922
a1: 0.09999922
a1: 0.09999922
a1: 0.09999922
a1: 0.09999921
a1: 0.09999922
a1: 0.09999921
a1: 0.09999922
a1: 0.099999204
a1: 0.09999921
a1: 0.09999921
a1: 0.099999204
a1: 0.0999992
a1: 0.09999921
a1: 0.099999204
a1: 0.099999204
a1: 0.099999204
a1: 0.09999921
a1: 0.099999204
a1: 0.099999204
a1: 0.09999919
a1: 0.0999992
a1: 0.09999919
a1: 0.09999919
a1: 0.09999918
a1: 0.099999174
a1: 0.09999919
a1: 0.099999174
a1: 0.09999919
a1: 0.099999174
a1: 0.0999992
a1: 0.09999918
a1: 0.09999918
a1: 0.099999174
a1: 0.099999174
a1: 0.09999917
a1: 0.099999174
a1: 0.099999174
a1: 0.09999918
a1: 0.099999174
a1: 0.09999918
a1: 0.09999918
a1: 0.09999919
a1: 0.09999919
a1: 0.0999992
a1: 0.0999992
a1: 0.09999919
a1: 0.09999918
a1: 0.09999919
a1: 0.0999992
a1: 0.099999204
a1: 0.099999204
a1: 0.09999921
a1: 0.099999204
a1: 0.09999921
a1: 0.099999204
a1: 0.09999922
a1: 0.09999921
a1: 0.09999923
a1: 0.09999921
a1: 0.09999922
a1: 0.09999921
a1: 0.09999922
a1: 0.099999234
a1: 0.09999923
a1: 0.09999924
a1: 0.09999924
a1: 0.09999925
a1: 0.09999925
a1: 0.09999926
a1: 0.09999926
a1: 0.09999925
a1: 0.09999926
a1: 0.099999264
a1: 0.099999264
a1: 0.099999264
a1: 0.099999264
a1: 0.099999264
a1: 0.09999927
a1: 0.09999927
a1: 0.09999927
a1: 0.09999928
a1: 0.09999928
a1: 0.099999286
a1: 0.09999928
a1: 0.09999928
a1: 0.09999928
a1: 0.099999286
a1: 0.099999286
a1: 0.099999286
a1: 0.0999993
a1: 0.0999993
a1: 0.099999286
a1: 0.09999929
a1: 0.09999929
a1: 0.0999993
a1: 0.0999993
a1: 0.09999929
a1: 0.09999929
a1: 0.09999931
a1: 0.0999993
a1: 0.0999993
a1: 0.0999993
a1: 0.0999993
a1: 0.099999316
a1: 0.09999931
a1: 0.0999993
a1: 0.0999993
a1: 0.09999931
a1: 0.09999929
a1: 0.0999993
a1: 0.0999993
a1: 0.0999993
a1: 0.09999931
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.0999993
a1: 0.09999932
a1: 0.09999931
a1: 0.09999931
a1: 0.0999993
a1: 0.09999931
a1: 0.09999931
a1: 0.09999931
a1: 0.09999931
a1: 0.09999931
a1: 0.09999931
a1: 0.0999993
a1: 0.0999993
a1: 0.0999993
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.09999929
a1: 0.099999286
a1: 0.09999928
a1: 0.09999928
a1: 0.09999927
a1: 0.09999925
a1: 0.09999927
a1: 0.09999926
a1: 0.09999925
a1: 0.09999925
a1: 0.09999925
a1: 0.09999925
a1: 0.09999926
a1: 0.09999924
a1: 0.099999234
a1: 0.099999234
a1: 0.099999234
a1: -3.7252903E-9
a1: -1.8626451E-9
a1: 0.0
a1: -1.8626451E-9
a1: 1.8626451E-9
a1: 0.0
a1: 3.7252903E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: 0.0
a1: 0.0
a1: -9.313226E-10
a1: -1.8626451E-9
a1: -9.313226E-10
a1: -1.8626451E-9
a1: -9.313226E-10
a1: -9.313226E-10
a1: -1.3969839E-9
a1: 2.3283064E-9
a1: -1.6298145E-9
a1: -2.0954758E-9
a1: 2.3283064E-10
a1: 8.1490725E-10
a1: -4.656613E-10
a1: 2.3283064E-10
a1: 9.313226E-10
a1: 4.656613E-10
a1: -4.656613E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -9.313226E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 1.8626451E-9
a1: -1.8626451E-9
a1: 0.0
a1: 0.0
a1: -1.8626451E-9
a1: 0.0
a1: 3.7252903E-9
a1: 1.8626451E-9
a1: -1.8626451E-9
a1: 5.5879354E-9
a1: -1.8626451E-9
a1: -1.8626451E-9
a1: 0.0
a1: 0.0
a1: -3.7252903E-9
a1: 0.0
a1: 3.7252903E-9
a1: 0.0
a1: 3.7252903E-9
a1: -3.7252903E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: -3.7252903E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 3.7252903E-9
a1: 3.7252903E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 3.7252903E-9
a1: 0.0
a1: 3.7252903E-9
a1: 3.7252903E-9
a1: 3.7252903E-9
a1: -7.4505806E-9
a1: 3.7252903E-9
a1: 0.0
a1: -3.7252903E-9
a1: 3.7252903E-9
a1: 3.7252903E-9
a1: 0.0
a1: -3.7252903E-9
a1: 0.0
a1: 3.7252903E-9
a1: 0.0
a1: -3.7252903E-9
a1: -0.09999922
a1: -0.09999923
a1: -0.099999234
a1: -0.099999234
a1: -0.09999922
a1: -0.09999921
a1: -0.09999922
a1: -0.09999922
a1: -0.09999922
a1: -0.09999922
a1: -0.09999922
a1: -0.09999921
a1: -0.099999204
a1: -0.0999992
a1: -0.09999922
a1: -0.099999204
a1: -0.099999204
a1: -0.0999992
a1: -0.0999992
a1: -0.099999204
a1: -0.09999919
a1: -0.099999204
a1: -0.09999919
a1: -0.09999919
a1: -0.099999204
a1: -0.099999204
a1: -0.099999204
a1: -0.0999992
a1: -0.09999918
a1: -0.09999918
a1: -2.3283064E-10
a1: -3.4924597E-10
a1: -1.3969839E-9
a1: 1.5133992E-9
a1: 4.656613E-10
a1: 3.958121E-9
a1: 2.3283064E-10
a1: 4.656613E-10
a1: 3.259629E-9
a1: 3.3760443E-9
a1: 1.6298145E-9
a1: 1.6298145E-9
a1: 1.8626451E-9
a1: 5.820766E-10
a1: 1.3969839E-9
a1: -6.9849193E-10
a1: 1.0477379E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -4.656613E-10
a1: 3.4924597E-10
a1: 3.4924597E-10
a1: 3.4924597E-10
a1: -9.313226E-10
a1: 0.0
a1: 1.1641532E-10
a1: 2.3283064E-10
a1: -2.3283064E-10
a1: -5.820766E-10
a1: 6.9849193E-10
a1: -4.656613E-10
a1: 1.1641532E-10
a1: -1.1641532E-10
a1: -1.1641532E-10
a1: 2.3283064E-10
a1: 0.0
a1: 2.3283064E-10
a1: -1.1641532E-10
a1: -3.4924597E-10
a1: -1.1641532E-10
a1: -1.1641532E-10
a1: -1.1641532E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0999992
a1: 0.0999992
a1: 0.09999919
a1: 0.09999919
a1: 0.09999919
a1: 0.0999992
a1: 0.0999992
a1: 0.099999204
a1: 0.09999919
a1: 0.0999992
a1: 0.09999919
a1: 0.09999919
a1: 0.09999919
a1: 0.099999204
a1: 0.0999992
a1: 0.09999919
a1: 0.0999992
a1: 0.0999992
a1: 0.0999992
a1: 0.0999992
a1: 0.09999919
a1: 0.09999919
a1: 0.0999992
a1: 0.09999919
a1: 0.099999174
a1: 0.099999174
a1: 0.09999918
a1: 0.099999174
a1: 0.09999916
a1: 0.09999917
a1: 0.09999917
a1: 0.099999174
a1: 0.09999916
a1: 0.09999917
a1: 0.09999916
a1: 0.09999917
a1: 0.09999918
a1: 0.099999174
a1: 0.09999916
a1: 0.09999917
a1: 0.09999916
a1: 0.09999916
a1: 0.09999916
a1: 0.09999916
a1: 0.09999916
a1: 0.09999917
a1: 0.09999916
a1: 0.099999174
a1: 0.09999916
a1: 0.09999915
a1: 0.09999915
a1: 0.09999915
a1: 0.099999145
a1: 0.09999916
a1: 0.09999916
a1: 0.099999145
a1: 0.099999145
a1: 0.099999145
a1: 0.099999145
a1: 0.099999145
a1: 0.099999145
a1: 0.09999915
a1: 0.09999914
a1: 0.099999145
a1: 0.09999915
a1: 0.09999916
a1: 0.099999145
a1: 0.09999913
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -0.09999913
a1: -0.09999914
a1: -0.09999914
a1: -0.09999913
a1: -0.09999912
a1: -0.09999912
a1: -0.09999913
a1: -0.09999913
a1: -0.099999115
a1: -0.099999115
a1: -0.09999912
a1: -0.099999115
a1: -0.099999115
a1: -0.09999912
a1: -0.099999115
a1: -0.099999115
a1: -0.099999115
a1: -0.09999911
a1: -0.099999115
a1: -0.09999911
a1: -0.0999991
a1: -0.099999115
a1: -0.099999115
a1: -0.09999912
a1: -0.09999913
a1: -0.099999115
a1: -0.09999913
a1: -0.099999115
a1: -0.09999913
a1: -0.09999913
a1: -0.09999913
a1: -0.09999913
a1: -0.09999912
a1: -0.09999913
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
====Sound test... exiting====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted logs/clog2012-07-24_2156PDT.txt.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
----Sound test... started----
====Starfighter Engine Revision -1====
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.1
a1: 0.10000001
a1: 0.099999994
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.099999994
a1: 0.099999994
a1: 0.09999999
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.1
a1: 0.09999999
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.10000001
a1: 0.099999994
a1: 0.099999994
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.10000002
a1: 0.1
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000002
a1: 0.10000001
a1: 0.10000002
a1: 0.1
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.09999999
a1: 0.09999998
a1: 0.099999994
a1: 0.09999999
a1: 0.099999994
a1: 0.1
a1: 0.10000001
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999997
a1: 0.09999999
a1: 0.09999998
a1: 0.09999998
a1: 0.09999997
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -3.7252903E-9
a1: 0.0
a1: 3.7252903E-9
a1: 0.0
a1: 0.0
a1: -3.7252903E-9
a1: 0.0
a1: -3.7252903E-9
a1: -3.7252903E-9
a1: 0.0
a1: -3.7252903E-9
a1: 0.0
a1: -3.7252903E-9
a1: -3.7252903E-9
a1: -3.7252903E-9
a1: 0.0
a1: 0.0
a1: -3.7252903E-9
a1: -3.7252903E-9
a1: 0.0
a1: -7.4505806E-9
a1: 0.0
a1: -3.7252903E-9
a1: 0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.09999998
a1: -0.099999964
a1: -0.09999997
a1: -0.099999964
a1: -0.09999997
a1: -0.09999997
a1: -0.09999997
a1: -0.09999997
a1: -0.09999998
a1: -0.09999997
a1: -0.09999997
a1: -0.09999998
a1: -0.09999998
a1: -0.09999998
a1: -0.099999964
a1: -0.09999998
a1: -0.09999997
a1: -0.099999964
a1: -0.09999996
a1: -0.099999964
a1: -0.09999997
a1: -0.09999998
a1: -0.09999998
a1: -0.09999999
a1: -0.09999998
a1: -0.09999998
a1: -0.09999997
a1: -0.09999997
a1: -0.09999997
a1: -0.099999964
a1: -0.09999996
a1: -0.099999964
a1: -0.09999994
a1: -0.09999996
a1: -0.09999996
a1: -0.099999964
a1: -0.099999964
a1: -0.099999964
a1: -0.09999996
a1: -0.09999995
a1: -0.09999996
a1: -0.09999996
a1: -0.09999995
a1: -0.09999995
a1: -0.09999994
a1: -0.099999934
a1: -0.099999934
a1: -0.09999994
a1: -0.09999994
a1: -0.099999934
a1: -0.099999934
a1: -0.09999993
a1: -0.09999992
a1: -0.09999992
a1: -0.09999992
a1: -0.099999905
a1: -0.09999991
a1: -0.0999999
a1: -0.09999991
a1: -0.0999999
a1: -0.099999905
a1: -0.0999999
a1: -0.09999989
a1: -0.09999989
a1: -0.09999989
a1: -0.09999988
a1: -0.099999875
a1: -0.09999988
a1: -0.09999988
a1: -0.099999875
a1: -0.09999987
a1: -0.099999875
a1: -0.09999988
a1: -0.09999987
a1: -0.09999986
a1: -0.09999986
a1: -0.09999987
a1: -0.09999986
a1: -0.09999986
a1: -0.099999845
a1: -0.099999845
a1: -0.09999985
a1: -0.099999845
a1: -0.09999983
a1: -0.09999983
a1: -0.09999983
a1: -0.09999982
a1: -0.09999983
a1: -0.09999982
a1: -0.099999815
a1: -0.09999981
a1: -0.0999998
a1: -0.0999998
a1: -0.09999981
a1: -0.0999998
a1: -0.09999981
a1: -0.09999979
a1: -0.09999979
a1: -0.099999785
a1: -0.099999785
a1: -0.09999977
a1: -0.09999977
a1: -0.09999977
a1: -0.09999977
a1: -0.09999976
a1: -0.09999976
a1: -0.09999977
a1: -0.09999976
a1: -0.099999756
a1: -0.09999977
a1: -0.099999756
a1: -0.09999976
a1: -0.09999977
a1: -0.099999756
a1: -0.09999975
a1: -0.099999756
a1: -0.09999975
a1: -0.09999974
a1: -0.09999975
a1: -0.09999975
a1: -0.09999974
a1: -0.09999973
a1: -0.099999726
a1: -0.09999973
a1: -0.09999972
a1: -0.099999726
a1: -0.099999726
a1: -0.09999971
a1: -0.0999997
a1: -0.09999972
a1: -0.099999696
a1: -0.099999696
a1: -0.099999696
a1: -0.09999969
a1: -0.09999968
a1: -0.09999968
a1: -0.09999967
a1: -0.09999967
a1: -0.099999666
a1: -0.099999666
a1: -0.09999967
a1: -0.09999967
a1: -0.09999966
a1: -0.09999966
a1: -0.09999966
a1: -0.09999965
a1: -0.09999966
a1: -0.09999966
a1: -0.099999644
a1: -0.099999644
a1: -0.099999644
a1: -0.09999965
a1: -0.09999965
a1: -0.09999965
a1: -0.099999644
a1: -0.09999964
a1: -0.09999964
a1: -0.09999964
a1: -0.09999964
a1: -0.09999962
a1: -0.09999964
a1: -0.09999961
a1: -0.09999963
a1: -0.099999614
a1: -0.099999614
a1: -0.09999961
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
====Sound test... exiting====
----Sound test... started----
====Starfighter Engine Revision -1====
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.1
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.099999994
a1: 0.099999994
a1: 0.09999999
a1: 0.099999994
a1: 0.09999999
a1: 0.09999998
a1: 0.09999999
a1: 0.09999999
a1: 0.1
a1: 0.099999994
a1: 0.09999999
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.09999997
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.099999964
a1: 0.09999998
a1: 0.09999998
a1: 0.09999999
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.099999994
a1: 0.09999998
a1: 0.09999997
a1: 0.099999994
a1: 0.09999998
a1: 0.09999998
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.09999999
a1: 0.099999994
a1: 0.09999999
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999999
a1: 0.09999999
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.1
a1: 0.10000001
a1: 0.099999994
a1: 0.099999994
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000002
a1: 0.100000024
a1: 0.10000002
a1: 0.100000024
a1: 0.100000024
a1: 0.100000024
a1: 0.100000024
a1: 0.100000024
a1: 0.10000002
a1: 0.100000024
a1: 0.10000003
a1: 0.100000024
a1: 0.10000003
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000003
a1: 0.10000004
a1: 0.100000046
a1: 0.10000004
a1: 0.10000003
a1: 0.10000004
a1: 0.100000024
a1: 0.10000004
a1: 0.10000004
a1: 0.10000003
a1: 0.10000003
a1: 0.10000003
a1: 0.10000004
a1: 0.100000046
a1: 0.10000004
a1: 0.10000003
a1: 0.10000003
a1: 0.100000046
a1: 0.10000004
a1: 0.100000024
a1: 0.10000003
a1: 0.10000004
a1: 0.10000003
a1: 0.10000003
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000005
a1: 0.10000005
a1: 0.10000005
a1: 0.100000046
a1: 0.100000046
a1: 0.10000005
a1: 0.10000005
a1: 0.100000046
a1: 0.100000046
a1: 0.100000046
a1: 0.10000005
a1: 0.10000004
a1: 0.100000046
a1: 0.10000005
a1: 0.10000005
a1: 0.10000005
a1: 0.10000005
a1: 0.10000004
a1: 0.10000004
a1: 0.10000003
a1: 0.10000004
a1: 0.10000005
a1: 0.100000046
a1: 0.10000004
a1: 0.10000005
a1: 0.100000046
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.100000046
a1: 0.100000046
a1: 0.10000004
a1: 0.10000004
a1: 0.10000005
a1: 0.10000005
a1: 0.100000046
a1: 0.10000005
a1: 0.10000005
a1: 0.10000007
a1: 0.10000005
a1: 0.100000046
a1: 0.10000004
a1: 0.100000046
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000003
a1: 0.10000004
a1: 0.100000046
a1: 0.10000004
a1: 0.10000003
a1: 0.10000003
a1: 0.10000005
a1: 0.10000004
a1: 0.100000046
a1: 0.10000004
a1: 0.10000004
a1: 0.100000046
a1: 0.10000005
a1: 0.100000046
a1: 0.10000005
a1: 0.10000006
a1: 0.10000005
a1: 0.10000005
a1: 0.100000046
a1: 0.10000006
a1: 0.10000007
a1: 0.100000046
a1: 0.10000005
a1: 0.10000005
a1: 0.100000076
a1: 0.10000007
a1: 0.10000006
a1: 0.10000007
a1: 0.10000005
a1: 0.10000005
a1: 0.10000005
a1: 0.10000006
a1: 0.10000006
a1: 0.10000006
a1: 0.10000006
a1: 0.10000005
a1: 0.100000046
a1: 0.10000006
a1: 0.10000006
a1: 0.10000005
a1: 0.100000076
a1: 0.10000006
a1: 0.10000005
a1: 0.10000007
a1: 0.10000006
a1: 0.10000007
a1: 0.10000007
a1: 0.10000006
a1: 0.10000006
a1: 0.10000007
a1: 0.10000007
a1: 0.10000006
a1: 0.10000005
a1: 0.10000007
a1: 0.10000007
a1: 0.10000006
a1: 0.10000006
a1: 0.10000007
a1: 0.10000006
a1: 0.10000007
a1: 0.10000006
a1: 0.10000007
a1: 0.10000007
a1: 0.10000007
a1: 0.10000006
a1: 0.10000006
a1: 0.10000006
a1: 0.10000006
a1: 0.10000007
a1: 0.10000007
a1: 0.10000007
a1: 0.10000007
a1: 0.10000007
a1: 0.100000076
a1: 0.10000008
a1: 0.100000076
a1: 0.10000007
a1: 0.10000007
a1: 0.10000007
a1: 0.10000007
a1: 0.10000007
a1: 0.100000076
a1: 0.10000007
a1: 0.10000007
a1: 0.10000007
a1: 0.100000076
a1: 0.10000007
a1: 0.10000005
a1: 0.10000007
a1: 0.100000076
a1: 0.10000007
a1: 0.10000007
a1: 0.10000005
a1: 0.10000006
a1: 0.10000006
a1: 0.10000005
a1: 0.10000006
a1: 0.10000005
a1: 0.10000007
a1: 0.10000007
a1: 0.10000006
a1: 0.10000007
a1: 0.10000007
a1: 0.10000006
a1: 0.10000007
a1: 0.10000006
a1: 0.10000007
a1: 0.10000006
a1: 0.10000005
a1: 0.10000007
a1: 0.10000005
a1: 0.10000005
a1: 0.10000005
a1: 0.100000046
a1: 0.100000046
a1: 0.10000005
a1: 0.10000005
a1: 0.10000005
a1: 0.100000046
a1: 0.100000046
a1: 0.10000005
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000003
a1: 0.10000004
a1: 0.10000004
a1: 0.100000046
a1: 0.100000046
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000004
a1: 0.10000003
a1: 0.10000003
a1: 0.100000024
a1: 0.10000002
a1: 0.100000024
a1: 0.100000024
a1: 0.10000002
a1: 0.100000024
a1: 0.10000002
a1: 0.100000024
a1: 0.100000024
a1: 0.10000002
a1: 0.100000024
a1: 0.10000002
a1: 0.10000002
a1: 0.10000001
a1: 0.10000002
a1: 0.100000024
a1: 0.10000001
a1: 0.10000002
a1: 0.100000024
a1: 0.100000024
a1: 0.10000002
a1: 0.10000002
a1: 0.10000002
a1: 0.100000024
a1: 0.10000003
a1: 0.100000024
a1: 0.10000002
a1: 0.100000024
a1: 0.10000003
a1: 0.100000024
a1: 0.100000024
a1: 0.10000002
a1: 0.100000024
a1: 0.10000003
a1: 0.100000024
a1: 0.100000024
a1: 0.10000001
a1: 0.10000001
a1: 0.100000024
a1: 0.10000002
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.10000001
a1: 0.099999994
a1: 0.10000001
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.099999994
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.099999994
a1: 0.10000001
a1: 0.09999999
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999998
a1: 0.09999997
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.099999964
a1: 0.09999995
a1: 0.09999995
a1: 0.09999996
a1: 0.09999996
a1: 0.09999996
a1: 0.099999964
a1: 0.09999995
a1: 0.09999995
a1: 0.09999996
a1: 0.09999995
a1: 0.09999995
a1: 0.09999995
a1: 0.09999995
a1: 0.09999994
a1: 0.09999995
a1: 0.09999995
a1: 0.09999994
a1: 0.099999934
a1: 0.09999995
a1: 0.09999994
a1: 0.09999994
a1: 0.09999995
a1: 0.09999994
a1: 0.099999934
a1: 0.09999994
a1: 0.09999993
a1: 0.09999994
a1: 0.099999934
a1: 0.099999934
a1: 0.099999934
a1: 0.09999994
a1: 0.099999934
a1: 0.09999994
a1: 0.09999993
a1: 0.09999994
a1: 0.09999993
a1: 0.099999934
a1: 0.09999994
a1: 0.099999934
a1: 0.09999995
a1: 0.099999934
a1: 0.099999934
a1: 0.099999934
a1: 0.09999994
a1: 0.09999993
a1: 0.09999993
a1: 0.09999994
a1: 0.09999993
a1: 0.099999934
a1: 0.09999993
a1: 0.09999992
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: 4.656613E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 4.656613E-10
a1: 4.656613E-10
a1: 4.656613E-10
a1: 0.0
a1: -4.656613E-10
a1: 0.0
a1: 0.0
a1: 4.656613E-10
a1: -4.656613E-10
a1: 0.0
a1: 4.656613E-10
a1: 4.656613E-10
a1: 0.0
a1: 4.656613E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -4.656613E-10
a1: 0.0
a1: 0.0
a1: 9.313226E-10
a1: 0.0
a1: 0.0
a1: -4.656613E-10
a1: 0.0
a1: -0.09999993
a1: -0.09999993
a1: -0.09999992
a1: -0.09999993
a1: -0.09999992
a1: -0.09999993
a1: -0.09999993
a1: -0.09999992
a1: -0.09999992
a1: -0.09999993
a1: -0.09999993
a1: -0.099999934
a1: -0.09999993
a1: -0.099999934
a1: -0.09999992
a1: -0.09999993
a1: -0.09999992
a1: -0.09999992
a1: -0.09999993
a1: -0.09999993
a1: -0.09999993
a1: -0.099999934
a1: -0.09999992
a1: -0.09999993
a1: -0.09999991
a1: -0.09999991
a1: -0.09999993
a1: -0.09999992
a1: -0.09999991
a1: -0.09999992
a1: -0.09999991
a1: -0.09999991
a1: -0.09999992
a1: -0.09999991
a1: -0.09999991
a1: -0.099999905
a1: -0.0999999
a1: -0.09999989
a1: -0.099999905
a1: -0.09999989
a1: -0.09999991
a1: -0.0999999
a1: -0.099999905
a1: -0.0999999
a1: -0.099999905
a1: -0.0999999
a1: -0.099999905
a1: -0.0999999
a1: -0.09999989
a1: -0.0999999
a1: -0.099999905
a1: -0.0999999
a1: -0.09999989
a1: -0.09999989
a1: -0.09999988
a1: -0.09999989
a1: -0.099999875
a1: -0.09999988
a1: -0.099999875
a1: -0.09999987
a1: -0.099999875
a1: -0.09999989
a1: -0.09999989
a1: -0.099999875
a1: -0.099999875
a1: -0.09999987
a1: -0.09999987
a1: -0.099999875
a1: -0.099999875
a1: -0.099999875
a1: -0.09999987
a1: -0.09999988
a1: -0.09999987
a1: -0.099999875
a1: -0.099999875
a1: -0.099999875
a1: -0.099999875
a1: -0.09999986
a1: -0.099999845
a1: -0.09999985
a1: -0.09999986
a1: -0.09999985
a1: -0.09999986
a1: -0.099999845
a1: -0.099999845
a1: -0.099999845
a1: -0.09999983
a1: -0.09999983
a1: -0.09999982
a1: -0.099999815
a1: -0.09999981
a1: -0.099999815
a1: -0.09999982
a1: -0.099999815
a1: -0.099999815
a1: -0.09999983
a1: -0.0999998
a1: -0.0999998
a1: -0.0999998
a1: -0.09999979
a1: -0.09999979
a1: -0.0999998
a1: -0.0999998
a1: -0.0999998
a1: -0.0999998
a1: -0.0999998
a1: -0.099999785
a1: -0.099999785
a1: -0.09999979
a1: -0.09999978
a1: -0.09999978
a1: -0.09999978
a1: -0.09999977
a1: 9.313226E-10
a1: 0.0
a1: -1.8626451E-9
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.099999785
a1: 0.099999785
a1: 0.09999977
a1: 0.09999976
a1: 0.09999977
a1: 0.099999756
a1: 0.09999976
a1: 0.099999756
a1: 0.099999756
a1: 0.09999975
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.09999973
a1: 0.09999973
a1: 0.09999973
a1: 0.09999973
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.09999974
a1: 0.099999726
a1: 0.09999972
a1: 0.09999972
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.09999973
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.0999997
a1: 0.09999971
a1: 0.09999971
a1: 0.099999726
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999972
a1: 0.09999972
a1: 0.09999972
a1: 0.09999971
a1: 0.0999997
a1: 0.099999726
a1: 0.09999971
a1: 0.099999726
a1: 0.09999972
a1: 0.09999972
a1: 0.09999973
a1: 0.09999973
a1: 0.099999726
a1: 0.09999972
a1: 0.09999971
a1: 0.09999972
a1: 0.09999972
a1: 0.09999974
a1: 0.09999973
a1: 0.09999973
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.09999972
a1: 0.099999726
a1: 0.099999726
a1: 0.09999974
a1: 0.099999726
a1: 0.099999726
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.099999726
a1: 0.09999972
a1: 0.09999971
a1: 0.099999726
a1: 0.09999972
a1: 0.09999971
a1: 0.099999726
a1: 0.099999726
a1: 0.09999971
a1: 0.099999726
a1: 0.09999972
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999972
a1: 0.09999973
a1: 0.09999972
a1: 0.099999726
a1: 0.09999972
a1: 0.09999972
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.099999726
a1: 0.09999972
a1: 0.09999972
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -6.9849193E-10
a1: -9.313226E-10
a1: -2.7939677E-9
a1: -2.3283064E-10
a1: -2.561137E-9
a1: -2.3283064E-9
a1: -1.8626451E-9
a1: -1.3969839E-9
a1: 9.313226E-10
a1: 9.313226E-10
a1: -1.3969839E-9
a1: -4.656613E-10
a1: 4.656613E-10
a1: -2.3283064E-9
a1: -9.313226E-10
a1: -2.7939677E-9
a1: -1.3969839E-9
a1: -1.8626451E-9
a1: -1.3969839E-9
a1: -3.259629E-9
a1: -9.313226E-10
a1: -2.3283064E-9
a1: -0.099999696
a1: -0.09999971
a1: -0.09999972
a1: -0.099999696
a1: -0.0999997
a1: -0.09999971
a1: -0.09999972
a1: -0.099999726
a1: -0.0999997
a1: -0.099999726
a1: -0.09999972
a1: -0.099999726
a1: -0.09999971
a1: -0.099999726
a1: -0.09999973
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.09999973
a1: -0.09999973
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.099999726
a1: -0.09999975
a1: -0.09999974
a1: -0.09999974
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.09999977
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.099999756
a1: -0.09999976
a1: -0.099999756
a1: -0.099999756
a1: -0.09999975
a1: -0.09999976
a1: -0.09999973
a1: -0.09999974
a1: -0.09999973
a1: -0.09999974
a1: -0.099999726
a1: -0.09999972
a1: -0.09999975
a1: -0.09999973
a1: -0.099999726
a1: -0.09999973
a1: -0.09999973
a1: -0.099999726
a1: -0.09999974
a1: -0.09999973
a1: -0.099999726
a1: -0.09999973
a1: -0.09999971
a1: -0.09999972
a1: -0.09999971
a1: -0.09999972
a1: -0.09999971
a1: -0.099999726
a1: -0.09999971
a1: -0.09999971
a1: -0.09999972
a1: -0.09999971
a1: -0.09999971
a1: -0.09999972
a1: -0.099999726
a1: -0.0999997
a1: -0.09999972
a1: -0.09999971
a1: -0.09999972
a1: -0.09999972
a1: -0.09999972
a1: -0.09999972
a1: -0.09999971
a1: -0.09999973
a1: -0.09999971
a1: -0.09999972
a1: -0.099999726
a1: -0.09999971
a1: -0.09999971
a1: -0.09999971
a1: -0.09999971
a1: -0.099999696
a1: -0.099999696
a1: -0.0999997
a1: -0.099999696
a1: -0.099999696
a1: -0.099999696
a1: -0.099999696
a1: -0.099999696
a1: -0.09999971
a1: -0.099999696
a1: -0.09999969
a1: -0.0999997
a1: -0.099999696
a1: -0.099999696
a1: -0.09999971
a1: -0.09999971
a1: -0.09999971
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -1.8626451E-9
a1: 1.8626451E-9
a1: 1.8626451E-9
a1: 2.7939677E-9
a1: 1.8626451E-9
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.099999696
a1: 0.099999696
a1: 0.0999997
a1: 0.09999971
a1: 0.0999997
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999972
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.0999997
a1: 0.0999997
a1: 0.09999971
a1: 0.0999997
a1: 0.099999696
a1: 0.09999971
a1: 0.099999696
a1: 0.099999696
a1: 0.0999997
a1: 0.099999696
a1: 0.099999696
a1: 0.09999971
a1: 0.0999997
a1: 0.099999696
a1: 0.0999997
a1: 0.0999997
a1: 0.0999997
a1: 0.09999972
a1: 0.0999997
a1: 0.09999971
a1: 0.099999696
a1: 0.09999971
a1: 0.09999971
a1: 0.099999696
a1: 0.09999971
a1: 0.09999972
a1: 0.0999997
a1: 0.09999971
a1: 0.099999726
a1: 0.09999972
a1: 0.09999971
a1: 0.09999973
a1: 0.09999972
a1: 0.09999971
a1: 0.099999726
a1: 0.09999973
a1: 0.09999973
a1: 0.09999973
a1: 0.099999726
a1: 0.09999973
a1: 0.09999972
a1: 0.099999726
a1: 0.09999973
a1: 0.099999756
a1: 0.09999973
a1: 0.09999975
a1: 0.09999973
a1: 0.099999756
a1: 0.09999974
a1: 0.099999756
a1: 0.099999756
a1: 0.09999974
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.099999756
a1: 0.09999977
a1: 0.09999977
a1: 0.099999756
a1: 0.09999977
a1: 0.099999756
a1: 0.09999977
a1: 0.09999977
a1: 0.09999977
a1: 0.099999756
a1: 0.09999977
a1: 0.09999978
a1: 0.099999756
a1: 0.09999977
a1: 0.09999977
a1: 0.099999785
a1: 0.09999977
a1: 0.099999785
a1: 0.099999785
a1: 0.099999785
a1: 0.09999979
a1: 0.099999785
a1: 0.099999785
a1: 0.0999998
a1: 1.8626451E-9
a1: 9.313226E-10
a1: 1.8626451E-9
a1: 0.0
a1: -9.313226E-10
a1: -9.313226E-10
a1: 9.313226E-10
a1: 0.0
a1: 1.8626451E-9
a1: 3.7252903E-9
a1: -1.8626451E-9
a1: -2.7939677E-9
a1: 0.0
a1: -9.313226E-10
a1: -2.7939677E-9
a1: -9.313226E-10
a1: -2.7939677E-9
a1: -9.313226E-10
a1: -1.8626451E-9
a1: -4.656613E-9
a1: -3.7252903E-9
a1: 0.0
a1: -9.313226E-10
a1: -2.7939677E-9
a1: -1.8626451E-9
a1: -1.8626451E-9
a1: 0.0
a1: -9.313226E-10
a1: -9.313226E-10
a1: -2.7939677E-9
a1: 0.0
a1: 1.8626451E-9
a1: 9.313226E-10
a1: 0.0
a1: -2.7939677E-9
a1: -9.313226E-10
a1: -1.8626451E-9
a1: 9.313226E-10
a1: 9.313226E-10
a1: 1.3969839E-9
a1: 9.313226E-10
a1: -1.3969839E-9
a1: 4.656613E-10
a1: 2.7939677E-9
a1: 4.656613E-10
a1: 1.8626451E-9
a1: -1.3969839E-9
a1: -4.656613E-10
a1: -4.656613E-10
a1: 0.0
a1: 9.313226E-10
a1: 4.656613E-10
a1: -9.313226E-10
a1: -9.313226E-10
a1: -9.313226E-10
a1: 9.313226E-10
a1: -4.656613E-10
a1: -4.656613E-10
a1: -2.3283064E-9
a1: -2.561137E-9
a1: -1.1641532E-9
a1: -6.9849193E-10
a1: -4.656613E-10
a1: -6.9849193E-10
a1: -2.0954758E-9
a1: -2.3283064E-10
a1: -1.8626451E-9
a1: -2.3283064E-10
a1: -1.1641532E-9
a1: -1.1641532E-10
a1: 2.2118911E-9
a1: 5.820766E-10
a1: -6.9849193E-10
a1: -2.5029294E-9
a1: 0.0999998
a1: 0.099999815
a1: 0.0999998
a1: 0.099999815
a1: 0.099999815
a1: 0.099999815
a1: 0.09999981
a1: 0.099999815
a1: 0.099999815
a1: 0.09999982
a1: 0.09999982
a1: 0.09999983
a1: 0.09999982
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: -8.731149E-10
a1: 2.3283064E-10
a1: 8.731149E-11
a1: -2.910383E-10
a1: 3.4924597E-10
a1: 8.1490725E-10
a1: -1.8189894E-11
a1: -9.677024E-10
a1: 5.3842086E-10
a1: -8.1490725E-10
a1: -6.1118044E-10
a1: -4.0745363E-10
a1: -4.0745363E-10
a1: -4.0745363E-10
a1: 1.1641532E-10
a1: 5.2386895E-10
a1: -2.3283064E-10
a1: -5.2386895E-10
a1: -6.9849193E-10
a1: 1.1641532E-9
a1: -2.3283064E-10
a1: -8.1490725E-10
a1: -4.656613E-10
a1: -5.820766E-10
a1: 2.3283064E-10
a1: -4.656613E-10
a1: 1.1641532E-10
a1: 3.4924597E-10
a1: -8.1490725E-10
a1: -6.9849193E-10
a1: -2.3283064E-10
a1: -4.656613E-10
a1: 2.3283064E-10
a1: -2.3283064E-10
a1: -4.656613E-10
a1: 0.0
a1: 2.3283064E-10
a1: 0.0
a1: 6.9849193E-10
a1: -4.656613E-10
a1: 4.656613E-10
a1: -2.3283064E-10
a1: -2.3283064E-10
a1: 9.313226E-10
a1: -4.656613E-10
a1: 0.0
a1: 2.3283064E-10
a1: 0.0
a1: -4.656613E-10
a1: 0.0
a1: 0.0
a1: 0.0
a1: 4.656613E-10
a1: -4.656613E-10
a1: -9.313226E-10
a1: 0.0
a1: -4.656613E-10
a1: 0.0
a1: -1.3969839E-9
a1: 0.099999815
a1: 0.099999815
a1: 0.099999815
a1: 0.09999982
a1: 0.09999982
a1: 0.099999815
a1: 0.09999981
a1: 0.09999981
a1: 0.0999998
a1: 0.09999981
a1: 0.0999998
a1: 0.099999815
a1: 0.0999998
a1: 0.09999981
a1: 0.09999982
a1: 0.099999815
a1: 0.09999981
a1: 0.099999815
a1: 0.09999981
a1: 0.0999998
a1: 0.09999981
a1: 0.0999998
a1: 0.09999981
a1: 0.099999815
a1: 0.099999815
a1: 0.09999981
a1: 0.09999981
a1: 0.099999815
a1: 0.099999815
a1: 0.0999998
a1: 0.0999998
a1: 0.09999981
a1: 0.099999815
a1: 0.0999998
a1: 0.09999981
a1: 0.099999815
a1: 0.09999981
a1: 0.09999981
a1: 0.0999998
a1: 0.09999981
a1: 0.099999815
a1: 0.0999998
a1: 0.0999998
a1: 0.09999981
a1: 0.0999998
a1: 0.0999998
a1: 0.099999815
a1: 0.099999815
a1: 0.0999998
a1: 0.09999981
a1: 0.09999981
a1: 0.0999998
a1: 0.0999998
a1: 0.0999998
a1: 0.0999998
a1: 0.09999981
a1: 0.09999982
a1: 0.0999998
a1: 0.09999981
a1: 0.099999815
a1: 0.0999998
a1: 0.099999815
a1: 0.09999979
a1: 0.0999998
a1: 0.0999998
a1: 0.09999979
a1: 0.09999979
a1: 0.099999785
a1: 0.099999785
a1: 0.09999978
a1: 0.09999976
a1: 0.099999785
a1: 0.099999785
a1: 0.09999977
a1: 0.09999978
a1: 0.099999785
a1: 0.09999978
a1: 0.09999978
a1: 0.09999977
a1: 0.099999785
a1: 0.09999977
a1: 0.099999785
a1: 0.09999978
a1: 0.09999976
a1: 0.09999976
a1: 0.09999977
a1: 0.099999756
a1: 0.09999977
a1: 0.09999977
a1: 0.09999976
a1: 0.099999756
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999976
a1: 0.09999975
a1: 0.09999975
a1: 0.09999976
a1: 0.099999756
a1: 0.09999977
a1: 0.09999975
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.09999976
a1: 0.09999976
a1: 0.09999975
a1: 0.09999977
a1: 0.09999976
a1: 0.09999977
a1: 0.099999785
a1: 0.09999977
a1: 0.09999977
a1: 0.099999785
a1: 0.09999977
a1: 0.09999976
a1: 0.09999977
a1: 0.09999977
a1: 0.09999976
a1: 0.09999977
a1: 0.099999756
a1: 0.09999975
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.09999976
a1: 0.09999975
a1: 0.099999756
a1: 0.099999756
a1: 0.09999975
a1: 0.099999756
a1: 0.099999756
a1: 0.09999974
a1: 0.099999756
a1: 0.099999756
a1: 0.09999974
a1: 0.09999975
a1: 0.09999975
a1: 0.09999974
a1: 0.099999756
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999973
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.09999974
a1: 0.09999974
a1: 0.09999973
a1: 0.099999726
a1: 0.09999973
a1: 0.09999973
a1: 0.099999726
a1: 0.09999972
a1: 0.099999726
a1: 0.099999726
a1: 0.09999972
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.0999997
a1: 0.09999972
a1: 0.0999997
a1: 0.099999696
a1: 0.099999696
a1: 0.0999997
a1: 0.0999997
a1: 0.09999971
a1: 0.0999997
a1: 0.099999696
a1: 0.09999971
a1: 0.09999971
a1: 0.0999997
a1: 0.0999997
a1: 0.099999696
a1: 0.09999968
a1: 0.09999969
a1: 0.09999971
a1: 0.09999969
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 5.122274E-9
a1: 1.6298145E-9
a1: -4.1909516E-9
a1: 1.1641532E-9
a1: 3.958121E-9
a1: -2.3283064E-10
a1: 3.0267984E-9
a1: 3.0267984E-9
a1: 1.1641532E-9
a1: 1.6298145E-9
a1: 1.1641532E-9
a1: 5.122274E-9
a1: 4.1909516E-9
a1: -3.7252903E-9
a1: 4.656613E-9
a1: 7.1013346E-9
a1: 4.0745363E-9
a1: 5.355105E-9
a1: 5.122274E-9
a1: 5.5879354E-9
a1: 5.005859E-9
a1: 6.2864274E-9
a1: 9.429641E-9
a1: 1.0477379E-9
a1: 5.47152E-9
a1: 1.4551915E-9
a1: 7.4505806E-9
a1: 5.9371814E-9
a1: -1.2805685E-9
a1: 2.4447218E-9
a1: 4.3364707E-9
a1: 2.6775524E-9
a1: 6.8102963E-9
a1: 3.6525307E-9
a1: 2.6120688E-9
a1: 5.660695E-9
a1: 3.5797711E-9
a1: -1.6589183E-9
a1: -6.9849193E-10
a1: -2.8230716E-9
a1: 1.5716068E-9
a1: 6.693881E-9
a1: 7.1013346E-9
a1: 4.831236E-9
a1: 8.381903E-9
a1: 1.6298145E-9
a1: -1.7462298E-9
a1: -1.1641532E-10
a1: 9.313226E-10
a1: -4.4237822E-9
a1: 8.1490725E-10
a1: 3.0267984E-9
a1: 4.656613E-9
a1: 7.1013346E-9
a1: 1.8626451E-9
a1: 0.09999968
a1: 0.09999969
a1: 0.09999969
a1: 0.09999968
a1: 0.09999968
a1: 0.09999968
a1: 0.09999968
a1: 0.09999969
a1: 0.09999969
a1: 0.09999968
a1: 0.099999696
a1: 0.09999969
a1: 0.09999969
a1: 0.09999969
a1: 0.099999696
a1: 0.099999696
a1: 0.09999969
a1: 0.099999696
a1: 0.09999969
a1: 0.09999967
a1: 0.09999969
a1: 0.09999968
a1: 0.09999968
a1: 0.09999969
a1: 0.09999968
a1: 0.09999967
a1: 0.09999968
a1: 0.09999969
a1: 0.09999969
a1: 0.09999969
a1: 0.09999969
a1: 0.09999967
a1: 0.09999969
a1: 0.099999696
a1: 0.09999969
a1: 0.099999696
a1: 0.099999696
a1: 0.09999968
a1: 0.0999997
a1: 0.09999971
a1: 0.09999969
a1: 0.099999696
a1: 0.099999696
a1: 0.099999696
a1: 0.099999696
a1: 0.099999696
a1: 0.09999969
a1: 0.099999696
a1: 0.09999968
a1: 0.099999696
a1: 0.09999971
a1: 0.09999971
a1: 0.099999696
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.0999997
a1: 0.09999971
a1: 0.09999972
a1: 0.0999997
a1: 0.09999971
a1: 0.0999997
a1: 0.09999972
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999972
a1: 0.09999972
a1: 0.09999972
a1: 0.099999726
a1: 0.09999974
a1: 0.099999726
a1: 0.09999972
a1: 0.09999973
a1: 0.09999972
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: -6.9849193E-10
a1: 0.0
a1: -2.3283064E-10
a1: -4.656613E-10
a1: -0.099999726
a1: -0.09999973
a1: -0.09999974
a1: -0.09999973
a1: -0.09999973
a1: -0.09999972
a1: -0.099999726
a1: -0.09999972
a1: -0.09999972
a1: -0.09999972
a1: -0.09999972
a1: -0.099999726
a1: -0.09999972
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.099999726
a1: -0.09999973
a1: -0.099999726
a1: -0.09999971
a1: -0.099999726
a1: -0.09999972
a1: -0.09999974
a1: -0.09999974
a1: -0.09999975
a1: -0.099999756
a1: -0.099999756
a1: -0.09999976
a1: -0.09999974
a1: -0.09999974
a1: -0.09999975
a1: -0.09999974
a1: -0.09999975
a1: -0.09999976
a1: -0.09999976
a1: -0.09999975
a1: -0.099999756
a1: -0.09999976
a1: -0.099999756
a1: -0.09999977
a1: -0.099999756
a1: -0.09999976
a1: -0.099999756
a1: -0.09999976
a1: -0.09999977
a1: -0.09999977
a1: -0.099999785
a1: -0.09999978
a1: -0.09999979
a1: -0.099999785
a1: -0.099999785
a1: -0.0999998
a1: -0.099999785
a1: -0.09999981
a1: -0.099999815
a1: -0.09999981
a1: -0.0999998
a1: -0.0999998
a1: -0.0999998
a1: -0.0999998
a1: -0.099999815
a1: -0.09999981
a1: -0.099999815
a1: -0.099999815
a1: -0.09999983
a1: -0.09999983
a1: 3.7252903E-9
a1: -3.7252903E-9
a1: -3.7252903E-9
a1: 0.0
a1: -3.7252903E-9
a1: -3.7252903E-9
a1: -7.4505806E-9
a1: -3.7252903E-9
a1: -3.7252903E-9
a1: -3.7252903E-9
a1: 0.0
a1: 0.0
a1: 0.09999982
a1: 0.099999815
a1: 0.099999815
a1: 0.09999983
a1: 0.09999982
a1: 0.099999815
a1: 0.099999815
a1: 0.09999981
a1: 0.09999982
a1: 0.09999983
a1: 0.09999982
a1: 0.09999983
a1: 0.09999983
a1: 0.099999845
a1: 0.099999815
a1: 0.09999983
a1: 0.099999815
a1: 0.099999815
a1: 0.09999982
a1: 0.09999982
a1: 0.09999982
a1: 0.099999815
a1: 0.09999981
a1: 0.09999982
a1: 0.099999815
a1: 0.09999981
a1: 0.0999998
a1: 0.099999785
a1: 0.0999998
a1: 0.09999979
a1: 0.09999981
a1: 0.0999998
a1: 0.09999979
a1: 0.0999998
a1: 0.0999998
a1: 0.09999981
a1: 0.0999998
a1: 0.0999998
a1: 0.099999815
a1: 0.09999981
a1: 0.0999998
a1: 0.0999998
a1: 0.09999979
a1: 0.0999998
a1: 0.0999998
a1: 0.0999998
a1: 0.0999998
a1: 0.099999785
a1: 0.099999785
a1: 0.09999979
a1: 0.09999978
a1: 0.09999978
a1: 0.099999785
a1: 0.09999976
a1: 0.09999977
a1: 0.09999977
a1: 0.09999977
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.099999756
a1: 0.09999975
a1: 0.099999756
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.099999726
a1: 0.09999973
a1: 0.09999973
a1: 0.09999972
a1: 0.09999971
a1: 0.099999726
a1: 0.099999726
a1: 0.09999972
a1: 0.09999972
a1: 0.099999726
a1: 0.09999972
a1: 0.09999972
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999972
a1: 0.099999726
a1: 0.09999971
a1: 0.0999997
a1: 0.09999971
a1: 0.09999971
a1: 0.09999971
a1: 0.09999972
a1: 0.09999972
a1: 0.09999972
a1: 0.099999726
a1: 0.09999972
a1: 0.09999973
a1: 0.099999726
a1: 0.09999974
a1: 0.099999726
a1: 0.099999726
a1: 0.09999974
a1: 0.09999974
a1: 0.099999726
a1: 0.09999975
a1: 0.09999974
a1: 0.099999726
a1: 0.099999726
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.09999975
a1: 0.09999973
a1: 0.09999973
a1: 0.099999726
a1: 0.09999973
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.09999975
a1: 0.09999974
a1: 0.09999973
a1: 0.09999974
a1: 0.09999974
a1: 0.09999974
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.099999726
a1: 0.09999973
a1: 0.099999726
a1: 0.09999973
a1: 0.09999974
a1: 0.09999973
a1: 0.09999974
a1: 0.099999726
a1: 0.099999726
a1: 0.099999726
a1: 0.09999974
a1: 0.0
a1: 0.0
a1: 3.7252903E-9
a1: 3.7252903E-9
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.099999726
a1: -0.099999726
a1: -0.09999974
a1: -0.099999726
a1: -0.09999973
a1: -0.09999974
a1: -0.09999974
a1: -0.09999973
a1: -0.099999726
a1: -0.09999974
a1: -0.09999974
a1: -0.099999726
a1: -0.099999726
a1: -0.09999974
a1: -0.09999973
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999975
a1: -0.09999974
a1: -0.099999726
a1: -0.09999973
a1: -0.09999974
a1: -0.09999974
a1: -0.09999975
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999972
a1: -0.09999973
a1: -0.09999973
a1: -0.09999974
a1: -0.09999974
a1: -0.09999974
a1: -0.09999972
a1: -0.099999726
a1: -0.09999971
a1: -0.09999973
a1: -0.09999973
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
====Sound test... exiting====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted logs/clog2012-07-25_0928PDT.txt.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
----Sound test... started----
====Starfighter Engine Revision -1====
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.1
a1: 0.10000001
a1: 0.10000001
a1: 0.099999994
a1: 0.1
a1: 0.1
a1: 0.10000001
a1: 0.10000001
a1: 0.099999994
a1: 0.099999994
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.099999994
a1: 0.1
a1: 0.099999994
a1: 0.099999994
a1: 0.1
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.1
a1: 0.10000001
a1: 0.10000001
a1: 0.10000002
a1: 0.10000002
a1: 0.100000024
a1: 0.10000002
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.0
a1: -0.10000001
a1: -0.10000001
a1: -0.10000001
a1: -0.10000001
a1: -0.10000001
a1: -0.099999994
a1: -0.10000001
a1: -0.10000001
a1: -0.10000001
a1: -0.1
a1: -0.099999994
a1: -0.099999994
a1: -0.1
a1: -0.10000001
a1: -0.1
a1: -0.1
a1: -0.10000002
a1: -0.100000024
a1: -0.10000001
a1: -0.10000001
a1: -0.10000001
a1: -0.1
a1: -0.10000001
a1: -0.1
a1: -0.1
a1: -0.10000002
a1: -0.10000001
a1: -0.10000001
a1: -0.100000024
a1: -0.10000002
a1: -0.10000002
a1: -0.10000002
a1: -0.10000002
a1: -0.10000001
a1: -0.10000001
a1: -0.10000002
a1: -0.10000001
a1: -0.10000001
a1: -0.100000024
a1: -0.10000001
a1: -0.10000002
a1: -0.10000002
a1: -0.10000002
a1: -0.10000002
a1: -0.1
a1: -0.10000001
a1: -0.10000002
a1: -0.099999994
a1: -0.1
a1: -0.1
a1: -0.10000001
a1: -0.10000001
a1: -0.10000002
a1: -0.100000024
a1: -0.1
a1: -0.10000002
a1: -0.10000001
a1: -0.1
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
spectate 1
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
a1: 0.0
====Sound test... exiting====
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































Deleted logs/clog2012-07-25_1400PDT.txt.

1
2
----Sound test... started----
====Starfighter Engine Revision -1====
<
<




Deleted logs/clog2012-07-25_1403PDT.txt.

1
2
----Sound test... started----
====Starfighter Engine Revision -1====
<
<




Deleted logs/clog2012-07-25_1405PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
----Sound test... started----
====Starfighter Engine Revision -1====
<
<
<
<








Deleted logs/clog2012-07-25_1409PDT.txt.

1
2
----Sound test... started----
====Starfighter Engine Revision -1====
<
<




Deleted logs/clog2012-07-25_1423PDT.txt.

1
2
----Sound test... started----
====Starfighter Engine Revision -1====
<
<




Deleted logs/clog2012-07-25_1425PDT.txt.

1
2
3
4
5
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 0
spectate 1
====Sound test... exiting====
<
<
<
<
<










Deleted logs/clog2012-07-25_1427PDT.txt.

1
2
3
4
5
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
spectate 0
====Sound test... exiting====
<
<
<
<
<










Deleted logs/clog2012-07-25_1429PDT.txt.

1
2
3
4
5
6
7
----Sound test... started----
====Starfighter Engine Revision -1====
spectaet 1
Unrecognized command 'spectaet'
spectate 1
spectate 0
====Sound test... exiting====
<
<
<
<
<
<
<














Deleted logs/clog2012-07-25_1432PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
<
<
<
<








Deleted logs/clog2012-07-25_1433PDT.txt.

1
2
3
4
5
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
spectate 0
====Sound test... exiting====
<
<
<
<
<










Deleted logs/clog2012-07-25_1436PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-25_1437PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
<
<
<
<








Deleted logs/clog2012-07-25_1438PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
<
<
<
<








Deleted logs/clog2012-07-26_0910PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-26_0912PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-26_1003PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-26_1010PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
<
<
<
<








Deleted logs/clog2012-07-26_1012PDT.txt.

1
2
3
4
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
<
<
<
<








Deleted logs/clog2012-07-26_1013PDT.txt.

1
2
3
4
5
6
7
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
cammovespeed
Usage: cammovespeed <units per second>
cammovespeed 500
====Sound test... exiting====
<
<
<
<
<
<
<














Deleted logs/clog2012-07-26_1015PDT.txt.

1
2
3
4
5
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
cammovespeed 2000
====Sound test... exiting====
<
<
<
<
<










Deleted logs/clog2012-07-26_1017PDT.txt.

1
2
----Sound test... started----
====Starfighter Engine Revision -1====
<
<




Deleted logs/clog2012-07-26_1018PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-26_1019PDT.txt.

1
2
3
4
5
6
7
8
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
====Sound test... exiting====
<
<
<
<
<
<
<
<
















Deleted logs/clog2012-07-26_1020PDT.txt.

1
2
3
4
5
6
7
8
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
----Sound test... started----
====Starfighter Engine Revision -1====
spectate 1
spectate 0
====Sound test... exiting====
<
<
<
<
<
<
<
<
















Deleted logs/clog2012-07-26_1021PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-26_1024PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted logs/clog2012-07-26_1025PDT.txt.

1
2
3
----Sound test... started----
====Starfighter Engine Revision -1====
====Sound test... exiting====
<
<
<






Deleted res/models/airplane/FL1BMUP.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/FL1TXDW.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/FL2BMDW.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/FL2BMUP.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/FL2TXUP.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/LAKEREM.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/LAKEREM2.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/MSKLEFT.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/MSKRIGHT.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/RAPIDWBM.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/RAPIFUBM.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/RAPIMORE.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/RAPIOCRE.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/RAPIWIBM.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/TXTALA.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/TXTLEFT.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/TXTRIGT.JPG.

cannot compute difference between binary files

Deleted res/models/airplane/airplane.mtl.

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
159
160
161
162
163
164
165
166
167
168
169
# Max2Mtl Version 4.0 Mar 10th, 2001
#
# Multi/Sub Material__43 (18) to come 
#
newmtl RAPICROM
Ka  0.5 0.5 0.4
Kd  0.5 0.5 0.4
Ks  1.0 1.0 1.0
d  1.0
Ns  0.5
illum 2
#
newmtl AMARILLO
Ka  1.0 0.9 0.4
Kd  1.0 0.9 0.4
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
map_Kd RAPIMORE.JPG
#
newmtl GRIS
Ka  0.3 0.3 0.3
Kd  0.3 0.3 0.3
Ks  1.0 1.0 1.0
d  1.0
Ns  0.5
illum 2
map_Kd RAPIOCRE.JPG
#
newmtl RAPIDOWN1
Ka  0.7 0.7 0.7
Kd  0.7 0.7 0.7
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
map_Kd RAPIMORE.JPG
bump RAPIWIBM.JPG
#
newmtl RAPIUP
Ka  0.7 0.7 0.7
Kd  0.7 0.7 0.7
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
map_Kd RAPIOCRE.JPG
bump RAPIWIBM.JPG
#
newmtl RAPIFLYD
Ka  1.0 0.9 0.4
Kd  1.0 0.9 0.4
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
map_Kd FL1TXDW.JPG
bump FL1BMUP.JPG
#
newmtl RAPIFLYU
Ka  0.4 0.4 0.4
Kd  0.4 0.4 0.4
Ks  1.0 1.0 1.0
d  1.0
Ns  0.5
illum 2
map_Kd FL2TXUP.JPG
bump FL1BMUP.JPG
#
newmtl RAPIFLYU1
Ka  0.4 0.4 0.4
Kd  0.4 0.4 0.4
Ks  1.0 1.0 1.0
d  1.0
Ns  0.5
illum 2
map_Kd RAPIOCRE.JPG
bump FL2BMUP.JPG
#
newmtl RAPIFLYD1
Ka  1.0 0.9 0.4
Kd  1.0 0.9 0.4
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
map_Kd TXTALA.JPG
bump FL2BMDW.JPG
#
newmtl FUSELEFT
Ka  1.0 0.9 0.4
Kd  1.0 0.9 0.4
Ks  1.0 1.0 1.0
d  1.0
Ns  0.5
illum 2
#
newmtl RAPIDOWN
Ka  1.0 0.9 0.4
Kd  1.0 0.9 0.4
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
map_Kd RAPIMORE.JPG
bump RAPIDWBM.JPG
#
newmtl RAPIBLAC
Ka  0.3 0.3 0.3
Kd  0.3 0.3 0.3
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
map_Kd RAPIOCRE.JPG
#
newmtl FUSERIGT
Ka  1.0 0.9 0.4
Kd  1.0 0.9 0.4
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
#
newmtl RAPIGLA2
Ka  1.0 0.9 0.4
Kd  1.0 0.9 0.4
Ks  1.0 1.0 1.0
d  0.8
Ns  0.5
illum 2
#
newmtl RAPIGLAS
Ka  0.1 0.2 0.0
Kd  0.1 0.2 0.0
Ks  1.0 1.0 1.0
d  0.5
Ns  0.5
illum 2
#
newmtl RAPIMORE
Ka  1.0 0.9 0.4
Kd  1.0 0.9 0.4
Ks  1.0 1.0 1.0
d  1.0
Ns  0.5
illum 2
map_Kd RAPIMORE.JPG
#
newmtl RAPITIRE
Ka  0.1 0.1 0.1
Kd  0.1 0.1 0.1
Ks  0.9 0.9 0.9
d  1.0
Ns  0.5
illum 2
#
newmtl SCORCROM
Ka  0.8 0.8 0.8
Kd  0.8 0.8 0.8
Ks  1.0 1.0 1.0
d  1.0
Ns  0.5
illum 2
#
# Multi/Sub Material__43 done 
#
# EOF
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































Deleted res/models/airplane/airplane.obj.

more than 10,000 changes

Deleted res/models/mq9/MQ-9.mtl.

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
# 
# Wavefront material file
# Converted by the DEEP Exploration  Deep Exploration 6.0 6.0.0.5908 Release
# Right Hemisphere, LTD
# http://www.righthemisphere.com/
# 

newmtl mq_9
Ka 0.709804 0.709804 0.709804
Kd 1 1 1
Ks 0.99 0.99 0.99
illum 2
Ns 34.2967
map_Kd predator.jpg
map_bump predator_Normal.jpg
bump predator_Normal.jpg
map_opacity 
map_d 
refl 
map_kS 
map_kA 
map_Ns 

newmtl mq_90
Ka 0.709804 0.709804 0.709804
Kd 1 1 1
Ks 0.99 0.99 0.99
illum 2
Ns 34.2967
map_Kd predator.jpg
map_bump predator_Normal.jpg
bump predator_Normal.jpg
map_opacity 
map_d 
refl 
map_kS 
map_kA 
map_Ns 

newmtl Material__69
Ka 0.282353 0.282353 0.282353
Kd 0.282353 0.282353 0.282353
Ks 0.9 0.9 0.9
illum 2
Ns 12.1257
map_Kd 
map_bump 
bump 
map_opacity 
map_d 
refl 
map_kS 
map_kA 
map_Ns 

newmtl Material__35
Ka 0.709804 0.709804 0.709804
Kd 0.709804 0.709804 0.709804
Ks 0.99 0.99 0.99
illum 2
Ns 34.2967
map_Kd 
map_bump 
bump 
map_opacity 
map_d 
refl 
map_kS 
map_kA 
map_Ns 

newmtl _6___Default
Ka 0.588235 0.588235 0.588235
Kd 1 1 1
Ks 0.9 0.9 0.9
illum 2
Ns 22.6274
map_Kd missile.jpg
map_bump 
bump 
map_opacity 
map_d 
refl 
map_kS 
map_kA 
map_Ns 
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































Deleted res/models/mq9/MQ-9.obj.

more than 10,000 changes

Deleted res/models/mq9/MQ9.JPG.

cannot compute difference between binary files

Deleted res/models/mq9/missile.jpg.

cannot compute difference between binary files

Deleted res/models/mq9/predator.jpg.

cannot compute difference between binary files

Deleted res/models/mq9/predator_Normal.jpg.

cannot compute difference between binary files

Deleted res/models/spaceship/Texture/diffuse.dds.

cannot compute difference between binary files

Deleted res/models/spaceship/Texture/diffuse.tga.

cannot compute difference between binary files

Deleted res/models/spaceship/Texture/glass.dds.

cannot compute difference between binary files

Deleted res/models/spaceship/Texture/glass.tga.

cannot compute difference between binary files

Deleted res/models/spaceship/Texture/normal.dds.

cannot compute difference between binary files

Deleted res/models/spaceship/Texture/normal.tga.

cannot compute difference between binary files

Deleted res/models/spaceship/spaceship.3DS.

cannot compute difference between binary files

Deleted res/models/spaceship/spaceship.max.

cannot compute difference between binary files

Deleted res/models/spaceship/spaceship.mtl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Max2Mtl Version 4.0 Mar 10th, 2001
#
# Multi/Sub Material__4758 (2) to come 
#
newmtl c8bec9bd.dds
Ka  0.7 0.7 0.7
Kd  0.7 0.7 0.7
Ks  1.0 1.0 1.0
d  1.0
Ns  1.0
illum 2
#
newmtl 973653b1.dds
Ka  0.7 0.7 0.7
Kd  0.7 0.7 0.7
Ks  1.0 1.0 1.0
d  1.0
Ns  1.0
illum 2
#
# Multi/Sub Material__4758 done 
#
# EOF
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































Deleted res/models/spaceship/spaceship.smd.

more than 10,000 changes

Deleted res/scripts/DisplaySettings.scr.

1
2
3
4
5
#begin
windowed bool true
vsync bool false
resolution string 640 x 400 x 16 @50Hz
#end
<
<
<
<
<










Deleted res/scripts/autoload.scr.

1
2
3
4

#begin
port number 4444
#end
<
<
<
<








Deleted res/scripts/entscript.scr.

1
2
3
4
5
6
7
8
9
10
11
test script for an entity
#begin
components string com.stargame.ForceComponent,com.stargame.MassComponent,com.stargame.MeshComponent,com.stargame.OrientationComponent,com.stargame.PositionComponent,com.stargame.VelocityComponent

tag string ship
PositionComponent:x number 0
PositionComponent:y number 0
PositionComponent:z number 0


#end
<
<
<
<
<
<
<
<
<
<
<






















Deleted res/scripts/terrainent.scr.

1
2
3
4
5
6
7
8
9
10
test script for an entity
#begin
components string com.stargame.MeshComponent,com.stargame.OrientationComponent,com.stargame.PositionComponent

PositionComponent:x number 0
PositionComponent:y number 0
PositionComponent:z number -400


#end
<
<
<
<
<
<
<
<
<
<




















Deleted res/scripts/testterrain.scr.

1
2
3
4
#begin
heightmap string "./res/terrain/heightmap.pgm"
unitsize number 32
#end
<
<
<
<








Deleted res/sound/LAZER0.WAV.

cannot compute difference between binary files

Deleted res/sound/LAZER1.WAV.

cannot compute difference between binary files

Deleted res/sound/LAZER2.WAV.

cannot compute difference between binary files

Deleted res/sound/LAZER3.WAV.

cannot compute difference between binary files

Deleted res/sound/R2D2a.wav.

cannot compute difference between binary files

Deleted res/sound/saberdown.wav.

cannot compute difference between binary files

Deleted res/sound/saberup.wav.

cannot compute difference between binary files

Deleted res/sound/tie_fighter.wav.

cannot compute difference between binary files

Deleted res/terrain/heightmap.pgm.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
P2
# CREATOR: GIMP PNM Filter Version 1.1
64 64
255
0
0
0
0
0
1
2
3
5
7
10
15
19
23
29
34
39
44
49
56
61
66
68
73
76
80
82
85
87
90
91
94
95
96
99
99
101
100
101
99
98
98
95
95
94
93
89
86
84
77
74
69
62
56
48
40
32
24
18
12
8
3
1
0
0
0
0
0
1
2
3
7
9
13
18
24
29
34
41
48
56
63
68
76
83
88
92
97
99
105
107
110
115
116
117
120
121
122
124
127
130
128
130
130
127
127
128
126
125
123
121
118
113
107
101
95
88
79
70
60
50
39
30
23
17
10
4
2
0
0
0
0
1
4
8
11
15
21
26
33
42
50
58
65
73
80
89
95
104
112
116
122
125
126
129
134
139
141
145
146
147
147
151
153
158
158
159
157
156
154
155
157
155
154
154
148
143
137
132
125
117
110
100
86
74
62
47
36
28
18
11
5
0
0
0
2
4
8
12
17
23
30
40
49
58
67
75
83
94
102
110
120
125
133
138
143
145
149
153
157
161
164
167
167
169
170
174
175
180
181
183
180
180
179
180
182
184
183
181
176
172
167
164
158
150
142
129
115
101
85
69
54
41
31
21
12
0
1
3
5
8
13
19
25
33
44
52
62
73
85
96
104
113
121
128
137
146
152
157
161
164
168
172
175
179
182
184
185
187
190
192
195
199
200
201
199
199
201
203
204
206
206
204
200
196
193
190
187
180
172
160
144
128
112
94
77
61
47
33
22
1
2
5
7
13
19
26
35
45
56
67
79
91
101
114
123
131
139
148
154
162
166
172
175
179
183
185
190
193
195
197
200
201
203
206
210
212
214
214
215
216
216
219
221
221
221
221
219
215
215
213
211
206
199
187
171
155
137
120
99
82
66
49
35
2
4
7
12
19
26
37
45
58
69
81
94
108
119
130
138
148
154
161
168
173
177
183
186
189
193
196
198
201
204
206
207
209
212
214
218
222
224
224
223
224
226
229
232
233
234
232
231
230
229
228
228
225
219
210
196
180
161
144
123
105
83
64
47
4
7
11
17
24
35
45
57
70
83
98
112
122
134
143
150
158
166
173
177
182
186
190
192
195
197
201
204
208
210
211
213
214
217
218
223
226
229
229
229
229
231
234
239
241
241
240
238
237
239
240
240
239
234
227
215
202
185
168
147
128
105
85
61
5
10
14
23
32
44
57
70
83
99
111
124
136
146
153
160
167
172
177
182
185
190
193
195
196
198
202
204
208
210
211
213
214
217
218
223
226
229
230
230
230
233
236
241
244
245
243
242
242
243
246
248
248
244
237
229
218
204
191
172
147
125
104
78
7
14
20
30
42
54
67
82
97
111
125
138
145
153
161
168
172
176
179
183
186
188
190
192
193
195
199
201
203
205
207
208
210
213
215
220
222
225
226
227
228
231
234
239
243
244
243
243
244
245
249
252
252
248
243
236
230
220
210
189
174
147
124
97
11
18
27
38
50
64
78
94
108
122
133
145
153
160
166
172
175
175
178
181
182
182
184
185
186
189
190
192
195
196
197
200
201
204
207
212
213
216
218
220
222
226
230
235
238
239
241
241
243
245
249
253
252
250
246
241
238
232
224
209
192
168
140
112
15
24
32
46
58
73
90
104
119
131
142
152
157
163
167
170
171
172
172
174
175
175
175
174
175
177
178
180
182
184
185
186
188
191
194
198
201
204
206
208
212
216
221
225
228
232
234
236
239
242
246
249
250
249
246
245
243
240
233
225
208
187
163
128
19
28
40
53
67
83
98
113
124
136
145
154
161
164
165
167
166
165
164
164
164
164
161
161
159
159
162
163
165
166
168
168
170
171
177
179
184
185
190
191
195
200
206
211
216
221
224
227
232
236
241
244
246
247
247
248
247
247
243
235
222
200
172
146
23
34
46
61
75
91
106
120
132
141
149
156
158
161
162
160
158
156
153
151
149
147
144
143
140
140
139
142
143
145
147
147
149
148
155
157
162
164
169
171
173
179
186
193
199
204
209
214
221
227
234
238
242
245
246
248
251
252
249
241
228
212
187
158
27
39
52
67
84
100
113
124
136
144
150
154
156
156
157
153
149
144
138
133
130
127
124
121
120
119
117
118
119
121
120
122
124
125
127
131
136
137
141
145
149
153
161
169
175
182
189
196
205
214
223
231
237
241
245
249
252
254
252
244
233
216
193
164
32
44
57
73
91
105
118
129
139
146
151
150
152
149
147
142
137
128
123
116
110
105
102
97
95
94
94
93
92
92
93
95
97
98
101
102
105
107
112
116
121
127
132
139
146
156
164
175
186
198
211
222
230
238
242
247
251
252
250
245
233
220
198
171
37
49
64
79
95
109
122
133
139
144
146
145
144
142
137
130
124
114
104
96
90
84
79
75
73
71
70
67
69
69
69
71
71
73
75
76
80
81
84
87
90
97
102
108
114
126
137
151
165
180
196
209
220
232
240
244
247
249
247
243
234
219
196
174
40
53
66
83
99
111
124
133
139
141
144
142
137
131
125
114
106
96
87
77
70
63
58
55
51
50
48
48
48
47
48
48
49
51
52
52
56
56
59
61
66
70
73
81
87
97
110
125
143
163
181
195
213
224
234
241
244
246
244
242
233
221
201
174
43
57
73
86
101
114
126
132
138
139
138
135
130
122
114
101
90
80
70
59
51
45
40
37
34
34
33
32
33
32
33
32
33
31
32
33
34
35
38
39
42
46
49
53
63
72
84
101
124
143
165
186
202
219
231
238
243
245
244
241
234
221
203
178
47
61
76
90
104
115
124
133
135
136
135
129
122
111
100
88
76
65
54
45
38
30
25
26
23
24
24
24
24
24
24
23
23
23
23
23
23
23
24
23
26
28
28
33
40
49
63
81
106
128
154
177
199
214
230
238
244
246
247
243
237
225
208
183
51
65
80
93
105
117
124
129
133
132
128
123
113
102
89
77
64
51
41
33
24
19
18
17
16
20
21
23
25
24
24
25
24
25
24
20
18
16
18
20
21
20
20
22
25
35
50
71
95
117
145
171
197
214
229
239
246
248
249
246
240
228
211
187
52
68
81
95
105
116
123
128
129
127
122
115
105
91
78
66
54
41
29
23
17
14
13
15
19
23
26
28
34
34
36
34
33
33
32
28
26
26
24
23
25
24
22
23
25
32
47
68
90
114
142
169
195
215
230
240
247
251
253
249
242
230
214
189
53
69
82
94
106
116
122
125
125
122
115
107
96
84
69
56
43
31
22
17
13
14
15
21
27
34
38
42
48
51
53
53
53
52
48
48
44
43
40
38
36
35
35
35
36
40
55
73
95
119
145
173
197
215
231
239
247
252
253
249
242
230
214
189
55
69
82
96
107
116
120
123
121
118
109
102
87
75
62
48
36
24
18
14
13
18
21
31
39
48
57
62
71
74
79
78
79
77
74
73
69
67
64
61
60
57
55
55
56
60
71
88
107
128
153
179
200
216
230
240
246
250
250
247
239
228
211
187
55
70
83
95
105
113
118
121
118
113
104
94
83
68
55
42
29
21
16
13
16
23
31
43
56
67
80
89
98
102
107
107
109
106
103
101
97
96
93
89
87
84
83
82
82
89
98
110
127
144
166
185
204
219
232
239
245
246
246
243
238
225
207
183
55
68
82
94
104
111
115
117
115
109
100
90
74
63
50
36
25
18
15
17
22
31
43
58
75
88
104
118
129
133
139
140
137
136
136
133
129
127
125
120
118
116
114
113
113
118
123
133
148
161
180
195
211
224
234
240
245
245
245
241
234
221
203
178
55
68
81
93
103
108
114
113
112
105
97
84
71
58
46
33
23
18
18
20
30
41
58
75
95
110
132
146
161
165
171
168
169
165
166
165
162
159
159
153
151
149
146
145
145
147
155
160
171
183
195
208
221
230
238
243
245
246
245
242
232
220
199
172
56
68
81
91
100
108
111
111
108
100
92
79
69
55
41
30
22
18
19
25
37
50
71
90
112
134
160
172
189
193
198
194
195
191
191
191
191
189
187
183
178
177
177
177
177
179
180
183
191
201
211
220
229
236
242
246
249
249
247
242
232
217
194
171
56
68
80
88
98
103
107
106
105
97
90
79
65
52
39
28
22
19
21
30
43
60
83
105
133
158
181
199
210
215
218
216
214
213
213
212
214
213
210
207
204
202
202
201
202
202
203
205
212
216
225
230
237
240
245
248
252
252
250
243
232
217
194
166
53
66
78
88
96
102
104
103
101
94
86
75
62
48
36
28
21
21
23
32
48
68
93
120
149
176
200
218
227
233
233
232
229
228
228
230
230
229
227
224
222
221
222
222
222
221
220
222
224
229
235
238
242
244
247
249
252
254
250
242
229
212
188
159
52
65
76
85
93
99
103
102
99
93
83
74
62
49
37
27
22
21
26
37
52
74
100
132
160
189
212
230
240
245
244
241
238
237
238
240
241
241
239
237
235
235
235
235
234
234
233
233
236
240
242
245
245
247
247
249
250
251
246
238
224
206
180
150
51
62
73
83
92
96
100
99
97
91
82
71
61
48
37
26
22
22
28
39
55
77
104
136
168
196
217
236
247
252
250
245
242
242
243
246
248
248
246
243
242
243
243
244
244
243
241
240
242
244
247
249
249
248
247
247
246
244
239
231
216
193
166
136
47
58
71
80
89
93
98
98
95
88
81
71
57
49
36
27
24
23
29
39
55
77
104
136
168
196
217
236
248
252
250
246
243
243
245
249
252
252
250
246
245
246
249
250
250
247
245
245
244
248
251
253
251
248
245
243
241
236
229
219
201
178
152
119
44
56
67
77
85
92
94
95
92
87
79
70
60
48
37
29
24
23
28
39
53
74
100
132
160
190
213
230
241
246
245
243
242
242
244
249
252
252
249
247
246
247
250
253
253
250
247
245
245
248
252
254
252
247
243
238
233
225
216
200
182
157
131
104
43
54
63
74
82
88
90
91
90
86
78
70
59
50
37
29
24
23
26
35
50
68
93
121
149
177
202
219
229
235
236
237
236
238
241
245
248
249
247
245
244
246
249
251
251
248
246
244
244
246
249
251
248
243
236
230
222
210
198
179
161
135
113
87
39
51
59
71
78
84
88
90
88
83
77
72
61
51
40
31
26
24
26
34
46
61
83
105
134
160
183
201
213
220
223
225
227
229
234
238
240
241
241
240
240
242
244
246
246
244
241
239
239
240
242
242
240
235
227
217
205
192
176
157
134
114
92
68
37
47
57
66
73
81
84
86
85
83
77
71
63
52
42
33
26
24
25
30
41
52
71
91
114
137
163
177
194
200
206
207
212
215
220
225
229
229
230
230
232
233
235
236
237
235
234
231
230
231
230
231
227
222
212
198
185
166
151
132
115
93
73
53
34
44
53
63
69
76
80
84
82
81
77
72
63
52
45
36
30
25
24
27
35
46
61
78
97
114
136
152
168
175
184
185
191
195
202
208
212
213
214
214
216
218
222
223
223
221
217
215
215
214
215
212
210
199
190
174
159
142
127
106
91
72
55
40
30
40
49
58
66
72
77
80
81
80
75
71
64
57
47
39
31
26
25
26
31
37
47
60
78
93
110
126
138
146
154
160
164
170
178
183
188
191
192
192
194
198
201
203
204
201
197
194
194
191
192
188
184
174
165
146
134
117
102
83
70
55
40
28
28
36
44
53
60
68
73
75
78
78
75
70
66
57
51
43
34
28
27
26
27
32
38
48
60
71
86
97
109
116
124
129
137
142
149
154
157
161
165
166
167
171
175
176
176
174
171
165
165
166
163
158
155
146
130
118
107
92
77
63
50
38
26
17
24
30
40
48
56
64
70
73
75
74
74
69
65
59
53
45
39
33
29
26
25
29
31
39
45
54
65
70
82
88
95
100
108
113
119
122
126
128
132
134
138
140
143
143
143
142
141
139
136
133
131
126
121
112
103
91
82
67
55
44
33
24
17
9
21
27
36
42
51
58
66
69
71
73
73
69
65
62
56
50
42
37
31
27
26
26
28
31
34
42
47
51
61
66
70
74
78
83
87
92
96
99
102
104
108
110
112
113
112
113
110
107
107
103
101
96
90
82
76
65
56
47
37
30
22
15
9
4
17
23
30
37
45
53
59
64
68
70
69
68
66
62
59
52
47
42
34
29
27
27
25
27
28
32
33
37
42
47
51
52
57
59
62
65
68
72
76
76
79
80
81
83
82
83
80
82
79
77
73
69
65
58
51
46
39
34
25
18
13
8
4
3
14
19
25
33
40
47
53
58
63
66
66
67
66
63
59
53
50
44
40
34
31
27
25
24
25
27
28
29
31
33
34
37
37
41
41
43
48
49
51
53
54
56
57
59
57
58
56
57
55
53
53
49
45
40
35
32
26
21
16
12
8
5
3
2
11
16
22
28
36
42
48
53
58
62
65
64
63
63
59
57
52
47
42
39
35
32
27
26
26
25
25
23
25
24
25
26
28
28
27
31
31
31
34
35
37
37
38
38
39
37
37
38
37
36
36
34
32
27
24
21
18
13
10
8
5
4
3
2
9
13
18
24
30
36
44
49
53
57
61
61
63
61
59
57
54
50
45
42
40
36
32
29
27
25
24
24
23
22
21
20
21
21
20
21
21
23
24
25
26
26
25
24
24
25
25
27
25
23
24
21
21
18
17
14
12
10
7
6
4
4
4
2
6
10
14
20
25
31
37
43
48
53
55
58
59
59
58
56
54
49
48
46
42
40
35
32
31
28
27
25
24
22
21
20
20
20
19
18
18
18
19
18
18
19
18
17
17
18
17
18
17
15
16
14
13
13
12
10
9
8
7
5
4
4
3
2
4
8
12
15
21
26
31
38
42
47
51
54
55
56
55
55
53
51
49
47
44
41
39
34
33
32
30
28
26
26
25
23
21
20
20
18
18
18
17
15
15
17
15
16
15
15
14
12
14
12
12
12
12
12
10
9
7
6
6
5
5
4
3
2
3
5
8
12
17
21
26
31
36
40
46
49
50
52
51
52
52
50
49
49
45
43
41
37
35
35
34
31
30
27
26
26
24
23
22
20
20
20
19
18
17
16
15
16
14
14
14
12
13
12
12
12
11
10
9
9
7
7
6
5
5
3
3
2
2
3
6
9
12
17
21
25
30
35
39
44
45
47
48
49
49
48
48
47
44
42
40
39
37
37
35
34
31
30
29
27
26
25
23
24
22
21
20
19
18
18
17
16
15
15
14
14
14
13
12
11
11
10
9
8
8
7
6
4
4
3
3
1
1
2
3
6
9
13
17
21
24
28
33
37
40
42
43
45
45
46
46
45
44
42
40
38
38
38
35
35
33
30
29
29
27
26
25
25
22
21
21
20
19
19
18
16
16
16
14
14
13
13
11
11
10
9
9
8
7
5
5
4
3
3
2
1
1
1
2
4
7
9
13
16
20
23
27
31
33
36
38
39
41
42
41
41
41
39
38
37
37
37
34
34
33
31
30
28
27
26
25
25
23
22
22
20
19
19
18
16
16
15
14
14
12
12
11
10
9
8
8
7
7
5
4
4
2
2
2
1
0
1
1
3
5
7
9
12
15
18
22
25
28
30
32
35
36
37
38
37
36
36
35
34
35
34
33
31
31
30
29
28
25
26
24
24
22
22
21
20
19
18
18
16
15
14
14
13
12
11
9
10
9
7
7
6
5
4
3
3
2
2
1
1
0
0
1
1
3
4
6
9
11
14
17
19
22
25
27
29
30
30
32
32
32
32
32
32
32
31
30
30
29
28
27
27
25
23
23
22
22
21
20
19
18
16
16
16
14
14
13
12
10
11
9
8
8
7
6
5
4
3
3
2
2
2
1
0
0
0
0
0
2
2
5
6
7
10
13
15
16
19
22
23
24
24
26
27
28
28
29
28
28
28
26
25
25
25
25
24
23
23
23
21
20
19
18
18
17
16
14
14
13
11
11
10
10
9
7
6
6
5
4
5
3
3
2
2
1
1
0
0
0
0
0
0
0
1
3
4
5
6
8
10
13
14
16
17
18
20
22
22
23
24
24
24
23
23
23
23
23
22
22
21
20
19
20
17
18
17
16
15
14
13
12
12
11
10
9
9
8
6
6
6
5
4
3
3
2
1
1
1
1
0
0
0
0
0
0
0
0
1
1
2
3
4
5
7
8
10
11
12
14
15
17
17
18
19
19
19
19
19
19
19
19
18
17
17
17
16
15
15
15
15
14
13
12
11
10
9
9
8
8
7
7
6
5
4
4
3
3
2
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
1
2
2
3
4
6
6
8
9
10
11
12
13
14
14
14
14
15
14
14
15
15
14
15
15
13
13
12
13
12
11
11
10
10
8
8
8
7
7
6
6
4
4
3
3
2
2
2
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
2
3
3
4
6
6
7
7
8
9
9
10
10
11
10
11
11
11
11
10
11
11
11
10
10
9
10
9
8
8
7
7
7
6
5
4
4
5
4
3
3
2
2
2
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
2
2
3
3
4
5
5
5
6
7
6
7
8
7
8
8
8
8
7
8
8
7
7
7
6
6
6
6
6
5
5
4
3
3
3
2
2
2
2
2
2
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
2
2
3
3
4
3
4
4
4
5
5
5
5
4
6
6
4
5
5
5
5
4
4
5
4
4
3
3
3
3
3
2
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
2
2
3
3
3
3
3
3
3
2
3
3
3
3
3
3
3
3
2
2
3
2
2
2
2
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
2
2
2
1
1
1
1
1
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Added source/Makefile.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
CC=gcc
CFLAGS=-ggdb
LDFLAGS=-L../lib -Iinclude

LIBSWIN32=-lglew32 -lopengl32 -lgdi32 -lm -llua
LIBSLINUX=-lglew32 -lopengl32 -lgdi32 -lm -llua
LIBSAPPLE=

CORE=core
TEST=test
O=objects
OUT=../bin
NAME=frontier
OBJECTS=		$(O)/AxisAngle.o	\
			$(O)/Array.o	\
			$(O)/BST.o	\
			$(O)/Component.o	\
			$(O)/DeviceEnumeration.o	\
			$(O)/Engine.o	\
			$(O)/EntityManager.o	\
			$(O)/Input.o	\
			$(O)/LinkedList.o	\
			$(O)/Matrix.o	\
			$(O)/Quaternion.o	\
			$(O)/Resource.o	\
			$(O)/ResourceManager.o	\
			$(O)/State.o	\
			$(O)/Vector.o	\
			$(O)/Void.o

WINAPP=		$(O)/wintest.o	\
		$(O)/tstate.o
LINUXAPP=
APPLEAPP=

w32: $(OBJECTS) $(WINAPP)
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(WINAPP) \
	-o $(OUT)/$(NAME) $(LIBSWIN32)

linux:	$(OBJECTS) $(LINUXAPP)
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(WINAPP) \
	-o $(OUT)/$(NAME) $(LIBSLINUX)

apple:	$(OBJECTS) $(APPLEAPP)
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(WINAPP) \
	-o $(OUT)/$(NAME) $(LIBSAPPLE)

test: $(OBJECTS) $(O)/test.o
	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(O)/test.o \
	-o $(OUT)/test $(LIBSWIN32)


$(O)/%.o: $(CORE)/%.c
	$(CC) $(CFLAGS) $(LDFLAGS) -c $< -o $@

$(O)/%.o: $(TEST)/%.c
	$(CC) $(CFLAGS) $(LDFLAGS) -c $< -o $@


cleanw32:
#keep directories updated with $(O) and $(OUT)
#windows needs directories to have \ instead of /
	del /Q objects\*.o
	del /Q ..\bin\*.exe
cleanlinux:
	rm -rf $(O)/*.o
	rm -rf $(OUT)/w*
cleanapple:
	rm -rf $(O)/*.o
	rm -rf $(OUT)/w*

Added source/core/Array.c.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#include "Array.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define DEFAULT_CAPACITY 4
#define RATE 4

Array * Array_create(const char * arrayType)
{
  if (strcmp(arrayType, "int") != 0 &&
	  strcmp(arrayType, "char") != 0 &&
	  strcmp(arrayType, "double") != 0 &&
	  strcmp(arrayType, "float") != 0 &&
	  strcmp(arrayType, "long") != 0 &&
	  strcmp(arrayType, "short") != 0 &&
	  strcmp(arrayType, "cstring") != 0)
  {
	return NULL;
  }

  Array * arr = (Array *)malloc(sizeof(Array));
  arr->size = 0;
  arr->capacity = DEFAULT_CAPACITY;
  arr->elements = (Element *)malloc(sizeof(Element)*arr->capacity);
  strcpy(arr->type, arrayType);
}

void Array_add(Array * arr, void * v)
{
  int i;
  Element * newElements = NULL;

  if (arr->size == arr->capacity) //grow array 1st if necessary
  {
	newElements = (Element *)malloc(sizeof(Element)*
									(arr->capacity+RATE));
	for (i = 0; i < arr->size; i++)
	  newElements[i] = arr->elements[i];
	free(arr->elements);
	arr->elements = newElements;
	arr->capacity += RATE;
  }

  arr->elements[arr->size].data = v;
  arr->size += 1;
}

Added source/core/Array.h.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef __ARRAY_H__
#define __ARRAY_H_

typedef struct
{
  void * data;
} Element;

typedef struct
{
  Element * elements;
  //void * data;
  int size;
  int capacity;
  char * type;
} Array;

Array * Array_create(const char * arrayType);
void Array_add(Array * arr, void * v);

#endif

Added source/core/AxisAngle.c.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "AxisAngle.h"

axisAngle_t AxisAngle_identity()
{
  axisAngle_t aa;
  aa.axis.x = 1;
  aa.axis.y = 0;
  aa.axis.z = 0;
  aa.angle = 0;
}

axisAngle_t AxisAngle_normalize(axisAngle_t aa)
{
  aa.axis = Vector_normalize(aa.axis);
  return aa;
}

Added source/core/AxisAngle.h.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef __AXIS_ANGLE_H__
#define __AXIS_ANGLE_H__

#include "Vector.h"

typedef struct axisAngle_s
{
  vector_t axis;
  float angle; //in radians
} axisAngle_t;

//an angle representing no rotation (0 degrees around
//any axis)
axisAngle_t AxisAngle_identity();

axisAngle_t AxisAngle_normalize(axisAngle_t aa);

#endif

Added source/core/BST.c.















>
>
>
>
>
>
>
1
2
3
4
5
6
7
#include "BST.h"

typedef struct
{
  int key;
  void * value;
} BSTNode;

Added source/core/BST.h.













>
>
>
>
>
>
1
2
3
4
5
6
#ifndef __BST_H__
#define __BST_H__



#endif

Added source/core/Component.c.

































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#include "Component.h"
#include "stdlib.h"
#include <string.h>
#include "Vector.h"

//given the given component type ID, allocate an instance of this
//component and return it
/*
component_t * Component_create(unsigned int componentType)
{
  component_t * c = NULL;
  void * d = NULL;
  if (componentType == ID_FORCE)
  {
	c = (component_t *)malloc(sizeof(component_t));
	c->id = componentType;
	d = malloc(sizeof(forceComp_t));
	memset(d, 0, sizeof(forceComp_t));
	c->data = d;
  }
  else if (componentType == ID_MASS)
  {
	c = (component_t *)malloc(sizeof(component_t));
	c->id = componentType;
	d = malloc(sizeof(massComp_t));
	memset(d, 0, sizeof(massComp_t));
	c->data = d;
  }
  else if (componentType == ID_MESH)
  {
	c = (component_t *)malloc(sizeof(component_t));
	c->id = componentType;
	d = malloc(sizeof(meshComp_t));
	memset(d, 0, sizeof(meshComp_t));
	c->data = d;
  }
  else if (componentType == ID_ORIENTATION)
  {
	c = (component_t *)malloc(sizeof(component_t));
	c->id = componentType;
	d = malloc(sizeof(orientationComp_t));
	memset(d, 0, sizeof(orientationComp_t));
	c->data = d;
  }
  else if (componentType == ID_POSITION)
  {
	c = (component_t *)malloc(sizeof(component_t));
	c->id = componentType;
	d = malloc(sizeof(positionComp_t));
	memset(d, 0, sizeof(positionComp_t));
	c->data = d;
  }
  else if (componentType == ID_VELOCITY)
  {
	c = (component_t *)malloc(sizeof(component_t));
	c->id = componentType;
	d = malloc(sizeof(velocityComp_t));
	memset(d, 0, sizeof(velocityComp_t));
	c->data = d;
  }
  else if (componentType == ID_VOLUME)
  {
	c = (component_t *)malloc(sizeof(component_t));
	c->id = componentType;
	d = malloc(sizeof(volumeComp_t));
	memset(d, 0, sizeof(volumeComp_t));
	c->data = d;
  }
  return c;
}

void Component_destroy(component_t * comp)
{
  if (comp == NULL)
	return;
  if (comp->data != NULL)
	free(comp->data);
  free(comp);
}
*/

Added source/core/Component.h.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
 #ifndef __COMPONENT_H__
#define __COMPONENT_H__

#include "Vector.h"

//id for each component type
#define ID_FORCE       (0 << 0)
#define ID_MASS        (0 << 1)
#define ID_MESH        (0 << 2)
#define ID_ORIENTATION (0 << 3)
#define ID_POSITION    (0 << 4)
#define ID_VELOCITY    (0 << 5)
#define ID_VOLUME      (0 << 6)

//equals the above, for easier comparisons in linked lists and such
#define PAYLOAD_FORCE ID_FORCE
#define PAYLOAD_MASS ID_MASS
#define PAYLOAD_MESH ID_MESH
#define PAYLOAD_ORIENTATION ID_ORIENTATION
#define PAYLOAD_POSITION ID_POSITION
#define PAYLOAD_VELOCITY ID_VELOCITY
#define PAYLOAD_VOLUME ID_VOLUME

/**
 * The container for a component. Stores metadata to keep track of the
 * id of the owning entity, as well as the component type that its data
 * should dereference to.
 */
/*
typedef struct component_s
{
  int entity; //owning entity
  unsigned int id; //type identifier of component
  void * data; //data specific to this type of component
} component_t;
*/

/**
 * The various forms of data that can be stored in a component_t.
 */
typedef struct forceComp_s
{
  int entity;
  vector_t gravity;
} forceComp_t;
typedef struct massComp_s
{
  int entity;
  float mass; //KG
} massComp_t;
typedef struct meshComp_s
{
  int entity;
  int placeholder;
} meshComp_t;
typedef struct orientationComp_s
{
  int entity;
  vector_t heading;
  vector_t right;
  vector_t up;
} orientationComp_t;
typedef struct positionComp_s
{
  int entity;
  vector_t position;
} positionComp_t;
typedef struct velocityComp_s
{
  int entity;
  vector_t velocity;
} velocityComp_t;
typedef struct volumeComp_s
{
  int entity;
  int placeholder;
} volumeComp_t;

/**
 * Create a component_t, containing data representative of componentType.
 * Used by EntityManager to create components.
 */
//component_t * Component_create(unsigned int componentType);

/**
 * Free a component_t as well as the data it contains from memory. Called
 * by the EntityManager when components are removed (either explicitly or
 * due to the owning entity being destroyed). The user should not have to
 * call this.
 */
//void Component_destroy(component_t * comp);

#endif

Added source/core/DeviceEnumeration.c.























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#include "DeviceEnumeration.h"
#include <stdio.h>
#include <stdbool.h>

#ifdef _WIN32
#include <windows.h>
#endif //_WIN32

static deviceOptions_t enum_win32();
static deviceOptions_t enum_linux();
static deviceOptions_t enum_apple();

//format text for the basic 80x25 size
deviceOptions_t enumerate()
{
  printf("enumerating...\n");
#ifdef _WIN32
  return enum_win32();
#elif __linux__
  return enum_linux();
#elif __APPLE__
  return enum_apple();
#else
#pragma message("cannot enumerate unsupported platform");
  deviceOptions_t options;
  memset(&options, 0, sizeof(deviceOptions_t));
  return options;
#endif
}

#ifdef _WIN32
deviceOptions_t enum_win32()
{
  deviceOptions_t options;
  bool madeChoice = false;
  DEVMODE mode;
  memset(&mode, 0, sizeof(DEVMODE));
  mode.dmSize = sizeof(DEVMODE);
  mode.dmDriverExtra = 0;

  int choice;
  int enumSize;
  int i = 0;
  system("cls");
  printf("Available Display Modes:\n");
  while (EnumDisplaySettings(NULL, i, &mode))
  {
	printf("%d. %dx%d @ %d Hz, %d Bits per Pixel\n",
		   i,
		   mode.dmPelsWidth,
		   mode.dmPelsHeight,		   
		   mode.dmDisplayFrequency,
		   mode.dmBitsPerPel);
	i++;
  }
  enumSize = i;
  printf("Enter an index for the desired display mode: ");
  scanf("%d", &choice);
  while (choice < 0 || choice > enumSize-1)
  {
	printf("Pick an index between 0 and %d, inclusive: ", enumSize-1);
	scanf("%d", &choice);
  }
  EnumDisplaySettings(NULL, choice, &mode);
  options.width = mode.dmPelsWidth;
  options.height = mode.dmPelsHeight;
  options.bpp = mode.dmBitsPerPel;
  options.hz = mode.dmDisplayFrequency;

  printf("%dx%d@%d Hz, %d Bits per Pixel\n",
		 options.width,
		 options.height,
		 options.hz,
		 options.bpp);
  return options; //todo
}
#endif //_WIN32

#ifdef __linux__
deviceOptions_t enum_linux()
{

}
#endif //__linux__

#ifdef __APPLE__
deviceOptions_t enum_apple()
{

}
#endif //__APPLE__

Added source/core/DeviceEnumeration.h.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef _DEVICE_ENUMERATION_H__
#define _DEVICE_ENUMERATION_H__

typedef struct deviceOptions_s
{
  int width;
  int height;
  int bpp; //bits per pixel
  int hz; //refresh rate
} deviceOptions_t;

//wrapper for platform specific enumerate func
deviceOptions_t enumerate();

#endif

Added source/core/Engine.c.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
#include "Engine.h"
#include <stdlib.h> //malloc, NULL
#include <string.h> //strcpy, memset
#include <stdio.h> //printf
#include "State.h"
#include "LinkedList.h"
#include "ResourceManager.h"
#include "Input.h"
#include "DeviceEnumeration.h"

#define GLEW_STATIC


//typedef bool (*initGLContext)(AppInstance);
#ifdef _WIN32
	   #include <windows.h>
	   #include <GL/glew.h>
	   //#include <gl/gl.h> provided by glew?
	   #include <GL/wglew.h> //windows specific extensions (

	   //windows winproc macros
	   //bit 30 of 31
	   #define KEY_AUTOREPEAT (1 << 30)

	   static bool win32_initOpenGLContext(HINSTANCE hInstance);
	   LRESULT CALLBACK WndProc(HWND hwnd,
								  UINT msg,
								  WPARAM wParam,
								  LPARAM lParam);
	   void win32_CenterWindow(HWND hwnd);
       //typedef win32initOpenGLContext initGLContext
#endif

#ifdef __linux__
	   #include <X11/X.h> //included by Xlib.h
	   #include <X11/Xlib.h>
	   #include <GL/gl.h>
	   #include <GL/glx.h>

	   static bool linux_initOpenGLContext();
#endif

#ifdef __APPLE__
#pragma message("No includes for apple yet!")
#endif




//lua
#include "../lua/lua.h"
#include "../lua/lualib.h"
#include "../lua/lauxlib.h"
#include "../lua/luaconf.h"


//char getKeyChar(WPARAM wParam);

/*
 * The data for the Engine module is stored here.
 */
typedef struct
{
  bool closeRequested;
  bool loaded;
//may be unneeded because states currently dont do anything besides load and close (no update/render)
  //bool stateChanged;
  int target_fps;
  char title[32];
  linkedList_t * states;
  State * currentState;

  //lua interpreter
  lua_State * lua;

  //win32
#ifdef _WIN32
  HINSTANCE instance;
  HWND wnd;
  HDC dc;
  HGLRC oglContext;
#endif //_WIN32

//display settings
deviceOptions_t dOptions;
} EngineData;

/* the sole instance of data for this module, only visible internally */
static EngineData eData;
static bool instanced = false;

//void Engine_addState(State * s, bool changeNow)
void Engine_addState(bool (*load)(void), bool (*close)(void), int id, bool changeNow)
{
  /*
  if (s == NULL)
	return;
  if (s->load == NULL || s->close == NULL)
	return;
  */
  //link_t * link = malloc(sizeof(link_t)-1 + sizeof(State));
  //link->prev = link->next = NULL;
  //link->payloadType = PAYLOAD_STATE;
  link_t * link = LinkedList_createLink(sizeof(State), PAYLOAD_STATE);
  State * s = &(link->payload);
  s->load = load;
  s->close = close;
  s->update = NULL;
  s->render = NULL;
  s->id = id;

  LinkedList_add(eData.states, link);

  if (changeNow)
  {
	if (eData.currentState != NULL)
	{
	  if (!eData.currentState->close())
		printf("Fatal error closing a state\n");
	}
	eData.currentState = s;
	if (!eData.currentState->load())
	  printf("Fatal error loading a state\n");
  }  
}

/**
 * Unload any currently loaded state and load a new one.
 * 
 * Limitations:
 * Can't change to a state that is already current.
 * Can't change to a state that has not been added to the engine, or has
 * been removed (it won't exist in the list).
 */
void Engine_changeState(int newStateID)
{
  int i;
  State * s;
  /*
  for (i = 0; i < LinkedList_size(eData.states); i++)
  {
	s = (State *)LinkedList_get(eData.states, i);
	if (s->id == newStateID)
	{
	  if (s != eData.currentState) //we are clear to change
	  {
		printf("changing state...\n");
		if (eData.currentState != NULL)
		  eData.currentState->close();
		s->load();
		return;
	  }
	  else
		printf("Can't change to an already current state\n");
	}
  }
  */
  printf("No state with id: %d", newStateID);
}

void Engine_create(EngineSetup * es)
{
  if (instanced) //can only create once
	return;

  memset(&eData, 0, sizeof(eData)); //init struct to 0

  printf("Engine_create()\n");
  //if engine setup is null, abort since we cant get the HINSTANCE
  if (es == NULL)
	return;
  
  /* init the eData */
  eData.closeRequested = false;
  eData.loaded = false;
  //eData.stateChanged = false;
  eData.target_fps = es->target_fps;
  strcpy(eData.title, es->title); //eData.title = es->title;
  eData.states = LinkedList_create();

  //setup device enumeration
eData.dOptions = enumerate();

  //setup display here
  //windows
#ifdef _WIN32
  eData.instance = es->instance;

  /* create window / setup opengl */
  //inst = es->instance;
  if (!win32_initOpenGLContext(eData.instance))
	printf("Error initing opengl...");
#endif //_WIN32
 
  //setup othe rmodules (console, network...)
  //EntityManager_create();
  //let each state determine which modules to open and close (except
  //persitent ones such as network)
  //temp: test lua
  eData.lua = (lua_State *)luaL_newstate();
  luaL_openlibs(eData.lua);
  int dofile = luaL_dofile(eData.lua, "../source/lua/hello.lua"); //path relative to exe in /bin
  if (dofile == 0)
  {
	//call foo
	lua_getglobal(eData.lua, "foo");
	lua_call(eData.lua, 0, 0);
  }
  else
	printf("Error, unable to run hello.lua\n");
  //cleanup lua
  lua_close(eData.lua);

  Input_create();
  ResourceManager_create();

  //seed random number generator
  
  //allow application to now perform any state specific setup
  if (es->EngineSetupFunc != NULL)
	es->EngineSetupFunc();
  
  /* if we got to this point, engine is ready to run */
  eData.loaded = true;
  instanced = true;
}

/** Called at the end of Engine_run(). */
void Engine_destroy()
{
  int i;
  //State * s;

  if (!instanced || !eData.loaded) //dont destroy if not loaded/instanced
	return;
  printf("Engine_destroy()\n");

  //clean dynamic engine data
  //states - should all be closed prior to this call so no need to check
  /*
  for (i = 0; i < LinkedList_size(eData.states); i++)
	free(LinkedList_get(eData.states, i));
  LinkedList_destroy(eData.states);
  */
  //close modules
  //EntityManager_destroy();
  Input_destroy();
  ResourceManager_destroy();

  //delete opengl context

#ifdef _WIN32
  wglMakeCurrent(eData.dc, NULL);
  wglDeleteContext(eData.oglContext);
#endif
  instanced = false;
  memset(&eData, 0, sizeof(eData)); //clean struct
}

long Engine_getTime()
{
  //TODO
  return 0;
}

const char * Engine_getTitle()
{
  return eData.title;
}

int Engine_getTargetFPS()
{
  return eData.target_fps;
}

bool Engine_isLoaded()
{
  return eData.loaded;
}

/**
 * Remove a state from the engine's state list that has a matching id.
 * The state is also freed from memory. Don't call this on the current
 * state.
 */
void Engine_removeState(int id)
{
  int i;
  State * s;
  /*
  for (i = 0; i < LinkedList_size(eData.states); i++)
  {
	s = (State *)LinkedList_get(eData.states, i);
	if (s == eData.currentState)
	{
	  printf("Cannot remove a state that is current\n");
	  break;
	}
	else
	{
	  if (s->id == id)
	  {
		LinkedList_remove(eData.states, i);
		free(s);
		break;
	  }
	}
  }
  */
}

void Engine_requestClose()
{
  eData.closeRequested = true;
}

void Engine_run()
{
#ifdef _WIN32
  MSG msg;
#endif //_WIN32

  long currentTime;
  if (!eData.loaded)
	return;
  
  
#ifdef _WIN32
  //printf("Hello Windows user...");
#elif __linux__
  //printf("Hello Linux user...");
#elif __CYGWIN__
  //printf("Hello cygwin user...");
#elif __APPLE__
  //printf("Hello apple fanboy...");
#else
  //printf("Helo unsupported platform...");
#endif
  //printf(" starting test program\n");
  //printf("Running engine titled '%s'...\n", eData.title);

  printf("Engine running...\n");
  while (!eData.closeRequested)
  {
	//if window is in focus
	
	//get time
	
	//(win32) if we have messages, dispatch them to winProc until
	//all messages in message queue are dispatched, then we can
	//process a frame
	//while (GetMessage(&msg, NULL, 0, 0))
#ifdef _WIN32
	while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
	{		 
	  TranslateMessage(&msg);
	  DispatchMessage(&msg);		
	}
#endif //_WIN32

	//update modules
	Input_update();
	
	glClearColor(0.5, 0.5, 0.5, 0.0);
	glClear(GL_COLOR_BUFFER_BIT);
	
	
	//if close requested or f12 pressed, exit
	if (false)
	  Engine_requestClose();
	
	//update current state
	//...test input
	/*
	printf("enter: ");
	if (Input_isKeyDown(KEY_RETURN))
	  printf("down\n");
	else
	  printf("up\n");
	*/
	static resource_t * res = NULL;
	if (Input_isKeyPressed(KEY_1, false)) //load script
	{
	  //printf("shift pressed (center mouse)\n");
	  res = ResourceManager_load("testtextfile.script", "../source/test/");
	}
	if (Input_isKeyPressed(KEY_2, false)) //unload script
	{
	  //printf("shift pressed (center mouse)\n");
	  ResourceManager_unload(res);
	}
	 

	//render current state
	
	//perform engine rendering (post processing etc), swap buffers 2
#ifdef _WIN32
	SwapBuffers(eData.dc);
#endif //WIN32
	//sleep to stayon target fps
	
  }
  //cleanup
  if (eData.currentState != NULL)
	eData.currentState->close();
  Engine_destroy();
}

void Engine_setTargetFPS(int newFPS)
{
  if (newFPS < 1)
	newFPS = 1;
  eData.target_fps = newFPS;
}

#ifdef _WIN32
static bool win32_initOpenGLContext(HINSTANCE hInstance)
{
  MSG msg;
 
  WNDCLASS wc;
  HDC dc; //handle to device context
  int pixelFormatIndex = 0;
  HGLRC tempOglContext; //handle to temp opengl rendering context
  
  BOOL bResult;
  
  GLenum err;
  
  PIXELFORMATDESCRIPTOR pfd =
	{
	  sizeof(PIXELFORMATDESCRIPTOR),
	  1,
	  PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, //flags
	  PFD_TYPE_RGBA, //type of framebuffer (rgba)
	  eData.dOptions.bpp, //colordepth of framebuffer (was 32)
	  0, 0, 0, 0, 0, 0, //?
	  0,
	  0,
	  0,
	  0, 0, 0, 0,
	  24, //number of bits for depth buffer
	  8, //number of bits for stencil buffer
	  0, //number of aux buffers in the framebuffer
	  PFD_MAIN_PLANE,
	  0,
	  0, 0, 0
	};
  
  wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; //unique device context per window
  wc.cbClsExtra = 0;
  wc.cbWndExtra = 0;
  wc.lpszClassName = TEXT(eData.title);
  wc.hInstance = hInstance;
  wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
  wc.lpszMenuName = NULL;
  wc.lpfnWndProc = &WndProc; //with & is correct way
  wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  
  RegisterClass(&wc);
  //DWORD dwStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
  DWORD dwStyle = WS_CAPTION | WS_SYSMENU; //title bar + close(X) button
  eData.wnd = CreateWindow(wc.lpszClassName,
						   TEXT(eData.title),
						   dwStyle,
						   100,
						   100,	
						   eData.dOptions.width, //250
						   eData.dOptions.height, //150
						   NULL,
						   NULL,
						   hInstance,
						   NULL);
  
  ShowWindow(eData.wnd, SW_SHOW);
  UpdateWindow(eData.wnd);  
  
  eData.dc = GetDC(eData.wnd);
  
  pixelFormatIndex = ChoosePixelFormat(eData.dc, &pfd);
  if (pixelFormatIndex == 0)
	return false;
  bResult = SetPixelFormat(eData.dc, pixelFormatIndex, &pfd);
  if (!bResult)
	return false;

  //test: describe the pixel format that was set to see what it really is
PIXELFORMATDESCRIPTOR tpfd;
memset(&tpfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
 DescribePixelFormat(eData.dc, pixelFormatIndex, sizeof(PIXELFORMATDESCRIPTOR), &tpfd);

  //create temp old style context (2.1)  
  tempOglContext = wglCreateContext(eData.dc);
  wglMakeCurrent(eData.dc, tempOglContext);
  
  //init GLEW
  err = glewInit();
  if (GLEW_OK != err)
  {
	fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
  }
  fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));

  //test system requirements====================
  printf("checking system requirements...\n");

  printf("vertex buffer: ");
  if (GLEW_ARB_vertex_buffer_object)
	printf("ok\n");
  else
	printf("unavailable\n");

  //end system requirements test====================

  //attempt to get a 3.1 opengl context. if not possible,
  //use the the standard 2.1 context that was already created..
  //delete temp gl context and create actual gl context
  //delete opengl context
  int attribs[] = 
	{
	  WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
	  WGL_CONTEXT_MINOR_VERSION_ARB, 1,
	  WGL_CONTEXT_FLAGS_ARB, 0,
	  0 //terminator
	};
  
  if (wglewIsSupported("WGL_ARB_create_context") == 1)
  {
	printf("Using 3.x context\n");
	eData.oglContext = wglCreateContextAttribsARB(eData.dc, 0, attribs);
	if (eData.oglContext == NULL)
	  printf("failed to create new cont\n");
	else
	  printf("created new cont\n");
    wglMakeCurrent(eData.dc, NULL);
	wglDeleteContext(tempOglContext);
	wglMakeCurrent(eData.dc, eData.oglContext);
  }
  else
  {
	printf("Using old 2.1 context\n");
	eData.oglContext = tempOglContext;
  }

  //const char * glver = glGetString(GL_VERSION);
  printf("GL_VENDOR: %s\n", glGetString(GL_VENDOR));
  printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
  printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
  printf("GL_SHADING_LANGUAGE_VERSION: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));

  //return (int)msg.wParam;
  return true;
}

LRESULT CALLBACK WndProc(HWND hwnd,
						 UINT msg,
						 WPARAM wParam,
						 LPARAM lParam)
{
  switch (msg)
  {
  case WM_CREATE:
	win32_CenterWindow(hwnd);
	return 0;
  case WM_DESTROY:
	eData.closeRequested = true;
	PostQuitMessage(0);
	return 0;	
  case WM_KEYDOWN:
	{
	  button_t key = Input_wParamToKey(wParam);
	  if (lParam & KEY_AUTOREPEAT)
		Input_pushKeyState(key, KEYSTATUS_REPEAT_PRESS);
	  else
		Input_pushKeyState(key, KEYSTATUS_FIRST_PRESS);	
	}
	break;
  case WM_KEYUP:
	{
	  button_t key = Input_wParamToKey(wParam);
	  Input_pushKeyState(key, KEYSTATUS_UP);
	}
	break;
  case WM_MOUSEMOVE:
	{
	  int x = LOWORD(lParam);
	  int y = HIWORD(lParam);
	  Input_pushMousePos(x, y);
	  //printf("(%d, %d)\n", x, y);

	  if (wParam & MK_RBUTTON)
	  {
		char text[50];
		sprintf(text, "%d %d", x, y);
		MessageBox(hwnd, text, "Mouse", MB_OK);
	  }  
	  break;
	}
  }
  return DefWindowProc(hwnd, msg, wParam, lParam);
}

void win32_CenterWindow(HWND hwnd)
{
  RECT rc;
  
  GetWindowRect(hwnd, &rc);
  
  SetWindowPos(hwnd, 0,
			   (GetSystemMetrics(SM_CXSCREEN) - rc.right)/2,
			   (GetSystemMetrics(SM_CYSCREEN) - rc.bottom)/2,
			   0, 0, SWP_NOZORDER | SWP_NOSIZE);
}
#endif //_WIN32

#ifdef __linux__
static bool linux_initOpenGLContext()
{
  Display * display;
  Window * root;
  GLint att =
	{
	  GLX_RGBA,
	  GLX_DEPTH_SIZE,
	  24,
	  GLX_DOUBLEBUFFER,
	  None
	};
  XVisualInfo * vi;
  Colormap cmap;
  XSetWindowAttributes setWinAttributes;
  Window win;
  GLXContext glxc;
  XWindowAttributes gWinAttributes;
  XEvent xev;

  display = XOpenDisplay(NULL);
  if (display == NULL)
  {
	printf("error: could not connect to X server\n");
	return false;
  }

  root = DefaultRootWindow(display);

  vi = glXChooseVisual(display, 0, att);
  if (vi == NULL)
  {
	printf("error: no appropriate visual found\n");
	return false;
  }
  else
	printf("selected visual %p\n", (void *)vi->visualid);

  printf("initing opengl context on linux... (not)\n");

  return true;
}

#endif //__linux__

Added source/core/Engine.h.





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#ifndef __ENGINE_H__
#define __ENGINE_H__

#include <stdbool.h>

#ifdef _WIN32
#include <windows.h>
#endif

#include "State.h"

typedef struct
{
  char title[32];
  float scale;
  int target_fps;
  void (*EngineSetupFunc)(void);
  void (*NetworkSetupFunc)(void);
  
  //win32
#ifdef _WIN32
  //TODO: spawn win32 window from console window so that it is no
  //longer necessary to pass in HINSTANCE, and possibly no need
  //to define WinMain instead of main
  HINSTANCE instance;
#endif

} EngineSetup;

/**
 * Add a state to the engine. The load and close functions are
 * called at the beginning and end of the state's lifetime.
 */
void Engine_addState(bool (*load)(void), bool (*close)(void), int id, bool changeNow);
//void Engine_addState(State * s, bool changeNow);
void Engine_changeState(int newStateID);
void Engine_create(EngineSetup * es);
long Engine_getTime();
const char * Engine_getTitle();
int Engine_getTargetFPS();
bool Engine_isLoaded();
void Engine_removeState(int id);
void Engine_requestClose();
void Engine_run();
void Engine_setTargetFPS(int newFPS);
#endif

Added source/core/EntityManager.c.

















































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
#include "EntityManager.h"
#include "LinkedList.h"
#include "Component.h"
#include <stdbool.h>
#include <string.h> //memset
#include <stdio.h>
#include "uthash.h"
#include <limits.h>


//map an entity ID to one of its components
/*
typedef struct entComp_s
{
  int * entityID; //just put the ent id in component since they
  //shoudl always have an owning entity anyway
  void * component;
} entComp_t;
*/

typedef struct emData_s
{
  linkedList_t * entities; //list of ints (entities)
  linkedList_t * components; //list of all components (various types)
  int idCounter; //keep track of the id to assign to next entity
  void (*userdefinedtranslateIDtoComponentFunc)(void); //?
} emData_t;

static emData_t emData;
static bool instanced = false;


//check to see if a given entity exists
bool EntityManager_containsEntity(int entity)
{
  if (!instanced)
	return false;

  link_t * link = emData.entities->head;
  while (link != NULL)
  {
	int * e = (int *)&(link->payload);
	if (*e == entity)
	  return true;
	link = link->next;
  }
  return false;
}

void EntityManager_create()
{
  if (instanced)
	return;

  memset(&emData, 0, sizeof(emData_t));
  emData.entities = LinkedList_create();
  emData.components = LinkedList_create();
  emData.idCounter = INT_MIN; //reset
  instanced = true;
}

//create component of type and attach to entity
void * EntityManager_createComponent(int entity, unsigned int componentType)
{
  if (!instanced)
	return NULL;
  if (!EntityManager_containsEntity(entity))
	return NULL;
  //if (entity == NULL)
  //return NULL;
  /*
  comp = Component_create(componentType);
  if (comp == NULL)
	return NULL;
  else
  {
	comp->entity = entity;
	LinkedList_add(emData.components, comp);
	return comp;
  }
  */

  link_t * link = NULL;
  //todo: init data for components in a better way then memset
  if (componentType == ID_FORCE)
  {
	link = LinkedList_createLink(sizeof(forceComp_t), PAYLOAD_FORCE);
	forceComp_t * c = (forceComp_t *)&(link->payload);
	memset(c, 0, sizeof(forceComp_t));
	c->entity = entity;
	LinkedList_add(emData.components, link);
	return c;
  }
  else if (componentType == ID_MASS)
  {
	link = LinkedList_createLink(sizeof(massComp_t), PAYLOAD_MASS);
	massComp_t * c = (massComp_t *)&(link->payload);
	memset(c, 0, sizeof(massComp_t));
	c->entity = entity;
	LinkedList_add(emData.components, link);
	return c;
  }
  else if (componentType == ID_MESH)
  {
	link = LinkedList_createLink(sizeof(meshComp_t), PAYLOAD_MESH);
	meshComp_t * c = (meshComp_t *)&(link->payload);
	memset(c, 0, sizeof(meshComp_t));
	c->entity = entity;
	LinkedList_add(emData.components, link);
	return c;
  }
  else if (componentType == ID_ORIENTATION)
  {
	link = LinkedList_createLink(sizeof(orientationComp_t), PAYLOAD_ORIENTATION);
	orientationComp_t * c = (orientationComp_t *)&(link->payload);
	memset(c, 0, sizeof(orientationComp_t));
	c->entity = entity;
	LinkedList_add(emData.components, link);
	return c;
  }
  else if (componentType == ID_POSITION)
  {
	link = LinkedList_createLink(sizeof(positionComp_t), PAYLOAD_POSITION);
	positionComp_t * c = (positionComp_t *)&(link->payload);
	memset(c, 0, sizeof(positionComp_t));
	c->entity = entity;
	LinkedList_add(emData.components, link);
	return c;
  }
  else if (componentType == ID_VELOCITY)
  {
	link = LinkedList_createLink(sizeof(velocityComp_t), PAYLOAD_VELOCITY);
	velocityComp_t * c = (velocityComp_t *)&(link->payload);
	memset(c, 0, sizeof(velocityComp_t));
	c->entity = entity;
	LinkedList_add(emData.components, link);
	return c;
  }
  else if (componentType == ID_VOLUME)
  {
	link = LinkedList_createLink(sizeof(volumeComp_t), PAYLOAD_VOLUME);
	volumeComp_t * c = (volumeComp_t *)&(link->payload);
	memset(c, 0, sizeof(volumeComp_t));
	c->entity = entity;
	LinkedList_add(emData.components, link);
	return c;
  }
  else
	return NULL;
}

//with this solution, currently only (max int) entities can be created during the
//lifetime of the entity manager
int EntityManager_createEntity()
{
  if (!instanced)
	return 0;
  //use dynamic int so that they dont go out of scope in the list

  link_t * link = LinkedList_createLink(sizeof(int), PAYLOAD_INT);
  int * entity = (int *)&(link->payload);
  *entity = emData.idCounter;
  //note: in current implementation, we have to skip 0 as thats reserved
  emData.idCounter++;
  LinkedList_add(emData.entities, link);
  return *entity;
}

void EntityManager_destroy()
{
  if (!instanced)
	return;

  int i;
  int * entity = NULL;
  void * data;
  //entComp_t * ec = NULL;
  //component_t * comp = NULL;


  //TODO..
  /*
  //free dynamically allocated containers in emData_t
  //free list elements before destroying list
  for (i = 0; i < LinkedList_size(emData.components); i++)
  {
  comp = (component_t *)LinkedList_get(emData.components, i);
  //free (ec->component);
  Component_destroy(comp);
  //entities will be freed from entities list (next)
  }
  LinkedList_destroy(emData.components);

  for (i = 0; i < LinkedList_size(emData.entities); i++)
  {
  //c keeps track of allocated memory and its size, free(void*) ok
  data = LinkedList_get(emData.entities, i);
  free(data);
  }
  LinkedList_destroy(emData.entities);
  */


  memset(&emData, 0, sizeof(emData_t));

  instanced = false;
}

//free an entity from memory, as well as all components that
//belonged to it
void EntityManager_removeEntity(int entity)
{
  if (!instanced)
	return;

  link_t * link = emData.entities->head;
  while (link != NULL)
  {
	int * e = (int *)&(link->payload);
	if (*e == entity) //bingo
	{
	  LinkedList_removeLink(emData.entities, link);
	  break;
	}
	link = link->next;
  }

  //remove components
  link = emData.components->head;
  while (link != NULL)
  {
	//each component struct has int entity as its first member
	if ( *(int *)&(link->payload) == entity ) //matching entity
	  LinkedList_removeLink(emData.components, link);
	link = link->next;
  }
}


/*
  void EntityManager_setEntityTag(int entity, const char * tag)
  {
  if (!instanced)
  return;
  }
*/

/*
  int EntityManager_getEntityByTag(const char * tag)
  {
  if (!instanced)
  return ;


  }
*/

//loops through entire list of components, and returns the first that
//matches both the component type and entity id. this should be a unique
//combination in the entity list, though it is not enforced
//only accessible by EntityManager. use the more specific(below) functions
//for component retrieval
void * EntityManager_getComponentFromEntity(int entity, unsigned int componentType)
{
  int i;
  if (!instanced)
	return NULL;

  link_t * link = emData.components->head;
  while (link != NULL)
  {
	//each component struct has int entity as its first member
	if ( *(int *)&(link->payload) == entity ) //matching entity
	  if (link->payloadType == componentType)
		  return (void *)&(link->payload);
	  link = link->next;
  }
  return NULL;
}

//gets component from entity and casts it as the given type before returning
forceComp_t * EntityManager_getForceFromEntity(int entity)
{
  return (forceComp_t *)EntityManager_getComponentFromEntity(entity, ID_FORCE);
}

massComp_t * EntityManager_getMassFromEntity(int entity)
{
  return (massComp_t *)EntityManager_getComponentFromEntity(entity, ID_MASS);
}

meshComp_t * EntityManager_getMeshFromEntity(int entity)
{
  return (meshComp_t *)EntityManager_getComponentFromEntity(entity, ID_MESH);
}

orientationComp_t * EntityManager_getOrientationFromEntity(int entity)
{
  return (orientationComp_t *)EntityManager_getComponentFromEntity(entity, ID_ORIENTATION);
}

positionComp_t * EntityManager_getPositionFromEntity(int entity)
{
  return (positionComp_t *)EntityManager_getComponentFromEntity(entity, ID_POSITION);
}

velocityComp_t * EntityManager_getVelocityFromEntity(int entity)
{
  return (velocityComp_t *)EntityManager_getComponentFromEntity(entity, ID_VELOCITY); 
}

volumeComp_t * EntityManager_getVolumeFromEntity(int entity)
{
  return (volumeComp_t *)EntityManager_getComponentFromEntity(entity, ID_VOLUME);
}


/*
void ** EntityManager_getAllComponentsOfType(unsigned int componentType)
{
  if (!instanced)
	return NULL;
}
*/

/*
void ** EntityManager_getAllEntitiesWithComponentType(unsigned int componentType)
{
  if (!instanced)
	return NULL;
}
*/

/*
void ** EntityManager_getAllEntitiesThatFitLock(int lock, bool strict)
{
  if (!instanced)
	return NULL;
}
*/


//**********"private" functions, only usable by this module**********

Added source/core/EntityManager.h.

































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#ifndef __ENTITYMANAGER_H__
#define __ENTITYMANAGER_H__
#include <stdbool.h>
#include "Component.h"

bool EntityManager_containsEntity(int entity);

/**
 * Create the Entity Manager.
 */
void EntityManager_create();

/**
 * Create a new new entity, and return an integer representing the unique ID of
 * the entity.
 */
int EntityManager_createEntity();

/**
 * Create a new component of the given type, and attach it to the entity. The
 * entity must already be created through EntityManager_createEntity(). The
 * component created is returned, or NULL if there was a problem.
 */
void * EntityManager_createComponent(int entity, unsigned int componentType);

/**
 * Destroy the entity manager, destroying all entities, and components as well.
 */
void EntityManager_destroy();

/**
 * Remove an entity from the manager. Also destroys any components that were
 * attached to this entity.
 */
void EntityManager_removeEntity(int entity);


//void EntityManager_setEntityTag(int entity, const char * tag);

//int EntityManager_getEntityByTag(const char * tag);

/**
 * Returns the instance of a given component type contained in an entity, or
 * NULL if the component type is invalid, the given entity ID does not exist,
 * or the given entity does not own a component of the given type.
 */
//todo: make static function when all is said and done (and move from header to src)
void * EntityManager_getComponentFromEntity(int entity, unsigned int componentType);

forceComp_t * EntityManager_getForceFromEntity(int entity);
massComp_t * EntityManager_getMassFromEntity(int entity);
meshComp_t * EntityManager_getMeshFromEntity(int entity);
orientationComp_t * EntityManager_getOrientationFromEntity(int entity);
positionComp_t * EntityManager_getPositionFromEntity(int entity);
velocityComp_t * EntityManager_getVelocityFromEntity(int entity);
volumeComp_t * EntityManager_getVolumeFromEntity(int entity);

//void ** EntityManager_getAllComponentsOfType(unsigned int componentType);

//void ** EntityManager_getAllEntitiesWithComponentType(unsigned int componentType);

//void ** EntityManager_getAllEntitiesThatFitLock(int lock, bool strict);

#endif

Added source/core/Input.c.







































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
#include "Input.h"
#include "LinkedList.h"
#include <stdio.h>

typedef struct inEvent_e
{
  button_t key;
  keyStatus_t status;
} inEvent_t;

typedef struct inData_s
{
  //new key presses since last frame
  linkedList_t * events; 

  //current state of a key, down(false) or up(true)
  keyStatus_t keyState[KEY_SIZE];

  //mouse
  int currX;
  int currY;
  int lastX;
  int lastY;
  int deltaX;
  int deltaY;
  mouseMode_t mouseMode;
} inData_t;

static inData_t inData;
static bool instanced = false;

void Input_create()
{
  int i;
  if (instanced)
	return;

  memset(&inData, 0, sizeof(inData_t));

  inData.events = LinkedList_create();
  for (i = 0; i < KEY_SIZE; i++)  
	inData.keyState[i] = KEYSTATUS_UP;
  inData.mouseMode = RTS_MODE;
}

void Input_destroy()
{
  LinkedList_destroy(inData.events);
}

int Input_getMouseDeltaX()
{
  return 0;
}

int Input_getMouseDeltaY()
{
  return 0;
}

int Input_getMouseX()
{
  return inData.currX;
}

int Input_getMouseY()
{
  return inData.currY;
}

bool Input_isKeyDown(button_t key)
{
  return (inData.keyState[key] != KEYSTATUS_UP);
}

bool Input_isKeyPressed(button_t key, bool repeats)
{
  if (repeats)
	return (inData.keyState[key] == KEYSTATUS_REPEAT_PRESS || inData.keyState[key] == KEYSTATUS_FIRST_PRESS);
  else //no repeats
	return (inData.keyState[key] == KEYSTATUS_FIRST_PRESS);
}

const char * Input_keyToString(button_t key)
{
  switch (key)
  {
	//numbers
  case KEY_0:
	return "0";
  case KEY_1:
	return "1";
  case KEY_2:
	return "2";
  case KEY_3:
	return "3";
  case KEY_4:
	return "4";
  case KEY_5:
	return "5";
  case KEY_6:
	return "6";
  case KEY_7:
	return "7";
  case KEY_8:
	return "8";
  case KEY_9:
	return "9";

	//letters (no case, check for shift key being pressed)
  case KEY_A:
	return "A";
  case KEY_B:
	return "B";
  case KEY_C:
	return "C";
  case KEY_D:
	return "D";
  case KEY_E:
	return "E";
  case KEY_F:
	return "F";
  case KEY_G:
	return "G";
  case KEY_H:
	return "H";
  case KEY_I:
	return "I";
  case KEY_J:
	return "J";
  case KEY_K:
	return "K";
  case KEY_L:
	return "L";
  case KEY_M:
	return "M";
  case KEY_N:
	return "N";
  case KEY_O:
	return "O";
  case KEY_P:
	return "P";
  case KEY_Q:
	return "Q";
  case KEY_R:
	return "R";
  case KEY_S:
	return "S";
  case KEY_T:
	return "T";
  case KEY_U:
	return "U";
  case KEY_V:
	return "V";
  case KEY_W:
	return "W";
  case KEY_X:
	return "X";
  case KEY_Y:
	return "Y";
  case KEY_Z:
	return "Z";

	//special
  case KEY_LMB:
	return "VK_LBUTTON";
  case KEY_MMB:
	return "VK_MBUTTON";
  case KEY_RMB:
	return "VK_RBUTTON";
  case KEY_MINUS:
	return "VK_OEM_MINUS";
  case KEY_EQUAL:
	return "VK_OEM_PLUS";
  case KEY_BACKSPACE:
	return "VK_BACK";
  case KEY_DELETE:
	return "VK_DELETE";
  case KEY_RETURN:
	return "VK_RETURN";
  case KEY_SHIFT:
	return "VK_SHIFT";
  case KEY_CTRL:
	return "VK_CONTROL";
  case KEY_ALT:
	return "VK_MENU";
  case KEY_SPACE:
	return "VK_SPACE";
  case KEY_CAPS:
	return "VK_CAPITAL";
  case KEY_TAB:
	return "VK_TAB";
  case KEY_TILDE:
	return "VK_OEM_3";
  case KEY_ESC:
	return "VK_ESCAP";

  default:
	return "'\0'";
  }
}

void Input_pushKeyState(button_t k, keyStatus_t s)
{
  link_t * link = LinkedList_createLink(sizeof(inEvent_t), PAYLOAD_INPUT);
  inEvent_t * event = (inEvent_t *)&(link->payload);
  event->key = k;
  event->status = s;
  LinkedList_add(inData.events, link);
}

void Input_pushMousePos(int x, int y)
{
  inData.currX = x;
  inData.currY = y;
}

void Input_centerCursor()
{
  //windows
  MOUSEINPUT m;
  INPUT in;

  m.dx = 65535/2; //dx/dy are normalized [0..65535]
  m.dy = 65535/2;
  m.mouseData = 0;
  m.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
  m.time = 0;
  m.dwExtraInfo = 0;

  in.type = INPUT_MOUSE;
  in.mi = m;

  if (!SendInput(1, &in, sizeof(INPUT)))
	printf("centerCursor failed\n");
}

void Input_setCursorPos(int x, int y)
{
  //windows
  MOUSEINPUT m;
  INPUT in;

  m.dx = x;
  m.dy = y;
  m.mouseData = 0;
  m.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
  m.time = 0;
  m.dwExtraInfo = 0;

  in.type = INPUT_MOUSE;
  in.mi = m;

  if (!SendInput(1, &in, sizeof(INPUT)))
	printf("setCursorPos failed\n");
}

void Input_update()
{
  int i;
  for (i = 0; i < KEY_SIZE; i++)
  {
	//any key that was not "up" last frame will default
	//to being down with no activity, until the events
	//to be processed for this frame say otherwise
	if (inData.keyState[i] != KEYSTATUS_UP)
	  inData.keyState[i] = KEYSTATUS_DOWN_NO_ACTIVITY;
  }

  //note: perhaps its not necessary to do this since
  //winProc processes everything right before this
  //is called.. so winProc could probably just
  //directly manipulate the keyStates and there would
  //be no need for the events linked list.
  //process new events since last frame
  link_t * head  = inData.events->head;
  while (head != NULL) //process the head of list until its empty
  {
	inEvent_t * event = (inEvent_t *)&(head->payload);
	inData.keyState[event->key] = event->status;  
	LinkedList_removeLink(inData.events, head);
	head = inData.events->head;
  }

  //calc mouse delta since last update
  //note: set cursor to center of screen each frame..
  //and have seperate modes, one for moving mouse
  //around for menus, and one for fps mode (glue
  //mouse to center)
  //inData.lastX = 
  inData.deltaX = inData.currX - inData.lastX;
  inData.deltaY = inData.currY - inData.lastY;
}

#ifdef _WIN32
/**
 * Return a character represented by the WPARAM.
 */
button_t Input_wParamToKey(WPARAM wParam)
{
  switch (wParam)
  {
	//numbers
  case '0':
	return KEY_0;
  case '1':
	return KEY_1;
  case '2':
	return KEY_2;
  case '3':
	return KEY_3;
  case '4':
	return KEY_4;
  case '5':
	return KEY_5;
  case '6':
	return KEY_6;
  case '7':
	return KEY_7;
  case '8':
	return KEY_8;
  case '9':
	return KEY_9;

  //letters (no case, check for shift key being pressed)
  case 'A':
	return KEY_A;
  case 'B':
	return KEY_B;
  case 'C':
	return KEY_C;
  case 'D':
	return KEY_D;
  case 'E':
	return KEY_E;
  case 'F':
	return KEY_F;
  case 'G':
	return KEY_G;
  case 'H':
	return KEY_H;
  case 'I':
	return KEY_I;
  case 'J':
	return KEY_J;
  case 'K':
	return KEY_K;
  case 'L':
	return KEY_L;
  case 'M':
	return KEY_M;
  case 'N':
	return KEY_N;
  case 'O':
	return KEY_O;
  case 'P':
	return KEY_P;
  case 'Q':
	return KEY_Q;
  case 'R':
	return KEY_R;
  case 'S':
	return KEY_S;
  case 'T':
	return KEY_T;
  case 'U':
	return KEY_U;
  case 'V':
	return KEY_V;
  case 'W':
	return KEY_W;
  case 'X':
	return KEY_X;
  case 'Y':
	return KEY_Y;
  case 'Z':
	return KEY_Z;

	//special
  case VK_LBUTTON:
	return KEY_LMB;
  case VK_MBUTTON:
	return KEY_MMB;
  case VK_RBUTTON:
	return KEY_RMB;
	//case VK_OEM_MINUS:
	//return KEY_MINUS;
	//case VK_OEM_PLUS: //the '+' key
	//return KEY_EQUAL;
  case VK_BACK:
	return KEY_BACKSPACE;
  case VK_DELETE:
	return KEY_DELETE;
  case VK_RETURN:
	return KEY_RETURN;
  case VK_SHIFT: //either shift
	return KEY_SHIFT;
  case VK_CONTROL: //either ctrl
	return KEY_CTRL;
  case VK_MENU: //either alt
	return KEY_ALT; 
  case VK_SPACE:
	return KEY_SPACE;
  case VK_CAPITAL:
	return KEY_CAPS;
  case VK_TAB:
	return KEY_TAB;
  case VK_OEM_3: //`~ key for us standard keyboard
	return KEY_TILDE;
  case VK_ESCAPE:
	return KEY_ESC;


  default:
	return KEY_INVALID;
  }

}
#endif //_WIN32

Added source/core/Input.h.

































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
#ifndef __INPUT_H__
#define __INPUT_H__

//for INPUT and MOUSEINPUT
//http://cboard.cprogramming.com/c-programming/109489-%60input-undeclared-first-use-function-%7C.html
//for some reason this isnt being defined on my home pc...
//but it defines on the laptop
#ifndef _WIN32_WINNT
#pragma message("_WIN32_WINNT was not defined, defining...")
#define _WIN32_WINNT 0x0500
#else
#pragma message("_WIN32_WINNT already defined")
#endif

#ifdef _WIN32
#include <windows.h>
#endif

#include <stdbool.h>

#define PAYLOAD_INPUT 9000

typedef enum mouseMode_e
{
  RTS_MODE, //mouse moves freely, is visible
  FPS_MODE //invisible mouse, recenter every frame
} mouseMode_t;

//All keys, including mouse, gamepad etc
typedef enum key_e
{
  KEY_0 = 0,
  KEY_1,
  KEY_2,
  KEY_3,
  KEY_4,
  KEY_5,
  KEY_6,
  KEY_7,
  KEY_8,
  KEY_9,

  //letters
  KEY_A,
  KEY_B,
  KEY_C,
  KEY_D,
  KEY_E,
  KEY_F,
  KEY_G,
  KEY_H,
  KEY_I,
  KEY_J,
  KEY_K,
  KEY_L,
  KEY_M,
  KEY_N,
  KEY_O,
  KEY_P,
  KEY_Q,
  KEY_R,
  KEY_S,
  KEY_T,
  KEY_U,
  KEY_V,
  KEY_W,
  KEY_X,
  KEY_Y,
  KEY_Z,

  //special
  KEY_LMB,
  KEY_MMB,
  KEY_RMB,
  KEY_MINUS,
  KEY_EQUAL,
  KEY_BACKSPACE,
  KEY_DELETE,
  KEY_RETURN,
  KEY_SHIFT,
  KEY_CTRL,
  KEY_ALT,
  KEY_SPACE,
  KEY_CAPS,
  KEY_TAB,
  KEY_TILDE,
  KEY_ESC,

  KEY_INVALID, //unsupported key, like windows key
  KEY_SIZE
} button_t;

typedef enum keyStatus_e
{
  //key not down at all
  KEYSTATUS_UP = (1 << 0),

  //key newly pressed since last update
  KEYSTATUS_FIRST_PRESS = (1 << 1),

  //key has been held down and an autorepeat is triggering
  KEYSTATUS_REPEAT_PRESS = (1 << 2),

  //key is held down, but was not newly pressed since last update. it also is not triggering an autorepeat during this update. a key is considered "down" during any case but up.
  KEYSTATUS_DOWN_NO_ACTIVITY = (1 << 3)
} keyStatus_t;

void Input_create();
void Input_destroy();
int Input_getMouseDeltaX();
int Input_getMouseDeltaY();
int Input_getMouseX();
int Input_getMouseY();

bool Input_isKeyDown(button_t key);

/**
 * Check if the key is held down during this frame. It
 * doesn't matter if the key was just pressed down this
 * frame, or if it has been held down for a long time.
 */
bool Input_isKeyDown(button_t key);

/**
 * Check if key was newly pressed down this frame.
 * If repeats is true, then key presses registered as
 * autorepeats (the key was held down and is retriggering)
 * then an autorepeat for this frame will be considered.
 * If repeats is false, then the function will only
 * return true if the key was freshly pressed this frame.
 */
bool Input_isKeyPressed(button_t key, bool repeats);

const char * Input_keyToString(button_t key);

//push keys that were pressed since the last frame
//void Input_pushEvent(button_t key, 
//used internally by engine only
//try writing this prototype in engine.c so that only
//engine can access it
void Input_pushKeyState(button_t k, keyStatus_t s);

void Input_pushMousePos(int x, int y);

void Input_centerCursor();

/**
 * Set the position of the cursor. This is different
 * from Input_pushMousePos, which sets the internal
 * record of the cursor position. This function
 * simulates a mouse event on all platforms.
 */
void Input_setCursorPos(int x, int y);

#ifdef _WIN32
//convert a windows virtual key code to platform independent key
button_t Input_wParamToKey(WPARAM wParam);
#endif

#endif

Added source/core/LinkedList.c.









































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
#include "LinkedList.h"
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>

void LinkedList_add(linkedList_t * ll, link_t * link)
{
  if (ll == NULL || link == NULL)
	return;

  if (ll->head == NULL)
	ll->head = link;
  else
  {
	link_t * curr = ll->head;
	while (curr->next != NULL)
	  curr = curr->next;
	curr->next = link;
	link->prev = curr;
  }
  ll->size += 1;
}

linkedList_t * LinkedList_create()
{
  linkedList_t * ll = (linkedList_t *)malloc(sizeof(linkedList_t));
  ll->head = NULL;
  ll->size = 0;
  return ll;
}

link_t * LinkedList_createLink(int payloadSize, int payloadType)
{
  link_t * link = malloc(sizeof(link_t)-1 + payloadSize);
  if (link != NULL)
  {
	link->prev = link->next = NULL;
	link->payloadType = payloadType;
  }
  return link;
}

//todo: free links? if link payloads contained pointers to allocated
//memory, a memory leak can occur.. maybe we should just restrict
//the list so that you cant allocate memory from the payload. (the
//payload should represent the memory allocated, not allocated pointers
//to more allocated memory).
void LinkedList_destroy(linkedList_t * ll)
{
  if (ll == NULL)
	return;
  if (ll->head == NULL) //empty
  {
	//do nothing
  }
  else
  {
	link_t * curr, * next;
	//curr = ll->head;
	next = ll->head;
	//free(curr);
	while (next != NULL)
	{
	  curr = next;
	  next = next->next;
	  free(curr);
	}
  }
  free(ll);
  //ll = NULL; this has no effect on the variable from the caller
}

//TEMP (to rid of link errors
//**************************************************
link_t * LinkedList_get(linkedList_t * ll, int index)
{
  if (ll == NULL)
	return NULL;
  if (index > ll->size-1 || index < 0)
	return NULL;
  if (LinkedList_isEmpty(ll))
	return NULL;

  link_t * curr = ll->head;
  int i;
  for (i = 0; i < index; i++)
	curr = curr->next;
  return curr;
}
//**************************************************
link_t * LinkedList_getIndex(linkedList_t * ll, int index)
{
  if (ll == NULL)
	return NULL;
  if (index > ll->size-1 || index < 0)
	return NULL;
  if (LinkedList_isEmpty(ll))
	return NULL;

  link_t * curr = ll->head;
  int i;
  for (i = 0; i < index; i++)
	curr = curr->next;
  return curr;
}

bool LinkedList_isEmpty(linkedList_t * ll)
{
  if (ll == NULL)
	return true;

  if (ll->head == NULL)
  {
	//assert size is 0
	return true;
  }
  else
  {
	//assert size > 0
	return false;
  }
}

void LinkedList_print(linkedList_t * ll)
{
  if (ll == NULL)
	return;
  if (LinkedList_isEmpty(ll))
	return;

  int i = 0;
  link_t * curr = ll->head;
  while (curr != NULL)
  {
	printf("[%d](payloadType=%d) -> ", i, curr->payloadType);
	i++;
  }
  printf("NULL");
}

//TEMP!!!!
//**************************************************
void LinkedList_remove(linkedList_t * ll, int index)
{
  if (ll == NULL)
	return;
  if (index > ll->size-1 || index < 0)
	return;
  if (LinkedList_isEmpty(ll))
	return;

  link_t * curr = LinkedList_getIndex(ll, index);
  if (curr == NULL)
	return;

  //... -> (before) -> (curr) -> (after) -> ...
  link_t * before = curr->prev;
  link_t * after = curr->next;
  if (before == NULL && after == NULL) //empty list now
  {
	ll->head = NULL;
  }
  else if (before != NULL && after != NULL) //reconnect before <--> after
  {
	before->next = after;
	after->prev = before;
  }
  else if (before != NULL && after == NULL) //before is new tail
  {
	before->next = NULL;
  }
  else //before == NULL && after != NULL, after is new head
  {
	after->prev = NULL;
	ll->head = after;	
  }
  free(curr);
  ll->size -= 1;
}
//**************************************************

void LinkedList_removeIndex(linkedList_t * ll, int index)
{
  if (ll == NULL)
	return;
  if (index > ll->size-1 || index < 0)
	return;
  if (LinkedList_isEmpty(ll))
	return;

  link_t * curr = LinkedList_getIndex(ll, index);
  if (curr == NULL)
	return;

  //... -> (before) -> (curr) -> (after) -> ...
  link_t * before = curr->prev;
  link_t * after = curr->next;
  if (before == NULL && after == NULL) //empty list now
  {
	ll->head = NULL;
  }
  else if (before != NULL && after != NULL) //reconnect before <--> after
  {
	before->next = after;
	after->prev = before;
  }
  else if (before != NULL && after == NULL) //before is new tail
  {
	before->next = NULL;
  }
  else //before == NULL && after != NULL, after is new head
  {
	after->prev = NULL;
	ll->head = after;	
  }
  free(curr);
  ll->size -= 1;
}

void LinkedList_removeLink(linkedList_t * ll, link_t * link)
{
  if (ll == NULL)
	return;
  if (link == NULL)
	return;
  if (LinkedList_isEmpty(ll))
	return;

  //... -> (before) -> (link) -> (after) -> ...
  link_t * before = link->prev;
  link_t * after = link->next;
  if (before == NULL && after == NULL) //empty list now
  {
	ll->head = NULL;
  }
  else if (before != NULL && after != NULL) //reconnect before <--> after
  {
	before->next = after;
	after->prev = before;
  }
  else if (before != NULL && after == NULL) //before is new tail
  {
	before->next = NULL;
  }
  else //before == NULL && after != NULL, after is new head
  {
	after->prev = NULL;
	ll->head = after;	
  }
  free(link);
  ll->size -= 1;
}

int LinkedList_size(linkedList_t * ll)
{
  if (ll == NULL)
	return -1;
  return ll->size;
}

Added source/core/LinkedList.h.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#ifndef __LINKED_LIST_H__
#define __LINKED_LIST_H__
#include <stdbool.h>

//TODO: use enum, and put all paylod types here, from other modules
//(like input)
#define PAYLOAD_BOOL -1
#define PAYLOAD_CHAR -2
#define PAYLOAD_CSTRING -3
#define PAYLOAD_DOUBLE -4
#define PAYLOAD_FLOAT -5
#define PAYLOAD_INT -6
#define PAYLOAD_LONG -7
#define PAYLOAD_SHORT -8

typedef struct link_s
{
  struct link_s * prev;
  struct link_s * next;
  int payloadType;
  char payload[1]; //actual payload data uses this address as reference
} link_t;

typedef struct linkedList_s
{
  link_t * head;
  int size;
} linkedList_t;

/**
 * Add a preallocated link to a linked list. The linked list should already
 * be allocated through LinkedList_create()
 */
void LinkedList_add(linkedList_t * ll, link_t * link);

/**
 * Create a new, empty linked list.
 */
linkedList_t * LinkedList_create();

/**
 * Allocate memory for a new link (extended by the given size of the
 * payload to append to it) and initialize values.
 */
link_t * LinkedList_createLink(int payloadSize, int payloadType);

/**
 * Destroy the given linked list. TODO... free all links, or expect the
 * user to do that beforehand?
 */
void LinkedList_destroy(linkedList_t * ll);

//temp
link_t * LinkedList_getIndex(linkedList_t * ll, int index);
void LinkedList_removeIndex(linkedList_t * ll, int index);
/**
 * Get the index'th link in the list.
 */
link_t * LinkedList_getIndex(linkedList_t * ll, int index);

/**
 * Get the link in the linked list that is the same instance as the link
 * passed into the function. It doesn't make sense why I would need this.
 */
//link_t * LinkedList_getLink(linkedList_t * ll, link_t * link);

/**
 * Return true if the linked list is empty, false otherwise.
 */
bool LinkedList_isEmpty(linkedList_t * ll);

void LinkedList_print(linkedList_t * ll);

/**
 * Remove the index'th link in the list.
 */
void LinkedList_removeIndex(linkedList_t * ll, int index);

/**
 * Remove the link from its' surroundings, and relink the previous
 * and next links if applicable. Use this when iterating through
 * a linked list, so that once a link to be removed is found, it
 * is immediately processed, whereas using LinkedList_removeIndex()
 * would require iterating through the entire list again.
 */
void LinkedList_removeLink(linkedList_t * ll, link_t * link);

/**
 * Returns the size of the given linked list.
 */
int LinkedList_size(linkedList_t * ll);

#endif

Added source/core/Matrix.c.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "Matrix.h"

matrix_t Matrix_identity()
{
  matrix_t m;
  m.e[0][0] = 1.0f; m.e[0][1] = 0.0f; m.e[0][2] = 0.0f; m.e[0][3] = 0.0f;
  m.e[1][0] = 0.0f; m.e[1][1] = 1.0f; m.e[1][2] = 0.0f; m.e[1][3] = 0.0f;
  m.e[2][0] = 0.0f; m.e[2][1] = 0.0f; m.e[2][2] = 1.0f; m.e[2][3] = 0.0f;
  m.e[3][0] = 0.0f; m.e[3][1] = 0.0f; m.e[3][2] = 0.0f; m.e[3][3] = 1.0f;
  return m;
}

matrix_t Matrix_invert(matrix_t m)
{
  //TODO
  return Matrix_identity();
}

matrix_t Matrix_multiply(matrix_t m, matrix_t n)
{
  //TODO
  return Matrix_identity();
}

Added source/core/Matrix.h.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef __MATRIX_H__
#define __MATRIX_H__
//4x4 matrix. Store data however you want, but declare the major order.
//default behavior is row major
typedef enum majorOrder_e
{	
  ROW_MAJOR,
  COLUMN_MAJOR
} majorOrder_t;

//row major order (math like)
//opengl is column major order
typedef struct matrix_s
{
  float e[4][4];
  majorOrder_t order;  
} matrix_t;

matrix_t Matrix_identity();
matrix_t Matrix_invert(matrix_t m);
matrix_t Matrix_multiply(matrix_t m, matrix_t n);
#endif

Added source/core/Quaternion.c.











































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#include "Quaternion.h"
#include "AxisAngle.h"
#include "Matrix.h"
#include "Vector.h"
#include <math.h>
#include <stdbool.h>


quaternion_t Quaternion_conjugate(quaternion_t p)
{
  p.x = -p.x;
  p.y = -p.y;
  p.z = -p.z;
  return p;
}

bool Quaternion_equal(quaternion_t p, quaternion_t q)
{
  bool x = p.x == q.x;
  bool y = p.y == q.y;
  bool z = p.z == q.z;
  bool w = p.w == q.w;
  return (x && y && z && w);
}

axisAngle_t Quaternion_getAxisAngle(quaternion_t p)
{
  axisAngle_t aa;

  if (Quaternion_equal(p, Quaternion_identity()))
	return AxisAngle_identity();

  aa.angle = 2 * acos(p.w);
  if (aa.angle == 0)
  {
	aa.axis.x = 1; //this is 0 in the java ver, fix
	aa.axis.y = 0; 
	aa.axis.z = 0;
  }
  else
  {
	aa.axis.x = p.x;
	aa.axis.y = p.y;
	aa.axis.z = p.z;
  }
  return aa;
}

matrix_t Quaternion_getMatrix(quaternion_t q)
{
  //http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm
  matrix_t m, n;
  m.e[0][0] =  q.w; m.e[0][1] =  q.z; m.e[0][2] = -q.y; m.e[0][3] =  q.x;
  m.e[1][0] = -q.z; m.e[1][1] =  q.w; m.e[1][2] =  q.x; m.e[1][3] =  q.y;
  m.e[2][0] =  q.y; m.e[2][1] = -q.x; m.e[2][2] =  q.w; m.e[2][3] =  q.z;
  m.e[3][0] = -q.x; m.e[3][1] = -q.y; m.e[3][2] = -q.z; m.e[3][3] =  q.w;		

  n.e[0][0] =  q.w; n.e[0][1] =  q.z; n.e[0][2] = -q.y; n.e[0][3] = -q.x;
  n.e[1][0] = -q.z; n.e[1][1] =  q.w; n.e[1][2] =  q.x; n.e[1][3] = -q.y;
  n.e[2][0] =  q.y; n.e[2][1] = -q.x; n.e[2][2] =  q.w; n.e[2][3] = -q.z;
  n.e[3][0] =  q.x; n.e[3][1] =  q.y; n.e[3][2] =  q.z; n.e[3][3] =  q.w;

  return Matrix_multiply(m, n);
}

quaternion_t Quaternion_identity()
{
  quaternion_t q;
  q.x = 0;
  q.y = 0;
  q.z = 0;
  q.w = 1;
  return q;
}

float Quaternion_magnitude(quaternion_t p)
{
  return sqrt( (p.x*p.x) + (p.y*p.y) + (p.z*p.z) + (p.w*p.w) );
}

quaternion_t Quaternion_multiply(quaternion_t p, quaternion_t q)
{
  quaternion_t r;

  return r;
}

quaternion_t Quaternion_normalize(quaternion_t p)
{
  float norm = Quaternion_magnitude(p);
  //check for 0 magnitude
  p.x /= norm;
  p.y /= norm;
  p.z /= norm;
  p.w /= norm;
  return p;
}

vector_t Quaternion_rotateVector(quaternion_t q, vector_t v)
{
  axisAngle_t aa = Quaternion_getAxisAngle(q);
  bool identityQuat = Quaternion_equal(q, Quaternion_identity());
  bool noAngle = aa.angle == 0;
  bool zeroLengthVector = Vector_magnitude(aa.axis) == 0;

  if (identityQuat || noAngle || zeroLengthVector)
	return v;

  //Rodrigues' rotation formula
  //Vrot = (V)cos(theta) + (w x v)sin(theta) + w(w . v)(1 - cos(theta))
  //v = vector
  //w = unit vector describing axis to rotate about
  //theta = ccw radians to rotate about
  vector_t w = Vector_normalize(aa.axis);
  float theta = aa.angle;
  //
  vector_t part1 = Vector_multiply(v, cos(theta));
  vector_t part2 = Vector_multiply(Vector_cross(w, v), sin(theta));
  vector_t part3 = Vector_multiply(Vector_multiply(w, Vector_dot(w, v)),
								   (1-cos(theta)));
  return Vector_add(Vector_add(part1, part2), part3);
}

quaternion_t Quaternion_setFromAxisAngle(axisAngle_t aa)
{
  quaternion_t q;
  q.w = cos(aa.angle/2.0f);
  q.x = aa.axis.x * sin(aa.angle/2.0f);
  q.y = aa.axis.y * sin(aa.angle/2.0f);
  q.z = aa.axis.z * sin(aa.angle/2.0f);
  return q;
}

Added source/core/Quaternion.h.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#ifndef __QUATERNION_H__
#define __QUATERNION_H__

#include "AxisAngle.h"
#include "Matrix.h"
#include <stdbool.h>

typedef struct quaternion_s
{
  float x;
  float y;
  float z;
  float w;
} quaternion_t;

/**
 * Return the conjugate of the given quaternion (negate its vector part).
 */
quaternion_t Quaternion_conjugate(quaternion_t p);

/**
 * Test if the two quaternions are equal. Note that this test will most
 * likely fail unless the values of each quaternion are simple (ex:
 * whole numbers).
 */
bool Quaternion_equal(quaternion_t p, quaternion_t q);

/**
 * Return an axis angle representation of the given quaternion.
 */
axisAngle_t Quaternion_getAxisAngle(quaternion_t p);

/**
 * Return a rotation matrix representing the rotation of this quaternion.
 */
matrix_t Quaternion_getMatrix(quaternion_t q);

/**
 * Return a multiplication identity quaternion. Note this is different
 * from an addition identity quaternion.
 */
quaternion_t Quaternion_identity();

/**
 * Compute the magnitude of the given quaternion. Also known as norm, or
 * length.
 */
float Quaternion_magnitude(quaternion_t p);

/**
 * Multiply the quaternions in the order pq.
 */
quaternion_t Quaternion_multiply(quaternion_t p, quaternion_t q);

/**
 * Normalize the quaternion, returning a unit quaternion.
 */
quaternion_t Quaternion_normalize(quaternion_t p);

/**
 * Rotate a vector about the given quaternion rotation.
 */
vector_t Quaternion_rotateVector(quaternion_t q, vector_t v);

/**
 * Return the result of encoding an axis-angle into a quaternion.
 */
quaternion_t Quaternion_setFromAxisAngle(axisAngle_t aa);

#endif

Added source/core/Resource.c.









































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#include "Resource.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

//helper functions
 material_t * loadMaterial(const char * name, const char * path);
 mesh_t * loadMesh(const char * name, const char * path);
 script_t * loadScript(const char * name, const char * path);
 sound_t * loadSound(const char * name, const char * path);



resource_t * Resource_create(const char * name, const char * path,
							 void * (*customLoader)(const char * name,
													const char * path))
{
  resource_t * r = NULL;
  void * data = NULL;
  if (name == NULL || path == NULL)
	return NULL;

  //check extension to determine resource type
  char * extension = strrchr(name, '.');
  r = (resource_t *)malloc(sizeof(resource_t));
  r->name = (char *)malloc(sizeof(char)*strlen(name));
  r->path = (char *)malloc(sizeof(char)*strlen(path));
  strcpy(r->name, name);
  strcpy(r->path, path);
  r->ref = 1;

  //load "resource scripts" which describe the resource, and where the
  //media is located on the disk
  if (customLoader != NULL)
  {
	data = customLoader(name, path);
	//r->type = RES_SOMETHING; todo, put something else here
	r->data = data;	
  }
  else if (strcmp(extension, ".png") == 0) //image resource
  {
	//TODO
  }
  else if (strcmp(extension, ".material") == 0) //texture + metadata
  {
	data = loadMaterial(name, path);
	r->type = RES_MATERIAL;
	r->data = data;	
  }
  else if (strcmp(extension, ".mesh") == 0) //mesh of triangles
  {
	data = loadMesh(name, path);
 	r->type = RES_MESH;
	r->data = data;	
  }
  else if (strcmp(extension, ".script") == 0) //temp   //else if (strcmp(extension, ".script") == 0) //lua script
  {
	data = loadScript(name, path);
	r->type = RES_SCRIPT;
	r->data = data;	
  }
  else if (strcmp(extension, ".sound") == 0) //sound scripts
  {
	data = loadSound(name, path);
	r->type = RES_SOUND;
	r->data = data;	
  }
  else //dont know how to load, free resource
  {
	printf("unknown resource extension '%s'\n", extension);
	free(r);
	return NULL;
  }

  if (data == NULL) //data failed to load, free resource
  {
	free(r);
	return NULL;
  }

  //printf("%s%s loaded\n", path, name);
  return r;
}

void Resource_destroy(resource_t * resource)
{
  if (resource == NULL)
	return;
  if (resource->name != NULL)
	free(resource->name);
  if (resource->path != NULL)
	free(resource->path);
  if (resource->data != NULL)
  {
	switch (resource->type)
	{
	case RES_IMAGE:
	  {
		image_t * image = (image_t *)resource->data;
	  }
	  break;
	case RES_MATERIAL:
	  {
		material_t * material = (material_t *)resource->data;
		if (material->image != NULL)
		  Resource_destroy(material->image);
	  }
	  break;
	case RES_MESH:
	  {
		mesh_t * mesh = (mesh_t *)resource->data;
	  }
	  break;
	case RES_SCRIPT:
	  {
		script_t * script = (script_t *)resource->data;
		if (script->contents != NULL);
		free(script->contents);
	  }
	  break;
	case RES_SOUND:
	  {
		sound_t * sound = (sound_t *)resource->data;
	  }
	  break;
	default:
	  printf("unknown resource type %d\n", resource->type);
	  break;
	}
	free(resource->data);
  }
  free(resource);
}

 material_t * loadMaterial(const char * name, const char * path)
{

  return NULL;
}

 mesh_t * loadMesh(const char * name, const char * path)
{

  return NULL;
}

 script_t * loadScript(const char * name, const char * path)
{
  FILE * f = NULL;
  char filename[256];
  script_t * script = NULL;
  memset(filename, 0, sizeof(filename));
  strcpy(filename, path);
  strcat(filename, name);
  f = fopen(filename, "r");
  if (f == NULL)
	printf("error opening file '%s'\n", filename);
  else
  {
	script = (script_t *)malloc(sizeof(script_t));
	int length = Resource_countChar(name, path);
	if (length <= 0)
	  printf("empty script\n");
	char * contents = (char *)malloc( (length+1)*sizeof(char) ); //+1 is \0
	memset(contents, 0, sizeof(contents));
	int i;
	char c[2];
	c[1] = '\0';
	for (i = 0; i < length; i++)
	{
	  c[0] = (char)fgetc(f);
	  strcat(contents, c);
	}
	script->contents = contents;
	fclose(f);
  }
  return script;
}

 sound_t * loadSound(const char * name, const char * path)
{

  return NULL;
}

//find somewhere better to put this
int Resource_countChar(const char * name, const char * path)
{
 FILE * f = NULL;
 int count = 0;
 int in;
 //TODO: determine max filename / path on each platform
  char filename[256];
  memset(filename, 0, sizeof(filename));
  strcpy(filename, path);
  strcat(filename, name);
  f = fopen(filename, "r");
  if (f == NULL)
	printf("error opening file '%s'\n", filename);
  else
  {
	in = fgetc(f);
	while (in != EOF)
	{
	  in = fgetc(f);
	  count++;
	}
	fclose(f);
  }
  return count;
}

Added source/core/Resource.h.





















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#ifndef __RESOURCE_H__
#define __RESOURCE_H__

#include "Vector.h"
#include <stdbool.h>

/**
 * --------------------------------------------------------
 * | Resource  (resource_t)                               |
 * | -metadata                                            |
 * |                                                      |
 * |               -------------------------------------  |
 * |void * data -> | Resource Data (mesh_t/image_t/..) |  |             
 * |               | -data                             |  |
 * |               |                                   |  |
 * |               |                                   |  |
 * |               |                                   |  |
 * |               |                                   |  |
 * |               |                                   |  |
 * |               -------------------------------------  |
 * |                                                      |
 * |                                                      |
 * --------------------------------------------------------
 */

typedef enum resType_e
{
  RES_IMAGE,
  RES_MATERIAL,
  RES_MESH,
  RES_SCRIPT,
  RES_SOUND
} resType_t;

typedef struct resource_e
{
  resType_t type;
  char * name;
  char * path;
  void * data;
  int ref; //reference count
} resource_t;

//types of structs to store in resource_t->data
typedef struct image_e
{
  int width;
  int height;
  //2d array of the color values
  //of each pixel in the image
  //(laid out linearly)
  int * colorMap;
} image_t;

typedef struct material_e
{
  bool nodraw;

  //load image with resource loader so different materials can contain
  //the same image, but the image is only loaded once in memory
  resource_t * image; 
} material_t;

typedef struct mesh_e
{
  //arrays
  vector_t * vertices;
  vector_t * texCoords;
  vector_t * vertexNormals;

} mesh_t;

typedef struct script_e
{
  //the text laid out in a cstring
  char * contents;
} script_t;

typedef struct sound_e
{
  bool loop;
  //temp, setup AL first
  void * sound;
} sound_t;

resource_t * Resource_create(const char * name, const char * path,
							 void * (*customLoader)(const char * name, 
													const char * path));

/**
 * Release dynamically allocated contents of a resource from memory,
 * including the resource_t itself. If a resource contains other resources
 * (such as a material containing an image) then the child resouces are
 * recursively destroyed as well.
 */
void Resource_destroy(resource_t * resource);


//here temporarily for test
 material_t * loadMaterial(const char * name, const char * path);
 mesh_t * loadMesh(const char * name, const char * path);
 script_t * loadScript(const char * name, const char * path);
 sound_t * loadSound(const char * name, const char * path);
int Resource_countChar(const char * name, const char * path);

#endif

Added source/core/ResourceManager.c.















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#include "ResourceManager.h"
#include <stdbool.h>
#include <string.h>
#include "LinkedList.h"
#include <stdio.h>
#include "Resource.h"

static rmData_t rmData;
static bool instanced = false;


void ResourceManager_create()
{
  if (instanced)
	return;
  rmData.resources = LinkedList_create();

  instanced = true;
}

void ResourceManager_destroy()
{
  if (!instanced)
	return;
  LinkedList_destroy(rmData.resources);

  instanced = false;
}

/**
 * Get the resource matching the name and path. If the
 * resource cannot be found, return NULL;
 */
static resource_t * ResourceManager_getElement(const char * name, const char * path)
{
  resource_t * resource = NULL;
  int i;
  for (i = 0; i < LinkedList_size(rmData.resources); i++)
  {
	resource = (resource_t *)LinkedList_get(rmData.resources, i);
	if (strcmp(resource->name, name) == 0 && strcmp(resource->path, path) == 0)
	  return resource;
  }
  return NULL;
}

/**
 * Return a resource with data from the given name/path. The resource
 * manager makes sure only one instance of the resource is loaded. This
 * means that these resources are READ ONLY by the callers.
 */
resource_t * ResourceManager_load(const char * name, const char * path)
{
  resource_t * r = NULL;
  if (name == NULL || path == NULL)
	return NULL;

  //check if in the list already
  r = ResourceManager_getElement(name, path);
  if (r != NULL)
	r->ref++;
  else
  {
	//check extension to determine resource type
	char * extension = strrchr(name, '.');
	/*
	// TODO
	if (strcmp(extension, ".scr") == 0)			
	//r = new Script(name, path);
	else if (strcmp(extension, ".wav") == 0)
	//r = new Sound(name, path);
	else if (strcmp(extension, ".obj") == 0)
	//r = new Mesh(name, path);
	else
	return NULL; // dont know how to load this

	//
	*/
	r = Resource_create(name, path, NULL);
	LinkedList_add(rmData.resources, r);
	printf("%s%s loaded\n", path, name);
  }
  
  return r;
}

/**
 * Called when an entity no longer needs a resource. The reference count
 * of the resource will be decreased by 1. If there are no more references
 * to the resource, it is freed. The function caller will be unaware if
 * the resource is freed from memory or not, but this should not matter
 * because this is called when the caller no longer has a use for the
 * resource. (So the caller shouldn't try to access the resource_t again
 * after calling this).
 */
void ResourceManager_unload(resource_t * resource)
{
  if (resource == NULL)
	return;
  resource->ref--;
  if (!resource->ref)
  {
	int i;
	resource_t * r = NULL;
	for (i = 0; i < LinkedList_size(rmData.resources); i++)
	{
	  r = LinkedList_get(rmData.resources, i);
	  if (resource == r)
	  {	  
		LinkedList_remove(rmData.resources, i);
		printf("%s%s unloaded\n", r->path, r->name);
		//destroy resource from memory
		Resource_destroy(resource);
		return;
	  }
	}
	printf("error: could not find resource to unload\n");
  }
}

Added source/core/ResourceManager.h.











































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#ifndef __RESOURCE_MANAGER_H__
#define __RESOURCE_MANAGER_H__
#include "LinkedList.h"
#include "Resource.h"



typedef struct rmData_s
{
  linkedList_t * resources;
} rmData_t;

/**
 * Create the resource manager. Should only need to be
 * called once at application start, so it simply be
 * created/destroyed by the engine without the user
 * having to worry about it.
 */
void ResourceManager_create();

void ResourceManager_destroy();

/**
 * Return a pointer to the resource with the specified
 * name and path. The resource manager will load the
 * resource if it is not already loaded, if it exists.
 * This will increment the resource's reference count.
 * If the resource cannot be found, returns NULL. The
 * calling entity should unload the resource with
 * ResourceManager_unload in order to decrement the
 * reference count.
 */
resource_t * ResourceManager_load(const char * name, const char * path);

void ResourceManager_unload(resource_t * resource);

#endif

Added source/core/State.c.









>
>
>
>
1
2
3
4
//functions for managing/tracking current state
#include "State.h"

//transitions array

Added source/core/State.h.

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef __STATE_H__
#define __STATE_H__

#include <stdbool.h>

#define PAYLOAD_STATE 0

typedef struct
{
  int id; //dont use negative numbers!!!!

  bool (*load)(void);

  bool (*close)(void);

  void (*update)(void);

  void (*render)(void);

 

} State;

#endif

Added source/core/Vector.c.

















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#include "Vector.h"
#include <math.h>
vector_t Vector_add(vector_t a, vector_t b)
{
  a.x += b.x;
  a.y += b.y;
  a.z += b.z;
  return a;
}

vector_t Vector_cross(vector_t a, vector_t b)
{
  vector_t v;
  if (Vector_magnitude(a) == 0 || Vector_magnitude(b) == 0)
	v = Vector_zero();  
  else
  {
	v.x = (a.y * b.z) - (a.z * b.y);
	v.y = -((a.x * b.z) - (a.z * b.x));
	v.z = (a.x * b.y) - (a.y * b.x);
  }
  return v;
}

float Vector_dot(vector_t a, vector_t b)
{
  return (a.x*b.x) + (a.y*b.y) + (a.z*b.z);
}

float Vector_magnitude(vector_t v)
{
  return sqrt( (v.x*v.x) + (v.y*v.y) + (v.z*v.z) );
}

vector_t Vector_multiply(vector_t v, float scalar)
{
  v.x *= scalar;
  v.y *= scalar;
  v.z *= scalar;
  return v;
}

vector_t Vector_normalize(vector_t v)
{
  float magnitude = Vector_magnitude(v);
  if (magnitude == 0) //be careful of 0 length vectors
	v = Vector_zero();
  else
  {
	v.x /= magnitude;
	v.y /= magnitude;
	v.z /= magnitude;
  }
  return v;
}

vector_t Vector_subtract(vector_t a, vector_t b)
{
  a.x -= b.x;
  a.y -= b.y;
  a.z -= b.z;
  return a;
}

vector_t Vector_zero()
{
  vector_t v;
  v.x = 0;
  v.y = 0;
  v.z = 0;
  return v;
}

Added source/core/Vector.h.

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#ifndef __VECTOR_H__
#define __VECTOR_H__

//none of these functions modify the vectors passed
//into them

typedef struct vector_s
{
  float x;
  float y;
  float z;
} vector_t;

vector_t Vector_add(vector_t a, vector_t b);
vector_t Vector_cross(vector_t a, vector_t b);

float Vector_dot(vector_t a, vector_t b);

float Vector_magnitude(vector_t v);

vector_t Vector_multiply(vector_t v, float scalar);



vector_t Vector_normalize(vector_t v);

vector_t Vector_subtract(vector_t a, vector_t b);

//return a zero length vector
vector_t Vector_zero();

#endif

Added source/core/Void.c.











































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#include "Void.h"

char * v2char(void * v)
{
  return (char *)v;
}

char ** v2cstring(void * v)
{
  return (char **)v;
}

double * v2double(void * v)
{
  return (double *)v;
}

float * v2float(void * v)
{
  return (float *)v;
}

int * v2int(void * v)
{
  return (int *)v;
}

long * v2long(void * v)
{
  return (long *)v;
}

short * v2short(void * v)
{
  return (short *)v;
}

Added source/core/Void.h.



























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
#ifndef __VOID_H__
#define __VOID_H__

//convert void pointers to the given type
char * v2char(void * v);
double * v2double(void * v);
float * v2float(void * v);
int * v2int(void * v);
long * v2long(void * v);
short * v2short(void * v);


#endif

Added source/core/uthash.h.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
/*
Copyright (c) 2003-2012, Troy D. Hanson     http://uthash.sourceforge.net
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef UTHASH_H
#define UTHASH_H 

#include <string.h>   /* memcmp,strlen */
#include <stddef.h>   /* ptrdiff_t */
#include <stdlib.h>   /* exit() */

/* These macros use decltype or the earlier __typeof GNU extension.
   As decltype is only available in newer compilers (VS2010 or gcc 4.3+
   when compiling c++ source) this code uses whatever method is needed
   or, for VS2008 where neither is available, uses casting workarounds. */
#ifdef _MSC_VER         /* MS compiler */
#if _MSC_VER >= 1600 && defined(__cplusplus)  /* VS2010 or newer in C++ mode */
#define DECLTYPE(x) (decltype(x))
#else                   /* VS2008 or older (or VS2010 in C mode) */
#define NO_DECLTYPE
#define DECLTYPE(x)
#endif
#else                   /* GNU, Sun and other compilers */
#define DECLTYPE(x) (__typeof(x))
#endif

#ifdef NO_DECLTYPE
#define DECLTYPE_ASSIGN(dst,src)                                                 \
do {                                                                             \
  char **_da_dst = (char**)(&(dst));                                             \
  *_da_dst = (char*)(src);                                                       \
} while(0)
#else 
#define DECLTYPE_ASSIGN(dst,src)                                                 \
do {                                                                             \
  (dst) = DECLTYPE(dst)(src);                                                    \
} while(0)
#endif

/* a number of the hash function use uint32_t which isn't defined on win32 */
#ifdef _MSC_VER
typedef unsigned int uint32_t;
typedef unsigned char uint8_t;
#else
#include <inttypes.h>   /* uint32_t */
#endif

#define UTHASH_VERSION 1.9.6

#ifndef uthash_fatal
#define uthash_fatal(msg) exit(-1)        /* fatal error (out of memory,etc) */
#endif
#ifndef uthash_malloc
#define uthash_malloc(sz) malloc(sz)      /* malloc fcn                      */
#endif
#ifndef uthash_free
#define uthash_free(ptr,sz) free(ptr)     /* free fcn                        */
#endif

#ifndef uthash_noexpand_fyi
#define uthash_noexpand_fyi(tbl)          /* can be defined to log noexpand  */
#endif
#ifndef uthash_expand_fyi
#define uthash_expand_fyi(tbl)            /* can be defined to log expands   */
#endif

/* initial number of buckets */
#define HASH_INITIAL_NUM_BUCKETS 32      /* initial number of buckets        */
#define HASH_INITIAL_NUM_BUCKETS_LOG2 5  /* lg2 of initial number of buckets */
#define HASH_BKT_CAPACITY_THRESH 10      /* expand when bucket count reaches */

/* calculate the element whose hash handle address is hhe */
#define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho)))

#define HASH_FIND(hh,head,keyptr,keylen,out)                                     \
do {                                                                             \
  unsigned _hf_bkt,_hf_hashv;                                                    \
  out=NULL;                                                                      \
  if (head) {                                                                    \
     HASH_FCN(keyptr,keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt);   \
     if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv)) {                           \
       HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ],  \
                        keyptr,keylen,out);                                      \
     }                                                                           \
  }                                                                              \
} while (0)

#ifdef HASH_BLOOM
#define HASH_BLOOM_BITLEN (1ULL << HASH_BLOOM)
#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8) + ((HASH_BLOOM_BITLEN%8) ? 1:0)
#define HASH_BLOOM_MAKE(tbl)                                                     \
do {                                                                             \
  (tbl)->bloom_nbits = HASH_BLOOM;                                               \
  (tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN);                 \
  if (!((tbl)->bloom_bv))  { uthash_fatal( "out of memory"); }                   \
  memset((tbl)->bloom_bv, 0, HASH_BLOOM_BYTELEN);                                \
  (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE;                                       \
} while (0) 

#define HASH_BLOOM_FREE(tbl)                                                     \
do {                                                                             \
  uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN);                              \
} while (0) 

#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8] |= (1U << ((idx)%8)))
#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8] & (1U << ((idx)%8)))

#define HASH_BLOOM_ADD(tbl,hashv)                                                \
  HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1)))

#define HASH_BLOOM_TEST(tbl,hashv)                                               \
  HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1)))

#else
#define HASH_BLOOM_MAKE(tbl) 
#define HASH_BLOOM_FREE(tbl) 
#define HASH_BLOOM_ADD(tbl,hashv) 
#define HASH_BLOOM_TEST(tbl,hashv) (1)
#endif

#define HASH_MAKE_TABLE(hh,head)                                                 \
do {                                                                             \
  (head)->hh.tbl = (UT_hash_table*)uthash_malloc(                                \
                  sizeof(UT_hash_table));                                        \
  if (!((head)->hh.tbl))  { uthash_fatal( "out of memory"); }                    \
  memset((head)->hh.tbl, 0, sizeof(UT_hash_table));                              \
  (head)->hh.tbl->tail = &((head)->hh);                                          \
  (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS;                        \
  (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2;              \
  (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head);                    \
  (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc(                      \
          HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket));               \
  if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); }             \
  memset((head)->hh.tbl->buckets, 0,                                             \
          HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket));               \
  HASH_BLOOM_MAKE((head)->hh.tbl);                                               \
  (head)->hh.tbl->signature = HASH_SIGNATURE;                                    \
} while(0)

#define HASH_ADD(hh,head,fieldname,keylen_in,add)                                \
        HASH_ADD_KEYPTR(hh,head,&((add)->fieldname),keylen_in,add)
 
#define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add)                            \
do {                                                                             \
 unsigned _ha_bkt;                                                               \
 (add)->hh.next = NULL;                                                          \
 (add)->hh.key = (char*)keyptr;                                                  \
 (add)->hh.keylen = (unsigned)keylen_in;                                                   \
 if (!(head)) {                                                                  \
    head = (add);                                                                \
    (head)->hh.prev = NULL;                                                      \
    HASH_MAKE_TABLE(hh,head);                                                    \
 } else {                                                                        \
    (head)->hh.tbl->tail->next = (add);                                          \
    (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail);         \
    (head)->hh.tbl->tail = &((add)->hh);                                         \
 }                                                                               \
 (head)->hh.tbl->num_items++;                                                    \
 (add)->hh.tbl = (head)->hh.tbl;                                                 \
 HASH_FCN(keyptr,keylen_in, (head)->hh.tbl->num_buckets,                         \
         (add)->hh.hashv, _ha_bkt);                                              \
 HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt],&(add)->hh);                   \
 HASH_BLOOM_ADD((head)->hh.tbl,(add)->hh.hashv);                                 \
 HASH_EMIT_KEY(hh,head,keyptr,keylen_in);                                        \
 HASH_FSCK(hh,head);                                                             \
} while(0)

#define HASH_TO_BKT( hashv, num_bkts, bkt )                                      \
do {                                                                             \
  bkt = ((hashv) & ((num_bkts) - 1));                                            \
} while(0)

/* delete "delptr" from the hash table.
 * "the usual" patch-up process for the app-order doubly-linked-list.
 * The use of _hd_hh_del below deserves special explanation.
 * These used to be expressed using (delptr) but that led to a bug
 * if someone used the same symbol for the head and deletee, like
 *  HASH_DELETE(hh,users,users);
 * We want that to work, but by changing the head (users) below
 * we were forfeiting our ability to further refer to the deletee (users)
 * in the patch-up process. Solution: use scratch space to
 * copy the deletee pointer, then the latter references are via that
 * scratch pointer rather than through the repointed (users) symbol.
 */
#define HASH_DELETE(hh,head,delptr)                                              \
do {                                                                             \
    unsigned _hd_bkt;                                                            \
    struct UT_hash_handle *_hd_hh_del;                                           \
    if ( ((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL) )  {         \
        uthash_free((head)->hh.tbl->buckets,                                     \
                    (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \
        HASH_BLOOM_FREE((head)->hh.tbl);                                         \
        uthash_free((head)->hh.tbl, sizeof(UT_hash_table));                      \
        head = NULL;                                                             \
    } else {                                                                     \
        _hd_hh_del = &((delptr)->hh);                                            \
        if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) {     \
            (head)->hh.tbl->tail =                                               \
                (UT_hash_handle*)((char*)((delptr)->hh.prev) +                   \
                (head)->hh.tbl->hho);                                            \
        }                                                                        \
        if ((delptr)->hh.prev) {                                                 \
            ((UT_hash_handle*)((char*)((delptr)->hh.prev) +                      \
                    (head)->hh.tbl->hho))->next = (delptr)->hh.next;             \
        } else {                                                                 \
            DECLTYPE_ASSIGN(head,(delptr)->hh.next);                             \
        }                                                                        \
        if (_hd_hh_del->next) {                                                  \
            ((UT_hash_handle*)((char*)_hd_hh_del->next +                         \
                    (head)->hh.tbl->hho))->prev =                                \
                    _hd_hh_del->prev;                                            \
        }                                                                        \
        HASH_TO_BKT( _hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt);   \
        HASH_DEL_IN_BKT(hh,(head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del);        \
        (head)->hh.tbl->num_items--;                                             \
    }                                                                            \
    HASH_FSCK(hh,head);                                                          \
} while (0)


/* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */
#define HASH_FIND_STR(head,findstr,out)                                          \
    HASH_FIND(hh,head,findstr,strlen(findstr),out)
#define HASH_ADD_STR(head,strfield,add)                                          \
    HASH_ADD(hh,head,strfield,strlen(add->strfield),add)
#define HASH_FIND_INT(head,findint,out)                                          \
    HASH_FIND(hh,head,findint,sizeof(int),out)
#define HASH_ADD_INT(head,intfield,add)                                          \
    HASH_ADD(hh,head,intfield,sizeof(int),add)
#define HASH_FIND_PTR(head,findptr,out)                                          \
    HASH_FIND(hh,head,findptr,sizeof(void *),out)
#define HASH_ADD_PTR(head,ptrfield,add)                                          \
    HASH_ADD(hh,head,ptrfield,sizeof(void *),add)
#define HASH_DEL(head,delptr)                                                    \
    HASH_DELETE(hh,head,delptr)

/* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined.
 * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined.
 */
#ifdef HASH_DEBUG
#define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0)
#define HASH_FSCK(hh,head)                                                       \
do {                                                                             \
    unsigned _bkt_i;                                                             \
    unsigned _count, _bkt_count;                                                 \
    char *_prev;                                                                 \
    struct UT_hash_handle *_thh;                                                 \
    if (head) {                                                                  \
        _count = 0;                                                              \
        for( _bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) {       \
            _bkt_count = 0;                                                      \
            _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head;                      \
            _prev = NULL;                                                        \
            while (_thh) {                                                       \
               if (_prev != (char*)(_thh->hh_prev)) {                            \
                   HASH_OOPS("invalid hh_prev %p, actual %p\n",                  \
                    _thh->hh_prev, _prev );                                      \
               }                                                                 \
               _bkt_count++;                                                     \
               _prev = (char*)(_thh);                                            \
               _thh = _thh->hh_next;                                             \
            }                                                                    \
            _count += _bkt_count;                                                \
            if ((head)->hh.tbl->buckets[_bkt_i].count !=  _bkt_count) {          \
               HASH_OOPS("invalid bucket count %d, actual %d\n",                 \
                (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count);              \
            }                                                                    \
        }                                                                        \
        if (_count != (head)->hh.tbl->num_items) {                               \
            HASH_OOPS("invalid hh item count %d, actual %d\n",                   \
                (head)->hh.tbl->num_items, _count );                             \
        }                                                                        \
        /* traverse hh in app order; check next/prev integrity, count */         \
        _count = 0;                                                              \
        _prev = NULL;                                                            \
        _thh =  &(head)->hh;                                                     \
        while (_thh) {                                                           \
           _count++;                                                             \
           if (_prev !=(char*)(_thh->prev)) {                                    \
              HASH_OOPS("invalid prev %p, actual %p\n",                          \
                    _thh->prev, _prev );                                         \
           }                                                                     \
           _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh);                    \
           _thh = ( _thh->next ?  (UT_hash_handle*)((char*)(_thh->next) +        \
                                  (head)->hh.tbl->hho) : NULL );                 \
        }                                                                        \
        if (_count != (head)->hh.tbl->num_items) {                               \
            HASH_OOPS("invalid app item count %d, actual %d\n",                  \
                (head)->hh.tbl->num_items, _count );                             \
        }                                                                        \
    }                                                                            \
} while (0)
#else
#define HASH_FSCK(hh,head) 
#endif

/* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to 
 * the descriptor to which this macro is defined for tuning the hash function.
 * The app can #include <unistd.h> to get the prototype for write(2). */
#ifdef HASH_EMIT_KEYS
#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen)                                   \
do {                                                                             \
    unsigned _klen = fieldlen;                                                   \
    write(HASH_EMIT_KEYS, &_klen, sizeof(_klen));                                \
    write(HASH_EMIT_KEYS, keyptr, fieldlen);                                     \
} while (0)
#else 
#define HASH_EMIT_KEY(hh,head,keyptr,fieldlen)                    
#endif

/* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */
#ifdef HASH_FUNCTION 
#define HASH_FCN HASH_FUNCTION
#else
#define HASH_FCN HASH_JEN
#endif

/* The Bernstein hash function, used in Perl prior to v5.6 */
#define HASH_BER(key,keylen,num_bkts,hashv,bkt)                                  \
do {                                                                             \
  unsigned _hb_keylen=keylen;                                                    \
  char *_hb_key=(char*)(key);                                                    \
  (hashv) = 0;                                                                   \
  while (_hb_keylen--)  { (hashv) = ((hashv) * 33) + *_hb_key++; }               \
  bkt = (hashv) & (num_bkts-1);                                                  \
} while (0)


/* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at 
 * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */
#define HASH_SAX(key,keylen,num_bkts,hashv,bkt)                                  \
do {                                                                             \
  unsigned _sx_i;                                                                \
  char *_hs_key=(char*)(key);                                                    \
  hashv = 0;                                                                     \
  for(_sx_i=0; _sx_i < keylen; _sx_i++)                                          \
      hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i];                     \
  bkt = hashv & (num_bkts-1);                                                    \
} while (0)

#define HASH_FNV(key,keylen,num_bkts,hashv,bkt)                                  \
do {                                                                             \
  unsigned _fn_i;                                                                \
  char *_hf_key=(char*)(key);                                                    \
  hashv = 2166136261UL;                                                          \
  for(_fn_i=0; _fn_i < keylen; _fn_i++)                                          \
      hashv = (hashv * 16777619) ^ _hf_key[_fn_i];                               \
  bkt = hashv & (num_bkts-1);                                                    \
} while(0) 
 
#define HASH_OAT(key,keylen,num_bkts,hashv,bkt)                                  \
do {                                                                             \
  unsigned _ho_i;                                                                \
  char *_ho_key=(char*)(key);                                                    \
  hashv = 0;                                                                     \
  for(_ho_i=0; _ho_i < keylen; _ho_i++) {                                        \
      hashv += _ho_key[_ho_i];                                                   \
      hashv += (hashv << 10);                                                    \
      hashv ^= (hashv >> 6);                                                     \
  }                                                                              \
  hashv += (hashv << 3);                                                         \
  hashv ^= (hashv >> 11);                                                        \
  hashv += (hashv << 15);                                                        \
  bkt = hashv & (num_bkts-1);                                                    \
} while(0)

#define HASH_JEN_MIX(a,b,c)                                                      \
do {                                                                             \
  a -= b; a -= c; a ^= ( c >> 13 );                                              \
  b -= c; b -= a; b ^= ( a << 8 );                                               \
  c -= a; c -= b; c ^= ( b >> 13 );                                              \
  a -= b; a -= c; a ^= ( c >> 12 );                                              \
  b -= c; b -= a; b ^= ( a << 16 );                                              \
  c -= a; c -= b; c ^= ( b >> 5 );                                               \
  a -= b; a -= c; a ^= ( c >> 3 );                                               \
  b -= c; b -= a; b ^= ( a << 10 );                                              \
  c -= a; c -= b; c ^= ( b >> 15 );                                              \
} while (0)

#define HASH_JEN(key,keylen,num_bkts,hashv,bkt)                                  \
do {                                                                             \
  unsigned _hj_i,_hj_j,_hj_k;                                                    \
  char *_hj_key=(char*)(key);                                                    \
  hashv = 0xfeedbeef;                                                            \
  _hj_i = _hj_j = 0x9e3779b9;                                                    \
  _hj_k = (unsigned)keylen;                                                                \
  while (_hj_k >= 12) {                                                          \
    _hj_i +=    (_hj_key[0] + ( (unsigned)_hj_key[1] << 8 )                      \
        + ( (unsigned)_hj_key[2] << 16 )                                         \
        + ( (unsigned)_hj_key[3] << 24 ) );                                      \
    _hj_j +=    (_hj_key[4] + ( (unsigned)_hj_key[5] << 8 )                      \
        + ( (unsigned)_hj_key[6] << 16 )                                         \
        + ( (unsigned)_hj_key[7] << 24 ) );                                      \
    hashv += (_hj_key[8] + ( (unsigned)_hj_key[9] << 8 )                         \
        + ( (unsigned)_hj_key[10] << 16 )                                        \
        + ( (unsigned)_hj_key[11] << 24 ) );                                     \
                                                                                 \
     HASH_JEN_MIX(_hj_i, _hj_j, hashv);                                          \
                                                                                 \
     _hj_key += 12;                                                              \
     _hj_k -= 12;                                                                \
  }                                                                              \
  hashv += keylen;                                                               \
  switch ( _hj_k ) {                                                             \
     case 11: hashv += ( (unsigned)_hj_key[10] << 24 );                          \
     case 10: hashv += ( (unsigned)_hj_key[9] << 16 );                           \
     case 9:  hashv += ( (unsigned)_hj_key[8] << 8 );                            \
     case 8:  _hj_j += ( (unsigned)_hj_key[7] << 24 );                           \
     case 7:  _hj_j += ( (unsigned)_hj_key[6] << 16 );                           \
     case 6:  _hj_j += ( (unsigned)_hj_key[5] << 8 );                            \
     case 5:  _hj_j += _hj_key[4];                                               \
     case 4:  _hj_i += ( (unsigned)_hj_key[3] << 24 );                           \
     case 3:  _hj_i += ( (unsigned)_hj_key[2] << 16 );                           \
     case 2:  _hj_i += ( (unsigned)_hj_key[1] << 8 );                            \
     case 1:  _hj_i += _hj_key[0];                                               \
  }                                                                              \
  HASH_JEN_MIX(_hj_i, _hj_j, hashv);                                             \
  bkt = hashv & (num_bkts-1);                                                    \
} while(0)

/* The Paul Hsieh hash function */
#undef get16bits
#if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__)             \
  || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__)
#define get16bits(d) (*((const uint16_t *) (d)))
#endif

#if !defined (get16bits)
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8)             \
                       +(uint32_t)(((const uint8_t *)(d))[0]) )
#endif
#define HASH_SFH(key,keylen,num_bkts,hashv,bkt)                                  \
do {                                                                             \
  char *_sfh_key=(char*)(key);                                                   \
  uint32_t _sfh_tmp, _sfh_len = keylen;                                          \
                                                                                 \
  int _sfh_rem = _sfh_len & 3;                                                   \
  _sfh_len >>= 2;                                                                \
  hashv = 0xcafebabe;                                                            \
                                                                                 \
  /* Main loop */                                                                \
  for (;_sfh_len > 0; _sfh_len--) {                                              \
    hashv    += get16bits (_sfh_key);                                            \
    _sfh_tmp       = (get16bits (_sfh_key+2) << 11) ^ hashv;                     \
    hashv     = (hashv << 16) ^ _sfh_tmp;                                        \
    _sfh_key += 2*sizeof (uint16_t);                                             \
    hashv    += hashv >> 11;                                                     \
  }                                                                              \
                                                                                 \
  /* Handle end cases */                                                         \
  switch (_sfh_rem) {                                                            \
    case 3: hashv += get16bits (_sfh_key);                                       \
            hashv ^= hashv << 16;                                                \
            hashv ^= _sfh_key[sizeof (uint16_t)] << 18;                          \
            hashv += hashv >> 11;                                                \
            break;                                                               \
    case 2: hashv += get16bits (_sfh_key);                                       \
            hashv ^= hashv << 11;                                                \
            hashv += hashv >> 17;                                                \
            break;                                                               \
    case 1: hashv += *_sfh_key;                                                  \
            hashv ^= hashv << 10;                                                \
            hashv += hashv >> 1;                                                 \
  }                                                                              \
                                                                                 \
    /* Force "avalanching" of final 127 bits */                                  \
    hashv ^= hashv << 3;                                                         \
    hashv += hashv >> 5;                                                         \
    hashv ^= hashv << 4;                                                         \
    hashv += hashv >> 17;                                                        \
    hashv ^= hashv << 25;                                                        \
    hashv += hashv >> 6;                                                         \
    bkt = hashv & (num_bkts-1);                                                  \
} while(0) 

#ifdef HASH_USING_NO_STRICT_ALIASING
/* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads.
 * For other types of CPU's (e.g. Sparc) an unaligned read causes a bus error.
 * MurmurHash uses the faster approach only on CPU's where we know it's safe. 
 *
 * Note the preprocessor built-in defines can be emitted using:
 *
 *   gcc -m64 -dM -E - < /dev/null                  (on gcc)
 *   cc -## a.c (where a.c is a simple test file)   (Sun Studio)
 */
#if (defined(__i386__) || defined(__x86_64__)) 
#define MUR_GETBLOCK(p,i) p[i]
#else /* non intel */
#define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 0x3) == 0)
#define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 0x3) == 1)
#define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 0x3) == 2)
#define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 0x3) == 3)
#define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL))
#if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__))
#define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24))
#define MUR_TWO_TWO(p)   ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16))
#define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >>  8))
#else /* assume little endian non-intel */
#define MUR_THREE_ONE(p) ((((*WP(p))&0xffffff00) >> 8) | (((*(WP(p)+1))&0x000000ff) << 24))
#define MUR_TWO_TWO(p)   ((((*WP(p))&0xffff0000) >>16) | (((*(WP(p)+1))&0x0000ffff) << 16))
#define MUR_ONE_THREE(p) ((((*WP(p))&0xff000000) >>24) | (((*(WP(p)+1))&0x00ffffff) <<  8))
#endif
#define MUR_GETBLOCK(p,i) (MUR_PLUS0_ALIGNED(p) ? ((p)[i]) :           \
                            (MUR_PLUS1_ALIGNED(p) ? MUR_THREE_ONE(p) : \
                             (MUR_PLUS2_ALIGNED(p) ? MUR_TWO_TWO(p) :  \
                                                      MUR_ONE_THREE(p))))
#endif
#define MUR_ROTL32(x,r) (((x) << (r)) | ((x) >> (32 - (r))))
#define MUR_FMIX(_h) \
do {                 \
  _h ^= _h >> 16;    \
  _h *= 0x85ebca6b;  \
  _h ^= _h >> 13;    \
  _h *= 0xc2b2ae35l; \
  _h ^= _h >> 16;    \
} while(0)

#define HASH_MUR(key,keylen,num_bkts,hashv,bkt)                        \
do {                                                                   \
  const uint8_t *_mur_data = (const uint8_t*)(key);                    \
  const int _mur_nblocks = (keylen) / 4;                               \
  uint32_t _mur_h1 = 0xf88D5353;                                       \
  uint32_t _mur_c1 = 0xcc9e2d51;                                       \
  uint32_t _mur_c2 = 0x1b873593;                                       \
  const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+_mur_nblocks*4); \
  int _mur_i;                                                          \
  for(_mur_i = -_mur_nblocks; _mur_i; _mur_i++) {                      \
    uint32_t _mur_k1 = MUR_GETBLOCK(_mur_blocks,_mur_i);               \
    _mur_k1 *= _mur_c1;                                                \
    _mur_k1 = MUR_ROTL32(_mur_k1,15);                                  \
    _mur_k1 *= _mur_c2;                                                \
                                                                       \
    _mur_h1 ^= _mur_k1;                                                \
    _mur_h1 = MUR_ROTL32(_mur_h1,13);                                  \
    _mur_h1 = _mur_h1*5+0xe6546b64;                                    \
  }                                                                    \
  const uint8_t *_mur_tail = (const uint8_t*)(_mur_data + _mur_nblocks*4); \
  uint32_t _mur_k1=0;                                                  \
  switch((keylen) & 3) {                                               \
    case 3: _mur_k1 ^= _mur_tail[2] << 16;                             \
    case 2: _mur_k1 ^= _mur_tail[1] << 8;                              \
    case 1: _mur_k1 ^= _mur_tail[0];                                   \
    _mur_k1 *= _mur_c1;                                                \
    _mur_k1 = MUR_ROTL32(_mur_k1,15);                                  \
    _mur_k1 *= _mur_c2;                                                \
    _mur_h1 ^= _mur_k1;                                                \
  }                                                                    \
  _mur_h1 ^= (keylen);                                                 \
  MUR_FMIX(_mur_h1);                                                   \
  hashv = _mur_h1;                                                     \
  bkt = hashv & (num_bkts-1);                                          \
} while(0)
#endif  /* HASH_USING_NO_STRICT_ALIASING */

/* key comparison function; return 0 if keys equal */
#define HASH_KEYCMP(a,b,len) memcmp(a,b,len) 

/* iterate over items in a known bucket to find desired item */
#define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,out)                       \
do {                                                                             \
 if (head.hh_head) DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,head.hh_head));          \
 else out=NULL;                                                                  \
 while (out) {                                                                   \
    if ((out)->hh.keylen == keylen_in) {                                           \
        if ((HASH_KEYCMP((out)->hh.key,keyptr,keylen_in)) == 0) break;             \
    }                                                                            \
    if ((out)->hh.hh_next) DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,(out)->hh.hh_next)); \
    else out = NULL;                                                             \
 }                                                                               \
} while(0)

/* add an item to a bucket  */
#define HASH_ADD_TO_BKT(head,addhh)                                              \
do {                                                                             \
 head.count++;                                                                   \
 (addhh)->hh_next = head.hh_head;                                                \
 (addhh)->hh_prev = NULL;                                                        \
 if (head.hh_head) { (head).hh_head->hh_prev = (addhh); }                        \
 (head).hh_head=addhh;                                                           \
 if (head.count >= ((head.expand_mult+1) * HASH_BKT_CAPACITY_THRESH)             \
     && (addhh)->tbl->noexpand != 1) {                                           \
       HASH_EXPAND_BUCKETS((addhh)->tbl);                                        \
 }                                                                               \
} while(0)

/* remove an item from a given bucket */
#define HASH_DEL_IN_BKT(hh,head,hh_del)                                          \
    (head).count--;                                                              \
    if ((head).hh_head == hh_del) {                                              \
      (head).hh_head = hh_del->hh_next;                                          \
    }                                                                            \
    if (hh_del->hh_prev) {                                                       \
        hh_del->hh_prev->hh_next = hh_del->hh_next;                              \
    }                                                                            \
    if (hh_del->hh_next) {                                                       \
        hh_del->hh_next->hh_prev = hh_del->hh_prev;                              \
    }                                                                

/* Bucket expansion has the effect of doubling the number of buckets
 * and redistributing the items into the new buckets. Ideally the
 * items will distribute more or less evenly into the new buckets
 * (the extent to which this is true is a measure of the quality of
 * the hash function as it applies to the key domain). 
 * 
 * With the items distributed into more buckets, the chain length
 * (item count) in each bucket is reduced. Thus by expanding buckets
 * the hash keeps a bound on the chain length. This bounded chain 
 * length is the essence of how a hash provides constant time lookup.
 * 
 * The calculation of tbl->ideal_chain_maxlen below deserves some
 * explanation. First, keep in mind that we're calculating the ideal
 * maximum chain length based on the *new* (doubled) bucket count.
 * In fractions this is just n/b (n=number of items,b=new num buckets).
 * Since the ideal chain length is an integer, we want to calculate 
 * ceil(n/b). We don't depend on floating point arithmetic in this
 * hash, so to calculate ceil(n/b) with integers we could write
 * 
 *      ceil(n/b) = (n/b) + ((n%b)?1:0)
 * 
 * and in fact a previous version of this hash did just that.
 * But now we have improved things a bit by recognizing that b is
 * always a power of two. We keep its base 2 log handy (call it lb),
 * so now we can write this with a bit shift and logical AND:
 * 
 *      ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0)
 * 
 */
#define HASH_EXPAND_BUCKETS(tbl)                                                 \
do {                                                                             \
    unsigned _he_bkt;                                                            \
    unsigned _he_bkt_i;                                                          \
    struct UT_hash_handle *_he_thh, *_he_hh_nxt;                                 \
    UT_hash_bucket *_he_new_buckets, *_he_newbkt;                                \
    _he_new_buckets = (UT_hash_bucket*)uthash_malloc(                            \
             2 * tbl->num_buckets * sizeof(struct UT_hash_bucket));              \
    if (!_he_new_buckets) { uthash_fatal( "out of memory"); }                    \
    memset(_he_new_buckets, 0,                                                   \
            2 * tbl->num_buckets * sizeof(struct UT_hash_bucket));               \
    tbl->ideal_chain_maxlen =                                                    \
       (tbl->num_items >> (tbl->log2_num_buckets+1)) +                           \
       ((tbl->num_items & ((tbl->num_buckets*2)-1)) ? 1 : 0);                    \
    tbl->nonideal_items = 0;                                                     \
    for(_he_bkt_i = 0; _he_bkt_i < tbl->num_buckets; _he_bkt_i++)                \
    {                                                                            \
        _he_thh = tbl->buckets[ _he_bkt_i ].hh_head;                             \
        while (_he_thh) {                                                        \
           _he_hh_nxt = _he_thh->hh_next;                                        \
           HASH_TO_BKT( _he_thh->hashv, tbl->num_buckets*2, _he_bkt);            \
           _he_newbkt = &(_he_new_buckets[ _he_bkt ]);                           \
           if (++(_he_newbkt->count) > tbl->ideal_chain_maxlen) {                \
             tbl->nonideal_items++;                                              \
             _he_newbkt->expand_mult = _he_newbkt->count /                       \
                                        tbl->ideal_chain_maxlen;                 \
           }                                                                     \
           _he_thh->hh_prev = NULL;                                              \
           _he_thh->hh_next = _he_newbkt->hh_head;                               \
           if (_he_newbkt->hh_head) _he_newbkt->hh_head->hh_prev =               \
                _he_thh;                                                         \
           _he_newbkt->hh_head = _he_thh;                                        \
           _he_thh = _he_hh_nxt;                                                 \
        }                                                                        \
    }                                                                            \
    uthash_free( tbl->buckets, tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \
    tbl->num_buckets *= 2;                                                       \
    tbl->log2_num_buckets++;                                                     \
    tbl->buckets = _he_new_buckets;                                              \
    tbl->ineff_expands = (tbl->nonideal_items > (tbl->num_items >> 1)) ?         \
        (tbl->ineff_expands+1) : 0;                                              \
    if (tbl->ineff_expands > 1) {                                                \
        tbl->noexpand=1;                                                         \
        uthash_noexpand_fyi(tbl);                                                \
    }                                                                            \
    uthash_expand_fyi(tbl);                                                      \
} while(0)


/* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */
/* Note that HASH_SORT assumes the hash handle name to be hh. 
 * HASH_SRT was added to allow the hash handle name to be passed in. */
#define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn)
#define HASH_SRT(hh,head,cmpfcn)                                                 \
do {                                                                             \
  unsigned _hs_i;                                                                \
  unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize;               \
  struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail;            \
  if (head) {                                                                    \
      _hs_insize = 1;                                                            \
      _hs_looping = 1;                                                           \
      _hs_list = &((head)->hh);                                                  \
      while (_hs_looping) {                                                      \
          _hs_p = _hs_list;                                                      \
          _hs_list = NULL;                                                       \
          _hs_tail = NULL;                                                       \
          _hs_nmerges = 0;                                                       \
          while (_hs_p) {                                                        \
              _hs_nmerges++;                                                     \
              _hs_q = _hs_p;                                                     \
              _hs_psize = 0;                                                     \
              for ( _hs_i = 0; _hs_i  < _hs_insize; _hs_i++ ) {                  \
                  _hs_psize++;                                                   \
                  _hs_q = (UT_hash_handle*)((_hs_q->next) ?                      \
                          ((void*)((char*)(_hs_q->next) +                        \
                          (head)->hh.tbl->hho)) : NULL);                         \
                  if (! (_hs_q) ) break;                                         \
              }                                                                  \
              _hs_qsize = _hs_insize;                                            \
              while ((_hs_psize > 0) || ((_hs_qsize > 0) && _hs_q )) {           \
                  if (_hs_psize == 0) {                                          \
                      _hs_e = _hs_q;                                             \
                      _hs_q = (UT_hash_handle*)((_hs_q->next) ?                  \
                              ((void*)((char*)(_hs_q->next) +                    \
                              (head)->hh.tbl->hho)) : NULL);                     \
                      _hs_qsize--;                                               \
                  } else if ( (_hs_qsize == 0) || !(_hs_q) ) {                   \
                      _hs_e = _hs_p;                                             \
                      _hs_p = (UT_hash_handle*)((_hs_p->next) ?                  \
                              ((void*)((char*)(_hs_p->next) +                    \
                              (head)->hh.tbl->hho)) : NULL);                     \
                      _hs_psize--;                                               \
                  } else if ((                                                   \
                      cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_p)), \
                             DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_q))) \
                             ) <= 0) {                                           \
                      _hs_e = _hs_p;                                             \
                      _hs_p = (UT_hash_handle*)((_hs_p->next) ?                  \
                              ((void*)((char*)(_hs_p->next) +                    \
                              (head)->hh.tbl->hho)) : NULL);                     \
                      _hs_psize--;                                               \
                  } else {                                                       \
                      _hs_e = _hs_q;                                             \
                      _hs_q = (UT_hash_handle*)((_hs_q->next) ?                  \
                              ((void*)((char*)(_hs_q->next) +                    \
                              (head)->hh.tbl->hho)) : NULL);                     \
                      _hs_qsize--;                                               \
                  }                                                              \
                  if ( _hs_tail ) {                                              \
                      _hs_tail->next = ((_hs_e) ?                                \
                            ELMT_FROM_HH((head)->hh.tbl,_hs_e) : NULL);          \
                  } else {                                                       \
                      _hs_list = _hs_e;                                          \
                  }                                                              \
                  _hs_e->prev = ((_hs_tail) ?                                    \
                     ELMT_FROM_HH((head)->hh.tbl,_hs_tail) : NULL);              \
                  _hs_tail = _hs_e;                                              \
              }                                                                  \
              _hs_p = _hs_q;                                                     \
          }                                                                      \
          _hs_tail->next = NULL;                                                 \
          if ( _hs_nmerges <= 1 ) {                                              \
              _hs_looping=0;                                                     \
              (head)->hh.tbl->tail = _hs_tail;                                   \
              DECLTYPE_ASSIGN(head,ELMT_FROM_HH((head)->hh.tbl, _hs_list));      \
          }                                                                      \
          _hs_insize *= 2;                                                       \
      }                                                                          \
      HASH_FSCK(hh,head);                                                        \
 }                                                                               \
} while (0)

/* This function selects items from one hash into another hash. 
 * The end result is that the selected items have dual presence 
 * in both hashes. There is no copy of the items made; rather 
 * they are added into the new hash through a secondary hash 
 * hash handle that must be present in the structure. */
#define HASH_SELECT(hh_dst, dst, hh_src, src, cond)                              \
do {                                                                             \
  unsigned _src_bkt, _dst_bkt;                                                   \
  void *_last_elt=NULL, *_elt;                                                   \
  UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh=NULL;                         \
  ptrdiff_t _dst_hho = ((char*)(&(dst)->hh_dst) - (char*)(dst));                 \
  if (src) {                                                                     \
    for(_src_bkt=0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) {     \
      for(_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head;                \
          _src_hh;                                                               \
          _src_hh = _src_hh->hh_next) {                                          \
          _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh);                       \
          if (cond(_elt)) {                                                      \
            _dst_hh = (UT_hash_handle*)(((char*)_elt) + _dst_hho);               \
            _dst_hh->key = _src_hh->key;                                         \
            _dst_hh->keylen = _src_hh->keylen;                                   \
            _dst_hh->hashv = _src_hh->hashv;                                     \
            _dst_hh->prev = _last_elt;                                           \
            _dst_hh->next = NULL;                                                \
            if (_last_elt_hh) { _last_elt_hh->next = _elt; }                     \
            if (!dst) {                                                          \
              DECLTYPE_ASSIGN(dst,_elt);                                         \
              HASH_MAKE_TABLE(hh_dst,dst);                                       \
            } else {                                                             \
              _dst_hh->tbl = (dst)->hh_dst.tbl;                                  \
            }                                                                    \
            HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt);    \
            HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt],_dst_hh);            \
            (dst)->hh_dst.tbl->num_items++;                                      \
            _last_elt = _elt;                                                    \
            _last_elt_hh = _dst_hh;                                              \
          }                                                                      \
      }                                                                          \
    }                                                                            \
  }                                                                              \
  HASH_FSCK(hh_dst,dst);                                                         \
} while (0)

#define HASH_CLEAR(hh,head)                                                      \
do {                                                                             \
  if (head) {                                                                    \
    uthash_free((head)->hh.tbl->buckets,                                         \
                (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket));      \
    HASH_BLOOM_FREE((head)->hh.tbl);                                             \
    uthash_free((head)->hh.tbl, sizeof(UT_hash_table));                          \
    (head)=NULL;                                                                 \
  }                                                                              \
} while(0)

#ifdef NO_DECLTYPE
#define HASH_ITER(hh,head,el,tmp)                                                \
for((el)=(head), (*(char**)(&(tmp)))=(char*)((head)?(head)->hh.next:NULL);       \
  el; (el)=(tmp),(*(char**)(&(tmp)))=(char*)((tmp)?(tmp)->hh.next:NULL)) 
#else
#define HASH_ITER(hh,head,el,tmp)                                                \
for((el)=(head),(tmp)=DECLTYPE(el)((head)?(head)->hh.next:NULL);                 \
  el; (el)=(tmp),(tmp)=DECLTYPE(el)((tmp)?(tmp)->hh.next:NULL))
#endif

/* obtain a count of items in the hash */
#define HASH_COUNT(head) HASH_CNT(hh,head) 
#define HASH_CNT(hh,head) ((head)?((head)->hh.tbl->num_items):0)

typedef struct UT_hash_bucket {
   struct UT_hash_handle *hh_head;
   unsigned count;

   /* expand_mult is normally set to 0. In this situation, the max chain length
    * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If
    * the bucket's chain exceeds this length, bucket expansion is triggered). 
    * However, setting expand_mult to a non-zero value delays bucket expansion
    * (that would be triggered by additions to this particular bucket)
    * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH.
    * (The multiplier is simply expand_mult+1). The whole idea of this
    * multiplier is to reduce bucket expansions, since they are expensive, in
    * situations where we know that a particular bucket tends to be overused.
    * It is better to let its chain length grow to a longer yet-still-bounded
    * value, than to do an O(n) bucket expansion too often. 
    */
   unsigned expand_mult;

} UT_hash_bucket;

/* random signature used only to find hash tables in external analysis */
#define HASH_SIGNATURE 0xa0111fe1
#define HASH_BLOOM_SIGNATURE 0xb12220f2

typedef struct UT_hash_table {
   UT_hash_bucket *buckets;
   unsigned num_buckets, log2_num_buckets;
   unsigned num_items;
   struct UT_hash_handle *tail; /* tail hh in app order, for fast append    */
   ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */

   /* in an ideal situation (all buckets used equally), no bucket would have
    * more than ceil(#items/#buckets) items. that's the ideal chain length. */
   unsigned ideal_chain_maxlen;

   /* nonideal_items is the number of items in the hash whose chain position
    * exceeds the ideal chain maxlen. these items pay the penalty for an uneven
    * hash distribution; reaching them in a chain traversal takes >ideal steps */
   unsigned nonideal_items;

   /* ineffective expands occur when a bucket doubling was performed, but 
    * afterward, more than half the items in the hash had nonideal chain
    * positions. If this happens on two consecutive expansions we inhibit any
    * further expansion, as it's not helping; this happens when the hash
    * function isn't a good fit for the key domain. When expansion is inhibited
    * the hash will still work, albeit no longer in constant time. */
   unsigned ineff_expands, noexpand;

   uint32_t signature; /* used only to find hash tables in external analysis */
#ifdef HASH_BLOOM
   uint32_t bloom_sig; /* used only to test bloom exists in external analysis */
   uint8_t *bloom_bv;
   char bloom_nbits;
#endif

} UT_hash_table;

typedef struct UT_hash_handle {
   struct UT_hash_table *tbl;
   void *prev;                       /* prev element in app order      */
   void *next;                       /* next element in app order      */
   struct UT_hash_handle *hh_prev;   /* previous hh in bucket order    */
   struct UT_hash_handle *hh_next;   /* next hh in bucket order        */
   void *key;                        /* ptr to enclosing struct's key  */
   unsigned keylen;                  /* enclosing struct's key len     */
   unsigned hashv;                   /* result of hash-fcn(key)        */
} UT_hash_handle;

#endif /* UTHASH_H */

Added source/include/GL/glew.h.

more than 10,000 changes

Added source/include/GL/wglew.h.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
/*
** The OpenGL Extension Wrangler Library
** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
** Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
** Copyright (C) 2002, Lev Povalahev
** All rights reserved.
** 
** Redistribution and use in source and binary forms, with or without 
** modification, are permitted provided that the following conditions are met:
** 
** * Redistributions of source code must retain the above copyright notice, 
**   this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright notice, 
**   this list of conditions and the following disclaimer in the documentation 
**   and/or other materials provided with the distribution.
** * The name of the author may be used to endorse or promote products 
**   derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
** THE POSSIBILITY OF SUCH DAMAGE.
*/

/*
** Copyright (c) 2007 The Khronos Group Inc.
** 
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
** 
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
** 
** THE MATERIALS ARE 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
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/

#ifndef __wglew_h__
#define __wglew_h__
#define __WGLEW_H__

#ifdef __wglext_h_
#error wglext.h included before wglew.h
#endif

#define __wglext_h_

#if !defined(WINAPI)
#  ifndef WIN32_LEAN_AND_MEAN
#    define WIN32_LEAN_AND_MEAN 1
#  endif
#include <windows.h>
#  undef WIN32_LEAN_AND_MEAN
#endif

/*
 * GLEW_STATIC needs to be set when using the static version.
 * GLEW_BUILD is set when building the DLL version.
 */
#ifdef GLEW_STATIC
#  define GLEWAPI extern
#else
#  ifdef GLEW_BUILD
#    define GLEWAPI extern __declspec(dllexport)
#  else
#    define GLEWAPI extern __declspec(dllimport)
#  endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* -------------------------- WGL_3DFX_multisample ------------------------- */

#ifndef WGL_3DFX_multisample
#define WGL_3DFX_multisample 1

#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
#define WGL_SAMPLES_3DFX 0x2061

#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample)

#endif /* WGL_3DFX_multisample */

/* ------------------------- WGL_3DL_stereo_control ------------------------ */

#ifndef WGL_3DL_stereo_control
#define WGL_3DL_stereo_control 1

#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058

typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);

#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL)

#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control)

#endif /* WGL_3DL_stereo_control */

/* ------------------------ WGL_AMD_gpu_association ------------------------ */

#ifndef WGL_AMD_gpu_association
#define WGL_AMD_gpu_association 1

#define WGL_GPU_VENDOR_AMD 0x1F00
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
#define WGL_GPU_RAM_AMD 0x21A3
#define WGL_GPU_CLOCK_AMD 0x21A4
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
#define WGL_GPU_NUM_RB_AMD 0x21A7
#define WGL_GPU_NUM_SPI_AMD 0x21A8

typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int* attribList);
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT* ids);
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, INT property, GLenum dataType, UINT size, void* data);
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);

#define wglBlitContextFramebufferAMD WGLEW_GET_FUN(__wglewBlitContextFramebufferAMD)
#define wglCreateAssociatedContextAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAMD)
#define wglCreateAssociatedContextAttribsAMD WGLEW_GET_FUN(__wglewCreateAssociatedContextAttribsAMD)
#define wglDeleteAssociatedContextAMD WGLEW_GET_FUN(__wglewDeleteAssociatedContextAMD)
#define wglGetContextGPUIDAMD WGLEW_GET_FUN(__wglewGetContextGPUIDAMD)
#define wglGetCurrentAssociatedContextAMD WGLEW_GET_FUN(__wglewGetCurrentAssociatedContextAMD)
#define wglGetGPUIDsAMD WGLEW_GET_FUN(__wglewGetGPUIDsAMD)
#define wglGetGPUInfoAMD WGLEW_GET_FUN(__wglewGetGPUInfoAMD)
#define wglMakeAssociatedContextCurrentAMD WGLEW_GET_FUN(__wglewMakeAssociatedContextCurrentAMD)

#define WGLEW_AMD_gpu_association WGLEW_GET_VAR(__WGLEW_AMD_gpu_association)

#endif /* WGL_AMD_gpu_association */

/* ------------------------- WGL_ARB_buffer_region ------------------------- */

#ifndef WGL_ARB_buffer_region
#define WGL_ARB_buffer_region 1

#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008

typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);

#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB)
#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB)
#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB)
#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB)

#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region)

#endif /* WGL_ARB_buffer_region */

/* ------------------------- WGL_ARB_create_context ------------------------ */

#ifndef WGL_ARB_create_context
#define WGL_ARB_create_context 1

#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define ERROR_INVALID_VERSION_ARB 0x2095
#define ERROR_INVALID_PROFILE_ARB 0x2096

typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList);

#define wglCreateContextAttribsARB WGLEW_GET_FUN(__wglewCreateContextAttribsARB)

#define WGLEW_ARB_create_context WGLEW_GET_VAR(__WGLEW_ARB_create_context)

#endif /* WGL_ARB_create_context */

/* --------------------- WGL_ARB_create_context_profile -------------------- */

#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1

#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126

#define WGLEW_ARB_create_context_profile WGLEW_GET_VAR(__WGLEW_ARB_create_context_profile)

#endif /* WGL_ARB_create_context_profile */

/* ------------------- WGL_ARB_create_context_robustness ------------------- */

#ifndef WGL_ARB_create_context_robustness
#define WGL_ARB_create_context_robustness 1

#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261

#define WGLEW_ARB_create_context_robustness WGLEW_GET_VAR(__WGLEW_ARB_create_context_robustness)

#endif /* WGL_ARB_create_context_robustness */

/* ----------------------- WGL_ARB_extensions_string ----------------------- */

#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1

typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);

#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB)

#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string)

#endif /* WGL_ARB_extensions_string */

/* ------------------------ WGL_ARB_framebuffer_sRGB ----------------------- */

#ifndef WGL_ARB_framebuffer_sRGB
#define WGL_ARB_framebuffer_sRGB 1

#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9

#define WGLEW_ARB_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_ARB_framebuffer_sRGB)

#endif /* WGL_ARB_framebuffer_sRGB */

/* ----------------------- WGL_ARB_make_current_read ----------------------- */

#ifndef WGL_ARB_make_current_read
#define WGL_ARB_make_current_read 1

#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054

typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID);
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);

#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB)
#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB)

#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read)

#endif /* WGL_ARB_make_current_read */

/* -------------------------- WGL_ARB_multisample -------------------------- */

#ifndef WGL_ARB_multisample
#define WGL_ARB_multisample 1

#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042

#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample)

#endif /* WGL_ARB_multisample */

/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */

#ifndef WGL_ARB_pbuffer
#define WGL_ARB_pbuffer 1

#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
#define WGL_PBUFFER_LARGEST_ARB 0x2033
#define WGL_PBUFFER_WIDTH_ARB 0x2034
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
#define WGL_PBUFFER_LOST_ARB 0x2036

DECLARE_HANDLE(HPBUFFERARB);

typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);

#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)
#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)
#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)
#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)
#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)

#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)

#endif /* WGL_ARB_pbuffer */

/* -------------------------- WGL_ARB_pixel_format ------------------------- */

#ifndef WGL_ARB_pixel_format
#define WGL_ARB_pixel_format 1

#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B

typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues);

#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB)
#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB)
#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB)

#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format)

#endif /* WGL_ARB_pixel_format */

/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */

#ifndef WGL_ARB_pixel_format_float
#define WGL_ARB_pixel_format_float 1

#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0

#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float)

#endif /* WGL_ARB_pixel_format_float */

/* ------------------------- WGL_ARB_render_texture ------------------------ */

#ifndef WGL_ARB_render_texture
#define WGL_ARB_render_texture 1

#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
#define WGL_TEXTURE_FORMAT_ARB 0x2072
#define WGL_TEXTURE_TARGET_ARB 0x2073
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
#define WGL_TEXTURE_RGB_ARB 0x2075
#define WGL_TEXTURE_RGBA_ARB 0x2076
#define WGL_NO_TEXTURE_ARB 0x2077
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
#define WGL_TEXTURE_1D_ARB 0x2079
#define WGL_TEXTURE_2D_ARB 0x207A
#define WGL_MIPMAP_LEVEL_ARB 0x207B
#define WGL_CUBE_MAP_FACE_ARB 0x207C
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
#define WGL_FRONT_LEFT_ARB 0x2083
#define WGL_FRONT_RIGHT_ARB 0x2084
#define WGL_BACK_LEFT_ARB 0x2085
#define WGL_BACK_RIGHT_ARB 0x2086
#define WGL_AUX0_ARB 0x2087
#define WGL_AUX1_ARB 0x2088
#define WGL_AUX2_ARB 0x2089
#define WGL_AUX3_ARB 0x208A
#define WGL_AUX4_ARB 0x208B
#define WGL_AUX5_ARB 0x208C
#define WGL_AUX6_ARB 0x208D
#define WGL_AUX7_ARB 0x208E
#define WGL_AUX8_ARB 0x208F
#define WGL_AUX9_ARB 0x2090

typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList);

#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB)
#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB)
#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB)

#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture)

#endif /* WGL_ARB_render_texture */

/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */

#ifndef WGL_ATI_pixel_format_float
#define WGL_ATI_pixel_format_float 1

#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
#define GL_RGBA_FLOAT_MODE_ATI 0x8820
#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835

#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float)

#endif /* WGL_ATI_pixel_format_float */

/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */

#ifndef WGL_ATI_render_texture_rectangle
#define WGL_ATI_render_texture_rectangle 1

#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5

#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle)

#endif /* WGL_ATI_render_texture_rectangle */

/* ------------------- WGL_EXT_create_context_es2_profile ------------------ */

#ifndef WGL_EXT_create_context_es2_profile
#define WGL_EXT_create_context_es2_profile 1

#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004

#define WGLEW_EXT_create_context_es2_profile WGLEW_GET_VAR(__WGLEW_EXT_create_context_es2_profile)

#endif /* WGL_EXT_create_context_es2_profile */

/* -------------------------- WGL_EXT_depth_float -------------------------- */

#ifndef WGL_EXT_depth_float
#define WGL_EXT_depth_float 1

#define WGL_DEPTH_FLOAT_EXT 0x2040

#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float)

#endif /* WGL_EXT_depth_float */

/* ---------------------- WGL_EXT_display_color_table ---------------------- */

#ifndef WGL_EXT_display_color_table
#define WGL_EXT_display_color_table 1

typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length);

#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT)
#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT)
#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT)
#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT)

#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table)

#endif /* WGL_EXT_display_color_table */

/* ----------------------- WGL_EXT_extensions_string ----------------------- */

#ifndef WGL_EXT_extensions_string
#define WGL_EXT_extensions_string 1

typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);

#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT)

#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string)

#endif /* WGL_EXT_extensions_string */

/* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */

#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_EXT_framebuffer_sRGB 1

#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9

#define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB)

#endif /* WGL_EXT_framebuffer_sRGB */

/* ----------------------- WGL_EXT_make_current_read ----------------------- */

#ifndef WGL_EXT_make_current_read
#define WGL_EXT_make_current_read 1

#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043

typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID);
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);

#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT)
#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT)

#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read)

#endif /* WGL_EXT_make_current_read */

/* -------------------------- WGL_EXT_multisample -------------------------- */

#ifndef WGL_EXT_multisample
#define WGL_EXT_multisample 1

#define WGL_SAMPLE_BUFFERS_EXT 0x2041
#define WGL_SAMPLES_EXT 0x2042

#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample)

#endif /* WGL_EXT_multisample */

/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */

#ifndef WGL_EXT_pbuffer
#define WGL_EXT_pbuffer 1

#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
#define WGL_PBUFFER_LARGEST_EXT 0x2033
#define WGL_PBUFFER_WIDTH_EXT 0x2034
#define WGL_PBUFFER_HEIGHT_EXT 0x2035

DECLARE_HANDLE(HPBUFFEREXT);

typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);

#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT)
#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT)
#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT)
#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT)
#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT)

#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer)

#endif /* WGL_EXT_pbuffer */

/* -------------------------- WGL_EXT_pixel_format ------------------------- */

#ifndef WGL_EXT_pixel_format
#define WGL_EXT_pixel_format 1

#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
#define WGL_ACCELERATION_EXT 0x2003
#define WGL_NEED_PALETTE_EXT 0x2004
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
#define WGL_SWAP_METHOD_EXT 0x2007
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
#define WGL_TRANSPARENT_EXT 0x200A
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
#define WGL_SHARE_DEPTH_EXT 0x200C
#define WGL_SHARE_STENCIL_EXT 0x200D
#define WGL_SHARE_ACCUM_EXT 0x200E
#define WGL_SUPPORT_GDI_EXT 0x200F
#define WGL_SUPPORT_OPENGL_EXT 0x2010
#define WGL_DOUBLE_BUFFER_EXT 0x2011
#define WGL_STEREO_EXT 0x2012
#define WGL_PIXEL_TYPE_EXT 0x2013
#define WGL_COLOR_BITS_EXT 0x2014
#define WGL_RED_BITS_EXT 0x2015
#define WGL_RED_SHIFT_EXT 0x2016
#define WGL_GREEN_BITS_EXT 0x2017
#define WGL_GREEN_SHIFT_EXT 0x2018
#define WGL_BLUE_BITS_EXT 0x2019
#define WGL_BLUE_SHIFT_EXT 0x201A
#define WGL_ALPHA_BITS_EXT 0x201B
#define WGL_ALPHA_SHIFT_EXT 0x201C
#define WGL_ACCUM_BITS_EXT 0x201D
#define WGL_ACCUM_RED_BITS_EXT 0x201E
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
#define WGL_DEPTH_BITS_EXT 0x2022
#define WGL_STENCIL_BITS_EXT 0x2023
#define WGL_AUX_BUFFERS_EXT 0x2024
#define WGL_NO_ACCELERATION_EXT 0x2025
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
#define WGL_FULL_ACCELERATION_EXT 0x2027
#define WGL_SWAP_EXCHANGE_EXT 0x2028
#define WGL_SWAP_COPY_EXT 0x2029
#define WGL_SWAP_UNDEFINED_EXT 0x202A
#define WGL_TYPE_RGBA_EXT 0x202B
#define WGL_TYPE_COLORINDEX_EXT 0x202C

typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);

#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT)
#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT)
#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT)

#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format)

#endif /* WGL_EXT_pixel_format */

/* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */

#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_EXT_pixel_format_packed_float 1

#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8

#define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float)

#endif /* WGL_EXT_pixel_format_packed_float */

/* -------------------------- WGL_EXT_swap_control ------------------------- */

#ifndef WGL_EXT_swap_control
#define WGL_EXT_swap_control 1

typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);

#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT)
#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT)

#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control)

#endif /* WGL_EXT_swap_control */

/* ----------------------- WGL_EXT_swap_control_tear ----------------------- */

#ifndef WGL_EXT_swap_control_tear
#define WGL_EXT_swap_control_tear 1

#define WGLEW_EXT_swap_control_tear WGLEW_GET_VAR(__WGLEW_EXT_swap_control_tear)

#endif /* WGL_EXT_swap_control_tear */

/* --------------------- WGL_I3D_digital_video_control --------------------- */

#ifndef WGL_I3D_digital_video_control
#define WGL_I3D_digital_video_control 1

#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053

typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);

#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D)
#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D)

#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control)

#endif /* WGL_I3D_digital_video_control */

/* ----------------------------- WGL_I3D_gamma ----------------------------- */

#ifndef WGL_I3D_gamma
#define WGL_I3D_gamma 1

#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F

typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue);
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);

#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D)
#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D)
#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D)
#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D)

#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma)

#endif /* WGL_I3D_gamma */

/* ---------------------------- WGL_I3D_genlock ---------------------------- */

#ifndef WGL_I3D_genlock
#define WGL_I3D_genlock 1

#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C

typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource);
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag);
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay);

#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D)
#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D)
#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D)
#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D)
#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D)
#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D)
#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D)
#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D)
#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D)
#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D)
#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D)
#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D)

#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock)

#endif /* WGL_I3D_genlock */

/* -------------------------- WGL_I3D_image_buffer ------------------------- */

#ifndef WGL_I3D_image_buffer
#define WGL_I3D_image_buffer 1

#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002

typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count);
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count);

#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D)
#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D)
#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D)
#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D)

#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer)

#endif /* WGL_I3D_image_buffer */

/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */

#ifndef WGL_I3D_swap_frame_lock
#define WGL_I3D_swap_frame_lock 1

typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID);
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID);
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag);

#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D)
#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D)
#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D)
#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D)

#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock)

#endif /* WGL_I3D_swap_frame_lock */

/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */

#ifndef WGL_I3D_swap_frame_usage
#define WGL_I3D_swap_frame_usage 1

typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);

#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D)
#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D)
#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D)
#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D)

#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage)

#endif /* WGL_I3D_swap_frame_usage */

/* --------------------------- WGL_NV_DX_interop --------------------------- */

#ifndef WGL_NV_DX_interop
#define WGL_NV_DX_interop 1

#define WGL_ACCESS_READ_ONLY_NV 0x0000
#define WGL_ACCESS_READ_WRITE_NV 0x0001
#define WGL_ACCESS_WRITE_DISCARD_NV 0x0002

typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void* dxDevice);
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void* dxObject, GLuint name, GLenum type, GLenum access);
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void* dxObject, HANDLE shareHandle);
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE* hObjects);
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);

#define wglDXCloseDeviceNV WGLEW_GET_FUN(__wglewDXCloseDeviceNV)
#define wglDXLockObjectsNV WGLEW_GET_FUN(__wglewDXLockObjectsNV)
#define wglDXObjectAccessNV WGLEW_GET_FUN(__wglewDXObjectAccessNV)
#define wglDXOpenDeviceNV WGLEW_GET_FUN(__wglewDXOpenDeviceNV)
#define wglDXRegisterObjectNV WGLEW_GET_FUN(__wglewDXRegisterObjectNV)
#define wglDXSetResourceShareHandleNV WGLEW_GET_FUN(__wglewDXSetResourceShareHandleNV)
#define wglDXUnlockObjectsNV WGLEW_GET_FUN(__wglewDXUnlockObjectsNV)
#define wglDXUnregisterObjectNV WGLEW_GET_FUN(__wglewDXUnregisterObjectNV)

#define WGLEW_NV_DX_interop WGLEW_GET_VAR(__WGLEW_NV_DX_interop)

#endif /* WGL_NV_DX_interop */

/* --------------------------- WGL_NV_DX_interop2 -------------------------- */

#ifndef WGL_NV_DX_interop2
#define WGL_NV_DX_interop2 1

#define WGLEW_NV_DX_interop2 WGLEW_GET_VAR(__WGLEW_NV_DX_interop2)

#endif /* WGL_NV_DX_interop2 */

/* --------------------------- WGL_NV_copy_image --------------------------- */

#ifndef WGL_NV_copy_image
#define WGL_NV_copy_image 1

typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);

#define wglCopyImageSubDataNV WGLEW_GET_FUN(__wglewCopyImageSubDataNV)

#define WGLEW_NV_copy_image WGLEW_GET_VAR(__WGLEW_NV_copy_image)

#endif /* WGL_NV_copy_image */

/* -------------------------- WGL_NV_float_buffer -------------------------- */

#ifndef WGL_NV_float_buffer
#define WGL_NV_float_buffer 1

#define WGL_FLOAT_COMPONENTS_NV 0x20B0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8

#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer)

#endif /* WGL_NV_float_buffer */

/* -------------------------- WGL_NV_gpu_affinity -------------------------- */

#ifndef WGL_NV_gpu_affinity
#define WGL_NV_gpu_affinity 1

#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1

DECLARE_HANDLE(HGPUNV);
typedef struct _GPU_DEVICE {
  DWORD cb; 
  CHAR DeviceName[32]; 
  CHAR DeviceString[128]; 
  DWORD Flags; 
  RECT rcVirtualScreen; 
} GPU_DEVICE, *PGPU_DEVICE;

typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);

#define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV)
#define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV)
#define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV)
#define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV)
#define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV)

#define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity)

#endif /* WGL_NV_gpu_affinity */

/* ---------------------- WGL_NV_multisample_coverage ---------------------- */

#ifndef WGL_NV_multisample_coverage
#define WGL_NV_multisample_coverage 1

#define WGL_COVERAGE_SAMPLES_NV 0x2042
#define WGL_COLOR_SAMPLES_NV 0x20B9

#define WGLEW_NV_multisample_coverage WGLEW_GET_VAR(__WGLEW_NV_multisample_coverage)

#endif /* WGL_NV_multisample_coverage */

/* -------------------------- WGL_NV_present_video ------------------------- */

#ifndef WGL_NV_present_video
#define WGL_NV_present_video 1

#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0

DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);

typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDc, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int* piAttribList);
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDc, HVIDEOOUTPUTDEVICENV* phDeviceList);
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int* piValue);

#define wglBindVideoDeviceNV WGLEW_GET_FUN(__wglewBindVideoDeviceNV)
#define wglEnumerateVideoDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoDevicesNV)
#define wglQueryCurrentContextNV WGLEW_GET_FUN(__wglewQueryCurrentContextNV)

#define WGLEW_NV_present_video WGLEW_GET_VAR(__WGLEW_NV_present_video)

#endif /* WGL_NV_present_video */

/* ---------------------- WGL_NV_render_depth_texture ---------------------- */

#ifndef WGL_NV_render_depth_texture
#define WGL_NV_render_depth_texture 1

#define WGL_NO_TEXTURE_ARB 0x2077
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
#define WGL_DEPTH_COMPONENT_NV 0x20A7

#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture)

#endif /* WGL_NV_render_depth_texture */

/* -------------------- WGL_NV_render_texture_rectangle -------------------- */

#ifndef WGL_NV_render_texture_rectangle
#define WGL_NV_render_texture_rectangle 1

#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2

#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle)

#endif /* WGL_NV_render_texture_rectangle */

/* --------------------------- WGL_NV_swap_group --------------------------- */

#ifndef WGL_NV_swap_group
#define WGL_NV_swap_group 1

typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint* count);
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint* maxGroups, GLuint *maxBarriers);
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint* group, GLuint *barrier);
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);

#define wglBindSwapBarrierNV WGLEW_GET_FUN(__wglewBindSwapBarrierNV)
#define wglJoinSwapGroupNV WGLEW_GET_FUN(__wglewJoinSwapGroupNV)
#define wglQueryFrameCountNV WGLEW_GET_FUN(__wglewQueryFrameCountNV)
#define wglQueryMaxSwapGroupsNV WGLEW_GET_FUN(__wglewQueryMaxSwapGroupsNV)
#define wglQuerySwapGroupNV WGLEW_GET_FUN(__wglewQuerySwapGroupNV)
#define wglResetFrameCountNV WGLEW_GET_FUN(__wglewResetFrameCountNV)

#define WGLEW_NV_swap_group WGLEW_GET_VAR(__WGLEW_NV_swap_group)

#endif /* WGL_NV_swap_group */

/* ----------------------- WGL_NV_vertex_array_range ----------------------- */

#ifndef WGL_NV_vertex_array_range
#define WGL_NV_vertex_array_range 1

typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);

#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV)
#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV)

#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range)

#endif /* WGL_NV_vertex_array_range */

/* -------------------------- WGL_NV_video_capture ------------------------- */

#ifndef WGL_NV_video_capture
#define WGL_NV_video_capture 1

#define WGL_UNIQUE_ID_NV 0x20CE
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF

DECLARE_HANDLE(HVIDEOINPUTDEVICENV);

typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV* phDeviceList);
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int* piValue);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);

#define wglBindVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewBindVideoCaptureDeviceNV)
#define wglEnumerateVideoCaptureDevicesNV WGLEW_GET_FUN(__wglewEnumerateVideoCaptureDevicesNV)
#define wglLockVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewLockVideoCaptureDeviceNV)
#define wglQueryVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewQueryVideoCaptureDeviceNV)
#define wglReleaseVideoCaptureDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoCaptureDeviceNV)

#define WGLEW_NV_video_capture WGLEW_GET_VAR(__WGLEW_NV_video_capture)

#endif /* WGL_NV_video_capture */

/* -------------------------- WGL_NV_video_output -------------------------- */

#ifndef WGL_NV_video_output
#define WGL_NV_video_output 1

#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
#define WGL_VIDEO_OUT_FRAME 0x20C8
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC

DECLARE_HANDLE(HPVIDEODEV);

typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV* hVideoDevice);
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long* pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long* pulCounterPbuffer, BOOL bBlock);

#define wglBindVideoImageNV WGLEW_GET_FUN(__wglewBindVideoImageNV)
#define wglGetVideoDeviceNV WGLEW_GET_FUN(__wglewGetVideoDeviceNV)
#define wglGetVideoInfoNV WGLEW_GET_FUN(__wglewGetVideoInfoNV)
#define wglReleaseVideoDeviceNV WGLEW_GET_FUN(__wglewReleaseVideoDeviceNV)
#define wglReleaseVideoImageNV WGLEW_GET_FUN(__wglewReleaseVideoImageNV)
#define wglSendPbufferToVideoNV WGLEW_GET_FUN(__wglewSendPbufferToVideoNV)

#define WGLEW_NV_video_output WGLEW_GET_VAR(__WGLEW_NV_video_output)

#endif /* WGL_NV_video_output */

/* -------------------------- WGL_OML_sync_control ------------------------- */

#ifndef WGL_OML_sync_control
#define WGL_OML_sync_control 1

typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator);
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc);
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc);

#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML)
#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML)
#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML)
#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML)
#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML)
#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML)

#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control)

#endif /* WGL_OML_sync_control */

/* ------------------------------------------------------------------------- */

#ifdef GLEW_MX
#define WGLEW_FUN_EXPORT
#define WGLEW_VAR_EXPORT
#else
#define WGLEW_FUN_EXPORT GLEW_FUN_EXPORT
#define WGLEW_VAR_EXPORT GLEW_VAR_EXPORT
#endif /* GLEW_MX */

#ifdef GLEW_MX
struct WGLEWContextStruct
{
#endif /* GLEW_MX */

WGLEW_FUN_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL;

WGLEW_FUN_EXPORT PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC __wglewBlitContextFramebufferAMD;
WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC __wglewCreateAssociatedContextAMD;
WGLEW_FUN_EXPORT PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC __wglewCreateAssociatedContextAttribsAMD;
WGLEW_FUN_EXPORT PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC __wglewDeleteAssociatedContextAMD;
WGLEW_FUN_EXPORT PFNWGLGETCONTEXTGPUIDAMDPROC __wglewGetContextGPUIDAMD;
WGLEW_FUN_EXPORT PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC __wglewGetCurrentAssociatedContextAMD;
WGLEW_FUN_EXPORT PFNWGLGETGPUIDSAMDPROC __wglewGetGPUIDsAMD;
WGLEW_FUN_EXPORT PFNWGLGETGPUINFOAMDPROC __wglewGetGPUInfoAMD;
WGLEW_FUN_EXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC __wglewMakeAssociatedContextCurrentAMD;

WGLEW_FUN_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB;
WGLEW_FUN_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB;
WGLEW_FUN_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB;
WGLEW_FUN_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB;

WGLEW_FUN_EXPORT PFNWGLCREATECONTEXTATTRIBSARBPROC __wglewCreateContextAttribsARB;

WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB;

WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB;
WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB;

WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB;
WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB;
WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB;
WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB;
WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB;

WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB;
WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB;
WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB;

WGLEW_FUN_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB;
WGLEW_FUN_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB;
WGLEW_FUN_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB;

WGLEW_FUN_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT;
WGLEW_FUN_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT;
WGLEW_FUN_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT;
WGLEW_FUN_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT;

WGLEW_FUN_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT;

WGLEW_FUN_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT;
WGLEW_FUN_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT;

WGLEW_FUN_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT;
WGLEW_FUN_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT;
WGLEW_FUN_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT;
WGLEW_FUN_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT;
WGLEW_FUN_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT;

WGLEW_FUN_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT;
WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT;
WGLEW_FUN_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT;

WGLEW_FUN_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT;
WGLEW_FUN_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT;

WGLEW_FUN_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D;
WGLEW_FUN_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D;

WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D;
WGLEW_FUN_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D;
WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D;
WGLEW_FUN_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D;

WGLEW_FUN_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D;
WGLEW_FUN_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D;
WGLEW_FUN_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D;
WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D;
WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D;
WGLEW_FUN_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D;
WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D;
WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D;
WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D;
WGLEW_FUN_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D;
WGLEW_FUN_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D;
WGLEW_FUN_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D;

WGLEW_FUN_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D;
WGLEW_FUN_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D;
WGLEW_FUN_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D;
WGLEW_FUN_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D;

WGLEW_FUN_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D;
WGLEW_FUN_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D;
WGLEW_FUN_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D;
WGLEW_FUN_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D;

WGLEW_FUN_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D;
WGLEW_FUN_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D;
WGLEW_FUN_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D;
WGLEW_FUN_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D;

WGLEW_FUN_EXPORT PFNWGLDXCLOSEDEVICENVPROC __wglewDXCloseDeviceNV;
WGLEW_FUN_EXPORT PFNWGLDXLOCKOBJECTSNVPROC __wglewDXLockObjectsNV;
WGLEW_FUN_EXPORT PFNWGLDXOBJECTACCESSNVPROC __wglewDXObjectAccessNV;
WGLEW_FUN_EXPORT PFNWGLDXOPENDEVICENVPROC __wglewDXOpenDeviceNV;
WGLEW_FUN_EXPORT PFNWGLDXREGISTEROBJECTNVPROC __wglewDXRegisterObjectNV;
WGLEW_FUN_EXPORT PFNWGLDXSETRESOURCESHAREHANDLENVPROC __wglewDXSetResourceShareHandleNV;
WGLEW_FUN_EXPORT PFNWGLDXUNLOCKOBJECTSNVPROC __wglewDXUnlockObjectsNV;
WGLEW_FUN_EXPORT PFNWGLDXUNREGISTEROBJECTNVPROC __wglewDXUnregisterObjectNV;

WGLEW_FUN_EXPORT PFNWGLCOPYIMAGESUBDATANVPROC __wglewCopyImageSubDataNV;

WGLEW_FUN_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV;
WGLEW_FUN_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV;
WGLEW_FUN_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV;
WGLEW_FUN_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV;
WGLEW_FUN_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV;

WGLEW_FUN_EXPORT PFNWGLBINDVIDEODEVICENVPROC __wglewBindVideoDeviceNV;
WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEODEVICESNVPROC __wglewEnumerateVideoDevicesNV;
WGLEW_FUN_EXPORT PFNWGLQUERYCURRENTCONTEXTNVPROC __wglewQueryCurrentContextNV;

WGLEW_FUN_EXPORT PFNWGLBINDSWAPBARRIERNVPROC __wglewBindSwapBarrierNV;
WGLEW_FUN_EXPORT PFNWGLJOINSWAPGROUPNVPROC __wglewJoinSwapGroupNV;
WGLEW_FUN_EXPORT PFNWGLQUERYFRAMECOUNTNVPROC __wglewQueryFrameCountNV;
WGLEW_FUN_EXPORT PFNWGLQUERYMAXSWAPGROUPSNVPROC __wglewQueryMaxSwapGroupsNV;
WGLEW_FUN_EXPORT PFNWGLQUERYSWAPGROUPNVPROC __wglewQuerySwapGroupNV;
WGLEW_FUN_EXPORT PFNWGLRESETFRAMECOUNTNVPROC __wglewResetFrameCountNV;

WGLEW_FUN_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV;
WGLEW_FUN_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV;

WGLEW_FUN_EXPORT PFNWGLBINDVIDEOCAPTUREDEVICENVPROC __wglewBindVideoCaptureDeviceNV;
WGLEW_FUN_EXPORT PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC __wglewEnumerateVideoCaptureDevicesNV;
WGLEW_FUN_EXPORT PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC __wglewLockVideoCaptureDeviceNV;
WGLEW_FUN_EXPORT PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC __wglewQueryVideoCaptureDeviceNV;
WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC __wglewReleaseVideoCaptureDeviceNV;

WGLEW_FUN_EXPORT PFNWGLBINDVIDEOIMAGENVPROC __wglewBindVideoImageNV;
WGLEW_FUN_EXPORT PFNWGLGETVIDEODEVICENVPROC __wglewGetVideoDeviceNV;
WGLEW_FUN_EXPORT PFNWGLGETVIDEOINFONVPROC __wglewGetVideoInfoNV;
WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEODEVICENVPROC __wglewReleaseVideoDeviceNV;
WGLEW_FUN_EXPORT PFNWGLRELEASEVIDEOIMAGENVPROC __wglewReleaseVideoImageNV;
WGLEW_FUN_EXPORT PFNWGLSENDPBUFFERTOVIDEONVPROC __wglewSendPbufferToVideoNV;

WGLEW_FUN_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML;
WGLEW_FUN_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML;
WGLEW_FUN_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML;
WGLEW_FUN_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML;
WGLEW_FUN_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML;
WGLEW_FUN_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML;
WGLEW_VAR_EXPORT GLboolean __WGLEW_3DFX_multisample;
WGLEW_VAR_EXPORT GLboolean __WGLEW_3DL_stereo_control;
WGLEW_VAR_EXPORT GLboolean __WGLEW_AMD_gpu_association;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_buffer_region;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_profile;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_create_context_robustness;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_extensions_string;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_framebuffer_sRGB;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_make_current_read;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_multisample;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pbuffer;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_pixel_format_float;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ARB_render_texture;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_pixel_format_float;
WGLEW_VAR_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_create_context_es2_profile;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_depth_float;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_display_color_table;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_extensions_string;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_make_current_read;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_multisample;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pbuffer;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control;
WGLEW_VAR_EXPORT GLboolean __WGLEW_EXT_swap_control_tear;
WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_digital_video_control;
WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_gamma;
WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_genlock;
WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_image_buffer;
WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock;
WGLEW_VAR_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_DX_interop2;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_copy_image;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_float_buffer;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_gpu_affinity;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_multisample_coverage;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_present_video;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_depth_texture;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_swap_group;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_vertex_array_range;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_capture;
WGLEW_VAR_EXPORT GLboolean __WGLEW_NV_video_output;
WGLEW_VAR_EXPORT GLboolean __WGLEW_OML_sync_control;

#ifdef GLEW_MX
}; /* WGLEWContextStruct */
#endif /* GLEW_MX */

/* ------------------------------------------------------------------------- */

#ifdef GLEW_MX

typedef struct WGLEWContextStruct WGLEWContext;
GLEWAPI GLenum GLEWAPIENTRY wglewContextInit (WGLEWContext *ctx);
GLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx, const char *name);

#define wglewInit() wglewContextInit(wglewGetContext())
#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x)

#define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x))
#define WGLEW_GET_FUN(x) wglewGetContext()->x

#else /* GLEW_MX */

#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x)
#define WGLEW_GET_FUN(x) x

GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);

#endif /* GLEW_MX */

GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name);

#ifdef __cplusplus
}
#endif

#undef GLEWAPI

#endif /* __wglew_h__ */

Added source/lua/hello.lua.











>
>
>
>
>
1
2
3
4
5
print("Hello world!");

function foo()
		 print("Hi I am the foo function!");
end

Added source/lua/lauxlib.h.









































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*
** $Id: lauxlib.h,v 1.120 2011/11/29 15:55:08 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/


#ifndef lauxlib_h
#define lauxlib_h


#include <stddef.h>
#include <stdio.h>

#include "lua.h"



/* extra error code for `luaL_load' */
#define LUA_ERRFILE     (LUA_ERRERR+1)


typedef struct luaL_Reg {
  const char *name;
  lua_CFunction func;
} luaL_Reg;


LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver);
#define luaL_checkversion(L)	luaL_checkversion_(L, LUA_VERSION_NUM)

LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len);
LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
                                                          size_t *l);
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
                                          const char *def, size_t *l);
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);

LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
                                          lua_Integer def);
LUALIB_API lua_Unsigned (luaL_checkunsigned) (lua_State *L, int numArg);
LUALIB_API lua_Unsigned (luaL_optunsigned) (lua_State *L, int numArg,
                                            lua_Unsigned def);

LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
LUALIB_API void (luaL_checkany) (lua_State *L, int narg);

LUALIB_API int   (luaL_newmetatable) (lua_State *L, const char *tname);
LUALIB_API void  (luaL_setmetatable) (lua_State *L, const char *tname);
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);

LUALIB_API void (luaL_where) (lua_State *L, int lvl);
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);

LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
                                   const char *const lst[]);

LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname);
LUALIB_API int (luaL_execresult) (lua_State *L, int stat);

/* pre-defined references */
#define LUA_NOREF       (-2)
#define LUA_REFNIL      (-1)

LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);

LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
                                               const char *mode);

#define luaL_loadfile(L,f)	luaL_loadfilex(L,f,NULL)

LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
                                   const char *name, const char *mode);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);

LUALIB_API lua_State *(luaL_newstate) (void);

LUALIB_API int (luaL_len) (lua_State *L, int idx);

LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
                                                  const char *r);

LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);

LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname);

LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1,
                                  const char *msg, int level);

LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
                                 lua_CFunction openf, int glb);

/*
** ===============================================================
** some useful macros
** ===============================================================
*/


#define luaL_newlibtable(L,l)	\
  lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)

#define luaL_newlib(L,l)	(luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))

#define luaL_argcheck(L, cond,numarg,extramsg)	\
		((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
#define luaL_checkstring(L,n)	(luaL_checklstring(L, (n), NULL))
#define luaL_optstring(L,n,d)	(luaL_optlstring(L, (n), (d), NULL))
#define luaL_checkint(L,n)	((int)luaL_checkinteger(L, (n)))
#define luaL_optint(L,n,d)	((int)luaL_optinteger(L, (n), (d)))
#define luaL_checklong(L,n)	((long)luaL_checkinteger(L, (n)))
#define luaL_optlong(L,n,d)	((long)luaL_optinteger(L, (n), (d)))

#define luaL_typename(L,i)	lua_typename(L, lua_type(L,(i)))

#define luaL_dofile(L, fn) \
	(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))

#define luaL_dostring(L, s) \
	(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))

#define luaL_getmetatable(L,n)	(lua_getfield(L, LUA_REGISTRYINDEX, (n)))

#define luaL_opt(L,f,n,d)	(lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))

#define luaL_loadbuffer(L,s,sz,n)	luaL_loadbufferx(L,s,sz,n,NULL)


/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/

typedef struct luaL_Buffer {
  char *b;  /* buffer address */
  size_t size;  /* buffer size */
  size_t n;  /* number of characters in buffer */
  lua_State *L;
  char initb[LUAL_BUFFERSIZE];  /* initial buffer */
} luaL_Buffer;


#define luaL_addchar(B,c) \
  ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
   ((B)->b[(B)->n++] = (c)))

#define luaL_addsize(B,s)	((B)->n += (s))

LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz);
LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);

#define luaL_prepbuffer(B)	luaL_prepbuffsize(B, LUAL_BUFFERSIZE)

/* }====================================================== */



/*
** {======================================================
** File handles for IO library
** =======================================================
*/

/*
** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
** initial structure 'luaL_Stream' (it may contain other fields
** after that initial structure).
*/

#define LUA_FILEHANDLE          "FILE*"


typedef struct luaL_Stream {
  FILE *f;  /* stream (NULL for incompletely created streams) */
  lua_CFunction closef;  /* to close stream (NULL for closed streams) */
} luaL_Stream;

/* }====================================================== */



/* compatibility with old module system */
#if defined(LUA_COMPAT_MODULE)

LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
                                   int sizehint);
LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
                                const luaL_Reg *l, int nup);

#define luaL_register(L,n,l)	(luaL_openlib(L,(n),(l),0))

#endif


#endif


Added source/lua/lua.h.















































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
/*
** $Id: lua.h,v 1.283 2012/04/20 13:18:26 roberto Exp $
** Lua - A Scripting Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
*/


#ifndef lua_h
#define lua_h

#include <stdarg.h>
#include <stddef.h>


#include "luaconf.h"


#define LUA_VERSION_MAJOR	"5"
#define LUA_VERSION_MINOR	"2"
#define LUA_VERSION_NUM		502
#define LUA_VERSION_RELEASE	"1"

#define LUA_VERSION	"Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
#define LUA_RELEASE	LUA_VERSION "." LUA_VERSION_RELEASE
#define LUA_COPYRIGHT	LUA_RELEASE "  Copyright (C) 1994-2012 Lua.org, PUC-Rio"
#define LUA_AUTHORS	"R. Ierusalimschy, L. H. de Figueiredo, W. Celes"


/* mark for precompiled code ('<esc>Lua') */
#define LUA_SIGNATURE	"\033Lua"

/* option for multiple returns in 'lua_pcall' and 'lua_call' */
#define LUA_MULTRET	(-1)


/*
** pseudo-indices
*/
#define LUA_REGISTRYINDEX	LUAI_FIRSTPSEUDOIDX
#define lua_upvalueindex(i)	(LUA_REGISTRYINDEX - (i))


/* thread status */
#define LUA_OK		0
#define LUA_YIELD	1
#define LUA_ERRRUN	2
#define LUA_ERRSYNTAX	3
#define LUA_ERRMEM	4
#define LUA_ERRGCMM	5
#define LUA_ERRERR	6


typedef struct lua_State lua_State;

typedef int (*lua_CFunction) (lua_State *L);


/*
** functions that read/write blocks when loading/dumping Lua chunks
*/
typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);

typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);


/*
** prototype for memory-allocation functions
*/
typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);


/*
** basic types
*/
#define LUA_TNONE		(-1)

#define LUA_TNIL		0
#define LUA_TBOOLEAN		1
#define LUA_TLIGHTUSERDATA	2
#define LUA_TNUMBER		3
#define LUA_TSTRING		4
#define LUA_TTABLE		5
#define LUA_TFUNCTION		6
#define LUA_TUSERDATA		7
#define LUA_TTHREAD		8

#define LUA_NUMTAGS		9



/* minimum Lua stack available to a C function */
#define LUA_MINSTACK	20


/* predefined values in the registry */
#define LUA_RIDX_MAINTHREAD	1
#define LUA_RIDX_GLOBALS	2
#define LUA_RIDX_LAST		LUA_RIDX_GLOBALS


/* type of numbers in Lua */
typedef LUA_NUMBER lua_Number;


/* type for integer functions */
typedef LUA_INTEGER lua_Integer;

/* unsigned integer type */
typedef LUA_UNSIGNED lua_Unsigned;



/*
** generic extra include file
*/
#if defined(LUA_USER_H)
#include LUA_USER_H
#endif



/*
** state manipulation
*/
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
LUA_API void       (lua_close) (lua_State *L);
LUA_API lua_State *(lua_newthread) (lua_State *L);

LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);


LUA_API const lua_Number *(lua_version) (lua_State *L);


/*
** basic stack manipulation
*/
LUA_API int   (lua_absindex) (lua_State *L, int idx);
LUA_API int   (lua_gettop) (lua_State *L);
LUA_API void  (lua_settop) (lua_State *L, int idx);
LUA_API void  (lua_pushvalue) (lua_State *L, int idx);
LUA_API void  (lua_remove) (lua_State *L, int idx);
LUA_API void  (lua_insert) (lua_State *L, int idx);
LUA_API void  (lua_replace) (lua_State *L, int idx);
LUA_API void  (lua_copy) (lua_State *L, int fromidx, int toidx);
LUA_API int   (lua_checkstack) (lua_State *L, int sz);

LUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);


/*
** access functions (stack -> C)
*/

LUA_API int             (lua_isnumber) (lua_State *L, int idx);
LUA_API int             (lua_isstring) (lua_State *L, int idx);
LUA_API int             (lua_iscfunction) (lua_State *L, int idx);
LUA_API int             (lua_isuserdata) (lua_State *L, int idx);
LUA_API int             (lua_type) (lua_State *L, int idx);
LUA_API const char     *(lua_typename) (lua_State *L, int tp);

LUA_API lua_Number      (lua_tonumberx) (lua_State *L, int idx, int *isnum);
LUA_API lua_Integer     (lua_tointegerx) (lua_State *L, int idx, int *isnum);
LUA_API lua_Unsigned    (lua_tounsignedx) (lua_State *L, int idx, int *isnum);
LUA_API int             (lua_toboolean) (lua_State *L, int idx);
LUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);
LUA_API size_t          (lua_rawlen) (lua_State *L, int idx);
LUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);
LUA_API void	       *(lua_touserdata) (lua_State *L, int idx);
LUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);
LUA_API const void     *(lua_topointer) (lua_State *L, int idx);


/*
** Comparison and arithmetic functions
*/

#define LUA_OPADD	0	/* ORDER TM */
#define LUA_OPSUB	1
#define LUA_OPMUL	2
#define LUA_OPDIV	3
#define LUA_OPMOD	4
#define LUA_OPPOW	5
#define LUA_OPUNM	6

LUA_API void  (lua_arith) (lua_State *L, int op);

#define LUA_OPEQ	0
#define LUA_OPLT	1
#define LUA_OPLE	2

LUA_API int   (lua_rawequal) (lua_State *L, int idx1, int idx2);
LUA_API int   (lua_compare) (lua_State *L, int idx1, int idx2, int op);


/*
** push functions (C -> stack)
*/
LUA_API void        (lua_pushnil) (lua_State *L);
LUA_API void        (lua_pushnumber) (lua_State *L, lua_Number n);
LUA_API void        (lua_pushinteger) (lua_State *L, lua_Integer n);
LUA_API void        (lua_pushunsigned) (lua_State *L, lua_Unsigned n);
LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t l);
LUA_API const char *(lua_pushstring) (lua_State *L, const char *s);
LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
                                                      va_list argp);
LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
LUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
LUA_API void  (lua_pushboolean) (lua_State *L, int b);
LUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);
LUA_API int   (lua_pushthread) (lua_State *L);


/*
** get functions (Lua -> stack)
*/
LUA_API void  (lua_getglobal) (lua_State *L, const char *var);
LUA_API void  (lua_gettable) (lua_State *L, int idx);
LUA_API void  (lua_getfield) (lua_State *L, int idx, const char *k);
LUA_API void  (lua_rawget) (lua_State *L, int idx);
LUA_API void  (lua_rawgeti) (lua_State *L, int idx, int n);
LUA_API void  (lua_rawgetp) (lua_State *L, int idx, const void *p);
LUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);
LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
LUA_API int   (lua_getmetatable) (lua_State *L, int objindex);
LUA_API void  (lua_getuservalue) (lua_State *L, int idx);


/*
** set functions (stack -> Lua)
*/
LUA_API void  (lua_setglobal) (lua_State *L, const char *var);
LUA_API void  (lua_settable) (lua_State *L, int idx);
LUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);
LUA_API void  (lua_rawset) (lua_State *L, int idx);
LUA_API void  (lua_rawseti) (lua_State *L, int idx, int n);
LUA_API void  (lua_rawsetp) (lua_State *L, int idx, const void *p);
LUA_API int   (lua_setmetatable) (lua_State *L, int objindex);
LUA_API void  (lua_setuservalue) (lua_State *L, int idx);


/*
** 'load' and 'call' functions (load and run Lua code)
*/
LUA_API void  (lua_callk) (lua_State *L, int nargs, int nresults, int ctx,
                           lua_CFunction k);
#define lua_call(L,n,r)		lua_callk(L, (n), (r), 0, NULL)

LUA_API int   (lua_getctx) (lua_State *L, int *ctx);

LUA_API int   (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
                            int ctx, lua_CFunction k);
#define lua_pcall(L,n,r,f)	lua_pcallk(L, (n), (r), (f), 0, NULL)

LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
                                        const char *chunkname,
                                        const char *mode);

LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);


/*
** coroutine functions
*/
LUA_API int  (lua_yieldk) (lua_State *L, int nresults, int ctx,
                           lua_CFunction k);
#define lua_yield(L,n)		lua_yieldk(L, (n), 0, NULL)
LUA_API int  (lua_resume) (lua_State *L, lua_State *from, int narg);
LUA_API int  (lua_status) (lua_State *L);

/*
** garbage-collection function and options
*/

#define LUA_GCSTOP		0
#define LUA_GCRESTART		1
#define LUA_GCCOLLECT		2
#define LUA_GCCOUNT		3
#define LUA_GCCOUNTB		4
#define LUA_GCSTEP		5
#define LUA_GCSETPAUSE		6
#define LUA_GCSETSTEPMUL	7
#define LUA_GCSETMAJORINC	8
#define LUA_GCISRUNNING		9
#define LUA_GCGEN		10
#define LUA_GCINC		11

LUA_API int (lua_gc) (lua_State *L, int what, int data);


/*
** miscellaneous functions
*/

LUA_API int   (lua_error) (lua_State *L);

LUA_API int   (lua_next) (lua_State *L, int idx);

LUA_API void  (lua_concat) (lua_State *L, int n);
LUA_API void  (lua_len)    (lua_State *L, int idx);

LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
LUA_API void      (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);



/*
** ===============================================================
** some useful macros
** ===============================================================
*/

#define lua_tonumber(L,i)	lua_tonumberx(L,i,NULL)
#define lua_tointeger(L,i)	lua_tointegerx(L,i,NULL)
#define lua_tounsigned(L,i)	lua_tounsignedx(L,i,NULL)

#define lua_pop(L,n)		lua_settop(L, -(n)-1)

#define lua_newtable(L)		lua_createtable(L, 0, 0)

#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))

#define lua_pushcfunction(L,f)	lua_pushcclosure(L, (f), 0)

#define lua_isfunction(L,n)	(lua_type(L, (n)) == LUA_TFUNCTION)
#define lua_istable(L,n)	(lua_type(L, (n)) == LUA_TTABLE)
#define lua_islightuserdata(L,n)	(lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
#define lua_isnil(L,n)		(lua_type(L, (n)) == LUA_TNIL)
#define lua_isboolean(L,n)	(lua_type(L, (n)) == LUA_TBOOLEAN)
#define lua_isthread(L,n)	(lua_type(L, (n)) == LUA_TTHREAD)
#define lua_isnone(L,n)		(lua_type(L, (n)) == LUA_TNONE)
#define lua_isnoneornil(L, n)	(lua_type(L, (n)) <= 0)

#define lua_pushliteral(L, s)	\
	lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)

#define lua_pushglobaltable(L)  \
	lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS)

#define lua_tostring(L,i)	lua_tolstring(L, (i), NULL)



/*
** {======================================================================
** Debug API
** =======================================================================
*/


/*
** Event codes
*/
#define LUA_HOOKCALL	0
#define LUA_HOOKRET	1
#define LUA_HOOKLINE	2
#define LUA_HOOKCOUNT	3
#define LUA_HOOKTAILCALL 4


/*
** Event masks
*/
#define LUA_MASKCALL	(1 << LUA_HOOKCALL)
#define LUA_MASKRET	(1 << LUA_HOOKRET)
#define LUA_MASKLINE	(1 << LUA_HOOKLINE)
#define LUA_MASKCOUNT	(1 << LUA_HOOKCOUNT)

typedef struct lua_Debug lua_Debug;  /* activation record */


/* Functions to be called by the debugger in specific events */
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);


LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar);
LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n);
LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n);

LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n);
LUA_API void  (lua_upvaluejoin) (lua_State *L, int fidx1, int n1,
                                               int fidx2, int n2);

LUA_API int (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
LUA_API lua_Hook (lua_gethook) (lua_State *L);
LUA_API int (lua_gethookmask) (lua_State *L);
LUA_API int (lua_gethookcount) (lua_State *L);


struct lua_Debug {
  int event;
  const char *name;	/* (n) */
  const char *namewhat;	/* (n) 'global', 'local', 'field', 'method' */
  const char *what;	/* (S) 'Lua', 'C', 'main', 'tail' */
  const char *source;	/* (S) */
  int currentline;	/* (l) */
  int linedefined;	/* (S) */
  int lastlinedefined;	/* (S) */
  unsigned char nups;	/* (u) number of upvalues */
  unsigned char nparams;/* (u) number of parameters */
  char isvararg;        /* (u) */
  char istailcall;	/* (t) */
  char short_src[LUA_IDSIZE]; /* (S) */
  /* private part */
  struct CallInfo *i_ci;  /* active function */
};

/* }====================================================================== */


/******************************************************************************
* Copyright (C) 1994-2012 Lua.org, PUC-Rio.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* 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.
******************************************************************************/


#endif

Added source/lua/luaconf.h.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
/*
** $Id: luaconf.h,v 1.172 2012/05/11 14:14:42 roberto Exp $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/


#ifndef lconfig_h
#define lconfig_h

#include <limits.h>
#include <stddef.h>


/*
** ==================================================================
** Search for "@@" to find all configurable definitions.
** ===================================================================
*/


/*
@@ LUA_ANSI controls the use of non-ansi features.
** CHANGE it (define it) if you want Lua to avoid the use of any
** non-ansi feature or library.
*/
#if !defined(LUA_ANSI) && defined(__STRICT_ANSI__)
#define LUA_ANSI
#endif


#if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE)
#define LUA_WIN		/* enable goodies for regular Windows platforms */
#endif

#if defined(LUA_WIN)
#define LUA_DL_DLL
#define LUA_USE_AFORMAT		/* assume 'printf' handles 'aA' specifiers */
#endif



#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN		/* needs an extra library: -ldl */
#define LUA_USE_READLINE	/* needs some extra libraries */
#define LUA_USE_STRTODHEX	/* assume 'strtod' handles hexa formats */
#define LUA_USE_AFORMAT		/* assume 'printf' handles 'aA' specifiers */
#define LUA_USE_LONGLONG	/* assume support for long long */
#endif

#if defined(LUA_USE_MACOSX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN		/* does not need -ldl */
#define LUA_USE_READLINE	/* needs an extra library: -lreadline */
#define LUA_USE_STRTODHEX	/* assume 'strtod' handles hexa formats */
#define LUA_USE_AFORMAT		/* assume 'printf' handles 'aA' specifiers */
#define LUA_USE_LONGLONG	/* assume support for long long */
#endif



/*
@@ LUA_USE_POSIX includes all functionality listed as X/Open System
@* Interfaces Extension (XSI).
** CHANGE it (define it) if your system is XSI compatible.
*/
#if defined(LUA_USE_POSIX)
#define LUA_USE_MKSTEMP
#define LUA_USE_ISATTY
#define LUA_USE_POPEN
#define LUA_USE_ULONGJMP
#define LUA_USE_GMTIME_R
#endif



/*
@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
@* Lua libraries.
@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
@* C libraries.
** CHANGE them if your machine has a non-conventional directory
** hierarchy or if you want to install your libraries in
** non-conventional directories.
*/
#if defined(_WIN32)	/* { */
/*
** In Windows, any exclamation mark ('!') in the path is replaced by the
** path of the directory of the executable file of the current process.
*/
#define LUA_LDIR	"!\\lua\\"
#define LUA_CDIR	"!\\"
#define LUA_PATH_DEFAULT  \
		LUA_LDIR"?.lua;"  LUA_LDIR"?\\init.lua;" \
		LUA_CDIR"?.lua;"  LUA_CDIR"?\\init.lua;" ".\\?.lua"
#define LUA_CPATH_DEFAULT \
		LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll;" ".\\?.dll"

#else			/* }{ */

#define LUA_VDIR	LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/"
#define LUA_ROOT	"/usr/local/"
#define LUA_LDIR	LUA_ROOT "share/lua/" LUA_VDIR
#define LUA_CDIR	LUA_ROOT "lib/lua/" LUA_VDIR
#define LUA_PATH_DEFAULT  \
		LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
		LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" "./?.lua"
#define LUA_CPATH_DEFAULT \
		LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
#endif			/* } */


/*
@@ LUA_DIRSEP is the directory separator (for submodules).
** CHANGE it if your machine does not use "/" as the directory separator
** and is not Windows. (On Windows Lua automatically uses "\".)
*/
#if defined(_WIN32)
#define LUA_DIRSEP	"\\"
#else
#define LUA_DIRSEP	"/"
#endif


/*
@@ LUA_ENV is the name of the variable that holds the current
@@ environment, used to access global names.
** CHANGE it if you do not like this name.
*/
#define LUA_ENV		"_ENV"


/*
@@ LUA_API is a mark for all core API functions.
@@ LUALIB_API is a mark for all auxiliary library functions.
@@ LUAMOD_API is a mark for all standard library opening functions.
** CHANGE them if you need to define those functions in some special way.
** For instance, if you want to create one Windows DLL with the core and
** the libraries, you may want to use the following definition (define
** LUA_BUILD_AS_DLL to get it).
*/
#if defined(LUA_BUILD_AS_DLL)	/* { */

#if defined(LUA_CORE) || defined(LUA_LIB)	/* { */
#define LUA_API __declspec(dllexport)
#else						/* }{ */
#define LUA_API __declspec(dllimport)
#endif						/* } */

#else				/* }{ */

#define LUA_API		extern

#endif				/* } */


/* more often than not the libs go together with the core */
#define LUALIB_API	LUA_API
#define LUAMOD_API	LUALIB_API


/*
@@ LUAI_FUNC is a mark for all extern functions that are not to be
@* exported to outside modules.
@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables
@* that are not to be exported to outside modules (LUAI_DDEF for
@* definitions and LUAI_DDEC for declarations).
** CHANGE them if you need to mark them in some special way. Elf/gcc
** (versions 3.2 and later) mark them as "hidden" to optimize access
** when Lua is compiled as a shared library. Not all elf targets support
** this attribute. Unfortunately, gcc does not offer a way to check
** whether the target offers that support, and those without support
** give a warning about it. To avoid these warnings, change to the
** default definition.
*/
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
    defined(__ELF__)		/* { */
#define LUAI_FUNC	__attribute__((visibility("hidden"))) extern
#define LUAI_DDEC	LUAI_FUNC
#define LUAI_DDEF	/* empty */

#else				/* }{ */
#define LUAI_FUNC	extern
#define LUAI_DDEC	extern
#define LUAI_DDEF	/* empty */
#endif				/* } */



/*
@@ LUA_QL describes how error messages quote program elements.
** CHANGE it if you want a different appearance.
*/
#define LUA_QL(x)	"'" x "'"
#define LUA_QS		LUA_QL("%s")


/*
@@ LUA_IDSIZE gives the maximum size for the description of the source
@* of a function in debug information.
** CHANGE it if you want a different size.
*/
#define LUA_IDSIZE	60


/*
@@ luai_writestring/luai_writeline define how 'print' prints its results.
** They are only used in libraries and the stand-alone program. (The #if
** avoids including 'stdio.h' everywhere.)
*/
#if defined(LUA_LIB) || defined(lua_c)
#include <stdio.h>
#define luai_writestring(s,l)	fwrite((s), sizeof(char), (l), stdout)
#define luai_writeline()	(luai_writestring("\n", 1), fflush(stdout))
#endif

/*
@@ luai_writestringerror defines how to print error messages.
** (A format string with one argument is enough for Lua...)
*/
#define luai_writestringerror(s,p) \
	(fprintf(stderr, (s), (p)), fflush(stderr))


/*
@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is,
** strings that are internalized. (Cannot be smaller than reserved words
** or tags for metamethods, as these strings must be internalized;
** #("function") = 8, #("__newindex") = 10.)
*/
#define LUAI_MAXSHORTLEN        40



/*
** {==================================================================
** Compatibility with previous versions
** ===================================================================
*/

/*
@@ LUA_COMPAT_ALL controls all compatibility options.
** You can define it to get all options, or change specific options
** to fit your specific needs.
*/
#if defined(LUA_COMPAT_ALL)	/* { */

/*
@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'.
** You can replace it with 'table.unpack'.
*/
#define LUA_COMPAT_UNPACK

/*
@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'.
** You can replace it with 'package.searchers'.
*/
#define LUA_COMPAT_LOADERS

/*
@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall.
** You can call your C function directly (with light C functions).
*/
#define lua_cpcall(L,f,u)  \
	(lua_pushcfunction(L, (f)), \
	 lua_pushlightuserdata(L,(u)), \
	 lua_pcall(L,1,0,0))


/*
@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library.
** You can rewrite 'log10(x)' as 'log(x, 10)'.
*/
#define LUA_COMPAT_LOG10

/*
@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base
** library. You can rewrite 'loadstring(s)' as 'load(s)'.
*/
#define LUA_COMPAT_LOADSTRING

/*
@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library.
*/
#define LUA_COMPAT_MAXN

/*
@@ The following macros supply trivial compatibility for some
** changes in the API. The macros themselves document how to
** change your code to avoid using them.
*/
#define lua_strlen(L,i)		lua_rawlen(L, (i))

#define lua_objlen(L,i)		lua_rawlen(L, (i))

#define lua_equal(L,idx1,idx2)		lua_compare(L,(idx1),(idx2),LUA_OPEQ)
#define lua_lessthan(L,idx1,idx2)	lua_compare(L,(idx1),(idx2),LUA_OPLT)

/*
@@ LUA_COMPAT_MODULE controls compatibility with previous
** module functions 'module' (Lua) and 'luaL_register' (C).
*/
#define LUA_COMPAT_MODULE

#endif				/* } */

/* }================================================================== */



/*
@@ LUAI_BITSINT defines the number of bits in an int.
** CHANGE here if Lua cannot automatically detect the number of bits of
** your machine. Probably you do not need to change this.
*/
/* avoid overflows in comparison */
#if INT_MAX-20 < 32760		/* { */
#define LUAI_BITSINT	16
#elif INT_MAX > 2147483640L	/* }{ */
/* int has at least 32 bits */
#define LUAI_BITSINT	32
#else				/* }{ */
#error "you must define LUA_BITSINT with number of bits in an integer"
#endif				/* } */


/*
@@ LUA_INT32 is an signed integer with exactly 32 bits.
@@ LUAI_UMEM is an unsigned integer big enough to count the total
@* memory used by Lua.
@@ LUAI_MEM is a signed integer big enough to count the total memory
@* used by Lua.
** CHANGE here if for some weird reason the default definitions are not
** good enough for your machine. Probably you do not need to change
** this.
*/
#if LUAI_BITSINT >= 32		/* { */
#define LUA_INT32	int
#define LUAI_UMEM	size_t
#define LUAI_MEM	ptrdiff_t
#else				/* }{ */
/* 16-bit ints */
#define LUA_INT32	long
#define LUAI_UMEM	unsigned long
#define LUAI_MEM	long
#endif				/* } */


/*
@@ LUAI_MAXSTACK limits the size of the Lua stack.
** CHANGE it if you need a different limit. This limit is arbitrary;
** its only purpose is to stop Lua to consume unlimited stack
** space (and to reserve some numbers for pseudo-indices).
*/
#if LUAI_BITSINT >= 32
#define LUAI_MAXSTACK		1000000
#else
#define LUAI_MAXSTACK		15000
#endif

/* reserve some space for error handling */
#define LUAI_FIRSTPSEUDOIDX	(-LUAI_MAXSTACK - 1000)




/*
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
** CHANGE it if it uses too much C-stack space.
*/
#define LUAL_BUFFERSIZE		BUFSIZ




/*
** {==================================================================
@@ LUA_NUMBER is the type of numbers in Lua.
** CHANGE the following definitions only if you want to build Lua
** with a number type different from double. You may also need to
** change lua_number2int & lua_number2integer.
** ===================================================================
*/

#define LUA_NUMBER_DOUBLE
#define LUA_NUMBER	double

/*
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
@* over a number.
*/
#define LUAI_UACNUMBER	double


/*
@@ LUA_NUMBER_SCAN is the format for reading numbers.
@@ LUA_NUMBER_FMT is the format for writing numbers.
@@ lua_number2str converts a number to a string.
@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
*/
#define LUA_NUMBER_SCAN		"%lf"
#define LUA_NUMBER_FMT		"%.14g"
#define lua_number2str(s,n)	sprintf((s), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR	32 /* 16 digits, sign, point, and \0 */


/*
@@ lua_str2number converts a decimal numeric string to a number.
@@ lua_strx2number converts an hexadecimal numeric string to a number.
** In C99, 'strtod' do both conversions. C89, however, has no function
** to convert floating hexadecimal strings to numbers. For these
** systems, you can leave 'lua_strx2number' undefined and Lua will
** provide its own implementation.
*/
#define lua_str2number(s,p)	strtod((s), (p))

#if defined(LUA_USE_STRTODHEX)
#define lua_strx2number(s,p)	strtod((s), (p))
#endif


/*
@@ The luai_num* macros define the primitive operations over numbers.
*/

/* the following operations need the math library */
#if defined(lobject_c) || defined(lvm_c)
#include <math.h>
#define luai_nummod(L,a,b)	((a) - floor((a)/(b))*(b))
#define luai_numpow(L,a,b)	(pow(a,b))
#endif

/* these are quite standard operations */
#if defined(LUA_CORE)
#define luai_numadd(L,a,b)	((a)+(b))
#define luai_numsub(L,a,b)	((a)-(b))
#define luai_nummul(L,a,b)	((a)*(b))
#define luai_numdiv(L,a,b)	((a)/(b))
#define luai_numunm(L,a)	(-(a))
#define luai_numeq(a,b)		((a)==(b))
#define luai_numlt(L,a,b)	((a)<(b))
#define luai_numle(L,a,b)	((a)<=(b))
#define luai_numisnan(L,a)	(!luai_numeq((a), (a)))
#endif



/*
@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
** machines, ptrdiff_t gives a good choice between int or long.)
*/
#define LUA_INTEGER	ptrdiff_t

/*
@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned.
** It must have at least 32 bits.
*/
#define LUA_UNSIGNED	unsigned LUA_INT32



/*
** Some tricks with doubles
*/

#if defined(LUA_CORE) && \
    defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI)	/* { */
/*
** The next definitions activate some tricks to speed up the
** conversion from doubles to integer types, mainly to LUA_UNSIGNED.
**
@@ MS_ASMTRICK uses Microsoft assembler to avoid clashes with a
** DirectX idiosyncrasy.
**
@@ LUA_IEEE754TRICK uses a trick that should work on any machine
** using IEEE754 with a 32-bit integer type.
**
@@ LUA_IEEELL extends the trick to LUA_INTEGER; should only be
** defined when LUA_INTEGER is a 32-bit integer.
**
@@ LUA_IEEEENDIAN is the endianness of doubles in your machine
** (0 for little endian, 1 for big endian); if not defined, Lua will
** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK).
**
@@ LUA_NANTRICK controls the use of a trick to pack all types into
** a single double value, using NaN values to represent non-number
** values. The trick only works on 32-bit machines (ints and pointers
** are 32-bit values) with numbers represented as IEEE 754-2008 doubles
** with conventional endianess (12345678 or 87654321), in CPUs that do
** not produce signaling NaN values (all NaNs are quiet).
*/

/* Microsoft compiler on a Pentium (32 bit) ? */
#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86)	/* { */

#define MS_ASMTRICK
#define LUA_IEEEENDIAN		0
#define LUA_NANTRICK


/* pentium 32 bits? */
#elif defined(__i386__) || defined(__i386) || defined(__X86__) /* }{ */

#define LUA_IEEE754TRICK
#define LUA_IEEELL
#define LUA_IEEEENDIAN		0
#define LUA_NANTRICK

/* pentium 64 bits? */
#elif defined(__x86_64)						/* }{ */

#define LUA_IEEE754TRICK
#define LUA_IEEEENDIAN		0

#elif defined(__POWERPC__) || defined(__ppc__)			/* }{ */

#define LUA_IEEE754TRICK
#define LUA_IEEEENDIAN		1

#else								/* }{ */

/* assume IEEE754 and a 32-bit integer type */
#define LUA_IEEE754TRICK

#endif								/* } */

#endif							/* } */

/* }================================================================== */




/* =================================================================== */

/*
** Local configuration. You can use this space to add your redefinitions
** without modifying the main part of the file.
*/



#endif

Added source/lua/lualib.h.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
/*
** $Id: lualib.h,v 1.43 2011/12/08 12:11:37 roberto Exp $
** Lua standard libraries
** See Copyright Notice in lua.h
*/


#ifndef lualib_h
#define lualib_h

#include "lua.h"



LUAMOD_API int (luaopen_base) (lua_State *L);

#define LUA_COLIBNAME	"coroutine"
LUAMOD_API int (luaopen_coroutine) (lua_State *L);

#define LUA_TABLIBNAME	"table"
LUAMOD_API int (luaopen_table) (lua_State *L);

#define LUA_IOLIBNAME	"io"
LUAMOD_API int (luaopen_io) (lua_State *L);

#define LUA_OSLIBNAME	"os"
LUAMOD_API int (luaopen_os) (lua_State *L);

#define LUA_STRLIBNAME	"string"
LUAMOD_API int (luaopen_string) (lua_State *L);

#define LUA_BITLIBNAME	"bit32"
LUAMOD_API int (luaopen_bit32) (lua_State *L);

#define LUA_MATHLIBNAME	"math"
LUAMOD_API int (luaopen_math) (lua_State *L);

#define LUA_DBLIBNAME	"debug"
LUAMOD_API int (luaopen_debug) (lua_State *L);

#define LUA_LOADLIBNAME	"package"
LUAMOD_API int (luaopen_package) (lua_State *L);


/* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L);



#if !defined(lua_assert)
#define lua_assert(x)	((void)0)
#endif


#endif

Added source/objects/ObjectFilesGoHere.

Added source/test/minunit.h.











>
>
>
>
>
1
2
3
4
5
/* file: minunit.h */
#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
#define mu_run_test(test) do { char *message = test(); tests_run++;		\
							   if (message) return message; } while (0)
extern int tests_run;

Added source/test/test.c.



































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
#include <stdio.h>
#include "minunit.h"
#include "../core/LinkedList.h"
#include "../core/EntityManager.h"
#include "../core/Vector.h"
#include "../core/Quaternion.h"
#include "../core/Matrix.h"
#include "../core/Resource.h" //will break when i remove Resource_countChar
int tests_run = 0;

//create a ll
static char * test_createLL()
{
  printf("Running test_createLL...");
  linkedList_t * ll = NULL;
  ll = LinkedList_create();
  mu_assert("LinkedList create failed", ll != NULL);
  printf("pass\n");
  return 0;
}

//add element to ll and try to get it back
static char * test_add()
{
  printf("Running test_add...");
  linkedList_t * ll = NULL;
  ll = LinkedList_create();
  mu_assert("LinkedList create failed", ll != NULL);
  
  //link_t * link = (link_t *)malloc(sizeof(link_t)-1 + sizeof(int));
  link_t * link = LinkedList_createLink(sizeof(int), 0);
  int * x = (int *)&(link->payload);
  *x = 42;
  LinkedList_add(ll, link);
  
  link_t * link2 = LinkedList_getIndex(ll, 0);
  int * x2 = (int *)&(link2->payload);
  mu_assert("LL should contain {42}", *x2 == 42);  
  
  printf("pass\n");
  return 0;
}

//create ll, add elements, check size to make sure its correct,
//and get the various elements. Then remove a middle element and make
//sure the surrounding elements are the correct value (and the LL is
//correct size). finally destroy the list and check for memory leaks
//with an external program
static char * test_ll1()
{
  printf("Running test_ll1...");
  linkedList_t * ll = LinkedList_create();
  mu_assert("LinkedList create failed", ll != NULL);
  
  //link_t * linkx = (link_t *)malloc(sizeof(link)-1 + sizeof(int));
  link_t * linkx = LinkedList_createLink(sizeof(int), 0);
  int * x = (int *)&(linkx->payload);
  *x = 4;
  LinkedList_add(ll, linkx);
  mu_assert("LL should not be empty (size should be 1)", !LinkedList_isEmpty(ll));
  
  link_t * linky = LinkedList_createLink(sizeof(int), 0);
  int * y = (int *)&(linky->payload);
  *y = 8;
  LinkedList_add(ll, linky);
  mu_assert("LL should not be empty", !LinkedList_isEmpty(ll));
  
  mu_assert("LL should be size 2", LinkedList_size(ll) == 2);
  
  link_t * linkz = LinkedList_createLink(sizeof(int), 0);
  int * z = (int *)&(linkz->payload);
  *z = -5;
  LinkedList_add(ll, linkz);
  mu_assert("LL should not be empty", !LinkedList_isEmpty(ll));
  
  mu_assert("LL should be size 3", LinkedList_size(ll) == 3);
  
  link_t * l_y = LinkedList_getIndex(ll, 1);
  link_t * l_z = LinkedList_getIndex(ll, 2);
  link_t * l_x = LinkedList_getIndex(ll, 0);
  
  mu_assert("LL[1] should be 8", *(int *)l_y->payload == 8);
  mu_assert("LL[2] should be -5", *(int *)l_z->payload == -5);
  mu_assert("LL[0] should be 4", *(int *)l_x->payload == 4);
  
  //try to get OOB
  mu_assert("LinkedList_getIndex should return NULL on OOB", LinkedList_getIndex(ll, 3) == NULL);
  mu_assert("LinkedList_getIndex should return NULL on OOB", LinkedList_getIndex(ll, 51) == NULL);
  mu_assert("LinkedList_getIndex should return NULL on OOB", LinkedList_getIndex(ll, -5) == NULL);
  
  //remove a middle element, check size and validate index of surviving elements
  LinkedList_removeIndex(ll, 1);
  mu_assert("LL removed [1], should be size 2 now", LinkedList_size(ll) == 2);
  link_t * l_0 = LinkedList_getIndex(ll, 0);
  link_t * l_1 = LinkedList_getIndex(ll, 1);
  int * li_0 = (int *)&(l_0->payload);
  int * li_1 = (int *)&(l_1->payload);
  //mu_assert("LL[0] should be 4", *(int *)l_0->payload == 4);
  //mu_assert("LL[1] should be -5", *(int*)l_1->payload == -5);
  mu_assert("LL[0] should be 4", *li_0 == 4);
  mu_assert("LL[1] should be -5", *li_1 == -5);
  mu_assert("LL should not have anything for [2]", LinkedList_getIndex(ll, 2) == NULL);
  
  //destroy
  LinkedList_destroy(ll);
  //temp, failing until I check for memory leaks with gdb/valgrind
  //mu_assert("TODO: check for memory leaks", 0.99999 == 1);
  printf("pass\n");
  return 0;
}

static char * test_LLMemory()
{
  printf("Running test_LLMemory...\n");
  linkedList_t * ll = LinkedList_create();
  
  link_t * lx = LinkedList_createLink(sizeof(int), 0);
  int * x = (int *)&(lx->payload);
  *x = 4;
  LinkedList_add(ll, lx);
  
  link_t * ly = LinkedList_createLink(sizeof(int), 0);
  int * y = (int *)&(ly->payload);
  *y = 8;
  LinkedList_add(ll, ly);
  
  link_t * lz = LinkedList_createLink(sizeof(int), 0);
  int * z = (int *)&(lz->payload);
  *z = -5;
  LinkedList_add(ll, lz);
  
  //remove a middle element
  LinkedList_remove(ll, 1);
  
  link_t * la = LinkedList_createLink(sizeof(int), 0);
  int * a = (int *)&(la->payload);
  *a = 1001;
  LinkedList_add(ll, la);
  
  //destroy
  LinkedList_destroy(ll);
  //check for memory leaks
  return 0;
}

static char * test_EMMemory()
{
  printf("Running test_EMMemory...\n");
  EntityManager_create();
  
  EntityManager_createEntity();
  EntityManager_createEntity();
  int e = EntityManager_createEntity();
  EntityManager_createEntity();
  EntityManager_createEntity();
  EntityManager_removeEntity(e);
  EntityManager_createEntity();
  
  EntityManager_destroy();
  //check for memory leaks
  return 0;
}

static char * test_entityManagerNotCreated()
{
  printf("Running test_entityManagerNotCreated...");
  void * c;
  bool b;  
  int e;
  c = EntityManager_createComponent(5, 0);
  mu_assert("EntityManager_createComponent should return 0 on any op's before create", c == 0);
  b = EntityManager_containsEntity(0);
  mu_assert("EntityManager_containsEntity should return 0 on any op's before create", b == 0);
  e = EntityManager_createEntity();
  mu_assert("EntityManager_createEntity should return 0 on any op's before create", e == 0);
  e = EntityManager_createEntity();
  mu_assert("EntityManager_createEntity should return 0 on any op's before create", e == 0);
  e = EntityManager_createEntity();
  mu_assert("EntityManager_createEntity should return 0 on any op's before create", e == 0);
  
  EntityManager_destroy();
  printf("pass\n");
  return 0;
}

//create entity, see if EM contains it, remove entity, see if EM contains
static char * test_entityCreateAndQuery()
{
  int entity = 512;
  bool contains = false;
  printf("Running test_entityCreateAndQuery...");
  EntityManager_create();
  entity = EntityManager_createEntity();
  mu_assert("int entity was not assigned a new value", entity != 512);
  
  contains = EntityManager_containsEntity(entity);
  mu_assert("EntityManager should contain the entity", contains);
  
  EntityManager_createEntity();
  EntityManager_createEntity();
  EntityManager_createEntity();
  
  EntityManager_removeEntity(entity);
  contains = EntityManager_containsEntity(entity);
  mu_assert("EntityManager should not contain entity", !contains);

  EntityManager_destroy();  
  printf("pass\n");
  return 0;
}

static char * test_multipleEntity()
{
  int e[5];
  int i, j;
  bool unique;
  
  printf("Running test_multipleEntity...");
  EntityManager_create();
  
  for (i = 0; i < 5; i++)
	e[i] = EntityManager_createEntity();
  
  for (i = 0; i < 5; i++)
  {
	for (j = i+1; j < 5; j++)
	{
	  mu_assert("Entity id's are not unique", (e[i] != e[j]));
	}
  }
  
  EntityManager_destroy();
  printf("pass\n");
  return 0;
}

static char * test_emComponent()
{
  printf("Running test_emComponent...");
  EntityManager_create();
  int ent = EntityManager_createEntity();
  forceComp_t * force = EntityManager_createComponent(ent, ID_FORCE);

  mu_assert("Component creation failed", force != NULL);

  force->gravity = Vector_zero();
  force->gravity.y = -10.0f;

  forceComp_t * force2 = (forceComp_t *)EntityManager_getComponentFromEntity(ent, ID_FORCE);

  mu_assert("Component get failed", force2 != NULL);
  mu_assert("Retrieved force data incorrect (y == -10.0f)", force2->gravity.y == -10.0f);

  //remove entity and see if component is still there
  EntityManager_removeEntity(ent);
  void * v = EntityManager_getComponentFromEntity(ent, ID_FORCE);

  mu_assert("Force component should not exist", v == NULL);

  EntityManager_destroy();
  printf("pass\n");
  return 0;
}

static char * test_vector()
{
  printf("Running test_vector...");
  vector_t a, b, c;
  vector_t i, j, k;
  i.x = 1; j.x = 0; k.x = 0;
  i.y = 0; j.y = 1; k.y = 0;
  i.z = 0; j.z = 0; k.z = 1;
  
  a.x = 5.5f; b.x = -4;
  a.y = -1; b.y = 2;
  a.z = -4; b.z = 0.25;
  
  c = Vector_add(a, b);
  mu_assert("vector addition fail",c.x == 1.5f);
  mu_assert("vector addition fail",c.y == 1.0f);
  mu_assert("vector addition fail",c.z == -3.75f);
  
  c = Vector_subtract(a, b);
  mu_assert("vector subtraction fail",c.x == 9.5f);
  mu_assert("vector subtraction fail",c.y == -3.0f);
  mu_assert("vector subtraction fail",c.z == -4.25f);
  
  c = Vector_multiply(a, 3.0f);
  mu_assert("vector scalar multiply fail",c.x == 16.5f);
  mu_assert("vector scalar multiply fail",c.y == -3.0f);
  mu_assert("vector scalar multiply fail",c.z == -12.0f);
  
  c = Vector_zero();
  mu_assert("zero vector incorrectly assigned",c.x == 0.0f);
  mu_assert("zero vector incorrectly assigned",c.y == 0.0f);
  mu_assert("zero vector incorrectly assigned",c.z == 0.0f);
  
  c.x = 3.0f;
  c.y = 4.0f;
  c.z = 0.0f;
  mu_assert("vector length fail", Vector_magnitude(c) == 5.0f);
  
  a.x = 1; b.x = 4;
  a.y = 3; b.y = -2;
  a.z = -5; b.z = -1;
  mu_assert("vector dot product miscalc", Vector_dot(a, b) == 3.0f);
  
  a.x = 4;
  a.y = 0;
  a.z = 0;
  c = Vector_normalize(a);
  mu_assert("vector normalize didnt set length to 1", Vector_magnitude(c) == 1.0f);
  
  c = Vector_cross(i, j);
  mu_assert("vector cross fail, ij = k", c.x == k.x);
  mu_assert("vector cross fail, ij = k", c.y == k.y);
  mu_assert("vector cross fail, ij = k", c.z == k.z);
  
  c = Vector_cross(j, i);
  mu_assert("vector cross fail, ji = -k", c.x == -k.x);
  mu_assert("vector cross fail, ji = -k", c.y == -k.y);
  mu_assert("vector cross fail, ji = -k", c.z == -k.z);
  
  c = Vector_cross(j, k);
  mu_assert("vector cross fail, jk = i", c.x == i.x);
  mu_assert("vector cross fail, jk = i", c.y == i.y);
  mu_assert("vector cross fail, jk = i", c.z == i.z);
  
  c = Vector_cross(k, j);
  mu_assert("vector cross fail, kj = -i", c.x == -i.x);
  mu_assert("vector cross fail, kj = -i", c.y == -i.y);
  mu_assert("vector cross fail, kj = -i", c.z == -i.z);
  
  c = Vector_cross(k, i);
  mu_assert("vector cross fail, ki = j", c.x == j.x);
  mu_assert("vector cross fail, ki = j", c.y == j.y);
  mu_assert("vector cross fail, ki = j", c.z == j.z);
  
  c = Vector_cross(i, k);
  mu_assert("vector cross fail, ik = -j", c.x == -j.x);
  mu_assert("vector cross fail, ik = -j", c.y == -j.y);
  mu_assert("vector cross fail, ik = -j", c.z == -j.z);
  
  printf("pass\n");
  return 0;
}

//test functions related to io
static char * test_io()
{
  printf("Running test_io...");
  
  int thirty = Resource_countChar("testtextfile.script", "../source/test/");
  mu_assert("testtextfile.script has 30 chars", thirty == 30);
  
  script_t * script = loadScript("testtextfile.script", "../source/test/");
  mu_assert("script file not read correctly", strcmp(script->contents,
													 "this file has..\n30 characters!") == 0);
  
  printf("pass\n");
  return 0;
}

static char * test_stub()
{
  printf("Running test_stub...");
  printf("pass\n");
  return 0;
}

static char * test_run()
{
  mu_run_test(test_createLL);
  mu_run_test(test_add);
  mu_run_test(test_ll1);
  mu_run_test(test_entityManagerNotCreated);
  mu_run_test(test_entityCreateAndQuery);
  mu_run_test(test_multipleEntity);
  mu_run_test(test_emComponent);
  mu_run_test(test_LLMemory);
  mu_run_test(test_EMMemory);
  mu_run_test(test_vector);
  mu_run_test(test_io);
  return 0;
}

int main(int argc, char ** argv)
{
  char * result = test_run();
  if (result != 0)
  {
	printf("%s\n", result);
  }
  else
  {
	printf("ALL TESTS PASSED\n");
  }
  printf("Tests run: %d\n", tests_run);
  
  return result != 0;
}

Added source/test/testtextfile.script.





>
>
1
2
this file has..
30 characters!

Added source/test/tstate.c.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "tstate.h"
#include <stdio.h>

//todo; change to create/destroy to be consistent with the rest of the
//modules..
bool tstate_load()
{
  printf("tstate_load()\n");
  EntityManager_create();
  return true;
}

bool tstate_close()
{
  printf("tstate_close()\n");
  EntityManager_destroy();
  return true;
}

Added source/test/tstate.h.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
#ifndef __T_STATE_H__
#define __T_STATE_H__

#include <stdbool.h>

#define TSTATE_ID 0
bool tstate_load();
bool tstate_close();

#endif

Added source/test/wintest.c.

























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
//engine specific
#include "../core/Engine.h"

//system
#include <windows.h>
#include <stdio.h> //printf
#include <string.h> //strcpy, memset

//app specific
#include "tstate.h"


void wintestEngineSetupFunc()
{
  printf("EngineSetupFunc()\n");

  State * tstate = (State *)malloc(sizeof(State));
  tstate->load = &tstate_load;
  tstate->close = &tstate_close;
  tstate->update = NULL;
  tstate->render = NULL;
  tstate->id = TSTATE_ID;
  //Engine_addState(tstate, true);

  //might revert back to this way, so that the user does not
  //have to use malloc/free for anything related to the base
  //engine (only for app specific stuff like entity systems logic)
 Engine_addState(&tstate_load, &tstate_close, TSTATE_ID, true);
  
}

/**
 * note: http://bobobobo.wordpress.com/2008/02/03/getting-the-hwnd-and-hinstance-of-the-console-window/
 * Consider using int main instead of int WINAPI Winmain for extra
 * portability. We will have to be able to spawn a native window from the
 * console however, which the link explains for windows. A console prompt
 * could ask the user to select the device enumeration prior to game start
 * instead of creating a window/form with the available options.
 */
//int main(int argc, int ** argv)
int WINAPI WinMain(HINSTANCE hInstance,
				   HINSTANCE hPrevInstance,
				   LPSTR lpCmdLine,
				   int nCmdShow)
{
  EngineSetup es;
  memset(&es, 0, sizeof(EngineSetup));
  strcpy(es.title, "Windows test game");
  es.instance = hInstance;
  es.EngineSetupFunc = &wintestEngineSetupFunc;

  printf("Starting test program...\n");

  Engine_create(&es);
  Engine_run();
	
  printf("Exiting test program...\n");
  return 0;
}

Deleted src/AppSetup.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
import me.dw.engine.Engine;
import me.dw.engine.EngineSetup;

//app
public class AppSetup implements EngineSetup.StateSetup
{
	@Override
	public void exec()
	{
		Engine.getInstance().addState(new TestState(0), true);
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<


























Deleted src/EngUserDefNetworkMsgFunc.java.

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
import java.nio.ByteBuffer;
import me.dw.engine.Network;
import me.dw.engine.NetworkSetup;


public class EngUserDefNetworkMsgFunc implements NetworkSetup.NetworkMessageHandler
{
	@Override
	public void clientRead(ByteBuffer b) {
		// TODO Auto-generated method stub
		System.out.println("reading as a client..." + b.toString());
		
		//byte buffer[];
		//buffer = b.array();
		//buffer = Arrays.copyOfRange(b.getData(), p.getOffset(), p.getLength());
		//System.out.println("Packet payload: " + buffer.toString());
//		System.out.println("Packet payload: '" + new String(buffer) + "'");
	}

	@Override
	public void serverRead(ByteBuffer b) {
		// TODO Auto-generated method stub
		System.out.println("reading as a server..." + b.toString());
		
		if (Network.isOOB(b))
			System.out.println("Out of band packet: '" + Network.bbToString(b) + "'");
		else
			System.out.println("Standard packet: '" + Network.bbToString(b) + "'");
		//buffer = b.array();
		//buffer = Arrays.copyOfRange(b.getData(), p.getOffset(), p.getLength());
		//System.out.println("Packet payload: " + buffer.toString());
		//System.out.println("Packet payload: '" + b.toString() + "'");
		//System.out.println("Packet payload: '" + Network.getInstance().bbToString(b) + "'");
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted src/TestProgram.java.

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
import me.dw.engine.*;


/**
 * Test program to make sure engine implementations are working as intended.
 * 
 * @author Donny
 *
 */
public class TestProgram {

	/**
	 * the point of insertion
	 * 
	 * @param args
	 */
	public static void main(String[] args)
	{
		System.out.println("starting test program...");
		
		NetworkSetup ns = new NetworkSetup();
		ns.messageHandlingFunc = new EngUserDefNetworkMsgFunc();
		
		EngineSetup es = new EngineSetup();
		es.appName = "Sound test...";
		es.scale = 1;
		es.setupFunc = new AppSetup();
		//es.targetFPS = 5;
		es.targetFPS = 60;
		es.networkSetup = ns;
		//es.networkSetup = null;

		
		Engine.create(es);
		if (Engine.getInstance() != null)
			Engine.getInstance().run();
		System.out.println("exiting test program...");
		
	
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































Deleted src/TestState.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251

import java.nio.FloatBuffer;
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;

import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import com.stargame.InputSystem;
import com.stargame.MeshComponent;
import com.stargame.PhysicsSystem;
import com.stargame.RenderSystem;

import me.dw.engine.Camera;
import me.dw.engine.ComponentProcessorManager;
import me.dw.engine.Console;
import me.dw.engine.EntityManager;
import me.dw.engine.Mesh;
import me.dw.engine.ResourceManager;
import me.dw.engine.SoundSystem;
import me.dw.engine.State;



public class TestState extends State
{
	private float y = -50;
	String msg = "";
	private float testangle = 1;

	SoundSystem ss;
	Set<String> sounds;

	EntityManager em;
	ComponentProcessorManager cpm;
	RenderSystem rs;

	//if true, control camera movement
	public boolean spectate;
	
	public TestState(int id)
	{
		super(id);
	}

	@Override
	public void load() {
		sounds = new TreeSet<String>();
		sounds.add("./res/sound/LAZER0.WAV");
		sounds.add("./res/sound/LAZER1.WAV");
		sounds.add("./res/sound/LAZER2.WAV");
		sounds.add("./res/sound/LAZER3.WAV");
		sounds.add("./res/sound/tie_fighter.wav");
		sounds.add("./res/sound/saberup.wav");
		sounds.add("./res/sound/R2D2a.wav");
		sounds.add("./res/sound/saberdown.wav");
		ss = new SoundSystem(sounds);
		ss.updateListener(new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.0f, 0.0f, 0.0f), new Vector3f(0.0f, 1.0f, 0.0f), new Vector3f(0.0f, 0.0f, 1.0f));			

		///light
		//vector for the direction the light is coming FROM (reverse the vector to get flow of light..)
		FloatBuffer lightPos = BufferUtils.createFloatBuffer(4).put(new float [] {0.0f, -1.0f, 0.0f, 0.0f});
		lightPos.rewind();
		GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPos);
		GL11.glShadeModel(GL11.GL_SMOOTH);
		//GL11.glShadeModel(GL11.GL_FLAT);

		//GL11.glEnable(GL11.GL_LIGHTING); turned on and off by rendersystem
		GL11.glEnable(GL11.GL_LIGHT0);

		GL11.glEnable(GL11.GL_TEXTURE_2D);                       

		GL11.glClearColor(0.3f, 0.3f, 0.3f, 0.3f);                
		GL11.glClearDepth(1);                                       

		GL11.glEnable(GL11.GL_BLEND);
		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

		GL11.glViewport(0,0,Display.getWidth(),Display.getHeight());

		//turn on culling, back face is default
		GL11.glEnable(GL11.GL_CULL_FACE);

		//entity system test================
		//(init)
		EntityManager.create();
		em = EntityManager.getInstance();
		ComponentProcessorManager.create();
		cpm = ComponentProcessorManager.getInstance();

		cpm.addSystem(new RenderSystem());
		cpm.addSystem(new PhysicsSystem());
		cpm.addSystem(new InputSystem());

		//script entity test subject
		UUID theship = em.createEntity("entscript.scr", "./res/scripts/");
		MeshComponent shipMC = (MeshComponent)EntityManager.getInstance().getComponentFromEntity(MeshComponent.ID, theship);
		//shipMC.mesh = (Mesh) ResourceManager.getInstance().load("spaceship.obj", "./res/models/spaceship/"); 
		shipMC.mesh = (Mesh) ResourceManager.getInstance().load("airplane.obj", "./res/models/airplane/");
		//shipMC.mesh = (Mesh) ResourceManager.getInstance().load("MQ-9.obj", "./res/models/mq9/");
		
		


		//test terrain
		// disabled while testing texturing
		UUID terrain = em.createEntity("terrainent.scr", "./res/scripts/");
		MeshComponent terrainMC = (MeshComponent)EntityManager.getInstance().getComponentFromEntity(MeshComponent.ID, terrain);
		terrainMC.mesh = new Mesh("testterrain.scr", "./res/scripts/");
		
	}

	@Override
	public void close()
	{
		// TODO Auto-generated method stub
		System.out.println("TestState unloading");
		EntityManager.destroy();
		ComponentProcessorManager.destroy();
		ss.unload();
	}

	@Override
	public void requestViewer() {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(float deltaT) {
		//Console.getInstance().out(Integer.toString(Input.getInstance().getMouseX()) + ", " + (Integer.toString(Input.getInstance().getMouseDeltaX())));
		//update sound system for the console
		ss.update();
	}

	@Override
	public void render()
	{
		// Clear the screen and depth buffer
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);	

		//setup 3d perspective projection (needed every frame because Console
		//modifies this later to display on a parellel projection.
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glLoadIdentity();
		GLU.gluPerspective(Camera.getInstance().fov, (float)Display.getWidth()/(float)Display.getHeight(), 1, Integer.MAX_VALUE);

		//clear modelview stack
		GL11.glMatrixMode(GL11.GL_MODELVIEW);
		GL11.glLoadIdentity();


		
		//transform everything for curr view
		GL11.glPushMatrix();
		{
			/** the viewer's position is usually not handled through the
			 * projection matrix, but the modelview matrix. the projection
			 * matrix only handles the transformation from eye-space to
			 * clip-space. camera transformation is achieved by applying the
			 * camera's inverse transformation as the first matrix on the
			 * modelview stack.
			 */
			//apply inverse transformation of camera
			Matrix4f m = Camera.getInstance().getInverseTransform();
			FloatBuffer fb = BufferUtils.createFloatBuffer(16);
			m.store(fb);
			fb.flip();
			GL11.glLoadMatrix(fb);
			//end scene camera positioning===========
			
			//draw a frame of reference (cube)
			float cubelength = 10_000.0f;
			GL11.glColor3f(1.0f,1.0f,1.0f);
			GL11.glBegin(GL11.GL_LINES);
			//bottom
			GL11.glVertex3f(0,0,0);//
			GL11.glVertex3f(cubelength,0,0);
			GL11.glVertex3f(0,0,0);//
			GL11.glVertex3f(0,cubelength,0);
			GL11.glVertex3f(cubelength,0,0);//
			GL11.glVertex3f(cubelength,cubelength,0);
			GL11.glVertex3f(0,cubelength,0);//
			GL11.glVertex3f(cubelength,cubelength,0);

			//top
			GL11.glVertex3f(0,0,cubelength);//
			GL11.glVertex3f(cubelength,0,cubelength);
			GL11.glVertex3f(0,0,cubelength);//
			GL11.glVertex3f(0,cubelength,cubelength);
			GL11.glVertex3f(cubelength,0,cubelength);//
			GL11.glVertex3f(cubelength,cubelength,cubelength);
			GL11.glVertex3f(0,cubelength,cubelength);//
			GL11.glVertex3f(cubelength,cubelength,cubelength);

			//midsection
			GL11.glVertex3f(0,0,0);
			GL11.glVertex3f(0,0,cubelength);
			GL11.glVertex3f(cubelength,0,0);
			GL11.glVertex3f(cubelength,0,cubelength);
			GL11.glVertex3f(cubelength,cubelength,0);
			GL11.glVertex3f(cubelength,cubelength,cubelength);
			GL11.glVertex3f(0,cubelength,0);
			GL11.glVertex3f(0,cubelength,cubelength);

			GL11.glEnd();

			
			//update systems (including render which is last system)
			GL11.glEnable(GL11.GL_DEPTH_TEST); //its disabled by console later
			GL11.glPushMatrix(); //put in center of world
			{							
				GL11.glColor3f(0.7f,0.7f,0.7f);
				cpm.updateSystems(0);
			}
			GL11.glPopMatrix();

			// draw quad
			GL11.glPushMatrix();
			{
				GL11.glDisable(GL11.GL_TEXTURE_2D); //allows quad to draw but not text
				// set the color of the quad (R,G,B,A)
				GL11.glColor3f(0.5f,0.5f,1.0f);

				GL11.glTranslatef(10, 0, 0);
				testangle += 2f;
				GL11.glRotatef(testangle, 0, 1, 0);

				GL11.glBegin(GL11.GL_QUADS);
				GL11.glVertex3f(0,0,10);
				GL11.glVertex3f(0,0,0);
				GL11.glVertex3f(10,0,0);
				GL11.glVertex3f(10,0,10);
				GL11.glEnd();
			}
			GL11.glPopMatrix();
		}
		GL11.glPopMatrix();
		
		//draw 2d hud stuff here
		//...
		
		//draw whatever the console wants to show
		Console.getInstance().render();
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































Deleted src/com/stargame/AppSetup.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.stargame;

import me.dw.engine.*;

/**
 * Custom setup function, executed after Engine finishes loading.
 * 
 * @author Donny
 *
 */
public class AppSetup implements EngineSetup.StateSetup
{

	@Override
	public void exec()
	{
		Engine.getInstance().addState(new MainMenuState(1), true);
		Engine.getInstance().addState(new GameplayState(2), false);
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted src/com/stargame/ForceComponent.java.

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
package com.stargame;

import org.lwjgl.util.vector.Vector3f;

import me.dw.engine.Component;

public class ForceComponent implements Component
{
	public static final long ID = 1L << 4;
	public Vector3f gravity;
	public Vector3f drag;
	public Vector3f thrust; //current movement force to apply during system update
	public Vector3f steering; //current steering forces
	public float torque; //rotational force around axis of heading (+ ccw/- cw)
	public Vector3f otherForcesThatWillBeAppliedInTheseGames;
	public float maxThrust; //the force to apply at max throttle
	private float throttle; //from 0 to 1 inclusive
	public float steerFactor; //higher values steer faster

	/** Whether or not this Component can be changed */
	public boolean mutable;

	//TODO: does it make sense to have a parent?
	//public ForceComponent parent;

	public ForceComponent()
	{
		//gravity = new Vector3f(0.0f, 0.0f, -9.81f);
		gravity = new Vector3f(0.0f, 0.0f, 0.0f);
		drag = new Vector3f(0.0f, 0.0f, 0.0f);
		thrust = new Vector3f(0.0f, 0.0f, 0.0f);
		steering = new Vector3f(0.0f, 0.0f, 0.0f);
		//insert future force memory allocations here

		maxThrust = 10.0f;
		throttle = 0.0f;	   
		steerFactor = 0.1f;
		mutable = true;
	}

	@Override
	public String toString() {
		return "Force=[gravity: " + gravity.toString() + "]\n[drag: " + drag.toString() + "]\n[thrust: " + thrust.toString() + "]\n[steering: " + steering.toString() + "]\n[sum: " + Vector3f.add(gravity, drag, null).toString() + "]\n[maxThrust: " + maxThrust + "]\n[steerFactor: " + steerFactor + "]\n[throttle: " + throttle + "]\n[mutable: " + mutable + "]";
	}

	@Override
	public long getID() {
		return ID;
	}

	@Override
	public boolean isMutable() {
		return mutable;
	}

	@Override
	public void setMutable(boolean mute) {
		mutable = mute;
	}

	public float getThrottle() {
		return throttle;
	}

	public void setThrottle(float x) {
		if (x < 0.0f)
			x = 0.0f;
		if (x > 1.0f)
			x = 1.0f;
		throttle = x;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































Deleted src/com/stargame/GameplayState.java.

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
package com.stargame;

import me.dw.engine.State;

public class GameplayState extends State
{

	public GameplayState(int id) {
		super(id);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void load() {
		// TODO Auto-generated method stub

	}

	@Override
	public void close() {
		// TODO Auto-generated method stub

	}

	@Override
	public void requestViewer() {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(float deltaT) {
		// TODO Auto-generated method stub

	}

	@Override
	public void render() {
		// TODO Auto-generated method stub

	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































Deleted src/com/stargame/InputSystem.java.

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
package com.stargame;

import java.util.SortedSet;
import java.util.UUID;

import org.lwjgl.input.Keyboard;
import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;

import me.dw.engine.Camera;
import me.dw.engine.ComponentProcessor;
import me.dw.engine.Console;
import me.dw.engine.EntityManager;
import me.dw.engine.Input;
import me.dw.engine.VectorHelper;

/** InputSystem applies forces (like driving a car), PhysicsSystem goes and
 * takes Position and Velocity to compute the new Position during an update.
 */
public class InputSystem implements ComponentProcessor
{
	private static final byte PRIORITY = Byte.MIN_VALUE;
	//private static final long LOCK = ForceComponent.ID;
	//private static final long LOCK = PositionComponent.ID | OrientationComponent.ID;
	private static final long LOCK = ForceComponent.ID | OrientationComponent.ID;
	private static final int FPS = 60;
	private static final String NAME = "InputSystem";

	@Override
	public String toString() {
		return NAME;
	}

	@Override
	public int compareTo(ComponentProcessor cp2) {
		return PRIORITY - cp2.getPriority();
	}

	@Override
	public int getFPS() {
		return FPS;
	}

	@Override
	public long getLock() {
		return LOCK;
	}

	@Override
	public byte getPriority() {
		return PRIORITY;
	}

	@Override
	public void processOneTick(long lastFrameTime)
	{
		if (Console.spectate == 1) //all input going to camera...
		{//FIXME: limit the rotations so that you cannot flip upside down...
			if (Input.getInstance().getKeyPress(Keyboard.KEY_W, true))
				Camera.getInstance().position = Vector3f.add(Camera.getInstance().position, VectorHelper.mulScalar(Camera.getInstance().getForwardVector(), Camera.getInstance().moveSpeed), null);
			if (Input.getInstance().getKeyPress(Keyboard.KEY_S, true))
				Camera.getInstance().position = Vector3f.sub(Camera.getInstance().position, VectorHelper.mulScalar(Camera.getInstance().getForwardVector(), Camera.getInstance().moveSpeed), null);	         
			if (Input.getInstance().getKeyPress(Keyboard.KEY_A, true))
				Camera.getInstance().position = Vector3f.sub(Camera.getInstance().position, VectorHelper.mulScalar(Camera.getInstance().getRightVector(), Camera.getInstance().moveSpeed), null);
			if (Input.getInstance().getKeyPress(Keyboard.KEY_D, true))
				Camera.getInstance().position = Vector3f.add(Camera.getInstance().position, VectorHelper.mulScalar(Camera.getInstance().getRightVector(), Camera.getInstance().moveSpeed), null);

			//cam test: rotate along z axis
			Quaternion rot = new Quaternion();
			Quaternion q = new Quaternion();
			Quaternion qx = new Quaternion();
			Quaternion qy = new Quaternion();
			if (Input.getInstance().getMouseDeltaY() != 0)
				qy.setFromAxisAngle(new Vector4f(Camera.getInstance().getRightVector().x, Camera.getInstance().getRightVector().y, Camera.getInstance().getRightVector().z, Camera.getInstance().turnSpeed*Input.getInstance().getMouseDeltaY()*3.14f/180.0f));
			if (Input.getInstance().getMouseDeltaX() != 0)
				qx.setFromAxisAngle(new Vector4f(0.0f, 0.0f, 1.0f, -Camera.getInstance().turnSpeed*Input.getInstance().getMouseDeltaX()*3.14f/180.0f));
			Quaternion.mul(qy, q, q);
			Quaternion.mul(qx, q, q);
			Camera.getInstance().orientation = Quaternion.mul(q, Camera.getInstance().orientation, null);

			//move axes
			Camera.getInstance().rotateAxes(q);
		}
		else
		{
			EntityManager em = EntityManager.getInstance();
			SortedSet<UUID> entities = em.getAllEntitiesThatFitLock(LOCK, false);
			for (UUID ent : entities)
				processEntity(ent);
		}
	}

	private void processEntity(UUID entity)
	{
		ForceComponent fc = (ForceComponent)EntityManager.getInstance().getComponentFromEntity(ForceComponent.ID, entity);
		OrientationComponent oc = (OrientationComponent)EntityManager.getInstance().getComponentFromEntity(OrientationComponent.ID, entity);
		if (fc == null)
			throw new NullPointerException(entity.toString() + ": null ForceComponent");
		if (oc == null)
			throw new NullPointerException(entity.toString() + ": null OrientationComponent");
		if (!fc.isMutable() || !oc.isMutable())
			return;

		//throttle
		if (Input.getInstance().getKeyPress(Keyboard.KEY_W, true)) //increase throttle (max 100)
			fc.setThrottle(fc.getThrottle()+0.1f);
		if (Input.getInstance().getKeyPress(Keyboard.KEY_S, true)) //decrease throttle (max 0)
			fc.setThrottle(fc.getThrottle()-0.1f);
		fc.thrust = new Vector3f(oc.getForwardVector().x*fc.maxThrust*fc.getThrottle(), oc.getForwardVector().y*fc.maxThrust*fc.getThrottle(), oc.getForwardVector().z*fc.maxThrust*fc.getThrottle());

		//turning
		fc.steering.x = 0.0f;
		fc.steering.y = 0.0f;
		fc.steering.z = 0.0f;

		//only turn if we have throttle
		if (fc.getThrottle() != 0)
		{
			if (Input.getInstance().getKeyPress(Keyboard.KEY_UP, true))
				fc.steering = Vector3f.add(fc.steering, (Vector3f)new Vector3f(oc.getUpVector().x*fc.steerFactor, oc.getUpVector().y*fc.steerFactor, oc.getUpVector().z*fc.steerFactor ).negate(), null);
			if (Input.getInstance().getKeyPress(Keyboard.KEY_DOWN, true))
				fc.steering = Vector3f.add(fc.steering, (Vector3f)new Vector3f(oc.getUpVector().x*fc.steerFactor, oc.getUpVector().y*fc.steerFactor, oc.getUpVector().z*fc.steerFactor ), null);	         
			if (Input.getInstance().getKeyPress(Keyboard.KEY_LEFT, true))
				fc.steering = Vector3f.add(fc.steering, (Vector3f)new Vector3f(oc.getRightVector().x*fc.steerFactor, oc.getRightVector().y*fc.steerFactor, oc.getRightVector().z*fc.steerFactor ).negate(), null);
			if (Input.getInstance().getKeyPress(Keyboard.KEY_RIGHT, true))
				fc.steering = Vector3f.add(fc.steering, (Vector3f)new Vector3f(oc.getRightVector().x*fc.steerFactor, oc.getRightVector().y*fc.steerFactor, oc.getRightVector().z*fc.steerFactor ), null);
			//System.out.println("THRUST: " + fc.thrust.toString());
			//System.out.println("STEER: " + fc.steering.toString());
			//roll
				if (Input.getInstance().getKeyPress(Keyboard.KEY_LBRACKET, true))
					fc.torque -= 0.1f;
				if (Input.getInstance().getKeyPress(Keyboard.KEY_RBRACKET, true))
					fc.torque += 0.1f;
			 
		}
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































Deleted src/com/stargame/MainMenuState.java.

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
package com.stargame;



import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import me.dw.engine.Console;
import me.dw.engine.State;

/**
 * Main menu.
 * 
 * @author Donny
 *
 */
public class MainMenuState extends State
{

	public MainMenuState(int id) {
		super(id);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void load() {
		// TODO Auto-generated method stub
		GL11.glEnable(GL11.GL_TEXTURE_2D);
		GL11.glShadeModel(GL11.GL_SMOOTH);        
		GL11.glDisable(GL11.GL_DEPTH_TEST);
		GL11.glDisable(GL11.GL_LIGHTING);                    

		GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                
		GL11.glClearDepth(1);                                       

		GL11.glEnable(GL11.GL_BLEND);
		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

		GL11.glViewport(0,0,Display.getWidth(),Display.getHeight());

		//projection matrix stack
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glLoadIdentity();
		GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1);
	}

	@Override
	public void close() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void requestViewer() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(float deltaT) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void render() {
		// Clear the screen and depth buffer
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);	

		
		//origin is in top left of screen
		Console.getInstance().render();
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































Deleted src/com/stargame/MassComponent.java.

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
package com.stargame;

import me.dw.engine.Component;

public class MassComponent implements Component
{
	public static final long ID = 1L << 5;
	public float mass; //in KG

	/** Whether or not this Component can be changed */
	public boolean mutable;

	public MassComponent()
	{
		mass = 1.0f;

		mutable = true;
	}	

	@Override
	public String toString() {
		return "[mass: " + mass + "][mutable: " + mutable + "]";
	}

	@Override
	public long getID() {
		return ID;
	}

	@Override
	public boolean isMutable() {
		return mutable;
	}

	@Override
	public void setMutable(boolean mute) {
		mutable = mute;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































Deleted src/com/stargame/MeshComponent.java.

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
package com.stargame;

import me.dw.engine.Component;
import me.dw.engine.Mesh;

public class MeshComponent implements Component
{
	public static final long ID = 1L << 1;
	public Mesh mesh;

	/** whether or not to draw this mesh component */
	public boolean draw;

	/** Whether or not this Component can be changed */
	public boolean mutable;

	public MeshComponent()
	{
		mesh = null;
		draw = true;
		mutable = true;
	}

	@Override
	public String toString() {
		return "Mesh=[mutable: " + mutable + "]\n[draw: " + draw + "]\n[mesh: " + mesh.toString() + "]";
	}

	@Override
	public long getID()
	{
		return ID;
	}

	@Override
	public boolean isMutable() {
		return mutable;
	}

	@Override
	public void setMutable(boolean mute) {
		mutable = mute;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































Deleted src/com/stargame/OrientationComponent.java.

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
package com.stargame;

import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector3f;
import me.dw.engine.Component;
import me.dw.engine.QuaternionHelper;

public class OrientationComponent implements Component
{
	public static final long ID = 1L << 3;
	public Vector3f heading, right;

	public Quaternion orientation; //rotation from starting orientation to current

	/** Whether or not this orientation can be changed */
	public boolean mutable;

	public OrientationComponent()
	{
		heading = new Vector3f(1.0f, 0.0f, 0.0f);
		right = new Vector3f(0.0f, -1.0f, 0.0f);
		orientation = new Quaternion();
		orientation = orientation.setIdentity();
		mutable = true;
	}

	//recalc heading and right 
	public void rotateAxes(Quaternion q)
	{
		heading = QuaternionHelper.rotateVector(heading, q);
		right = QuaternionHelper.rotateVector(right, q);
	}

	public Vector3f getForwardVector() {
		return heading;
	}

	public Vector3f getRightVector() {
		return right;
	}

	public Vector3f getUpVector() {
		return Vector3f.cross(right, heading, null);	
	}

	@Override
	public String toString() {
		return "Orientation=[mutable: " + mutable + "]\n[heading: " + heading.toString() + "]\n[right: " + right.toString() + "]\n[up: " + getUpVector().toString() + "]\n[orientation: " + orientation.toString() + "]";
	}

	@Override
	public long getID() {
		return ID;
	}

	@Override
	public boolean isMutable() {
		return mutable;
	}

	@Override
	public void setMutable(boolean mute) {
		mutable = mute;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































Deleted src/com/stargame/PhysicsSystem.java.

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
package com.stargame;

import java.util.SortedSet;
import java.util.UUID;

import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;

import me.dw.engine.ComponentProcessor;
import me.dw.engine.Console;
import me.dw.engine.EntityManager;

public class PhysicsSystem implements ComponentProcessor
{
	private static final byte PRIORITY = Byte.MAX_VALUE-5;
	private static final long LOCK = PositionComponent.ID | ForceComponent.ID | VelocityComponent.ID | OrientationComponent.ID | MassComponent.ID;
	private static final int FPS = 60;
	private static final String NAME = "PhysicsSystem";

	@Override
	public String toString() {
		return NAME;
	}

	@Override
	public int compareTo(ComponentProcessor cp2) {
		return PRIORITY - cp2.getPriority();
	}

	@Override
	public int getFPS() {
		return FPS;
	}

	@Override
	public long getLock() {
		return LOCK;
	}

	@Override
	public byte getPriority() {
		return PRIORITY;
	}

	@Override
	public void processOneTick(long lastFrameTime)
	{
		EntityManager em = EntityManager.getInstance();
		SortedSet<UUID> entities = em.getAllEntitiesThatFitLock(LOCK, false);
		for (UUID ent : entities)
			processEntity(ent, lastFrameTime);
	}

	private void processEntity(UUID entity, long lastFrameTime)
	{
		//TODO used fixed time step
		//long currentTime = Engine.getInstance().getTime();
		ForceComponent fc = (ForceComponent)EntityManager.getInstance().getComponentFromEntity(ForceComponent.ID, entity);
		MassComponent mc = (MassComponent)EntityManager.getInstance().getComponentFromEntity(MassComponent.ID, entity);
		OrientationComponent oc = (OrientationComponent)EntityManager.getInstance().getComponentFromEntity(OrientationComponent.ID, entity);
		PositionComponent pc = (PositionComponent)EntityManager.getInstance().getComponentFromEntity(PositionComponent.ID, entity);
		VelocityComponent vc = (VelocityComponent)EntityManager.getInstance().getComponentFromEntity(VelocityComponent.ID, entity);

		if (fc == null)
			throw new NullPointerException(entity.toString() + ": null ForceComponent");
		if (mc == null)
			throw new NullPointerException(entity.toString() + ": null MassComponent");
		if (oc == null)
			throw new NullPointerException(entity.toString() + ": null OrientationComponent");
		if (pc == null)
			throw new NullPointerException(entity.toString() + ": null PositionComponent");
		if (vc == null)
			throw new NullPointerException(entity.toString() + ": null VelocityComponent");

		if (!oc.isMutable() || !pc.isMutable() || !vc.isMutable())
			return;

		//should be defined/derived from the entity
		//float MOVE_SPEED = 6.0f;
		//float angleSpeed = 3.14f/64.0f;

		//position application========== 
		//TODO apply forces to change velocity, and use velocity to calc new
		//	position.
		//Vector3f prePosition = new Vector3f(pc.x, pc.y, pc.z);
		Vector3f displacement = new Vector3f(0,0,0);
		//float SPEED = 2.0f;	    
		displacement = Vector3f.add(fc.thrust, fc.steering, null);
		pc.x += displacement.x;
		pc.y += displacement.y;
		pc.z += displacement.z;

		//create rotation from current orientation to new heading
		Quaternion newRot = new Quaternion();
		Quaternion q;
		if (fc.steering.length() == 0) //no rot, use identity
			q = new Quaternion();
		else
		{
			Vector3f a = Vector3f.cross(oc.getForwardVector(), displacement, null);
			a.normalise();
			float angleRad = (float) Math.acos( Vector3f.dot((Vector3f)new Vector3f(oc.getForwardVector()).normalise(), (Vector3f)new Vector3f(displacement).normalise()) );
			//q = new Quaternion(a.x, a.y, a.z, 0);
			q = new Quaternion();
			q.setFromAxisAngle(new Vector4f(a.x, a.y, a.z, angleRad));
		}
		
		//TODO IDEA: get magnitude of horizontal steering force and apply a
		//minor bank rotation to the above computed quaternion to achieve nice
		//banked turns.
		//scalar projection a1 = a dot (unitvector)b	 
		Quaternion bank = new Quaternion();
		Vector3f a = new Vector3f(fc.steering);
		Vector3f b = new Vector3f(oc.getRightVector());
		b.normalise();
		float a1 = Vector3f.dot(a, b);
		//Console.getInstance().out("a1: " + a1);
		//System.out.println("a1: " + a1);

		//apply roll from any torque
		Quaternion roll = new Quaternion();
		//rotate 1 degree per unit of torque
		//roll.setFromAxisAngle(new Vector4f(oc.getForwardVector().x, oc.getForwardVector().y, oc.getForwardVector().z, 1.0f*3.14f/180.0f*fc.torque));
		a1 *= 5.5f;
		roll.setFromAxisAngle(new Vector4f(oc.getForwardVector().x, oc.getForwardVector().y, oc.getForwardVector().z, 1.0f*3.14f/180.0f*a1));

		//apply rotation to oc
		Quaternion.mul(roll, q, newRot);
		oc.orientation = Quaternion.mul(newRot, oc.orientation, null);
		//recalculate entity axes
		oc.rotateAxes(newRot);
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































Deleted src/com/stargame/PositionComponent.java.

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
package com.stargame;

import me.dw.engine.Component;

public class PositionComponent implements Component
{
	public static final long ID = 1L << 0;
	public float x, y, z;

	/** whether or not the position can be changed */
	public boolean mutable;

	/** if a parent is set, this Component's position will be concatenated to
	 *	the parent's position during updates
	 */
	public PositionComponent parent;

	public PositionComponent()
	{
		x = 0.0f;
		y = 0.0f;
		z = 0.0f;
		mutable = true;
		parent = null;
	}

	@Override
	public String toString()
	{
		return "Position=(" + x + ", " + y + ", " + z + ")";
	}

	@Override
	public long getID()
	{
		return ID;
	}

	@Override
	public boolean isMutable() {
		return mutable;
	}

	@Override
	public void setMutable(boolean mute) {
		mutable = mute;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































Deleted src/com/stargame/RenderSystem.java.

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
package com.stargame;

import java.util.SortedSet;
import java.util.UUID;

import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;

import me.dw.engine.ComponentProcessor;
import me.dw.engine.EntityManager;
import me.dw.engine.Material;
import me.dw.engine.Mesh.Face;
import me.dw.engine.QuaternionHelper;

public class RenderSystem implements ComponentProcessor
{
	private static final byte PRIORITY = Byte.MAX_VALUE;
	private static final long LOCK = PositionComponent.ID | MeshComponent.ID | OrientationComponent.ID;
	private static final int FPS = 60;
	private static final String NAME = "RenderSystem";

	@Override
	public String toString() {
		return NAME;
	}

	@Override
	public int compareTo(ComponentProcessor rs2) {
		return PRIORITY - rs2.getPriority();
	}

	@Override
	public int getFPS() {
		return FPS;
	}

	@Override
	public long getLock() {
		return LOCK;
	}

	@Override
	public byte getPriority() {
		return PRIORITY;
	}

	@Override
	public void processOneTick(long lastFrameTime)
	{
		EntityManager em = EntityManager.getInstance();
		SortedSet<UUID> entities = em.getAllEntitiesThatFitLock(LOCK, false);
		for (UUID ent : entities)
			processEntity(ent, lastFrameTime);
	}

	private void processEntity(UUID entity, long lastFrameTime)
	{
		//long currentTime = Engine.getInstance().getTime();
		int i, j;
		OrientationComponent oc = (OrientationComponent)EntityManager.getInstance().getComponentFromEntity(OrientationComponent.ID, entity);
		PositionComponent pc = (PositionComponent)EntityManager.getInstance().getComponentFromEntity(PositionComponent.ID, entity);
		MeshComponent mc = (MeshComponent)EntityManager.getInstance().getComponentFromEntity(MeshComponent.ID, entity);

		if (oc == null)
			throw new NullPointerException(entity.toString() + ": null OrientationComponent");
		if (pc == null)
			throw new NullPointerException(entity.toString() + ": null PositionComponent");
		if (mc == null)
			throw new NullPointerException(entity.toString() + ": null MeshComponent");
		if (!mc.draw)
			return;

		GL11.glPushMatrix();
		{
			//move ship to origin (done automatically by Mesh obj loader now)
			//GL11.glTranslatef(-mc.mesh.getCenter().x, -mc.mesh.getCenter().y, -mc.mesh.getCenter().z);

			//translate it to where i want it to be in the scene
			GL11.glTranslatef(pc.x, pc.y, pc.z);

			if (!mc.mesh.isTerrain())
				GL11.glScalef(0.005f, 0.005f, 0.005f); //scale the huge airplane
				//GL11.glScalef(1_000, 1_000, 1_000); //scale the tiny predator

			//temp: fix ship default orientation (does not work [rotates ship but screws up following rot])
			//GL11.glRotatef(90, 1, 0, 0);

			//rotation ship about its origin
			Vector4f axisAngle = QuaternionHelper.getAxisAngle(oc.orientation);
			//shouldnt need now that getAxisAngle() checks for identity quat
			//if (!(axisAngle.x == 0 && axisAngle.y == 0 && axisAngle.z == 0))
			//{
			//CONVERT TO DEGREES!
			float angleDeg = axisAngle.w * 180.0f/3.14f;
			GL11.glRotatef(angleDeg, axisAngle.x, axisAngle.y, axisAngle.z);
			//}

			GL11.glEnable(GL11.GL_LIGHTING);
			//GL11.glDisable(GL11.GL_LIGHTING);
			for (i = 0; i < mc.mesh.getFaces().size(); i++)
			{
				Face f = mc.mesh.getFaces().get(i);
				if (f.material != null)
				{
					Material mat = mc.mesh.getMaterial(f.material);
					if (mat.getTexture() == null)
					{
						GL11.glDisable(GL11.GL_TEXTURE_2D);						
					}
					else
					{				   
						mat.getTexture().bind();
						GL11.glEnable(GL11.GL_TEXTURE_2D);
					}
				}
				//GL11.glBegin(GL11.GL_TRIANGLES);
				GL11.glBegin(GL11.GL_POLYGON);
				//GL11.glBegin(GL11.GL_LINE_LOOP);
				for (j = 0; j < f.vIndices.size(); j++)
				{
					Vector2f tcoord = mc.mesh.getTexCoords().get(f.texCoordIndices.get(j));
					Vector3f vn = mc.mesh.getNormals().get(f.normalIndices.get(j));
					Vector3f v = mc.mesh.getVertices().get(f.vIndices.get(j));

					GL11.glTexCoord2f(tcoord.x, tcoord.y);
					GL11.glNormal3f(vn.x, vn.y, vn.z);
					GL11.glVertex3f(v.x, v.y, v.z);
				}
				GL11.glEnd();
			}
			//GL11.glEnable(GL11.GL_LIGHTING);
			GL11.glDisable(GL11.GL_LIGHTING);
		}
		GL11.glPopMatrix();
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































Deleted src/com/stargame/StarGame.java.

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
package com.stargame;

import me.dw.engine.Engine;
import me.dw.engine.EngineSetup;

/**
 * Star Game is a sample game built to solidify the foundations of the
 * starfighter engine, as well to serve as a proof of concept for the
 * implementation of the engine.
 * 
 * @author Donny
 *
 */
public class StarGame
{
	public static void main(String[] args)
	{
		EngineSetup es = new EngineSetup();
		es.appName = "Star Game";
		es.networkSetup = null;
		es.scale = 1.0f;
		es.setupFunc = new AppSetup();
		es.targetFPS = 70;
		
		Engine.create(es);
		if (Engine.getInstance() != null)
			Engine.getInstance().run();
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































Deleted src/com/stargame/VelocityComponent.java.

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
package com.stargame;

import org.lwjgl.util.vector.Vector3f;

import me.dw.engine.Component;

public class VelocityComponent implements Component
{
	public static final long ID = 1L << 2;
	public Vector3f velocity;

	/** whether or not the velocity can be changed */
	public boolean mutable;

	/** if a parent is set, this Component's velocity will be concatenated to
	 *	the parent's position during updates
	 */
	public VelocityComponent parent;

	/** Whether or not the velocity can be altered by InputSystem */
	public boolean acceptInput;

	public VelocityComponent()
	{
		velocity = new Vector3f(0.0f, 0.0f, 0.0f);
		mutable = true;
		parent = null;
		acceptInput = true;
	}

	@Override
	    public String toString() {      
		return "Velocity=[velocity: " +  velocity.toString() + "]\n[mutable: " + mutable + "]\n[parent: " + parent.toString() + "]\n[acceptInput: " + acceptInput + "]";
	}

	@Override
	public long getID() {
		return ID;
	}

	//TODO: just make Component an abstract class..?
	@Override
	public boolean isMutable() {
		return mutable;
	}

	@Override
	public void setMutable(boolean mute) {
		mutable = mute;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































Deleted src/com/stargame/VolumeComponent.java.

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
package com.stargame;

import me.dw.engine.Component;

/** Defines a volume at the origin with default orientation
 * (facing east). If a volume is to be attached to some sort
 * of object (such a mesh) that moves, this volume must be
 * transformed to the position and orientation of the object
 * before performing collision tests.
 * 
 * @author Donny
 *
 */
public class VolumeComponent implements Component
{
	public static final long ID = 1L << 6;
	
	  /** Whether or not this Component can be changed */
    public boolean mutable;
    
	public VolumeComponent()
	{
		
		mutable = true;
	}
	
	@Override
	public String toString() {
		return "Volume=[mutable: " + mutable + "]";
	}
	
	@Override
	public long getID() {
		return ID;
	}

	@Override
	public boolean isMutable() {
		return mutable;
	}

	@Override
	public void setMutable(boolean mute) {
		mutable = mute;
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































Deleted src/me/dw/engine/Camera.java.

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
package me.dw.engine;

import java.nio.FloatBuffer;

import org.lwjgl.BufferUtils;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector4f;

import me.dw.engine.QuaternionHelper;

/** The Camera represents the viewpoint from which the user is looking into the
 * application (whether he/she/it is looking somewhere in a 3D scene, or at 2D
 * menu screens. It is a singleton that persists throughout the life of the
 * application. Default transformation is at the origin facing east (x-axis).
 * 
 * @author Donny
 *
 */
public class Camera
{
	/** The position of the Camera in the scene */
	public Vector3f position;

	/** The current orientation of the Camera. Used by the renderer */
	public Quaternion orientation;

	/** Direction angles used for manipulating the Camera's local frame */
	private Vector3f heading, right;

	/** The field of view of the Camera */
	public float fov;
	
	/** How many units per second to move */
	public float moveSpeed;
	
	/** How many degrees per mouse pixel moved to pan */
	public float turnSpeed;

	private Camera()
	{
		position = new Vector3f(0.0f, 0.0f, 0.0f);
		orientation = new Quaternion();
		heading = new Vector3f(1.0f, 0.0f, 0.0f);
		right = new Vector3f(0.0f, -1.0f, 0.0f);
		//heading = new Vector3f(0.0f, 0.0f, -1.0f);
		//right = new Vector3f(1.0f, 0.0f, 0.0f);
		fov = 45;
		
		moveSpeed = 25.0f;
		turnSpeed = 0.5f;

		//OpenGL initial camera facing is down the -z axis, with +y
		//pointing up. set initial quaternion rotation to face
		//camera along the +x axis with +z pointing up
		//Vector4f axisAngle1 = new Vector4f(1.0f, 0.0f, 0.0f, 3.14f/2.0f);
		/*
		Vector4f axisAngle1 = new Vector4f(0.0f, 1.0f, 0.0f, -3.14f/2.0f);
		Vector4f axisAngle2 = new Vector4f(0.0f, 1.0f, 0.0f, 0);	     
		Quaternion q1 = new Quaternion();
		Quaternion q2 = new Quaternion();
		q1.setFromAxisAngle(axisAngle1);
		q2.setFromAxisAngle(axisAngle2);
		Quaternion.mul(q2, q1, orientation);
		 */
		//orientation.setFromAxisAngle(new Vector4f(0.577f, -0.577f, -0.577f, 2.094f));
		orientation = new Quaternion(0.5f, -0.5f, -0.5f, 0.5f);
	}

	public static class CameraHolder {
		public static final Camera INSTANCE = new Camera();
	}

	/** Uses initialization-on-demand holder idiom for extremely lazy loading.
	 * 
	 * @return The single instance of Camera;
	 */
	public static Camera getInstance() {
		return CameraHolder.INSTANCE;
	}

	//recalc heading and right 
	public void rotateAxes(Quaternion q)
	{
		heading = QuaternionHelper.rotateVector(heading, q);
		right = QuaternionHelper.rotateVector(right, q);
	}

	public Vector3f getForwardVector() {
		return heading;
	}

	public Vector3f getRightVector() {
		return right;
	}

	public Vector3f getUpVector() {
		return Vector3f.cross(right, heading, null);	
	}

	/** Create a matrix representing the inverse of the Camera's position
	 * and orientation transformation. This is to be applied to the ModelView's
	 * identity matrix in order to transform the entire scene as if viewed from
	 * the Camera's position and orientation.
	 * 
	 * @return A matrix representing the inverse transformation.
	 */
	public Matrix4f getInverseTransform()
	{
		Matrix4f inverseXform, translation = new Matrix4f(), rotation = new Matrix4f();
		/*
		tr[0][0] = 1.0f; tr[0][1] = 0.0f; tr[0][2] = 0.0f; tr[0][3] = position.x;
		tr[1][0] = 0.0f; tr[1][1] = 1.0f; tr[1][2] = 0.0f; tr[1][3] = position.y;
		tr[2][0] = 0.0f; tr[2][1] = 0.0f; tr[2][2] = 1.0f; tr[2][3] = position.z;
		tr[3][0] = 0.0f; tr[3][1] = 0.0f; tr[3][2] = 0.0f; tr[3][3] = 1.0f;
		 */
		//matrix4f is in column major order.
		/*
		translation.m03 = position.x;
		translation.m13 = position.y;
		translation.m23 = position.z;
		 */
		translation.m30 = position.x;
		translation.m31 = position.y;
		translation.m32 = position.z;
		
		Matrix4f m1 = new Matrix4f();
		Matrix4f m2 = new Matrix4f();
		Quaternion q = orientation;
		m1.m00 = q.w; m1.m01 = q.z; m1.m02 = -q.y; m1.m03 = q.x;
		m1.m10 = -q.z; m1.m11 = q.w; m1.m12 = q.x; m1.m13 = q.y;
		m1.m20 = q.y; m1.m21 = -q.x; m1.m22 = q.w; m1.m23 = q.z;
		m1.m30 = -q.x; m1.m31 = -q.y; m1.m32 = -q.z; m1.m33 = q.w;
		
		m2.m00 = q.w; m2.m01 = q.z; m2.m02 = -q.y; m2.m03 = -q.x;
		m2.m10 = -q.z; m2.m11 = q.w; m2.m12 = q.x; m2.m13 = -q.y;
		m2.m20 = q.y; m2.m21 = -q.x; m2.m22 = q.w; m2.m23 = -q.z;
		m2.m30 = q.x; m2.m31 = q.y; m2.m32 = q.z; m2.m33 = q.w;
	
		rotation = Matrix4f.mul(m1, m2, null);
		inverseXform = (Matrix4f) Matrix4f.mul(translation, rotation, null).invert();
		return inverseXform;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































Deleted src/me/dw/engine/Component.java.

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
package me.dw.engine;

public interface Component
{
	/**
	 * Get a bit field that uniquely identifies this Component from Components
	 * of another type.
	 * 
	 * @return A long representing a bit field with one bit toggled, to
	 * identify this Component.
	 */
	public long getID();

	/** Determine if the Component's members may be modified.
	 * 
	 * @return true if the Component's members may be modified, false otherwise.
	 */
	public boolean isMutable();
	
	/** Set the mutability of this Component.
	 * 
	 * @param mute true to keep systems from manipulating member data, false
	 * otherwise.
	 */
	public void setMutable(boolean mute);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































Deleted src/me/dw/engine/ComponentProcessor.java.

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
package me.dw.engine;

/**
 * Entity Systems implement this interface. ComponentProcessors are executed in
 * order of their priority.
 * 
 * @author Donny
 *
 */
public interface ComponentProcessor extends Comparable<ComponentProcessor>
{
	/**
	 * Get the number of times per that this ComponentProcessor should be
	 * updated. Should be <= The running FPS of the Engine.
	 * 
	 * @return The intended update rate of this ComponentProcessor.
	 */
	public int getFPS();
	
	/**
	 * Gets a bit field representing the Components that this
	 * ComponentProcessor interacts with. Each Component must exist in any
	 * given entity for this ComponentProcessor to act on it.
	 * 
	 * @return A long representing a bit field of this ComponentProcessor's
	 * lock signature.
	 */
	public long getLock();
	
	/**
	 * Get the priority of this ComponentProcessor.
	 * 
	 * @return
	 */
	public byte getPriority();
	
	/**
	 * Updates all components that this ComponentProcessor is defined for. If
	 * the lock signature contains more then one Component type, Components
	 * will be grouped by entity and processed on an entity-by-entity basis.
	 * @param lastFrameTime
	 */
	public void processOneTick(long lastFrameTime);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































Deleted src/me/dw/engine/ComponentProcessorManager.java.

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
package me.dw.engine;

import java.util.Iterator;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * System manager which updates all systems provided to it at their intended
 * update rates. Systems that are processed during the same update are
 * processed in order of their priority.
 * 
 * @author Donny
 *
 */
public class ComponentProcessorManager
{
	//list of all the systems in use, order
	private SortedSet<ComponentProcessor> systems;

	//the rate that the CP's frame counter increases every frame
	private Map<ComponentProcessor, Double> updateRates;

	//when this reaches 1, run system
	private Map<ComponentProcessor, Double> frameCount;
	
	private static boolean instanced = false;
	private static ComponentProcessorManager INSTANCE = null;

	private ComponentProcessorManager()
	{
		systems = new TreeSet<ComponentProcessor>();
		updateRates = new TreeMap<ComponentProcessor, Double>();
		frameCount = new TreeMap<ComponentProcessor, Double>();
	}

	public static void create()
	{
		if (!instanced)
		{
			instanced = true;
			INSTANCE = new ComponentProcessorManager();
		}
	}
	
	public static void destroy()
	{
		if (instanced)
		{
			instanced = false;
			INSTANCE = null;
		}
	}
	
	public static ComponentProcessorManager getInstance()
	{
		return INSTANCE;
	}
	
	/**
	 * Add a new @ComponentProcessor to process.
	 * 
	 * @param cp The @ComponentProcessor to process.
	 */
	public void addSystem(ComponentProcessor cp)
	{
		if (cp == null)
			return;
		systems.add(cp);
		updateRates.put(cp, (double)cp.getFPS()/(double)Engine.getInstance().getTargetFPS());
		frameCount.put(cp, 1.0);
	}

	/**
	 * Update each system in order of priority, if it is due to be updated,
	 * as determined by its current frameCount and frame update rate.
	 * 
	 * @param lastFrameTime TODO
	 */
	public void updateSystems(long lastFrameTime)
	{
		Iterator<ComponentProcessor> it = systems.iterator();
		//for (Map.Entry<ComponentProcessor, Double> entry : )

		while (it.hasNext())
		{
			ComponentProcessor cp = it.next();
			double fc = frameCount.get(cp);
			if (fc >= 1)
			{
				cp.processOneTick(lastFrameTime);
				fc = fc - 1.0;
				frameCount.put(cp, fc);
			}
			fc = fc + updateRates.get(cp);
			frameCount.put(cp, fc);
		}
	}

	public SortedSet<ComponentProcessor> getSystems()
	{
		return systems;
	}

	public double getUpdateRate(ComponentProcessor cp)
	{
		if (cp == null || !systems.contains(cp))
			return -1;
		//TODO: check this and next function for errors (null cp, not in map...)
		return updateRates.get(cp);
	}

	public double getFrameCount(ComponentProcessor cp)
	{
		if (cp == null || !systems.contains(cp))
			return -1;
		return frameCount.get(cp);
	}

	public int getLongestComponentProcessorLength()
	{
		int max = -1;
		for (ComponentProcessor cp : systems)
		{
			if (cp.toString().length() > max)
				max = cp.toString().length();
		}
		return max;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































Deleted src/me/dw/engine/Console.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
package me.dw.engine;

import java.awt.Font;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.text.*;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.Color;
import org.newdawn.slick.TrueTypeFont;

public class Console
{
	/** the different outputs that console can show */
	public enum outputType
	{
		OUTPUT_CONSOLE,
		OUTPUT_SOUNDCHANNELS //displays the status of each sound source
	}

	private String outFileName;

	private boolean showConsole = false;
	private boolean showSoundData = false;
	private boolean showRenderData = true;
	private boolean showSystemsData = true;

	/** main console output.*/
	private ArrayList<String> consoleLines;
	private static final int consoleVisibleLines = 8; //how many lines to show
	private static final float consoleX = 0.0f;
	private static final float consoleY = 0.0f;
	private int consoleOffset; //positive number representing how many lines to skip in the console, starting from most recent
	private StringBuilder consoleInput; //what the user is typing in
	private static final int lineWidth = 40; //how long the line is before word wrap
	private static final int MAX_INPUT_SIZE = 20; //max chars for input

	/** the various sound channels and their status */
	private String soundChannelLines[];
	private static final int soundChannelLinesSize = SoundSystem.MAX_SOURCES;
	private static final float soundChannelX = 0.5f;
	private static final float soundChannelY = 0.0f;

	/** the lines for render data (fps, etc) */
	private String renderLines[];
	private static final int renderLinesSize = 1;
	private static final float renderX = 0.0f;
	private static float renderY;
	private float frameTime;
	private int frameCount;

	/** systems monitor (order, frame count, updated real time) */
	private ArrayList<String> systemLines;
	private static final float systemX = 0.35f;
	private static final float systemY = 0.5f;

	private int fontSize;
	Font awtFont;
	TrueTypeFont font;

	private static Console INSTANCE = null;
	private static boolean instanced = false;

	//console variables (accessible by game)
	public static int spectate;
	
	private Console(int fontSz)
	{
		Date now = new Date();
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'_'HHmmzzz");
		outFileName = "logs/clog" + format.format(now) + ".txt";

		fontSize = fontSz;
		//awtFont = new Font("Times New Roman", Font.PLAIN, fontSz);
		//awtFont = new Font("Times New Roman", Font.BOLD, fontSz);
		awtFont = new Font(Font.MONOSPACED, Font.PLAIN, fontSz);
		font = new TrueTypeFont(awtFont, false);

		soundChannelLines = new String[soundChannelLinesSize];

		consoleLines = new ArrayList<String>();
		consoleOffset = 0;
		consoleInput = new StringBuilder();

		renderLines = new String[renderLinesSize];
		renderLines[0] = "FPS:"; //needed until 1st second passes and the update function fills this in
		renderY = (float)(Display.getHeight() - (2.0f*(float)fontSz)) / (float)Display.getHeight();
		frameTime = 1.0f;
		frameCount = 0;

		systemLines = new ArrayList<String>();
		
		spectate = 0;
	}

	/**
	 * Create the Console.
	 * 
	 * @param fontSz The size in pixels of the font.
	 */
	public static void create(int fontSz)
	{
		if (!instanced)
		{
			instanced = true;
			INSTANCE = new Console(fontSz);
		}
	}

	public static Console getInstance()
	{
		return INSTANCE;
	}

	/**
	 * Updates the Console with the current state of the program.
	 * 
	 * @param deltaT The time that has passed since the last update.
	 */
	public void update(float deltaT)
	{
		//updates that must be done every frame**********
		//==========render data==========
		// Calculate the frame rate.
		frameTime += deltaT;
		frameCount++;
		// Update the fps every second. (render data)
		if( frameTime > 1.0f )
		{
			renderLines[0] = "FPS: " + Integer.toString(frameCount);
			frameTime = 0.0f;
			frameCount = 0;
		}
		//==========end render data==========


		//updates only done when they are visible		
		//TODO
		if (showConsole)
		{
			//nothing to update
		}
		if (showSoundData)
		{	
			for (int i = Integer.MAX_VALUE; i < SoundSystem.MAX_SOURCES; i++)
			{
				//TODO: make soundsystem a singleton... cant acces right now
				SoundSystem stemp = null;
				String str = stemp.getChannelStatus(i);
				if (str != null)
					soundChannelLines[i] = str;
				else
					soundChannelLines[i] = "ch " + i + ": NULL";
			}
		}
		if (showRenderData)
		{
			//already updated above each frame
		}
		if (showSystemsData)
		{
			//systems data update
			//...
			ComponentProcessorManager cpm = ComponentProcessorManager.getInstance();
			int width = cpm.getLongestComponentProcessorLength();
			//String form = "%-[width]s: rate(%d), framecount(d)";
			//String form = "%-" + width + "s: rate(%f), framecount(%f)";		
			String form = "%-" + width + "s: rate(%f), framecount:[%-10s]";

			systemLines.clear();
			for (ComponentProcessor cp : cpm.getSystems())
			{
				//systemsLines.add(cp.toString + " rate: " + cpm.getUpdateRate(cp) + " frame: " + cpm.getFrameCount(cp));
				int numBars = (int)cpm.getFrameCount(cp) * 10;
				StringBuilder progressBar = new StringBuilder();
				for (int i = 0; i < numBars; i++)
					progressBar.append("|");
				//systemLines.add(String.format(form, cp.toString(), cpm.getUpdateRate(cp), cpm.getFrameCount(cp)));
				systemLines.add(String.format(form, cp.toString(), cpm.getUpdateRate(cp), progressBar.toString()));
			}
		}
	}

	/**
	 * Draw the various features of the Console, if they are set to show.
	 * Origin is top left of screen for Console rendering. Must be performed
	 * with an identity modelview matrix, or else it will be transformed (try
	 * it in projection?)
	 */
	public void render()
	{
		int i;
		float dw = Display.getWidth();
		float dh = Display.getHeight();
		float w, h;

		//set up a parallel projection
		GL11.glMatrixMode(GL11.GL_PROJECTION);
		GL11.glLoadIdentity();
		GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1);
		GL11.glEnable(GL11.GL_TEXTURE_2D); //for text texture
		GL11.glDisable(GL11.GL_DEPTH_TEST); //for console pixels overwriting

		if (showConsole)
		{
			//Stack<String> stackCopy = (Stack<String>) consoleLines.clone();
			w = dw*consoleX;
			h = dh*consoleY;
			font.drawString(w, h+(fontSize*(consoleVisibleLines)), "->"+consoleInput, Color.green);
			for (i = 0; i < consoleVisibleLines; i++)
			{
				if (consoleLines.size() > i+consoleOffset)
					font.drawString(w, h+(fontSize*(consoleVisibleLines-i-1)), consoleLines.get(i+consoleOffset), Color.green);
			}
		}
		if (showSoundData)
		{	
			w = dw*soundChannelX;
			h = dh*soundChannelY;
			font.drawString(w, h, "Sound Channels", Color.green);
			font.drawString(w, h+(fontSize*1), "--------------------", Color.green);
			for (i = 0; i < soundChannelLines.length; i++)
			{
				try { //if SoundSystem is not updated/setup properly, catch me
					font.drawString(w, h+(fontSize*(2+i)), soundChannelLines[i], Color.green);
				} catch (NullPointerException e) {
					font.drawString(w, h+(fontSize*(2+i)), "ch " + i + ": NULL", Color.green);
				}
			}
		}
		if (showRenderData)
		{
			w = dw*renderX;
			h = dh*renderY;
			for (i = 0; i < renderLines.length; i++)
			{
				font.drawString(w, h+(fontSize*i), renderLines[i], Color.green);
			}
		}
		if (showSystemsData)
		{
			w = dw*systemX;
			h = dh*systemY;
			font.drawString(w, h, "Entity Systems", Color.green);
			font.drawString(w, h+(fontSize*1), "--------------------", Color.green);
			for (i = 0; i < systemLines.size(); i++)			 
				font.drawString(w, h+(fontSize*(2+i)), systemLines.get(i), Color.green);			    
		}
		GL11.glDisable(GL11.GL_TEXTURE_2D);
		GL11.glEnable(GL11.GL_DEPTH_TEST);
	}

	@Deprecated
	public void setOutput(String [] lines, outputType t)
	{
		//make sure lines.length == the length that t should be
		switch (t)
		{
		case OUTPUT_CONSOLE:
			//consoleLines = lines;
			break;
		case OUTPUT_SOUNDCHANNELS:
			soundChannelLines = lines;
			break;			
		}

	}

	/**
	 * Inserts a character into the console user input stream
	 * 
	 * @param c
	 */
	public void in(char c)
	{
		if (c == 8) //backspace
		{
			try
			{
				consoleInput.deleteCharAt(consoleInput.length()-1);
			}
			catch (StringIndexOutOfBoundsException e)
			{
				//do nothing, string is empty already
			}
		}
		else if (c == '\n')
			processInput();
		else
		{
			if (consoleInput.length() < MAX_INPUT_SIZE)
				consoleInput.append(c);
		}
	}

	/**
	 * print a line in the console
	 * @param s
	 */
	public void out(String s)
	{
		String trunc;
		String origS = s;

		//word wrap
		while (s.length() > lineWidth)
		{
			trunc = s.substring(0, lineWidth);
			consoleLines.add(0, trunc);
			try
			{
				s = s.substring(lineWidth);
			}
			catch (IndexOutOfBoundsException e)
			{
				System.out.println(e.toString() + " s.length=" + s.length() + ", lineWidth=" + lineWidth);
			}
		}

		consoleLines.add(0, s);

		//if we are not looking at most recent line, scroll up with the text
		//	so we dont lose our place
		if (consoleOffset != 0)
			consoleOffset++;

		//log this console entry
		try {
			// Create file 
			FileWriter fstream = new FileWriter(outFileName, true);
			BufferedWriter out = new BufferedWriter(fstream);

			out.write(origS + System.getProperty("line.separator"));
			//Close the output stream
			out.flush();
			out.close();
		}
		catch (Exception e) { //Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}
	}

	/**
	 * Get the number of lines in the Console to skip, used for scrolling, and
	 * viewing the potentially unlimited number of Console lines in the very
	 * limited Console window.
	 * 
	 * @return The number of lines in the Console to skip.
	 */
	public int getConsoleOffset()
	{
		return consoleOffset;
	}

	/**
	 * Scrolls the view of console output up and down.
	 * 
	 * @param o the offset to view the lines in the console. A value of 0
	 * means we are looking at the most recent line. Higher values indicate we have scrolled up by that many lines.
	 */
	public void setConsoleOffset(int o)
	{
		if (o < 0 || consoleLines.size() <= consoleVisibleLines)
			o = 0;
		else if (o > consoleLines.size()-8)
			o = consoleLines.size()-8;

		consoleOffset = o;
	}

	/**
	 * Show the Console if it is hidden, and hide the Console if it is showing.
	 */
	public void toggleConsole()
	{
		showConsole = !showConsole;
	}

	/**
	 * Show the Console if it is not already showing.
	 */
	public void showConsole()
	{
		showConsole = true;
	}

	/**
	 * Hide the Console if it is not already hiding.
	 */
	public void hideConsole()
	{
		showConsole = false;
	}

	/**
	 * Parse the user console input, whatever it is.
	 */
	public void processInput()
	{
		if (consoleInput.length() > 0)
		{
			out(consoleInput.toString());
			parseCommand(consoleInput.toString());
			consoleInput.delete(0, consoleInput.length());
		}
	}

	/**
	 * True if console is currently visible.
	 * 
	 * @return True if the main Console prompt is open, false otherwise.
	 */
	public boolean isOpen()
	{
		return showConsole;
	}

	/**
	 * Parse console input and do whatever needs to be done.
	 * 
	 * @param com The command to parse.
	 */
	public void parseCommand(String com)
	{
		String args[] = com.split(" ");
		List<String> argv = Arrays.asList(args);

		switch (argv.get(0))
		{
		case "cammovespeed": //change speed of mouse aim (degrees per pixel)
			try {
				Camera.getInstance().moveSpeed = (Float.parseFloat(argv.get(1)));
			} catch (NumberFormatException e1) {
				out("cammovespeed must be a float");
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: cammovespeed <units per second>");
			}
			break;
		case "camturnspeed": //change speed of cam movement
			try {
				Camera.getInstance().turnSpeed = (Float.parseFloat(argv.get(1)));
			} catch (NumberFormatException e1) {
				out("cammousespeed must be a float");
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: camturnspeed <degrees per pixel>");
			}
			break;
		case "campos":
			try {
				//temp variables created so that the camera change only occurs
				//	if all 3 coords were successfully recovered
				int camX = Integer.parseInt(argv.get(1));
				int camY = Integer.parseInt(argv.get(2));
				int camZ = Integer.parseInt(argv.get(3));

				Camera.getInstance().position.x = camX;
				Camera.getInstance().position.y = camY;
				Camera.getInstance().position.z = camZ;
			} catch (NumberFormatException e1) {
				out("cam coord must be a number");
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: campos <x> <y> <z>");
			}
			break;
		//temp stuff
		case "dx":
			out(Integer.toString(Input.getInstance().getMouseDeltaX()));
			break;
		case "dy":
			out(Integer.toString(Input.getInstance().getMouseDeltaY()));
			break;
		case "exit": //quit the game
			Engine.getInstance().requestClose();
			break;
		case "fov": //change field of view
			try {
				Camera.getInstance().fov = Integer.parseInt(argv.get(1));
			} catch (NumberFormatException e1) {
				out("field of view must be a number");
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: fov <new fov>");
			}
			break;
		case "help": //display list of commands
			out("    cammovespeed");
			out("    camturnspeed");
			out("    campos");
			out("    dx");
			out("    dy");
			out("    exit");
			out("    fov");
			out("    help");
			out("    hide");
			out("    host");
			out("    join");
			out("    maxfps");
			out("    port");
			out("    show");
			break;
		case "hide": //hide a supplementary display
			try {
				String target = argv.get(1);
				switch (target)
				{
				case "sounddata":
					showSoundData = false;
					break;
				case "systems":
					showSystemsData = false;
					break;
				case "renderdata":
					showRenderData = false;
					break;
				default:
					out("Invalid hide target '" + target + "'");
					break;
				}
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: hide <soundchannels|systems|renderdata>");
			}
			break;
		case "host":
			out("Hosting...");
			Network.getInstance().host();
			break;
		case "join": //change network port
			String hostname;
			int port = 0;
			try {
				hostname = argv.get(1);
				port = Integer.parseInt(argv.get(2));

				Network.getInstance().join(new InetSocketAddress(hostname, port));
			} catch (IllegalArgumentException e0) {
				out("port '" + port + "' is an invalid port");
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: join <hostname/ip> <port>");
			}
			break;
		case "maxfps": //set max fps
			try {
				Engine.getInstance().setTargetFPS(Integer.parseInt(argv.get(1)));
			} catch (NumberFormatException e1) {
				out("fps must be a number");
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: maxfps <fps>");
			}
			break;
		case "port": //change network port
			try {
				Network.getInstance().setPort(Integer.parseInt(argv.get(1)));
			} catch (NumberFormatException e1) {
				out("port must be a number");
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: port <new port>");
			}
			break;
		case "show": //show a supplementary display
			try {
				String target = argv.get(1);
				switch (target)
				{
				case "sounddata":
					showSoundData = true;
					break;
				case "systems":
					showSystemsData = true;
					break;
				case "renderdata":
					showRenderData = true;
					break;
				default:
					out("Invalid show target '" + target + "'");
					break;
				}
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: show <sounddata|systems|renderdata>");
			}
			break;
		case "spectate": //set spectate mode (fly around with camera)
			try {
				spectate = Integer.parseInt(argv.get(1));
			} catch (NumberFormatException e1) {
				out("spectate must be 1 or 0");
			} catch (IndexOutOfBoundsException e2) {
				out("Usage: spectate <1|0>");
			}
			break;
		default:
			out("Unrecognized command '" + argv.get(0) + "'");
			break;
		}
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted src/me/dw/engine/DeviceEnumeration.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
package me.dw.engine;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;



public class DeviceEnumeration implements ActionListener
{
  	private JLabel adapterDetails;
  	private JLabel displayAdapter;
  	private JLabel driverVersion;
    
  	private JLabel displaySettings;
  	private JRadioButton radioWindowed;
  	private JRadioButton radioFullscreen;
    private ButtonGroup radioGroup;
    
  	private JCheckBox checkboxVsync;

  	private JComboBox<String> comboColorDepth;
  	private JComboBox<String> comboResolution;
  	private JComboBox<String> comboRefreshRate;

  	public class GraphicsOptions
  	{
  		public DisplayMode mode;
  		public boolean fullscreen;
  		public boolean vsync;
  	}
	
	public GraphicsOptions enumerate()
	{
		int i;
		DisplayMode[] modes = null;
		
		String displayAdapterString = Display.getAdapter();
		String driverVersionString = Display.getVersion();
		
		String fullscreenModes[] = null;
		Set<String> resolutionSet = new TreeSet<String>();
		Set<Integer> bitsPerPixelSet = new TreeSet<Integer>();
		Set<Integer> refreshRateSet = new TreeSet<Integer>();
		
		//Iterator<String> resolutionIterator;
		Iterator<Integer> bitsPerPixelIterator;
		Iterator<Integer> refreshRateIterator;
		
		//String resolutionList[];
		String bitsPerPixelList[];
		String refreshRateList[];
		
		try {
			modes = Display.getAvailableDisplayModes();
		} catch (LWJGLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		if (modes != null)
		{
			fullscreenModes = new String[modes.length];
			for (i = 0; i < modes.length; i++)
			{
				//put display modes into sorted array
				fullscreenModes[i] = modes[i].toString();
				
				//add string representation of resolution to a set
				resolutionSet.add(modes[i].getWidth() + " x " + modes[i].getHeight());
				//add bits per pixel to a set
				bitsPerPixelSet.add(modes[i].getBitsPerPixel());
				//add refresh rate to a set
				refreshRateSet.add(modes[i].getFrequency());
			}
			//Arrays.sort(fullscreenModes);
			//System.out.println("...");
			//for (i = 0; i < displaymodez.length; i++)
				//System.out.println(displaymodez[i]);
			//System.out.println("...");
		}
		
		//populate color depth list with strings for bits per pixel
		bitsPerPixelList = new String[bitsPerPixelSet.size()];
		bitsPerPixelIterator = bitsPerPixelSet.iterator();
		i = 0;
		while (bitsPerPixelIterator.hasNext())
		{
			bitsPerPixelList[i] = bitsPerPixelIterator.next().toString() + " Bits Per Pixel";
			i++;
		}
		
		//populate refresh rate list with strings for refresh rates
		refreshRateList = new String[refreshRateSet.size()];
		refreshRateIterator = refreshRateSet.iterator();
		i = 0;
		while (refreshRateIterator.hasNext())
		{
			refreshRateList[i] = refreshRateIterator.next().toString() + " Hertz";
			i++;
		}

		adapterDetails = new JLabel("Adapter Details");
		displayAdapter = new JLabel("Display Adapter: " + displayAdapterString);
		driverVersion = new JLabel("Driver Version: " + driverVersionString);
		
		displaySettings = new JLabel("DisplaySettings");

		radioWindowed = new JRadioButton("Windowed");
		radioWindowed.addActionListener(this);
		radioWindowed.setActionCommand("window");
		
		radioFullscreen= new JRadioButton("Fullscreen");
		radioFullscreen.addActionListener(this);
		radioFullscreen.setActionCommand("full");
		
		checkboxVsync= new JCheckBox("V-Sync");
		
		comboColorDepth = new JComboBox<String>(bitsPerPixelList);
		comboResolution = new JComboBox<String>(fullscreenModes); //changed from resolutionList
		comboRefreshRate = new JComboBox<String>(refreshRateList);
		
		comboColorDepth.setEnabled(false);
		//comboResolution.setEnabled(false);
		comboRefreshRate.setEnabled(false);
		
		//group radio buttons up
		radioGroup = new ButtonGroup();
		radioGroup.add(radioWindowed);
		radioGroup.add(radioFullscreen);
		
		//load settings script
		Script settings = new Script("DisplaySettings.scr", "./res/scripts/");
		
		//if script is empty, set default values
		if (settings.isEmpty())
		{
			//System.out.println("script empty");
			radioWindowed.setSelected(true);
			radioFullscreen.setSelected(false);
			checkboxVsync.setEnabled(false);
		}
		else
		{
			int comboIndex = -1;
			//System.out.println("loading saved values");
			if (settings.getBoolData("windowed"))
			{
				radioWindowed.setSelected(true);
				checkboxVsync.setEnabled(false);
			}
			else
			{
				radioFullscreen.setSelected(true);
			}

			checkboxVsync.setSelected(settings.getBoolData("vsync"));
			
			for (i = 0; i < fullscreenModes.length; i++)
			{
				if (fullscreenModes[i].equals(settings.getStringData("resolution")))
				{
					comboIndex = i;
					break;
				}
			}
			if (comboIndex != -1) //screen mode is available
			{
				comboResolution.setSelectedIndex(comboIndex);
			}
		}
		
		JComponent[] inputs = new JComponent[] {
				adapterDetails,
		        displayAdapter,
		        driverVersion,
		        displaySettings,
		        radioWindowed,
		        radioFullscreen,
		        checkboxVsync,
		        comboResolution,
		        //comboColorDepth,
		        //comboRefreshRate
		};
		
		int result = JOptionPane.showOptionDialog(null, inputs, "Graphics Settings", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null);
		if (result == JOptionPane.OK_OPTION)  
		{
			//return chosen display options
			GraphicsOptions go = new GraphicsOptions();
	  		go.fullscreen = radioFullscreen.isSelected();
	  		go.vsync = checkboxVsync.isSelected();
	  		go.mode = modes[comboResolution.getSelectedIndex()];
	  		
	  		//System.out.println("vsync: " + Boolean.toString(go.vsync));
			//save settings to script
			if (settings.isEmpty())
			{
				//System.out.println("saving to empty script");
				settings.addVariable("windowed", Variable.VarType.VAR_BOOL, Boolean.toString(!go.fullscreen));
				settings.addVariable("vsync", Variable.VarType.VAR_BOOL, Boolean.toString(go.vsync));
				settings.addVariable("resolution", Variable.VarType.VAR_STRING, (String)comboResolution.getSelectedItem());
			}
			else
			{
				//System.out.println("saving to existing script");
				settings.setVariable("windowed", Boolean.toString(!go.fullscreen));
				settings.setVariable("vsync", Boolean.toString(go.vsync));
				settings.setVariable("resolution", (String)comboResolution.getSelectedItem());
			}

			settings.saveScript();
	  		return go;
		}
		else
			return null;
	}
	
	@Override
	public void actionPerformed(ActionEvent e)
	{
		if (e.getActionCommand().equals("window"))
		{
			checkboxVsync.setEnabled(false);
			checkboxVsync.setSelected(false);
	        comboColorDepth.setEnabled(false);
	        //comboResolution.setEnabled(false);
	        comboRefreshRate.setEnabled(false);
		}
		else if (e.getActionCommand().equals("full"))
		{
			checkboxVsync.setEnabled(true);
	        comboColorDepth.setEnabled(true);
	        //comboResolution.setEnabled(true);
	        comboRefreshRate.setEnabled(true);
		}
		else
			System.out.println("unrecognized action command '" + e.getActionCommand() + "'");
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































Deleted src/me/dw/engine/Engine.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
package me.dw.engine;

import java.util.LinkedList;
import java.util.Random;

import org.lwjgl.LWJGLException;
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.openal.AL;
import org.lwjgl.openal.AL10;
import org.lwjgl.opengl.Display;



/**
 * Call create(EngineSetup es) to instantiate the engine, with an optional enginesetup class
 * that will apply application specific parameters to the engine, as well as an application
 * defined setup function, created by implementing StateSetup. pass null if no custom
 * parameters are necessary.
 * 
 * once instantiated with create(EngineSetup es), call getInstance() to get the singleton
 * 
 * @author Donny
 *
 */
public class Engine
{	
	private final static int FONT_SIZE = 12;
	
	private int target_fps;

	/**
	 * list of states added to the engine
	 */
	private LinkedList<State> states;

	/**
	 * the state that currently has control
	 * 
	 * (the state that the engine is currently processing each frame)
	 */
	private State currentState;

	/**
	 * used by the engine to indicate if the state has changed during the current frame
	 * 
	 * true if state has changed, else it is false
	 */
	boolean stateChanged;

	/** our random number generator */
	public Random randomer;

	/**
	 * true if engine is loaded and ready
	 */
	private boolean loaded;

	/**
	 * whether or not an instance has been created yet
	 */
	private static boolean instanced = false;

	private static Engine INSTANCE = null;

	/** Can close if this is true */
	private boolean closeRequested;

	public static final String SVN_REVISION = "#REVISION:-1#";

	/** The title of the program */
	private final String TITLE;

	/**
	 * Private constructor...
	 * 
	 * Makes use of singleton pattern
	 * Initialization on Demand Holder Idiom
	 */
	private Engine(EngineSetup es)
	{
		if (es == null)
			es = new EngineSetup();

		//check if system can run the game
		//if (!GLContext.getCapabilities().GL_ARB_vertex_buffer_object)
		//{
		//System.out.println("your video card does not support vertex buffers sry..");
		//return;
		//}

		loaded = false;

		target_fps = es.targetFPS;
		states = new LinkedList<State>();
		currentState = null;
		stateChanged = false;
		TITLE = es.appName;

		//setup device enumeration
		DeviceEnumeration.GraphicsOptions options;
		DeviceEnumeration device = new DeviceEnumeration();
		options = device.enumerate();
		if (options == null) //user didn't press OK, engine will not run()
			return;

		//setup display here, so that other modules (like input) can be created properly
		try {
			//Display.setDisplayModeAndFullscreen(new DisplayMode(options.resolutionWidth, options.resolutionHeight));
			Display.setDisplayMode(options.mode);
			Display.setFullscreen(options.fullscreen);
			Display.setVSyncEnabled(options.vsync);
			Display.setTitle(TITLE);
			Display.create();

			//load openAL and clear AL errors
			AL.create();
			AL10.alGetError();
		} catch (LWJGLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}


		Console.create(FONT_SIZE);
		Network.create(es.networkSetup);


		//seed random # generator
		randomer = new Random(System.nanoTime());

		//Allow the application to perform any state setup now.
		//if (es.setupFunc != null)
		//es.setupFunc.exec();

		loaded = true;
	}

	public static void create(EngineSetup es)
	{
		if (!instanced)
		{
			instanced = true;
			INSTANCE = new Engine(es);
			//engine must be loaded to avoid slick texture loading exception. the application is quitting
			//	anyways since we failed to load
			if (es.setupFunc != null && INSTANCE.isLoaded()) //moved here so that INSTANCE is set already before calling
				es.setupFunc.exec();
		}
	}

	public boolean isLoaded()
	{
		return loaded;
	}

	public static Engine getInstance()
	{
		return INSTANCE;
	}

	public State getCurrentState()
	{
		return currentState;
	}

	public void addState(State s, boolean changeNow)
	{
		states.add(s);

		if (!changeNow)
			return;

		if (currentState != null)
			currentState.close();

		currentState = states.getLast();
		currentState.load();
	}

	public void removeState(State s)
	{
		states.remove(s);
	}

	/*
	 * Get the current time in milliseconds.
	 */
	public long getTime()
	{
		return (Sys.getTime() * 1000L) / Sys.getTimerResolution();	
	}

	public int getTargetFPS()
	{
		return target_fps;
	}

	public void setTargetFPS(int fps)
	{
		if (fps < 1)
			fps = 1;
		target_fps = fps;
	}

	public String getTitle()
	{
		return TITLE;
	}

	public void requestClose()
	{
		closeRequested = true;
	}

	public void run()
	{
		long currentTime = (Sys.getTime() * 1000) / Sys.getTimerResolution();
		long prevTime = currentTime;
		long deltaTMilliseconds;
		float deltaTSeconds;
		if (loaded)
		{
			//write a summary of the application as a header
			String s = Engine.SVN_REVISION;
			//$REVISION:1234$ - from char after ':', to the last '$'
			String revision = s.substring(s.indexOf(':')+1, s.lastIndexOf('#'));
			Console.getInstance().out("----" + Engine.getInstance().getTitle() + " started----");
			Console.getInstance().out("====Starfighter Engine Revision " + revision + "====");
			while (!closeRequested)
			{
				if (true) //if window is in focus
				{
					//get time
					currentTime = getTime();
					deltaTMilliseconds = (currentTime - prevTime);
					deltaTSeconds = deltaTMilliseconds / 1000.0f;
					prevTime = currentTime;

					Network.getInstance().update(); //process network if need be
					Input.getInstance().update(); //update state of input
					Console.getInstance().update(deltaTSeconds); //update console

					if (Display.isCloseRequested() || Input.getInstance().getKeyPress(Keyboard.KEY_F12))
						requestClose();

					//console controls
					
					//moved to Input
					//if (Input.getInstance().getKeyPress(Keyboard.KEY_GRAVE)) //tilde
						//Console.getInstance().toggleConsole();
					if (Input.getInstance().getKeyPress(Keyboard.KEY_UP))
						Console.getInstance().setConsoleOffset(Console.getInstance().getConsoleOffset()+1);
					else if (Input.getInstance().getKeyPress(Keyboard.KEY_DOWN))
						Console.getInstance().setConsoleOffset(Console.getInstance().getConsoleOffset()-1);

					//update current state if there is one
					stateChanged = false;
					if (currentState != null)
						currentState.update(deltaTSeconds);
					if (stateChanged) //if the update caused a state change, skip rest of this loop iteration
						continue;

					//render current state
					if (currentState != null)
						currentState.render();

					Display.update(); //swap screen buffer



					Display.sync(target_fps); //keep on target
				}
			}
			if (currentState != null)
				currentState.close();
			//System.out.println("engine destroying openal/opengl");
			AL.destroy();
			Display.destroy();
			Console.getInstance().out("====" + Engine.getInstance().getTitle() + " exiting====");
		}
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































Deleted src/me/dw/engine/EngineSetup.java.

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
package me.dw.engine;

	
/**
 * engine setup class. to be filled out by the application and passed
 * to the engine constructor. the application will define behavior
 * for setting up the states by implementing Statesetup and passing
 * it to the engine from within EngineSetup
 * @author Donny
 *
 */
public class EngineSetup
{
	/**
	 * to be implemented by the application
	 * @author Donny
	 *
	 */
	public interface StateSetup
	{
		public void exec();
	}
		
	public String appName;
	public float scale; //unit scale
	public StateSetup setupFunc;
	public int targetFPS;
	public NetworkSetup networkSetup;
	
	public EngineSetup()
	{
		appName = "The Game";
		scale = 1.0f;
		setupFunc = null;
		targetFPS = Integer.MAX_VALUE; //no limit
		networkSetup = null;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































Deleted src/me/dw/engine/EntityManager.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
package me.dw.engine;

import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.UUID;

public class EntityManager
{
	//master list. if entity isnt here, it doesn't exist
	private SortedSet<UUID> entities; //sorted for quick searching

	//map each entity to its key signature (as determined by its components)
	private Map<UUID, Long> entityKeys;

	//map of names to entities. for assigning unique human readable names
	private Map<String, UUID> entityTags;

	private static boolean instanced = false;
	private static EntityManager INSTANCE = null;

	/*
	 * Every Component is stored here. The ID of a Component type is mapped to
	 * a map of all entities that contain this Component type. Each entity is
	 * mapped to its specific instance of the Component. 
	 */
	private Map<Long, Map<UUID, Component>> components;

	//reserved tag names for the engine (you cant assign any tag in this list
	//	to an entity).
	private SortedSet<String> keywords;
	
	private EntityManager()
	{
		int i;
		entities = new TreeSet<UUID>();
		entityTags = new TreeMap<String, UUID>();
		entityKeys = new TreeMap<UUID, Long>();
		components = new TreeMap<Long, Map<UUID, Component>>();

		//initialize map of all possible component ID's (# bits in long)
		for (i = 0; i < 64; i++)
			components.put(1L << i, new TreeMap<UUID, Component>());
		
		//init keywords
		keywords = new TreeSet<String>();
		keywords.add("camera");
		
		//create camera entity
	}

	public static void create()
	{
		if (!instanced)
		{
			instanced = true;
			INSTANCE = new EntityManager();
		}
	}

	public static void destroy()
	{
		if (instanced)
		{
			instanced = false;
			INSTANCE = null;
		}
	}

	public static EntityManager getInstance()
	{
		return INSTANCE;
	}

	/**
	 * Create a new Entity.
	 * 
	 * @return The UUID uniquely identifying the Entity.
	 */
	public UUID createEntity()
	{
		UUID ent = UUID.randomUUID();
		entities.add(ent);

		//initialize key signature to 0
		entityKeys.put(ent, 0L);

		return ent;
	}

	/** Create a new Entity from a Script.
	 * 
	 * Format for the Script (do not insert '<', '>'):
	 * 
	 * #begin
	 * tag string <name of entity tag>
	 * components string <Component1,Component2>
	 * #end
	 * 
	 * The tag variable is optional. The Components listed in the components
	 * variable must be on the same line, and match the SimpleName of the
	 * Component to instantiate. An example script with no tag, that adds the
	 * components "Position" and "Orientation" to the entity is:
	 * 
	 * #begin
	 * components string Position,Orientation
	 * 
	 * Position:x number 0
	 * Position:y number 2
	 * Position:z number 0
	 * 
	 * #end
	 * 
	 * @param scrName The name of the @Script to read.
	 * @param scrPath The relative location of the @Script.
	 * @return The UUID of the created Entity.
	 */
	public UUID createEntity(String scrName, String scrPath)
	{
		UUID ent = UUID.randomUUID();
		entities.add(ent);

		//initialize key signature to 0
		entityKeys.put(ent, 0L);

		Script entityFile = new Script(scrName, scrPath);

		//setEntityTag(ent, entityFile.getStringData("tag")); //todo catch script's exception for no tag
		String comps = entityFile.getStringData("components");
		String list[] = comps.split(",");
		for (int i = 0; i < list.length; i++)
		{
			Component c = createComponent(list[i], ent);

			//fields of the derived component class, not tied to any instance
			Field genericFields[] = null;
			try {
				genericFields = Class.forName(list[i]).getFields();
				List<Field> l = Arrays.asList(genericFields);
				//System.out.println("Fields for " + list[i]);
				for (Field f : l)
				{
					//System.out.println(f.toString());
					String v = c.getClass().getSimpleName() + ":" + f.getName();
					//System.out.println("var to chase '" + v + "'");

					try {
						//this is performed to ensure the data exists
						//(checking for exception thrown)
						entityFile.getUnknownData(v);

						switch (entityFile.getVarType(v))
						{
						case "bool":
							f.setBoolean(c, entityFile.getBoolData(v));
							break;
							//case "color":
							//f.setColor(c, (color) entityFile.getColorData(v));
							//break;
						case "float":
							f.setFloat(c, (float) entityFile.getFloatData(v));
							break;
						case "number":
							f.setInt(c, (int) entityFile.getNumberData(v));
							break;
						case "string":
							f.set(c, entityFile.getStringData(v));
							break;
							//case "vector":
							//f.setColor(c, (color) entityFile.getColorData(v));
							//break;
							//case "unknown":
							//f.setColor(c, (color) entityFile.getColorData(v));
							//break;
						}
					} catch (IllegalArgumentException | IllegalAccessException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (NullPointerException n) { //variable not in script
						//System.out.println("var " + v + " not in script");
					}
				}
			} catch (SecurityException | ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return ent;
	}

	/**
	 * Create a Component whose ID matches componentName, and attach it to an
	 * entity. Also updates the entity's key to reflect that it contains the
	 * new component.
	 * 
	 * @param componentName The name of the Component implementing class to
	 * create.
	 * @param entityID The UUID of the entity to attach the Component to.
	 * @return The created Component.
	 */
	public Component createComponent(String componentName, UUID entityID)
	{
		try {
			@SuppressWarnings("rawtypes")
			Class c = Class.forName(componentName);
			Component comp = (Component)c.newInstance();
			components.get(comp.getID()).put(entityID, comp);

			//update entity's key
			long oldKey = entityKeys.get(entityID);
			entityKeys.put(entityID, oldKey | comp.getID());
			return comp;
		} catch (LinkageError le) {
			le.printStackTrace();
		} catch (ClassNotFoundException cnfe) {
			cnfe.printStackTrace();
		} catch (IllegalAccessException iae) {
			iae.printStackTrace();
		} catch (InstantiationException ie) {
			ie.printStackTrace();
		} catch (SecurityException se) {
			se.printStackTrace();
		}
		return null;
	}

	/**
	 * Create a Component whose ID matches componentName, and attach it to an
	 * entity. Also updates the entity's key to reflect that it contains the
	 * new component.
	 * 
	 * @param componentName The name of the Component implementing class to
	 * create.
	 * @param entityTag The tag of the entity to attach the Component to.
	 */
	public Component createComponent(String componentName, String entityTag)
	{
		return createComponent(componentName, getEntityByTag(entityTag));
	}

	/**
	 * Remove an entity from the EntityManager. Any calls that refer to this
	 * entity will report this entity as non existent.
	 * 
	 * @param entityID The UUID of the entity to remove.
	 */
	public void removeEntity(UUID entityID)
	{
		entities.remove(entityID);
		entityKeys.remove(entityID);
	}

	/**
	 * Remove an entity from the EntityManager. Any calls that refer to this
	 * entity will report this entity as non existent.
	 * 
	 * @param entityTag The tag of the entity to remove.
	 */
	public void removeEntity(String entityTag)
	{
		removeEntity(getEntityByTag(entityTag));
	}

	/**
	 * Set the tag of an entity. Allows an entity to later be referred to by
	 * this tag. Note that setting multiple tags on an entity does not remove
	 * the previous tag references. Previous tag references will only be
	 * removed when the tag is applied to a new entity.
	 * 
	 * @param entity The UUID of the entity to tag.
	 * @param entityTag The tag to refer to the entity by.
	 */
	public void setEntityTag(UUID entity, String entityTag)
	{
		entityTags.put(entityTag, entity);
	}

	/**
	 * Get an entity by its tag.
	 * 
	 * @param entityTag The tag of the entity to get.
	 * @return The UUID of the entity, or null if the entity doesn't exist.
	 */
	public UUID getEntityByTag(String entityTag)
	{
		UUID ent = entityTags.get(entityTag);
		//tagged entities that are removed leave their tag behind. so check 1st
		if (ent == null)
			return null;
		else if (entities.contains(ent))
			return null;
		else
			return ent;
	}

	/**
	 * Get a specific Component instance which belongs to an Entity.
	 * 
	 * @param compType The Component.getID() of the Component.
	 * @param entityID The UUID of the entity to retrieve the Component type
	 * from.
	 * @return The Component of the given type that belongs to the given entity,
	 * or null if the Component does not exist in the entity.
	 */
	public Component getComponentFromEntity(long compType, UUID entityID)
	{
		if (entityID == null || !entities.contains(entityID))
			return null;
		return components.get(compType).get(entityID);
	}

	/**
	 * Get a list of all existing Components of the same type.
	 * @param compType The Component.getID() of the Component.
	 * @return A List of all Components with a matching compType.
	 */
	public Collection<Component> getAllComponentsOfType(long compType)
	{
		return components.get(compType).values();
	}

	/**
	 * Get a Sorted Set of all Entities that contain a specific Component type.
	 * @param compType The Component.getID() of the Component.
	 * @return A SortedSet of all Entities that contain a Component matching
	 * the given compType.
	 */
	public SortedSet<UUID> getAllEntitiesWithComponentType(long compType)
	{
		return (SortedSet<UUID>)components.get(compType).keySet();
	}

	/**
	 * Get a Sorted Set of all Entities which contain ALL Components defined
	 * in a given bit field.
	 * 
	 * @param lock Bit field defining Components that must exist in the Entity.
	 * @param strict True if an Entity key must match the lock exactly, false
	 * if the Entity may contain more components then specified by the lock.
	 * @return A SortedSet of all Entities whose key fits the requirements of
	 * the lock.
	 */
	public SortedSet<UUID> getAllEntitiesThatFitLock(long lock, boolean strict)
	{
		SortedSet<UUID> matches = new TreeSet<UUID>();
		for (UUID ent : entities)
		{
			if (strict)
			{
				if (entityKeys.get(ent) == lock)
					matches.add(ent);
			}
			else
			{
				if ((entityKeys.get(ent) & lock) == lock)
					matches.add(ent);
			}
		}
		return matches;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































































































































































































































































Deleted src/me/dw/engine/Input.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
package me.dw.engine;

import java.awt.event.MouseAdapter;

import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;


public class Input
{
	private long mousePressStamps[];

	/**
	 * each key has a number of stamps. 0 stamps means the key is not currently
	 * pressed. 1 or greater stamps means the key has already been pressed down.
	 * when a key is released, its stamps go back down to 0.
	 */
	private long keyPressStamps[];

	/** delta values for mouse */
	private int lastMX;
	private int lastMY;
	private int currMX;
	private int currMY;
	
	//set in constructor, Display must already be created.
	//dont call Input.getInstance() before then or this wont
	//be set right
	private int mouseCenterX;
	private int mouseCenterY;
	
	/**
	 * Private constructor...
	 * 
	 * Makes use of singleton pattern
	 * Initialization on Demand Holder Idiom
	 * @throws Exception If the Display has not been created yet, which is
	 * needed in order to obtain screen dimensions.
	 */
	private Input()
	{
		mousePressStamps = new long[Mouse.getButtonCount()];
		keyPressStamps = new long[Keyboard.KEYBOARD_SIZE];
		
		/*
		if (!Display.isCreated())
		{
			mouseCenterX = Display.getWidth()/2;
			mouseCenterX = Display.getHeight()/2;
		}
		else
			Console.getInstance().out("Input was summoned before Display creation");
			//throw new Exception("Input was summoned before Display creation");
			 * 
			 */
	}

	private static class InputHolder
	{
		private static final Input INSTANCE = new Input();
	}

	public static Input getInstance()
	{
		return InputHolder.INSTANCE;
	}

	public void update()
	{
		int i;
		Keyboard.poll();
		Mouse.poll();

		//lastMX = currMX;
		//lastMY = currMY;
		currMX = getMouseX();
		currMY = getMouseY();
		
		for (i = 0; i < keyPressStamps.length; i++)
		{
			if (Keyboard.isKeyDown(i))
				keyPressStamps[i]++;
			else
				keyPressStamps[i] = 0;
		}

		for (i = 0; i < mousePressStamps.length; i++)
		{
			if (Mouse.isButtonDown(i))
				mousePressStamps[i]++;
			else
				mousePressStamps[i] = 0;
		}


		//put current input into console if it is open
		if (Console.getInstance().isOpen())
		{
			for (i = 0; i < keyPressStamps.length; i++)
			{
				if (helperKeyPress(i, false) && getKeyChar(i) != '\0')
				{
					Console.getInstance().in(getKeyChar(i));
				}
			}
		}

		if (helperKeyPress(Keyboard.KEY_GRAVE, false)) //tilde
			Console.getInstance().toggleConsole();
		
		//reset mouse
		//System.out.println("mouse created: " + Mouse.isCreated());
		//System.out.println("mouse grabbed: " + Mouse.isGrabbed());
		lastMX = Display.getWidth()/2;
		lastMY = Display.getHeight()/2;
		Mouse.setCursorPosition(lastMX, lastMY);
		//mouseCenterX = Display.getWidth()/2;
		//mouseCenterX = Display.getHeight()/2;
		//Mouse.setClipMouseCoordinatesToWindow(true);
	}

	//if console is open, all controls go to console.
	public boolean getKeyPress(int key)
	{
		if (Console.getInstance().isOpen())
			return false;
		return helperKeyPress(key, false);
	}

	/**
	 * 
	 * @param key the Keyboard.KEY_ constant to check
	 * @param ignorePressStamp true if we want to check if key is currently down.
	 * 			false if we want to check if the key was just pressed down during last update.
	 * @return
	 */
	public boolean getKeyPress(int key, boolean ignorePressStamp)
	{//TODO: make it so outside classes can only get a true if the console is
		//	closed. internally though, skip the check
		//DOING: the above TODO. clear this when test is successful
		if (Console.getInstance().isOpen())
			return false;
		return helperKeyPress(key, ignorePressStamp);
	}

	/** The logic for key press resides here. Implemented so that the Console
	 * can bypass straight to this check, while objects outside this class must
	 * go through the public interface first (which checks to see if the
	 * Console is open first */
	private boolean helperKeyPress(int key, boolean ignorePressStamp)
	{
		boolean pressed = true;

		if (keyPressStamps[key] == 0) //key not pressed
			return false;

		if (ignorePressStamp)
		{
			if (keyPressStamps[key] > 1)
				pressed = true;
			else
				pressed = false;
		}
		else
		{
			if (keyPressStamps[key] > 1)
				pressed = false;
			else
				pressed = true;
		}

		return pressed;
	}

	public boolean getMouseButtonPress(int button)
	{
		if (Console.getInstance().isOpen())		
			return false;
		return helperMouseButtonPress(button, false);
	}

	public boolean getMouseButtonPress(int button, boolean ignorePressStamp)
	{
		if (Console.getInstance().isOpen())		
			return false;
		return helperMouseButtonPress(button, ignorePressStamp);
	}

	private boolean helperMouseButtonPress(int button, boolean ignorePressStamp)
	{
		boolean pressed = true;

		if (mousePressStamps[button] == 0) //button not pressed
			return false;

		if (ignorePressStamp)
		{
			if (mousePressStamps[button] > 1)
				pressed = true;
			else
				pressed = false;
		}
		else
		{
			if (mousePressStamps[button] > 1)
				pressed = false;
			else
				pressed = true;
		}

		return pressed;
	}

	public int getMouseX()
	{
		return Mouse.getX();
	}

	public int getMouseY()
	{
		return Mouse.getY();
	}

	public int getMouseDeltaX()
	{
		return currMX - lastMX;
	}

	public int getMouseDeltaY()
	{
		return currMY - lastMY;
	}

	/**
	 * Convert the given Keyboard.KEY value to a character, for console/chat.
	 * 
	 * @return The given key, in char format.
	 */
	public char getKeyChar(int key)
	{
		switch (key)
		{
		//numbers
		case Keyboard.KEY_0:
			return '0';
		case Keyboard.KEY_1:
			return '1';
		case Keyboard.KEY_2:
			return '2';
		case Keyboard.KEY_3:
			return '3';
		case Keyboard.KEY_4:
			return '4';
		case Keyboard.KEY_5:
			return '5';
		case Keyboard.KEY_6:
			return '6';
		case Keyboard.KEY_7:
			return '7';
		case Keyboard.KEY_8:
			return '8';
		case Keyboard.KEY_9:
			return '9';

		//letters
		case Keyboard.KEY_A:
			return 'a';
		case Keyboard.KEY_B:
			return 'b';
		case Keyboard.KEY_C:
			return 'c';
		case Keyboard.KEY_D:
			return 'd';
		case Keyboard.KEY_E:
			return 'e';
		case Keyboard.KEY_F:
			return 'f';
		case Keyboard.KEY_G:
			return 'g';
		case Keyboard.KEY_H:
			return 'h';
		case Keyboard.KEY_I:
			return 'i';
		case Keyboard.KEY_J:
			return 'j';
		case Keyboard.KEY_K:
			return 'k';
		case Keyboard.KEY_L:
			return 'l';
		case Keyboard.KEY_M:
			return 'm';
		case Keyboard.KEY_N:
			return 'n';
		case Keyboard.KEY_O:
			return 'o';
		case Keyboard.KEY_P:
			return 'p';
		case Keyboard.KEY_Q:
			return 'q';
		case Keyboard.KEY_R:
			return 'r';
		case Keyboard.KEY_S:
			return 's';
		case Keyboard.KEY_T:
			return 't';
		case Keyboard.KEY_U:
			return 'u';
		case Keyboard.KEY_V:
			return 'v';
		case Keyboard.KEY_W:
			return 'w';
		case Keyboard.KEY_X:
			return 'x';
		case Keyboard.KEY_Y:
			return 'y';
		case Keyboard.KEY_Z:
			return 'z';

		//special
		case Keyboard.KEY_SPACE:
			return ' ';
		case Keyboard.KEY_RETURN:
			return '\n';
		case Keyboard.KEY_BACK:
			return 8; //ascii backspace
		case Keyboard.KEY_SLASH:
			return '/';
		case Keyboard.KEY_MINUS:
			return '-';
		case Keyboard.KEY_PERIOD:
			return '.';
		case Keyboard.KEY_UNDERLINE: //FIXME doesnt work
			return '_';
			
		default: //return a char identifying that the given key isnt mapped
			return '\0';
		}
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































Deleted src/me/dw/engine/Material.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
package me.dw.engine;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;

/**
 * Sample material script:
 * 
 * #begin
 * 
 * texture 		string
 * ignore_face	bool
 * ignore_fog	bool
 * ignore_ray	bool
 * 
 * transparency	color
 * 
 * diffuse		color
 * ambient		color
 * specular		color
 * emmisive		color
 * specpower	color
 * 
 * #end
 */

/**
 * 
 * @author Donny
 *
 */
public class Material extends Resource
{
	public static final int R = 0;
	public static final int G = 1;
	public static final int B = 2;
	public static final int A = 3;
	private static final int RGBA_SIZE = 4;

	private Texture texture;
	private Lighting lightProperties;
	private int width;
	private int height;
	private boolean ignoreFace;
	private boolean ignoreFog;
	private boolean ignoreRay;

	public static class MaterialSetup
	{
		public Texture texture;
		public Lighting lightProperties;
		public int width;
		public int height;
		private boolean ignoreFace;
		private boolean ignoreFog;
		private boolean ignoreRay;

		public MaterialSetup()
		{
			texture = null;
			lightProperties = new Lighting();
		}
	}

	public static class Lighting
	{
		public float diffuse[];
		public float ambient[];
		public float specular[];
		public float emissive[];
		public float specpower;

		public Lighting()
		{
			diffuse = new float[] {0.0f, 0.0f, 0.0f, 0.0f};
			ambient = new float[] {0.0f, 0.0f, 0.0f, 0.0f};
			specular = new float[] {0.0f, 0.0f, 0.0f, 0.0f};
			emissive = new float[] {0.0f, 0.0f, 0.0f, 0.0f};
		}

		public Lighting(float diffuseRGBA[], float ambientRGBA[], float specularRGBA[], float emissiveRGBA[], float specularPower) throws IllegalArgumentException
		{
			int i;
			if (diffuseRGBA == null)
				diffuseRGBA = new float[] {0.0f, 0.0f, 0.0f, 0.0f};
			if (ambientRGBA == null)
				ambientRGBA = new float[] {0.0f, 0.0f, 0.0f, 0.0f};
			if (specularRGBA == null)
				specularRGBA = new float[] {0.0f, 0.0f, 0.0f, 0.0f};
			if (emissiveRGBA == null)
				emissiveRGBA = new float[] {0.0f, 0.0f, 0.0f, 0.0f};

			List<Float> diffuseList = new ArrayList<Float>();
			List<Float> ambientList = new ArrayList<Float>();
			List<Float> specularList = new ArrayList<Float>();
			List<Float> emissiveList = new ArrayList<Float>();

			for (float f : diffuseRGBA)
				diffuseList.add(f);
			for (float f : ambientRGBA)
				ambientList.add(f);
			for (float f : specularRGBA)
				specularList.add(f);
			for (float f : emissiveRGBA)
				emissiveList.add(f);

			//constrain values to [0..1], add value if missing
			for (i = 0; i < RGBA_SIZE; i++)
			{
				try {
					if (diffuseList.get(i) < 0.0f)
						diffuseList.set(i, 0.0f);
					else if (diffuseList.get(i) > 1.0f)
						diffuseList.set(i, 0.0f);
				} catch (IndexOutOfBoundsException e) {
					diffuseList.add(0.0f);
				}

				try {
					if (ambientList.get(i) < 0.0f)
						ambientList.set(i, 0.0f);
					else if (ambientList.get(i) > 1.0f)
						ambientList.set(i, 0.0f);
				} catch (IndexOutOfBoundsException e) {
					ambientList.add(0.0f);
				}

				try {
					if (specularList.get(i) < 0.0f)
						specularList.set(i, 0.0f);
					else if (specularList.get(i) > 1.0f)
						specularList.set(i, 0.0f);
				} catch (IndexOutOfBoundsException e) {
					specularList.add(0.0f);
				}

				try {
					if (emissiveList.get(i) < 0.0f)
						emissiveList.set(i, 0.0f);
					else if (emissiveList.get(i) > 1.0f)
						emissiveList.set(i, 0.0f);
				} catch (IndexOutOfBoundsException e) {
					specularList.add(0.0f);
				}
			}
			diffuse = diffuseRGBA;
			ambient = ambientRGBA;
			specular = specularRGBA;
			emissive = emissiveRGBA;
			specpower = specularPower;
		}
	}

	//create from material script
	public Material(String rName, String rPath)
	{
		super(rName, rPath);

		//load image
		try {
			texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(getFilename()));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		//load material script
		Script matScript = new Script(rName, rPath);

		try {
			lightProperties = new Lighting(	matScript.getColorData("diffuse"),
					matScript.getColorData("ambient"),
					matScript.getColorData("specular"),
					matScript.getColorData("emissive"),
					matScript.getFloatData("specpower") );
			width = texture.getImageWidth();
			height = texture.getImageHeight();
			ignoreFace = matScript.getBoolData("ignore_face");
			ignoreFog = matScript.getBoolData("ignore_fog");
			ignoreRay = matScript.getBoolData("ignore_ray");
		} catch (NullPointerException e) {
			e.printStackTrace();
		}
	}

	public Material() {
		// TODO Auto-generated constructor stub
		super();
	}

	public void init(MaterialSetup ms)
	{
		texture = ms.texture;
		lightProperties = ms.lightProperties;
		width = ms.width;
		height = ms.height;
		ignoreFace = ms.ignoreFace;
		ignoreFog = ms.ignoreFog;
		ignoreRay = ms.ignoreRay;
	}

	public Texture getTexture()
	{
		return texture;
	}

	public Lighting getLighting()
	{
		return lightProperties;
	}

	public int getWidth()
	{
		return width;
	}

	public int getHeight()
	{
		return height;
	}

	public boolean getIgnoreFace()
	{
		return ignoreFace;
	}

	public boolean getIgnoreFog()
	{
		return ignoreFog;
	}

	public boolean getIgnoreRay()
	{
		return ignoreRay;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































Deleted src/me/dw/engine/Mesh.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
package me.dw.engine;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

import me.dw.engine.Material.MaterialSetup;

import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;

/** Any 3D object, or terrain. If loading terrain is desired, you must load a
 * Script (.scr) which contains the path to a heightmap image, as well as info
 * on how to setup the terrain (size, textures etc).
 * 
 * @author Donny
 *
 */
public class Mesh extends Resource
{
	private ArrayList<Vector3f> vertices;
	private ArrayList<Vector2f> texCoords;
	private ArrayList<Vector3f> vertexNormals;
	private ArrayList<Face> faces;
	private ArrayList<Material> materials;
	private Map<String, Material> materialNames;

	private Vector3f min, max;

	//for terrain
	boolean terrain; //true if I represent terrain
	private int voxelSize;
	short heightmap[][];
	private int heightmapWidth;
	private int heightmapHeight;
	private short heightmapMaxVal;

	public class Face
	{
		public ArrayList<Integer> vIndices;
		public ArrayList<Integer> texCoordIndices;
		public ArrayList<Integer> normalIndices;
		public String material;

		public Face()
		{
			vIndices = new ArrayList<Integer>();
			texCoordIndices = new ArrayList<Integer>();
			normalIndices = new ArrayList<Integer>();
		}

		public void addVertex(int vertexIndex, int textureIndex, int normalIndex)
		{
			vIndices.add(vertexIndex);
			texCoordIndices.add(textureIndex);
			normalIndices.add(normalIndex);
		}
	}

	public Mesh(String rName, String rPath)
	{
		super(rName, rPath);

		vertices = new ArrayList<Vector3f>();
		texCoords = new ArrayList<Vector2f>();
		vertexNormals = new ArrayList<Vector3f>();
		faces = new ArrayList<Face>();
		materials = new ArrayList<Material>();
		materialNames = new TreeMap<String, Material>();

		min = new Vector3f(Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE);
		max = new Vector3f(-Float.MAX_VALUE, -Float.MAX_VALUE, -Float.MAX_VALUE);

		//for terrain
		terrain = false;
		heightmap = null;

		//load the mesh
		loadMesh();
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		if (terrain)
		{
			sb.append("[TerrainMesh] ");
			sb.append("voxelSize: " + voxelSize);
			sb.append("width: " + heightmapWidth);
			sb.append("height: " + heightmapHeight);
			sb.append("maxVal: " + heightmapMaxVal);
		}
		else
			sb.append("[Mesh] ");
		sb.append("verts: " + vertices.size() + ", faces: " + faces.size());
		return sb.toString();
	}

	private void loadMesh()
	{
		String extension = getName().substring(getName().lastIndexOf('.')).toLowerCase();
		switch (extension)
		{
		case ".obj": //wavefront
			loadOBJ();
			break;
		case ".md2": //quake 2
			loadMD2();
			break;
		case ".scr": //script file defining terrain
			loadTerrain();
			break;
		default:
			System.out.println("Unknown mesh file type '" + extension + "'");
			break;
		}
	}

	private void loadOBJ()
	{
		try {
			Scanner scan = new Scanner(new FileInputStream(new File(getFilename())));
			String line;
			//String tokens[];
			List<String> tokens;
			//min and max values of all vertices
			String useMtl = "";

			while (scan.hasNext())
			{
				line = scan.nextLine();
				if (line.length() > 0)
				{
					while (line.charAt(line.length()-1) == '\\') //cont on next line
						line = line.substring(0, line.length()-1) + " " + scan.nextLine();
				}
				//System.out.println("'" + line + "'");
				if (line.isEmpty()) //newline
					continue;
				if (line.charAt(0) == '#') //comment
					continue;
				tokens = Arrays.asList(line.split("\\s+"));
				switch (tokens.get(0))
				{
				//vertex data
				case "v": //vertex
					Vector3f v = new Vector3f(Float.parseFloat(tokens.get(1)), Float.parseFloat(tokens.get(2)), Float.parseFloat(tokens.get(3)));
					if (v.x < min.x)
						min.x = v.x;
					if (v.y < min.y)
						min.y = v.y;
					if (v.z < min.z)
						min.z = v.z;
					if (v.x > max.x)
						max.x = v.x;
					if (v.y > max.y)
						max.y = v.y;
					if (v.z > max.z)
						max.z = v.z;
					vertices.add(v);
					break;
				case "vt": //tex coord
					texCoords.add(new Vector2f(Float.parseFloat(tokens.get(1)), Float.parseFloat(tokens.get(2))));
					break;
				case "vn": //vertex normal
					vertexNormals.add(new Vector3f(Float.parseFloat(tokens.get(1)), Float.parseFloat(tokens.get(2)), Float.parseFloat(tokens.get(3))));
					break;
				case "vp": //parameter space vertex
					break;

					//free-form curve/surface attributes
				case "deg": //degree
				case "bmat": //basis matrix
				case "step": //step size
				case "cstype": //curve of surface type

					//elements
				case "p": //point
				case "l": //line
					break;
				case "f": //face
					//split a face value such as 123/434/2134 by /'s (v/vt/vn)
					List<String> localToken;
					Face f = new Face();	
					//go through each token except (0), and tokenize it if it
					//	has /'s
					for (int i = 1; i < tokens.size(); i++)
					{
						if (tokens.get(i).contains("/"))
						{
							localToken = Arrays.asList(tokens.get(i).split("/"));

							for (int j = 0; j < localToken.size(); j++)
							{
								if (j == 0)
									f.vIndices.add(Integer.parseInt(localToken.get(j))-1);
								else if (j == 1)
									f.texCoordIndices.add(Integer.parseInt(localToken.get(j))-1);	
								else if (j == 2)
									f.normalIndices.add(Integer.parseInt(localToken.get(j))-1);
							}
						}
						else //only the vertex data
							f.vIndices.add(Integer.parseInt(tokens.get(i))-1);
					}
					f.material = useMtl;
					if (f.material == null)
						System.out.println(".");
					faces.add(f);
					break;
				case "curv": //curve
				case "curv2": //2d curve
				case "surf": //surface

					//free-form curve/surface body statements
				case "parm": //parameter values
				case "trim": //outer trimming loop
				case "hole": //inner trimming loop
				case "scrv": //special curve
				case "sp": //special point
				case "end": //end statement

					//connectivity between free-form surfaces
				case "con": //connect
					break;

					//grouping:
				case "g": //group name
					break;
				case "s": //smoothing group
					break;
				case "mg": //merging group
				case "o": //object name

					//display/render attributes
				case "bevel": //bevel interpolation
				case "c_interp": //color interpolation
				case "d_interp": //dissolve interpolation
				case "lod": //level of detail
					break;
				case "usemtl": //material name
					useMtl = tokens.get(1);
					break;
				case "mtllib": //material library
					parseMTL(tokens.get(1));
					break;
				case "shadow_obj": //shadow casting
				case "trace_obj": //ray tracing
				case "ctech": //curve approximation technique
				case "stech": //surface approximation technique

				default:
					System.out.println("Invalid keyword in .obj '" + tokens.get(0) + "'");
					break;
				}
			}
			scan.close();
			//System.out.println(getFilename() + " loaded. min = " + min.toString() + ", max = " + max.toString());

			//center obj 2
			//and rotate it since its not oriented correctly (but seems to be
			//	correct in blender...)
			Quaternion q = new Quaternion();
			q.setFromAxisAngle(new Vector4f(1, 0, 0, 3.14f/2.0f));
			for (int i = 0; i < vertices.size(); i++)
			{
				Vector3f v = vertices.get(i);

				v.x -= getCenter().x;
				v.y -= getCenter().y;
				v.z -= getCenter().z;
				vertices.set(i, QuaternionHelper.rotateVector(v, q)); 
			}

		} catch (FileNotFoundException e1) {
			//TODO
			e1.printStackTrace();
		} catch (IndexOutOfBoundsException e2) {
			//TODO
			e2.printStackTrace();
		} catch (NumberFormatException e3) {
			//TODO
			e3.printStackTrace();
		}

	}

	private void parseMTL(String filename)
	{
		try {
			Scanner scan = new Scanner(new FileInputStream(new File(getPath() + filename)));
			String line;
			List<String> tokens;
			Material mat = null;
			MaterialSetup matSetup = null;

			while (scan.hasNext())
			{
				line = scan.nextLine();
				//System.out.println("'" + line + "'");
				if (line.isEmpty()) //newline
					continue;
				if (line.charAt(0) == '#') //comment
					continue;
				//TODO: if the end of the line has '\', get next line and concat
				tokens = Arrays.asList(line.split("\\s+"));
				switch (tokens.get(0))
				{
				//new material
				case "newmtl": //vertex
					try {
						if (mat == null) //first mtl
						{
							mat = new Material();
							materials.add(mat);
							materialNames.put(tokens.get(1), mat);
							matSetup = new MaterialSetup();
						}
						else //push matSetup to current mat and start over
						{
							//push 
							mat.init(matSetup);

							mat = new Material();
							materials.add(mat);
							materialNames.put(tokens.get(1), mat);
							matSetup = new MaterialSetup();
						}					   
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "Ka": //ambient kolor default (0.2, 0.2, 0.2)
					try {
						matSetup.lightProperties.ambient[0] = Float.parseFloat(tokens.get(1));
						matSetup.lightProperties.ambient[1] = Float.parseFloat(tokens.get(2));
						matSetup.lightProperties.ambient[2] = Float.parseFloat(tokens.get(3));
						matSetup.lightProperties.ambient[3] = 1.0f; //?
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "Kd": //diffuse (0.8, 0.8, 0.8)
					try {
						matSetup.lightProperties.diffuse[0] = Float.parseFloat(tokens.get(1));
						matSetup.lightProperties.diffuse[1] = Float.parseFloat(tokens.get(2));
						matSetup.lightProperties.diffuse[2] = Float.parseFloat(tokens.get(3));
						matSetup.lightProperties.diffuse[3] = 1.0f; //?
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "Ks": //specular (1.0, 1.0, 1.0)
					try {
						matSetup.lightProperties.specular[0] = Float.parseFloat(tokens.get(1));
						matSetup.lightProperties.specular[1] = Float.parseFloat(tokens.get(2));
						matSetup.lightProperties.specular[2] = Float.parseFloat(tokens.get(3));
						matSetup.lightProperties.specular[3] = 1.0f; //?
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "Ns": //specular coefficient [1..1000] (default 0.0)
					try {
						matSetup.lightProperties.specpower = Float.parseFloat(tokens.get(1));
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "d": //transparency (1.0, no trans)
				case "Tr": //see above
					try {
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "illum": //illumination model (1)
					try {
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "map_Ka": //ambient texture map
					try {
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "map_Kd": //diffuse texture map
					try {
						//check extension to determine resource type
						String extension = tokens.get(1).substring(tokens.get(1).lastIndexOf('.'));
						extension = extension.toUpperCase();
						if ( !(extension.equals(".PNG") || extension.equals(".JPG") || extension.equals("TGA")) )
							throw new IllegalArgumentException("Unknown image type '" + extension + "'");

						//load image
						try {
							matSetup.texture = TextureLoader.getTexture(extension.substring(1), ResourceLoader.getResourceAsStream(getPath() + tokens.get(1)));
						} catch (IOException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "map_Ks": //specular color texture map
					try {
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "map_Ns": //specular highlight component
					try {
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "map_d": //alpha texture map
					try {
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "map_bump": //bump map (default: luminance channel of image)
				case "bump": //see above
					try {
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "disp": //displacement map
					try {
						break;
					}
					catch ( IndexOutOfBoundsException e) {
						//blank field, skip
						System.out.println("Skipping blank field in mtl");
					}
					break;
				case "decal": //stencil detail texture (defaults to 'matte' channel of img)
					break;

				}
			}
			//push the last mtl created
			mat.init(matSetup);
		} catch (FileNotFoundException e1) {
			//TODO
			e1.printStackTrace();
		} catch (IndexOutOfBoundsException e2) {
			//TODO
			e2.printStackTrace();
		} catch (NumberFormatException e3) {
			//TODO
			e3.printStackTrace();
		}
	}

	private void loadMD2()
	{

	}

	/** Load a terrain mesh from a Script. The Script points to a heightmap
	 * where each pixel will be represented as a voxel.
	 * 
	 * Script format:
	 * 
	 * #begin
	 * heightmap	string	<path/to/grayscalePNG>
	 * unitsize		number	<height/width of a voxel>
	 * 
	 */
	private void loadTerrain()
	{
		Script terrainScript = new Script(getFilename());
		voxelSize = (int) terrainScript.getNumberData("unitsize");
		//load image
		try {
			//FIXME: terrain is not loading properly from script
			//Texture texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(terrainScript.getStringData("heightmap")));
			//Texture texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("./res/terrain/heightmap.png"));

			//load pgm
			int x = 0, y = 0;
			//same problem as above with Texture
			//Scanner s = new Scanner(new FileInputStream(new File(terrainScript.getStringData("heightmap"))));
			Scanner s = new Scanner(new FileInputStream(new File("./res/terrain/heightmap.pgm")));
			if (s.next().equals("P2"))
			{
				while (!s.hasNextInt())
					s.nextLine();
				heightmapWidth = s.nextInt();
				while (!s.hasNextInt())
					s.nextLine();
				heightmapHeight = s.nextInt();
				while (!s.hasNextShort())
					s.nextLine();
				heightmapMaxVal = s.nextShort();

				//start reading pixels
				heightmap = new short[heightmapWidth][heightmapHeight];
				while (s.hasNext()) //read to end of file
				{
					while (!s.hasNextShort()) //skip non numbers
						s.next();
					heightmap[x][y] = s.nextShort();
					x++;
					if (x == heightmapWidth)
					{
						x = 0;
						y++;
					}
					assert(x < heightmapWidth); //width is the size, x is [0..width-1]
				}
			}
			s.close();
			terrain = true;
			System.out.println("terrain loaded voxel size: " + voxelSize + "x" + voxelSize + "x" + voxelSize);

			//create voxels
			Vector3f offset = new Vector3f();

			//temp, so renderer doesnt complain
			texCoords.add(new Vector2f());
			vertexNormals.add(new Vector3f(0.0f, 0.0f, 1.0f));

			for (int j = 0; j < heightmapHeight; j++)
			{
				offset.y = -j*voxelSize;
				for (int i = 0; i < heightmapWidth; i++)
				{
					Face f1 = new Face();
					Face f2 = new Face();
					offset.x = i*voxelSize;

					//top face tris (counter clockwise)
					vertices.add(new Vector3f(0.0f+offset.x, 0.0f+offset.y, heightmap[i][j]+voxelSize));
					f1.addVertex(vertices.size()-1, 0, 0);
					vertices.add(new Vector3f(0.0f+offset.x, -voxelSize+offset.y, heightmap[i][j]+voxelSize));
					f1.addVertex(vertices.size()-1, 0, 0);
					vertices.add(new Vector3f(voxelSize+offset.x, -voxelSize+offset.y, heightmap[i][j]+voxelSize));
					f1.addVertex(vertices.size()-1, 0, 0);

					vertices.add(new Vector3f(0.0f+offset.x, 0.0f+offset.y, heightmap[i][j]+voxelSize));
					f2.addVertex(vertices.size()-1, 0, 0);
					vertices.add(new Vector3f(voxelSize+offset.x, -voxelSize+offset.y, heightmap[i][j]+voxelSize));
					f2.addVertex(vertices.size()-1, 0, 0);
					vertices.add(new Vector3f(voxelSize+offset.x, 0.0f+offset.y, heightmap[i][j]+voxelSize));
					f2.addVertex(vertices.size()-1, 0, 0);

					faces.add(f1);
					faces.add(f2);
				}
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public Vector3f getCenter() {
		return new Vector3f( (min.x+max.x)/2.0f, (min.y+max.y)/2.0f, (min.z+max.z)/2.0f );
	}

	public int getNumVertices() {
		return vertices.size();
	}

	public int getNumFaces() {
		return faces.size();
	}

	public ArrayList<Vector3f> getVertices() {
		return vertices;
	}

	public ArrayList<Vector2f> getTexCoords() {
		return texCoords;
	}

	public ArrayList<Vector3f> getNormals() {
		return vertexNormals;
	}

	public ArrayList<Face> getFaces() {
		return faces;
	}

	public boolean isTerrain() {
		return terrain;
	}

	public Material getMaterial(String m)
	{
		return materialNames.get(m);
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted src/me/dw/engine/Network.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
package me.dw.engine;

import java.io.IOException;
import java.net.*;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

import me.dw.engine.NetworkSetup.NetworkMessageHandler;

public class Network
{
	public enum NetworkMode
	{
		NET_SERVER, //handle connection requests, send client updates
		NET_CLIENT, //handle server updates, send commands to server

		//out of band states
		/**
		 * Connection steps:
		 * 1. Client requests to join server.
		 * 2. Server replies (if there is room) with a random ID
		 * 3. Client replies with random ID + its info (name, appearance etc)
		 * 4. If the ID echoed back from the client and its info checks out
		 * 		(i.e. they aren't banned) then send a final ACK and begin
		 * 		sending the game state packets. If the client receives the ACK
		 * 		or starts receiving the game state packets, start setting up
		 * 		the game for the player and updating.
		 */
		NET_CLIENT_JOIN_REQUEST, //client is performing initial request to join
		NET_CLIENT_SEND_INFO, //replying with server generated id + local info

		NET_NONE //do nothing
	}

	/**
	 * Represents an instance of the game, attempting to interact with
	 * other instances. Can also be thought of as a player.
	 * 
	 * @author Donny
	 *
	 */
	public class Client
	{
		public InetSocketAddress address;
		public String name;

		public Client(InetSocketAddress a, String n)
		{
			address = a;
			name = n;
		}
	}

	/**
	 * Encapsulates a ByteBuffer to send, with destination info etc.
	 * 
	 * @author Donny
	 *
	 */
	public class OutboundMessage
	{
		InetSocketAddress destAddress;
		int sequence;
		ByteBuffer buffer;

		//for reliable msgs
		boolean reliable;
		int ttl; //time to live (in network frames) before resend
		int ttl_max;
		int numberOfSends;

		/**
		 * Construct a non-reliable message.
		 * 
		 * @param buf The message to be sent.
		 * @param inet The destination address.
		 * @param seq The sequence number of the message to send.
		 */
		public OutboundMessage(ByteBuffer buf, InetSocketAddress inet, int seq)
		{
			destAddress = inet;
			buffer = buf;
			reliable = false;
			sequence = seq;
			ttl = 0;
			ttl_max = 0;
			numberOfSends = 0;
		}

		/**
		 * Construct a reliable message.
		 * 
		 * @param buf The message to be sent.
		 * @param inet The destination address.
		 * @param seq The sequence number of the message to send.
		 * @param maxttl The number of network ticks to wait before attempting
		 * to resend, if the message has not been acknowledged yet.
		 * @param numResends Total number of times to resend the message before
		 * giving up.
		 */
		public OutboundMessage(ByteBuffer buf, InetSocketAddress inet, int seq, int maxttl, int numResends)
		{
			destAddress = inet;
			buffer = buf;
			reliable = true;
			sequence = seq;
			ttl = 0;
			ttl_max = maxttl;
			numberOfSends = numResends;
		}

		public void ttlIncr()
		{
			ttl++;
			if (ttl >= ttl_max)
				ttl = 0;
		}
	}

	public InetAddress address;
	private DatagramSocket dSocket;
	private DatagramChannel dChannel;
	//private boolean socketBound;
	private int port; //todo: make this changeable, restart connection
	NetworkMessageHandler msgHandler; //defined by application
	NetworkMode netMode; //what mode to operate in

	//for servers
	private ArrayList<Client> connectedClients;
	private static final int MAX_CLIENTS = 8;

	//codes for client/server communication

	//client->server
	private static final String QUERY_SERVER = "query";
	private static final String JOIN_REQUEST = "joinreqeust";
	private static final String CONNECT_REQUEST = "connectrequest"; //concat with server's UID + client details to submit connect request

	//server->client
	private static final String JOIN_REPLY = "joinreply"; //concatenate with UID for replying to a client join request
	private static final String CONNECT_REPLY = "connectreply"; 

	//# of ticks for an oob message to wait before attempting resend
	private static final int OOB_TTL = 120;

	//# of times to resend an oob message before giving up
	private static final int OOB_RETRIES_MAX = 3;

	private ArrayList<OutboundMessage> outboundMessages;

	private long UID;

	private boolean portReady;

	//when true, network should be idle, ignore any packets read.
	//private boolean dropPackets;

	//note: udp may break up large packets. so we will have to check incoming packets to make sure they are not
	//	fragmented
	public final static int MAXIMUM_TRANSMISSION_UNIT = 1400;

	/**
	 * allocateDirect has higher alloc/dealloc costs, so make sure
	 * this is a long lived buffer
	 */
	ByteBuffer buf;

	private static Network INSTANCE = null;
	private static boolean instanced = false;

	private Network(NetworkSetup ns)
	{
		if (ns == null)
			ns = new NetworkSetup();

		//Script s = (Script)ResourceManager.getInstance().getElement("autoload.scr", "./res/scripts/");
		//int port = (int)s.getNumberData("port");
		port = ns.port;
		msgHandler = ns.messageHandlingFunc; //save the user defined msg func

		//Console.getInstance().out("Network using port " + port);
		//engineInst = Engine.getInstance(); //bad, engine creates network in
		//	the ctor, where it is not instanced yet!!

		buf = ByteBuffer.allocateDirect(MAXIMUM_TRANSMISSION_UNIT);
		netMode = NetworkMode.NET_NONE;

		connectedClients = new ArrayList<Client>();
		outboundMessages = new ArrayList<OutboundMessage>();

		portReady = false;

		//dropPackets = true;
		UID = 0;

		System.out.println("Initializing network socket");
		open();
	}

	public static void create(NetworkSetup ns)
	{
		if (!instanced)
		{
			instanced = true;
			INSTANCE = new Network(ns);
		}
	}

	public static Network getInstance()
	{
		return INSTANCE;
	}

	/**
	 * Open the socket to the world. Attempts to use the port specified as port.
	 */
	public void open()
	{
		try {
			dChannel = DatagramChannel.open();
			dChannel.configureBlocking(false);
			dSocket = dChannel.socket();
			dSocket.bind(new InetSocketAddress(port));
			System.out.println("Socket ready on port '" + port + "'");
			portReady = true;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			//e.printStackTrace();
			System.out.println("Failed to open socket, choose a new port before attempting any network operations");
			close();
		}
	}

	/**
	 * Close the socket off from the outside world.
	 */
	public void close()
	{
		try {
			dChannel.disconnect();
			dChannel.close();
			System.out.println("Socket closed");
			portReady = false;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println("Failed to close socket");
		}
	}

	public void update()
	{
		if (portReady)
		{
			//process any received packets
			processReceived();

			//see if we have anything to send
			sendQueued();
		}
	}

	/**
	 * For a maximum period of time (or until no more messages are left). For
	 * now there is no max time so we process everything in the socket buffer.
	 */
	public void processReceived()
	{
		//long startTime = Engine.getInstance().getTime();
		InetSocketAddress remoteAddr = null;

		try {
			buf.clear();
			remoteAddr = (InetSocketAddress) dChannel.receive(buf);
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
			return;
		}

		while (remoteAddr != null) 
		{
			buf.flip();
			//http://tutorials.jenkov.com/java-nio/buffers.html
			//buffer in the current state is in write mode. the channel writes into the buffer and gives it back to you (it doesnt flip)
			//System.out.println("recieved packet from '" + remoteAddr.toString() + "'");
			Console.getInstance().out("recieved packet from '" + remoteAddr.toString() + "'");

			//handle oob packets here
			if (isOOB(buf))
			{
				try {
					handleOOB(remoteAddr, buf);
				}
				catch (IndexOutOfBoundsException e)
				{
					Console.getInstance().out("Malformed OOB packet received, discarding");
				}
			}
			else if (netMode == NetworkMode.NET_CLIENT || netMode == NetworkMode.NET_SERVER)
			{
				//process the non oob packet if client or server (else drop it)
				if (msgHandler != null)
				{	
					if (netMode == NetworkMode.NET_CLIENT)
						msgHandler.clientRead(buf);
					else if (netMode == NetworkMode.NET_SERVER)
						msgHandler.serverRead(buf);
					else
						System.out.println("Discarding packet (NET_NONE mode)");
				}
				else
					System.out.println("Discarding packet (no msgHandler)");
			}

			//try to get another packet
			try {
				buf.clear();
				remoteAddr = (InetSocketAddress) dChannel.receive(buf);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return;
			}
		}
		//System.out.println("processed all packets in " + (Engine.getInstance().getTime()-startTime) + "ms");
	}

	/**
	 * Handles a received Out Of Band packet based on current state of Network.
	 * 
	 * @param address Origin address of the packet
	 * @param buffer ByteBuffer containing packet contents, with position set
	 * just beyond the last OOB bit
	 * @throws IndexOutOfBoundsException The Out Of Band packet's message will
	 * be converted to a String, and split into tokens. If the message is not
	 * formatted correctly, the List of tokens will throw an
	 * IndexOutOfBoundsException, at which point we will discard the message
	 * entirely.
	 */
	public void handleOOB(InetSocketAddress address, ByteBuffer buffer) throws IndexOutOfBoundsException
	{
		String oobMsg = Network.bbToString(buf);
		String parms[] = oobMsg.split(" ");
		List<String> params = Arrays.asList(parms);
		System.out.println("Out of band packet: '" + oobMsg + "'");

		if (buffer == null || address == null)
			return;
		if (!isOOB(buffer))
			return;

		if (netMode == NetworkMode.NET_CLIENT_JOIN_REQUEST)
		{
			switch (params.get(0))
			{
			case JOIN_REPLY: //(client) submit conn request with server uid + client details
				Console.getInstance().out("[JOIN_REPLY] from " + address.toString());
				//stop resending the join request (go and find it)
				ackOOB(JOIN_REQUEST, address);
				
				//TODO add try/catchs
				netMode = NetworkMode.NET_CLIENT_SEND_INFO;
				String clientDetails = "name/donny/rank/2/exp/511/kdr/1.03/serveruid/" + params.get(1);
				String msg = CONNECT_REQUEST + " " + clientDetails;
				ByteBuffer b = ByteBuffer.allocate(MAXIMUM_TRANSMISSION_UNIT);
				bbWriteOOB(b);
				bbWriteString(b, msg);
				b.flip();
				outboundMessages.add(new OutboundMessage(b, address, 0, OOB_TTL, OOB_RETRIES_MAX));
				break;
			}
		}
		else if (netMode == NetworkMode.NET_CLIENT_SEND_INFO)
		{
			switch (params.get(0))
			{
			case CONNECT_REPLY: //(client) prepare for descent
				Console.getInstance().out("[CONNECT_REPLY] from " + address.toString());
				ackOOB(CONNECT_REQUEST, address);
				
				netMode = NetworkMode.NET_CLIENT;
				Console.getInstance().out("Now connected to " + address.toString());
				break;
			}
		}
		else if (netMode == NetworkMode.NET_SERVER)
		{
			switch (params.get(0))
			{
			case QUERY_SERVER: //(server) send reply with info
				//...
				break;
			case JOIN_REQUEST: //(server) if theres room, gen id and reply
				//nothing to ack, this is the 1st contact
				if (connectedClients.size() < MAX_CLIENTS && !isIPConnected(address))
				{
					Console.getInstance().out("[JOIN_REQUEST] from " + address.toString());
					//long id = Engine.getInstance().randomer.nextLong();
					//String msg = JOIN_REQUEST_REPLY + " " + Long.toString(id);
					String msg = JOIN_REPLY + " " + Long.toString(getUID());
					ByteBuffer b = ByteBuffer.allocate(MAXIMUM_TRANSMISSION_UNIT);
					bbWriteOOB(b);
					bbWriteString(b, msg);
					b.flip();
					outboundMessages.add(new OutboundMessage(b, address, 0, OOB_TTL, OOB_RETRIES_MAX));
				}
				break;
			case CONNECT_REQUEST: //(server) if client echoed the correct uid + their background checks out, send connect reply and start sending updates
				ackOOB(JOIN_REPLY, address);
				if (connectedClients.size() < MAX_CLIENTS)
				{
					Console.getInstance().out("[CONNECT_REQUEST] from " + address.toString());
					String details[] = params.get(1).split("/");

					if (details[details.length-2].equals("serveruid") && details[details.length-1].equals(Long.toString(getUID())))
					{
						ByteBuffer b = ByteBuffer.allocate(MAXIMUM_TRANSMISSION_UNIT);
						bbWriteOOB(b);
						bbWriteString(b, CONNECT_REPLY);
						b.flip();
						//outboundMessages.add(new OutboundMessage(b, address, 0, OOB_TTL, OOB_RETRIES_MAX));
						outboundMessages.add(new OutboundMessage(b, address, 0)); //unreliable

						Client c = new Client(address, "c" + Integer.toString(connectedClients.size()));
						connectedClients.add(c);

						Console.getInstance().out("Client gave correct UID");
						System.out.println("New clientList: " + connectedClients.toString());
					}
					else
						Console.getInstance().out("Client gave wrong UID");
				}
				break;
			}
		}
	}

	public void sendQueued()
	{
		//int i;
		OutboundMessage m;
		Iterator<OutboundMessage> it = outboundMessages.iterator();
		//for (i = 0; i < outboundMessages.size(); i++)
		while (it.hasNext())
		{
			//m = outboundMessages.get(i);
			m = it.next();
			try {
				//always send unreliables. reliables only sent first time
				//	(ttl of 0) and then we wait until it reaches 0 again
				if (!m.reliable || (m.ttl == 0 && m.numberOfSends > 0))
				{
					int numBytesSent = dChannel.send(m.buffer, m.destAddress);
					m.buffer.rewind(); //prepare for possible resend
					m.numberOfSends--;
					System.out.println("Message (" + numBytesSent + " bytes) sent to " + m.destAddress + ":" + m.destAddress.getPort());
				}
				if (m.reliable)
				{
					m.ttlIncr();
					if (m.numberOfSends <= 0)
					{
						//outboundMessages.remove(i);
						it.remove();
						System.out.println("^ sent reliably for the last time");
					}
				}
				else
					it.remove();
					//outboundMessages.remove(i);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 

		}
	}

	/**
	 * Find an OOB message in outboundMessages and stop sending it. Only acks
	 * a msg that was sent to a specific address.
	 * 
	 * @param addr TODO
	 */
	private void ackOOB(String oobCmd, InetSocketAddress addr)
	{
		int i;
		OutboundMessage m;
		String oobMsg;
		String param[];
		
		if (addr == null)
			return;
		for (i = 0; i < outboundMessages.size(); i++)
		{
			m = outboundMessages.get(i);
			if (m.reliable && Network.isOOB(m.buffer) && m.destAddress.equals(addr))
			{
				oobMsg = Network.bbToString(m.buffer);
				param = oobMsg.split(" ");
				if (param[0].equals(oobCmd)) //the oob command of this reliable oob packet matches
				{
					m.numberOfSends = 0;
					System.out.println("'" + oobCmd + "' from " + addr.toString() + " acked");
					return;
				}
			}
		}
		System.out.println("'" + oobCmd + "' from " + addr.toString() + " could not be acked (msg not found)");
	}

	/**
	 * Host a session. Processes packets from clients and sends responses.
	 * Must not be currently running a server, or be a connected client.
	 */
	public void host()
	{
		if (netMode == NetworkMode.NET_NONE)
		{
			if (portReady)
				netMode = NetworkMode.NET_SERVER;
			else
				Console.getInstance().out("Failed to host: select an available port first");

			//register with master server

		}
	}

	/**
	 * Attempts to join a specified session.
	 * 
	 * @param address The hostname/port of the server to join.
	 */
	public void join(InetSocketAddress address)
	{
		if (netMode == NetworkMode.NET_NONE)
		{
			ByteBuffer msgbb = ByteBuffer.allocate(MAXIMUM_TRANSMISSION_UNIT);
			netMode = NetworkMode.NET_CLIENT_JOIN_REQUEST;

			//msgbb.put(msg);
			bbWriteOOB(msgbb);
			bbWriteString(msgbb, JOIN_REQUEST);
			msgbb.flip();

			//sends from current position in bytebuffer, and advances its
			//	position as well
			//int numBytesSent = dChannel.send(msgbb, address); 
			//System.out.println("Join request (" + numBytesSent + " bytes) sent to " + address.getAddress().getHostAddress() + ":" + address.getPort() + "'" + msgbb.toString() + "'");

			outboundMessages.add(new OutboundMessage(msgbb, address, 0, OOB_TTL, OOB_RETRIES_MAX));
		}
	}

	/**
	 * If running as a server or client, close connection and revert to NET_NONE
	 */
	public void closeConnection()
	{
		if (netMode == NetworkMode.NET_SERVER)
		{
			//send "server shutting down" packet. if a client doesnt receive it,
			//	oh well..
			//...

			try {
				dChannel.disconnect();
				dChannel.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			netMode = NetworkMode.NET_NONE;
		}
		else if (netMode == NetworkMode.NET_CLIENT)
		{

		}
		else if (netMode == NetworkMode.NET_NONE) //force close everything
		{

		}
	}

	public int getPort()
	{
		return port;
	}

	/**
	 * Changes the application port. Closes and reopens socket with the newly
	 * bound port.
	 * 
	 * @param newPort The new port.
	 */
	public void setPort(int newPort)
	{
		close();
		port = newPort;
		open();
	}

	public NetworkMode getNetWorkMode()
	{
		return netMode;
	}

	/**
	 * Inserts a given string into the ByteBuffer as a sequence of bytes. If
	 * the ByteBuffer has insufficient space, the String is truncated. The
	 * string is inserted at the current position of the ByteBuffer, and the
	 * new position of the ByteBuffer will point to the element just beyond the
	 * string.
	 * 
	 * (The ByteBuffer's reference is passed by value (like everything), so the
	 * changes will be seen by the caller as long as the reference isn't changed
	 * with null or new.)
	 * 
	 * @param s The String to insert.
	 * @param b The ByteBuffer.
	 */
	public static void bbWriteString(ByteBuffer b, String s)
	{//TODO: try using ByteBuffer.put(char) method. each char will take 2 bytes however
		int i;
		if (b == null)
			return;
		for (i = 0; i < s.length(); i++)
		{
			try {
				//TODO: use a better implementation that will be stable across
				//platforms
				if (s.charAt(i) < 128)
					b.put((byte) s.charAt(i)); //ascii only! or we'll have problems
			}
			catch (BufferOverflowException e) //no more space, stop
			{
				return;
			}
		}
	}

	/**
	 * Step through ByteBuffer starting at current position and convert each
	 * byte into a char, and returning a String representation of the buffer.
	 * After the read, the ByteBuffer position is returned to its location
	 * prior to this call.
	 * 
	 * @param b A ByteBuffer with position set to the desired beginning of read.
	 * @return A String representing all chars from the initial position of b
	 * to the end of the ByteBuffer.
	 */
	public static String bbToString(ByteBuffer b)
	{
		int startPos = b.position();
		StringBuilder s = new StringBuilder();

		while (b.hasRemaining())
		{
			s.append((char)b.get());
		}
		//set back to initial position for future reads etc
		b.position(startPos);
		return s.toString();
	}

	/**
	 * Returns the next byte in a ByteBuffer, leaving the position where it was
	 * prior to the peek.
	 * 
	 * @param b The ByteBuffer to peek.
	 * @return The next byte in the ByteBuffer.
	 */
	public static byte bbPeekByte(ByteBuffer b)
	{
		int startPos = b.position();
		byte bite = b.get();
		b.position(startPos);
		return bite;
	}

	/**
	 * Reads the first four bytes in a ByteBuffer to determine if this is an
	 * out of band packet. An OOB packet will have the first four bytes set to
	 * to all 1s. Does not change the current position of the ByteBuffer.
	 * 
	 * If the ByteBuffer contains the Out Of Band signature, its position will
	 * be set to the first element just beyond the signature, else it will be
	 * set to 0.
	 * 
	 * Out Of Band should only be checked/written prior to any other analysis
	 * of the ByteBuffer, to avoid problems with overwriting data in the buffer.
	 * 
	 * @param b The ByteBuffer.
	 * @return true if the first four bytes represent 0xFFFFFF.
	 */
	public static boolean isOOB(ByteBuffer b)
	{
		if (b.get(0) == (byte) 0b1111_1111 &&
				b.get(1) == (byte) 0b1111_1111 &&
				b.get(2) == (byte) 0b1111_1111 &&
				b.get(3) == (byte) 0b1111_1111)
		{
			b.position(4);
			return true;
		}
		else
		{
			return false;
		}
	}

	/**
	 * Writes the Out Of Band signature header to a ByteBuffer. The header will
	 * be inserted at the beginning of the ByteBuffer, and the position will
	 * be set to the very next element after the last byte in the OOB header.
	 * 
	 * Out Of Band should only be checked/written prior to any other analysis
	 * of the ByteBuffer, to avoid problems with overwriting data in the buffer.
	 * 
	 * @param b The ByteBuffer to mark as Out Of Band.
	 */
	public void bbWriteOOB(ByteBuffer b)
	{
		b.position(0);
		b.put((byte) 0b1111_1111);
		b.put((byte) 0b1111_1111);
		b.put((byte) 0b1111_1111);
		b.put((byte) 0b1111_1111);
	}

	/**
	 * Lazy setting of UID because Engine is still created when Network is
	 * created, so we can't get a random value yet.
	 * 
	 * @return The UID of this application instance.
	 */
	public long getUID()
	{
		if (UID == 0)
			UID = Engine.getInstance().randomer.nextLong();
		return UID;
	}
	
	/**
	 * (For servers) check if IP/port matches that of a connected client.
	 * 
	 * @param ip The address to check
	 * @return true if IP matches one of the connected clients.
	 */
	public boolean isIPConnected(InetSocketAddress ip)
	{
		int i;
		for (i = 0; i < connectedClients.size(); i++)
			if (connectedClients.get(i).address.equals(ip))
				return true;
		return false;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted src/me/dw/engine/NetworkSetup.java.

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
package me.dw.engine;

import java.net.InetSocketAddress;
import java.nio.ByteBuffer;

/**
 * This class allows the engine user to specify parameters for the Network when
 * setting it up. We also pass a NetworkMessageHandler interface that will
 * allow the engine user to specify how to process datagrams that are received,
 * as well as specify what to send.
 * @author Donny
 *
 */
public class NetworkSetup
{
	/**
	 * To be implemented by the application
	 */
	public interface NetworkMessageHandler
	{
		/**
		 * Defines the way a client should handle the received packet.
		 * 
		 * @param b ByteBuffer representing the contents of the packet in bytes.
		 */
		public void clientRead(ByteBuffer b);
		
		/**
		 * Defines the way a server should handle the received packet.
		 * 
		 * @param b ByteBuffer representing the contents of the packet in bytes.
		 */
		public void serverRead(ByteBuffer b);
		
		//public void write(Bytebuffr)
	}
	
	public NetworkMessageHandler messageHandlingFunc;
	public int port;
	public InetSocketAddress masterServerAddress;
	
	public NetworkSetup()
	{
		messageHandlingFunc = null;
		port = 4444;
		masterServerAddress = new InetSocketAddress("http://www.donny.me", 4444);
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































Deleted src/me/dw/engine/QuaternionHelper.java.

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
package me.dw.engine;

import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;

/** This class will check any provided quaternions to see if they are
 * multiplication identity quaternions before performing any operations, so it 
 * doesn't need to be checked anywhere else.
 */
public class QuaternionHelper
{
	/** Get the Axis-Angle from a quaternion rotation.
	 * 
	 * @param q The quaternion.
	 * @return A 4-dimensional vector, with [x y z] representing the axis of
	 * rotation, and w representing the angle of rotation (counterclockwise).
	 * Returns a 0 degree rotation about the x axis if there is no rotation (q
	 * is identity quaternion).
	 */
	public static Vector4f getAxisAngle(Quaternion q)
	{
		if (isIdentity(q))
			return new Vector4f(1.0f, 0.0f, 0.0f, 0.0f);
		Vector4f aa = new Vector4f(); //axis angle, w = angle
		Vector3f w = new Vector3f(); //temp axis for normalizing it
		aa.w = (float) (2 * Math.acos(q.w));
		if (aa.w != 0)
		{
			//aa.x = q.x;
			//aa.y = q.y;
			//aa.z = q.z;
			w.x = q.x;
			w.y = q.y;
			w.z = q.z;
			//if (w.length() != 0)
			w.normalise();
			//else
			//w.x = 1;
			aa.x = w.x;
			aa.y = w.y;
			aa.z = w.z;
		}
		else
		{
			aa.x = aa.y = aa.z = 0;
		}

		return aa;
	}

	public static Vector3f rotateVector(Vector3f v, Quaternion q)
	{
		if (isIdentity(q))
			return v;
		//the given quat may be very close to a non rot, but not == identity..
		//so check resulting aa
		Vector4f aa = getAxisAngle(q);
		Vector3f rotationAxis = new Vector3f(aa.x, aa.y, aa.z);
		if (rotationAxis.length() == 0 || aa.w == 0)
		{
			Console.getInstance().out("0 length: " + q.toString() + ", " + v.toString() + ", " + aa.toString());
			return v;
		}
		rotationAxis.normalise();
		float angleCCW = aa.w;
		Vector3f vrot = new Vector3f();

		float cosTheta = (float) Math.cos(angleCCW);
		float sinTheta = (float) Math.sin(angleCCW);

		Vector3f wCrossv = new Vector3f();
		Vector3f.cross(rotationAxis, v, wCrossv);

		float wDotv = Vector3f.dot(rotationAxis, v);

		Vector3f vcosTheta = new Vector3f();
		vcosTheta.x = v.x * cosTheta;
		vcosTheta.y = v.y * cosTheta;
		vcosTheta.z = v.z * cosTheta;

		Vector3f wCrossvTimesSinTheta = new Vector3f();
		wCrossvTimesSinTheta.x = wCrossv.x * sinTheta;
		wCrossvTimesSinTheta.y = wCrossv.y * sinTheta;
		wCrossvTimesSinTheta.z = wCrossv.z * sinTheta;

		Vector3f thirdArg = new Vector3f();
		thirdArg.x = rotationAxis.x * (wDotv) * (1.0f - cosTheta);
		thirdArg.y = rotationAxis.y * (wDotv) * (1.0f - cosTheta);
		thirdArg.z = rotationAxis.z * (wDotv) * (1.0f - cosTheta);

		vrot = Vector3f.add(vcosTheta, wCrossvTimesSinTheta, null);
		vrot = Vector3f.add(vrot, thirdArg, null);
		return vrot;
	}

	/* Will return a 0 degree rotation about the x axis if axis is 0
	 */
	public static Vector4f createAxisAngle(Vector3f axis, float angle)
	{
		if (axis.length() == 0)
		{
			axis.x = 1.0f;
			angle = 0.0f;
		}
		axis.normalise();
		return new Vector4f(axis.x, axis.y, axis.z, angle);
	}

	public static boolean isIdentity(Quaternion q)
	{
		if (q.x == 0.0f && q.y == 0.0f && q.z == 0.0f && q.w == 1)
			return true;
		else
			return false;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































Deleted src/me/dw/engine/Resource.java.

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
package me.dw.engine;

public class Resource
{
	private String name;
	private String pathTo;
	private int refCount;

	public Resource() {
		// TODO Auto-generated constructor stub
	}

	public Resource(String rName, String rPath)
	{
		name = rName;

		//this gave problems with resourcemanager identifying resources with
		//	altered rPaths
		//if (rPath.charAt(rPath.length()-1) != '/')
		//rPath = rPath + "/";
		pathTo = rPath;
		refCount = 1;
		//System.out.println(refCount);
	}

	public String getName()
	{
		return name;
	}

	public String getPath()
	{
		return pathTo;
	}

	/**
	 * @return complete filename (including path and extension)
	 */
	public String getFilename()
	{
		return (pathTo + name);
	}

	public void refIncr()
	{
		refCount++;
	}

	public void refDecr()
	{
		refCount--;
	}

	public int getRefCount()
	{
		return refCount;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































Deleted src/me/dw/engine/ResourceManager.java.

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
package me.dw.engine;

import java.util.LinkedList;

public class ResourceManager
{
	/**
	 * the list of resources currently loaded
	 */
	private LinkedList<Resource> resourceList;
	
	/**
	 * Private constructor...
	 * 
	 * Makes use of singleton pattern
	 * Initialization on Demand Holder Idiom
	 */
	private ResourceManager()
	{
		resourceList = new LinkedList<Resource>();
	}
	
	private static class ResourceManagerHolder
	{
		private static final ResourceManager INSTANCE = new ResourceManager();
	}
	
	public static ResourceManager getInstance()
	{
		return ResourceManagerHolder.INSTANCE;
	}
	
	public Resource getElement(String name, String path)
	{
		int i;
		Resource r;
		for (i = 0; i < resourceList.size(); i++)
		{
			r = resourceList.get(i);
			if (r.getName().equals(name) && r.getPath().equals(path))
				return r;
		}
		return null;
	}
	
	public Resource load(String name, String path) 
	{
		Resource r;
		String extension;
		if (name == null || path == null)
			return null;
		
		//check if in the list already
		r = getElement(name, path);
		if (r != null)
			r.refIncr();
		else
		{
			//check extension to determine resource type
			extension = name.substring(name.lastIndexOf('.'));
			
			//todo: add interface for an optional custom resource loading function
			if (extension.equals(".scr"))
				r = new Script(name, path);
			else if (extension.equals(".wav"))
				r = new Sound(name, path);
			else if (extension.equals(".obj"))
				r = new Mesh(name, path);
			else
				throw new IllegalArgumentException("Unknown resource type '" + extension + "'");
			resourceList.add(r);
			System.out.println(path+name+" loaded");
		}
		return r;
	}
	
	public void unload(Resource r)
	{
		if (r == null)
			return;	
		r.refDecr();
		if (r.getRefCount() == 0)
		{
			System.out.println(r.getPath()+r.getName()+" unloaded");
			resourceList.remove(r);
		}
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































Deleted src/me/dw/engine/Script.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
package me.dw.engine;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;



public class Script extends Resource
{
	/**
	 * 
	 * @author Donny
	 *
	 * when reading input, the expected type of the next token
	 * will be represented by a nextVal enum
	 * 
	 */
	private enum NextVal
	{
		NEXTVALUE_NAME,
		NEXTVALUE_TYPE,
		NEXTVALUE_VALUE,
		NEXTVALUE_STRING, //sequence with whitespaces
		NEXTVALUE_BEGIN,
		NEXTVALUE_END //cant expect end. must run into end while looking for another name
	}

	final private String BEGIN_NAME = "#begin";
	final private String END_NAME = "#end";

	/**
	 * list of variables obtained from the script
	 */
	private LinkedList<Variable> variables;

	public Script(String rName)
	{
		super(rName, "./");
		init();
	}

	public Script(String rName, String rPath)
	{
		super(rName, rPath);
		init();
	}

	@Override
	public String toString() {
		StringBuilder s = new StringBuilder();
		s.append(getFilename() + ":");
		for (Variable v : variables)
			s.append("\n" + v.toString());
		return s.toString();
	}

	private void init()
	{
		Scanner s = null;
		String token;
		NextVal expectedVal;

		variables = new LinkedList<Variable>();

		try {
			s = new Scanner(new FileInputStream(new File(getFilename())));

			//parse script
			expectedVal = NextVal.NEXTVALUE_BEGIN;
			while (s.hasNext())
			{
				token = s.next();

				switch (expectedVal)
				{
				case NEXTVALUE_BEGIN:
					if (token.equals(BEGIN_NAME))
						expectedVal = NextVal.NEXTVALUE_NAME;
					break;
				case NEXTVALUE_NAME: //grab the 3 expected tokens
					if (token.equals(END_NAME))
						expectedVal = NextVal.NEXTVALUE_BEGIN;
					else
					{
						//skip the whitespace after the "type" field using substring
						variables.add(new Variable(token, s.next(), s.nextLine().substring(1)));
					}
					break;
				}
			}
			s.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			System.out.println("couldnt find!");
			//e.printStackTrace();
		}
	}

	public boolean isEmpty()
	{
		return variables.isEmpty();
	}

	public void saveScript()
	{
		int i;
		try {
			// Create file 
			FileWriter fstream = new FileWriter(getFilename(), false);
			BufferedWriter out = new BufferedWriter(fstream);

			out.write(BEGIN_NAME + '\n');
			for (i = 0; i < variables.size(); i++)
			{
				out.write(variables.get(i).getName() + " " + variables.get(i).getTypeString() + " " + variables.get(i).getData() + '\n');
			}
			out.write(END_NAME);
			//Close the output stream
			out.close();
		}
		catch (Exception e){//Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}
	}

	public void addVariable(String vName, String vType, String vValue)
	{
		variables.add(new Variable(vName, vType, vValue));
	}

	public void addVariable(String vName, Variable.VarType vType, String vValue)
	{
		variables.add(new Variable(vName, vType, vValue));
	}

	/**
	 * set value of preexisting variable to new value
	 * @param vName
	 * @param vValue
	 */
	public void setVariable(String vName, String vValue)
	{
		Variable v = null;
		String type;
		int i;
		//find variable first
		for (i = 0; i < variables.size(); i++)
		{
			if (variables.get(i).getName().equals(vName))
			{
				v = variables.get(i);
				break;
			}
		}

		if (v == null)
			return;

		//remove variable and readd it in
		type = v.getTypeString();

		variables.remove(i);
		variables.add(new Variable(vName, type, vValue));
	}

	/**
	 * gets a variable from the list, by name
	 * 
	 */
	private Variable getVariable(String varName) throws NullPointerException
	{
		int i;
		for (i = 0; i < variables.size(); i++)
		{
			if (variables.get(i).getName().equals(varName))
				return variables.get(i);
		}
		//when getting a variable in the script, it should be there, so we will
		//	throw an exception if its not found
		throw new NullPointerException("'" + varName + "' not found in '" + getFilename() + "'");
	}

	public boolean getBoolData(String varName) throws NullPointerException
	{
		Variable v = getVariable(varName);

		if (v.getType() != Variable.VarType.VAR_BOOL)
		{
			//throw an exception (wrong type)
		}

		return Boolean.parseBoolean(v.getData());
	}

	public float[] getColorData(String varName) throws NullPointerException
	{
		Variable v = getVariable(varName);

		if (v.getType() != Variable.VarType.VAR_COLOR)
		{
			//throw an exception
		}

		//parse the 4 expected values
		int i;
		float color[] = new float[4];
		//using List instead of normal array to generate exceptions from get()
		List<String> vals = Arrays.asList(v.getData().split(" "));
		for (i = 0; i < color.length; i++)
		{
			try //replace missing/erroneous values with 0
			{
				color[i] = Float.parseFloat(vals.get(i));
			}
			catch (IndexOutOfBoundsException e)
			{
				color[i] = 0.0f;
			}
		}
		return color;
	}

	public float getFloatData(String varName) throws NullPointerException
	{
		Variable v = getVariable(varName);

		if (v.getType() != Variable.VarType.VAR_FLOAT)
		{
			//throw an exception
		}

		return Float.parseFloat(v.getData());
	}

	public long getNumberData(String varName) throws NullPointerException
	{
		Variable v = getVariable(varName);

		if (v.getType() != Variable.VarType.VAR_NUMBER)
		{
			//throw an exception
		}

		return Integer.parseInt(v.getData());
	}

	public String getStringData(String varName) throws NullPointerException
	{
		Variable v = getVariable(varName);

		if (v.getType() != Variable.VarType.VAR_STRING)
		{
			//throw an exception
		}

		return v.getData();
	}

	//public D3DXVECTOR3 getVectorData(String varName)

	public String getUnknownData(String varName) throws NullPointerException
	{
		Variable v = getVariable(varName);

		return v.getData();
	}

	public String getVarType(String varname)
	{
		Variable v = getVariable(varname);
		return v.getTypeString();
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































Deleted src/me/dw/engine/Sound.java.

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
package me.dw.engine;

//TODO: replace Set<String> in SoundSystem with Set<Sound>, so that we can
//	pass more info on the sounds, such as priority, volume, loop, music/notmusic/ etc
public class Sound extends Resource
{
	
	public Sound(String rName)
	{
		super(rName, "./");
		init();
	}
	
	public Sound(String rName, String rPath)
	{
		super(rName, rPath);
		init();
	}
	
	private void init()
	{
		
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































Deleted src/me/dw/engine/SoundSystem.java.

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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
package me.dw.engine;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.nio.*;
import java.util.Iterator;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.TreeMap;

import org.lwjgl.BufferUtils;
import org.lwjgl.openal.AL10;
import org.lwjgl.openal.OpenALException;
import org.lwjgl.util.WaveData;
import org.lwjgl.util.vector.Vector3f;

/**
 * A SoundSystem is instantiated with all of the sounds it is responsible
 * for, so it must be instantiated and loaded/unloaded with the states,
 * not in the Engine.
 * 
 * @author Donny
 *
 */
public class SoundSystem
{	
	/** we will be juggling the available sources */
	final static public int MAX_SOURCES = 16;
	
	/** buffers hold sound data */
	private IntBuffer buffer;
	
	/** sources are points emitting sound! */
	private IntBuffer source;
	
	/** maps the index of each element in the buffer to its sound name */
	private Map<Integer, String> buffer_Index_Name;
	
	/** maps the name of each sound to its index in the buffer */
	private Map<String, Integer> buffer_Name_Index;
	
	/** set of all valid sounds that can be played */
	private Set<String> nameSet;
	
	private Vector3f listenerPos, listenerVel, listenerFacing, listenerUp;
	
	/**
	 * This class encapsulates a source index, allowing us to calculate the priority
	 * of a source, which we can then store in a min-heap.
	 * 
	 * @author Donny
	 *
	 */
	public class SourceInfo implements Comparable<SourceInfo>
	{
		private byte priority;
		private int sourceIndex; //index of the source intbuffer that this refers to
		
		public SourceInfo(int index)
		{
			sourceIndex = index;
			priority = Byte.MIN_VALUE;
		}
		
		public int getPriority()
		{
			return priority;
		}
		
		public int getSourceIndex()
		{
			return sourceIndex;
		}
		
		/**
		 * calculates the current priority of the source at source.get(sourceIndex).
		 * Higher numbers mean higher priority.
		 */
		public void calcPriority() //TODO: write a smarter version of me
		{
			if (AL10.alGetSourcei(source.get(sourceIndex), AL10.AL_SOURCE_STATE) != AL10.AL_PLAYING) //not playing
			{
				priority = Byte.MIN_VALUE;
			}
			else
			{
				priority = 1;
			}
		}

		@Override
		public int compareTo(SourceInfo si2) {
			return priority - si2.getPriority();
		}
	}
	
	public SoundSystem(Set<String> fileNameSet)
	{	
		//System.out.println("soundsystem loading");
		int i = 0;
		WaveData waveFile;
		Iterator<String> it = fileNameSet.iterator();
		String fileName;
		nameSet = fileNameSet;


		buffer_Index_Name = new TreeMap<Integer, String>();
		buffer_Name_Index = new TreeMap<String, Integer>();
		buffer = BufferUtils.createIntBuffer(fileNameSet.size());
		source = BufferUtils.createIntBuffer(MAX_SOURCES); //256 is the max tested on my desktop

		AL10.alGenBuffers(buffer);
		checkALError();

		//gen buffers
		while (it.hasNext())
		{
			fileName = it.next();

			//designate an index in the buffer for this sound
			buffer_Index_Name.put(i, fileName);
			buffer_Name_Index.put(fileName, i);
			
			FileInputStream fin = null;
			BufferedInputStream bin = null;
			try {
			    fin = new FileInputStream(fileName);
			    bin = new BufferedInputStream(fin);
			} catch (FileNotFoundException e) {
			    e.printStackTrace();
			}
		
			waveFile = WaveData.create(bin);
			AL10.alBufferData(buffer.get(i), waveFile.format, waveFile.data, waveFile.samplerate);	
			waveFile.dispose();
			i++;
		}
		
		AL10.alGenSources(source);
		checkALError();

	}
	
	/**
	 * Updates the console with the current state of each sound channel.
	 * Call every frame in the loop for updates.
	 */
	public void update()
	{
		int play;
		int i;
		String lines[] = new String[MAX_SOURCES];
		
		for (i = 0; i < MAX_SOURCES; i++)
		{
			play = AL10.alGetSourcei(source.get(i), AL10.AL_SOURCE_STATE);
			if (play == AL10.AL_PLAYING)
				lines[i] = i + " playing";
			else if (play == AL10.AL_STOPPED)
				lines[i] = i + " stopped";
			else if (play == AL10.AL_PAUSED)
				lines[i] = i + " paused";
			else
				lines[i] = i + " something else: " + play;
			
		}
		//TODO: move this so that console pulls the info, instead of having the
		//	ss push it
		Console.getInstance().setOutput(lines, Console.outputType.OUTPUT_SOUNDCHANNELS);
	}
	
	//TODO: let engine user specify priority to play sound (an integer)
	
	/**
	 * Play a sound inside the listener's head
	 * 
	 * @param name the path/name of the sound to play. Must be one of the sounds passed into the constructor.
	 */
	public void playSound(String name)
	{
		int sourceIndex = getBestSource();
		//TODO create a zeroed out floatbuffer so we dont have to keep reallocating one
		if (nameSet.contains(name))
		{
			AL10.alSourceStop(source.get(sourceIndex)); //cannot replace a source that is currently playing
			AL10.alSourcei(source.get(sourceIndex), AL10.AL_BUFFER, buffer.get(buffer_Name_Index.get(name)));
			AL10.alSourcei(source.get(sourceIndex), AL10.AL_SOURCE_RELATIVE, AL10.AL_TRUE);
			AL10.alSource(source.get(sourceIndex), AL10.AL_POSITION, (FloatBuffer) BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip());
			AL10.alSource(source.get(sourceIndex), AL10.AL_VELOCITY, (FloatBuffer) BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip());
			checkALError();
			AL10.alSourcePlay(source.get(sourceIndex));
			Console.getInstance().out("Playing sound '" + name + "'");
		}
		else
			System.out.println("sound '" + name + "' not in sound system!");
	}
	
	public void playSound(String name, Vector3f pos, Vector3f vel)
	{
		int sourceIndex = getBestSource();
		
		if (nameSet.contains(name))
		{
			AL10.alSourceStop(source.get(sourceIndex)); //cannot replace a source that is currently playing
			AL10.alSourcei(source.get(sourceIndex), AL10.AL_BUFFER, buffer.get(buffer_Name_Index.get(name)));
			AL10.alSourcei(source.get(sourceIndex), AL10.AL_SOURCE_RELATIVE, AL10.AL_FALSE);
			AL10.alSource(source.get(sourceIndex), AL10.AL_POSITION, (FloatBuffer) BufferUtils.createFloatBuffer(3).put(new float[] {pos.x, pos.y, pos.z}).flip());
			AL10.alSource(source.get(sourceIndex), AL10.AL_VELOCITY, (FloatBuffer) BufferUtils.createFloatBuffer(3).put(new float[] {vel.x, vel.y, vel.z}).flip());
			checkALError();
			AL10.alSourcePlay(source.get(sourceIndex));
		}
		else
			System.out.println("sound '" + name + "' not in sound system!");
	}
	
	/**
	 * get the source.get index of the best candidate element in source to use
	 * for this sound. Builds a min heap of all sources based on priority and
	 * returns the index of source at the top of the heap.
	 * @return
	 */
	public int getBestSource()
	{
		int i;
		PriorityQueue<SourceInfo> q = new PriorityQueue<SourceInfo>();
		SourceInfo s;
		for (i = 0; i < MAX_SOURCES; i++)
		{
			s = new SourceInfo(i);
			s.calcPriority();
			//build a min heap
			q.add(s);
		}
		return q.peek().getSourceIndex();
	}
	
	/**
	 * Update the position of the listener (usually you).
	 * 
	 * @param pos Position of the listener.
	 * @param vel Velocity of the listener.
	 * @param dir Facing direction of the listener.
	 * @param up Vector defining which way is up for the listener.
	 */
	public void updateListener(Vector3f pos, Vector3f vel, Vector3f dir, Vector3f up)
	{
		listenerPos = pos;
		listenerVel = vel;
		listenerFacing = dir;
		listenerUp = up;
		AL10.alListener(AL10.AL_POSITION, (FloatBuffer) BufferUtils.createFloatBuffer(3).put(new float[] {pos.x, pos.y, pos.z}).flip());
		AL10.alListener(AL10.AL_VELOCITY, (FloatBuffer) BufferUtils.createFloatBuffer(3).put(new float[] {vel.x, vel.y, vel.z}).flip());
		AL10.alListener(AL10.AL_ORIENTATION, (FloatBuffer) BufferUtils.createFloatBuffer(6).put(new float[] {dir.x, dir.y, dir.z, up.x, up.y, up.z}).flip());
	}
	
	public Vector3f getListenerPos()
	{
		return listenerPos;
		
	}
	
	public Vector3f getListenerVel()
	{
		return listenerVel;
		
	}
	
	public Vector3f getListenerFacing()
	{
		return listenerFacing;
		
	}
	
	public Vector3f getListenerUp()
	{
		return listenerUp;
		
	}
	
	public void unload()
	{
		//System.out.println("Soundsystem unloading");
		AL10.alDeleteSources(source);
		AL10.alDeleteBuffers(buffer);
	}
	
	/**
	 * throws an openAL exception if an error is discovered
	 */
	public void checkALError()
	{
		int errorCode = AL10.alGetError();
		if ( errorCode != AL10.AL_NO_ERROR)
			throw new OpenALException(getALErrorString(errorCode));
	}
	
	public String getALErrorString(int err)
	{
		switch (err) {
	    case AL10.AL_NO_ERROR:
	      return "AL_NO_ERROR";
	    case AL10.AL_INVALID_NAME:
	      return "AL_INVALID_NAME";
	    case AL10.AL_INVALID_ENUM:
	      return "AL_INVALID_ENUM";
	    case AL10.AL_INVALID_VALUE:
	      return "AL_INVALID_VALUE";
	    case AL10.AL_INVALID_OPERATION:
	      return "AL_INVALID_OPERATION";
	    case AL10.AL_OUT_OF_MEMORY:
	      return "AL_OUT_OF_MEMORY";
	    default:
	      return "No such error code";
		}
	}

	public String getChannelStatus(int i)
	{
		if (i < 0 || i > MAX_SOURCES)
		{
			int play = AL10.alGetSourcei(source.get(i), AL10.AL_SOURCE_STATE);
			if (play == AL10.AL_PLAYING)
				return "ch " + i + ": playing";
			else if (play == AL10.AL_STOPPED)
				return "ch " + i + ": stopped";
			else if (play == AL10.AL_PAUSED)
				return "ch " + i + ": paused";
			else
				return "ch " + i + ": something else: " + play;
		}
		else
			return null;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































Deleted src/me/dw/engine/State.java.

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
package me.dw.engine;

public abstract class State
{
	/**
	 * Identifies the state that this state represents. This will
	 * be defined by the application. It must be unique from other states.
	 */
	private int stateID;
	
	public State(int id)
	{
		stateID = id;
	}
	
	abstract public void load();
	
	//TODO: add return type where the state will pass information to be read
	//	by the next state when it is closed. the next state can choose to read
	//	the data from the previous (closed) state or not, and do whatever it
	//	wants from it (or nothing)
	abstract public void close();
	
	abstract public void requestViewer();
	
	abstract public void update(float deltaT);
	
	/**
	 * Called after the engine has performed its own rendering. Performs
	 * specialized rendering that is not covered by the engine.
	 */
	abstract public void render();
	
	/**
	 * Get the unique ID of this State.
	 * 
	 * @return The unique ID of this state.
	 */
	public int getID()
	{
		return stateID;
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































Deleted src/me/dw/engine/Variable.java.

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
package me.dw.engine;

public class Variable
{
	public enum VarType
	{
		VAR_BOOL,
		VAR_COLOR,
		VAR_FLOAT,
		VAR_NUMBER,
		VAR_STRING,
		VAR_VECTOR,
		VAR_UNKNOWN
	}

	/**
	 * the data stored in this variable, in string format
	 */
	private String data;

	/**
	 * the name of this variable
	 */
	private String name;

	/**
	 * the type of the variable
	 */
	private VarType type;

	public Variable(String newName)
	{

	}

	public Variable(String newName, String newType, String newValue)
	{
		name = newName;
		data = newValue;

		if (newType.equals("bool"))
			type = VarType.VAR_BOOL;
		else if (newType.equals("color"))
			type = VarType.VAR_COLOR;
		else if (newType.equals("float"))
			type = VarType.VAR_FLOAT;
		else if (newType.equals("number"))
			type = VarType.VAR_NUMBER;
		else if (newType.equals("string"))
			type = VarType.VAR_STRING;
		else if (newType.equals("vector"))
			type = VarType.VAR_VECTOR;
		else
			type = VarType.VAR_UNKNOWN;
	}

	public Variable(String newName, VarType newType, String newValue)
	{
		name = newName;
		data = newValue;
		type = newType;
	}

	@Override
	public String toString() {
		return "varName: " + name + ", type: " + getTypeString() + ", val: " + data;
	}

	public VarType getType()
	{
		return type;
	}

	public String getTypeString()
	{		
		if (type == VarType.VAR_BOOL)
			return "bool";
		else if (type == VarType.VAR_COLOR)
			return "color";
		else if (type == VarType.VAR_FLOAT)
			return "float";
		else if (type == VarType.VAR_NUMBER)
			return "number";
		else if (type == VarType.VAR_STRING)
			return "string";
		else if (type == VarType.VAR_VECTOR)
			return "vector";
		else
			return "unknown";
	}

	public String getName()
	{
		return name;
	}

	public String getData()
	{
		return data;
	}
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































Deleted src/me/dw/engine/VectorHelper.java.

1
2
3
4
5
6
7
8
9
10
11
12
package me.dw.engine;

import org.lwjgl.util.vector.Vector3f;

public class VectorHelper
{
	public static Vector3f mulScalar(Vector3f v, float s)
	{
		return new Vector3f(v.x*s, v.y*s, v.z*s);
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
























Deleted src/me/dw/engine/Zone.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package me.dw.engine;

/** A Zone represents an area of the game world. It keeps track of everything
 * contained inside of it, as well as how to render itself (minus any entities
 * that may be coexist in it, those will be rendered seperately). Zones are
 * linked together in a tree by the World, which will determine where Zones
 * are in relation to each other.
 * 
 * @author Donny
 *
 */
public class Zone
{

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























Deleted test/me/dw/engine/CameraTest.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
package me.dw.engine;

import static org.junit.Assert.*;

import org.junit.Test;

public class CameraTest {

	@Test
	public void testGetInverseTransform() {
		Camera.getInstance().getInverseTransform();
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted test/me/dw/engine/EntityManagerTest.java.

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
package me.dw.engine;

import static org.junit.Assert.*;

import org.junit.Test;

public class EntityManagerTest {

	@Test
	public void testEntityManager() {
		fail("Not yet implemented");
	}

	@Test
	public void testCreateEntity() {
		fail("Not yet implemented");
	}

	@Test
	public void testCreateComponentStringUUID() {
		fail("Not yet implemented");
	}

	@Test
	public void testCreateComponentStringString() {
		fail("Not yet implemented");
	}

	@Test
	public void testRemoveEntityUUID() {
		fail("Not yet implemented");
	}

	@Test
	public void testRemoveEntityString() {
		fail("Not yet implemented");
	}

	@Test
	public void testSetEntityTag() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetEntityByTag() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetComponentFromEntity() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetAllComponentsOfType() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetAllEntitiesWithComponentType() {
		fail("Not yet implemented");
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted test/me/dw/engine/NetworkTest.java.

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
package me.dw.engine;

import static org.junit.Assert.*;

import java.nio.ByteBuffer;

import me.dw.engine.Network;

import org.junit.Test;

public class NetworkTest {

	@Test
	public void testIsOOB() {
		ByteBuffer b = ByteBuffer.allocate(12);
		b.put((byte) 0b1111_1111);
		b.put((byte) 0b1111_1111);
		b.put((byte) 0b1111_1111);
		b.put((byte) 0b1111_1111);
		
		b.put((byte) 12);
		b.put((byte) -90);
		b.put((byte) -1);
		
		ByteBuffer b2 = ByteBuffer.allocate(12);
		b2.put((byte) 0b1111_1111);
		b2.put((byte) 21);
		b2.put((byte) 0b1111_1111);
		
		b2.put((byte) 12);
		b2.put((byte) -90);
		b2.put((byte) -1);
		
		assertTrue("OOB buffer", Network.isOOB(b));
		assertFalse("non OOB buffer", Network.isOOB(b2));
	}
/*
	@Test
	public void testACKOOBMessages()
	{
		Network n = new Network(null);
		n.
	}
	*/
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































Deleted test/me/dw/engine/QuaternionHelperTest.java.

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
package me.dw.engine;

import static org.junit.Assert.*;

import org.junit.Test;
import org.lwjgl.util.vector.Quaternion;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;

public class QuaternionHelperTest {

	@Test
	public void testGetAxisAngle() {
		Quaternion q = new Quaternion();
		Vector3f axis = new Vector3f(1, 1, 90);
		float angle = 3.14f;
		Vector4f origAA = QuaternionHelper.createAxisAngle(axis, angle);
		q.setFromAxisAngle(origAA);
		Vector4f newAA = QuaternionHelper.getAxisAngle(q);
		//can fail due to rounding errors, but more basic sample data will pass
		assertTrue(origAA.x == newAA.x);
		assertTrue(origAA.y == newAA.y);
		assertTrue(origAA.z == newAA.z);
		assertTrue(origAA.w == newAA.w);
	}

	@Test
	public void testRotateVector() {
		fail("Not yet implemented");
	}

	@Test
	public void testCreateAxisAngle() {
		//works apparently due to tests in getAxisAngle
		//fail("Not yet implemented");
		assertTrue(true);
	}

}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Deleted test/me/dw/engine/ResourceTest.java.

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
package me.dw.engine;

import static org.junit.Assert.*;

import org.junit.Test;

public class ResourceTest {

	@Test
	public void testResource() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetName() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetPath() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetFilename() {
		fail("Not yet implemented");
	}

	@Test
	public void testRefIncr() {
		fail("Not yet implemented");
	}

	@Test
	public void testRefDecr() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetRefCount() {
		Resource r = new Resource("./", "test");
		assertTrue("RefCount > 0 test",r.getRefCount() > 0);
	}

}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<