mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-15 18:39:51 +00:00
Several bugfixes related to the new Monster version
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@101 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
cc1f7f02e9
commit
fd79223cf7
31
esm/defs.d
31
esm/defs.d
@ -148,21 +148,26 @@ template LoadTT(T)
|
|||||||
|
|
||||||
void makeProto(char[] clsName = null)
|
void makeProto(char[] clsName = null)
|
||||||
{
|
{
|
||||||
// Use the template type name as the Monster class name if none
|
|
||||||
// is specified.
|
|
||||||
if(clsName == "")
|
|
||||||
{
|
|
||||||
clsName = typeid(T).toString;
|
|
||||||
|
|
||||||
// Remove the module name
|
|
||||||
int i = clsName.rfind('.');
|
|
||||||
if(i != -1)
|
|
||||||
clsName = clsName[i+1..$];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up a prototype object
|
// Set up a prototype object
|
||||||
if(mc is null)
|
if(mc is null)
|
||||||
mc = vm.load(clsName);
|
{
|
||||||
|
// Use the template type name as the Monster class name if
|
||||||
|
// none is specified.
|
||||||
|
if(clsName == "")
|
||||||
|
{
|
||||||
|
clsName = typeid(T).toString;
|
||||||
|
|
||||||
|
// Remove the module name
|
||||||
|
int i = clsName.rfind('.');
|
||||||
|
if(i != -1)
|
||||||
|
clsName = clsName[i+1..$];
|
||||||
|
}
|
||||||
|
|
||||||
|
// All the game objects are in the 'game' package
|
||||||
|
clsName = "game." ~ clsName;
|
||||||
|
mc = vm.load(clsName);
|
||||||
|
}
|
||||||
|
|
||||||
proto = mc.createObject();
|
proto = mc.createObject();
|
||||||
|
|
||||||
proto.setString8("id", id);
|
proto.setString8("id", id);
|
||||||
|
@ -36,7 +36,7 @@ import esm.imports;
|
|||||||
|
|
||||||
struct Activator
|
struct Activator
|
||||||
{
|
{
|
||||||
mixin LoadT!();
|
mixin LoadT;
|
||||||
|
|
||||||
Script *script;
|
Script *script;
|
||||||
MeshIndex model;
|
MeshIndex model;
|
||||||
|
@ -1097,6 +1097,9 @@ class PackageImpHolder : ImportHolder
|
|||||||
{
|
{
|
||||||
sc = psc;
|
sc = psc;
|
||||||
assert(sc !is null);
|
assert(sc !is null);
|
||||||
|
|
||||||
|
type = psc.type;
|
||||||
|
assert(type !is null);
|
||||||
}
|
}
|
||||||
|
|
||||||
override:
|
override:
|
||||||
|
@ -520,7 +520,7 @@ class DotOperator : OperatorExpr
|
|||||||
owner.resolve(sc);
|
owner.resolve(sc);
|
||||||
|
|
||||||
Type ot = owner.type;
|
Type ot = owner.type;
|
||||||
assert(ot !is null);
|
assert(ot !is null, "owner " ~ owner.toString ~ " has no type!");
|
||||||
|
|
||||||
ot.getMemberScope();
|
ot.getMemberScope();
|
||||||
|
|
||||||
|
@ -613,6 +613,11 @@ class MemberExpr : Expression
|
|||||||
if(isType)
|
if(isType)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// Singletons are also static members (of packages), even if the
|
||||||
|
// type is not a meta type
|
||||||
|
if(singCls != -1)
|
||||||
|
return true;
|
||||||
|
|
||||||
// Ditto for packages
|
// Ditto for packages
|
||||||
if(isPackage)
|
if(isPackage)
|
||||||
return true;
|
return true;
|
||||||
@ -911,7 +916,7 @@ class MemberExpr : Expression
|
|||||||
// only push the index.
|
// only push the index.
|
||||||
tasm.pushFarClass(var.number, var.sc.getClass().getTreeIndex(), s);
|
tasm.pushFarClass(var.number, var.sc.getClass().getTreeIndex(), s);
|
||||||
|
|
||||||
else assert(0);
|
else assert(0, "called evalAsm on " ~ toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push the address of the variable rather than its value
|
// Push the address of the variable rather than its value
|
||||||
|
@ -952,7 +952,7 @@ final class MonsterClass
|
|||||||
void createScope()
|
void createScope()
|
||||||
{
|
{
|
||||||
// Since debugging self inheritance can be a little icky, add an
|
// Since debugging self inheritance can be a little icky, add an
|
||||||
// explisit recursion check.
|
// explicit recursion check.
|
||||||
assert(!flags.has(CFlags.InScope), "createScope called recursively");
|
assert(!flags.has(CFlags.InScope), "createScope called recursively");
|
||||||
flags.set(CFlags.InScope);
|
flags.set(CFlags.InScope);
|
||||||
|
|
||||||
@ -968,9 +968,15 @@ final class MonsterClass
|
|||||||
parents.length = parentNames.length;
|
parents.length = parentNames.length;
|
||||||
foreach(int i, pName; parentNames)
|
foreach(int i, pName; parentNames)
|
||||||
{
|
{
|
||||||
// Find the class. vm.load() returns the existing class if
|
// Find the parent class.
|
||||||
// it has already been loaded.
|
assert(pack !is null);
|
||||||
MonsterClass mc = vm.load(pName.str);
|
auto sl = pack.lookupClass(pName);
|
||||||
|
if(!sl.isClass)
|
||||||
|
fail("Cannot inherit from " ~ pName.str ~ ": No such class.",
|
||||||
|
pName.loc);
|
||||||
|
auto mc = sl.mc;
|
||||||
|
assert(mc !is null);
|
||||||
|
//MonsterClass mc = vm.load(pName.str);
|
||||||
mc.requireScope();
|
mc.requireScope();
|
||||||
|
|
||||||
assert(mc !is null);
|
assert(mc !is null);
|
||||||
|
@ -345,7 +345,7 @@ struct VM
|
|||||||
fail(format("Invalid class name %s (file %s)", cname, fname));
|
fail(format("Invalid class name %s (file %s)", cname, fname));
|
||||||
|
|
||||||
// At this point, check if the class already exists.
|
// At this point, check if the class already exists.
|
||||||
if(global.ciInList(cname, mc))
|
if(pack.ciInList(cname, mc))
|
||||||
{
|
{
|
||||||
// Match!
|
// Match!
|
||||||
assert(mc !is null);
|
assert(mc !is null);
|
||||||
|
@ -35,6 +35,8 @@ float mouseSensX;
|
|||||||
float mouseSensY;
|
float mouseSensY;
|
||||||
bool flipMouseY;
|
bool flipMouseY;
|
||||||
|
|
||||||
|
import sound;
|
||||||
|
|
||||||
// TODO: This could be replaced by some sort of hook placed on
|
// TODO: This could be replaced by some sort of hook placed on
|
||||||
// mainVolume. Writing to the variable would automatically update
|
// mainVolume. Writing to the variable would automatically update
|
||||||
// everything.
|
// everything.
|
||||||
|
@ -27,8 +27,8 @@ class Apparatus : InventoryItem;
|
|||||||
enum AppaType : char[] altName
|
enum AppaType : char[] altName
|
||||||
{
|
{
|
||||||
MortarPestle = 0 : "Mortar and Pestle",
|
MortarPestle = 0 : "Mortar and Pestle",
|
||||||
Albemic = 1,
|
Albemic = 1 : "Albemic"
|
||||||
Calcinator = 2
|
Calcinator = 2 : "Calcinator"
|
||||||
}
|
}
|
||||||
|
|
||||||
float quality;
|
float quality;
|
@ -49,7 +49,7 @@ char[] name, id;
|
|||||||
char[] owner;
|
char[] owner;
|
||||||
|
|
||||||
// A global variable? Don't know what it's used for.
|
// A global variable? Don't know what it's used for.
|
||||||
char[] global;
|
char[] glob;
|
||||||
|
|
||||||
// Reference to a soul trapped creature?
|
// Reference to a soul trapped creature?
|
||||||
char[] soulID;
|
char[] soulID;
|
||||||
@ -61,10 +61,8 @@ int indx;
|
|||||||
// Magic value / health / uses of an item?
|
// Magic value / health / uses of an item?
|
||||||
float xchg;
|
float xchg;
|
||||||
|
|
||||||
// ?? See comment below
|
// These depend on the item in question
|
||||||
int intv, nam9;
|
int intv, nam9;
|
||||||
|
|
||||||
// ??
|
|
||||||
int fltv;
|
int fltv;
|
||||||
int unam;
|
int unam;
|
||||||
|
|
@ -37,8 +37,6 @@ void initMonsterScripts()
|
|||||||
{
|
{
|
||||||
// Add the script directories
|
// Add the script directories
|
||||||
vm.addPath("mscripts/");
|
vm.addPath("mscripts/");
|
||||||
vm.addPath("mscripts/gameobjects/");
|
|
||||||
vm.addPath("mscripts/sound/");
|
|
||||||
|
|
||||||
// Import some modules into the global scope, so we won't have to
|
// Import some modules into the global scope, so we won't have to
|
||||||
// import them manually in each script.
|
// import them manually in each script.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Email: < korslund@gmail.com >
|
Email: < korslund@gmail.com >
|
||||||
WWW: http://openmw.snaptoad.com/
|
WWW: http://openmw.snaptoad.com/
|
||||||
|
|
||||||
This file (jukebox.mn) is part of the OpenMW package.
|
This file (music.mn) is part of the OpenMW package.
|
||||||
|
|
||||||
OpenMW is distributed as free software: you can redistribute it
|
OpenMW is distributed as free software: you can redistribute it
|
||||||
and/or modify it under the terms of the GNU General Public License
|
and/or modify it under the terms of the GNU General Public License
|
||||||
|
@ -163,6 +163,7 @@ struct MeshLoader
|
|||||||
auto pc = cast(NiPathController)data.controller;
|
auto pc = cast(NiPathController)data.controller;
|
||||||
if(kc !is null)
|
if(kc !is null)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
writefln("Found keyframe controller");
|
writefln("Found keyframe controller");
|
||||||
writefln(" Node name was: %s", data.name);
|
writefln(" Node name was: %s", data.name);
|
||||||
assert(cont.target is data);
|
assert(cont.target is data);
|
||||||
@ -170,6 +171,7 @@ struct MeshLoader
|
|||||||
auto kcd = kc.data;
|
auto kcd = kc.data;
|
||||||
writefln(" Types: %s %s %s",
|
writefln(" Types: %s %s %s",
|
||||||
kcd.rotType, kcd.traType, kcd.scaleType);
|
kcd.rotType, kcd.traType, kcd.scaleType);
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Adding keyframes:
|
Adding keyframes:
|
||||||
@ -189,7 +191,7 @@ struct MeshLoader
|
|||||||
}
|
}
|
||||||
else if(pc !is null)
|
else if(pc !is null)
|
||||||
{
|
{
|
||||||
writefln("Found path controller");
|
//writefln("Found path controller");
|
||||||
assert(cont.target is data);
|
assert(cont.target is data);
|
||||||
}
|
}
|
||||||
else writefln("Other controller (%s)", cont);
|
else writefln("Other controller (%s)", cont);
|
||||||
|
@ -465,24 +465,24 @@ class CellData
|
|||||||
else fail(format(" UNKNOWN REFERENCE! Type ", cast(int)it.i.type));
|
else fail(format(" UNKNOWN REFERENCE! Type ", cast(int)it.i.type));
|
||||||
|
|
||||||
// Now that the object has found it's place, load data
|
// Now that the object has found it's place, load data
|
||||||
// into base.
|
// into the object.
|
||||||
|
|
||||||
with(*mo)
|
with(*mo)
|
||||||
{
|
{
|
||||||
// Scale. Multiply with the existing scale value.
|
// Scale. Multiply with the existing scale value.
|
||||||
float scale = getFloat("scale");
|
float *scale = getFloatPtr("scale");
|
||||||
setFloat("scale", scale*getHNOFloat("XSCL", 1.0));
|
*scale *= getHNOFloat("XSCL", 1.0);
|
||||||
|
|
||||||
// Statics only need the position data. Skip the
|
// Statics only need the position data. Skip the rest
|
||||||
// unneeded calls to isNextSub() as an optimization.
|
// as an optimization.
|
||||||
if(stat) goto readpos;
|
if(stat) goto readpos;
|
||||||
|
|
||||||
// An NPC that owns this object (and will get angry if
|
// The NPC that owns this object (and will get angry
|
||||||
// you steal it)
|
// if you steal it)
|
||||||
setString8("owner", getHNOString("ANAM"));
|
setString8("owner", getHNOString("ANAM"));
|
||||||
|
|
||||||
// I have no idea, link to a global variable perhaps?
|
// I have no idea, link to a global variable perhaps?
|
||||||
setString8("global", getHNOString("BNAM"));
|
setString8("glob", getHNOString("BNAM"));
|
||||||
|
|
||||||
// ID of creature trapped in a soul gem (?)
|
// ID of creature trapped in a soul gem (?)
|
||||||
setString8("soulID", getHNOString("XSOL"));
|
setString8("soulID", getHNOString("XSOL"));
|
||||||
|
@ -68,7 +68,7 @@ struct Music
|
|||||||
assert(controlC is null);
|
assert(controlC is null);
|
||||||
assert(controlM is null);
|
assert(controlM is null);
|
||||||
|
|
||||||
jukeC = vm.load("Jukebox");
|
jukeC = vm.load("sound.Jukebox");
|
||||||
jukeC.bind("waitUntilFinished",
|
jukeC.bind("waitUntilFinished",
|
||||||
new Idle_waitUntilFinished);
|
new Idle_waitUntilFinished);
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ struct Music
|
|||||||
|
|
||||||
jukeC.bindConst({new Jukebox(params.obj()); });
|
jukeC.bindConst({new Jukebox(params.obj()); });
|
||||||
|
|
||||||
controlC = vm.load("Music");
|
controlC = vm.load("sound.Music");
|
||||||
controlM = controlC.getSing();
|
controlM = controlC.getSing();
|
||||||
controlM.call("setup");
|
controlM.call("setup");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user