diff --git a/OpenArena User's Manual.doc b/OpenArena User's Manual.doc
new file mode 100644
index 0000000..09ac164
Binary files /dev/null and b/OpenArena User's Manual.doc differ
diff --git a/OpenArena User's Manual.htm b/OpenArena User's Manual.htm
new file mode 100644
index 0000000..c1cdc1c
--- /dev/null
+++ b/OpenArena User's Manual.htm
@@ -0,0 +1,1096 @@
+
+
+
+
+
+
+
+
+OpenArena User’s Manual v0
+
+
+
+
+
+
+
+
+
+
OpenArena User’s Manual v0.1.0
+
+
+
+
Table
+of Contents
+
+
+
+
1. Introduction
+
+
a. What This Is
+
+
b. What This Is Not
+
+
c. Version History
+
+
2. Legal Stuff
+
+
a. Legal Notices
+
+
b. Copyright Information
+
+
c. Suggested Proper Uses
+
+
3. How To Use the SDK
+
+
4. Us
+
+
a. Contact Information / Who Did What
+
+
b. Why I Started This Project
+
+
5. Files
+
+
a. Format of the .map file
+
+
b. Format of the .cfg file
+
+
6. Notes on
+the Source Code
+
+
a. Mistakes I Plan To Do Something
+About
+
+
b. Mistakes I Plan To Do Nothing
+About
+
+
7. Changes to
+this manual
+
+
a. Versions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1. Introduction
+
+
+
+
1.a . What This Is
+
+
OpenArena
+is a 3D rendering engine. It is suitable
+for any type of game, but can be used for anything that requires 3D Rendering.
+
+
+
+
1.b . What This Is Not
+
+
OpenArena
+is not a game in itself. I PLAN
+to distribute some sample games as well.
+ OpenArena is not opensource
+software. It is available under the QTPL
+a copy of which is attached.
+
+
+
+
1.c . Version History
+
+
0.0.1-alpha
+
+
First Version
+
+
Loads a map from a file
+and then renders from the origin.
+
+
0.0.2-alpha
+
+
Beginning
+of movement code.
+
+
0.0.3-alpha
+
+
Added
+prelim texture support.
+
+
0.0.4-alpha
+
+
Better movement code.
+
+
0.0.4.1-alpha
+
+
More movement code
+(mouse look) still haven't gotten strafing done yet.
+
+
0.0.5-alpha
+
+
Added support for
+control config files for controls implemented so far.
+
+
0.0.6-alpha
+
+
If only I could
+remember.
+
+
0.0.7-alpha
+
+
Added the ability for
+map files to specify textures to load and which textures go with which
+triangle.
+
+
0.0.8-alpha
+
+
Added
+the ability to load lighting information for an infinite amount of lights from
+a .lit file.
+
+
0.0.9-alpha
+
+
Fixed
+control loading.
+
+
Modified default
+tom4.map file to add 2 more sectors( rooms) to test
+multiple sectors. Until now we had never
+tested a map with more than one sector.
+
+
0.0.10-alpha
+
+
Completely
+overhauled control loading. (technically a
+little faster now)
+
+
Added
+strafing.
+
+
Added mouselook , movespeed , turnspeed , and mousespeed (sensativity ) to the config file
+
+
Changed
+textures in the sample maps.
+
+
0.0.11-alpha
+
+
Added support for
+setting the screen resolution in the config file.
+
+
Added togglemouselook and quickmouselook
+keys.
+
+
0.0.12-alpha
+
+
Moved
+all code from the CONTROLS class into the LEVEL class.
+
+
Moved
+the LoadBMP function into the LEVEL class.
+
+
Moved
+the texutre array into the LEVEL class.
+
+
Added left right and
+middle mouse buttons as viable config keys (mouse1
+left, mouse2 right, mouse3 middle)
+
+
0.0.13-alpha
+
+
Added maxfps param to config files.
+
+
Added colordepth param to config files.
+
+
Added fullscreen param to config files.
+
+
Added map param to config files.
+
+
Added nextLevel to LEVEL class. This should allow to have a series of maps be
+determined from some other config file later on ie . a maplist
+file.
+
+
0.0.14-alpha
+
+
Changed textures to targa files for now only 24 and 32 bit uncompressed images
+are supported but more variety will come as will the return of bitmaps.
+
+
0.0.14.1-alpha
+ Added support for
+compressed targa files.
+
+
0.0.15-alpha
+
+
Added first command line
+switch "+set" with it's first parameter
+game. This changes the directory oa loads data from (will make it also look in the oa folder later and add xgame
+that only looks in this folder).
+
+
0.0.16-alpha
+
+
Added support for .bmp
+textures.
+
+
0.0.17-alpha
+
+
Minor internal tweaking
+can’t remember exactly what though.
+
+
0.0.18-alpha
+
+
Major tweaking to
+movement and rendering although there isn’t apparently any discernable changes
+while running but greatly improved code readability.
+
+
0.1.0-alpha
+
+
Complete rewrite of ingame controls.
+
+
Complete rewrite of level
+loading code.
+
+
Complete rewrite of config loading code.
+
+
New map file format.
+
+
New cfg
+file format.
+
+
Added support for saving a
+map file.
+
+
Added support for saving a cfg file.
+
+
Removed lit file.
+
+
Removed ent file.
+
+
Temporarily removed support
+for lights (they will be back soon).
+
+
(coming soon)
+
+
Added support for .md3
+models.
+
+
Compression some type of
+package system probably zip or rar .
+
+
Camera/World
+Collision.
+
+
A test
+weapon.
+
+
A test
+target ie . Bot with
+no AI just change color or something when hit.
+
+
3D sound and other
+sounds
+
+
More/real background
+music
+
+
+
+
2. Legal Stuff
+
+
+
+
2.a . Legal Notices
+
+
This software is provided without any warranty of any kind not even
+that of merchantability or fitness for a particular purpose. I take no responsibility for any damages to
+anyone or anything resulting from the use or possession of this software.
+
+
+
+
2.b . Copyright Information
+
+
This program can be distributed
+under the GNU GPL with the following exception. I want to make this multiplayer
+compatible later on. So any
+modifications that have anything to do with encryption or netcode
+don't have to be opensource as long as a copy of the
+source is sent to me to peruse and possibly add to the program (with applicable
+credit given). Other than that OA will
+be open source hence the name.
+ Alternatively you can redistribute OA under the QTPL.
+
+
If you would like to modify the
+source code all I want you to do is make the new source available including
+giving me a copy either by e-mail headhunter45@hotmail.com but I have the inbox
+protector on so make sure the subject line has OpenArena
+in it preferably even just OpenArena as a subject
+this is only necessary the first time or two you e-mail me so I can add you to
+my address book.
+
+
The following textures are used with
+permission from Texture Station at http://www.nepthys.com/textures moon2.bmp, ground.bmp , nightSky.bmp . The names have been changed.
+
+
Some of the audio loops used to
+create the background music came, royalty free, from http://www.beatmode.com and Creative Power.
+
+
+
+
2.c . Suggested Uses
+
+
Make the next greatest first person
+shooter.
+
+
Make a really cool RPG.
+
+
+
+
3. How To Use
+The SDK
+
+
I. Take
+my code.
+
+
II. Modify
+it if necessary.
+
+
III. Create
+your own media ie textures, music, maps.
+
+
IV. Distribute.
+
+
V. Repeat.
+
+
+
+
4. Us
+
+
+
+
4.a . Contact Information / Who Did What
+
+
G2k, headhunter45@hotmail.com
+put OpenArena in the subject or I'll never see your
+message.
+
+
+
+
4.b . Why I Started This Project
+
+
I got bored one weekend and couldn't
+find my quake3™ cd .
+
+
+
+
5. Files
+
+
+
+
5.a . Format of the .map file
+
+
+
+
“//” denotes a C++ style comment in this
+description, but there are no comments in the .map file at all.
+
+
Blank lines and organization are for readability
+purposes only.
+
+
+
+
1 //Gravity
+not implemented yet
+
+
4 //Number
+of triangles in the map
+
+
+
+
//First triangle
+
+
1 //Texture
+for the first triangle
+
+
//Verticies of this triangle u and v are
+texture coordinates
+
+
// x
+ y z u
+ v
+
+
-10.0 - 1.0
+ -10.0 0.0 0.0
+
+
-10.0 - 1.0
+ 10.0 2 0.0
+
+
-10.0 10.0
+ 10.0
+ 2 1.1
+
+
//The normal for this triangle in x, y, z format
+will take out later
+
+
1.0 0.0 0.0
+
+
+
+
//Second triangle
+
+
1
+
+
-10.0 - 1.0
+ -10.0 0.0 0.0
+
+
-10.0 10.0
+ -10.0 0.0 1.1
+
+
-10.0 10.0
+ 10.0
+ 2 1.1
+
+
1.0 0.0 0.0
+
+
+
+
//Third triangle
+
+
1
+
+
10.0 - 1.0 -10.0
+ 0.0 0.0
+
+
10.0 - 1.0 10.0
+ 2 0.0
+
+
10.0 10.0 10.0 2 1.1
+
+
-1.0 0.0 0.0
+
+
+
+
//Fourth Triangle
+
+
1
+
+
10.0 - 1.0 -10.0
+ 0.0 0.0
+
+
10.0 10.0 -10.0
+ 0.0 1.1
+
+
10.0 10.0 10.0 2 1.1
+
+
-1.0 0.0 0.0
+
+
+
+
3 //Number
+of textures
+
+
groundc.tga //Texture filenames all in the gamedir /textures folder. Bmp and tga
+textures are allowed.
+
+
moonc.tga
+
+
nightSkyc.tga
+
+
+
+
bgm2.mp3 //Background
+music file cda1 specifies the first cd -audio track in
+the first cd-rom drive cda2 the second and so on.
+
+
+
+
5.b . Format of the . cfg file
+
+
<command > <param 1> <param 2> … <param n>
+
+
One command per line separated by any amount of whitespace . WARNING!
+ The parser treats newlines as whitespace but does not require a newline
+to separate a command. This may change
+so stick with this format. The parser
+does not like syntax errors.
+
+
+
+
+
+
6. Notes On
+The Source Code
+
+
+
+
6.a . Mistakes I Plan To Do Something About
+
+
Almost nothing is properly
+commented. (I’m working on this … slowly … kinda )
+
+
Really really bad organization and nonuniform
+nameing conventions. (This is getting better though.)
+
+
+
+
6.b . Mistakes I Plan To Do Nothing About
+
+
None so far.
+
+
+
+
7. Changes to this file
+
+
+
+
7.a . Versions
+
+
+
+
v0.0.1
+
+
Origional
+Version
+
+
v0.0.2
+
+
Reorganized a few things
+
+
v0.0.3
+
+
Updated contact
+information and added an update for OpenArena
+v0.0.18-alpha
+
+
v0.1.0
+
+
Made version numbers of
+this file match OpenArena release versions.
+
+
Updated file description
+sections.
+
+
Made
+section headings bold.
+
+
Removed sections 5.b and
+5.c and renamed 5.d to 5.b because those files are no longer used.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OpenArena User's Manual.html b/OpenArena User's Manual.html
new file mode 100644
index 0000000..c1cdc1c
--- /dev/null
+++ b/OpenArena User's Manual.html
@@ -0,0 +1,1096 @@
+
+
+
+
+
+
+
+
+OpenArena User’s Manual v0
+
+
+
+
+
+
+
+
+
+
OpenArena User’s Manual v0.1.0
+
+
+
+
Table
+of Contents
+
+
+
+
1. Introduction
+
+
a. What This Is
+
+
b. What This Is Not
+
+
c. Version History
+
+
2. Legal Stuff
+
+
a. Legal Notices
+
+
b. Copyright Information
+
+
c. Suggested Proper Uses
+
+
3. How To Use the SDK
+
+
4. Us
+
+
a. Contact Information / Who Did What
+
+
b. Why I Started This Project
+
+
5. Files
+
+
a. Format of the .map file
+
+
b. Format of the .cfg file
+
+
6. Notes on
+the Source Code
+
+
a. Mistakes I Plan To Do Something
+About
+
+
b. Mistakes I Plan To Do Nothing
+About
+
+
7. Changes to
+this manual
+
+
a. Versions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1. Introduction
+
+
+
+
1.a . What This Is
+
+
OpenArena
+is a 3D rendering engine. It is suitable
+for any type of game, but can be used for anything that requires 3D Rendering.
+
+
+
+
1.b . What This Is Not
+
+
OpenArena
+is not a game in itself. I PLAN
+to distribute some sample games as well.
+ OpenArena is not opensource
+software. It is available under the QTPL
+a copy of which is attached.
+
+
+
+
1.c . Version History
+
+
0.0.1-alpha
+
+
First Version
+
+
Loads a map from a file
+and then renders from the origin.
+
+
0.0.2-alpha
+
+
Beginning
+of movement code.
+
+
0.0.3-alpha
+
+
Added
+prelim texture support.
+
+
0.0.4-alpha
+
+
Better movement code.
+
+
0.0.4.1-alpha
+
+
More movement code
+(mouse look) still haven't gotten strafing done yet.
+
+
0.0.5-alpha
+
+
Added support for
+control config files for controls implemented so far.
+
+
0.0.6-alpha
+
+
If only I could
+remember.
+
+
0.0.7-alpha
+
+
Added the ability for
+map files to specify textures to load and which textures go with which
+triangle.
+
+
0.0.8-alpha
+
+
Added
+the ability to load lighting information for an infinite amount of lights from
+a .lit file.
+
+
0.0.9-alpha
+
+
Fixed
+control loading.
+
+
Modified default
+tom4.map file to add 2 more sectors( rooms) to test
+multiple sectors. Until now we had never
+tested a map with more than one sector.
+
+
0.0.10-alpha
+
+
Completely
+overhauled control loading. (technically a
+little faster now)
+
+
Added
+strafing.
+
+
Added mouselook , movespeed , turnspeed , and mousespeed (sensativity ) to the config file
+
+
Changed
+textures in the sample maps.
+
+
0.0.11-alpha
+
+
Added support for
+setting the screen resolution in the config file.
+
+
Added togglemouselook and quickmouselook
+keys.
+
+
0.0.12-alpha
+
+
Moved
+all code from the CONTROLS class into the LEVEL class.
+
+
Moved
+the LoadBMP function into the LEVEL class.
+
+
Moved
+the texutre array into the LEVEL class.
+
+
Added left right and
+middle mouse buttons as viable config keys (mouse1
+left, mouse2 right, mouse3 middle)
+
+
0.0.13-alpha
+
+
Added maxfps param to config files.
+
+
Added colordepth param to config files.
+
+
Added fullscreen param to config files.
+
+
Added map param to config files.
+
+
Added nextLevel to LEVEL class. This should allow to have a series of maps be
+determined from some other config file later on ie . a maplist
+file.
+
+
0.0.14-alpha
+
+
Changed textures to targa files for now only 24 and 32 bit uncompressed images
+are supported but more variety will come as will the return of bitmaps.
+
+
0.0.14.1-alpha
+ Added support for
+compressed targa files.
+
+
0.0.15-alpha
+
+
Added first command line
+switch "+set" with it's first parameter
+game. This changes the directory oa loads data from (will make it also look in the oa folder later and add xgame
+that only looks in this folder).
+
+
0.0.16-alpha
+
+
Added support for .bmp
+textures.
+
+
0.0.17-alpha
+
+
Minor internal tweaking
+can’t remember exactly what though.
+
+
0.0.18-alpha
+
+
Major tweaking to
+movement and rendering although there isn’t apparently any discernable changes
+while running but greatly improved code readability.
+
+
0.1.0-alpha
+
+
Complete rewrite of ingame controls.
+
+
Complete rewrite of level
+loading code.
+
+
Complete rewrite of config loading code.
+
+
New map file format.
+
+
New cfg
+file format.
+
+
Added support for saving a
+map file.
+
+
Added support for saving a cfg file.
+
+
Removed lit file.
+
+
Removed ent file.
+
+
Temporarily removed support
+for lights (they will be back soon).
+
+
(coming soon)
+
+
Added support for .md3
+models.
+
+
Compression some type of
+package system probably zip or rar .
+
+
Camera/World
+Collision.
+
+
A test
+weapon.
+
+
A test
+target ie . Bot with
+no AI just change color or something when hit.
+
+
3D sound and other
+sounds
+
+
More/real background
+music
+
+
+
+
2. Legal Stuff
+
+
+
+
2.a . Legal Notices
+
+
This software is provided without any warranty of any kind not even
+that of merchantability or fitness for a particular purpose. I take no responsibility for any damages to
+anyone or anything resulting from the use or possession of this software.
+
+
+
+
2.b . Copyright Information
+
+
This program can be distributed
+under the GNU GPL with the following exception. I want to make this multiplayer
+compatible later on. So any
+modifications that have anything to do with encryption or netcode
+don't have to be opensource as long as a copy of the
+source is sent to me to peruse and possibly add to the program (with applicable
+credit given). Other than that OA will
+be open source hence the name.
+ Alternatively you can redistribute OA under the QTPL.
+
+
If you would like to modify the
+source code all I want you to do is make the new source available including
+giving me a copy either by e-mail headhunter45@hotmail.com but I have the inbox
+protector on so make sure the subject line has OpenArena
+in it preferably even just OpenArena as a subject
+this is only necessary the first time or two you e-mail me so I can add you to
+my address book.
+
+
The following textures are used with
+permission from Texture Station at http://www.nepthys.com/textures moon2.bmp, ground.bmp , nightSky.bmp . The names have been changed.
+
+
Some of the audio loops used to
+create the background music came, royalty free, from http://www.beatmode.com and Creative Power.
+
+
+
+
2.c . Suggested Uses
+
+
Make the next greatest first person
+shooter.
+
+
Make a really cool RPG.
+
+
+
+
3. How To Use
+The SDK
+
+
I. Take
+my code.
+
+
II. Modify
+it if necessary.
+
+
III. Create
+your own media ie textures, music, maps.
+
+
IV. Distribute.
+
+
V. Repeat.
+
+
+
+
4. Us
+
+
+
+
4.a . Contact Information / Who Did What
+
+
G2k, headhunter45@hotmail.com
+put OpenArena in the subject or I'll never see your
+message.
+
+
+
+
4.b . Why I Started This Project
+
+
I got bored one weekend and couldn't
+find my quake3™ cd .
+
+
+
+
5. Files
+
+
+
+
5.a . Format of the .map file
+
+
+
+
“//” denotes a C++ style comment in this
+description, but there are no comments in the .map file at all.
+
+
Blank lines and organization are for readability
+purposes only.
+
+
+
+
1 //Gravity
+not implemented yet
+
+
4 //Number
+of triangles in the map
+
+
+
+
//First triangle
+
+
1 //Texture
+for the first triangle
+
+
//Verticies of this triangle u and v are
+texture coordinates
+
+
// x
+ y z u
+ v
+
+
-10.0 - 1.0
+ -10.0 0.0 0.0
+
+
-10.0 - 1.0
+ 10.0 2 0.0
+
+
-10.0 10.0
+ 10.0
+ 2 1.1
+
+
//The normal for this triangle in x, y, z format
+will take out later
+
+
1.0 0.0 0.0
+
+
+
+
//Second triangle
+
+
1
+
+
-10.0 - 1.0
+ -10.0 0.0 0.0
+
+
-10.0 10.0
+ -10.0 0.0 1.1
+
+
-10.0 10.0
+ 10.0
+ 2 1.1
+
+
1.0 0.0 0.0
+
+
+
+
//Third triangle
+
+
1
+
+
10.0 - 1.0 -10.0
+ 0.0 0.0
+
+
10.0 - 1.0 10.0
+ 2 0.0
+
+
10.0 10.0 10.0 2 1.1
+
+
-1.0 0.0 0.0
+
+
+
+
//Fourth Triangle
+
+
1
+
+
10.0 - 1.0 -10.0
+ 0.0 0.0
+
+
10.0 10.0 -10.0
+ 0.0 1.1
+
+
10.0 10.0 10.0 2 1.1
+
+
-1.0 0.0 0.0
+
+
+
+
3 //Number
+of textures
+
+
groundc.tga //Texture filenames all in the gamedir /textures folder. Bmp and tga
+textures are allowed.
+
+
moonc.tga
+
+
nightSkyc.tga
+
+
+
+
bgm2.mp3 //Background
+music file cda1 specifies the first cd -audio track in
+the first cd-rom drive cda2 the second and so on.
+
+
+
+
5.b . Format of the . cfg file
+
+
<command > <param 1> <param 2> … <param n>
+
+
One command per line separated by any amount of whitespace . WARNING!
+ The parser treats newlines as whitespace but does not require a newline
+to separate a command. This may change
+so stick with this format. The parser
+does not like syntax errors.
+
+
+
+
+
+
6. Notes On
+The Source Code
+
+
+
+
6.a . Mistakes I Plan To Do Something About
+
+
Almost nothing is properly
+commented. (I’m working on this … slowly … kinda )
+
+
Really really bad organization and nonuniform
+nameing conventions. (This is getting better though.)
+
+
+
+
6.b . Mistakes I Plan To Do Nothing About
+
+
None so far.
+
+
+
+
7. Changes to this file
+
+
+
+
7.a . Versions
+
+
+
+
v0.0.1
+
+
Origional
+Version
+
+
v0.0.2
+
+
Reorganized a few things
+
+
v0.0.3
+
+
Updated contact
+information and added an update for OpenArena
+v0.0.18-alpha
+
+
v0.1.0
+
+
Made version numbers of
+this file match OpenArena release versions.
+
+
Updated file description
+sections.
+
+
Made
+section headings bold.
+
+
Removed sections 5.b and
+5.c and renamed 5.d to 5.b because those files are no longer used.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OpenArena/bass.dll b/OpenArena/bass.dll
new file mode 100644
index 0000000..c08fd2d
Binary files /dev/null and b/OpenArena/bass.dll differ
diff --git a/OpenArena/oa/config/G2k.cfg b/OpenArena/oa/config/G2k.cfg
new file mode 100644
index 0000000..91d1556
--- /dev/null
+++ b/OpenArena/oa/config/G2k.cfg
@@ -0,0 +1,30 @@
+bind forward up
+bind backward down
+bind forward mouse1
+bind backward mouse2
+bind lookleft left
+bind lookright right
+bind lookup pageup
+bind lookdown pagedown
+bind moveleft s
+bind moveright d
+bind moveup space
+bind movedown a
+bind fireprimary f
+bind firesecondary g
+bind weapnext t
+bind weapprev r
+bind togglelights l
+bind togglefps p
+bind toggleconsole `
+bind togglemouselook null
+bind quickmouselook null
+set turnspeed 1.0
+//set movespeed 0.2
+set fullscreen 0
+set mousespeed 5
+set mouselook 1
+set screenwidth 1024
+set screenheight 768
+set colordepth 32
+set maxfps 500
\ No newline at end of file
diff --git a/OpenArena/oa/config/my.cfg b/OpenArena/oa/config/my.cfg
new file mode 100644
index 0000000..bffcf54
--- /dev/null
+++ b/OpenArena/oa/config/my.cfg
@@ -0,0 +1,36 @@
+bind forward up
+bind backward down
+bind forward mouse1
+bind backward mouse2
+bind lookleft left
+bind lookright right
+bind lookup pageup
+bind lookdown pagedown
+bind moveleft s
+bind moveright d
+bind moveup space
+bind movedown a
+bind fireprimary f
+bind firesecondary g
+bind weapnext t
+bind weapprev r
+bind togglelights l
+bind togglefps p
+bind toggleconsole ~
+bind toggleconsole `
+bind toggleconsole i
+bind togglemouselook m
+bind quickmouselook y
+set turnspeed 0.02
+set movespeed 0.2
+set mousespeed 5
+set mouselook 1
+set screenwidth 800
+set screenheight 600
+set colordepth 16
+set fullscreen 0
+map intro.map
+set maxfps 60
+set rollleft w
+set rollright e
+set sound 1
diff --git a/OpenArena/oa/maps/intro.map b/OpenArena/oa/maps/intro.map
new file mode 100644
index 0000000..0455d6c
--- /dev/null
+++ b/OpenArena/oa/maps/intro.map
@@ -0,0 +1,16 @@
+1
+1
+
+
+0
+-10 -10 -5 0 0
+-10 10 -5 0 1
+10 -10 -5 1 0
+0 0 1
+
+3
+groundc.tga
+moonc.tga
+nightSkyc.tga
+
+bgm1.mp3
diff --git a/OpenArena/oa/maps/oamap1.map b/OpenArena/oa/maps/oamap1.map
new file mode 100644
index 0000000..608a753
--- /dev/null
+++ b/OpenArena/oa/maps/oamap1.map
@@ -0,0 +1,14 @@
+1
+1
+
+0
+-10 -10 -5 0 0
+-10 10 -5 0 1
+10 -10 -5 1 0
+0 0 1
+
+3
+groundc.tga
+moonc.tga
+nightSkyc.tga
+bgm1.mp3
diff --git a/OpenArena/oa/maps/oamap1.xml b/OpenArena/oa/maps/oamap1.xml
new file mode 100644
index 0000000..e69de29
diff --git a/OpenArena/oa/music/bgm/bgm1.mp3 b/OpenArena/oa/music/bgm/bgm1.mp3
new file mode 100644
index 0000000..b6ac72c
Binary files /dev/null and b/OpenArena/oa/music/bgm/bgm1.mp3 differ
diff --git a/OpenArena/oa/music/bgm/bgm2.mp3 b/OpenArena/oa/music/bgm/bgm2.mp3
new file mode 100644
index 0000000..b6e6ff6
Binary files /dev/null and b/OpenArena/oa/music/bgm/bgm2.mp3 differ
diff --git a/OpenArena/oa/textures/Thumbs.db b/OpenArena/oa/textures/Thumbs.db
new file mode 100644
index 0000000..2396f8c
Binary files /dev/null and b/OpenArena/oa/textures/Thumbs.db differ
diff --git a/OpenArena/oa/textures/default.tga b/OpenArena/oa/textures/default.tga
new file mode 100644
index 0000000..d39612a
Binary files /dev/null and b/OpenArena/oa/textures/default.tga differ
diff --git a/OpenArena/oa/textures/groundc.tga b/OpenArena/oa/textures/groundc.tga
new file mode 100644
index 0000000..d39612a
Binary files /dev/null and b/OpenArena/oa/textures/groundc.tga differ
diff --git a/OpenArena/oa/textures/menu/Thumbs.db b/OpenArena/oa/textures/menu/Thumbs.db
new file mode 100644
index 0000000..1364816
Binary files /dev/null and b/OpenArena/oa/textures/menu/Thumbs.db differ
diff --git a/OpenArena/oa/textures/menu/con_back.bmp b/OpenArena/oa/textures/menu/con_back.bmp
new file mode 100644
index 0000000..baa881d
Binary files /dev/null and b/OpenArena/oa/textures/menu/con_back.bmp differ
diff --git a/OpenArena/oa/textures/menu/con_back.tga b/OpenArena/oa/textures/menu/con_back.tga
new file mode 100644
index 0000000..71e7493
Binary files /dev/null and b/OpenArena/oa/textures/menu/con_back.tga differ
diff --git a/OpenArena/oa/textures/menu/font.bmp b/OpenArena/oa/textures/menu/font.bmp
new file mode 100644
index 0000000..0ea960e
Binary files /dev/null and b/OpenArena/oa/textures/menu/font.bmp differ
diff --git a/OpenArena/oa/textures/moonc.tga b/OpenArena/oa/textures/moonc.tga
new file mode 100644
index 0000000..02fc902
Binary files /dev/null and b/OpenArena/oa/textures/moonc.tga differ
diff --git a/OpenArena/oa/textures/nightSkyc.tga b/OpenArena/oa/textures/nightSkyc.tga
new file mode 100644
index 0000000..4387516
Binary files /dev/null and b/OpenArena/oa/textures/nightSkyc.tga differ
diff --git a/OpenArena/oa/textures/test.bmp b/OpenArena/oa/textures/test.bmp
new file mode 100644
index 0000000..1de073c
Binary files /dev/null and b/OpenArena/oa/textures/test.bmp differ
diff --git a/bass.dll b/bass.dll
new file mode 100644
index 0000000..c08fd2d
Binary files /dev/null and b/bass.dll differ
diff --git a/include/bass.h b/include/bass.h
new file mode 100644
index 0000000..a6ff500
--- /dev/null
+++ b/include/bass.h
@@ -0,0 +1,1221 @@
+/* BASS 1.6 C/C++ header file, copyright (c) 1999-2002 Ian Luck.
+ Please report bugs/suggestions/etc... to bass@un4seen.com
+
+ See the BASS.CHM file for more complete documentation */
+
+#ifndef BASS_H
+#define BASS_H
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef BASSDEF
+#define BASSDEF(f) WINAPI f
+#endif
+
+typedef unsigned __int64 QWORD; // 64-bit
+
+typedef DWORD HMUSIC; // MOD music handle
+typedef DWORD HSAMPLE; // sample handle
+typedef DWORD HCHANNEL; // playing sample's channel handle
+typedef DWORD HSTREAM; // sample stream handle
+typedef DWORD HSYNC; // synchronizer handle
+typedef DWORD HDSP; // DSP handle
+typedef DWORD HFX; // DX8 effect handle
+
+// Error codes returned by BASS_GetErrorCode
+#define BASS_OK 0 // all is OK
+#define BASS_ERROR_MEM 1 // memory error
+#define BASS_ERROR_FILEOPEN 2 // can't open the file
+#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver
+#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost - please report this!
+#define BASS_ERROR_HANDLE 5 // invalid handle
+#define BASS_ERROR_FORMAT 6 // unsupported format
+#define BASS_ERROR_POSITION 7 // invalid playback position
+#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called
+#define BASS_ERROR_START 9 // BASS_Start has not been successfully called
+#define BASS_ERROR_INITCD 10 // can't initialize CD
+#define BASS_ERROR_CDINIT 11 // BASS_CDInit has not been successfully called
+#define BASS_ERROR_NOCD 12 // no CD in drive
+#define BASS_ERROR_CDTRACK 13 // can't play the selected CD track
+#define BASS_ERROR_ALREADY 14 // already initialized
+#define BASS_ERROR_CDVOL 15 // CD has no volume control
+#define BASS_ERROR_NOPAUSE 16 // not paused
+#define BASS_ERROR_NOTAUDIO 17 // not an audio track
+#define BASS_ERROR_NOCHAN 18 // can't get a free channel
+#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified
+#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified
+#define BASS_ERROR_NO3D 21 // no 3D support
+#define BASS_ERROR_NOEAX 22 // no EAX support
+#define BASS_ERROR_DEVICE 23 // illegal device number
+#define BASS_ERROR_NOPLAY 24 // not playing
+#define BASS_ERROR_FREQ 25 // illegal sample rate
+#define BASS_ERROR_NOA3D 26 // A3D.DLL is not installed
+#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream (WAV/MP3/MP2/MP1/OGG)
+#define BASS_ERROR_NOHW 29 // no hardware voices available
+#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data
+#define BASS_ERROR_NONET 32 // no internet connection could be opened
+#define BASS_ERROR_CREATE 33 // couldn't create the file
+#define BASS_ERROR_NOFX 34 // effects are not enabled
+#define BASS_ERROR_PLAYING 35 // the channel is playing
+#define BASS_ERROR_NOTAVAIL 37 // requested data is not available
+#define BASS_ERROR_DECODE 38 // the channel is a "decoding channel"
+#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed
+#define BASS_ERROR_TIMEOUT 40 // connection timedout
+#define BASS_ERROR_UNKNOWN -1 // some other mystery error
+
+// Device setup flags
+#define BASS_DEVICE_8BITS 1 // use 8 bit resolution, else 16 bit
+#define BASS_DEVICE_MONO 2 // use mono, else stereo
+#define BASS_DEVICE_3D 4 // enable 3D functionality
+/* If the BASS_DEVICE_3D flag is not specified when initilizing BASS,
+then the 3D flags (BASS_SAMPLE_3D and BASS_MUSIC_3D) are ignored when
+loading/creating a sample/stream/music. */
+#define BASS_DEVICE_LEAVEVOL 32 // leave the volume as it is
+#define BASS_DEVICE_NOTHREAD 128 // update buffers manually (using BASS_Update)
+#define BASS_DEVICE_LATENCY 256 // calculate device latency (BASS_INFO struct)
+#define BASS_DEVICE_VOL1000 512 // 0-1000 volume range (else 0-100)
+
+// DirectSound interfaces (for use with BASS_GetDSoundObject)
+#define BASS_OBJECT_DS 1 // IDirectSound
+#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener
+
+typedef struct {
+ DWORD size; // size of this struct (set this before calling the function)
+ DWORD flags; // device capabilities (DSCAPS_xxx flags)
+ DWORD hwsize; // size of total device hardware memory
+ DWORD hwfree; // size of free device hardware memory
+ DWORD freesam; // number of free sample slots in the hardware
+ DWORD free3d; // number of free 3D sample slots in the hardware
+ DWORD minrate; // min sample rate supported by the hardware
+ DWORD maxrate; // max sample rate supported by the hardware
+ BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
+ DWORD a3d; // unused
+ DWORD dsver; // DirectSound version (use to check for DX5/7 functions)
+ DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
+} BASS_INFO;
+
+// BASS_INFO flags (from DSOUND.H)
+#define DSCAPS_CONTINUOUSRATE 0x00000010
+/* supports all sample rates between min/maxrate */
+#define DSCAPS_EMULDRIVER 0x00000020
+/* device does NOT have hardware DirectSound support */
+#define DSCAPS_CERTIFIED 0x00000040
+/* device driver has been certified by Microsoft */
+/* The following flags tell what type of samples are supported by HARDWARE
+mixing, all these formats are supported by SOFTWARE mixing */
+#define DSCAPS_SECONDARYMONO 0x00000100 // mono
+#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo
+#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit
+#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit
+
+typedef struct {
+ DWORD size; // size of this struct (set this before calling the function)
+ DWORD flags; // device capabilities (DSCCAPS_xxx flags)
+ DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags)
+ DWORD inputs; // number of inputs
+ BOOL singlein; // TRUE = only 1 input can be set at a time
+} BASS_RECORDINFO;
+
+// BASS_RECORDINFO flags (from DSOUND.H)
+#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER
+/* device does NOT have hardware DirectSound recording support */
+#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED
+/* device driver has been certified by Microsoft */
+
+// defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
+#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */
+#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */
+#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */
+#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */
+#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */
+#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */
+#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */
+#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */
+#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */
+#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */
+#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */
+#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */
+
+// Music flags
+#define BASS_MUSIC_RAMP 1 // normal ramping
+#define BASS_MUSIC_RAMPS 2 // sensitive ramping
+/* Ramping doesn't take a lot of extra processing and improves
+the sound quality by removing "clicks". Sensitive ramping will
+leave sharp attacked samples, unlike normal ramping. */
+#define BASS_MUSIC_LOOP 4 // loop music
+#define BASS_MUSIC_FT2MOD 16 // play .MOD as FastTracker 2 does
+#define BASS_MUSIC_PT1MOD 32 // play .MOD as ProTracker 1 does
+#define BASS_MUSIC_MONO 64 // force mono mixing (less CPU usage)
+#define BASS_MUSIC_3D 128 // enable 3D functionality
+#define BASS_MUSIC_POSRESET 256 // stop all notes when moving position
+#define BASS_MUSIC_SURROUND 512 // surround sound
+#define BASS_MUSIC_SURROUND2 1024 // surround sound (mode 2)
+#define BASS_MUSIC_STOPBACK 2048 // stop the music on a backwards jump effect
+#define BASS_MUSIC_FX 4096 // enable DX8 effects
+#define BASS_MUSIC_CALCLEN 8192 // calculate playback length
+#define BASS_MUSIC_DECODE 0x200000// don't play the music, only decode (BASS_ChannelGetData)
+#define BASS_MUSIC_NOSAMPLE 0x400000// don't load the samples
+
+// Sample info structure & flags
+typedef struct {
+ DWORD freq; // default playback rate
+ DWORD volume; // default volume (0-100)
+ int pan; // default pan (-100=left, 0=middle, 100=right)
+ DWORD flags; // BASS_SAMPLE_xxx flags
+ DWORD length; // length (in samples, not bytes)
+ DWORD max; // maximum simultaneous playbacks
+/* The following are the sample's default 3D attributes (if the sample
+is 3D, BASS_SAMPLE_3D is in flags) see BASS_ChannelSet3DAttributes */
+ DWORD mode3d; // BASS_3DMODE_xxx mode
+ float mindist; // minimum distance
+ float maxdist; // maximum distance
+ DWORD iangle; // angle of inside projection cone
+ DWORD oangle; // angle of outside projection cone
+ DWORD outvol; // delta-volume outside the projection cone
+/* The following are the defaults used if the sample uses the DirectX 7
+voice allocation/management features. */
+ DWORD vam; // voice allocation/management flags (BASS_VAM_xxx)
+ DWORD priority; // priority (0=lowest, 0xffffffff=highest)
+} BASS_SAMPLE;
+
+#define BASS_SAMPLE_8BITS 1 // 8 bit, else 16 bit
+#define BASS_SAMPLE_MONO 2 // mono, else stereo
+#define BASS_SAMPLE_LOOP 4 // looped
+#define BASS_SAMPLE_3D 8 // 3D functionality enabled
+#define BASS_SAMPLE_SOFTWARE 16 // it's NOT using hardware mixing
+#define BASS_SAMPLE_MUTEMAX 32 // muted at max distance (3D only)
+#define BASS_SAMPLE_VAM 64 // uses the DX7 voice allocation & management
+#define BASS_SAMPLE_FX 128 // the DX8 effects are enabled
+#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume
+#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing
+#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only)
+
+#define BASS_MP3_HALFRATE 0x10000 // reduced quality MP3/MP2/MP1 (half sample rate)
+#define BASS_MP3_SETPOS 0x20000 // enable pin-point seeking on the MP3/MP2/MP1/OGG
+
+#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends
+#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams
+#define BASS_STREAM_BLOCK 0x100000// download/play internet file stream (MPx/OGG) in small blocks
+#define BASS_STREAM_DECODE 0x200000// don't play the stream, only decode (BASS_ChannelGetData)
+#define BASS_STREAM_META 0x400000// request metadata from a Shoutcast stream
+
+// DX7 voice allocation flags
+#define BASS_VAM_HARDWARE 1
+/* Play the sample in hardware. If no hardware voices are available then
+the "play" call will fail */
+#define BASS_VAM_SOFTWARE 2
+/* Play the sample in software (ie. non-accelerated). No other VAM flags
+may be used together with this flag. */
+
+// DX7 voice management flags
+/* These flags enable hardware resource stealing... if the hardware has no
+available voices, a currently playing buffer will be stopped to make room for
+the new buffer. NOTE: only samples loaded/created with the BASS_SAMPLE_VAM
+flag are considered for termination by the DX7 voice management. */
+#define BASS_VAM_TERM_TIME 4
+/* If there are no free hardware voices, the buffer to be terminated will be
+the one with the least time left to play. */
+#define BASS_VAM_TERM_DIST 8
+/* If there are no free hardware voices, the buffer to be terminated will be
+one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is beyond
+it's max distance. If there are no buffers that match this criteria, then the
+"play" call will fail. */
+#define BASS_VAM_TERM_PRIO 16
+/* If there are no free hardware voices, the buffer to be terminated will be
+the one with the lowest priority. */
+
+// 3D vector (for 3D positions/velocities/orientations)
+typedef struct {
+ float x; // +=right, -=left
+ float y; // +=up, -=down
+ float z; // +=front, -=behind
+} BASS_3DVECTOR;
+
+// 3D channel modes
+#define BASS_3DMODE_NORMAL 0
+/* normal 3D processing */
+#define BASS_3DMODE_RELATIVE 1
+/* The channel's 3D position (position/velocity/orientation) are relative to
+the listener. When the listener's position/velocity/orientation is changed
+with BASS_Set3DPosition, the channel's position relative to the listener does
+not change. */
+#define BASS_3DMODE_OFF 2
+/* Turn off 3D processing on the channel, the sound will be played
+in the center. */
+
+// EAX environments, use with BASS_SetEAXParameters
+enum
+{
+ EAX_ENVIRONMENT_GENERIC,
+ EAX_ENVIRONMENT_PADDEDCELL,
+ EAX_ENVIRONMENT_ROOM,
+ EAX_ENVIRONMENT_BATHROOM,
+ EAX_ENVIRONMENT_LIVINGROOM,
+ EAX_ENVIRONMENT_STONEROOM,
+ EAX_ENVIRONMENT_AUDITORIUM,
+ EAX_ENVIRONMENT_CONCERTHALL,
+ EAX_ENVIRONMENT_CAVE,
+ EAX_ENVIRONMENT_ARENA,
+ EAX_ENVIRONMENT_HANGAR,
+ EAX_ENVIRONMENT_CARPETEDHALLWAY,
+ EAX_ENVIRONMENT_HALLWAY,
+ EAX_ENVIRONMENT_STONECORRIDOR,
+ EAX_ENVIRONMENT_ALLEY,
+ EAX_ENVIRONMENT_FOREST,
+ EAX_ENVIRONMENT_CITY,
+ EAX_ENVIRONMENT_MOUNTAINS,
+ EAX_ENVIRONMENT_QUARRY,
+ EAX_ENVIRONMENT_PLAIN,
+ EAX_ENVIRONMENT_PARKINGLOT,
+ EAX_ENVIRONMENT_SEWERPIPE,
+ EAX_ENVIRONMENT_UNDERWATER,
+ EAX_ENVIRONMENT_DRUGGED,
+ EAX_ENVIRONMENT_DIZZY,
+ EAX_ENVIRONMENT_PSYCHOTIC,
+
+ EAX_ENVIRONMENT_COUNT // total number of environments
+};
+
+// EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx)
+#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F
+#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F
+#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F
+#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F
+#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F
+#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F
+#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F
+#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F
+#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F
+#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F
+#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F
+#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F
+#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F
+#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F
+#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F
+#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F
+#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F
+#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F
+#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F
+#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F
+#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F
+#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F
+#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F
+#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F
+#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F
+#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F
+
+// software 3D mixing algorithm modes (used with BASS_Set3DAlgorithm)
+#define BASS_3DALG_DEFAULT 0
+/* default algorithm (currently translates to BASS_3DALG_OFF) */
+#define BASS_3DALG_OFF 1
+/* Uses normal left and right panning. The vertical axis is ignored except for
+scaling of volume due to distance. Doppler shift and volume scaling are still
+applied, but the 3D filtering is not performed. This is the most CPU efficient
+software implementation, but provides no virtual 3D audio effect. Head Related
+Transfer Function processing will not be done. Since only normal stereo panning
+is used, a channel using this algorithm may be accelerated by a 2D hardware
+voice if no free 3D hardware voices are available. */
+#define BASS_3DALG_FULL 2
+/* This algorithm gives the highest quality 3D audio effect, but uses more CPU.
+Requires Windows 98 2nd Edition or Windows 2000 that uses WDM drivers, if this
+mode is not available then BASS_3DALG_OFF will be used instead. */
+#define BASS_3DALG_LIGHT 3
+/* This algorithm gives a good 3D audio effect, and uses less CPU than the FULL
+mode. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM drivers, if
+this mode is not available then BASS_3DALG_OFF will be used instead. */
+
+typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, DWORD user);
+/* Stream callback function. NOTE: A stream function should obviously be as quick
+as possible, other streams (and MOD musics) can't be mixed until it's finished.
+handle : The stream that needs writing
+buffer : Buffer to write the samples in
+length : Number of bytes to write
+user : The 'user' parameter value given when calling BASS_StreamCreate
+RETURN : Number of bytes written. If less than "length" then the
+ stream is assumed to be at the end, and is stopped. */
+
+/* Sync types (with BASS_ChannelSetSync "param" and SYNCPROC "data"
+definitions) & flags. */
+#define BASS_SYNC_MUSICPOS 0
+#define BASS_SYNC_POS 0
+/* Sync when a music or stream reaches a position.
+if HMUSIC...
+param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all)
+data : LOWORD=order HIWORD=row
+if HSTREAM...
+param: position in bytes
+data : not used */
+#define BASS_SYNC_MUSICINST 1
+/* Sync when an instrument (sample for the non-instrument based formats)
+is played in a music (not including retrigs).
+param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all)
+data : LOWORD=note HIWORD=volume (0-64) */
+#define BASS_SYNC_END 2
+/* Sync when a music or file stream reaches the end.
+param: not used
+data : 1 = the sync is triggered by a backward jump in a MOD music, otherwise not used */
+#define BASS_SYNC_MUSICFX 3
+/* Sync when the "sync" effect (XM/MTM/MOD: E8x/Wxx, IT/S3M: S2x) is used.
+param: 0:data=pos, 1:data="x" value
+data : param=0: LOWORD=order HIWORD=row, param=1: "x" value */
+#define BASS_SYNC_META 4
+/* Sync when metadata is received in a Shoutcast stream.
+param: not used
+data : pointer to the metadata */
+#define BASS_SYNC_MESSAGE 0x20000000 // FLAG: post a Windows message (instead of callback)
+/* When using a window message "callback", the message to post is given in the "proc"
+parameter of BASS_ChannelSetSync, and is posted to the window specified in the BASS_Init
+call. The message parameters are: WPARAM = data, LPARAM = user. */
+#define BASS_SYNC_MIXTIME 0x40000000 // FLAG: sync at mixtime, else at playtime
+#define BASS_SYNC_ONETIME 0x80000000 // FLAG: sync only once, else continuously
+
+typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, DWORD user);
+/* Sync callback function. NOTE: a sync callback function should be very
+quick (eg. just posting a message) as other syncs cannot be processed
+until it has finished. If the sync is a "mixtime" sync, then other streams
+and MOD musics can not be mixed until it's finished either.
+handle : The sync that has occured
+channel: Channel that the sync occured in
+data : Additional data associated with the sync's occurance
+user : The 'user' parameter given when calling BASS_ChannelSetSync */
+
+typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, DWORD user);
+/* DSP callback function. NOTE: A DSP function should obviously be as quick as
+possible... other DSP functions, streams and MOD musics can not be processed
+until it's finished.
+handle : The DSP handle
+channel: Channel that the DSP is being applied to
+buffer : Buffer to apply the DSP to
+length : Number of bytes in the buffer
+user : The 'user' parameter given when calling BASS_ChannelSetDSP */
+
+typedef BOOL (CALLBACK RECORDPROC)(void *buffer, DWORD length, DWORD user);
+/* Recording callback function.
+buffer : Buffer containing the recorded sample data
+length : Number of bytes
+user : The 'user' parameter value given when calling BASS_RecordStart
+RETURN : TRUE = continue recording, FALSE = stop */
+
+// BASS_ChannelGetData flags
+#define BASS_DATA_FFT512 0x80000000 // 512 sample FFT
+#define BASS_DATA_FFT1024 0x80000001 // 1024 FFT
+#define BASS_DATA_FFT2048 0x80000002 // 2048 FFT
+
+// BASS_StreamGetTags flags : what's returned
+#define BASS_TAG_ID3 0 // ID3v1 tags : 128 byte block
+#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block
+#define BASS_TAG_OGG 2 // OGG comments : array of null-terminated strings
+#define BASS_TAG_HTTP 3 // HTTP headers : array of null-terminated strings
+#define BASS_TAG_ICY 4 // ICY headers : array of null-terminated strings
+#define BASS_TAG_META 5 // ICY metadata : null-terminated string
+
+// DX8 effect types, use with BASS_ChannelSetFX
+enum
+{
+ BASS_FX_CHORUS, // GUID_DSFX_STANDARD_CHORUS
+ BASS_FX_COMPRESSOR, // GUID_DSFX_STANDARD_COMPRESSOR
+ BASS_FX_DISTORTION, // GUID_DSFX_STANDARD_DISTORTION
+ BASS_FX_ECHO, // GUID_DSFX_STANDARD_ECHO
+ BASS_FX_FLANGER, // GUID_DSFX_STANDARD_FLANGER
+ BASS_FX_GARGLE, // GUID_DSFX_STANDARD_GARGLE
+ BASS_FX_I3DL2REVERB, // GUID_DSFX_STANDARD_I3DL2REVERB
+ BASS_FX_PARAMEQ, // GUID_DSFX_STANDARD_PARAMEQ
+ BASS_FX_REVERB // GUID_DSFX_WAVES_REVERB
+};
+
+typedef struct {
+ float fWetDryMix;
+ float fDepth;
+ float fFeedback;
+ float fFrequency;
+ DWORD lWaveform; // 0=triangle, 1=sine
+ float fDelay;
+ DWORD lPhase; // BASS_FX_PHASE_xxx
+} BASS_FXCHORUS; // DSFXChorus
+
+typedef struct {
+ float fGain;
+ float fAttack;
+ float fRelease;
+ float fThreshold;
+ float fRatio;
+ float fPredelay;
+} BASS_FXCOMPRESSOR; // DSFXCompressor
+
+typedef struct {
+ float fGain;
+ float fEdge;
+ float fPostEQCenterFrequency;
+ float fPostEQBandwidth;
+ float fPreLowpassCutoff;
+} BASS_FXDISTORTION; // DSFXDistortion
+
+typedef struct {
+ float fWetDryMix;
+ float fFeedback;
+ float fLeftDelay;
+ float fRightDelay;
+ BOOL lPanDelay;
+} BASS_FXECHO; // DSFXEcho
+
+typedef struct {
+ float fWetDryMix;
+ float fDepth;
+ float fFeedback;
+ float fFrequency;
+ DWORD lWaveform; // 0=triangle, 1=sine
+ float fDelay;
+ DWORD lPhase; // BASS_FX_PHASE_xxx
+} BASS_FXFLANGER; // DSFXFlanger
+
+typedef struct {
+ DWORD dwRateHz; // Rate of modulation in hz
+ DWORD dwWaveShape; // 0=triangle, 1=square
+} BASS_FXGARGLE; // DSFXGargle
+
+typedef struct {
+ int lRoom; // [-10000, 0] default: -1000 mB
+ int lRoomHF; // [-10000, 0] default: 0 mB
+ float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0
+ float flDecayTime; // [0.1, 20.0] default: 1.49s
+ float flDecayHFRatio; // [0.1, 2.0] default: 0.83
+ int lReflections; // [-10000, 1000] default: -2602 mB
+ float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s
+ int lReverb; // [-10000, 2000] default: 200 mB
+ float flReverbDelay; // [0.0, 0.1] default: 0.011 s
+ float flDiffusion; // [0.0, 100.0] default: 100.0 %
+ float flDensity; // [0.0, 100.0] default: 100.0 %
+ float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz
+} BASS_FXI3DL2REVERB; // DSFXI3DL2Reverb
+
+typedef struct {
+ float fCenter;
+ float fBandwidth;
+ float fGain;
+} BASS_FXPARAMEQ; // DSFXParamEq
+
+typedef struct {
+ float fInGain; // [-96.0,0.0] default: 0.0 dB
+ float fReverbMix; // [-96.0,0.0] default: 0.0 db
+ float fReverbTime; // [0.001,3000.0] default: 1000.0 ms
+ float fHighFreqRTRatio; // [0.001,0.999] default: 0.001
+} BASS_FXREVERB; // DSFXWavesReverb
+
+#define BASS_FX_PHASE_NEG_180 0
+#define BASS_FX_PHASE_NEG_90 1
+#define BASS_FX_PHASE_ZERO 2
+#define BASS_FX_PHASE_90 3
+#define BASS_FX_PHASE_180 4
+
+#define CDCHANNEL 0 // CD channel, for use with BASS_Channel functions
+#define RECORDCHAN 1 // Recording channel, for use with BASS_Channel functions
+
+// BASS_ChannelIsActive return values
+#define BASS_ACTIVE_STOPPED 0
+#define BASS_ACTIVE_PLAYING 1
+#define BASS_ACTIVE_STALLED 2
+#define BASS_ACTIVE_PAUSED 3
+
+// BASS_CDGetID flags
+#define BASS_CDID_IDENTITY 0
+#define BASS_CDID_UPC 1
+#define BASS_CDID_CDDB 2
+#define BASS_CDID_CDDB2 3
+
+// BASS_RecordSetInput flags
+#define BASS_INPUT_OFF 0x10000
+#define BASS_INPUT_ON 0x20000
+#define BASS_INPUT_LEVEL 0x40000
+
+
+DWORD BASSDEF(BASS_GetVersion)();
+/* Retrieve the version number of BASS that is loaded.
+RETURN : The BASS version (LOWORD.HIWORD) */
+
+char *BASSDEF(BASS_GetDeviceDescription)(DWORD devnum);
+/* Get the text description of a device. This function can be used to
+enumerate the available devices.
+devnum : The device (0=first)
+RETURN : The text description of the device (NULL=error) */
+
+float BASSDEF(BASS_SetBufferLength)(float length);
+/* Set the amount that BASS mixes ahead new musics/streams. Changing
+this setting does not affect musics/streams that have already been
+loaded/created. Increasing the buffer length, decreases the chance of
+the sound possibly breaking-up on slower computers, but increase DSP
+latency. The default length is 0.5 secs.
+length : The buffer length in seconds
+RETURN : The actual new buffer length */
+
+void BASSDEF(BASS_SetGlobalVolumes)(int musvol, int samvol, int strvol);
+/* Set the global music/sample/stream volume levels.
+musvol : MOD music global volume level (0-100, -1=leave current)
+samvol : Sample global volume level (0-100, -1=leave current)
+strvol : Stream global volume level (0-100, -1=leave current) */
+
+void BASSDEF(BASS_GetGlobalVolumes)(DWORD *musvol, DWORD *samvol, DWORD *strvol);
+/* Retrive the global music/sample/stream volume levels.
+musvol : MOD music global volume level (NULL=don't retrieve it)
+samvol : Sample global volume level (NULL=don't retrieve it)
+strvol : Stream global volume level (NULL=don't retrieve it) */
+
+void BASSDEF(BASS_SetLogCurves)(BOOL volume, BOOL pan);
+/* Make the volume/panning values translate to a logarithmic curve,
+or a linear "curve" (the default).
+volume : volume curve (FALSE=linear, TRUE=log)
+pan : panning curve (FALSE=linear, TRUE=log) */
+
+void BASSDEF(BASS_Set3DAlgorithm)(DWORD algo);
+/* Set the 3D algorithm for software mixed 3D channels (does not affect
+hardware mixed channels). Changing the mode only affects subsequently
+created or loaded samples/streams/musics, not those that already exist.
+Requires DirectX 7 or above.
+algo : algorithm flag (BASS_3DALG_xxx) */
+
+DWORD BASSDEF(BASS_ErrorGetCode)();
+/* Get the BASS_ERROR_xxx error code. Use this function to get the
+reason for an error. */
+
+void BASSDEF(BASS_SetCLSID)(GUID *clsid);
+/* Set the class identifier of the object to create, that will be used
+to initialize DirectSound.
+clsid : Class identifier of the object to create (NULL=use default) */
+
+BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win);
+/* Initialize the digital output. This must be called before all following
+BASS functions (except CD and recording functions).
+device : Device to use (0=first, -1=default, -2=no sound)
+freq : Output sample rate
+flags : BASS_DEVICE_xxx flags (optional HIWORD=update period)
+win : Owner window (0=current foreground window)
+
+NOTE: The "no sound" device (device=-2), allows loading and "playing"
+of MOD musics only (all sample/stream functions and most other functions
+fail). This is so that you can still use the MOD musics as synchronizers
+when there is no soundcard present. When using device -2, you should still
+set the other arguments as you would do normally. */
+
+void BASSDEF(BASS_Free)();
+/* Free all resources used by the digital output, including all musics
+and samples. */
+
+void *BASSDEF(BASS_GetDSoundObject)(DWORD object);
+/* Retrieve a pointer to a DirectSound interface. This can be used by
+advanced users to "plugin" external functionality.
+object : The interface to retrieve (BASS_OBJECT_xxx)
+RETURN : A pointer to the requested interface (NULL=error) */
+
+void BASSDEF(BASS_GetInfo)(BASS_INFO *info);
+/* Retrieve some information on the device being used.
+info : Pointer to store info at */
+
+BOOL BASSDEF(BASS_Update)();
+/* Update the HMUSIC/HSTREAM channel buffers. */
+
+float BASSDEF(BASS_GetCPU)();
+/* Get the current CPU usage of BASS. This includes the time taken to mix
+the MOD musics and sample streams, and also the time taken by any user
+DSP functions. It does not include plain sample mixing which is done by
+the output device (hardware accelerated) or DirectSound (emulated). Audio
+CD playback requires no CPU usage.
+RETURN : The CPU usage percentage (floating-point) */
+
+BOOL BASSDEF(BASS_Start)();
+/* Start the digital output. */
+
+BOOL BASSDEF(BASS_Stop)();
+/* Stop the digital output, stopping all musics/samples/streams. */
+
+BOOL BASSDEF(BASS_Pause)();
+/* Stop the digital output, pausing all musics/samples/streams. Use
+BASS_Start to resume the digital output. */
+
+BOOL BASSDEF(BASS_SetVolume)(DWORD volume);
+/* Set the digital output master volume.
+volume : Desired volume level (0-100) */
+
+int BASSDEF(BASS_GetVolume)();
+/* Get the digital output master volume.
+RETURN : The volume level (0-100, -1=error) */
+
+BOOL BASSDEF(BASS_Set3DFactors)(float distf, float rollf, float doppf);
+/* Set the factors that affect the calculations of 3D sound.
+distf : Distance factor (0.0-10.0, 1.0=use meters, 0.3=use feet, <0.0=leave current)
+ By default BASS measures distances in meters, you can change this
+ setting if you are using a different unit of measurement.
+roolf : Rolloff factor, how fast the sound quietens with distance
+ (0.0=no rolloff, 1.0=real world, 2.0=2x real... 10.0=max, <0.0=leave current)
+doppf : Doppler factor (0.0=no doppler, 1.0=real world, 2.0=2x real... 10.0=max, <0.0=leave current)
+ The doppler effect is the way a sound appears to change frequency when it is
+ moving towards or away from you. The listener and sound velocity settings are
+ used to calculate this effect, this "doppf" value can be used to lessen or
+ exaggerate the effect. */
+
+BOOL BASSDEF(BASS_Get3DFactors)(float *distf, float *rollf, float *doppf);
+/* Get the factors that affect the calculations of 3D sound.
+distf : Distance factor (NULL=don't get it)
+roolf : Rolloff factor (NULL=don't get it)
+doppf : Doppler factor (NULL=don't get it) */
+
+BOOL BASSDEF(BASS_Set3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top);
+/* Set the position/velocity/orientation of the listener (ie. the player/viewer).
+pos : Position of the listener (NULL=leave current)
+vel : Listener's velocity, used to calculate doppler effect (NULL=leave current)
+front : Direction that listener's front is pointing (NULL=leave current)
+top : Direction that listener's top is pointing (NULL=leave current)
+ NOTE: front & top must both be set in a single call */
+
+BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top);
+/* Get the position/velocity/orientation of the listener.
+pos : Position of the listener (NULL=don't get it)
+vel : Listener's velocity (NULL=don't get it)
+front : Direction that listener's front is pointing (NULL=don't get it)
+top : Direction that listener's top is pointing (NULL=don't get it)
+ NOTE: front & top must both be retrieved in a single call */
+
+BOOL BASSDEF(BASS_Apply3D)();
+/* Apply changes made to the 3D system. This must be called to apply any changes
+made with BASS_Set3DFactors, BASS_Set3DPosition, BASS_ChannelSet3DAttributes or
+BASS_ChannelSet3DPosition. It improves performance to have DirectSound do all the
+required recalculating at the same time like this, rather than recalculating after
+every little change is made. NOTE: This is automatically called when starting a 3D
+sample with BASS_SamplePlay3D/Ex. */
+
+BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, float damp);
+/* Set the type of EAX environment and it's parameters. Obviously, EAX functions
+have no effect if no EAX supporting device (ie. SB Live) is used.
+env : Reverb environment (EAX_ENVIRONMENT_xxx, -1=leave current)
+vol : Volume of the reverb (0.0=off, 1.0=max, <0.0=leave current)
+decay : Time in seconds it takes the reverb to diminish by 60dB (0.1-20.0, <0.0=leave current)
+damp : The damping, high or low frequencies decay faster (0.0=high decays quickest,
+ 1.0=low/high decay equally, 2.0=low decays quickest, <0.0=leave current) */
+
+BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, float *damp);
+/* Get the current EAX parameters.
+env : Reverb environment (NULL=don't get it)
+vol : Reverb volume (NULL=don't get it)
+decay : Decay duration (NULL=don't get it)
+damp : The damping (NULL=don't get it) */
+
+
+HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, void *file, DWORD offset, DWORD length, DWORD flags);
+/* Load a music (MO3/XM/MOD/S3M/IT/MTM). The amplification and pan
+seperation are initially set to 50, use BASS_MusicSetAmplify
+and BASS_MusicSetPanSep to adjust them.
+mem : TRUE = Load music from memory
+file : Filename (mem=FALSE) or memory location (mem=TRUE)
+offset : File offset to load the music from (only used if mem=FALSE)
+length : Data length (only used if mem=FALSE, 0=use to end of file)
+flags : BASS_MUSIC_xxx flags
+RETURN : The loaded music's handle (NULL=error) */
+
+void BASSDEF(BASS_MusicFree)(HMUSIC handle);
+/* Free a music's resources.
+handle : Music handle */
+
+char *BASSDEF(BASS_MusicGetName)(HMUSIC handle);
+/* Retrieves a music's name.
+handle : Music handle
+RETURN : The music's name (NULL=error) */
+
+DWORD BASSDEF(BASS_MusicGetLength)(HMUSIC handle, BOOL playlen);
+/* Retrieves the length of a music in patterns (how many "orders" there are)
+or in output bytes (requires BASS_MUSIC_CALCLEN was used with BASS_MusicLoad).
+handle : Music handle
+playlen: TRUE=get the playback length, FALSE=get the pattern length
+RETURN : The length of the music (-1=error) */
+
+BOOL BASSDEF(BASS_MusicPreBuf)(HMUSIC handle);
+/* Pre-buffer initial sample data ready for playback.
+handle : Handle of music */
+
+BOOL BASSDEF(BASS_MusicPlay)(HMUSIC handle);
+/* Play a music. Playback continues from where it was last stopped/paused.
+Multiple musics may be played simultaneously.
+handle : Handle of music to play */
+
+BOOL BASSDEF(BASS_MusicPlayEx)(HMUSIC handle, DWORD pos, int flags, BOOL reset);
+/* Play a music, specifying start position and playback flags.
+handle : Handle of music to play
+pos : Position to start playback from, LOWORD=order HIWORD=row
+flags : BASS_MUSIC_xxx flags. These flags overwrite the defaults
+ specified when the music was loaded. (-1=use current flags)
+reset : TRUE = Stop all current playing notes and reset bpm/etc... */
+
+BOOL BASSDEF(BASS_MusicSetAmplify)(HMUSIC handle, DWORD amp);
+/* Set a music's amplification level.
+handle : Music handle
+amp : Amplification level (0-100) */
+
+BOOL BASSDEF(BASS_MusicSetPanSep)(HMUSIC handle, DWORD pan);
+/* Set a music's pan seperation.
+handle : Music handle
+pan : Pan seperation (0-100, 50=linear) */
+
+BOOL BASSDEF(BASS_MusicSetPositionScaler)(HMUSIC handle, DWORD scale);
+/* Set a music's "GetPosition" scaler
+When you call BASS_ChannelGetPosition, the "row" (HIWORD) will be
+scaled by this value. By using a higher scaler, you can get a more
+precise position indication.
+handle : Music handle
+scale : The scaler (1-256) */
+
+BOOL BASSDEF(BASS_MusicSetChannelVol)(HMUSIC handle, DWORD channel, DWORD volume);
+/* Set the volume level of a channel in a music
+handle : Music handle
+channel: Channel number (0=first)
+volume : Volume level (0-100) */
+
+int BASSDEF(BASS_MusicGetChannelVol)(HMUSIC handle, DWORD channel);
+/* Get the volume level of a channel in a music
+handle : Music handle
+channel: Channel number (0=first)
+RETURN : The channel's volume (-1=error) */
+
+
+HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, void *file, DWORD offset, DWORD length, DWORD max, DWORD flags);
+/* Load a WAV/MP3/MP2/MP1 sample. If you're loading a sample with 3D
+functionality, then you should use BASS_GetInfo and BASS_SetInfo to set
+the default 3D parameters. You can also use these two functions to set
+the sample's default frequency/volume/pan/looping.
+mem : TRUE = Load sample from memory
+file : Filename (mem=FALSE) or memory location (mem=TRUE)
+offset : File offset to load the sample from (only used if mem=FALSE)
+length : Data length (only used if mem=FALSE, 0=use to end of file)
+max : Maximum number of simultaneous playbacks (1-65535)
+flags : BASS_SAMPLE_xxx flags (only the LOOP/3D/SOFTWARE/VAM/MUTEMAX/OVER_xxx flags are used)
+RETURN : The loaded sample's handle (NULL=error) */
+
+void* BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD max, DWORD flags);
+/* Create a sample. This function allows you to generate custom samples, or
+load samples that are not in the WAV format. A pointer is returned to the
+memory location at which you should write the sample's data. After writing
+the data, call BASS_SampleCreateDone to get the new sample's handle.
+length : The sample's length (in samples, NOT bytes)
+freq : default sample rate
+max : Maximum number of simultaneous playbacks (1-65535)
+flags : BASS_SAMPLE_xxx flags
+RETURN : Memory location to write the sample's data (NULL=error) */
+
+HSAMPLE BASSDEF(BASS_SampleCreateDone)();
+/* Finished creating a new sample.
+RETURN : The new sample's handle (NULL=error) */
+
+void BASSDEF(BASS_SampleFree)(HSAMPLE handle);
+/* Free a sample's resources.
+handle : Sample handle */
+
+BOOL BASSDEF(BASS_SampleGetInfo)(HSAMPLE handle, BASS_SAMPLE *info);
+/* Retrieve a sample's current default attributes.
+handle : Sample handle
+info : Pointer to store sample info */
+
+BOOL BASSDEF(BASS_SampleSetInfo)(HSAMPLE handle, BASS_SAMPLE *info);
+/* Set a sample's default attributes.
+handle : Sample handle
+info : Sample info, only the freq/volume/pan/3D attributes and
+ looping/override method flags are used */
+
+HCHANNEL BASSDEF(BASS_SamplePlay)(HSAMPLE handle);
+/* Play a sample, using the sample's default attributes.
+handle : Handle of sample to play
+RETURN : Handle of channel used to play the sample (NULL=error) */
+
+HCHANNEL BASSDEF(BASS_SamplePlayEx)(HSAMPLE handle, DWORD start, int freq, int volume, int pan, BOOL loop);
+/* Play a sample, using specified attributes.
+handle : Handle of sample to play
+start : Playback start position (in samples, not bytes)
+freq : Playback rate (-1=default)
+volume : Volume (-1=default, 0=silent, 100=max)
+pan : Pan position (-101=default, -100=left, 0=middle, 100=right)
+loop : TRUE = Loop sample (-1=default)
+RETURN : Handle of channel used to play the sample (NULL=error) */
+
+HCHANNEL BASSDEF(BASS_SamplePlay3D)(HSAMPLE handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
+/* Play a 3D sample, setting it's 3D position, orientation and velocity.
+handle : Handle of sample to play
+pos : position of the sound (NULL = x/y/z=0.0)
+orient : orientation of the sound, this is irrelevant if it's an
+ omnidirectional sound source (NULL = x/y/z=0.0)
+vel : velocity of the sound (NULL = x/y/z=0.0)
+RETURN : Handle of channel used to play the sample (NULL=error) */
+
+HCHANNEL BASSDEF(BASS_SamplePlay3DEx)(HSAMPLE handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel, DWORD start, int freq, int volume, BOOL loop);
+/* Play a 3D sample, using specified attributes.
+handle : Handle of sample to play
+pos : position of the sound (NULL = x/y/z=0.0)
+orient : orientation of the sound, this is irrelevant if it's an
+ omnidirectional sound source (NULL = x/y/z=0.0)
+vel : velocity of the sound (NULL = x/y/z=0.0)
+start : Playback start position (in samples, not bytes)
+freq : Playback rate (-1=default)
+volume : Volume (-1=default, 0=silent, 100=max)
+loop : TRUE = Loop sample (-1=default)
+RETURN : Handle of channel used to play the sample (NULL=error) */
+
+BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle);
+/* Stops all instances of a sample. For example, if a sample is playing
+simultaneously 3 times, calling this function will stop all 3 of them,
+which is obviously simpler than calling BASS_ChannelStop 3 times.
+handle : Handle of sample to stop */
+
+
+HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD flags, STREAMPROC *proc, DWORD user);
+/* Create a user sample stream.
+freq : Stream playback rate (100-100000)
+flags : BASS_SAMPLE_xxx flags (only the 8BITS/MONO/3D flags are used)
+proc : User defined stream writing function
+user : The 'user' value passed to the callback function
+RETURN : The created stream's handle (NULL=error) */
+
+HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, void *file, DWORD offset, DWORD length, DWORD flags);
+/* Create a sample stream from an MP3/MP2/MP1/OGG or WAV file.
+mem : TRUE = Stream file from memory
+file : Filename (mem=FALSE) or memory location (mem=TRUE)
+offset : File offset of the stream data
+length : File length (0=use whole file if mem=FALSE)
+flags : Flags
+RETURN : The created stream's handle (NULL=error) */
+
+HSTREAM BASSDEF(BASS_StreamCreateURL)(char *url, DWORD offset, DWORD flags, char *save);
+/* Create a sample stream from an MP3/MP2/MP1/OGG or WAV file on the internet,
+optionally saving a local copy to disk.
+url : The URL (beginning with "http://" or "ftp://")
+offset : File offset of start streaming from
+flags : Flags
+save : Filename to save the streamed file as locally (NULL=don't save)
+RETURN : The created stream's handle (NULL=error) */
+
+void BASSDEF(BASS_StreamFree)(HSTREAM handle);
+/* Free a sample stream's resources.
+handle : Stream handle */
+
+QWORD BASSDEF(BASS_StreamGetLength)(HSTREAM handle);
+/* Retrieves the playback length (in bytes) of a file stream. It's not always
+possible to 100% accurately guess the length of a stream, so the length returned
+may be only an approximation when using some WAV codecs.
+handle : Stream handle
+RETURN : The length (0=streaming in blocks, -1=error) */
+
+char *BASSDEF(BASS_StreamGetTags)(HSTREAM handle, DWORD tags);
+/* Retrieves the requested tags/headers, if available.
+handle : Stream handle
+tags : A BASS_TAG_xxx flag
+RETURN : Pointer to the tags (NULL=error) */
+
+BOOL BASSDEF(BASS_StreamPreBuf)(HSTREAM handle);
+/* Pre-buffer initial sample data ready for playback.
+handle : Handle of stream */
+
+BOOL BASSDEF(BASS_StreamPlay)(HSTREAM handle, BOOL flush, DWORD flags);
+/* Play a sample stream, optionally flushing the buffer first.
+handle : Handle of stream to play
+flush : Flush buffer contents. If you stop a stream and then want to
+ continue it from where it stopped, don't flush it. Flushing
+ a file stream causes it to restart from the beginning.
+flags : BASS_SAMPLE_LOOP flag (only affects file streams) */
+
+DWORD BASSDEF(BASS_StreamGetFilePosition)(HSTREAM handle, DWORD mode);
+/* Retrieves the file position of the decoding, the download (if streaming from
+the internet), or the end (total length). Obviously only works with file streams.
+handle : Stream handle
+mode : The position to retrieve (0=decoding, 1=download, 2=end)
+RETURN : The position (-1=error) */
+
+
+BOOL BASSDEF(BASS_CDInit)(char *drive, DWORD flags);
+/* Initialize the CD functions, must be called before any other CD
+functions. The volume is initially set to 100 (the maximum), use
+BASS_ChannelSetAttributes to adjust it.
+drive : The CD drive, for example: "d:" (NULL=use default drive)
+flags : BASS_DEVICE_LEAVEVOL=leave the volume as it is */
+
+void BASSDEF(BASS_CDFree)();
+/* Free resources used by the CD. */
+
+BOOL BASSDEF(BASS_CDInDrive)();
+/* Check if there is a CD in the drive. */
+
+BOOL WINAPI BASS_CDDoor(BOOL open);
+/* Opens or closes the CD door.
+open : TRUE=open the door */
+
+char *BASSDEF(BASS_CDGetID)(DWORD id);
+/* Retrieves identification info from the CD in the drive.
+id : One of the BASS_CDID_xxx flags
+RETURN : ID string (NULL=error) */
+
+DWORD BASSDEF(BASS_CDGetTracks)();
+/* Retrieves the number of tracks on the CD
+RETURN : The number of tracks (-1=error) */
+
+BOOL BASSDEF(BASS_CDPlay)(DWORD track, BOOL loop, BOOL wait);
+/* Play a CD track.
+track : Track number to play (1=first)
+loop : TRUE = Loop the track
+wait : TRUE = don't return until playback has started (some drives
+ will always wait anyway) */
+
+DWORD BASSDEF(BASS_CDGetTrackLength)(DWORD track);
+/* Retrieves the playback length (in milliseconds) of a cd track.
+track : The CD track (1=first)
+RETURN : The length (-1=error) */
+
+
+char *BASSDEF(BASS_RecordGetDeviceDescription)(DWORD devnum);
+/* Get the text description of a recording device. This function can be
+used to enumerate the available devices.
+devnum : The device (0=first)
+RETURN : The text description of the device (NULL=error) */
+
+BOOL BASSDEF(BASS_RecordInit)(int device);
+/* Initialize a recording device.
+device : Device to use (0=first, -1=default) */
+
+void BASSDEF(BASS_RecordFree)();
+/* Free all resources used by the recording device. */
+
+void BASSDEF(BASS_RecordGetInfo)(BASS_RECORDINFO *info);
+/* Retrieve some information on the recording device being used.
+info : Pointer to store info at */
+
+char *BASSDEF(BASS_RecordGetInputName)(DWORD input);
+/* Get the text description of a recording input.
+input : Input number (0=first)
+RETURN : The text description (NULL=error) */
+
+BOOL BASSDEF(BASS_RecordSetInput)(DWORD input, DWORD setting);
+/* Adjust the setting of a recording input.
+input : Input number (0=first)
+setting: BASS_INPUT flags (if BASS_INPUT_LEVEL used, LOWORD=volume) */
+
+DWORD BASSDEF(BASS_RecordGetInput)(DWORD input);
+/* Retrieve the setting of a recording input.
+input : Input number (0=first)
+RETURN : The setting (LOWORD=volume, with BASS_INPUT_OFF flag if off, -1=error) */
+
+BOOL BASSDEF(BASS_RecordStart)(DWORD freq, DWORD flags, RECORDPROC *proc, DWORD user);
+/* Start recording. Use BASS_ChannelStop to stop recording.
+freq : Sampling rate
+flags : BASS_SAMPLE_8BITS/MONO flags (optional HIWORD=update period)
+proc : User defined function to receive the recorded data
+user : The 'user' value passed to the callback function */
+
+
+/* A "channel" can be a playing sample (HCHANNEL), a MOD music (HMUSIC), a
+sample stream (HSTREAM), the CD (CDCHANNEL), or recording (RECORDCHAN). The
+following functions can be used with one or more of these channel types. */
+
+float BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos);
+/* Translate a byte position into time (seconds)
+handle : Handle of channel (HCHANNEL/HMUSIC/HSTREAM, or RECORDCHAN, also HSAMPLE)
+pos : The position to translate
+RETURN : The millisecond position (<0=error) */
+
+QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, float pos);
+/* Translate a time (seconds) position into bytes
+handle : Handle of channel (HCHANNEL/HMUSIC/HSTREAM, or RECORDCHAN, also HSAMPLE)
+pos : The position to translate
+RETURN : The byte position (-1=error) */
+
+DWORD BASSDEF(BASS_ChannelIsActive)(DWORD handle);
+/* Check if a channel is active (playing) or stalled.
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL/RECORDCHAN)
+RETURN : One of the BASS_ACTIVE_xxx values */
+
+DWORD BASSDEF(BASS_ChannelGetFlags)(DWORD handle);
+/* Get some info about a channel.
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM)
+RETURN : BASS_SAMPLE_xxx flags (-1=error) */
+
+BOOL BASSDEF(BASS_ChannelStop)(DWORD handle);
+/* Stop a channel.
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL/RECORDCHAN) */
+
+BOOL BASSDEF(BASS_ChannelPause)(DWORD handle);
+/* Pause a channel.
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL/RECORDCHAN) */
+
+BOOL BASSDEF(BASS_ChannelResume)(DWORD handle);
+/* Resume a paused channel.
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL/RECORDCHAN) */
+
+BOOL BASSDEF(BASS_ChannelSetAttributes)(DWORD handle, int freq, int volume, int pan);
+/* Update a channel's attributes. The actual setting may not be exactly
+as specified, depending on the accuracy of the device and drivers.
+NOTE: Only the volume can be adjusted for the CD "channel", but not all
+soundcards allow controlling of the CD volume level.
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
+freq : Playback rate (100-100000, 0=original, -1=leave current)
+volume : Volume (-1=leave current, 0=silent, 100=max)
+pan : Pan position (-101=current, -100=left, 0=middle, 100=right)
+ panning has no effect on 3D channels */
+
+BOOL BASSDEF(BASS_ChannelGetAttributes)(DWORD handle, DWORD *freq, DWORD *volume, int *pan);
+/* Retrieve a channel's attributes. Only the volume is available for
+the CD "channel" (if allowed by the soundcard/drivers).
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
+freq : Pointer to store playback rate (NULL=don't retrieve it)
+volume : Pointer to store volume (NULL=don't retrieve it)
+pan : Pointer to store pan position (NULL=don't retrieve it) */
+
+BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, int outvol);
+/* Set a channel's 3D attributes.
+handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
+mode : BASS_3DMODE_xxx mode (-1=leave current setting)
+min : minimum distance, volume stops increasing within this distance (<0.0=leave current)
+max : maximum distance, volume stops decreasing past this distance (<0.0=leave current)
+iangle : angle of inside projection cone in degrees (360=omnidirectional, -1=leave current)
+oangle : angle of outside projection cone in degrees (-1=leave current)
+ NOTE: iangle & oangle must both be set in a single call
+outvol : delta-volume outside the projection cone (0=silent, 100=same as inside)
+The iangle/oangle angles decide how wide the sound is projected around the
+orientation angle. Within the inside angle the volume level is the channel
+level as set with BASS_ChannelSetAttributes, from the inside to the outside
+angles the volume gradually changes by the "outvol" setting. */
+
+BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, DWORD *outvol);
+/* Retrieve a channel's 3D attributes.
+handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
+mode : BASS_3DMODE_xxx mode (NULL=don't retrieve it)
+min : minumum distance (NULL=don't retrieve it)
+max : maximum distance (NULL=don't retrieve it)
+iangle : angle of inside projection cone (NULL=don't retrieve it)
+oangle : angle of outside projection cone (NULL=don't retrieve it)
+ NOTE: iangle & oangle must both be retrieved in a single call
+outvol : delta-volume outside the projection cone (NULL=don't retrieve it) */
+
+BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
+/* Update a channel's 3D position, orientation and velocity. The velocity
+is only used to calculate the doppler effect.
+handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
+pos : position of the sound (NULL=leave current)
+orient : orientation of the sound, this is irrelevant if it's an
+ omnidirectional sound source (NULL=leave current)
+vel : velocity of the sound (NULL=leave current) */
+
+BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
+/* Retrieve a channel's current 3D position, orientation and velocity.
+handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
+pos : position of the sound (NULL=don't retrieve it)
+orient : orientation of the sound, this is irrelevant if it's an
+ omnidirectional sound source (NULL=don't retrieve it)
+vel : velocity of the sound (NULL=don't retrieve it) */
+
+BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos);
+/* Set the current playback position of a channel.
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
+pos : the position
+ if HCHANNEL: position in bytes
+ if HMUSIC: LOWORD=order HIWORD=row ... use MAKELONG(order,row)
+ if HSTREAM: position in bytes, file streams only
+ if CDCHANNEL: position in milliseconds from start of track */
+
+QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle);
+/* Get the current playback position of a channel.
+handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
+RETURN : the position (-1=error)
+ if HCHANNEL: position in bytes
+ if HMUSIC: LOWORD=order HIWORD=row (see BASS_MusicSetPositionScaler)
+ if HSTREAM: total bytes played since the stream was last flushed
+ if CDCHANNEL: position in milliseconds from start of track */
+
+DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle);
+/* Calculate a channel's current output level.
+handle : Channel handle (HMUSIC/HSTREAM, or RECORDCHAN)
+RETURN : LOWORD=left level (0-128) HIWORD=right level (0-128) (-1=error) */
+
+DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length);
+/* Retrieves upto "length" bytes of the channel's current sample data. This is
+useful if you wish to "visualize" the sound.
+handle : Channel handle (HMUSIC/HSTREAM, or RECORDCHAN)
+buffer : Location to write the data
+length : Number of bytes of wanted, or a BASS_DATA_xxx flag
+RETURN : Number of bytes actually written to the buffer (-1=error) */
+
+HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, DWORD user);
+/* Setup a sync on a channel. Multiple syncs may be used per channel.
+handle : Channel handle
+type : Sync type (BASS_SYNC_xxx type & flags)
+param : Sync parameters (see the BASS_SYNC_xxx type description)
+proc : User defined callback function (window message if using BASS_SYNC_MESSAGE flag)
+user : The 'user' value passed to the callback function
+RETURN : Sync handle (NULL=error) */
+
+BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync);
+/* Remove a sync from a channel
+handle : Channel handle
+sync : Handle of sync to remove */
+
+HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, DWORD user);
+/* Setup a user DSP function on a channel. When multiple DSP functions
+are used on a channel, they are called in the order that they were added.
+handle : Channel handle (HMUSIC/HSTREAM)
+proc : User defined callback function
+user : The 'user' value passed to the callback function
+RETURN : DSP handle (NULL=error) */
+
+BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp);
+/* Remove a DSP function from a channel
+handle : Channel handle (HMUSIC/HSTREAM)
+dsp : Handle of DSP to remove */
+
+HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD type);
+/* Setup a DX8 effect on a channel. Can only be used when the channel
+is not playing. Use BASS_FXSetParameters to set the effect parameters.
+Obviously requires DX8.
+handle : Channel handle (HMUSIC/HSTREAM)
+type : Type of effect to setup (BASS_FX_xxx)
+RETURN : FX handle (NULL=error) */
+
+BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx);
+/* Remove a DX8 effect from a channel. Can only be used when the
+channel is not playing.
+handle : Channel handle (HMUSIC/HSTREAM)
+fx : Handle of FX to remove */
+
+BOOL BASSDEF(BASS_ChannelSetEAXMix)(DWORD handle, float mix);
+/* Set the wet(reverb)/dry(no reverb) mix ratio on the channel. By default
+the distance of the sound from the listener is used to calculate the mix.
+NOTE: The channel must have 3D functionality enabled for the EAX environment
+to have any affect on it.
+handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
+mix : The ratio (0.0=reverb off, 1.0=max reverb, -1.0=let EAX calculate
+ the reverb mix based on the distance) */
+
+BOOL BASSDEF(BASS_ChannelGetEAXMix)(DWORD handle, float *mix);
+/* Get the wet(reverb)/dry(no reverb) mix ratio on the channel.
+handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
+mix : Pointer to store the ratio at */
+
+BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan);
+/* Set a link between 2 channels. When the 1st is played/stopped/paused/resumed
+the 2nd channel is also played/stopped/paused/resumed.
+handle : Handle of channel to link "chan" to (HMUSIC/HSTREAM)
+chan : Handle of channel to link to "handle" (HMUSIC/HSTREAM) */
+
+BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan);
+/* Remove a link from a channel.
+handle : Handle of channel to unlink with "chan" (HMUSIC/HSTREAM)
+chan : Handle of channel to unlink from "handle" (HMUSIC/HSTREAM) */
+
+
+BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, void *par);
+/* Set the parameters of a DX8 effect.
+handle : FX handle
+par : Pointer to the parameter structure */
+
+BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *par);
+/* Retrieve the parameters of a DX8 effect.
+handle : FX handle
+par : Pointer to the parameter structure */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/bmp.h b/include/bmp.h
new file mode 100644
index 0000000..e0dd47d
--- /dev/null
+++ b/include/bmp.h
@@ -0,0 +1,11 @@
+#ifndef __bmp_h__
+#define __bmp_h__
+
+#include
+#include
+#include "texture.h"
+
+//AUX_RGBImageRec *LoadBMP(const char *Filename);
+TextureImage* LoadBMP(const char* Filename);
+
+#endif
diff --git a/include/camera.h b/include/camera.h
new file mode 100644
index 0000000..e4bbed7
--- /dev/null
+++ b/include/camera.h
@@ -0,0 +1,88 @@
+#ifndef __camera_h__
+#define __camera_h__
+
+#include
+#include
+#include "vector.h"
+#include "myGl.h"
+#include "screen.h"
+
+
+
+class CameraClass
+{
+public:
+ //Constructors
+ CameraClass(); //Default Constructor
+ //Purpose:
+ //
+
+ //CameraClass(const CameraClass&); //Copy Constructor
+ //Purpose:
+ //
+
+ //Observer Accessors
+ Vec3f Position();
+ //Purpose:
+ //
+
+ Vec3f View();
+ //Purpose:
+ //
+
+ Vec3f UpVector();
+ //Purpose:
+ //
+
+ Vec3f Strafe();
+ //Purpose:
+ //
+
+ //Mutators
+ void PositionCamera(double xpos, double ypos, double zpos,
+ double xview, double yview, double zview,
+ double xup, double yup, double zup);
+ //Purpose:
+ //
+
+ void PositionCamera(Vec3f pos, Vec3f view, Vec3f up);
+ //Purpose:
+ //
+
+ void RotateView(double angle, double X, double Y, double Z);
+ //Purpose:
+ //
+
+ void SetViewByMouse(SCREEN g_Screen);
+ //Purpose:
+ //
+
+ void RotateAroundPoint(Vec3f vCenter, double X, double Y, double Z);
+ //Purpose:
+ //
+
+ void StrafeCamera(double speed);
+ //Purpose:
+ //
+
+ void MoveCamera(double speed);
+ //Purpose:
+ //
+
+ void Update();
+ //Purpose:
+ //
+
+ void Look();
+ //Purpose:
+ //
+
+
+private:
+ Vec3f m_vPosition;
+ Vec3f m_vView;
+ Vec3f m_vUpVector;
+ Vec3f m_vStrafe;
+};
+
+#endif
\ No newline at end of file
diff --git a/include/critter.h b/include/critter.h
new file mode 100644
index 0000000..655209a
--- /dev/null
+++ b/include/critter.h
@@ -0,0 +1,14 @@
+#ifndef __critter_h__
+#define __critter_h__
+
+#include "md3.h"
+
+
+class CRITTER
+{
+public:
+ MD3_MODEL model;
+};
+
+
+#endif
\ No newline at end of file
diff --git a/include/ctrls.h b/include/ctrls.h
new file mode 100644
index 0000000..150d596
--- /dev/null
+++ b/include/ctrls.h
@@ -0,0 +1,33 @@
+#include "physics.h"
+#include "datatypes.h"
+#include "list.h"
+#include
+
+class ControlSchemeClass
+{
+public:
+ void LoadDefaultControlScheme();
+ void ClearControlScheme();
+
+ list forward;
+ list backward;
+ list lookLeft;
+ list lookRight;
+ list lookUp;
+ list lookDown;
+ list moveLeft;
+ list moveRight;
+ list moveUp;
+ list moveDown;
+ list firePrimary;
+ list fireSecondary;
+ list weaponNext;
+ list weaponPrev;
+ list toggleLights;
+ list toggleFPS;
+ list toggleConsole;
+ list toggleMouseLook;
+ list quickMouseLook;
+ list rollLeft;
+ list rollRight;
+};
\ No newline at end of file
diff --git a/include/datatypes.h b/include/datatypes.h
new file mode 100644
index 0000000..ecaca29
--- /dev/null
+++ b/include/datatypes.h
@@ -0,0 +1,28 @@
+#ifndef __datatypes_h__
+#define __datatypes_h__
+
+typedef unsigned __int8 uint8;
+typedef unsigned __int16 uint16;
+typedef unsigned __int32 uint32;
+typedef unsigned __int64 uint64;
+typedef __int8 int8;
+typedef __int16 int16;
+typedef __int32 int32;
+typedef __int64 int64;
+typedef signed __int8 sint8;
+typedef signed __int16 sint16;
+typedef signed __int32 sint32;
+typedef signed __int64 sint64;
+
+/*
+typedef unsigned __int8 byte;
+typedef unsigned __int16 word;
+typedef unsigned __int32 dword;
+typedef unsigned __int64 qword;
+
+typedef byte db;
+typedef word dw;
+typedef dword dd;
+typedef qword dq;
+*/
+#endif
\ No newline at end of file
diff --git a/include/entities.h b/include/entities.h
new file mode 100644
index 0000000..c727dce
--- /dev/null
+++ b/include/entities.h
@@ -0,0 +1,58 @@
+using namespace std;
+
+struct LIGHT
+{
+ GLfloat coords[4];
+ GLfloat color[4];
+};
+
+struct PLAYER_START
+{
+ Vec3f coords;
+ Vec3f heading;
+};
+struct PLAYER_DEATHMATCH_START
+{
+ Vec3f coords;
+ Vec3f heading;
+};
+struct BOT_START
+{
+ Vec3f coords;
+ Vec3f heading;
+ string name;
+};
+struct GEOMETRY
+{
+ int x;
+};
+struct PROJECTILE
+{
+ Vec3f heading;
+ Vec3f start;
+ Vec3f end;
+ int dammage;
+ float creation;
+
+};
+//const PROJECTILE BULLET = {{0,0,0},{0,0,0},{0,0,0},5};
+//const PROJECTILE SPIKE = {{0,0,0},{0,0,0},{0,0,0},10};
+
+struct ENTITY
+{
+ PLAYER_START* Player_Start;
+ int numPlayer_Start;
+ PLAYER_DEATHMATCH_START* Player_Deathmatch_Start;
+ int numPlayer_Deathmatch_Start;
+ BOT_START* Bot_Start;
+ int numBot_Start;
+ GEOMETRY* Geometry;
+ int numGeometry;
+ PROJECTILE* Projectile;
+ int numProjectile;
+
+ ENTITY();
+
+};
+
+enum ITEM_TYPE{/*all weapons go first*/WEAPON_LASERPISTOL = 1, WEAPON_SHOTGUN = 2, ITEM_BANDAGES = 4, RUNE_DAMMAGEMULTIPLIER = 8, RUNE_PROTECTION = 16, RUNE_VAMPIRE = 32, RUNE_SPEED = 64, RUNE_DOC = 128};//This semicolon got rid of 107 errors and no warnings
diff --git a/include/entity.h b/include/entity.h
new file mode 100644
index 0000000..bb381a4
--- /dev/null
+++ b/include/entity.h
@@ -0,0 +1,30 @@
+#ifndef __entity_h__
+#define __entity_h__
+
+#include "datatypes.h"
+
+enum { //Begin entity declaration
+ ENTITY_NONE=0, //Nonexistant entity this should never be used.
+ ENTITY_PLAYER_MULTI_START //Player start position for multiplayer.
+}; //End entity declaration
+
+class ENTITY
+{
+public:
+ ENTITY()
+ {
+ type = ENTITY_NONE;
+ vPosition = Vec3f(0,0,0);
+ vHeading = Vec3f(0,0,0);
+ vUp = Vec3f(0,0,0);
+ health = 0;
+ }
+
+ uint32 type;
+ Vec3f vPosition;
+ Vec3f vHeading;
+ Vec3f vUp;
+ uint16 health;
+};
+
+#endif
\ No newline at end of file
diff --git a/include/geometry.h b/include/geometry.h
new file mode 100644
index 0000000..0648cbd
--- /dev/null
+++ b/include/geometry.h
@@ -0,0 +1,35 @@
+#include "vector.h"
+#include "myglTexture.h"
+
+struct TRIANGLE
+{
+ GL_MY_TEXTURE texture;
+ uint32 texID;
+ Vec3f vertecies[3];
+ Vec2f texCoords[3];
+ Vec3f normal;
+};
+
+class POSITION
+{
+public:
+ GLfloat xrot; // X rotation
+ GLfloat yrot; // Y rotation
+ GLfloat zrot; // Z rotation
+ GLfloat xtrans; // X translation
+ GLfloat ytrans; // Y translation
+ GLfloat ztrans; // Z translation
+ bool stepRight;
+ bool stepLeft;
+ POSITION()
+ {
+ xtrans = 0.0f;
+ ytrans = 0.0f;
+ ztrans = 0.0f;
+ xrot = 0.0f;
+ yrot = 0.0f;
+ zrot = 0.0f;
+ }
+private:
+
+};
diff --git a/include/level.h b/include/level.h
new file mode 100644
index 0000000..75ff76a
--- /dev/null
+++ b/include/level.h
@@ -0,0 +1,99 @@
+#ifndef __LEVEL_H__
+#define __LEVEL_H__
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include //for auxDIBImageLoad
+#include //for file I/O
+
+#include "mydefs.h"
+#include "bmp.h"
+#include "tga.h"
+#include "list.h"
+#include "bass.h"
+#include "vector.h"
+#include "camera.h"
+#include "entities.h"
+#include "geometry.h"
+#include "myglFont.h"
+#include "myglTexture.h"
+#include "player.h"
+#include "strmanip.h"
+
+using namespace std;
+
+const float piover180 = 0.0174532925f;
+const string DEFAULT_TEXTURE_NAME = "oa/textures/default.tga";
+const unsigned int MAX_CONSOLE_LINES = 30; //The max number of lines to be displayed in the console
+const unsigned int MAX_CONSOLE_HISTORY_LINES = MAX_CONSOLE_LINES + 20; //The max number of console lines to store in the history
+
+enum {GL_MY_TEXTURE_CONSOLEBACKGROUND=0, NUM_MENU_TEXTURES};
+
+class LEVEL
+{
+public:
+ LEVEL();
+ ~LEVEL();
+ bool LoadMap(string mapname);
+ void LoadMap();
+ void SaveMap(string mapname);
+ bool LoadConfig(string cfgname);
+ void LoadConfig();
+ void SaveConfig(string cfgname);
+ void Execute(string cmd);
+ void LoadGLTextures();
+ void Render();
+ void UnloadMap();
+ uint32 FPS();
+ void ParseCmds(LPSTR);
+
+ void Print(int x, int y, const char* string, unsigned int set);
+
+ /*Not Yet Implemented
+ void PlayerConnect(); // implement later
+ void PlayerDisconnect(); // implement later
+ */
+ SCREEN screen;
+ GLFontClass glFont;
+ string nextLevel;
+ PLAYER* defaultPlayer;
+ uint32 numTextures;
+ string* textureNames;
+
+ string bgm;
+ HSTREAM bgmStream;
+ unsigned char bgmCDA;
+ string gamedir;
+ float gravity;
+ bool mlook;
+ bool showFPS;
+ bool showConsole;
+ bool sound;
+ float turnSpeed;
+ float moveSpeed;
+ float mouseSpeed;
+ unsigned char maxFPS;
+ //Map
+ TRIANGLE* triangles;
+ uint32 numTriangles;
+ list players;
+ list ents;
+ //list textures;
+ GL_MY_TEXTURE* textures;
+ GL_MY_TEXTURE menuTextures[NUM_MENU_TEXTURES];
+
+
+
+private:
+ string consoleHistory[MAX_CONSOLE_HISTORY_LINES];
+
+
+
+};
+#endif
\ No newline at end of file
diff --git a/include/list.cpp b/include/list.cpp
new file mode 100644
index 0000000..7a6d787
--- /dev/null
+++ b/include/list.cpp
@@ -0,0 +1,246 @@
+/*
+template
+listNode::listNode()
+{
+ next = NULL;
+}
+
+template
+list::list()
+{
+ head = NULL;
+ tail = NULL;
+ currPos = NULL;
+}
+
+template
+list::~list()
+{
+ currPos = NULL;
+ while(head != NULL)
+ {
+ tail = head;
+ head = head->next;
+ delete tail;
+ tail = NULL;
+ }
+}
+
+template
+list::list(const list& rtOp)
+{
+ head = NULL;
+ tail = NULL
+ currPos = NULL;
+
+ operator=(rtOp);
+}
+
+template
+void list::Clear()
+{
+ while(head)
+ Remove(head->data);
+}
+
+template
+void list::operator=(const list& rtOp)
+{
+ Clear();
+
+ listNode temp = rtOp.head->next;
+ listNode temp2 = NULL;
+
+ if(temp != NULL)
+ {
+ head = new listNode;
+ head->data = rtOp.head->data;
+ tail = head;
+ temp2 = head;
+ }
+
+ while (temp != NULL)
+ {
+ temp2->next = new listNode;
+ temp2 = temp2->next;
+ temp2->data = temp->data;
+ temp = temp->next;
+ }
+
+ tail = temp2;
+}
+
+template
+bool list::IsEmpty()
+{
+ return head == NULL;
+}
+
+template
+bool list::IsFull()
+{
+ return false;
+}
+
+template
+void list::Insert(ItemType newItem)
+{
+ listNode* temp = head;
+ if(head != NULL)
+ {
+
+ while(temp->next!= NULL && temp->data < newItem)
+ {
+ temp = temp->next;
+ }
+
+ if(temp == head)
+ {
+ tail->next = head;
+ head = new listNode;
+ head->next = tail->next;
+ tail->next = NULL;
+ temp = head;
+ }
+ else if(temp->data != newItem)
+ {
+ if(temp == tail)
+ {
+ tail->next = new listNode;
+ tail = tail->next;
+ temp = tail;
+ }
+ else
+ {
+ tail->next = temp->next;
+ temp = temp->next = new listNode;
+ temp->next = tail->next;
+ tail->next = NULL;
+ }
+ }
+ }
+ else
+ {
+ temp = tail = head = new listNode;
+ tail->next = NULL;
+ }
+
+ temp->data = newItem;
+}
+
+template
+void list::Remove(ItemType target)
+{
+ if(head != NULL)
+ {
+ listNode* temp = head;
+ tail->next = head;
+
+ while(temp->next != NULL && temp->data != target)
+ {
+ tail->next = temp;
+ temp = temp->next;
+ }
+
+ if(temp->data == target)
+ {
+ if(tail->next != head)
+ {
+ tail->next->next = temp->next;
+ delete temp;
+ }
+ else
+ {
+ head = head->next;
+ delete tail->next;
+ }
+ }
+ tail->next = NULL;
+ }
+}
+
+template
+bool list::PrevPosition()
+{
+ if(currPos != head)
+ {
+ tail->next = currPos;
+ currPos = head;
+
+ if(currPos != tail->next)
+ {
+ while(currPos->next != tail->next)
+ {
+ currPos = currPos->next;
+ }
+ }
+
+ tail->next = NULL;
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+template
+bool list::NextPosition()
+{
+ if(currPos != tail)
+ {
+ currPos = currPos->next;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+template
+void list::Remove()
+{
+ if(currPos != NULL)
+ {
+ tail->next = currPos;
+ currPos = currPos->next;
+ delete tail->next;
+ tail->next = NULL;
+ }
+
+}
+
+template
+ItemType list::Retrieve()
+{
+ if(currPos != NULL)
+ return currPos->data;
+}
+
+template
+bool list::IsFirstPosition()
+{
+ return currPos == head;
+}
+
+template
+bool list::IsLastPosition()
+{
+ return currPos == tail;
+}
+
+template
+void list::FirstPosition()
+{
+ currPos = head;
+}
+
+template
+void list::LastPosition()
+{
+ currPos = tail;
+}
+
+*/
\ No newline at end of file
diff --git a/include/list.h b/include/list.h
new file mode 100644
index 0000000..f85053c
--- /dev/null
+++ b/include/list.h
@@ -0,0 +1,312 @@
+#ifndef __list_h__
+#define __list_h__
+
+#include
+
+#pragma warning(disable:4715)
+
+template
+class listNode
+{
+public:
+ listNode();
+ listNode* next;
+ ItemType data;
+};
+
+template
+class list
+{
+public:
+ list();
+ ~list();
+ list(const list&);
+
+ bool IsEmpty();
+ bool IsFull();
+ void Insert(ItemType newItem);
+ void Remove(ItemType target);
+ void Remove();
+ ItemType Retrieve();
+ bool PrevPosition();
+ bool NextPosition();
+ bool IsFirstPosition();
+ bool IsLastPosition();
+ void FirstPosition();
+ void LastPosition();
+ void Clear();
+ void operator=(const list&);
+ ItemType operator[](unsigned int);
+
+private:
+ listNode* head;
+ listNode* tail;
+ listNode* currPos;
+};
+
+template
+listNode::listNode()
+{
+ next = NULL;
+}
+
+template
+list::list()
+{
+ head = NULL;
+ tail = NULL;
+ currPos = NULL;
+}
+
+template
+list::~list()
+{
+ currPos = NULL;
+ while(head != NULL)
+ {
+ tail = head;
+ head = head->next;
+ delete tail;
+ tail = NULL;
+ }
+}
+
+template
+list::list(const list& rtOp)
+{
+ head = NULL;
+ tail = NULL
+ currPos = NULL;
+
+ operator=(rtOp);
+}
+
+template
+void list::Clear()
+{
+ while(head)
+ Remove(head->data);
+}
+
+template
+void list::operator=(const list& rtOp)
+{
+ Clear();
+
+ listNode temp = rtOp.head->next;
+ listNode temp2 = NULL;
+
+ if(temp != NULL)
+ {
+ head = new listNode;
+ head->data = rtOp.head->data;
+ tail = head;
+ temp2 = head;
+ }
+
+ while (temp != NULL)
+ {
+ temp2->next = new listNode;
+ temp2 = temp2->next;
+ temp2->data = temp->data;
+ temp = temp->next;
+ }
+
+ tail = temp2;
+}
+
+template
+bool list::IsEmpty()
+{
+ return head == NULL;
+}
+
+template
+bool list::IsFull()
+{
+ return false;
+}
+
+template
+void list::Insert(ItemType newItem)
+{
+ listNode* temp = head;
+ if(head != NULL)
+ {
+
+ while(temp->next!= NULL && temp->data < newItem)
+ {
+ temp = temp->next;
+ }
+
+ if(temp == head)
+ {
+ tail->next = head;
+ head = new listNode;
+ head->next = tail->next;
+ tail->next = NULL;
+ temp = head;
+ }
+ else if(temp->data != newItem)
+ {
+ if(temp == tail)
+ {
+ tail->next = new listNode;
+ tail = tail->next;
+ temp = tail;
+ }
+ else
+ {
+ tail->next = temp->next;
+ temp = temp->next = new listNode;
+ temp->next = tail->next;
+ tail->next = NULL;
+ }
+ }
+ }
+ else
+ {
+ temp = tail = head = new listNode;
+ tail->next = NULL;
+ }
+
+ temp->data = newItem;
+}
+
+template
+void list::Remove(ItemType target)
+{
+ if(head != NULL)
+ {
+ listNode* temp = head;
+ tail->next = head;
+
+ while(temp->next != NULL && temp->data != target)
+ {
+ tail->next = temp;
+ temp = temp->next;
+ }
+
+ if(temp->data == target)
+ {
+ if(tail->next != head)
+ {
+ tail->next->next = temp->next;
+ delete temp;
+ }
+ else
+ {
+ head = head->next;
+ delete tail->next;
+ }
+ }
+ tail->next = NULL;
+ }
+}
+
+template
+bool list::PrevPosition()
+{
+ if(currPos != head)
+ {
+ tail->next = currPos;
+ currPos = head;
+
+ if(currPos != tail->next)
+ {
+ while(currPos->next != tail->next)
+ {
+ currPos = currPos->next;
+ }
+ }
+
+ tail->next = NULL;
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+template
+bool list::NextPosition()
+{
+ if(currPos != tail)
+ {
+ currPos = currPos->next;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+template
+void list::Remove()
+{
+ if(currPos != NULL)
+ {
+ tail->next = currPos;
+ currPos = currPos->next;
+ delete tail->next;
+ tail->next = NULL;
+ }
+
+}
+
+template
+ItemType list::Retrieve()
+{
+ if(currPos != NULL)
+ return currPos->data;
+}
+
+template
+bool list::IsFirstPosition()
+{
+ return currPos == head;
+}
+
+template
+bool list::IsLastPosition()
+{
+ return currPos == tail;
+}
+
+template
+void list::FirstPosition()
+{
+ currPos = head;
+}
+
+template
+void list::LastPosition()
+{
+ currPos = tail;
+}
+
+template
+ItemType list::operator[](unsigned int index)
+{
+ if(head != NULL)
+ {
+ listNode* temp = head;
+ while(index > 0 && temp != NULL)
+ {
+ temp = temp->next;
+ --index;
+ }
+ if(temp != NULL)
+ {
+ return temp->data;
+ }
+ }
+}
+
+
+#include "list.cpp"
+
+#endif
\ No newline at end of file
diff --git a/include/main.h b/include/main.h
new file mode 100644
index 0000000..6ecb16a
--- /dev/null
+++ b/include/main.h
@@ -0,0 +1,43 @@
+#ifndef __main_h__
+#define __main_h__
+
+#include // Header file for windows
+#include // Header file for standard input/output
+#include // Header file for OpenGL32 library
+#include // Header file for Glu32 library
+#include // Header file for GLaux library
+#include
+
+#include "camera.h"
+#include "level.h"
+#include "myGL.h"
+#include "WorldDefs.h"
+#include "mydefs.h"
+
+#pragma warning(disable: 4786)
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Variables
+
+static bool keys[256]; // Array for which keys are down now
+static bool keys2[256]; // Array for which keys are were down already
+static bool active=true; // Is window active flag
+static bool fullscreen=true; // Is window fullscreen flag
+static bool showConsole = false;// Do we need to draw the console
+
+
+//static SCREEN g_Screen = {800,600,16,1,"OpenArena"};
+static POINT mpos;
+static float lastTime = 0.0f; // This will hold the time from the last frame
+static float currentTime;
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function Declarations
+LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration for WndProc
+
+void InitControls(); // Sets up player controls
+int InitGL(); // All setup for OpenGL goes here
+GLvoid ReSizeGLScene(GLsizei width, GLsizei height); // Resize and initialize the GL window
+GLvoid KillGLWindow(GLvoid); //Properly kill the window
+bool CreateGLWindow(string title, int width, int height, int bits, bool fullscreenflag);
+
+#endif
diff --git a/include/mydefs.h b/include/mydefs.h
new file mode 100644
index 0000000..3915b1d
--- /dev/null
+++ b/include/mydefs.h
@@ -0,0 +1,8 @@
+#ifndef __mydefs_h__
+#define __mydefs_h__
+
+#include
+
+static HWND g_hWnd = NULL;
+
+#endif
diff --git a/include/mygl.h b/include/mygl.h
new file mode 100644
index 0000000..06364ec
--- /dev/null
+++ b/include/mygl.h
@@ -0,0 +1,25 @@
+#ifndef __MYGL_H__
+#define __MYGL_H__
+
+#include
+#include
+#include
+#include
+#include
+#include "screen.h"
+#include "tga.h"
+#include "bmp.h"
+#include "strmanip.h"
+
+using namespace std;
+
+static HDC hDC=NULL; // Private GDI device context
+static HGLRC hRC=NULL; // Permanent rendering context
+static HINSTANCE hInstance; // Application instance
+static SCREEN g_Screen;
+int InitGL(GLvoid);
+
+bool LoadGLTexture(string , unsigned int&, int = GL_LINEAR, int = GL_LINEAR);
+void FreeGLTexture(unsigned int&);
+#endif
+
diff --git a/include/myglFont.h b/include/myglFont.h
new file mode 100644
index 0000000..59ffc18
--- /dev/null
+++ b/include/myglFont.h
@@ -0,0 +1,29 @@
+#ifndef __glPrint_h__
+#define __glPrint_h__
+
+#include "myGL.h"
+
+class GLFontClass
+{
+private:
+ short screenWidth;
+ short screenHeight;
+ unsigned int base;
+ unsigned int texture;
+ bool status;
+
+public:
+ GLFontClass();
+ ~GLFontClass();
+ bool BuildFont(const char*);
+ bool FreeFont();
+ void Print(int, int, const char*, unsigned int = 0);
+ bool Status();
+ void SetScreenDimensions(short, short);
+ void SetScreenWidth(short);
+ void SetScreenHeight(short);
+ short ScreenWidth();
+ short ScreenHeight();
+};
+
+#endif
\ No newline at end of file
diff --git a/include/myglTexture.h b/include/myglTexture.h
new file mode 100644
index 0000000..61fc34e
--- /dev/null
+++ b/include/myglTexture.h
@@ -0,0 +1,35 @@
+#ifndef __myglTexture_h__
+#define __myglTexture_h__
+
+#include
+#include "datatypes.h"
+#include "myGL.h"
+
+using namespace std;
+
+class GL_MY_TEXTURE
+{
+public:
+ GL_MY_TEXTURE();
+ ~GL_MY_TEXTURE();
+ string Filename();
+ uint32 ID();
+ bool Load(string filename);
+ bool Load(string filename, uint32 min, uint32 mag);
+ void Free();
+ bool Loaded();
+ bool operator<(const GL_MY_TEXTURE&);
+ bool operator<=(const GL_MY_TEXTURE&);
+ bool operator==(const GL_MY_TEXTURE&);
+ bool operator!=(const GL_MY_TEXTURE&);
+ bool operator>=(const GL_MY_TEXTURE&);
+ bool operator>(const GL_MY_TEXTURE&);
+
+private:
+ uint32 minFilter;
+ uint32 magFilter;
+ string filename;
+ uint32 id;
+};
+
+#endif
\ No newline at end of file
diff --git a/include/opengl.h b/include/opengl.h
new file mode 100644
index 0000000..1dbb83e
--- /dev/null
+++ b/include/opengl.h
@@ -0,0 +1,9 @@
+#ifndef __opengl_h__
+#define __opengl_h__
+
+#include
+#include
+#include
+#include
+
+#endif
\ No newline at end of file
diff --git a/include/physics.h b/include/physics.h
new file mode 100644
index 0000000..8a0cd65
--- /dev/null
+++ b/include/physics.h
@@ -0,0 +1,5 @@
+class WORLD_PHYSICS
+{
+public:
+ WORLD_PHYSICS();
+};
\ No newline at end of file
diff --git a/include/player.h b/include/player.h
new file mode 100644
index 0000000..391b777
--- /dev/null
+++ b/include/player.h
@@ -0,0 +1,27 @@
+#ifndef __PLAYER_H__
+#define __PLAYER_H__
+
+#include "camera.h"
+#include "ctrls.h"
+
+class PLAYER
+{
+public:
+ void Load();
+ void Save();
+ void CreateCharacter();
+ //void FirePrimary(ENTITY& ent);
+ //void FireSecondary();
+ void AddItem(unsigned int item);
+ void RemoveItem(unsigned int item);
+
+ ControlSchemeClass controls;
+ CameraClass camera;
+
+
+private:
+
+};
+
+
+#endif
\ No newline at end of file
diff --git a/include/screen.h b/include/screen.h
new file mode 100644
index 0000000..df7c1b8
--- /dev/null
+++ b/include/screen.h
@@ -0,0 +1,28 @@
+#ifndef __screen_h__
+#define __screen_h__
+#include
+
+using namespace std;
+
+class SCREEN
+{
+public:
+ SCREEN()
+ {
+ width=640;
+ height=480;
+ bpp=16;
+ fullscreen=false;
+ name = "";
+ }
+
+ short width;
+ short height;
+ char bpp;
+ bool fullscreen;
+ string name;
+
+
+};
+
+#endif
\ No newline at end of file
diff --git a/include/strmanip.h b/include/strmanip.h
new file mode 100644
index 0000000..fa27ebc
--- /dev/null
+++ b/include/strmanip.h
@@ -0,0 +1,23 @@
+#ifndef __strmanip_h__
+#define __strmanip_h__
+
+#include
+#include
+#include
+#include "datatypes.h"
+
+using namespace std;
+
+bool Truth(string str);
+int Integer(string str);
+float Floating(string str);
+uint8 KeyName(string str);
+string KeyString(uint8);
+string Right(string, uint32);
+string Left(string, uint32);
+string tolower(string);
+string toupper(string);
+string word(string, uint32);
+
+#endif
+
\ No newline at end of file
diff --git a/include/texture.h b/include/texture.h
new file mode 100644
index 0000000..67fc27a
--- /dev/null
+++ b/include/texture.h
@@ -0,0 +1,13 @@
+#ifndef __texture_h__
+#define __texture_h__
+
+struct TextureImage
+{
+ unsigned char* data;
+ unsigned int bpp;
+ unsigned int sizeX;
+ unsigned int sizeY;
+ unsigned int type;
+};
+
+#endif
\ No newline at end of file
diff --git a/include/tga.h b/include/tga.h
new file mode 100644
index 0000000..976ecb0
--- /dev/null
+++ b/include/tga.h
@@ -0,0 +1,35 @@
+#ifndef __TGA_H__
+#define __TGA_H__
+
+#pragma comment(lib, "OpenGL32.lib")
+#include
+#include
+#include
+#include
+#include "texture.h"
+
+struct TGAHeader
+{
+ GLubyte Header[12]; // File Header To Determine File Type
+};
+
+struct TGA
+{
+ GLubyte header[6]; // Holds The First 6 Useful Bytes Of The File
+ GLuint bytesPerPixel; // Number Of BYTES Per Pixel (3 Or 4)
+ GLuint imageSize; // Amount Of Memory Needed To Hold The Image
+ GLuint type; // The Type Of Image, GL_RGB Or GL_RGBA
+ GLuint Height; // Height Of Image
+ GLuint Width; // Width Of Image
+ GLuint Bpp; // Number Of BITS Per Pixel (24 Or 32)
+};
+
+TextureImage* LoadTGA(const char *filename);
+
+const GLubyte uTGAcompare[12] = {0,0,2, 0,0,0,0,0,0,0,0,0}; // Uncompressed TGA Header
+const GLubyte cTGAcompare[12] = {0,0,10,0,0,0,0,0,0,0,0,0}; // Compressed TGA Header
+TextureImage* LoadUncompressedTGA(FILE *); // Load an Uncompressed file
+TextureImage* LoadCompressedTGA(FILE *); // Load a Compressed file
+
+
+#endif
\ No newline at end of file
diff --git a/include/vector.h b/include/vector.h
new file mode 100644
index 0000000..cf61974
--- /dev/null
+++ b/include/vector.h
@@ -0,0 +1,57 @@
+#ifndef __vector_h__
+#define __vector_h__
+
+#include
+
+class Vec3d
+{
+public:
+ double x,y,z;
+ Vec3d(); //Default Constructor
+ Vec3d(const Vec3d&); //Copy Constructor
+ Vec3d(double, double); //From an angle
+ Vec3d(double, double, double); //From values
+ double lengthsquared() const;
+ double length() const;
+ void normalize();
+ Vec3d normalized() const;
+
+ Vec3d cross(const Vec3d&) const;
+ void operator=(const Vec3d&);
+ Vec3d operator*(const Vec3d&) const;
+ Vec3d operator+(const Vec3d&) const;
+ Vec3d operator-(const Vec3d&) const;
+ Vec3d operator*(double) const;
+ Vec3d operator/(double) const;
+
+};
+
+Vec3d Vector(double, double);
+//Vec3d Angle2Vec3f()
+class Vec2f
+{
+public:
+ float x,y;
+ Vec2f(); //Default Constructor
+ Vec2f(const Vec2f&); //Copy Constructor
+ Vec2f(double); // from an angle
+ Vec2f(double, double); //from values
+
+ double lengthsquared() const;
+ double length() const;
+ void normalize();
+ Vec2f normalized() const;
+
+ Vec2f cross(const Vec2f&) const;
+ Vec2f operator=(const Vec2f&);
+ Vec2f operator*(const Vec2f&) const;
+ Vec2f operator+(const Vec2f&) const;
+ Vec2f operator-(const Vec2f&) const;
+ //Vec2f operator/(const Vec2f&) const; //Is this right?
+ Vec2f operator*(double) const;
+ Vec2f operator/(double) const;
+};
+
+typedef Vec3d Vec3f;
+
+#endif
\ No newline at end of file
diff --git a/include/worlddefs.h b/include/worlddefs.h
new file mode 100644
index 0000000..cf37d96
--- /dev/null
+++ b/include/worlddefs.h
@@ -0,0 +1,8 @@
+#ifndef __WorldDefs_h__
+#define __WorldDefs_h__
+
+#include "level.h"
+
+static LEVEL level;
+
+#endif
diff --git a/lib/bass.lib b/lib/bass.lib
new file mode 100644
index 0000000..c52241c
Binary files /dev/null and b/lib/bass.lib differ
diff --git a/license.txt b/license.txt
new file mode 100644
index 0000000..b23de1a
--- /dev/null
+++ b/license.txt
@@ -0,0 +1,2 @@
+ This program can be distributed under the GNU GPL with the following exception. I want to make this multiplayer compatible later on. So any modifications that have anything to do with encryption or netcode don't have to be opensource as long as a copy of the source is sent to me to peruse and possibly add to the program (with applicable credit given). Other than that OA will be open source hence the name. Alternatively you can redistribute OA under the QTPL.
+ If you would like to modify the source code all I want you to do is make the new source available includeing giving me a copy either by e-mail headhunter45@hotmail.com but I have the inbox protector on so make sure the subject line has something identifiable in it preferably even just OpenArena as a subject this is only necessary the first time or two you e-mail me so I can add you to my address book. Also I have created a msn community you can post a link to the source in there and I'll download it myself (http://groups.msn.com/CodersCorner).
diff --git a/oa.ncb b/oa.ncb
new file mode 100644
index 0000000..db65296
Binary files /dev/null and b/oa.ncb differ
diff --git a/oa.nsi b/oa.nsi
new file mode 100644
index 0000000..cbf181b
--- /dev/null
+++ b/oa.nsi
@@ -0,0 +1,159 @@
+; example2.nsi
+;
+; This script is based on example1.nsi, but it remember the directory,
+; has uninstall support and (optionally) installs start menu shortcuts.
+;
+; It will install makensisw.exe into a directory that the user selects,
+
+;--------------------------------
+
+; The name of the installer
+Name "OpenArena"
+
+; The installer icon
+Icon "${NSISDIR}\contrib\Icons\setup.ico"
+
+; The file to write
+OutFile "OpenArena-0.1.0-alpha.exe"
+
+; The default installation directory
+InstallDir "$PROGRAMFILES\HHPS\OpenArena-0.1.0-alpha"
+
+; Registry key to check for directory (so if you install again, it will
+; overwrite the old one automatically)
+InstallDirRegKey HKLM SOFTWARE\HHPS\OpenArena-0.1.0-alpha "Install_Dir"
+
+; The text to prompt the user to enter a directory
+ComponentText "This will install OpenArena on your computer. Select which options you want installed."
+
+; The text to prompt the user to enter a directory
+DirText "Choose a directory to install in to:"
+
+;--------------------------------
+
+; The stuff to install
+Section "Base (required)"
+
+ SectionIn RO
+
+ ; Set output path to the installation directory.
+ SetOutPath $INSTDIR
+
+ ; Put file there
+ File ".\bass.dll"
+ File ".\license.txt"
+ File ".\OpenArena User's Manual.doc"
+ File ".\OpenArena User's Manual.html"
+ SetOutPath $INSTDIR\OpenArena
+ File ".\bass.dll"
+
+ ; Write the installation path into the registry
+ WriteRegStr HKLM SOFTWARE\HHPS\OpenArena-0.1.0-alpha "Install_Dir" "$INSTDIR"
+
+ ; Write the uninstall keys for Windows
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenArena v0.1.0-alpha" "DisplayName" "OpenArena v0.1.0-alpha (remove only)"
+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenArena v0.1.0-alpha" "UninstallString" '"$INSTDIR\uninstall.exe"'
+ WriteUninstaller "uninstall.exe"
+ CreateDirectory "$SMPROGRAMS\HHPS\OpenArena"
+ SetOutPath $INSTDIR\OpenArena
+ CreateShortCut "$SMPROGRAMS\HHPS\OpenArena\Readme v0.1.0-alpha.lnk" "$INSTDIR\OpenArena User's Manual.html"
+
+
+SectionEnd
+
+; optional section (can be disabled by the user)
+Section "SDK"
+
+ SetOutPath $INSTDIR
+ File ".\oa.sln"
+ File ".\oa.vcproj"
+ File ".\oa.ncb"
+ File ".\oa.suo"
+ File ".\heading.txt"
+ SetOutPath $INSTDIR\include
+ File ".\include\*.h"
+ SetOutPath $INSTDIR\lib
+ File ".\lib\*.lib"
+ SetOutPath $INSTDIR\src
+ File ".\src\*.cpp"
+ SetOutPath $INSTDIR\OpenArena\oa\config
+ File ".\OpenArena\oa\config\my.cfg"
+ CreateDirectory $INSTDIR\OpenArena\oa\maps
+ CreateDirectory $INSTDIR\OpenArena\oa\music\bgm
+ CreateDirectory $INSTDIR\OpenArena\oa\textures\menu
+ SetOutPath $INSTDIR\OpenArena
+
+ CreateShortCut "$SMPROGRAMS\HHPS\OpenArena\OpenArena SDK v0.1.0-alpha.lnk" "$INSTDIR\oa.sln"
+
+SectionEnd
+
+Section "Media"
+
+ SetOutPath $INSTDIR\OpenArena
+ File ".\OpenArena\oa.exe"
+ SetOutPath $INSTDIR\OpenArena\oa\config
+ File ".\OpenArena\oa\config\my.cfg"
+ SetOutPath $INSTDIR\OpenArena\oa\maps
+ File ".\OpenArena\oa\maps\intro.map"
+ File ".\OpenArena\oa\maps\oamap1.map"
+ SetOutPath $INSTDIR\OpenArena\oa\music\bgm
+ File ".\OpenArena\oa\music\bgm\*.mp3"
+ SetOutPath $INSTDIR\OpenArena\oa\textures
+ File ".\OpenArena\oa\textures\*.tga"
+ File ".\OpenArena\oa\textures\*.bmp"
+ SetOutPath $INSTDIR\OpenArena\oa\textures\menu
+ File ".\OpenArena\oa\textures\menu\*.bmp"
+ File ".\OpenArena\oa\textures\menu\*.tga"
+
+ SetOutPath $INSTDIR\OpenArena
+ CreateShortCut "$SMPROGRAMS\HHPS\OpenArena\OpenArena v0.1.0-alpha.lnk" "$INSTDIR\OpenArena\oa.exe"
+
+
+
+SectionEnd
+
+;--------------------------------
+
+; Uninstaller
+
+UninstallText "This will uninstall example2. Hit next to continue."
+
+; Uninstall section
+
+Section "Uninstall"
+
+ ; remove registry keys
+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenArena v0.1.0-alpha"
+ DeleteRegKey HKLM SOFTWARE\HHPS\OpenArena-0.1.0-alpha
+
+ ; remove files and uninstaller
+ Delete /REBOOTOK $INSTDIR\OpenArena\*.*
+ Delete /REBOOTOK $INSTDIR\include\*.*
+ Delete /REBOOTOK $INSTDIR\lib\*.*
+ Delete /REBOOTOK $INSTDIR\src\*.*
+ Delete /REBOOTOK $INSTDIR\bass.dll
+ Delete /REBOOTOK $INSTDIR\heading.txt
+ Delete /REBOOTOK $INSTDIR\license.txt
+ Delete /REBOOTOK $INSTDIR\oa.ncb
+ Delete /REBOOTOK $INSTDIR\oa.sln
+ Delete /REBOOTOK $INSTDIR\oa.sou
+ Delete /REBOOTOK $INSTDIR\oa.vcproj
+ Delete /REBOOTOK "$INSTDIR\OpenArena User's Manual.doc"
+ Delete /REBOOTOK "$INSTDIR\OpenArena User's Manual.html"
+ Delete /REBOOTOK $INSTDIR\uninstall.exe
+
+ ; remove shortcuts, if any
+ Delete /REBOOTOK "$SMPROGRAMS\HHPS\OpenArena\Readme v0.1.0-alpha.lnk"
+ Delete /REBOOTOK "$SMPROGRAMS\HHPS\OpenArena\OpenArena SDK v0.1.0-alpha.lnk"
+ Delete /REBOOTOK "$SMPROGRAMS\HHPS\OpenArena\OpenArena v0.1.0-alpha.lnk"
+
+ ; remove directories used
+ RMDIR /r $INSTDIR\include
+ RMDIR /r $INSTDIR\lib
+ RMDIR /r $INSTDIR\OpenArena
+ RMDIR /r $INSTDIR\src
+ RMDIR /r "$INSTDIR"
+
+
+
+SectionEnd
\ No newline at end of file
diff --git a/oa.sln b/oa.sln
new file mode 100644
index 0000000..8354398
--- /dev/null
+++ b/oa.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oa", "oa.vcproj", "{6F5D0FF6-A032-4356-932E-865B601E0DD4}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {6F5D0FF6-A032-4356-932E-865B601E0DD4}.Debug.ActiveCfg = Debug|Win32
+ {6F5D0FF6-A032-4356-932E-865B601E0DD4}.Debug.Build.0 = Debug|Win32
+ {6F5D0FF6-A032-4356-932E-865B601E0DD4}.Release.ActiveCfg = Release|Win32
+ {6F5D0FF6-A032-4356-932E-865B601E0DD4}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/oa.suo b/oa.suo
new file mode 100644
index 0000000..3225099
Binary files /dev/null and b/oa.suo differ
diff --git a/oa.vcproj b/oa.vcproj
new file mode 100644
index 0000000..25e64a6
--- /dev/null
+++ b/oa.vcproj
@@ -0,0 +1,325 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/bmp.cpp b/src/bmp.cpp
new file mode 100644
index 0000000..56b7a23
--- /dev/null
+++ b/src/bmp.cpp
@@ -0,0 +1,63 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Module: bmp.cpp
+// Author: Tom Hicks
+// Creation: 09-01-2003
+// LastEdit: 10-09-2003
+// Editors: Tom Hicks
+//
+// Purpose:
+// To implement a wrapper function that will load a 24bit windows bitmap
+// file and return a pointer to a TextureImage object containing the image.
+//
+// Summary of Methods:
+// Global
+// -LoadBMP
+// Loads a 24 bit windows bitmap file specified by fn and returns a
+// pointer to a TextureImage object containing the bitmap image.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "../include/bmp.h"
+
+TextureImage* LoadBMP(const char* fn)
+{
+ //If anything is not perfect return NULL after cleaning up our mess
+
+ FILE* f=NULL; //A pointer to our file structure
+
+ //If our filename is null
+ if(!fn)
+ return NULL;
+
+
+ //Try to open our file and if successfull...
+ f=fopen(fn, "r");
+ if(f)
+ {
+ //close the file
+ fclose(f);
+
+ //Load our bitmap structure from the file.
+ AUX_RGBImageRec* bmp = auxDIBImageLoad(fn);
+
+ //If the load was successfull.
+ if(bmp)
+ {
+ //Allocate memory for a TextureImage Structure.
+ TextureImage* tex = new TextureImage;
+
+ //Convert the bitmap to a TextureImage.
+ tex->data = bmp->data;
+ tex->sizeX = bmp->sizeX;
+ tex->sizeY = bmp->sizeY;
+ tex->type = GL_RGB;
+ tex->bpp = 3;
+
+ //Free the bitmap but not it's data and return our TextureImage.
+ free(bmp);
+ return tex;
+ }
+ }
+ return NULL;
+}
diff --git a/src/camera.cpp b/src/camera.cpp
new file mode 100644
index 0000000..d26589f
--- /dev/null
+++ b/src/camera.cpp
@@ -0,0 +1,190 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Module: camera.cpp
+// Author: Tom Hicks
+// Creation: 09-01-2003
+// LastEdit: 10-09-2003
+// Editors: Tom Hicks
+//
+// Purpose:
+// To implement an OpenGL Camera
+//
+// Summary of Methods:
+// CameraClass
+// -CameraClass();
+// Initalize PDM's. Sets position to 0,0,0 up to 0,1,0 and view to 0,0,-1
+// -Vec3f Position();
+// Returns a copy of the position vector.
+// -Vec3f View();
+// Returns a copy of the view vector.
+// -Vec3f UpVector();
+// Returns a copy of the up vector.
+// -Vec3f Strafe();
+// Returns a copy of the strafe vector.
+// -void PositionCamera(double xpos, double ypos, double zpos,
+// double xview, double yview, double zview,
+// double xup, double yup, double zup);
+// Sets the position, up, and view vectors to those created from the respective input values.
+// -void PositionCamera(Vec3f pos, Vec3f view, Vec3f up);
+// Sets the position, up, and view vectors to those passed in.
+// -void RotateView(double angle, double X, double Y, double Z);
+// Rotates the view angle degrees on the axis specified by X, Y, and Z.
+// -void SetViewByMouse(SCREEN g_Screen);
+// Rotates the pitch and yaw of the view based on the mouse.
+// -void RotateAroundPoint(double angle, double X, double Y, double Z, Vec3f vCenter);
+// Rotates the view angle degrees around a point vCenter on the axis specified by X, Y, Z.
+// -void StrafeCamera(double speed);
+// Moves the camera along an axis perpendicular to the plane specified by the up and view vectors a distance specified by speed.
+// -void MoveCamera(double speed);
+// Moves the camera along the axis specified by it's view vector a distance equal to speed.
+// -void Update();
+// Update the internal strafe vector.
+// -void Look();
+// Positions the current viewport at point of the camera and facing the same direction.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "../include/camera.h"
+
+CameraClass::CameraClass()
+{
+ m_vPosition = Vec3f(0,0,0);
+ m_vView = Vec3f(0,0,-1);
+ m_vUpVector = Vec3f(0,1,0);
+}
+
+void CameraClass::PositionCamera(double xpos, double ypos, double zpos,
+ double xview, double yview, double zview,
+ double xup, double yup, double zup)
+{
+ m_vPosition = Vec3f(xpos, ypos, zpos);
+ m_vView = Vec3f(xview, yview, zview);
+ m_vUpVector = Vec3f(xup, yup, zup);
+}
+
+void CameraClass::PositionCamera(Vec3f pos, Vec3f view, Vec3f up)
+{
+ m_vPosition = pos;
+ m_vView = view;
+ m_vUpVector = up;
+}
+
+void CameraClass::SetViewByMouse(SCREEN g_Screen)
+{
+ static double currentRotX = 0.0f;
+ POINT mpos;
+ POINT middle;
+
+ double angleZ;
+
+ middle.x = g_Screen.width / 2;
+ middle.y = g_Screen.height / 2;
+
+ GetCursorPos(&mpos);
+ SetCursorPos(middle.x, middle.y);
+
+ if(mpos.x != middle.x || mpos.y != middle.y)
+ {
+ angleZ = double(middle.y - mpos.y) / 1000.0f;
+ currentRotX -= angleZ;
+
+ if(currentRotX > 1.0f)
+ currentRotX = 1.0f;
+ else if(currentRotX < -1.0f)
+ currentRotX = -1.0f;
+ else
+ {
+ Vec3f axis = (m_vView - m_vPosition).cross(m_vUpVector);
+ axis.normalize();
+
+ RotateView(angleZ, axis.x, axis.y, axis.z);
+
+ //need to switch these two when I figure out stuff for flight
+ //till then I think the first is faster
+
+ RotateView(double(middle.x - mpos.x) / 1000.0f, 0, 1, 0);
+ //RotateView(double(middle.x - mpos.x) / 1000.0f, m_vUpVector.x, m_vUpVector.y, m_vUpVector.z);
+ }
+ }
+}
+
+void CameraClass::MoveCamera(double speed)
+{
+ Vec3f heading = (m_vView - m_vPosition).normalized();
+
+ m_vPosition.x += heading.x * speed;
+ m_vPosition.z += heading.z * speed;
+ m_vView.x += heading.x * speed;
+ m_vView.z += heading.z * speed;
+}
+
+void CameraClass::RotateView(double angle, double x, double y, double z)
+{
+ Vec3f nView;
+ Vec3f cView;
+
+ cView = m_vView - m_vPosition;
+
+ double cosTheta = cos(angle);
+ double sinTheta = sin(angle);
+
+ nView.x = (cosTheta + (1 - cosTheta) * x * x) * cView.x +
+ ((1 - cosTheta) * x * y - z * sinTheta) * cView.y +
+ ((1 - cosTheta) * x * z + y * sinTheta) * cView.z;
+
+ nView.y = (cosTheta + (1 - cosTheta) * y * y) * cView.y +
+ ((1- cosTheta) * x * y + z * sinTheta) * cView.x +
+ ((1 - cosTheta) * y * z - x * sinTheta) * cView.z;
+
+ nView.z = (cosTheta + (1 - cosTheta) * z * z) * cView.z+
+ ((1 - cosTheta) * x * z - y * sinTheta) * cView.x +
+ ((1 - cosTheta) * y * z + x * sinTheta) * cView.y;
+
+ m_vView.x = m_vPosition.x + nView.x;
+ m_vView.y = m_vPosition.y + nView.y;
+ m_vView.z = m_vPosition.z + nView.z;
+}
+
+void CameraClass::StrafeCamera(double speed)
+{
+ m_vPosition.x += m_vStrafe.x * speed;
+ m_vPosition.z += m_vStrafe.z * speed;
+ m_vView.x += m_vStrafe.x * speed;
+ m_vView.z += m_vStrafe.z * speed;
+}
+
+
+
+void CameraClass::Update()
+{
+ m_vStrafe =((m_vView - m_vPosition).cross(m_vUpVector)).normalized();
+ //SetViewByMouse(); //TODO take this whole function out asap
+
+}
+
+void CameraClass::Look()
+{
+ gluLookAt(m_vPosition.x, m_vPosition.y, m_vPosition.z,
+ m_vView.x, m_vView.y, m_vView.z,
+ m_vUpVector.x, m_vUpVector.y, m_vUpVector.z);
+}
+
+Vec3f CameraClass::Position()
+{
+ return m_vPosition;
+}
+
+Vec3f CameraClass::Strafe()
+{
+ return m_vStrafe;
+}
+
+Vec3f CameraClass::UpVector()
+{
+ return m_vUpVector;
+}
+
+Vec3f CameraClass::View()
+{
+ return m_vView;
+}
\ No newline at end of file
diff --git a/src/ctrls.cpp b/src/ctrls.cpp
new file mode 100644
index 0000000..8ef2f9d
--- /dev/null
+++ b/src/ctrls.cpp
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Module: ctrls.cpp
+// Author: Tom Hicks
+// Creation: 09-01-2003
+// LastEdit: 10-09-2003
+// Editors: Tom Hicks
+//
+// Purpose:
+// To implement a system for managing a bindable control scheme.
+//
+// Summary of Methods:
+// ControlSchemeClass
+// void LoadDefaultControlScheme();
+// void ClearControlScheme();
+//
+// Summary of Properties:
+// ControlSchemeClass
+// -list forward;
+// A list of the VKeys associated with forward.
+// -list backward;
+// A list of the VKeys associated with backward.
+// -list lookLeft;
+// A list of the VKeys associated with turning left.
+// -list lookRight;
+// A list of the VKeys associated with turning right.
+// -list lookUp;
+// A list of the VKeys associated with looking up.
+// -list lookDown;
+// A list of the VKeys associated with looking down.
+// -list moveLeft;
+// A list of the VKeys associated with strafing left.
+// -list moveRight;
+// A list of the VKeys associated with strafing right.
+// -list moveUp;
+// A list of the VKeys associated with jumping.
+// -list moveDown;
+// A list of the VKeys associated with crouching.
+// -list firePrimary;
+// A list of the VKeys associated with activating the primary ability of the active item.
+// -list fireSecondary;
+// A list of the VKeys associated with activating the secondary ablilty of the active item.
+// -list weaponNext;
+// A list of the VKeys associated with switching to the next item.
+// -list weaponPrev;
+// A list of the VKeys associated with switching to the previous item.
+// -list toggleLights;
+// A list of the VKeys associated with turning lighting on and off.
+// -list toggleFPS;
+// A list of the VKeys associated with turning the FPS display on and off.
+// -list toggleConsole;
+// A list of the VKeys associated with toggling the display of the console.
+// -list toggleMouseLook;
+// A list of the VKeys associated with toggling mouse look.
+// -list quickMouseLook;
+// A list of the VKeys associated with temporarily switching the mouse look mode.
+// -list rollLeft;
+// A list of the VKeys associated with rolling left.
+// -list rollRight;
+// A list of the VKeys associated with rolling right.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "../include/ctrls.h"
+
+void ControlSchemeClass::LoadDefaultControlScheme()
+{
+ forward.Insert(VK_LBUTTON);
+ backward.Insert(VK_RBUTTON);
+ lookLeft.Insert(VK_LEFT);
+ lookRight.Insert(VK_RIGHT);
+ lookUp.Insert(VK_UP);
+ lookDown.Insert(VK_DOWN);
+ moveLeft.Insert('S');
+ moveRight.Insert('D');
+ moveUp.Insert(VK_SPACE);
+ moveDown.Insert('A');
+ firePrimary.Insert('F');
+ fireSecondary.Insert('G');
+ weaponNext.Insert('T');
+ weaponPrev.Insert('R');
+ toggleLights.Insert('L');
+ toggleFPS.Insert('P');
+ toggleConsole.Insert('~');
+ toggleMouseLook.Insert('M');
+ quickMouseLook.Insert('Q');
+ rollLeft.Insert('W');
+ rollRight.Insert('E');
+}
+void ControlSchemeClass::ClearControlScheme()
+{
+ backward.Clear();
+ firePrimary.Clear();
+ fireSecondary.Clear();
+ forward.Clear();
+ lookDown.Clear();
+ lookUp.Clear();
+ lookRight.Clear();
+ lookLeft.Clear();
+ moveDown.Clear();
+ moveUp.Clear();
+ moveLeft.Clear();
+ moveRight.Clear();
+ quickMouseLook.Clear();
+ toggleConsole.Clear();
+ toggleFPS.Clear();
+ toggleLights.Clear();
+ toggleMouseLook.Clear();
+ weaponNext.Clear();
+ weaponPrev.Clear();
+}
+
diff --git a/src/level.cpp b/src/level.cpp
new file mode 100644
index 0000000..52411ef
--- /dev/null
+++ b/src/level.cpp
@@ -0,0 +1,951 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Module: level.cpp
+// Author: Tom Hicks
+// Creation: 09-01-2003
+// LastEdit: 10-09-2003
+// Editors: Tom Hicks
+//
+// Purpose:
+// To implement the world or at least a reasonable copy.
+//
+// Summary of Methods:
+// Global
+// -function name
+// description
+// blahClass
+// -function name
+// description
+//
+// Summary of Properties:
+// blahClass
+// -property name
+// description
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "../include/level.h"
+
+#pragma comment(lib, "bass.lib")
+
+using namespace std;
+
+LEVEL::LEVEL()
+{
+
+ consoleHistory[0] = "hello0";
+ consoleHistory[1] = "hello1";
+ consoleHistory[MAX_CONSOLE_HISTORY_LINES-2] = "hello3";
+ consoleHistory[MAX_CONSOLE_HISTORY_LINES-1] = "hello4";
+
+ textureNames = NULL;
+ numTextures = 0;
+
+ screen.name = "OpenArena";
+
+ showFPS = false;
+ showConsole = false;
+
+ nextLevel = "intro.map";
+ gamedir = "oa/";
+ sound = true;
+
+ defaultPlayer = new PLAYER;
+
+ numTriangles = 0;
+ triangles = NULL;
+ /*
+ for(int x=0; x<4; x++)
+ LightAmbient[x] = 5;
+ */
+ //Player Stuff
+ mouseSpeed = 5;
+ turnSpeed = 1.0f;
+ moveSpeed = .2f;
+ mlook = true;
+}
+
+LEVEL::~LEVEL()
+{
+ if(defaultPlayer)
+ {
+ try
+ {
+ delete defaultPlayer;
+ }
+ catch(...)
+ {
+ }
+ defaultPlayer = NULL;
+ }
+}
+
+
+
+
+bool LEVEL::LoadMap(string mapname)
+{
+ ifstream input;
+ string readBuffer;
+
+ //players.Insert(*defaultPlayer);
+
+ mapname = gamedir + "maps/" + mapname;
+
+ if(tolower(Right(mapname, 4)) != ".map")
+ mapname = mapname + ".map";
+
+ input.open(mapname.c_str());
+
+ if(!input)
+ {
+ char* tmpChar = new char[mapname.length() + 41];
+ strcpy(tmpChar, "Unable to load level file ");
+ strcat(tmpChar, mapname.c_str());
+ strcat(tmpChar, " doesn't exist.");
+
+ MessageBox(NULL,tmpChar,"ERROR",MB_OK|MB_ICONEXCLAMATION);
+ delete [] tmpChar;
+ return false;
+ }
+
+ //Gravity
+ input >> readBuffer;
+ gravity = (float)atof(readBuffer.c_str());
+
+ //Number of triangles
+ input >> readBuffer;
+ numTriangles = Integer(readBuffer);
+
+ //Triangle Data
+ triangles = new TRIANGLE[numTriangles];
+ for(unsigned int i=0; i> readBuffer;
+ triangles[i].texID = Integer(readBuffer);
+
+ for(unsigned int i2=0; i2<3; i2++)
+ {
+ //Vertex Data
+ input >> readBuffer;
+ triangles[i].vertecies[i2].x = atof(readBuffer.c_str());
+ input >> readBuffer;
+ triangles[i].vertecies[i2].y = atof(readBuffer.c_str());
+ input >> readBuffer;
+ triangles[i].vertecies[i2].z = atof(readBuffer.c_str());
+ input >> readBuffer;
+ triangles[i].texCoords[i2].x = (float)atof(readBuffer.c_str());
+ input >> readBuffer;
+ triangles[i].texCoords[i2].y = (float)atof(readBuffer.c_str());
+ }
+
+ //Normal
+ input >> readBuffer;
+
+ triangles[i].normal.x = atof(readBuffer.c_str());
+ input >> readBuffer;
+ triangles[i].normal.y = atof(readBuffer.c_str());
+ input >> readBuffer;
+ triangles[i].normal.z = atof(readBuffer.c_str());
+ }
+
+ //Number of textures;
+ input >> readBuffer;
+ numTextures = Integer(readBuffer);
+
+ //Texture data
+ textureNames = new string[numTextures];
+ for(unsigned int i=0; i> textureNames[i];
+ }
+
+ //BGM
+ input >> bgm;
+
+ //LoadGLTextures();
+ //Build display list
+ if (sound)
+ {
+ BASS_Init(-1, 44100, BASS_DEVICE_LEAVEVOL, g_hWnd);
+ BASS_Start();
+ BASS_CDInit(NULL, BASS_DEVICE_LEAVEVOL);
+
+ if(bgm.length()>=4)
+ {
+ if( toupper(bgm[0]) == 'C' &&
+ toupper(bgm[1]) == 'D' &&
+ toupper(bgm[2]) == 'A')
+ {
+ bgmCDA = Integer(bgm.substr(3,bgm.length()));
+ BASS_CDPlay(bgmCDA, 1, 0);
+ }
+ else
+ {
+ bgmCDA=0;
+ string tmpstr = gamedir + "music/bgm/" + bgm;
+ bgmStream = BASS_StreamCreateFile(0, (void*)tmpstr.c_str(), 0, 0, BASS_STREAM_AUTOFREE);
+ BASS_StreamPlay(bgmStream, 1, BASS_SAMPLE_LOOP);
+ }
+ }
+ }
+
+ return true;
+}
+void LEVEL::LoadMap()
+{
+ LoadMap(nextLevel);
+}
+
+void LEVEL::SaveMap(string mapname)
+{
+ ofstream output;
+
+ mapname = gamedir + "maps/" + mapname;
+
+ if(tolower(Right(mapname, 4)) != ".map")
+ mapname = mapname + ".map";
+
+ output.open(mapname.c_str());
+
+ if(!output)
+ {
+ char* tmpChar = new char[mapname.length() + 42];
+ strcpy(tmpChar, "Unable to save level file ");
+ strcat(tmpChar, mapname.c_str());
+ strcat(tmpChar, " already exists.");
+
+ MessageBox(NULL,tmpChar,"ERROR",MB_OK|MB_ICONEXCLAMATION);
+ delete [] tmpChar;
+ return;
+ }
+
+ //Gravity
+ output << gravity << endl;
+
+ //Number of triangles
+ output << numTriangles << endl;
+
+ //Triangle Data
+ for(unsigned int i=0; icamera.Look();
+///*
+ for (uint32 i=0; ilast+1)
+ {
+ last=time;
+ fps2 = fps;
+ fps=0;
+ }
+ return fps2;
+}
+
+void LEVEL::Execute(string cmd)
+{
+ string command;
+
+ uint32 i=0xFFFFFFFF;
+ while(word(cmd, ++i) != "")
+ {
+ command = word(cmd, i);
+
+ if(command == "set")
+ {
+ command = tolower(word(cmd, ++i));
+
+ if(command == "turnspeed")
+ {
+ turnSpeed = (float)atof(word(cmd, ++i).c_str());//Floating(word(cmd, ++i));
+ }
+ else if(command == "mousespeed")
+ {
+ mouseSpeed = (float)atof(word(cmd, ++i).c_str());
+ }
+ else if(command == "maxfps")
+ {
+ maxFPS = Integer(word(cmd, ++i));
+ }
+ else if(command == "sound")
+ {
+ sound = Truth(word(cmd, ++i));
+ }
+ else if(command == "game")
+ {
+ gamedir= word(cmd, ++i);
+ }
+ else if(command == "screenwidth")
+ {
+ screen.width = Integer(word(cmd, ++i));
+ }
+ else if(command == "screenheight")
+ {
+ screen.height = Integer(word(cmd, ++i));
+ }
+ else if(command == "fullscreen")
+ {
+ screen.fullscreen = Truth(word(cmd, ++i));
+ }
+ }
+ else if(command == "bind")
+ {
+ command = tolower(word(cmd, ++i));
+
+ if(command == "forward")
+ {
+ defaultPlayer->controls.forward.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "backward")
+ {
+ defaultPlayer->controls.backward.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "lookleft")
+ {
+ defaultPlayer->controls.lookLeft.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "lookright")
+ {
+ defaultPlayer->controls.lookRight.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "lookup")
+ {
+ defaultPlayer->controls.lookUp.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "lookdown")
+ {
+ defaultPlayer->controls.lookDown.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "moveup")
+ {
+ defaultPlayer->controls.moveUp.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "movedown")
+ {
+ defaultPlayer->controls.moveDown.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "moveleft")
+ {
+ defaultPlayer[0].controls.moveLeft.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "moveright")
+ {
+ defaultPlayer[0].controls.moveRight.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "fireprimary")
+ {
+ defaultPlayer->controls.firePrimary.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "firesecondary")
+ {
+ defaultPlayer->controls.fireSecondary.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "weapnext")
+ {
+ defaultPlayer->controls.weaponNext.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "weapprev")
+ {
+ defaultPlayer->controls.weaponPrev.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "togglelights" || command == "togglelighting")
+ {
+ defaultPlayer->controls.toggleLights.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "togglefps")
+ {
+ defaultPlayer->controls.toggleFPS.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "toggleconsole")
+ {
+ defaultPlayer->controls.toggleConsole.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "togglemouselook")
+ {
+ defaultPlayer->controls.toggleMouseLook.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "quickmouselook")
+ {
+ defaultPlayer->controls.quickMouseLook.Insert(KeyName(word(cmd, ++i)));
+ }
+ }
+ else if(command == "map")
+ {
+ nextLevel = word(cmd, ++i);
+ }
+ }
+}
+
+void LEVEL::ParseCmds(LPSTR lpCmdLine)
+{
+ string cmd = lpCmdLine;
+ string command;
+
+ uint32 i=0xFFFFFFFF;
+ while(word(cmd, ++i) != "")
+ {
+ command = word(cmd, i);
+
+ if(command == "+set")
+ {
+ command = tolower(word(cmd, ++i));
+
+ if(command == "turnspeed")
+ {
+ turnSpeed = (float)atof(word(cmd, ++i).c_str());
+ }
+ else if(command == "mousespeed")
+ {
+ mouseSpeed = (float)atof(word(cmd, ++i).c_str());
+ }
+ else if(command == "maxfps")
+ {
+ maxFPS = Integer(word(cmd, ++i));
+ }
+ else if(command == "sound")
+ {
+ sound = Truth(word(cmd, ++i));
+ }
+ else if(command == "game")
+ {
+ gamedir= word(cmd, ++i);
+ }
+ }
+ else if(command == "+bind")
+ {
+ command = tolower(word(cmd, ++i));
+
+ if(command == "forward")
+ {
+ defaultPlayer->controls.forward.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "backward")
+ {
+ defaultPlayer->controls.backward.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "lookleft")
+ {
+ defaultPlayer->controls.lookLeft.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "lookright")
+ {
+ defaultPlayer->controls.lookRight.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "lookup")
+ {
+ defaultPlayer->controls.lookUp.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "lookdown")
+ {
+ defaultPlayer->controls.lookDown.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "moveup")
+ {
+ defaultPlayer->controls.moveUp.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "movedown")
+ {
+ defaultPlayer->controls.moveDown.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "fireprimary")
+ {
+ defaultPlayer->controls.firePrimary.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "firesecondary")
+ {
+ defaultPlayer->controls.fireSecondary.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "weapnext")
+ {
+ defaultPlayer->controls.weaponNext.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "weapprev")
+ {
+ defaultPlayer->controls.weaponPrev.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "togglelights" || command == "togglelighting")
+ {
+ defaultPlayer->controls.toggleLights.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "togglefps")
+ {
+ defaultPlayer->controls.toggleFPS.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "toggleconsole")
+ {
+ defaultPlayer->controls.toggleConsole.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "togglemouselook")
+ {
+ defaultPlayer->controls.toggleMouseLook.Insert(KeyName(word(cmd, ++i)));
+ }
+ else if(command == "quickmouselook")
+ {
+ defaultPlayer->controls.quickMouseLook.Insert(KeyName(word(cmd, ++i)));
+ }
+ }
+ else if(command == "+map")
+ {
+ nextLevel = word(cmd, ++i);
+ }
+ }
+}
+
+void LEVEL::LoadConfig()
+{
+ showFPS = false;
+ nextLevel = "intro.map";
+ gamedir = "oa/";
+ sound = true;
+
+ mouseSpeed = 5;
+ turnSpeed = 1.0f;
+ moveSpeed = .2f;
+ mlook = true;
+}
+bool LEVEL::LoadConfig(string cfgname)
+{
+ ifstream input;
+ string readBuffer;
+
+ cfgname = gamedir + "config/" + cfgname;
+
+ if(tolower(Right(cfgname, 4)) !=".cfg")
+ cfgname = cfgname + ".cfg";
+
+ input.open(cfgname.c_str());
+
+ if(!input)
+ return false;
+
+ getline(input, readBuffer);
+
+ while(input)
+ {
+ uint32 i=0xFFFFFFFF;
+
+ if(readBuffer[0] == '/' && readBuffer[1] == '/')
+ {
+ getline(input, readBuffer);
+ }
+
+ Execute(readBuffer);
+
+ getline(input, readBuffer);
+ }
+
+ return true;
+}
+
+void LEVEL::SaveConfig(string cfgname)
+{
+ ofstream output;
+
+ cfgname = gamedir + "config/" + cfgname;
+
+ if(tolower(Right(cfgname, 4)) !=".cfg")
+ cfgname = cfgname + ".cfg";
+
+ output.open(cfgname.c_str());
+
+ if(!output)
+ return;
+
+ //Client Config
+ output << "set turnspeed " << turnSpeed << endl;
+ output << "set mousespeed " << mouseSpeed << endl;
+ output << "set mouselook " << mlook << endl;
+ output << "set screenwidth " << screen.width << endl;
+ output << "set screenheight " << screen.height << endl;
+ output << "set colordepth " << screen.bpp << endl;
+ output << "set maxfps " << maxFPS << endl;
+
+ //Control Scheme
+ //output << " bind " << action << keyname << endl;
+ if(!defaultPlayer->controls.backward.IsEmpty())
+ {
+ defaultPlayer->controls.backward.FirstPosition();
+ output << "bind backward " << string(KeyString(defaultPlayer->controls.backward.Retrieve())) << endl;
+ while(defaultPlayer->controls.backward.NextPosition())
+ output << "bind backward " << KeyString(defaultPlayer->controls.backward.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.firePrimary.IsEmpty())
+ {
+ defaultPlayer->controls.firePrimary.FirstPosition();
+ output << "bind firePrimary " << KeyString(defaultPlayer->controls.firePrimary.Retrieve()) << endl;
+ while(defaultPlayer->controls.firePrimary.NextPosition())
+ output << "bind firePrimary " << KeyString(defaultPlayer->controls.firePrimary.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.fireSecondary.IsEmpty())
+ {
+ defaultPlayer->controls.fireSecondary.FirstPosition();
+ output << "bind fireSecondary " << KeyString(defaultPlayer->controls.fireSecondary.Retrieve()) << endl;
+ while(defaultPlayer->controls.fireSecondary.NextPosition())
+ output << "bind fireSecondary " << KeyString(defaultPlayer->controls.fireSecondary.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.forward.IsEmpty())
+ {
+ defaultPlayer->controls.forward.FirstPosition();
+ output << "bind forward " << KeyString(defaultPlayer->controls.forward.Retrieve()) << endl;
+ while(defaultPlayer->controls.forward.NextPosition())
+ output << "bind forward " << KeyString(defaultPlayer->controls.forward.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.lookDown.IsEmpty())
+ {
+ defaultPlayer->controls.lookDown.FirstPosition();
+ output << "bind lookDown " << KeyString(defaultPlayer->controls.lookDown.Retrieve()) << endl;
+ while(defaultPlayer->controls.lookDown.NextPosition())
+ output << "bind lookDown " << KeyString(defaultPlayer->controls.lookDown.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.lookLeft.IsEmpty())
+ {
+ defaultPlayer->controls.lookLeft.FirstPosition();
+ output << "bind lookLeft " << KeyString(defaultPlayer->controls.lookLeft.Retrieve()) << endl;
+ while(defaultPlayer->controls.lookLeft.NextPosition())
+ output << "bind lookLeft " << KeyString(defaultPlayer->controls.lookLeft.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.lookRight.IsEmpty())
+ {
+ defaultPlayer->controls.lookRight.FirstPosition();
+ output << "bind lookRight " << KeyString(defaultPlayer->controls.lookRight.Retrieve()) << endl;
+ while(defaultPlayer->controls.lookRight.NextPosition())
+ output << "bind lookRight " << KeyString(defaultPlayer->controls.lookRight.Retrieve()) << endl;
+ }
+ if(!defaultPlayer->controls.lookUp.IsEmpty())
+ {
+ defaultPlayer->controls.lookUp.FirstPosition();
+ output << "bind lookUp " << KeyString(defaultPlayer->controls.lookUp.Retrieve()) << endl;
+ while(defaultPlayer->controls.lookUp.NextPosition())
+ output << "bind lookUp " << KeyString(defaultPlayer->controls.lookUp.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.moveDown.IsEmpty())
+ {
+ defaultPlayer->controls.moveDown.FirstPosition();
+ output << "bind moveDown " << KeyString(defaultPlayer->controls.moveDown.Retrieve()) << endl;
+ while(defaultPlayer->controls.moveDown.NextPosition())
+ output << "bind moveDown " << KeyString(defaultPlayer->controls.moveDown.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.moveLeft.IsEmpty())
+ {
+ defaultPlayer->controls.moveLeft.FirstPosition();
+ output << "bind moveLeft " << KeyString(defaultPlayer->controls.moveLeft.Retrieve()) << endl;
+ while(defaultPlayer->controls.moveLeft.NextPosition())
+ output << "bind moveLeft " << KeyString(defaultPlayer->controls.moveLeft.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.moveRight.IsEmpty())
+ {
+ defaultPlayer->controls.moveRight.FirstPosition();
+ output << "bind moveRight " << KeyString(defaultPlayer->controls.moveRight.Retrieve()) << endl;
+ while(defaultPlayer->controls.moveRight.NextPosition())
+ output << "bind moveRight " << KeyString(defaultPlayer->controls.moveRight.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.moveUp.IsEmpty())
+ {
+ defaultPlayer->controls.moveUp.FirstPosition();
+ output << "bind moveUp " << KeyString(defaultPlayer->controls.moveUp.Retrieve()) << endl;
+ while(defaultPlayer->controls.moveUp.NextPosition())
+ output << "bind moveUp " << KeyString(defaultPlayer->controls.moveUp.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.quickMouseLook.IsEmpty())
+ {
+ defaultPlayer->controls.quickMouseLook.FirstPosition();
+ output << "bind quickMouseLook " << KeyString(defaultPlayer->controls.quickMouseLook.Retrieve()) << endl;
+ while(defaultPlayer->controls.quickMouseLook.NextPosition())
+ output << "bind quickMouseLook " << KeyString(defaultPlayer->controls.quickMouseLook.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.rollLeft.IsEmpty())
+ {
+ defaultPlayer->controls.rollLeft.FirstPosition();
+ output << "bind rollLeft " << KeyString(defaultPlayer->controls.rollLeft.Retrieve()) << endl;
+ while(defaultPlayer->controls.rollLeft.NextPosition())
+ output << "bind rollLeft " << KeyString(defaultPlayer->controls.rollLeft.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.rollRight.IsEmpty())
+ {
+ defaultPlayer->controls.rollRight.FirstPosition();
+ output << "bind rollRight " << KeyString(defaultPlayer->controls.rollRight.Retrieve()) << endl;
+ while(defaultPlayer->controls.rollRight.NextPosition())
+ output << "bind rollRight " << KeyString(defaultPlayer->controls.rollRight.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.toggleConsole.IsEmpty())
+ {
+ defaultPlayer->controls.toggleConsole.FirstPosition();
+ output << "bind toggleConsole " << KeyString(defaultPlayer->controls.toggleConsole.Retrieve()) << endl;
+ while(defaultPlayer->controls.toggleConsole.NextPosition())
+ output << "bind toggleConsole " << KeyString(defaultPlayer->controls.toggleConsole.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.toggleFPS.IsEmpty())
+ {
+ defaultPlayer->controls.toggleFPS.FirstPosition();
+ output << "bind toggleFPS " << KeyString(defaultPlayer->controls.toggleFPS.Retrieve()) << endl;
+ while(defaultPlayer->controls.toggleFPS.NextPosition())
+ output << "bind toggleFPS " << KeyString(defaultPlayer->controls.toggleFPS.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.toggleLights.IsEmpty())
+ {
+ defaultPlayer->controls.toggleLights.FirstPosition();
+ output << "bind toggleLights " << KeyString(defaultPlayer->controls.toggleLights.Retrieve()) << endl;
+ while(defaultPlayer->controls.toggleLights.NextPosition())
+ output << "bind toggleLights " << KeyString(defaultPlayer->controls.toggleLights.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.toggleMouseLook.IsEmpty())
+ {
+ defaultPlayer->controls.toggleMouseLook.FirstPosition();
+ output << "bind toggleMouseLook " << KeyString(defaultPlayer->controls.toggleMouseLook.Retrieve()) << endl;
+ while(defaultPlayer->controls.toggleMouseLook.NextPosition())
+ output << "bind toggleMouseLook " << KeyString(defaultPlayer->controls.toggleMouseLook.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.weaponNext.IsEmpty())
+ {
+ defaultPlayer->controls.weaponNext.FirstPosition();
+ output << "bind weaponNext " << KeyString(defaultPlayer->controls.weaponNext.Retrieve()) << endl;
+ while(defaultPlayer->controls.weaponNext.NextPosition())
+ output << "bind weaponNext " << KeyString(defaultPlayer->controls.weaponNext.Retrieve()) << endl;
+ }
+
+ if(!defaultPlayer->controls.weaponPrev.IsEmpty())
+ {
+ defaultPlayer->controls.weaponPrev.FirstPosition();
+ output << "bind weaponPrev " << KeyString(defaultPlayer->controls.weaponPrev.Retrieve()) << endl;
+ while(defaultPlayer->controls.weaponPrev.NextPosition())
+ output << "bind weaponPrev " << KeyString(defaultPlayer->controls.weaponPrev.Retrieve()) << endl;
+ }
+}
+
+void LEVEL::Print(int x, int y, const char* str, unsigned int set)
+{
+ glFont.Print(x,y,str, set);
+}
\ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..1be341f
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,746 @@
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Author: Tom Hicks
+// Module: main.cpp
+// Purpose: This is an implementation of the openarena SDK.
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////
+//include necessary header files
+#include "../include/main.h"
+
+
+//link necessary libraries
+#pragma comment(lib, "opengl32.lib")
+#pragma comment(lib, "glu32.lib")
+#pragma comment(lib, "glaux.lib")
+#pragma comment(lib, "winmm.lib")
+
+
+#ifndef CDS_FULLSCREEN
+#define CDS_FULLSCREEN 4
+#endif
+
+
+
+using namespace std;
+
+void InitControls();
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function Definitions
+
+//
+//void InitControls()
+// Purpose:
+// Initializes controls by loading the default control config file "my.cfg".
+
+void InitControls()
+{
+ if (!level.LoadConfig("my.cfg"))
+ level.LoadConfig();
+}
+
+//
+// int InitGL(GLvoid)
+// Purpose:
+// To do all required setup before creating an OpenGL window
+// Pre:
+//
+// Post:
+//
+
+int InitGL(GLvoid)
+{
+ level.LoadGLTextures();
+
+ glEnable(GL_TEXTURE_2D);
+ glShadeModel(GL_SMOOTH);
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClearDepth(1.0f);
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_LEQUAL);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
+
+ /*lighting disabled temporarily
+ glLightfv(GL_LIGHT1, GL_AMBIENT, level.LightAmbient);
+ for(index=0; indexcontrols.backward.IsEmpty())
+ {
+ level.defaultPlayer->controls.backward.FirstPosition();
+ if(keys[level.defaultPlayer->controls.backward.Retrieve()])
+ {
+ level.defaultPlayer->camera.MoveCamera(-level.moveSpeed);
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.backward.NextPosition() && (keys[level.defaultPlayer->controls.backward.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.backward.Retrieve()])
+ {
+ level.defaultPlayer->camera.MoveCamera(-level.moveSpeed);
+ }
+ }
+ }
+ }
+
+ //////////
+ //Move forward
+ if(!level.defaultPlayer->controls.forward.IsEmpty())
+ {
+ level.defaultPlayer->controls.forward.FirstPosition();
+ if(keys[level.defaultPlayer->controls.forward.Retrieve()])
+ {
+ level.defaultPlayer->camera.MoveCamera(level.moveSpeed);
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.forward.NextPosition() && (keys[level.defaultPlayer->controls.forward.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.forward.Retrieve()])
+ {
+ level.defaultPlayer->camera.MoveCamera(level.moveSpeed);
+ }
+ }
+ }
+ }
+
+ //////////
+ //Strafe Left
+ if(!level.defaultPlayer->controls.moveLeft.IsEmpty())
+ {
+ level.defaultPlayer->controls.moveLeft.FirstPosition();
+ if(keys[level.defaultPlayer->controls.moveLeft.Retrieve()])
+ {
+ level.defaultPlayer->camera.StrafeCamera(-level.moveSpeed);
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.moveLeft.NextPosition() && (keys[level.defaultPlayer->controls.moveLeft.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.moveLeft.Retrieve()])
+ {
+ level.defaultPlayer->camera.StrafeCamera(-level.moveSpeed);
+ }
+ }
+ }
+ }
+
+ //////////
+ //Strafe Right
+ if(!level.defaultPlayer->controls.moveRight.IsEmpty())
+ {
+ level.defaultPlayer->controls.moveRight.FirstPosition();
+ if(keys[level.defaultPlayer->controls.moveRight.Retrieve()])
+ {
+ level.defaultPlayer[0].camera.StrafeCamera(level.moveSpeed);
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.moveRight.NextPosition() && (keys[level.defaultPlayer->controls.moveRight.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.moveRight.Retrieve()])
+ {
+ level.defaultPlayer->camera.StrafeCamera(level.moveSpeed);
+ }
+ }
+ }
+ }
+
+ //////////
+ //Keyboard Look Left
+ if(!level.defaultPlayer->controls.lookLeft.IsEmpty())
+ {
+ level.defaultPlayer->controls.lookLeft.FirstPosition();
+ if(keys[level.defaultPlayer->controls.lookLeft.Retrieve()])
+ {
+ level.defaultPlayer[0].camera.RotateView(level.turnSpeed, 0, 1, 0);
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.lookLeft.NextPosition() && (keys[level.defaultPlayer->controls.lookLeft.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.lookLeft.Retrieve()])
+ {
+ level.defaultPlayer[0].camera.RotateView(level.turnSpeed, 0, 1, 0);
+ }
+ }
+ }
+ }
+
+ //////////
+ //Keyboard Look Right
+ if(!level.defaultPlayer->controls.lookRight.IsEmpty())
+ {
+ level.defaultPlayer->controls.lookRight.FirstPosition();
+ if(keys[level.defaultPlayer->controls.lookRight.Retrieve()])
+ {
+ level.defaultPlayer->camera.RotateView(-level.turnSpeed, 0, 1, 0);
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.lookRight.NextPosition() && (keys[level.defaultPlayer->controls.lookRight.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.lookRight.Retrieve()])
+ {
+ level.defaultPlayer->camera.RotateView(-level.turnSpeed, 0, 1, 0);
+ }
+ }
+ }
+ }
+
+ //////////
+ //Keyboard Look Up
+ if(!level.defaultPlayer->controls.lookUp.IsEmpty())
+ {
+ level.defaultPlayer->controls.lookUp.FirstPosition();
+ if(keys[level.defaultPlayer->controls.lookUp.Retrieve()])
+ {
+ level.defaultPlayer->camera.RotateView(level.turnSpeed, 1, 0, 0);
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.lookUp.NextPosition() && (keys[level.defaultPlayer->controls.lookUp.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.lookUp.Retrieve()])
+ {
+ level.defaultPlayer->camera.RotateView(level.turnSpeed, 1, 0, 0);
+ }
+ }
+ }
+ }
+
+ //////////
+ //Keyboard Look Down
+ if(!level.defaultPlayer->controls.lookDown.IsEmpty())
+ {
+ level.defaultPlayer->controls.lookDown.FirstPosition();
+ if(keys[level.defaultPlayer->controls.lookDown.Retrieve()])
+ {
+ level.defaultPlayer->camera.RotateView(-level.turnSpeed, 1, 0, 0);
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.lookDown.NextPosition() && (keys[level.defaultPlayer->controls.lookDown.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.lookDown.Retrieve()])
+ {
+ level.defaultPlayer->camera.RotateView(-level.turnSpeed, 1, 0, 0);
+ }
+ }
+ }
+ }
+
+ //////////
+ //Toggle Show FPS
+ if(!level.defaultPlayer->controls.toggleFPS.IsEmpty())
+ {
+ level.defaultPlayer->controls.toggleFPS.FirstPosition();
+ if(keys[level.defaultPlayer->controls.toggleFPS.Retrieve()])
+ {
+ if(!keys2[level.defaultPlayer->controls.toggleFPS.Retrieve()])
+ {
+ level.showFPS = !level.showFPS;
+ }
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.toggleFPS.NextPosition() && (keys[level.defaultPlayer->controls.toggleFPS.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.toggleFPS.Retrieve()])
+ {
+ if(!keys2[level.defaultPlayer->controls.toggleFPS.Retrieve()])
+ {
+ level.showFPS = !level.showFPS;
+ }
+ }
+ }
+ }
+ }
+
+ //////////
+ //Toggle MouseLook
+ if(!level.defaultPlayer->controls.toggleMouseLook.IsEmpty())
+ {
+ level.defaultPlayer->controls.toggleMouseLook.FirstPosition();
+ if(keys[level.defaultPlayer->controls.toggleMouseLook.Retrieve()])
+ {
+ if(keys2[level.defaultPlayer->controls.toggleMouseLook.Retrieve()])
+ {
+ level.mlook = ! level.mlook;
+ }
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.toggleMouseLook.NextPosition() && (keys[level.defaultPlayer->controls.toggleMouseLook.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.toggleMouseLook.Retrieve()])
+ {
+ if(keys2[level.defaultPlayer->controls.toggleMouseLook.Retrieve()])
+ {
+ level.mlook = ! level.mlook;
+ }
+ }
+ }
+ }
+ }
+
+ //////////
+ //Toggle Console
+ //if(!level.defaultPlayer[0].controls.toggleConsole.IsEmpty())
+ if(keys['I'])
+ keys['I'] = true;
+
+ if(!level.defaultPlayer->controls.toggleConsole.IsEmpty())
+ {
+ level.defaultPlayer->controls.toggleConsole.FirstPosition();
+ if(keys[level.defaultPlayer->controls.toggleConsole.Retrieve()])
+ {
+ if(!keys2[level.defaultPlayer->controls.toggleConsole.Retrieve()])
+ {
+ level.showConsole = !level.showConsole;
+ keys2[level.defaultPlayer->controls.toggleConsole.Retrieve()] = true;
+ }
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.toggleConsole.NextPosition() && (keys[level.defaultPlayer->controls.toggleConsole.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.toggleConsole.Retrieve()])
+ {
+ if(!keys2[level.defaultPlayer->controls.toggleConsole.Retrieve()])
+ {
+ level.showConsole = !level.showConsole;
+ keys2[level.defaultPlayer->controls.toggleConsole.Retrieve()] = true;
+ }
+ }
+ }
+ }
+ }
+
+ //////////
+ //Quick MouseLook
+ if(!level.defaultPlayer->controls.quickMouseLook.IsEmpty())
+ {
+ level.defaultPlayer->controls.quickMouseLook.FirstPosition();
+ if(keys[level.defaultPlayer->controls.quickMouseLook.Retrieve()])
+ {
+ if(keys2[level.defaultPlayer->controls.quickMouseLook.Retrieve()])
+ {
+ level.mlook = ! level.mlook;
+ }
+ }
+ else
+ {
+ while(level.defaultPlayer->controls.quickMouseLook.NextPosition() && (keys[level.defaultPlayer->controls.quickMouseLook.Retrieve()] != true));
+ {
+ if(keys[level.defaultPlayer->controls.quickMouseLook.Retrieve()])
+ {
+ if(keys2[level.defaultPlayer->controls.quickMouseLook.Retrieve()])
+ {
+ level.mlook = ! level.mlook;
+ }
+ }
+ }
+ }
+ }
+
+ level.Render();
+
+ }
+ }
+
+ SwapBuffers(hDC);
+
+ if (keys[VK_F1])
+ {
+ keys[VK_F1]=false;
+ KillGLWindow();
+ g_Screen.fullscreen=!g_Screen.fullscreen;
+ if (!CreateGLWindow("OpenArena",g_Screen.width,g_Screen.height,g_Screen.bpp,g_Screen.fullscreen))
+ {
+ return 0;
+ }
+ }
+ }
+ }
+
+ level.UnloadMap();
+ KillGLWindow();
+ return (msg.wParam);
+}
diff --git a/src/mygl.cpp b/src/mygl.cpp
new file mode 100644
index 0000000..aadbfb7
--- /dev/null
+++ b/src/mygl.cpp
@@ -0,0 +1,63 @@
+
+#include "../include/myGL.h"
+
+void FreeGLTexture(unsigned int& texture)
+{
+ glDeleteTextures(1, &texture);
+}
+
+bool LoadGLTexture(string fn, unsigned int& texture, int mag, int min)
+{
+ if(Right(tolower(fn), 4) == ".bmp")
+ {
+ TextureImage* texImage = NULL;
+ if(texImage = LoadBMP(fn.c_str()))
+ {
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, texImage->sizeX, texImage->sizeY, 0, texImage->type, GL_UNSIGNED_BYTE, texImage->data);
+
+ if(texImage) //Just in case somehow the file was empty or unloadable
+ {
+ if(texImage->data)
+ free(texImage->data);
+ free(texImage);
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else if(Right(tolower(fn), 4) == ".tga")
+ {
+ TextureImage* texImage = NULL;
+ if(texImage = LoadTGA(fn.c_str()))
+ {
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, texImage->sizeX, texImage->sizeY, 0, texImage->type, GL_UNSIGNED_BYTE, texImage->data);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ if(texImage) //Just in case somehow the file was empty or unloadable
+ {
+ if(texImage->data)
+ free(texImage->data);
+ free(texImage);
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+}
diff --git a/src/myglFont.cpp b/src/myglFont.cpp
new file mode 100644
index 0000000..2fe514a
--- /dev/null
+++ b/src/myglFont.cpp
@@ -0,0 +1,142 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Module: myglFont.cpp
+// Author: Tom Hicks
+// Creation: 09-01-2003
+// LastEdit: 09-01-2003
+// Editors: None
+//
+// Purpose:
+//
+// Summary of Methods:
+// Global
+// -function name
+// description
+// blahClass
+// -function name
+// description
+//
+// Summary of Properties:
+// blahClass
+// -property name
+// description
+//
+////////////////////////////////////////////////////////////////////////////////
+
+#include "../include/myglFont.h"
+
+GLFontClass::GLFontClass()
+{
+ status = 0;
+ base = 0;
+ texture = 0;
+ screenWidth = 1;
+ screenHeight = 1;
+}
+
+GLFontClass::~GLFontClass()
+{
+ FreeFont();
+}
+
+bool GLFontClass::BuildFont(const char* texName)
+{
+ FreeFont();
+
+ if(LoadGLTexture(texName, texture, GL_NEAREST, GL_NEAREST))
+ {
+ float x, y;
+ base = glGenLists(256);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ for(short i = 0; i<256; i++)
+ {
+ x = i%16/16.0f;
+ y = i/16/16.0f;
+ glNewList(base+i, GL_COMPILE);
+ glBegin(GL_QUADS);
+ glTexCoord2f(x, 1-y-0.0625f);
+ glVertex2i(0,0);
+ glTexCoord2f(x+0.0625f, 1-y-0.0625f);
+ glVertex2i(16,0);
+ glTexCoord2f(x+0.0625f, 1-y);
+ glVertex2i(16,16);
+ glTexCoord2f(x, 1-y);
+ glVertex2i(0,16);
+ glEnd();
+ glTranslated(16,0,0);
+ glEndList();
+ }
+ status = true;
+ }
+ return status;
+}
+
+bool GLFontClass::FreeFont()
+{
+ if(status)
+ {
+ glDeleteLists(base, 256);
+ status = false;
+ }
+ return status;
+}
+
+void GLFontClass::Print(int x, int y, const char* str, unsigned int set)
+{
+ if(status)
+ {
+ if(set>1)
+ set = 1;
+
+ glBindTexture(GL_TEXTURE_2D, texture);
+ //glDisable(GL_DEPTH_TEST);
+ //glEnable(GL_BLEND);
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0,screenWidth,0,screenHeight,-1,1);
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glTranslated(x, y, 0);
+ glListBase(base-32+(128*set));
+ glCallLists(strlen(str), GL_BYTE, str);
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ //glDisable(GL_BLEND);
+ //glEnable(GL_DEPTH_TEST);
+ }
+}
+
+bool GLFontClass::Status()
+{
+ return status;
+}
+
+void GLFontClass::SetScreenDimensions(short x, short y)
+{
+ screenWidth = x;
+ screenHeight = y;
+}
+
+void GLFontClass::SetScreenWidth(short x)
+{
+ screenWidth = x;
+}
+
+void GLFontClass::SetScreenHeight(short y)
+{
+ screenHeight = y;
+}
+
+short GLFontClass::ScreenWidth()
+{
+ return screenWidth;
+}
+
+short GLFontClass::ScreenHeight()
+{
+ return screenHeight;
+}
diff --git a/src/myglTexture.cpp b/src/myglTexture.cpp
new file mode 100644
index 0000000..e98faa1
--- /dev/null
+++ b/src/myglTexture.cpp
@@ -0,0 +1,107 @@
+#include "../include/myglTexture.h"
+
+GL_MY_TEXTURE::GL_MY_TEXTURE()
+{
+ id=0xFFFFFFFF;
+ filename = "";
+ minFilter = GL_LINEAR;
+ magFilter = GL_LINEAR;
+}
+
+GL_MY_TEXTURE::~GL_MY_TEXTURE()
+{
+ Free();
+}
+
+string GL_MY_TEXTURE::Filename()
+{
+ return filename;
+}
+
+uint32 GL_MY_TEXTURE::ID()
+{
+ return id;
+}
+
+bool GL_MY_TEXTURE::Loaded()
+{
+ return filename != "";
+}
+
+bool GL_MY_TEXTURE::Load(string fn)
+{
+ if(Loaded())
+ Free();
+
+ if(LoadGLTexture(fn.c_str(), id, minFilter, magFilter))
+ {
+ filename = fn;
+ return true;
+ }
+ else
+ {
+ id=0xFFFFFFFF;
+ return false;
+ }
+}
+
+bool GL_MY_TEXTURE::Load(string fn, uint32 min, uint32 mag)
+{
+ if(Loaded())
+ Free();
+
+ if(LoadGLTexture(fn.c_str(), id, min, mag))
+ {
+ filename = fn;
+ minFilter = min;
+ magFilter = mag;
+ return true;
+ }
+ else
+ {
+ id=0xFFFFFFFF;
+ return false;
+ }
+}
+
+void GL_MY_TEXTURE::Free()
+{
+ if(Loaded())
+ {
+ FreeGLTexture(id);
+ minFilter = GL_LINEAR;
+ magFilter = GL_LINEAR;
+ filename = "";
+ id = 0xFFFFFFFF;
+ }
+}
+
+bool GL_MY_TEXTURE::operator<(const GL_MY_TEXTURE& rtOp)
+{
+ return id=(const GL_MY_TEXTURE& rtOp)
+{
+ return id>=rtOp.id;
+}
+
+bool GL_MY_TEXTURE::operator>(const GL_MY_TEXTURE& rtOp)
+{
+ return id>rtOp.id;
+}
diff --git a/src/physics.cpp b/src/physics.cpp
new file mode 100644
index 0000000..0564af1
--- /dev/null
+++ b/src/physics.cpp
@@ -0,0 +1,5 @@
+#include "../include/physics.h"
+
+WORLD_PHYSICS::WORLD_PHYSICS()
+{
+}
\ No newline at end of file
diff --git a/src/player.cpp b/src/player.cpp
new file mode 100644
index 0000000..81948cc
--- /dev/null
+++ b/src/player.cpp
@@ -0,0 +1,23 @@
+#include "../include/player.h"
+
+void PLAYER::Load()
+{
+}
+
+void PLAYER::Save()
+{
+}
+
+void PLAYER::AddItem(unsigned int item)
+{
+// inventory = inventory | item;
+}
+
+void PLAYER::RemoveItem(unsigned int item)
+{
+// inventory = inventory & ~item;
+}
+
+void PLAYER::CreateCharacter()
+{
+}
diff --git a/src/strmanip.cpp b/src/strmanip.cpp
new file mode 100644
index 0000000..90187ac
--- /dev/null
+++ b/src/strmanip.cpp
@@ -0,0 +1,289 @@
+#include "../include/strmanip.h"
+
+bool Truth(std::string str)
+{
+ if (toupper(str[0]) == 'T' || str[0] == '1')
+ return true;
+ else
+ return false;
+}
+
+int Integer(std::string str)
+{
+ int last = str.length() - 1;
+ int number = 0;
+
+ for (int x = last; x>=0; x--)
+ {
+ switch(str[x])
+ {
+ case '1':
+ number += (int)pow(10, last-x);
+ break;
+ case '2':
+ number += 2 * (int)pow(10, last-x);
+ break;
+ case '3':
+ number += 3 * (int)pow(10, last-x);
+ break;
+ case '4':
+ number += 4 * (int)pow(10, last-x);
+ break;
+ case '5':
+ number += 5 * (int)pow(10, last-x);
+ break;
+ case '6':
+ number += 6 * (int)pow(10, last-x);
+ break;
+ case '7':
+ number += 7 * (int)pow(10, last-x);
+ break;
+ case '8':
+ number += 8 * (int)pow(10, last-x);
+ break;
+ case '9':
+ number += 9 * (int)pow(10, last-x);
+ }
+ }
+ return number;
+}
+
+float Floating(std::string str)
+{
+ //this doesn't work right yet so use atof for now
+
+ int last = str.length() - 1;
+ float number = 0.0f;
+ bool period = false;
+
+ for (int x = last; x>=0; x--)
+ {
+ switch(str[x])
+ {
+ case '1':
+ number += (float)pow(10, last-x);
+ break;
+ case '2':
+ number += 2 * (float)pow(10, last-x);
+ break;
+ case '3':
+ number += 3 * (float)pow(10, last-x);
+ break;
+ case '4':
+ number += 4 * (float)pow(10, last-x);
+ break;
+ case '5':
+ number += 5 * (float)pow(10, last-x);
+ break;
+ case '6':
+ number += 6 * (float)pow(10, last-x);
+ break;
+ case '7':
+ number += 7 * (float)pow(10, last-x);
+ break;
+ case '8':
+ number += 8 * (float)pow(10, last-x);
+ break;
+ case '9':
+ number += 9 * (float)pow(10, last-x);
+ break;
+ case '.':
+ if (!period)
+ {
+ number *= (float)pow(10, -(last-x));
+ last -= (x+1);
+ period = true;
+ }
+ else
+ return number;
+
+ }
+ }
+
+ if(str[0] =='-')
+ return -number;
+ else
+ return number;
+}
+
+string KeyString(uint8 key)
+{
+ switch (key)
+ {
+ case VK_UP:
+ return "up";
+ case VK_DOWN:
+ return "down";
+ case VK_LEFT:
+ return "left";
+ case VK_RIGHT:
+ return "right";
+ case VK_PRIOR:
+ return "pageup";
+ case VK_NEXT:
+ return "pagedown";
+ case VK_SPACE:
+ return "space";
+ case VK_LBUTTON:
+ return "mouse1";
+ case VK_RBUTTON:
+ return "mouse2";
+ case VK_MBUTTON:
+ return "mouse3";
+ case VK_F1:
+ return "f1";
+ case VK_F2:
+ return "f2";
+ case VK_F3:
+ return "f3";
+ case VK_F4:
+ return "f4";
+ case VK_F5:
+ return "f5";
+ case VK_F6:
+ return "f6";
+ case VK_F7:
+ return "f7";
+ case VK_F8:
+ return "f8";
+ case VK_F9:
+ return "f9";
+ case VK_F10:
+ return "f10";
+ case VK_F11:
+ return "f11";
+ case VK_F12:
+ return "f2";
+ default:
+ return "null";
+ };
+}
+uint8 KeyName(std::string str)
+{
+ if (str.length() > 1)
+ {
+ if (str.substr(0,2) == "up")
+ return VK_UP;
+ else if (str.substr(0,4) == "down")
+ return VK_DOWN;
+ else if (str.substr(0,6) == "pageup")
+ return VK_PRIOR;
+ else if (str.substr(0,8) == "pagedown")
+ return VK_NEXT;
+ else if (str.substr(0,5) == "right")
+ return VK_RIGHT;
+ else if (str.substr(0,4) == "left")
+ return VK_LEFT;
+ else if (str.substr(0,5) == "space")
+ return VK_SPACE;
+ else if (str.substr(0,6) == "mouse1")
+ return VK_LBUTTON;
+ else if (str.substr(0,6) == "mouse2")
+ return VK_RBUTTON;
+ else if (str.substr(0,6) == "mouse3")
+ return VK_MBUTTON;
+ /*uncomment this to enable f1 as a mappable key
+ else if(str.substr(0,2) == "f1")
+ return VK_F1;
+ */
+
+ else if (str.substr(0,2) == "f2")
+ return VK_F2;
+ else if (str.substr(0,2) == "f3")
+ return VK_F3;
+ else if (str.substr(0,2) == "f4")
+ return VK_F4;
+ else if (str.substr(0,2) == "f5")
+ return VK_F5;
+ else if (str.substr(0,2) == "f6")
+ return VK_F6;
+ else if (str.substr(0,2) == "f7")
+ return VK_F7;
+ else if (str.substr(0,2) == "f8")
+ return VK_F8;
+ else if (str.substr(0,2) == "f9")
+ return VK_F9;
+ else if (str.substr(0,2) == "f10")
+ return VK_F10;
+ else if (str.substr(0,2) == "f11")
+ return VK_F11;
+ else if (str.substr(0,2) == "f12")
+ return VK_F12;
+ //Add Game specific keys here and e-mail headhunter45@hotmail.com subject OpenArena keys so I can add them please
+ else if (str.substr(0,4) == "null")
+ return NULL;
+ else
+ return NULL;
+ }
+ else
+ return toupper(str[0]);
+}
+
+string Right(string str, uint32 len)
+{
+ return str.substr(str.length()-len, len);
+}
+
+string Left(string str, uint32 len)
+{
+ return str.substr(0, len);
+}
+
+string tolower(string str)
+{
+ for(uint32 i=0; i 0)
+ {
+ if(wordNum < 1)
+ {
+ while (!isspace(str[++length]) && length <= maxLength);
+
+ return str.substr(start, length);
+ }
+ else
+ {
+ while(isspace(str[start]))
+ ++start;
+
+ for(uint32 i=0; isizeY = tga.header[1] * 256 + tga.header[0];
+ image->sizeX = tga.header[3] * 256 + tga.header[2];
+ image->bpp = tga.header[4];
+ tga.Width = image->sizeX;
+ tga.Height = image->sizeY;
+ tga.Bpp = image->bpp;
+
+ if((image->sizeX <= 0) || (image->sizeY <= 0) || ((image->bpp != 24) && (image->bpp !=32)))
+ {
+ MessageBox(NULL, "Invalid texture information", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ return NULL;
+ }
+
+ if(image->bpp == 24)
+ {
+ image->type = GL_RGB;
+ }
+ else
+ {
+ image->type = GL_RGBA;
+ }
+
+ tga.bytesPerPixel = (tga.Bpp / 8);
+ tga.imageSize = (tga.bytesPerPixel * tga.Width * tga.Height);
+ image->data = (GLubyte *)malloc(tga.imageSize);
+
+ if(image->data == NULL)
+ {
+ MessageBox(NULL, "Could not allocate memory for image", "ERROR", MB_OK);
+ fclose(fTGA);
+ return NULL;
+ }
+
+ if(fread(image->data, 1, tga.imageSize, fTGA) != tga.imageSize)
+ {
+ MessageBox(NULL, "Could not read image data", "ERROR", MB_OK);
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+ fclose(fTGA);
+ return NULL;
+ }
+
+
+ for(GLuint cswap = 0; cswap < (int)tga.imageSize; cswap += tga.bytesPerPixel)
+ {
+ image->data[cswap] ^= image->data[cswap+2] ^=
+ image->data[cswap] ^= image->data[cswap+2];
+ }
+
+ fclose(fTGA);
+ return image;
+}
+
+TextureImage* LoadCompressedTGA(FILE * fTGA)
+{
+ TextureImage* image = new TextureImage;
+ TGA tga;
+
+ if(fread(tga.header, sizeof(tga.header), 1, fTGA) == 0)
+ {
+ MessageBox(NULL, "Could not read info header", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ return NULL;
+ }
+
+ image->sizeX = tga.header[1] * 256 + tga.header[0];
+ image->sizeY = tga.header[3] * 256 + tga.header[2];
+ image->bpp = tga.header[4];
+ tga.Width = image->sizeX;
+ tga.Height = image->sizeY;
+ tga.Bpp = image->bpp;
+
+ if((image->sizeX <= 0) || (image->sizeY <= 0) || ((image->bpp != 24) && (image->bpp !=32)))
+ {
+ MessageBox(NULL, "Invalid texture information", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ return NULL;
+ }
+
+ tga.bytesPerPixel = (tga.Bpp / 8);
+ tga.imageSize = (tga.bytesPerPixel * tga.Width * tga.Height);
+ image->data = (GLubyte *)malloc(tga.imageSize);
+
+ if(image->data == NULL)
+ {
+ MessageBox(NULL, "Could not allocate memory for image", "ERROR", MB_OK);
+ fclose(fTGA);
+ return NULL;
+ }
+
+ GLuint pixelcount = tga.Height * tga.Width;
+ GLuint currentpixel = 0;
+ GLuint currentbyte = 0;
+ GLubyte * colorbuffer = (GLubyte *)malloc(tga.bytesPerPixel);
+
+ do
+ {
+ GLubyte chunkheader = 0;
+
+ if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0)
+ {
+ MessageBox(NULL, "Could not read RLE header", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+ return NULL;
+ }
+
+ if(chunkheader < 128)
+ {
+ chunkheader++;
+ for(short counter = 0; counter < chunkheader; counter++)
+ {
+ if(fread(colorbuffer, 1, tga.bytesPerPixel, fTGA) != tga.bytesPerPixel)
+ {
+ MessageBox(NULL, "Could not read image data", "ERROR", MB_OK);
+
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+
+ if(colorbuffer != NULL)
+ {
+ free(colorbuffer);
+ }
+
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+
+ return NULL;
+ }
+
+ image->data[currentbyte ] = colorbuffer[2];
+ image->data[currentbyte + 1 ] = colorbuffer[1];
+ image->data[currentbyte + 2 ] = colorbuffer[0];
+
+ if(tga.bytesPerPixel == 4)
+ {
+ image->data[currentbyte + 3] = colorbuffer[3];
+ }
+
+ currentbyte += tga.bytesPerPixel;
+ currentpixel++;
+
+ if(currentpixel > pixelcount)
+ {
+ MessageBox(NULL, "Too many pixels read", "ERROR", NULL);
+
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+
+ if(colorbuffer != NULL)
+ {
+ free(colorbuffer);
+ }
+
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+
+ return NULL;
+ }
+ }
+ }
+ else
+ {
+ chunkheader -= 127;
+ if(fread(colorbuffer, 1, tga.bytesPerPixel, fTGA) != tga.bytesPerPixel)
+ {
+ MessageBox(NULL, "Could not read from file", "ERROR", MB_OK);
+
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+
+ if(colorbuffer != NULL)
+ {
+ free(colorbuffer);
+ }
+
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+
+ return NULL;
+ }
+
+ for(short counter = 0; counter < chunkheader; counter++)
+ {
+ image->data[currentbyte ] = colorbuffer[2];
+ image->data[currentbyte + 1 ] = colorbuffer[1];
+ image->data[currentbyte + 2 ] = colorbuffer[0];
+
+ if(tga.bytesPerPixel == 4)
+ {
+ image->data[currentbyte + 3] = colorbuffer[3];
+ }
+
+ currentbyte += tga.bytesPerPixel;
+ currentpixel++;
+
+ if(currentpixel > pixelcount)
+ {
+ MessageBox(NULL, "Too many pixels read", "ERROR", NULL);
+
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+
+ if(colorbuffer != NULL)
+ {
+ free(colorbuffer);
+ }
+
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+
+ return NULL;
+ }
+ }
+ }
+ }
+
+ while(currentpixel < pixelcount);
+ fclose(fTGA);
+ return image;
+}
+
+
+/*
+TextureImage* LoadTGA(const char * filename)
+{
+ TGAHeader tgaheader;
+ TextureImage* image;
+ std::string errmsg;
+ FILE* file = fopen(filename, "rb");
+
+ if(file == NULL)
+ {
+ errmsg = "Could not open texture file ";
+ errmsg = errmsg + filename;
+ MessageBox(NULL, errmsg.c_str(), "ERROR", MB_OK);
+ return NULL;
+ }
+
+ if(fread(&tgaheader, sizeof(TGAHeader), 1, file) == 0)
+ {
+ MessageBox(NULL, "Could not read file header", "ERROR", MB_OK);
+ if(file != NULL)
+ fclose(file);
+ return NULL;
+ }
+
+ if(memcmp(uTGAcompare, &tgaheader, sizeof(tgaheader)) == 0)
+ image = LoadUncompressedTGA(file);
+ else if(memcmp(cTGAcompare, &tgaheader, sizeof(tgaheader)) == 0)
+ image = LoadCompressedTGA(file);
+ else
+ {
+ MessageBox(NULL, "TGA file must be type 2 or type 10 ", "Invalid Image", MB_OK);
+ fclose(file);
+ return NULL;
+ }
+ return image;
+}
+
+TextureImage* LoadUncompressedTGA(FILE * fTGA)
+{
+ TGA tga;
+ TextureImage* image = new TextureImage;
+
+ if(fread(tga.header, sizeof(tga.header), 1, fTGA) == 0)
+ {
+ MessageBox(NULL, "Could not read info header", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ return NULL;
+ }
+
+ image->sizeY = tga.header[1] * 256 + tga.header[0];
+ image->sizeX = tga.header[3] * 256 + tga.header[2];
+ image->bpp = tga.header[4];
+ tga.Width = image->sizeX;
+ tga.Height = image->sizeY;
+ tga.Bpp = image->bpp;
+
+ if((image->sizeX <= 0) || (image->sizeY <= 0) || ((image->bpp != 24) && (image->bpp !=32)))
+ {
+ MessageBox(NULL, "Invalid texture information", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ return NULL;
+ }
+
+ if(image->bpp == 24)
+ {
+ image->type = GL_RGB;
+ }
+ else
+ {
+ image->type = GL_RGBA;
+ }
+
+ tga.bytesPerPixel = (tga.Bpp / 8);
+ tga.imageSize = (tga.bytesPerPixel * tga.Width * tga.Height);
+ image->data = (GLubyte *)malloc(tga.imageSize);
+
+ if(image->data == NULL)
+ {
+ MessageBox(NULL, "Could not allocate memory for image", "ERROR", MB_OK);
+ fclose(fTGA);
+ return NULL;
+ }
+
+ if(fread(image->data, 1, tga.imageSize, fTGA) != tga.imageSize)
+ {
+ MessageBox(NULL, "Could not read image data", "ERROR", MB_OK);
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+ fclose(fTGA);
+ return NULL;
+ }
+
+
+ for(GLuint cswap = 0; cswap < (int)tga.imageSize; cswap += tga.bytesPerPixel)
+ {
+ image->data[cswap] ^= image->data[cswap+2] ^=
+ image->data[cswap] ^= image->data[cswap+2];
+ }
+
+ fclose(fTGA);
+ return image;
+}
+
+TextureImage* LoadCompressedTGA(FILE * fTGA)
+{
+ TextureImage* image = new TextureImage;
+ TGA tga;
+
+ if(fread(tga.header, sizeof(tga.header), 1, fTGA) == 0)
+ {
+ MessageBox(NULL, "Could not read info header", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ return NULL;
+ }
+
+ image->sizeX = tga.header[1] * 256 + tga.header[0];
+ image->sizeY = tga.header[3] * 256 + tga.header[2];
+ image->bpp = tga.header[4];
+ tga.Width = image->sizeX;
+ tga.Height = image->sizeY;
+ tga.Bpp = image->bpp;
+
+ if((image->sizeX <= 0) || (image->sizeY <= 0) || ((image->bpp != 24) && (image->bpp !=32)))
+ {
+ MessageBox(NULL, "Invalid texture information", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ return NULL;
+ }
+
+ tga.bytesPerPixel = (tga.Bpp / 8);
+ tga.imageSize = (tga.bytesPerPixel * tga.Width * tga.Height);
+ image->data = (GLubyte *)malloc(tga.imageSize);
+
+ if(image->data == NULL)
+ {
+ MessageBox(NULL, "Could not allocate memory for image", "ERROR", MB_OK);
+ fclose(fTGA);
+ return NULL;
+ }
+
+ GLuint pixelcount = tga.Height * tga.Width;
+ GLuint currentpixel = 0;
+ GLuint currentbyte = 0;
+ GLubyte * colorbuffer = (GLubyte *)malloc(tga.bytesPerPixel);
+
+ do
+ {
+ GLubyte chunkheader = 0;
+
+ if(fread(&chunkheader, sizeof(GLubyte), 1, fTGA) == 0)
+ {
+ MessageBox(NULL, "Could not read RLE header", "ERROR", MB_OK);
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+ return NULL;
+ }
+
+ if(chunkheader < 128)
+ {
+ chunkheader++;
+ for(short counter = 0; counter < chunkheader; counter++)
+ {
+ if(fread(colorbuffer, 1, tga.bytesPerPixel, fTGA) != tga.bytesPerPixel)
+ {
+ MessageBox(NULL, "Could not read image data", "ERROR", MB_OK);
+
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+
+ if(colorbuffer != NULL)
+ {
+ free(colorbuffer);
+ }
+
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+
+ return NULL;
+ }
+
+ image->data[currentbyte ] = colorbuffer[2];
+ image->data[currentbyte + 1 ] = colorbuffer[1];
+ image->data[currentbyte + 2 ] = colorbuffer[0];
+
+ if(tga.bytesPerPixel == 4)
+ {
+ image->data[currentbyte + 3] = colorbuffer[3];
+ }
+
+ currentbyte += tga.bytesPerPixel;
+ currentpixel++;
+
+ if(currentpixel > pixelcount)
+ {
+ MessageBox(NULL, "Too many pixels read", "ERROR", NULL);
+
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+
+ if(colorbuffer != NULL)
+ {
+ free(colorbuffer);
+ }
+
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+
+ return NULL;
+ }
+ }
+ }
+ else
+ {
+ chunkheader -= 127;
+ if(fread(colorbuffer, 1, tga.bytesPerPixel, fTGA) != tga.bytesPerPixel)
+ {
+ MessageBox(NULL, "Could not read from file", "ERROR", MB_OK);
+
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+
+ if(colorbuffer != NULL)
+ {
+ free(colorbuffer);
+ }
+
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+
+ return NULL;
+ }
+
+ for(short counter = 0; counter < chunkheader; counter++)
+ {
+ image->data[currentbyte ] = colorbuffer[2];
+ image->data[currentbyte + 1 ] = colorbuffer[1];
+ image->data[currentbyte + 2 ] = colorbuffer[0];
+
+ if(tga.bytesPerPixel == 4)
+ {
+ image->data[currentbyte + 3] = colorbuffer[3];
+ }
+
+ currentbyte += tga.bytesPerPixel;
+ currentpixel++;
+
+ if(currentpixel > pixelcount)
+ {
+ MessageBox(NULL, "Too many pixels read", "ERROR", NULL);
+
+ if(fTGA != NULL)
+ {
+ fclose(fTGA);
+ }
+
+ if(colorbuffer != NULL)
+ {
+ free(colorbuffer);
+ }
+
+ if(image->data != NULL)
+ {
+ free(image->data);
+ }
+
+ return NULL;
+ }
+ }
+ }
+ }
+
+ while(currentpixel < pixelcount);
+ fclose(fTGA);
+ return image;
+}
+*/
\ No newline at end of file
diff --git a/src/vector.cpp b/src/vector.cpp
new file mode 100644
index 0000000..a2a0394
--- /dev/null
+++ b/src/vector.cpp
@@ -0,0 +1,163 @@
+#include "../include/vector.h"
+
+Vec3d::Vec3d()
+{
+ x=0.0f;
+ y=0.0f;
+ z=0.0f;
+}
+
+Vec3d::Vec3d(const Vec3d& orig)
+{
+ operator=(orig);
+}
+
+Vec3d::Vec3d(double xr=0, double zr=0)
+{
+ x=(double)sin(90-xr);
+ y=(double)sin(xr);
+ z=(double)(y*tan(zr));
+}
+
+Vec3d::Vec3d(double X, double Y, double Z)
+{
+ x = X;
+ y = Y;
+ z = Z;
+}
+
+double Vec3d::lengthsquared()const
+{
+ return (x*x+y*y+z*z);
+}
+
+double Vec3d::length() const
+{
+ return (double)sqrt(lengthsquared());
+}
+
+void Vec3d::normalize()
+{
+ x/=length();
+ y/=length();
+ z/=length();
+}
+
+void Vec3d::operator=(const Vec3d& v)
+{
+ x = v.x;
+ y = v.y;
+ z = v.z;
+}
+
+Vec3d Vec3d::cross(const Vec3d& v) const
+{
+ return Vec3d(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
+}
+
+Vec3d Vec3d::operator*(const Vec3d& v) const
+{
+ return Vec3d(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
+}
+
+Vec3d Vec3d::operator+(const Vec3d& v)const
+{
+ return Vec3d(x+v.x, y+v.y, z+v.z);
+}
+
+Vec3d Vec3d::operator*(double f) const
+{
+ return Vec3d(x*f, y*f, z*f);
+}
+
+Vec3d Vec3d::operator-(const Vec3d& v)const
+{
+ return Vec3d(x-v.x, y-v.y, z-v.z);
+}
+
+Vec3d Vec3d::operator/(double k) const
+{
+ return Vec3d(x/k, y/k, z/k);
+}
+
+Vec3d Vec3d::normalized() const
+{
+ return Vec3d(x/length(), y/length(), z/length());
+}
+
+
+Vec2f::Vec2f()
+{
+ x=0;
+ y=0;
+}
+
+Vec2f::Vec2f(const Vec2f& rtOp)
+{
+ x=rtOp.x;
+ y=rtOp.y;
+}
+
+Vec2f Vec2f::cross(const Vec2f& rtOp) const
+{
+ return Vec2f(y-rtOp.y, rtOp.x-x);
+}
+
+double Vec2f::length()const
+{
+ return sqrt(x*x+y*y);
+}
+
+double Vec2f::lengthsquared()const
+{
+ return (x*x+y*y);
+}
+
+void Vec2f::normalize()
+{
+ x/=(float)length();
+ y/=(float)length();
+}
+
+Vec2f Vec2f::normalized() const
+{
+ return Vec2f(x/length(), y/length());
+}
+
+Vec2f Vec2f::operator*(double rtOp) const
+{
+ return Vec2f(x*rtOp, y*rtOp);
+}
+
+Vec2f Vec2f::operator+(const Vec2f& rtOp) const
+{
+ return Vec2f(x+rtOp.x, y+rtOp.y);
+}
+
+Vec2f Vec2f::operator*(const Vec2f& rtOp) const
+{
+ return Vec2f(x*rtOp.x, y*rtOp.y);
+}
+
+Vec2f Vec2f::operator-(const Vec2f& rtOp) const
+{
+ return Vec2f(x-rtOp.x, y-rtOp.y);
+}
+
+Vec2f Vec2f::operator/(double rtOp) const
+{
+ return Vec2f(x/rtOp, y/rtOp);
+}
+
+Vec2f Vec2f::operator=(const Vec2f& rtOp)
+{
+ x=rtOp.x;
+ y=rtOp.x;
+ return Vec2f(x,y);
+}
+
+Vec2f::Vec2f(double X, double Y)
+{
+ x=(float)X;
+ y=(float)Y;
+}
\ No newline at end of file
diff --git a/vc70.idb b/vc70.idb
new file mode 100644
index 0000000..2dddf5a
Binary files /dev/null and b/vc70.idb differ