mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 22:45:36 +00:00
Worked on the config system
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@10 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
c7a44f724f
commit
2f93fd25d3
16 changed files with 549 additions and 145 deletions
232
INSTALL-win32.txt
Normal file
232
INSTALL-win32.txt
Normal file
|
@ -0,0 +1,232 @@
|
|||
OpenMW - the completely unofficial reimplementation of Morrowind
|
||||
================================================================
|
||||
|
||||
Written by Nicolay Korslund
|
||||
Email: korslund@gmail.com
|
||||
WWW: http://openmw.snaptoad.com
|
||||
License: See GPL3.txt
|
||||
Current version: 0.2 (second release, very pre-alpha)
|
||||
Date: 2008 jun. 17
|
||||
|
||||
|
||||
|
||||
QUICK NOTE: You must own and install Morrowind before you can use
|
||||
OpenMW. Let me repeat that: OpenMW will NOT run if you do not have
|
||||
Morrowind installed on your system!
|
||||
|
||||
|
||||
|
||||
|
||||
New in version 0.2
|
||||
==================
|
||||
|
||||
The second release should now work with the GDC compiler (the D
|
||||
frontend for GCC) and DSSS. Since GDC is the only option for compiling
|
||||
on other Unixes, on 64 bit and on Mac, this will probably make porting
|
||||
to these platforms much easier. DSSS (a specialized D build tool) will
|
||||
hopefully make porting to Windows a lot easier.
|
||||
|
||||
To compile, you no longer use 'make'. Instead you use 'dsss build',
|
||||
which will run 'make' for you. (More details below.)
|
||||
|
||||
See the changelog at the end.
|
||||
|
||||
|
||||
|
||||
|
||||
Installation from source
|
||||
========================
|
||||
|
||||
These instructions are for the brave souls who seek to compile OpenMW
|
||||
on their own. If you are using the binary version, you can skip to the
|
||||
next section.
|
||||
|
||||
Supported platforms:
|
||||
--------------------
|
||||
|
||||
The only operating system that has been tested and is known to work is
|
||||
32bit Ubuntu Linux 8.04. Windows and other platforms have not been
|
||||
tested as of yet.
|
||||
|
||||
Dependencies:
|
||||
-------------
|
||||
|
||||
Dependencies needed to build OpenMW:
|
||||
|
||||
OGRE 1.4.5 (3d engine)
|
||||
Audiere 1.9.4 (sound engine)
|
||||
OIS-1.2.0 (input system)
|
||||
gcc and g++ (C++ compiler)
|
||||
GNU make (build tool for C++ files)
|
||||
DMD 1.030 (D compiler)
|
||||
or GDC 4.1.3 (alternative D compiler)
|
||||
Monster 0.8 (scripting language and tools)
|
||||
DSSS 0.75 (D build tool)
|
||||
curl (for DSSS)
|
||||
|
||||
The above versions are the ones I have tested recently, but other
|
||||
versions might work. OGRE and Audiere will require their own set of
|
||||
dependencies. I recommend using an automated package tool to install
|
||||
as many of these as possible. On ubuntu, try typing:
|
||||
|
||||
sudo apt-get install libogre-dev libaudiere-dev build-essential g++ curl gdc
|
||||
|
||||
This takes care of OGRE, Audiere, the C and D compilers, make and
|
||||
curl. The rest have to be installed manually. There is a libois-dev
|
||||
package in Ubuntu (OIS version 0.99), but this has NOT been tested.
|
||||
|
||||
You can find the other libraries and tools here:
|
||||
|
||||
OIS: http://sourceforge.net/projects/wgois/
|
||||
DMD: http://digitalmars.com/d/1.0/dmd-linux.html
|
||||
DSSS: http://svn.dsource.org/projects/dsss/downloads/
|
||||
Monster: http://monster.snaptoad.com/download.html
|
||||
|
||||
If you are using a DSSS binary and not compiling from source (I
|
||||
recommend the binary), make sure to get one that matches your D
|
||||
compiler. Ie. get the GDC version if you installed GDC, and the DMD
|
||||
version for DMD.
|
||||
|
||||
If you want to install Ogre and Audiere manually as well, try:
|
||||
|
||||
OGRE: http://ogre3d.org
|
||||
Audiere: http://audiere.sourceforge.net/
|
||||
|
||||
Once everything is set up correctly, you might need to alter a couple
|
||||
of lines in the Makefile. The Makefile is only used to compile the C++
|
||||
parts of OpenMW, that interfaces with Ogre, OIS and Audiere. On the
|
||||
line:
|
||||
|
||||
OGCC=g++ `pkg-config --cflags OGRE`
|
||||
|
||||
Insert the path to your OIS include directory (or leave it blank if
|
||||
you installed OIS in /usr). For example, you might add:
|
||||
|
||||
-I/home/me/my/path/to/OIS/include
|
||||
|
||||
You might also need to add other include paths or options for Ogre if
|
||||
the pkg-config command doesn't work for some reason. Mine outputs
|
||||
|
||||
$ pkg-config --cflags OGRE
|
||||
-DOGRE_GUI_GLX -DOGRE_CONFIG_LITTLE_ENDIAN -I/usr/include/OGRE
|
||||
|
||||
After you are reasonably satisfied, you can try running make manually
|
||||
to see if the C++ parts compile. When you are ready to compile the D
|
||||
parts and link it all together, type:
|
||||
|
||||
dsss build
|
||||
|
||||
If something goes terribly wrong during the build (it probably will),
|
||||
_and_ you figure out how to solve it, I would appreciate if you told
|
||||
me about it so I could update these instructions.
|
||||
|
||||
|
||||
|
||||
|
||||
Running the binary
|
||||
==================
|
||||
|
||||
The binary downloads have been compiled on a 32-bit Ubuntu 8.04 box
|
||||
with the libraries mentioned below. They might not work on other linux
|
||||
systems due to differing library setups. If this is the case, then
|
||||
your only option is to compile from source.
|
||||
|
||||
Dependencies:
|
||||
-------------
|
||||
|
||||
The binary depends on the following libraries:
|
||||
|
||||
OGRE 1.4
|
||||
Audiere 1.9.4
|
||||
OIS-1.2.0
|
||||
|
||||
and Morrowind of course. If you followed the compilation instructions
|
||||
above, you will have these already. If not, you can find them here:
|
||||
|
||||
OGRE: http://ogre3d.org
|
||||
Audiere: http://audiere.sourceforge.net/
|
||||
OIS: http://sourceforge.net/projects/wgois/
|
||||
|
||||
Alternatively (on Ubuntu 8.04) you can at least get Ogre and Audiere
|
||||
with the command:
|
||||
|
||||
sudo apt-get install libogre14 libaudiere-1.9.4
|
||||
|
||||
Configuration:
|
||||
--------------
|
||||
|
||||
Before you can run OpenMW, you have to help it find the Morrowind data
|
||||
files. The 'morro' program needs the files Morrowind.esm and
|
||||
Morrowind.bsa, and the directories Sound/ and Music/ from your
|
||||
Morrowind Data Files directory. By default it expects to find these in
|
||||
the data/ directory. (Can be changed in morro.ini.)
|
||||
|
||||
I recommend creating a symbolic link to your original Morrowind
|
||||
install. For example, if you have Morrowind installed in:
|
||||
|
||||
c:\Program Files\Bethesda Softworks\Morrowind\
|
||||
|
||||
and your windows c: drive is mounted on /media/hda1, then run the
|
||||
following command:
|
||||
|
||||
ln -s "/media/hda1/Program Files/Bethesda Softworks/Morrowind/Data Files/" data
|
||||
|
||||
Also, if you have OGRE installed in a non-standard directory (ie. NOT
|
||||
to /usr/lib/OGRE), you have to change the PluginFolder in plugins.cfg.
|
||||
|
||||
Finally, you can change screen resolution and fullscreen mode in
|
||||
ogre.cfg. (I don't recommend fullscreen mode yet, since it may mess up
|
||||
your screen and input settings if the program crashes.)
|
||||
|
||||
Running OpenMW:
|
||||
---------------
|
||||
|
||||
If Azura is with you and all the stars and planets are aligned in your
|
||||
favor, you should now be able to run OpenMW using the program called
|
||||
'morro'.
|
||||
|
||||
Write morro -h to see a list of options.
|
||||
|
||||
Running without parameters should bring you into the cave called Sud,
|
||||
or the last cell loaded. You are in free float mode. Move around with
|
||||
WASD (or arrow keys), move up and down with left shift and ctrl, exit
|
||||
with 'q' or escape.
|
||||
|
||||
To load another cell, specify the cell name on the command line. Use
|
||||
the 'esmtool' program to get a list of cells (see below.) Note that
|
||||
you must use quotation marks "" if the cell name contains spaces or
|
||||
other weird characters. Exterior cells are disabled at the moment.
|
||||
|
||||
Enjoy! ;-)
|
||||
|
||||
|
||||
|
||||
|
||||
Other included tools:
|
||||
=====================
|
||||
|
||||
esmtool - Used to inspect ES files (ESM, ESP, ESS). Run without
|
||||
arguments to get a list of options.
|
||||
|
||||
bsatool - Tool for viewing and extracting files from BSA archives.
|
||||
(Can also be used to test the NIF parser on a BSA.)
|
||||
|
||||
niftool - Decodes one or more NIF files and prints the details.
|
||||
|
||||
|
||||
|
||||
|
||||
Changelog:
|
||||
==========
|
||||
|
||||
0.3 (work in progress)
|
||||
- updated Makefile and sources for increased portability (thanks to
|
||||
Dmitry Marakasov for FreeBSD tips and testing!)
|
||||
|
||||
0.2 (2008 jun. 17) - latest release
|
||||
- compiles with gdc
|
||||
- switched to DSSS for building D code
|
||||
- includes the program esmtool
|
||||
|
||||
0.1 (2008 jun. 03)
|
||||
- first release
|
5
Makefile
5
Makefile
|
@ -4,11 +4,8 @@
|
|||
CXX?= g++
|
||||
CXXFLAGS?=
|
||||
|
||||
# Replace this path with your OIS include path
|
||||
OIS_PATH=../../../software/include
|
||||
|
||||
# Compiler settings for Ogre + OIS. Change as needed.
|
||||
OGCC=$(CXX) $(CXXFLAGS) `pkg-config --cflags OGRE` -I$(OIS_PATH)
|
||||
OGCC=$(CXX) $(CXXFLAGS) `pkg-config --cflags OGRE OIS`
|
||||
|
||||
# Compiler settings for Audiere
|
||||
AGCC=$(CXX) $(CXXFLAGS) `audiere-config --cxxflags`
|
||||
|
|
124
README.txt
Normal file
124
README.txt
Normal file
|
@ -0,0 +1,124 @@
|
|||
OpenMW - the completely unofficial reimplementation of Morrowind
|
||||
================================================================
|
||||
|
||||
Written by Nicolay Korslund
|
||||
Email: korslund@gmail.com
|
||||
WWW: http://openmw.snaptoad.com
|
||||
License: See GPL3.txt
|
||||
Current version: 0.3 (still very pre-alpha)
|
||||
Date: 2008 jul. 6
|
||||
|
||||
|
||||
|
||||
|
||||
QUICK NOTE: You must own and install Morrowind before you can use
|
||||
OpenMW. Let me repeat that: OpenMW will NOT run if you do not have
|
||||
Morrowind installed on your system!
|
||||
|
||||
|
||||
|
||||
|
||||
Release notes for 0.3
|
||||
=====================
|
||||
|
||||
This release adds support for building and running on Windows. As a
|
||||
result, the installation instructions have been split into the files
|
||||
INSTALL-win32.txt and INSTALL-linux.txt. These files cover both the
|
||||
binary packages and installation from source.
|
||||
|
||||
See also the changelog at the end.
|
||||
|
||||
Note: if you are using a localized (non-English) version of Morrowind,
|
||||
the default starting cell (Sud) might not exist, and the esmtool will
|
||||
probably fail with UTF errors, since the system currently expects UTF8
|
||||
input. This will be fixed in a future release - I have even added
|
||||
localized support as one of the major goals on the web page.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
On the immediate TODO list:
|
||||
===========================
|
||||
|
||||
- read the input files in the correct code page
|
||||
- support for Mac
|
||||
- collision detection
|
||||
- displaying creatures correcty, animation
|
||||
- rendering NPCs
|
||||
- GUI/HUD system
|
||||
- rendering outdoor scenes (exterior cells)
|
||||
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Currently supported platforms are Windows and Linux. Tested on Windows
|
||||
XP and Ubuntu 8.04.
|
||||
|
||||
For instructions, see the files INSTALL-win32.txt or
|
||||
INSTALL-linux.txt.
|
||||
|
||||
FreeBSD has also been tested but is only partially supported, due to
|
||||
sketchy D compiler support. Linux 64 bit currently does NOT work, for
|
||||
the same reason.
|
||||
|
||||
|
||||
|
||||
|
||||
Programs included in this package:
|
||||
==================================
|
||||
|
||||
openmw - The main program. Run openmw -h for a list of options.
|
||||
|
||||
esmtool - Used to inspect ES files (ESM, ESP, ESS). Run without
|
||||
arguments to get a list of options.
|
||||
|
||||
bsatool - Tool for viewing and extracting files from BSA archives.
|
||||
(Can also be used to test the NIF parser on a BSA.)
|
||||
|
||||
niftool - Decodes one or more NIF files and prints the details.
|
||||
|
||||
|
||||
|
||||
|
||||
Acknowledgements
|
||||
================
|
||||
|
||||
Thanks goes out to:
|
||||
|
||||
- The NifTools group / NIFLA for their great work on decoding the NIF
|
||||
file format.
|
||||
|
||||
- Dmitry Marakasov for testing and porting to FreeBSD.
|
||||
|
||||
- Nebelmann for continued testing on 64 bit linux.
|
||||
|
||||
- Bethesda Softworks for creating Morrowind!
|
||||
|
||||
|
||||
|
||||
|
||||
Changelog:
|
||||
==========
|
||||
|
||||
0.3 (work in progress)
|
||||
- built and tested on Windows XP
|
||||
- partial support for FreeBSD (exceptions do not work)
|
||||
- removed some config files, since these are auto-generated when
|
||||
missing
|
||||
- made the config system more robust (an Ogre config windows opened
|
||||
when needed)
|
||||
- alternatively reads config file from ~/.openmw/ on unix systems.
|
||||
- updated Makefile and sources for increased portability (thanks to
|
||||
Dmitry Marakasov.)
|
||||
|
||||
0.2 (2008 jun. 17) - latest release
|
||||
- compiles with gdc
|
||||
- switched to DSSS for building D code
|
||||
- includes the program esmtool
|
||||
|
||||
0.1 (2008 jun. 03)
|
||||
- first release
|
2
bored.d
2
bored.d
|
@ -59,7 +59,7 @@ void main()
|
|||
if(loot) writefln("You have loot.");
|
||||
if(level>1) writefln("You are level ", level);
|
||||
writefln("
|
||||
1) Kill monster
|
||||
1) Kill a monster
|
||||
2) Read a book
|
||||
3) Read an NPC
|
||||
4) Sell some loot
|
||||
|
|
149
core/config.d
149
core/config.d
|
@ -25,6 +25,7 @@ module core.config;
|
|||
|
||||
import std.string;
|
||||
import std.file;
|
||||
import std.path;
|
||||
import std.stdio;
|
||||
|
||||
import monster.util.string;
|
||||
|
@ -54,6 +55,7 @@ struct ConfigManager
|
|||
{
|
||||
IniWriter iniWriter;
|
||||
|
||||
// Sound setting
|
||||
float musicVolume;
|
||||
float sfxVolume;
|
||||
float mainVolume;
|
||||
|
@ -64,6 +66,15 @@ struct ConfigManager
|
|||
float mouseSensY;
|
||||
bool flipMouseY;
|
||||
|
||||
// Ogre configuration
|
||||
bool showOgreConfig; // The configuration setting
|
||||
// The actual result, overridable by a command line switch, and also
|
||||
// set to true if firstRun is true.
|
||||
bool finalOgreConfig;
|
||||
|
||||
// Other settings
|
||||
bool firstRun;
|
||||
|
||||
// Number of current screen shot. Saved upon exit, so that shots
|
||||
// from separate sessions don't overwrite each other.
|
||||
int screenShotNum;
|
||||
|
@ -75,6 +86,9 @@ struct ConfigManager
|
|||
char[] musDir; // Explore music
|
||||
char[] musDir2; // Battle music
|
||||
|
||||
// Configuration file
|
||||
char[] confFile = "openmw.ini";
|
||||
|
||||
// Cell to load at startup
|
||||
char[] defaultCell;
|
||||
|
||||
|
@ -133,12 +147,68 @@ struct ConfigManager
|
|||
// Initialize the key binding manager
|
||||
keyBindings.initKeys();
|
||||
|
||||
readIni();
|
||||
// On Linux / Unix, if openmw.ini is not found in the current
|
||||
// directory, use ~/openmw/openmw.ini instead.
|
||||
version(Posix)
|
||||
{
|
||||
if(!exists(confFile))
|
||||
confFile = expandTilde("~/.openmw/openmw.ini");
|
||||
}
|
||||
|
||||
if(reset) with(keyBindings)
|
||||
readIni(reset);
|
||||
|
||||
// I think DMD is on the brink of collapsing here. This has been
|
||||
// moved elsewhere, because DMD couldn't handle one more import in
|
||||
// this file.
|
||||
//updateMouseSensitivity();
|
||||
}
|
||||
|
||||
// Read config from morro.ini, if it exists. The reset parameter is
|
||||
// set to true if we should use default key bindings instead of the
|
||||
// ones from the config file.
|
||||
void readIni(bool reset)
|
||||
{
|
||||
// Read configuration file, if it exists.
|
||||
IniReader ini;
|
||||
|
||||
// TODO: Right now we have to specify each option twice, once for
|
||||
// reading and once for writing. Fix it? Nah. Don't do anything,
|
||||
// this entire configuration scheme is likely to change anyway.
|
||||
|
||||
ini.readFile(confFile);
|
||||
|
||||
screenShotNum = ini.getInt("General", "Screenshots", 0);
|
||||
mainVolume = saneVol(ini.getFloat("Sound", "Main Volume", 0.7));
|
||||
musicVolume = saneVol(ini.getFloat("Sound", "Music Volume", 0.5));
|
||||
sfxVolume = saneVol(ini.getFloat("Sound", "SFX Volume", 0.5));
|
||||
useMusic = ini.getBool("Sound", "Enable Music", true);
|
||||
|
||||
mouseSensX = ini.getFloat("Controls", "Mouse Sensitivity X", 0.2);
|
||||
mouseSensY = ini.getFloat("Controls", "Mouse Sensitivity Y", 0.2);
|
||||
flipMouseY = ini.getBool("Controls", "Flip Mouse Y Axis", false);
|
||||
|
||||
defaultCell = ini.getString("General", "Default Cell", "Sud");
|
||||
|
||||
firstRun = ini.getBool("General", "First Run", true);
|
||||
showOgreConfig = ini.getBool("General", "Show Ogre Config", false);
|
||||
|
||||
// This flag determines whether we will actually show the Ogre
|
||||
// config dialogue. The EITHER of the following are true, the
|
||||
// config box will be shown:
|
||||
// - The program is being run for the first time
|
||||
// - The "Show Ogre Config" option in openmw.ini is set.
|
||||
// - The -oc option is specified on the command line
|
||||
// - The file ogre.cfg is missing
|
||||
|
||||
finalOgreConfig = showOgreConfig || firstRun ||
|
||||
!exists("ogre.cfg");
|
||||
|
||||
// Set default key bindings if the user specified the -rk setting,
|
||||
// or if no config file was found.
|
||||
if(reset || !ini.wasRead) with(keyBindings)
|
||||
{
|
||||
// Remove all existing key bindings
|
||||
clear();
|
||||
//clear();
|
||||
|
||||
// Bind some default keys
|
||||
bind(Keys.MoveLeft, KC.A, KC.LEFT);
|
||||
|
@ -154,66 +224,41 @@ struct ConfigManager
|
|||
bind(Keys.MusVolUp, KC.N2);
|
||||
bind(Keys.SfxVolDown, KC.N3);
|
||||
bind(Keys.SfxVolUp, KC.N4);
|
||||
bind(Keys.Mute, KC.M);
|
||||
|
||||
bind(Keys.ToggleBattleMusic, KC.SPACE);
|
||||
bind(Keys.Debug, KC.G);
|
||||
|
||||
bind(Keys.Pause, KC.PAUSE, KC.P);
|
||||
bind(Keys.ScreenShot, KC.SYSRQ);
|
||||
bind(Keys.Exit, KC.Q, KC.ESCAPE);
|
||||
}
|
||||
|
||||
// I think DMD is on the brink of collapsing here. This has been
|
||||
// moved elsewhere, because DMD couldn't handle one more import in
|
||||
// this file.
|
||||
//updateMouseSensitivity();
|
||||
}
|
||||
|
||||
// Read config from morro.ini, if it exists.
|
||||
void readIni()
|
||||
{
|
||||
// Read configuration file, if it exists.
|
||||
IniReader ini;
|
||||
|
||||
// TODO: Right now we have to specify each option twice, once for
|
||||
// reading and once for writing. Fix it? Nah. Don't do anything,
|
||||
// this entire configuration scheme is likely to change anyway.
|
||||
|
||||
ini.readFile("morro.ini");
|
||||
|
||||
screenShotNum = ini.getInt("General", "Screenshots", 0);
|
||||
mainVolume = saneVol(ini.getFloat("Sound", "Main Volume", 0.7));
|
||||
musicVolume = saneVol(ini.getFloat("Sound", "Music Volume", 0.5));
|
||||
sfxVolume = saneVol(ini.getFloat("Sound", "SFX Volume", 0.5));
|
||||
useMusic = ini.getBool("Sound", "Enable Music", true);
|
||||
|
||||
mouseSensX = ini.getFloat("Controls", "Mouse Sensitivity X", 0.2);
|
||||
mouseSensY = ini.getFloat("Controls", "Mouse Sensitivity Y", 0.2);
|
||||
flipMouseY = ini.getBool("Controls", "Flip Mouse Y Axis", false);
|
||||
|
||||
defaultCell = ini.getString("General", "Default Cell", "");
|
||||
|
||||
// Read key bindings
|
||||
for(int i; i<Keys.Length; i++)
|
||||
else
|
||||
{
|
||||
char[] s = keyToString[i];
|
||||
if(s.length)
|
||||
keyBindings.bindComma(cast(Keys)i, ini.getString("Bindings", s, ""));
|
||||
// Read key bindings
|
||||
for(int i; i<Keys.Length; i++)
|
||||
{
|
||||
char[] s = keyToString[i];
|
||||
if(s.length)
|
||||
keyBindings.bindComma(cast(Keys)i, ini.getString("Bindings", s, ""));
|
||||
}
|
||||
}
|
||||
|
||||
// Read specific directories
|
||||
bsaDir = ini.getString("General", "BSA Directory", "./");
|
||||
esmDir = ini.getString("General", "ESM Directory", "./");
|
||||
sndDir = ini.getString("General", "SFX Directory", "sound/Sound/");
|
||||
musDir = ini.getString("General", "Explore Music Directory", "sound/Music/Explore/");
|
||||
musDir2 = ini.getString("General", "Battle Music Directory", "sound/Music/Battle/");
|
||||
bsaDir = ini.getString("General", "BSA Directory", "data/");
|
||||
esmDir = ini.getString("General", "ESM Directory", "data/");
|
||||
sndDir = ini.getString("General", "SFX Directory", "data/Sound/");
|
||||
musDir = ini.getString("General", "Explore Music Directory", "data/Music/Explore/");
|
||||
musDir2 = ini.getString("General", "Battle Music Directory", "data/Music/Battle/");
|
||||
}
|
||||
|
||||
// Create the config file
|
||||
void writeConfig()
|
||||
{
|
||||
writefln("In writeConfig");
|
||||
writefln("writeConfig(%s)", confFile);
|
||||
with(iniWriter)
|
||||
{
|
||||
openFile("morro.ini");
|
||||
openFile(confFile);
|
||||
|
||||
comment("Don't write your own comments in this file, they");
|
||||
comment("will disappear when the file is rewritten.");
|
||||
|
@ -226,6 +271,14 @@ struct ConfigManager
|
|||
writeInt("Screenshots", screenShotNum);
|
||||
writeString("Default Cell", defaultCell);
|
||||
|
||||
// Save the setting as it appeared in the input. The setting
|
||||
// you specify in the ini is persistent, specifying the -oc
|
||||
// parameter does not change it.
|
||||
writeBool("Show Ogre Config", showOgreConfig);
|
||||
|
||||
// The next run is never the first run.
|
||||
writeBool("First Run", false);
|
||||
|
||||
section("Controls");
|
||||
writeFloat("Mouse Sensitivity X", mouseSensX);
|
||||
writeFloat("Mouse Sensitivity Y", mouseSensY);
|
||||
|
@ -271,6 +324,10 @@ struct ConfigManager
|
|||
intuitive to try out a new mod without risking your savegame data
|
||||
or original settings. So these would be handled in a separate
|
||||
plugin manager.
|
||||
|
||||
In any case, the import should be interactive and user-driven, so
|
||||
there is no use in making it before we have a gui of some sort up
|
||||
and running.
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,43 @@
|
|||
|
||||
module core.inifile;
|
||||
|
||||
import std.stdio;
|
||||
import std.stream;
|
||||
import std.string;
|
||||
import std.path;
|
||||
import std.file;
|
||||
|
||||
import monster.util.string;
|
||||
import monster.util.aa;
|
||||
|
||||
void safeMkdir(char[] npath)
|
||||
{
|
||||
char curDir[];
|
||||
int index = 0;
|
||||
int srch;
|
||||
|
||||
do
|
||||
{
|
||||
while(npath[index..$].begins("/"))
|
||||
index++;
|
||||
|
||||
srch = npath[index..$].find('/');
|
||||
|
||||
if(srch == -1)
|
||||
curDir = npath;
|
||||
else
|
||||
{
|
||||
index += srch;
|
||||
curDir = npath[0..index];
|
||||
}
|
||||
index++;
|
||||
|
||||
if(!exists(curDir) || !isdir(curDir))
|
||||
mkdir(curDir);
|
||||
}
|
||||
while(srch != -1)
|
||||
}
|
||||
|
||||
// Writes an ini file.
|
||||
struct IniWriter
|
||||
{
|
||||
|
@ -41,12 +71,14 @@ struct IniWriter
|
|||
if(ini is null) ini = new File();
|
||||
char[] oldFile = file~".old";
|
||||
|
||||
// Windows doesn't support renaming into an existing file
|
||||
version(Windows)
|
||||
if(exists(oldFile)) remove(oldFile);
|
||||
|
||||
if(exists(file))
|
||||
rename(file, oldFile);
|
||||
copy(file, oldFile);
|
||||
|
||||
// Make sure the output directory exists
|
||||
char[] dr = getDirName(file);
|
||||
if(dr.length)
|
||||
safeMkdir(dr);
|
||||
|
||||
ini.open(file, FileMode.OutNew);
|
||||
}
|
||||
|
||||
|
@ -147,6 +179,7 @@ struct IniReader
|
|||
{
|
||||
vars.reset();
|
||||
section = null;
|
||||
wasRead = false;
|
||||
}
|
||||
|
||||
int getInt(char[] sec, char[] var, int def)
|
||||
|
@ -187,6 +220,8 @@ struct IniReader
|
|||
return def;
|
||||
}
|
||||
|
||||
bool wasRead = false;
|
||||
|
||||
void readFile(char[] fn)
|
||||
{
|
||||
// Reset this struct
|
||||
|
@ -196,6 +231,8 @@ struct IniReader
|
|||
// and default values will be used instead.
|
||||
if(!exists(fn)) return;
|
||||
|
||||
wasRead = true;
|
||||
|
||||
// Read buffer. Finite in size but perfectly safe - the readLine
|
||||
// routine allocates more mem if it needs it.
|
||||
char[300] buffer;
|
||||
|
|
14
dsss.conf
14
dsss.conf
|
@ -1,7 +1,8 @@
|
|||
###########################
|
||||
# Main program #
|
||||
###########################
|
||||
[morro.d]
|
||||
|
||||
[openmw.d]
|
||||
# Add libraries and the two C++ object files
|
||||
buildflags = -llOgreMain -llaudiere -llOIS cpp_audiere.o cpp_ogre.o
|
||||
|
||||
|
@ -16,25 +17,36 @@ version(Posix) {
|
|||
prebuild += dsss clean niftool
|
||||
|
||||
|
||||
|
||||
|
||||
###########################
|
||||
# Bsa inspection tool #
|
||||
###########################
|
||||
|
||||
[bsatool.d]
|
||||
|
||||
|
||||
|
||||
###########################
|
||||
# Esm inspection tool #
|
||||
###########################
|
||||
|
||||
[esmtool.d]
|
||||
# Because of interdepencies between the ESM code and the resource
|
||||
# manager, we have to include all the C++ stuff.
|
||||
buildflags = -llOgreMain -llaudiere -llOIS cpp_audiere.o cpp_ogre.o
|
||||
|
||||
|
||||
|
||||
###########################
|
||||
# Nif inspection tool #
|
||||
###########################
|
||||
|
||||
[niftool.d]
|
||||
buildflags = -debug=warnstd -debug=check -debug=statecheck -debug=strict -debug=verbose
|
||||
# Clean the nif object files to make sure they are recompiled in debug mode
|
||||
prebuild = dsss clean niftool
|
||||
|
||||
|
||||
|
||||
[bored.d]
|
||||
|
|
44
morro.ini
44
morro.ini
|
@ -1,44 +0,0 @@
|
|||
; Don't write your own comments in this file, they
|
||||
; will disappear when the file is rewritten.
|
||||
[General]
|
||||
ESM Directory=data/
|
||||
BSA Directory=data/
|
||||
SFX Directory=data/Sound/
|
||||
Explore Music Directory=data/Music/Explore/
|
||||
Battle Music Directory=data/Music/Battle/
|
||||
Screenshots=11
|
||||
Default Cell=Sud
|
||||
|
||||
[Controls]
|
||||
Mouse Sensitivity X=0.2
|
||||
Mouse Sensitivity Y=0.2
|
||||
Flip Mouse Y Axis=no
|
||||
|
||||
[Bindings]
|
||||
; Key bindings. The strings must match exactly.
|
||||
Move Left=a,left
|
||||
Move Right=d,right
|
||||
Turn Left=
|
||||
Turn Right=
|
||||
Move Forward=w,up
|
||||
Move Backward=s,down
|
||||
Move Up=left_shift
|
||||
Move Down=left_ctrl
|
||||
Increase Main Volume=numpad_plus
|
||||
Decrease Main Volume=numpad_minus
|
||||
Increase Music Volume=2
|
||||
Decrease Music Volume=1
|
||||
Increase SFX Volume=4
|
||||
Decrease SFX Volume=3
|
||||
Mute Sound=m
|
||||
Toggle Battle Music=space
|
||||
OGRE Test Action=g
|
||||
Pause=pause,p
|
||||
Screen Shot=print_screen
|
||||
Quick Exit=q,escape
|
||||
|
||||
[Sound]
|
||||
Main Volume=0.7
|
||||
Music Volume=0.4
|
||||
SFX Volume=0.6
|
||||
Enable Music=yes
|
|
@ -15,8 +15,8 @@ copy ..\ogre\bin\debug\cg.dll .
|
|||
copy ..\audiere\bin\audiere.dll .
|
||||
copy \windows\system32\d3dx9_30.dll d3dx9d_30.dll
|
||||
|
||||
echo Compiling main program (morro.exe)
|
||||
gdc morro.d bsa\*.d core\*.d esm\*.d input\*.d nif\*.d ogre\*.d scene\*.d sound\*.d util\*.d cpp_audiere.o cpp_ogre.o ..\monster\monster\util\*.d ..\monster\monster\minibos\*.d ..\monster\monster\minibos\c\*.d ..\monster\monster\minibos\c\windows\*.d -I..\monster ogremain_d.dll ..\audiere\lib\audiere.lib OIS_d.dll -lstdc++ -o morro.exe
|
||||
echo Compiling main program (openmw.exe)
|
||||
gdc openmw.d bsa\*.d core\*.d esm\*.d input\*.d nif\*.d ogre\*.d scene\*.d sound\*.d util\*.d cpp_audiere.o cpp_ogre.o ..\monster\monster\util\*.d ..\monster\monster\minibos\*.d ..\monster\monster\minibos\c\*.d ..\monster\monster\minibos\c\windows\*.d -I..\monster ogremain_d.dll ..\audiere\lib\audiere.lib OIS_d.dll -lstdc++ -o openmw.exe
|
||||
|
||||
echo Setting up the correct Ogre cfg files
|
||||
copy ogre.cfg.win32 ogre.cfg
|
||||
|
|
19
ogre.cfg
19
ogre.cfg
|
@ -1,19 +0,0 @@
|
|||
Render System=Direct3D9 Rendering Subsystem
|
||||
|
||||
[Direct3D9 Rendering Subsystem]
|
||||
Allow NVPerfHUD=No
|
||||
Anti aliasing=None
|
||||
Floating-point mode=Fastest
|
||||
Full Screen=No
|
||||
Rendering Device=NVIDIA Quadro NVS 135M
|
||||
VSync=No
|
||||
Video Mode=800 x 600 @ 32-bit colour
|
||||
|
||||
[OpenGL Rendering Subsystem]
|
||||
Colour Depth=32
|
||||
Display Frequency=N/A
|
||||
FSAA=0
|
||||
Full Screen=No
|
||||
RTT Preferred Mode=FBO
|
||||
VSync=No
|
||||
Video Mode=800 x 600
|
|
@ -51,8 +51,9 @@ typedef void* ManualLoader;
|
|||
extern(C):
|
||||
|
||||
// Do engine configuration. Returns 0 if we should continue, 1 if
|
||||
// not.
|
||||
int cpp_configure();
|
||||
// not. The parameter (0 or 1) determine whether an Ogre config
|
||||
// dialogue is shown.
|
||||
int cpp_configure(int showConfig);
|
||||
|
||||
// Sets up the window
|
||||
void cpp_initWindow();
|
||||
|
|
|
@ -41,7 +41,7 @@ extern "C" void cpp_cleanup()
|
|||
}
|
||||
}
|
||||
|
||||
extern "C" int32_t cpp_configure()
|
||||
extern "C" int32_t cpp_configure(int32_t showConfig)
|
||||
{
|
||||
mRoot = new Root();
|
||||
|
||||
|
@ -70,18 +70,17 @@ extern "C" int32_t cpp_configure()
|
|||
}
|
||||
}
|
||||
|
||||
// Show the configuration dialog and initialise the system
|
||||
// You can skip this and use root.restoreConfig() to load configuration
|
||||
// settings if you were sure there are valid ones saved in ogre.cfg
|
||||
// Show the configuration dialog and initialise the system, if the
|
||||
// showConfig parameter is specified. The settings are stored in
|
||||
// ogre.cfg. If the parameter is false, the settings are assumed to
|
||||
// come from ogre.cfg.
|
||||
int result;
|
||||
if(showConfig)
|
||||
result = mRoot->showConfigDialog();
|
||||
else
|
||||
result = mRoot->restoreConfig();
|
||||
|
||||
// TODO: This should be controlled through the ini file. It's
|
||||
// sensible to open the dialoge the first time, and later only
|
||||
// open it when a command line parameter is given.
|
||||
|
||||
if(mRoot->showConfigDialog())
|
||||
//if(mRoot->restoreConfig())
|
||||
return 0;
|
||||
return 1;
|
||||
return !result;
|
||||
}
|
||||
|
||||
// Initialize window. This will create and show the actual window.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
module ogre.ogre;
|
||||
|
||||
import core.resource;
|
||||
import core.config;
|
||||
|
||||
import ogre.bindings;
|
||||
import util.uniquename;
|
||||
|
@ -80,7 +81,8 @@ void setupOgre()
|
|||
{
|
||||
// Later we will send some config info from core.config along with
|
||||
// this function
|
||||
if(cpp_configure()) OgreException("Configuration abort");
|
||||
if(cpp_configure(config.finalOgreConfig))
|
||||
OgreException("Configuration abort");
|
||||
|
||||
cpp_initWindow();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Email: < korslund@gmail.com >
|
||||
WWW: http://openmw.snaptoad.com/
|
||||
|
||||
This file (morro.d) is part of the OpenMW package.
|
||||
This file (openmw.d) is part of the OpenMW package.
|
||||
|
||||
OpenMW is distributed as free software: you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
|
@ -61,6 +61,7 @@ void main(char[][] args)
|
|||
bool render = true;
|
||||
bool help = false;
|
||||
bool resetKeys = false;
|
||||
bool showOgreFlag = false;
|
||||
|
||||
// Some examples to try:
|
||||
//
|
||||
|
@ -89,6 +90,7 @@ void main(char[][] args)
|
|||
}
|
||||
else if(a == "-h") help=true;
|
||||
else if(a == "-rk") resetKeys = true;
|
||||
else if(a == "-oc") showOgreFlag = true;
|
||||
else cells ~= a;
|
||||
|
||||
if(cells.length + eCells.length/2 > 1 )
|
||||
|
@ -101,6 +103,10 @@ void main(char[][] args)
|
|||
config.initialize(resetKeys);
|
||||
scope(exit) config.writeConfig();
|
||||
|
||||
// If the -oc parameter is specified, we override any config
|
||||
// setting.
|
||||
if(showOgreFlag) config.finalOgreConfig = true;
|
||||
|
||||
if(cells.length == 0 && eCells.length == 0)
|
||||
if(config.defaultCell.length)
|
||||
cells ~= config.defaultCell;
|
||||
|
@ -115,6 +121,7 @@ void main(char[][] args)
|
|||
writefln(" -n Only load, do not render");
|
||||
writefln(" -ex,y Load exterior cell (x,y)");
|
||||
writefln(" -rk Reset key bindings to default");
|
||||
writefln(" -oc Show the Ogre config dialogue");
|
||||
writefln(" -h Show this help");
|
||||
writefln("");
|
||||
writefln("Specifying more than one cell implies -n");
|
13
plugins.cfg
13
plugins.cfg
|
@ -1,14 +1,13 @@
|
|||
# Defines plugins to load
|
||||
|
||||
# Define plugin folder
|
||||
PluginFolder=..\Ogre\bin\debug\
|
||||
PluginFolder=/usr/lib/OGRE
|
||||
|
||||
# Define plugins
|
||||
Plugin=RenderSystem_Direct3D9_d
|
||||
Plugin=RenderSystem_GL_d
|
||||
Plugin=Plugin_ParticleFX_d
|
||||
Plugin=Plugin_BSPSceneManager_d
|
||||
Plugin=Plugin_OctreeSceneManager_d
|
||||
Plugin=Plugin_CgProgramManager_d
|
||||
Plugin=RenderSystem_GL
|
||||
Plugin=Plugin_ParticleFX
|
||||
Plugin=Plugin_BSPSceneManager
|
||||
Plugin=Plugin_OctreeSceneManager
|
||||
# Plugin=Plugin_CgProgramManager
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue