forked from mirror/openmw-tes3mp
Merge branch 'master' into dialogue
Conflicts: apps/openmw/mwclass/creature.cpp apps/openmw/mwclass/creature.hpp apps/openmw/mwclass/npc.cpp apps/openmw/mwclass/npc.hpp apps/openmw/mwworld/class.cpp apps/openmw/mwworld/class.hppactorid
commit
2cfe5f0697
@ -0,0 +1,57 @@
|
||||
# Locate Audiere
|
||||
# This module defines
|
||||
# AUDIERE_LIBRARY
|
||||
# AUDIERE_FOUND, if false, do not try to link to Audiere
|
||||
# AUDIERE_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# Created by Nicolay Korslund for OpenMW (http://openmw.com)
|
||||
#
|
||||
# More or less a direct ripoff of FindOpenAL.cmake by Eric Wing.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distributed this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
|
||||
FIND_PATH(AUDIERE_INCLUDE_DIR audiere.h
|
||||
HINTS
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(AUDIERE_LIBRARY
|
||||
NAMES audiere
|
||||
HINTS
|
||||
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
SET(AUDIERE_FOUND "NO")
|
||||
IF(AUDIERE_LIBRARY AND AUDIERE_INCLUDE_DIR)
|
||||
SET(AUDIERE_FOUND "YES")
|
||||
ENDIF(AUDIERE_LIBRARY AND AUDIERE_INCLUDE_DIR)
|
||||
|
@ -0,0 +1,90 @@
|
||||
# Find the FFmpeg library
|
||||
#
|
||||
# Sets
|
||||
# FFMPEG_FOUND. If false, don't try to use ffmpeg
|
||||
# FFMPEG_INCLUDE_DIR
|
||||
# FFMPEG_LIBRARIES
|
||||
#
|
||||
# Modified by Nicolay Korslund for OpenMW
|
||||
|
||||
SET( FFMPEG_FOUND "NO" )
|
||||
|
||||
FIND_PATH( FFMPEG_avcodec_INCLUDE_DIR avcodec.h
|
||||
HINTS
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/usr/include/ffmpeg
|
||||
/usr/local/include/ffmpeg
|
||||
/usr/include/ffmpeg/libavcodec
|
||||
/usr/local/include/ffmpeg/libavcodec
|
||||
/usr/include/libavcodec
|
||||
/usr/local/include/libavcodec
|
||||
)
|
||||
|
||||
FIND_PATH( FFMPEG_avformat_INCLUDE_DIR avformat.h
|
||||
HINTS
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/usr/include/ffmpeg
|
||||
/usr/local/include/ffmpeg
|
||||
/usr/include/ffmpeg/libavformat
|
||||
/usr/local/include/ffmpeg/libavformat
|
||||
/usr/include/libavformat
|
||||
/usr/local/include/libavformat
|
||||
)
|
||||
|
||||
set(FFMPEG_INCLUDE_DIR ${FFMPEG_avcodec_INCLUDE_DIR} ${FFMPEG_avformat_INCLUDE_DIR})
|
||||
|
||||
IF( FFMPEG_INCLUDE_DIR )
|
||||
|
||||
FIND_PROGRAM( FFMPEG_CONFIG ffmpeg-config
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
${HOME}/bin
|
||||
)
|
||||
|
||||
IF( FFMPEG_CONFIG )
|
||||
EXEC_PROGRAM( ${FFMPEG_CONFIG} ARGS "--libs avformat" OUTPUT_VARIABLE FFMPEG_LIBS )
|
||||
SET( FFMPEG_FOUND "YES" )
|
||||
SET( FFMPEG_LIBRARIES "${FFMPEG_LIBS}" )
|
||||
|
||||
ELSE( FFMPEG_CONFIG )
|
||||
|
||||
FIND_LIBRARY( FFMPEG_avcodec_LIBRARY avcodec
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/lib64
|
||||
/usr/local/lib64
|
||||
)
|
||||
|
||||
FIND_LIBRARY( FFMPEG_avformat_LIBRARY avformat
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/lib64
|
||||
/usr/local/lib64
|
||||
)
|
||||
|
||||
FIND_LIBRARY( FFMPEG_avutil_LIBRARY avutil
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/lib64
|
||||
/usr/local/lib64
|
||||
)
|
||||
|
||||
IF( FFMPEG_avcodec_LIBRARY )
|
||||
IF( FFMPEG_avformat_LIBRARY )
|
||||
|
||||
SET( FFMPEG_FOUND "YES" )
|
||||
SET( FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY} ${FFMPEG_avcodec_LIBRARY} )
|
||||
IF( FFMPEG_avutil_LIBRARY )
|
||||
SET( FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_avutil_LIBRARY} )
|
||||
ENDIF( FFMPEG_avutil_LIBRARY )
|
||||
|
||||
ENDIF( FFMPEG_avformat_LIBRARY )
|
||||
ENDIF( FFMPEG_avcodec_LIBRARY )
|
||||
|
||||
ENDIF( FFMPEG_CONFIG )
|
||||
|
||||
ENDIF( FFMPEG_INCLUDE_DIR )
|
@ -0,0 +1,47 @@
|
||||
# Locate MPG123
|
||||
# This module defines
|
||||
# MPG123_LIBRARY
|
||||
# MPG123_FOUND, if false, do not try to link to Mpg123
|
||||
# MPG123_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# Created by Nicolay Korslund for OpenMW (http://openmw.com)
|
||||
#
|
||||
# Ripped off from other sources. In fact, this file is so generic (I
|
||||
# just did a search and replace on another file) that I wonder why the
|
||||
# CMake guys haven't wrapped this entire thing in a single
|
||||
# function. Do we really need to repeat this stuff for every single
|
||||
# library when they all work the same? </today's rant>
|
||||
|
||||
FIND_PATH(MPG123_INCLUDE_DIR mpg123.h
|
||||
HINTS
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(MPG123_LIBRARY
|
||||
NAMES mpg123
|
||||
HINTS
|
||||
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
SET(MPG123_FOUND "NO")
|
||||
IF(MPG123_LIBRARY AND MPG123_INCLUDE_DIR)
|
||||
SET(MPG123_FOUND "YES")
|
||||
ENDIF(MPG123_LIBRARY AND MPG123_INCLUDE_DIR)
|
||||
|
@ -0,0 +1,41 @@
|
||||
# Locate SNDFILE
|
||||
# This module defines
|
||||
# SNDFILE_LIBRARY
|
||||
# SNDFILE_FOUND, if false, do not try to link to Sndfile
|
||||
# SNDFILE_INCLUDE_DIR, where to find the headers
|
||||
#
|
||||
# Created by Nicolay Korslund for OpenMW (http://openmw.com)
|
||||
|
||||
FIND_PATH(SNDFILE_INCLUDE_DIR sndfile.h
|
||||
HINTS
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
FIND_LIBRARY(SNDFILE_LIBRARY
|
||||
NAMES sndfile
|
||||
HINTS
|
||||
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
SET(SNDFILE_FOUND "NO")
|
||||
IF(SNDFILE_LIBRARY AND SNDFILE_INCLUDE_DIR)
|
||||
SET(SNDFILE_FOUND "YES")
|
||||
ENDIF(SNDFILE_LIBRARY AND SNDFILE_INCLUDE_DIR)
|
||||
|
@ -0,0 +1,48 @@
|
||||
#include "records.hpp"
|
||||
|
||||
/** Implementation for some of the load() functions. Most are found in
|
||||
the header files themselves, but this is a bit irritating to
|
||||
compile if you're changing the functions often, as virtually the
|
||||
entire engine depends on these headers.
|
||||
*/
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
void NPC::load(ESMReader &esm, const std::string& id)
|
||||
{
|
||||
mId = id;
|
||||
|
||||
npdt52.gold = -10;
|
||||
|
||||
model = esm.getHNOString("MODL");
|
||||
name = esm.getHNOString("FNAM");
|
||||
|
||||
race = esm.getHNString("RNAM");
|
||||
cls = esm.getHNString("CNAM");
|
||||
faction = esm.getHNString("ANAM");
|
||||
head = esm.getHNString("BNAM");
|
||||
hair = esm.getHNString("KNAM");
|
||||
|
||||
script = esm.getHNOString("SCRI");
|
||||
|
||||
esm.getSubNameIs("NPDT");
|
||||
esm.getSubHeader();
|
||||
if(esm.getSubSize() == 52) esm.getExact(&npdt52, 52);
|
||||
else if(esm.getSubSize() == 12) esm.getExact(&npdt12, 12);
|
||||
else esm.fail("NPC_NPDT must be 12 or 52 bytes long");
|
||||
|
||||
esm.getHNT(flags, "FLAG");
|
||||
|
||||
inventory.load(esm);
|
||||
spells.load(esm);
|
||||
|
||||
if(esm.isNextSub("AIDT"))
|
||||
{
|
||||
esm.getHExact(&AI, sizeof(AI));
|
||||
hasAI = true;
|
||||
}
|
||||
else hasAI = false;
|
||||
|
||||
esm.skipRecord();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
Subproject commit c7b179d6546688208528c8eef681d42b7c1ec7be
|
||||
Subproject commit c982f701cacdd2932bfdc22b168f54221a549b62
|
@ -1 +1 @@
|
||||
Subproject commit c04d72cbe380217c2d1d60f8a2c6e4810fe4c050
|
||||
Subproject commit b9d4dc448bc3be908653f9dea3c3450fb85ed107
|
@ -1,47 +0,0 @@
|
||||
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 get the singleton
|
||||
// instance
|
||||
MonsterClass mc = vm.load("GMST");
|
||||
gmstObj = mc.getSing();
|
||||
|
||||
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.lookupName(name).isVar)
|
||||
{
|
||||
writefln("WARNING: GMST %s not supported!", name);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(b.type == VarType.Int) gmstObj.setInt(name, b.i);
|
||||
else if(b.type == VarType.Float) gmstObj.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) gmstObj.setString8(name, b.str);
|
||||
}
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
/*
|
||||
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||
Copyright (C) 2008 Nicolay Korslund
|
||||
Email: < korslund@gmail.com >
|
||||
WWW: http://openmw.snaptoad.com/
|
||||
|
||||
This file (soundlist.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
|
||||
version 3, as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
version 3 along with this program. If not, see
|
||||
http://www.gnu.org/licenses/ .
|
||||
|
||||
*/
|
||||
|
||||
module scene.soundlist;
|
||||
|
||||
import esm.loadsoun;
|
||||
import sound.audio;
|
||||
import sound.sfx;
|
||||
|
||||
SoundList soundScene;
|
||||
|
||||
// Has a list over all sounds currently playing in the
|
||||
// scene. Currently only holds static, looping sounds, mainly
|
||||
// torches. Later I will have to decide what to do with play-once
|
||||
// sounds. Do I bother to update their position, or do I assume that
|
||||
// once it starts playing, it is short enough that it doesn't matter?
|
||||
// The last option is probably not viable, since some sounds can be
|
||||
// very long.
|
||||
struct SoundList
|
||||
{
|
||||
SoundInstance[] list;
|
||||
|
||||
// Get a sound instance from a Sound struct
|
||||
static SoundInstance getInstance(Sound *s, bool loop=false)
|
||||
{
|
||||
const distFactor = 40.0; // Just guessing, really.
|
||||
|
||||
assert(!s.sound.isEmpty());
|
||||
|
||||
SoundInstance inst = s.sound.getInstance();
|
||||
inst.setParams(s.data.volume/255.0,
|
||||
s.data.minRange*distFactor,
|
||||
s.data.maxRange*distFactor,
|
||||
loop);
|
||||
return inst;
|
||||
}
|
||||
|
||||
SoundInstance *insert(Sound *snd, bool loop=false)
|
||||
{
|
||||
// For some reason, we get called with empty sound instances here
|
||||
// if some files are missing, but not for others. Check into it
|
||||
// later.
|
||||
if(snd.sound.isEmpty) return null;
|
||||
|
||||
// Reuse a dead instance if one exists
|
||||
foreach(ref s; list)
|
||||
{
|
||||
if(s.owner == null)
|
||||
{
|
||||
s = getInstance(snd, loop);
|
||||
return &s;
|
||||
}
|
||||
}
|
||||
// Otherwise append a new one
|
||||
list ~= getInstance(snd, loop);
|
||||
return &list[$-1];
|
||||
}
|
||||
|
||||
void update(float x, float y, float z,
|
||||
float frontx, float fronty, float frontz,
|
||||
float upx, float upy, float upz)
|
||||
{
|
||||
SoundInstance.setPlayerPos(x,y,z,frontx,fronty,frontz,upx,upy,upz);
|
||||
foreach(ref s; list)
|
||||
if(s.owner) s.updateSound();
|
||||
}
|
||||
|
||||
void kill()
|
||||
{
|
||||
foreach(ref s; list)
|
||||
{
|
||||
if(s.owner) s.kill();
|
||||
}
|
||||
list = null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue