Merge branch 'master' of github.com:OpenMW/openmw

deque
MiroslavR 10 years ago
commit 3823e36f05

1
.gitignore vendored

@ -37,6 +37,7 @@ resources
/omwlauncher
/openmw
/opencs
/niftest
## generated objects
apps/openmw/config.hpp

@ -0,0 +1,139 @@
Adam Hogan <comrade@comrade-desktop.(none)>
Aleksandar Jovanov <ajovanov93@yahoo.com>
Alexander Olofsson <ace@haxalot.com>
Alex McKibben <mckibbenta@gmail.com>
Alex "rainChu" Haddad <alx1213@gmail.com>
Ardekantur <greystone@ardekantur.com>
Armin Preiml <b.nutzer@gmail.com>
Artem Kotsynyak <greye@carceri>
Arthur Moore <arthur@Behemoth>
Arthur Moore <Arthur.Moore.git@cd-net.net>
athile <athile@athile.net>
athile <athile.g@gmail.com>
Stefan Galowicz <bogglez@the.mind>
Bret Curtis <psi29a@gmail.com>
Britt Mathis <britt.mathis@gmail.com>
Sandy Carter <bwrsandman@gmail.com>
Sandy Carter <mr.sandy.carter@gmail.com>
Carl Maxwell <carl.maxwell@gmail.com>
cc9cii <cc9c@iinet.net.au>
Cory F. Cohen <cfcohen@verizon.net>
Chris Robinson <chris.kcat@gmail.com>
Cris Mihalache <mirceam94@hotmail.com>
darkf <lw9k123@gmail.com>
Diggory Hardy <diggory.hardy@gmail.com>
Thomas Luppi <ThomasLuppi@gmail.com>
Thomas Luppi <tluppi@thomas-GE60.(none)>
Dmitriy 'Endorph' Shkurskiy <end0rph@hotmail.com>
Dmitry Marakasov <amdmi3@amdmi3.ru>
Douglas Diniz <dgdiniz@gmail.com>
Douglas Mencken <dougmencken@gmail.com>
Edmondo Tommasina <edmondo.tommasina@gmail.com>
Eduard Cot <eduard@eduard-iMac.(none)>
Eli2 <fabian@fabian-desktop.(none)>
Emanuel Guével <guevel.emanuel@gmail.com>
Leon Saunders <LeonDavidSaunders@gmail.com>
Fil Krynicki <filipkrynicki@gmail.com>
John Blomberg <johnblo@kth.se>
Gašper Sedej <gsedej@gmail.com>
Michał Bień <michal1.bien@gmail.com>
Joel Graff <monograff76@gmail.com>
Paul McElroy <pcm1123@gmail.com>
Artem Kotsynyak <greye@carceri>
Artem Kotsynyak <greye@null.net>
gugus <gus_512@hotmail.com>
guidoj <guido@thuisbasis.net>
gus <gus_512@hotmail.com>
Hallfaer Tuilinn <gijsbertth@gmail.com>
Julian Ospald <julian.ospald@googlemail.com>
Jacob Essex <jacob@jacobessex.com>
Jan Borsodi <jborsodi@gmail.com>
Jan-Peter Nilsson <peppe@pappkartong.se>
Jason Hooks <Hooks@.(none)>
Jason Hooks <jason@Jason-ThinkPad-R61.(none)>
Jason Hooks <jhooks1@mix.wvu.edu>
Jeffrey Haines <jeffhaines@me.com>
Jeffrey Haines <jib-y@users.noreply.github.com>
Jordan Ayers <jordan.ayers@gmail.com>
Jordan Milne <jordan.milne@saynotolinux.com>
Josua Grawitter <josh@greyage.org>
Julien Voisin <pouicpouicpouic@gmail.com>
Karl-Felix Glatzer <karl.glatzer@gmx.de>
Chris Robinson <chris.kcat@gmail.com>
Kevin Poitra <pupkev@yahoo.com>
Roman Proskuryakov <humbug@deeptown.org>
Lars Söderberg <lazze_1983@hotmail.com>
lazydev <lazydev@homecomp>
lazydev <lazydev@nomail>
Lukasz Gromanowski <lgromanowski@gmail.com>
Marc Bouvier <marcrbouvier@gmail.com>
Marcin Hulist <Gohan1989@gmail.com>
Marc Zinnschlag <marc@zpages.de>
Marek Kochanowicz <herr@mikrus.pl>
Marek Kochanowicz <marek@localhost.localdomain>
Marek Kochanowicz <sirherrbatka@gmail.com>
Mark Siewert <mark.siewert@t-online.de>
Mark Siewert <ms@cerebra.localdomain>
megaton <9megaton6@gmail.com>
Michael Mc Donnell <michael@mcdonnell.dk>
Michael Papageorgiou <werdanith@yahoo.gr>
Michal Sciubidlo <michal.sciubidlo@gmail.com>
Michał Ściubidło <michal.sciubidlo@gmail.com>
Nathan Jeffords <blunted2night@gmail.com>
Nicolay Korslund <korslund@gmail.com>
Nicolay Korslund <nicolayk@met.no>
Nikolay Kasyanov <corrmage@gmail.com>
pchan3 <chantlerpeter@gmail.com>
Pieter van der Kloet <pvdkloet@gmail.com>
Mateusz Kołaczek <mateusz.kolaczek@gmail.com>
Bret Curtis <psi29a@gmail.com>
Pieter van der Kloet <pvdkloet@gmail.com>
Rohit Nirmal <rohitnirmal9@gmail.com>
Roman Melnik <kromgart@gmail.com>
Radu-Marius Popovici <rpopovici@github.com>
Sandy Carter <bwrsandman@gmail.com>
Scott Howard <showard314@gmail.com>
Jannik Heller <scrawl@baseoftrash.de>
Jannik Heller <scrawl@scrawl-laptop.(none)>
Sebastian Wick <sebastian@sebastianwick.net>
Sebastian Wick <wick.sebastian@gmail.com>
Sergey Shambir <sergey.shambir.auto@gmail.com>
sergoz <parapvr@yandex.ru>
Chris Boyce <slothlife@users.noreply.github.com>
Star-Demon <starsickle@yahoo.com>
Sylvain Thesnieres <garvek@gmail.com>
Thomas Luppi <digrules@gmail.com>
Thomas Luppi <tluppi@thomas-GE60.(none)>
Thoronador <thoronador@users.sourceforge.net>
TomKoenderink <tom_koenderink-github@omniadicta.net>
Tom Mason <wheybags@wheybags.com>
Torben Carrington <torbenlcarrington@Gmail.com>
Vincent Heuken <vincent@vincentheuken.com>
Manuel Edelmann <edelmann.manuel@gmail.com>
Manuel Edelmann <vorenon@hotmail.com>
Alexander Nadeau <wareya@gmail.com>
Michael Hogan <mr.michaelhogan@gmail.com>
Jacob Essex <github@JacobEssex.com>
Yuri Krupenin <yuri.krupenin@gmail.com>
Bret Curtis <noone@your.box>
sirherrbatka <herr@localhost.localdomain>
sirherrbatka <sirherrbatka@myopera.com>
sergei <sergei@ubuntu.(none)>
riothamus <digimars@gmail.com>
nobrakal <nobrakal@gmail.com>
nkorslund <nkorslund@ea6a568a-9f4f-0410-981a-c910a81bb256>
mrcheko <cheko@sevas.ua>
Miroslav Puda <pakanek@gmail.com>
MiroslavR <miroslavr256@gmail.com>
mckibbenta <mckibbenta@gmail.com>
jeaye <jeaye@arrownext.com>
eroen <eroen@falcon.eroen.eu>
eroen <eroen@occam.eroen.eu>
dreamer-dead <dreamer.dead@gmail.com>
crysthala <crystalsoulslayer@gmail.com>
Berulacks <beru@eml.cc>
Axujen <axujen@gmail.com>
root <root@debian>
unknown <Hooks@.(none)>

@ -77,6 +77,7 @@ option(BUILD_MWINIIMPORTER "build MWiniImporter" ON)
option(BUILD_OPENCS "build OpenMW Construction Set" ON)
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest ang GMock frameworks" OFF)
option(BUILD_NIFTEST "build nif file tester" OFF)
# OS X deployment
option(OPENMW_OSX_DEPLOYMENT OFF)
@ -396,6 +397,9 @@ IF(NOT WIN32 AND NOT APPLE)
IF(BUILD_OPENCS)
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/opencs" DESTINATION "${BINDIR}" )
ENDIF(BUILD_OPENCS)
IF(BUILD_NIFTEST)
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/niftest" DESTINATION "${BINDIR}" )
ENDIF(BUILD_NIFTEST)
# Install licenses
INSTALL(FILES "docs/license/DejaVu Font License.txt" DESTINATION "${LICDIR}" )
@ -512,6 +516,11 @@ add_subdirectory (extern/sdl4ogre)
# Components
add_subdirectory (components)
#Testing
if (BUILD_NIFTEST)
add_subdirectory(components/nif/tests/)
endif(BUILD_NIFTEST)
# Apps and tools
add_subdirectory( apps/openmw )

@ -111,7 +111,7 @@ namespace MWScript
const std::string& name, char type) const
{
int index = MWBase::Environment::get().getScriptManager()->getLocals (scriptId).
search (type, name);
searchIndex (type, name);
if (index!=-1)
return index;

@ -528,11 +528,12 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr actor = R()(runtime, false);
std::string factionID = "";
if(arg0==0)
{
MWWorld::Ptr actor = R()(runtime);
factionID = getDialogueActorFaction(actor);
}
else
@ -562,11 +563,12 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr actor = R()(runtime, false);
std::string factionID = "";
if(arg0==0)
{
MWWorld::Ptr actor = R()(runtime);
factionID = getDialogueActorFaction(actor);
}
else
@ -602,11 +604,12 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr actor = R()(runtime, false);
std::string factionID = "";
if(arg0==0)
{
MWWorld::Ptr actor = R()(runtime);
factionID = getDialogueActorFaction(actor);
}
else
@ -637,6 +640,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
std::string factionID = "";
if(arg0 >0)
{
@ -645,8 +650,6 @@ namespace MWScript
}
else
{
MWWorld::Ptr ptr = R()(runtime);
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
{
factionID = "";
@ -750,6 +753,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
std::string factionId;
if (arg0==1)
@ -759,8 +764,6 @@ namespace MWScript
}
else
{
MWWorld::Ptr ptr = R()(runtime);
if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty())
factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first;
}
@ -783,6 +786,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
@ -795,8 +800,6 @@ namespace MWScript
}
else
{
MWWorld::Ptr ptr = R()(runtime);
if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty())
factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first;
}
@ -818,6 +821,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
@ -830,8 +835,6 @@ namespace MWScript
}
else
{
MWWorld::Ptr ptr = R()(runtime);
if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty())
factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first;
}
@ -913,6 +916,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
std::string factionID = "";
if(arg0 >0 )
{
@ -921,8 +926,6 @@ namespace MWScript
}
else
{
MWWorld::Ptr ptr = R()(runtime);
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
{
factionID = "";
@ -952,6 +955,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
std::string factionID = "";
if(arg0 >0 )
{
@ -960,7 +965,6 @@ namespace MWScript
}
else
{
MWWorld::Ptr ptr = R()(runtime);
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
{
factionID = "";
@ -985,6 +989,8 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
{
MWWorld::Ptr ptr = R()(runtime, false);
std::string factionID = "";
if(arg0 >0 )
{
@ -993,7 +999,6 @@ namespace MWScript
}
else
{
MWWorld::Ptr ptr = R()(runtime);
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
{
factionID = "";

@ -1,6 +1,8 @@
#include "lineparser.hpp"
#include <memory>
#include <components/misc/stringops.hpp>
#include "scanner.hpp"
@ -120,7 +122,7 @@ namespace Compiler
if (mState==SetMemberVarState)
{
mMemberName = name;
mMemberName = Misc::StringUtils::lowerCase (name);
std::pair<char, bool> type = getContext().getMemberType (mMemberName, mName);
if (type.first!=' ')
@ -297,7 +299,12 @@ namespace Compiler
try
{
ErrorDowngrade errorDowngrade (getErrorHandler());
// workaround for broken positioncell instructions.
/// \todo add option to disable this
std::auto_ptr<ErrorDowngrade> errorDowngrade (0);
if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell")
errorDowngrade.reset (new ErrorDowngrade (getErrorHandler()));
std::vector<Interpreter::Type_Code> code;
optionals = mExprParser.parseArguments (argumentType, scanner, code);
mCode.insert (mCode.begin(), code.begin(), code.end());

@ -15,8 +15,6 @@ namespace Compiler
std::vector<std::string> mLongs;
std::vector<std::string> mFloats;
int searchIndex (char type, const std::string& name) const;
std::vector<std::string>& get (char type);
public:
@ -27,9 +25,11 @@ namespace Compiler
int getIndex (const std::string& name) const;
///< return index for local variable \a name (-1: does not exist).
bool search (char type, const std::string& name) const;
/// Return index for local variable \a name of type \a type (-1: variable does not
/// exit).
bool search (char type, const std::string& name) const;
int searchIndex (char type, const std::string& name) const;
const std::vector<std::string>& get (char type) const;

@ -1,5 +1 @@
niftool
*_test
*.nif
*.kf
output.txt
*.log

@ -0,0 +1,19 @@
set(NIFTEST
niftest.cpp
)
source_group(components\\nif\\tests FILES ${NIFTEST})
# Main executable
add_executable(niftest
${NIFTEST}
)
target_link_libraries(niftest
${Boost_LIBRARIES}
components
)
if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(niftest gcov)
endif()

@ -1,12 +0,0 @@
GCC=g++
all: niftool nif_bsa_test
niftool: niftool.cpp ../nif_file.hpp ../nif_file.cpp ../record.hpp
$(GCC) $< ../nif_file.cpp ../../tools/stringops.cpp -o $@
nif_bsa_test: nif_bsa_test.cpp ../nif_file.cpp ../../bsa/bsa_file.cpp ../../tools/stringops.cpp
$(GCC) $^ -o $@
clean:
rm niftool *_test

@ -1,30 +0,0 @@
/*
Runs NIFFile through all the NIFs in Morrowind.bsa.
*/
#include "../nif_file.hpp"
#include "../../bsa/bsa_file.hpp"
#include "../../tools/stringops.hpp"
#include <iostream>
using namespace Mangle::Stream;
using namespace std;
using namespace Nif;
int main(int argc, char **args)
{
BSAFile bsa;
cout << "Reading Morrowind.bsa\n";
bsa.open("../../data/Morrowind.bsa");
const BSAFile::FileList &files = bsa.getList();
for(int i=0; i<files.size(); i++)
{
const char *n = files[i].name;
if(!ends(n, ".nif")) continue;
cout << "Decoding " << n << endl;
NIFFile nif(bsa.getFile(n), n);
}
}

@ -0,0 +1,96 @@
///Program to test .nif files both on the FileSystem and in BSA archives.
#include "../niffile.hpp"
#include "../../bsa/bsa_file.hpp"
#include "../../bsa/bsa_archive.hpp"
#include <OgreRoot.h>
#include <OgreResourceGroupManager.h>
#include <iostream>
#include <algorithm>
#include <exception>
///See if the file has the named extension
bool hasExtension(std::string filename, std::string extensionToFind)
{
std::string extension = filename.substr(filename.find_last_of(".")+1);
//Convert strings to lower case for comparison
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
std::transform(extensionToFind.begin(), extensionToFind.end(), extensionToFind.begin(), ::tolower);
if(extension == extensionToFind)
return true;
else
return false;
}
///See if the file has the "nif" extension.
bool isNIF(std::string filename)
{
return hasExtension(filename,"nif");
}
///See if the file has the "bsa" extension.
bool isBSA(std::string filename)
{
return hasExtension(filename,"bsa");
}
///Check all the nif files in the given BSA archive
void readBSA(std::string filename)
{
Bsa::BSAFile bsa;
bsa.open(filename.c_str());
const Bsa::BSAFile::FileList &files = bsa.getList();
Bsa::addBSA(filename,"Bsa Files");
for(unsigned int i=0; i<files.size(); i++)
{
std::string name = files[i].name;
if(isNIF(name))
{
//std::cout << "Decoding " << name << std::endl;
Nif::NIFFile temp_nif(name);
}
}
}
int main(int argc, char **argv)
{
//Need this for Ogre's getSingleton
new Ogre::Root("", "", "niftest.log");
Ogre::ResourceGroupManager::getSingleton ().createResourceGroup ("Bsa Files");
//Needed to read files from file system
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/", "FileSystem");
// Initialize the resource groups:
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
std::cout << "Reading Files" << std::endl;
for(int i = 1; i<argc;i++)
{
std::string name = argv[i];
try{
if(isNIF(name))
{
//std::cout << "Decoding " << name << std::endl;
Nif::NIFFile temp_nif(name);
}
else if(isBSA(name))
{
std::cout << "Reading " << name << std::endl;
readBSA(name);
}
else
{
std::cerr << "ERROR: \"" << name << "\" is not a nif or bsa file!" << std::endl;
}
}
catch (std::exception& e)
{
std::cerr << "ERROR, an exception has occured" << e.what() << std::endl;
}
}
return 0;
}

File diff suppressed because it is too large Load Diff

@ -1,18 +1,15 @@
#!/bin/bash
make || exit
#Script to test all nif files (both loose, and in BSA archives) in data files directory
mkdir -p output
DATAFILESDIR="$1"
PROGS=*_test
find "$DATAFILESDIR" -iname *bsa > nifs.txt
find "$DATAFILESDIR" -iname *nif >> nifs.txt
for a in $PROGS; do
if [ -f "output/$a.out" ]; then
echo "Running $a:"
./$a | diff output/$a.out -
else
echo "Creating $a.out"
./$a > "output/$a.out"
git add "output/$a.out"
fi
done
sed -e 's/.*/\"&\"/' nifs.txt > quoted_nifs.txt
xargs --arg-file=quoted_nifs.txt ../../../niftest
rm nifs.txt
rm quoted_nifs.txt

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save