Skip to content

Commit

Permalink
Merge pull request #19 from cc9cii/prepare_nif_release
Browse files Browse the repository at this point in the history
Prepare nif release
  • Loading branch information
cc9cii committed Mar 14, 2020
2 parents dee5b75 + 56d6300 commit a360dfe
Show file tree
Hide file tree
Showing 39 changed files with 2,216 additions and 188 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -581,6 +581,7 @@ add_subdirectory (extern/ogre-ffmpeg-videoplayer)
add_subdirectory (extern/oics)
add_subdirectory (extern/sdl4ogre)
add_subdirectory (extern/esm4)
add_subdirectory (extern/fglib)
add_subdirectory (extern/murmurhash)
add_subdirectory (extern/BSAOpt)

Expand Down
1 change: 1 addition & 0 deletions apps/opencs/CMakeLists.txt
Expand Up @@ -213,6 +213,7 @@ target_link_libraries(openmw-cs
${SHINY_LIBRARIES}
${ESM4_LIBRARIES}
${ZLIB_LIBRARY}
${FGLIB_LIBRARIES}
${MURMURHASH_LIBRARIES}
${BSAOPTHASH_LIBRARIES}
${Boost_SYSTEM_LIBRARY}
Expand Down
1 change: 1 addition & 0 deletions apps/openmw/CMakeLists.txt
Expand Up @@ -120,6 +120,7 @@ target_link_libraries(openmw
${ESM4_LIBRARIES}
${BSAOPTHASH_LIBRARIES}
${ZLIB_LIBRARY}
${FGLIB_LIBRARIES}
${OPENAL_LIBRARY}
${SOUND_INPUT_LIBRARY}
${BULLET_LIBRARIES}
Expand Down
12 changes: 6 additions & 6 deletions cmake/FindFFmpeg.cmake
Expand Up @@ -39,10 +39,10 @@ endif ()
#
### Macro: set_component_found
#
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
# Marks the given component as found if *_LIBRARIES is present.
#
macro(set_component_found _component )
if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
if (${_component}_LIBRARIES)
# message(STATUS " - ${_component} found.")
set(${_component}_FOUND TRUE)
else ()
Expand Down Expand Up @@ -70,8 +70,8 @@ macro(find_component _component _pkgconfig _library _header)
find_path(${_component}_INCLUDE_DIRS ${_header}
HINTS
${FFMPEGSDK_INC}
${PC_LIB${_component}_INCLUDEDIR}
${PC_LIB${_component}_INCLUDE_DIRS}
# ${PC_LIB${_component}_INCLUDEDIR}
# ${PC_LIB${_component}_INCLUDE_DIRS}
PATH_SUFFIXES
ffmpeg
)
Expand Down Expand Up @@ -122,7 +122,7 @@ if (NOT FFMPEG_LIBRARIES)
# message(STATUS "Required component ${_component} present.")
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
# list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
else ()
# message(STATUS "Required component ${_component} missing.")
endif ()
Expand Down Expand Up @@ -152,7 +152,7 @@ endforeach ()
# Compile the list of required vars
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
foreach (_component ${FFmpeg_FIND_COMPONENTS})
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES) #${_component}_INCLUDE_DIRS)
endforeach ()

# Give a nice error message if some of the required vars are missing.
Expand Down
15 changes: 10 additions & 5 deletions extern/esm4/armo.cpp
Expand Up @@ -36,7 +36,10 @@ ESM4::Armor::Armor() : mFormId(0), mFlags(0), mBoundRadius(0.f), mArmorFlags(0),
{
mEditorId.clear();
mFullName.clear();
mModel.clear();
mModelMale.clear();
mModelMaleWorld.clear();
mModelFemale.clear();
mModelFemaleWorld.clear();
mText.clear();
mIconMale.clear();
mIconFemale.clear();
Expand Down Expand Up @@ -102,12 +105,15 @@ void ESM4::Armor::load(ESM4::Reader& reader)
}
else
{
if (!reader.getZString(mModel))
if (!reader.getZString(mModelMale))
throw std::runtime_error ("ARMO MODL data read error");
}

break;
}
case ESM4::SUB_MOD2: reader.getZString(mModelMaleWorld);break;
case ESM4::SUB_MOD3: reader.getZString(mModelFemale); break;
case ESM4::SUB_MOD4: reader.getZString(mModelFemaleWorld); break;
case ESM4::SUB_ICON: reader.getZString(mIconMale); break;
case ESM4::SUB_ICO2: reader.getZString(mIconFemale); break;
case ESM4::SUB_BMDT:
Expand Down Expand Up @@ -167,9 +173,6 @@ void ESM4::Armor::load(ESM4::Reader& reader)
break;
}
case ESM4::SUB_MODT:
case ESM4::SUB_MOD2:
case ESM4::SUB_MOD3:
case ESM4::SUB_MOD4:
case ESM4::SUB_MO2B:
case ESM4::SUB_MO3B:
case ESM4::SUB_MO4B:
Expand Down Expand Up @@ -212,6 +215,8 @@ void ESM4::Armor::load(ESM4::Reader& reader)
throw std::runtime_error("ESM4::ARMO::load - Unknown subrecord " + ESM4::printName(subHdr.typeId));
}
}
//if ((mArmorFlags&0xffff) == 0x02) // only hair
//std::cout << "only hair " << mEditorId << std::endl;
}

//void ESM4::Armor::save(ESM4::Writer& writer) const
Expand Down
49 changes: 44 additions & 5 deletions extern/esm4/armo.hpp
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016, 2018, 2019 cc9cii
Copyright (C) 2016, 2018-2020 cc9cii
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -38,14 +38,15 @@ namespace ESM4

struct Armor
{
// WARN: TES4 Armorflags still has the general flags high bits
enum ArmorFlags
{
TES4_Head = 0x00000001,
TES4_Hair = 0x00000002,
TES4_UpperBody = 0x00000004,
TES4_LowerBody = 0x00000008,
TES4_Hand = 0x00000010,
TES4_Foot = 0x00000020,
TES4_Hands = 0x00000010,
TES4_Feet = 0x00000020,
TES4_RightRing = 0x00000040,
TES4_LeftRing = 0x00000080,
TES4_Amulet = 0x00000100,
Expand Down Expand Up @@ -76,7 +77,40 @@ namespace ESM4
FO3_MouthObject = 0x00010000,
FO3_BodyAddOn1 = 0x00020000,
FO3_BodyAddOn2 = 0x00040000,
FO3_BodyAddOn3 = 0x00080000
FO3_BodyAddOn3 = 0x00080000,
//
TES5_Head = 0x00000001,
TES5_Hair = 0x00000002,
TES5_Body = 0x00000004,
TES5_Hands = 0x00000008,
TES5_Forearms = 0x00000010,
TES5_Amulet = 0x00000020,
TES5_Ring = 0x00000040,
TES5_Feet = 0x00000080,
TES5_Calves = 0x00000100,
TES5_Shield = 0x00000200,
TES5_Tail = 0x00000400,
TES5_LongHair = 0x00000800,
TES5_Circlet = 0x00001000,
TES5_Ears = 0x00002000,
TES5_BodyAddOn3 = 0x00004000,
TES5_BodyAddOn4 = 0x00008000,
TES5_BodyAddOn5 = 0x00010000,
TES5_BodyAddOn6 = 0x00020000,
TES5_BodyAddOn7 = 0x00040000,
TES5_BodyAddOn8 = 0x00080000,
TES5_DecapHead = 0x00100000,
TES5_Decapitate = 0x00200000,
TES5_BodyAddOn9 = 0x00400000,
TES5_BodyAddOn10 = 0x00800000,
TES5_BodyAddOn11 = 0x01000000,
TES5_BodyAddOn12 = 0x02000000,
TES5_BodyAddOn13 = 0x04000000,
TES5_BodyAddOn14 = 0x08000000,
TES5_BodyAddOn15 = 0x10000000,
TES5_BodyAddOn16 = 0x20000000,
TES5_BodyAddOn17 = 0x40000000,
TES5_FX01 = 0x80000000
};

enum GeneralFlags
Expand Down Expand Up @@ -117,11 +151,16 @@ namespace ESM4

std::string mEditorId;
std::string mFullName;
std::string mModel;
std::string mModelMale;
std::string mModelMaleWorld;
std::string mModelFemale;
std::string mModelFemaleWorld;
std::string mText;
std::string mIconMale;
std::string mIconFemale;

std::string mModel; // FIXME: for OpenCS

float mBoundRadius;

std::uint32_t mArmorFlags;
Expand Down
20 changes: 13 additions & 7 deletions extern/esm4/clot.cpp
Expand Up @@ -27,6 +27,7 @@
#include "clot.hpp"

#include <stdexcept>
//#include <iostream> // FIXME: for debugging only

#include "reader.hpp"
//#include "writer.hpp"
Expand All @@ -36,7 +37,10 @@ ESM4::Clothing::Clothing() : mFormId(0), mFlags(0), mBoundRadius(0.f), mClothing
{
mEditorId.clear();
mFullName.clear();
mModel.clear();
mModelMale.clear();
mModelMaleWorld.clear();
mModelFemale.clear();
mModelFemaleWorld.clear();
mIconMale.clear();
mIconFemale.clear();

Expand All @@ -61,19 +65,19 @@ void ESM4::Clothing::load(ESM4::Reader& reader)
{
case ESM4::SUB_EDID: reader.getZString(mEditorId); break;
case ESM4::SUB_FULL: reader.getZString(mFullName); break;
case ESM4::SUB_MODL: reader.getZString(mModel); break;
case ESM4::SUB_ICON: reader.getZString(mIconMale); break;
case ESM4::SUB_ICO2: reader.getZString(mIconFemale); break;
case ESM4::SUB_DATA: reader.get(mData); break;
case ESM4::SUB_BMDT: reader.get(mClothingFlags); break;
case ESM4::SUB_SCRI: reader.getFormId(mScript); break;
case ESM4::SUB_ENAM: reader.getFormId(mEnchantment); break;
case ESM4::SUB_ANAM: reader.get(mEnchantmentPoints); break;
case ESM4::SUB_MODB: reader.get(mBoundRadius); break;
case ESM4::SUB_MODL: reader.getZString(mModelMale); break;
case ESM4::SUB_MOD2: reader.getZString(mModelMaleWorld); break;
case ESM4::SUB_MOD3: reader.getZString(mModelFemale); break;
case ESM4::SUB_MOD4: reader.getZString(mModelFemaleWorld); break;
case ESM4::SUB_ICON: reader.getZString(mIconMale); break;
case ESM4::SUB_ICO2: reader.getZString(mIconFemale); break;
case ESM4::SUB_MODT:
case ESM4::SUB_MOD2:
case ESM4::SUB_MOD3:
case ESM4::SUB_MOD4:
case ESM4::SUB_MO2B:
case ESM4::SUB_MO3B:
case ESM4::SUB_MO4B:
Expand All @@ -89,6 +93,8 @@ void ESM4::Clothing::load(ESM4::Reader& reader)
throw std::runtime_error("ESM4::CLOT::load - Unknown subrecord " + ESM4::printName(subHdr.typeId));
}
}
//if ((mClothingFlags&0xffff) == 0x02) // only hair
//std::cout << "only hair " << mEditorId << std::endl;
}

//void ESM4::Clothing::save(ESM4::Writer& writer) const
Expand Down
13 changes: 9 additions & 4 deletions extern/esm4/clot.hpp
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016, 2018, 2019 cc9cii
Copyright (C) 2016, 2018-2020 cc9cii
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -51,9 +51,14 @@ namespace ESM4

std::string mEditorId;
std::string mFullName;
std::string mModel;
std::string mIconMale; // inventory
std::string mIconFemale; // inventory
std::string mModelMale;
std::string mModelMaleWorld;
std::string mModelFemale;
std::string mModelFemaleWorld;
std::string mIconMale; // texture
std::string mIconFemale; // texture

std::string mModel; // FIXME: for OpenCS

float mBoundRadius;

Expand Down
4 changes: 2 additions & 2 deletions extern/esm4/eyes.hpp
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016, 2018 cc9cii
Copyright (C) 2016, 2018, 2020 cc9cii
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -50,7 +50,7 @@ namespace ESM4

std::string mEditorId;
std::string mFullName;
std::string mIcon; // inventory
std::string mIcon; // texture

Data mData;

Expand Down
3 changes: 2 additions & 1 deletion extern/esm4/hair.cpp
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016, 2018 cc9cii
Copyright (C) 2016, 2018, 2020 cc9cii
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -27,6 +27,7 @@
#include "hair.hpp"

#include <stdexcept>
//#include <iostream> // FIXME: for debugging only

#include "reader.hpp"
//#include "writer.hpp"
Expand Down
6 changes: 3 additions & 3 deletions extern/esm4/hair.hpp
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016, 2018 cc9cii
Copyright (C) 2016, 2018, 2020 cc9cii
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -50,8 +50,8 @@ namespace ESM4

std::string mEditorId;
std::string mFullName;
std::string mModel;
std::string mIcon; // inventory
std::string mModel; // mesh
std::string mIcon; // texture

float mBoundRadius;

Expand Down
5 changes: 3 additions & 2 deletions extern/esm4/ligh.cpp
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016, 2018 cc9cii
Copyright (C) 2016, 2018, 2020 cc9cii
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -69,6 +69,7 @@ void ESM4::Light::load(ESM4::Reader& reader)
}
case ESM4::SUB_DATA:
{
// FIXME: TES4 might be uint32 as well, need to check
if (isFONV || (esmVer == ESM4::VER_094 && subHdr.dataSize == 32)/*FO3*/)
{
reader.get(mData.time); // uint32
Expand All @@ -89,7 +90,7 @@ void ESM4::Light::load(ESM4::Reader& reader)
reader.get(mData.intensityAmplitude);
reader.get(mData.movementAmplitude);
}
else if (subHdr.dataSize == 32)
else if (subHdr.dataSize == 32) // TES4
{
reader.get(mData.falloff);
reader.get(mData.FOV);
Expand Down
13 changes: 12 additions & 1 deletion extern/esm4/ligh.hpp
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016, 2018, 2019 cc9cii
Copyright (C) 2016, 2018-2020 cc9cii
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -44,6 +44,17 @@ namespace ESM4
float duration;
std::uint32_t radius;
std::uint32_t colour; // RGBA
// flags:
// 0x00000001 = Dynamic
// 0x00000002 = Can be Carried
// 0x00000004 = Negative
// 0x00000008 = Flicker
// 0x00000020 = Off By Default
// 0x00000040 = Flicker Slow
// 0x00000080 = Pulse
// 0x00000100 = Pulse Slow
// 0x00000200 = Spot Light
// 0x00000400 = Spot Shadow
std::int32_t flags;
float falloff;
float FOV;
Expand Down

0 comments on commit a360dfe

Please sign in to comment.