mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Added script containing all GMST variables
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@66 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
7de25b0dee
commit
e5fc473731
18
esmtool.d
18
esmtool.d
@ -60,6 +60,8 @@ void main(char[][] args)
|
||||
|
||||
bool weList; // List weapons
|
||||
|
||||
bool gmst; // List game settings
|
||||
|
||||
bool numbers; // List how many there are of each record type
|
||||
|
||||
foreach(char[] a; args[1..$])
|
||||
@ -69,6 +71,7 @@ void main(char[][] args)
|
||||
else if(a == "-s") scptShow = true;
|
||||
else if(scptShow && scptName == "") scptName = a;
|
||||
|
||||
else if(a == "-g") gmst = true;
|
||||
else if(a == "-cil") ciList = true;
|
||||
else if(a == "-cel") ceList = true;
|
||||
|
||||
@ -85,8 +88,9 @@ void main(char[][] args)
|
||||
writefln("Syntax: %s [options] esm-file [esm-file ... ]", args[0]);
|
||||
writefln(" Options:");
|
||||
writefln(" -r Display all records in raw format");
|
||||
writefln(" -n List the number of each record");
|
||||
writefln(" -n List the number of each record type");
|
||||
writefln(" -sl List scripts");
|
||||
writefln(" -g List game settings (GMST)");
|
||||
writefln(" -s name Show given script");
|
||||
writefln(" -cil List interior cells");
|
||||
writefln(" -cel List exterior cells with names");
|
||||
@ -222,6 +226,18 @@ void main(char[][] args)
|
||||
writefln("Total actors: ", actors.length);
|
||||
writefln("Total cell placable items: ", cellRefs.length);
|
||||
}
|
||||
if(gmst)
|
||||
{
|
||||
foreach(a, b; gameSettings.names)
|
||||
{
|
||||
writef(a, " (");
|
||||
if(b.type == VarType.Int) writefln("int) = ", b.i);
|
||||
else if(b.type == VarType.Float) writefln("float) = ", b.f);
|
||||
else if(b.type == VarType.String) writefln("string) = '%s'", b.str);
|
||||
else writefln("no value)", cast(int)b.type);
|
||||
}
|
||||
}
|
||||
|
||||
if(scptList) foreach(a, b; scripts.names) writefln(a);
|
||||
if(ciList)
|
||||
foreach(a, b; cells.in_cells)
|
||||
|
2107
mscripts/gamesettings.mn
Normal file
2107
mscripts/gamesettings.mn
Normal file
File diff suppressed because it is too large
Load Diff
3
openmw.d
3
openmw.d
@ -35,6 +35,7 @@ import bullet.bullet;
|
||||
|
||||
import scene.celldata;
|
||||
import scene.soundlist;
|
||||
import scene.gamesettings;
|
||||
|
||||
import core.resource;
|
||||
import core.memory;
|
||||
@ -168,6 +169,8 @@ void main(char[][] args)
|
||||
// Load all ESM and ESP files
|
||||
loadTESFiles(config.gameFiles);
|
||||
|
||||
scene.gamesettings.loadGameSettings();
|
||||
|
||||
CellData cd = cellList.get();
|
||||
|
||||
foreach(char[] cName; cells)
|
||||
|
50
scene/gamesettings.d
Normal file
50
scene/gamesettings.d
Normal file
@ -0,0 +1,50 @@
|
||||
module scene.gamesettings;
|
||||
|
||||
import monster.monster;
|
||||
import esm.records : gameSettings;
|
||||
import esm.defs : VarType;
|
||||
import std.stdio;
|
||||
import std.string;
|
||||
|
||||
MonsterObject *gmstObj;
|
||||
|
||||
void loadGameSettings()
|
||||
{
|
||||
// Load the GameSettings Monster class, and create an instance.
|
||||
MonsterClass mc = new MonsterClass("GameSettings");
|
||||
MonsterObject *mo = mc.createObject;
|
||||
gmstObj = mo;
|
||||
|
||||
foreach(a, b; gameSettings.names)
|
||||
{
|
||||
assert(a == b.id);
|
||||
assert(a[0] == 'i' || a[0] == 'f' || a[0] == 's');
|
||||
|
||||
// There's three cases of variable names containing
|
||||
// spaces. Since these are so seldom, it makes more sense to
|
||||
// make special workarounds for them instead of searching every
|
||||
// string.
|
||||
char[] name = a;
|
||||
if(name.length > 13 && (name[6] == ' ' || name[5] == ' '))
|
||||
{
|
||||
name = name.replace(" ", "_");
|
||||
// Make sure we don't change the original string!
|
||||
assert(name != a);
|
||||
}
|
||||
|
||||
if(mc.sc.findVar(name) is null)
|
||||
{
|
||||
writefln("WARNING: GMST %s not supported!", name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(b.type == VarType.Int) mo.setInt(name, b.i);
|
||||
else if(b.type == VarType.Float) mo.setFloat(name, b.f);
|
||||
// TODO: At some point we will probably translate strings into
|
||||
// UTF32 at load time, so string8 will not be needed here.
|
||||
else if(b.type == VarType.String) mo.setString8(name, b.str);
|
||||
}
|
||||
|
||||
// Call the test function
|
||||
mo.call("test");
|
||||
}
|
@ -29,6 +29,9 @@ extern "C" { // the headers don't do this..
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#else
|
||||
// FIXME: This works on Ubuntu (given the switches from pkg-config),
|
||||
// but apparently there are some problems on other systems (eg
|
||||
// Archlinux).
|
||||
#include <avcodec.h>
|
||||
#include <avformat.h>
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user