mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-09 18:40:14 +00:00
Some script updates, fixed windows build script (not tested)
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@65 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
54f598d2e7
commit
7de25b0dee
@ -8,4 +8,4 @@ g++ -c ogre\cpp_ogre.cpp -I.\includes\ogre\
|
|||||||
g++ -c bullet\cpp_bullet.cpp -I.\includes\bullet\
|
g++ -c bullet\cpp_bullet.cpp -I.\includes\bullet\
|
||||||
|
|
||||||
echo Compiling main program (openmw.exe)
|
echo Compiling main program (openmw.exe)
|
||||||
gdc -Wall -g openmw.d bsa\*.d core\*.d esm\*.d input\*.d nif\*.d ogre\*.d scene\*.d sound\*.d util\*.d bullet\*.d cpp_ogre.o cpp_avcodec.o cpp_bullet.o libbulletdynamics.a libbulletcollision.a libbulletmath.a monster\util\*.d avcodec-51.dll avformat-52.dll avdevice-52.dll avutil-49.dll openal32.dll ogremain_d.dll OIS_d.dll -lstdc++ -o openmw.exe
|
gdc -Wall -g openmw.d bsa\*.d core\*.d esm\*.d input\*.d nif\*.d ogre\*.d scene\*.d sound\*.d util\*.d bullet\*.d cpp_ogre.o cpp_avcodec.o cpp_bullet.o libbulletdynamics.a libbulletcollision.a libbulletmath.a mscripts\object.d monster\compiler\*.d monster\vm\*.d monster\util\*.d avcodec-51.dll avformat-52.dll avdevice-52.dll avutil-49.dll openal32.dll ogremain_d.dll OIS_d.dll -lstdc++ -o openmw.exe
|
||||||
|
@ -404,10 +404,38 @@ extern "C" void bullet_insertStatic(btConcaveShape *shape,
|
|||||||
// FIXME: Scaling does NOT work.
|
// FIXME: Scaling does NOT work.
|
||||||
|
|
||||||
// Are we scaled?
|
// Are we scaled?
|
||||||
if(scale != 1.0) {}
|
if(scale != 1.0)
|
||||||
// Wrap the shape in a class that scales it. TODO: Try this on
|
{
|
||||||
// ALL shapes, just to test the slowdown.
|
cout << "Scaling shape " << shape << " by " << scale << endl;
|
||||||
//shape = new ScaleShape(shape, scale);
|
|
||||||
|
// Not quite sure how to handle local scaling yet. Our initial
|
||||||
|
// attempt was to create a wrapper that showed a scale mesh to
|
||||||
|
// the "outside world" while referencing the original, but I
|
||||||
|
// suspect it ended up altering the original data. At least it
|
||||||
|
// doesn't work the way it is now, and only crashes.
|
||||||
|
|
||||||
|
// The alternative is to create a new copy of the shape for each
|
||||||
|
// scaled version we insert. This is wasteful, but might be
|
||||||
|
// acceptable.
|
||||||
|
|
||||||
|
// It's also possible we can achieve this effect by changing
|
||||||
|
// larger parts of the Bullet library - but I hope I don't have
|
||||||
|
// to create my own dispatcher and such. Finally, even if the
|
||||||
|
// transformations given to objects are supposed to be uniform
|
||||||
|
// in length, maybe we can cheat the system and scale the
|
||||||
|
// transformation instead. Try it just for kicks, and go through
|
||||||
|
// the system to see what parts of Bullet it would break.
|
||||||
|
|
||||||
|
// In any case, when we find a solution we should apply it to
|
||||||
|
// all shapes (not just scale!=1.0) to get a better impression
|
||||||
|
// of any performance and memory overhead.
|
||||||
|
|
||||||
|
// Also, as an optimization, it looks like multiple instances of
|
||||||
|
// the same shape are often inserted with the same scale
|
||||||
|
// factor. We could easily cache this. The scale-recreation of
|
||||||
|
// meshes (in necessary) could be done as a separate function,
|
||||||
|
// and the caching could be done in D code.
|
||||||
|
}
|
||||||
|
|
||||||
btTransform trafo;
|
btTransform trafo;
|
||||||
trafo.setIdentity();
|
trafo.setIdentity();
|
||||||
|
@ -32,8 +32,8 @@ class Jukebox : Object;
|
|||||||
float fadeLevel = 0.0;
|
float fadeLevel = 0.0;
|
||||||
|
|
||||||
// How much to fade in and out each second
|
// How much to fade in and out each second
|
||||||
float fadeInRate = 0.10;
|
float fadeInRate = 0.14;
|
||||||
float fadeOutRate = 0.25;
|
float fadeOutRate = 0.30;
|
||||||
|
|
||||||
// Time between each fade step
|
// Time between each fade step
|
||||||
float fadeInterval = 0.2;
|
float fadeInterval = 0.2;
|
||||||
@ -50,12 +50,7 @@ int index;
|
|||||||
float musVolume;
|
float musVolume;
|
||||||
|
|
||||||
bool isPlaying; // Is a song currently playing?
|
bool isPlaying; // Is a song currently playing?
|
||||||
|
bool isPaused; // Is the song currently paused?
|
||||||
// TODO: Make "isPaused" instead, makes more sense
|
|
||||||
bool hasSong; // Is a song currently selected (playing or paused)
|
|
||||||
|
|
||||||
// TODO: Move to Object for now
|
|
||||||
native int randInt(int a, int b);
|
|
||||||
|
|
||||||
// Native functions to control music
|
// Native functions to control music
|
||||||
native setSound(char[] filename);
|
native setSound(char[] filename);
|
||||||
@ -66,12 +61,18 @@ idle waitUntilFinished();
|
|||||||
|
|
||||||
// Fade out and then stop the music. TODO: Rename these to resume()
|
// Fade out and then stop the music. TODO: Rename these to resume()
|
||||||
// etc and use super.resume, when this is possible.
|
// etc and use super.resume, when this is possible.
|
||||||
pause() { state = fadeOut; }
|
pause()
|
||||||
|
{
|
||||||
|
isPaused = true;
|
||||||
|
state = fadeOut;
|
||||||
|
}
|
||||||
|
|
||||||
resume()
|
resume()
|
||||||
{
|
{
|
||||||
if(!hasSong) next();
|
if(isPaused) playSound();
|
||||||
else playSound();
|
else next();
|
||||||
|
|
||||||
|
isPaused = false;
|
||||||
state = fadeIn;
|
state = fadeIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +82,6 @@ stop()
|
|||||||
{
|
{
|
||||||
stopSound();
|
stopSound();
|
||||||
|
|
||||||
hasSong = false;
|
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
fadeLevel = 0.0;
|
fadeLevel = 0.0;
|
||||||
state = null;
|
state = null;
|
||||||
@ -96,7 +96,9 @@ play()
|
|||||||
playSound();
|
playSound();
|
||||||
|
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
hasSong = true;
|
isPaused = false;
|
||||||
|
|
||||||
|
state = playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the next song in the playlist
|
// Play the next song in the playlist
|
||||||
@ -159,7 +161,6 @@ randomize()
|
|||||||
state fadeIn
|
state fadeIn
|
||||||
{
|
{
|
||||||
begin:
|
begin:
|
||||||
|
|
||||||
setVolume(musVolume*fadeLevel);
|
setVolume(musVolume*fadeLevel);
|
||||||
|
|
||||||
sleep(fadeInterval);
|
sleep(fadeInterval);
|
||||||
@ -179,7 +180,6 @@ state fadeIn
|
|||||||
state fadeOut
|
state fadeOut
|
||||||
{
|
{
|
||||||
begin:
|
begin:
|
||||||
|
|
||||||
sleep(fadeInterval);
|
sleep(fadeInterval);
|
||||||
|
|
||||||
fadeLevel -= fadeInterval*fadeOutRate;
|
fadeLevel -= fadeInterval*fadeOutRate;
|
||||||
@ -187,7 +187,6 @@ state fadeOut
|
|||||||
if(fadeLevel <= 0.0)
|
if(fadeLevel <= 0.0)
|
||||||
{
|
{
|
||||||
fadeLevel = 0.0;
|
fadeLevel = 0.0;
|
||||||
|
|
||||||
stopSound();
|
stopSound();
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
|
|
||||||
@ -201,12 +200,16 @@ state fadeOut
|
|||||||
state playing
|
state playing
|
||||||
{
|
{
|
||||||
begin:
|
begin:
|
||||||
|
setVolume(musVolume);
|
||||||
|
fadeLevel = 1.0;
|
||||||
|
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
// Wait for the song to play. Will return imediately if the song has
|
// Wait for the song to play. Will return imediately if the song has
|
||||||
// already stopped or if no song is playing
|
// already stopped or if no song is playing
|
||||||
waitUntilFinished();
|
waitUntilFinished();
|
||||||
|
|
||||||
// Start playing the next song
|
// Start playing the next song
|
||||||
next();
|
next();
|
||||||
|
}
|
||||||
goto begin;
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ module mscripts.object;
|
|||||||
import monster.monster;
|
import monster.monster;
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
import std.date;
|
import std.date;
|
||||||
|
import core.resource : rnd;
|
||||||
|
|
||||||
// Set up the base Monster classes we need in OpenMW
|
// Set up the base Monster classes we need in OpenMW
|
||||||
void initMonsterScripts()
|
void initMonsterScripts()
|
||||||
@ -38,6 +39,9 @@ void initMonsterScripts()
|
|||||||
|
|
||||||
// Bind various functions
|
// Bind various functions
|
||||||
mc.bind("print", { print(); });
|
mc.bind("print", { print(); });
|
||||||
|
mc.bind("randInt",
|
||||||
|
{ stack.pushInt(rnd.randInt
|
||||||
|
(stack.popInt,stack.popInt));});
|
||||||
mc.bind("sleep", new IdleSleep);
|
mc.bind("sleep", new IdleSleep);
|
||||||
|
|
||||||
// Load and run the test script
|
// Load and run the test script
|
||||||
|
@ -29,3 +29,6 @@ idle sleep(float seconds);
|
|||||||
|
|
||||||
// Print a message to screen
|
// Print a message to screen
|
||||||
native print(char[][] msg...);
|
native print(char[][] msg...);
|
||||||
|
|
||||||
|
// Get a random number between a and b (inclusive)
|
||||||
|
native int randInt(int a, int b);
|
||||||
|
@ -10,7 +10,7 @@ state printMessage
|
|||||||
{
|
{
|
||||||
// This state code will run as long as the object is in this state.
|
// This state code will run as long as the object is in this state.
|
||||||
begin:
|
begin:
|
||||||
sleep(10);
|
sleep(15);
|
||||||
print("Howdy from the world of Monster scripts!");
|
print("Howdy from the world of Monster scripts!");
|
||||||
print("This script is located in mscripts/test.mn. Check it out!");
|
print("This script is located in mscripts/test.mn. Check it out!");
|
||||||
goto begin;
|
goto begin;
|
||||||
|
@ -90,9 +90,6 @@ struct MusicManager
|
|||||||
{
|
{
|
||||||
assert(mc is null);
|
assert(mc is null);
|
||||||
mc = new MonsterClass("Jukebox", "jukebox.mn");
|
mc = new MonsterClass("Jukebox", "jukebox.mn");
|
||||||
mc.bind("randInt",
|
|
||||||
{ stack.pushInt(rnd.randInt
|
|
||||||
(stack.popInt,stack.popInt));});
|
|
||||||
mc.bind("waitUntilFinished",
|
mc.bind("waitUntilFinished",
|
||||||
new Idle_waitUntilFinished);
|
new Idle_waitUntilFinished);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user