mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 05:40:25 +00:00
More work on the scripts (just playing around)
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@71 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
394c1d18aa
commit
c2d992c8f0
9 changed files with 121 additions and 26 deletions
27
mscripts/gameobjects/equipitem.mn
Normal file
27
mscripts/gameobjects/equipitem.mn
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||||
|
Copyright (C) 2008 Nicolay Korslund
|
||||||
|
Email: < korslund@gmail.com >
|
||||||
|
WWW: http://openmw.snaptoad.com/
|
||||||
|
|
||||||
|
This file (equipitem.mn) 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/ .
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Anything that can be equiped, like clothes, armor and weapons.
|
||||||
|
class EquipItem : InventoryItem;
|
||||||
|
|
||||||
|
int enchant;
|
|
@ -4,7 +4,7 @@
|
||||||
Email: < korslund@gmail.com >
|
Email: < korslund@gmail.com >
|
||||||
WWW: http://openmw.snaptoad.com/
|
WWW: http://openmw.snaptoad.com/
|
||||||
|
|
||||||
This file (cellobject.mn) is part of the OpenMW package.
|
This file (gameobject.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
|
||||||
|
@ -23,9 +23,18 @@
|
||||||
|
|
||||||
// An object that exists inside a cell. All cell objects must have a
|
// An object that exists inside a cell. All cell objects must have a
|
||||||
// position in space.
|
// position in space.
|
||||||
class CellObject : Object;
|
class GameObject : Object;
|
||||||
|
|
||||||
// Position and rotation in space
|
// Is this object placed in a cell? isPlaced is true if the object is
|
||||||
|
// displayed inside a cell with a mesh and given 3D coordinates, and
|
||||||
|
// false otherwise (eg. if it is part of the player's inventory or in
|
||||||
|
// a container.)
|
||||||
|
|
||||||
|
// TODO: This will change to an actual cell reference later on, and be
|
||||||
|
// null if the object is not placed.
|
||||||
|
bool isPlaced;
|
||||||
|
|
||||||
|
// Position and rotation in space (only valid if isPlaced is true.)
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
float r1, r2, r3;
|
float r1, r2, r3;
|
||||||
|
|
28
mscripts/gameobjects/inventoryitem.mn
Normal file
28
mscripts/gameobjects/inventoryitem.mn
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||||
|
Copyright (C) 2008 Nicolay Korslund
|
||||||
|
Email: < korslund@gmail.com >
|
||||||
|
WWW: http://openmw.snaptoad.com/
|
||||||
|
|
||||||
|
This file (inventoryitem.mn) 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/ .
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
class InventoryItem : GameObject;
|
||||||
|
|
||||||
|
float weight;
|
||||||
|
int value;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Light : CellObject;
|
class Light : InventoryItem;
|
||||||
|
|
||||||
// Time left in seconds (for carried lights)
|
// Time left in seconds (for carried lights)
|
||||||
float lifetime;
|
float lifetime;
|
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Objects that can have a lock level and a trap
|
// Objects that can have a lock level and a trap
|
||||||
class LockedObject : CellObject;
|
class LockedObject : GameObject;
|
||||||
|
|
||||||
// ID of key and trap type.
|
// ID of key and trap type.
|
||||||
char[] key, trap;
|
char[] key, trap;
|
31
mscripts/gameobjects/weapon.mn
Normal file
31
mscripts/gameobjects/weapon.mn
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
OpenMW - The completely unofficial reimplementation of Morrowind
|
||||||
|
Copyright (C) 2008 Nicolay Korslund
|
||||||
|
Email: < korslund@gmail.com >
|
||||||
|
WWW: http://openmw.snaptoad.com/
|
||||||
|
|
||||||
|
This file (weapon.mn) 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/ .
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Weapons (This is just an example, it's not used for anything yet.)
|
||||||
|
class Weapon : EquipItem;
|
||||||
|
|
||||||
|
float speed, reach;
|
||||||
|
|
||||||
|
bool magical, silver;
|
||||||
|
bool isTwohanded;
|
||||||
|
|
|
@ -35,7 +35,7 @@ void initMonsterScripts()
|
||||||
{
|
{
|
||||||
// Add the script directories
|
// Add the script directories
|
||||||
MonsterClass.addPath("mscripts/");
|
MonsterClass.addPath("mscripts/");
|
||||||
MonsterClass.addPath("mscripts/cellobjects/");
|
MonsterClass.addPath("mscripts/gameobjects/");
|
||||||
MonsterClass.addPath("mscripts/sound/");
|
MonsterClass.addPath("mscripts/sound/");
|
||||||
|
|
||||||
// Make sure the Object class is loaded
|
// Make sure the Object class is loaded
|
||||||
|
|
|
@ -42,7 +42,7 @@ import scene.player;
|
||||||
// Generic version of a "live" object
|
// Generic version of a "live" object
|
||||||
struct GenLive(T)
|
struct GenLive(T)
|
||||||
{
|
{
|
||||||
// Instance of class CellObject or a derived class (depending on
|
// Instance of class GameObject or a derived class (depending on
|
||||||
// object type)
|
// object type)
|
||||||
MonsterObject *obj;
|
MonsterObject *obj;
|
||||||
T *m;
|
T *m;
|
||||||
|
@ -259,13 +259,13 @@ class CellData
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static
|
static
|
||||||
MonsterClass cellObjC, doorC, lightC, lockedC;
|
MonsterClass gameObjC, doorC, lightC, lockedC;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
if(cellObjC !is null) return;
|
if(gameObjC !is null) return;
|
||||||
|
|
||||||
cellObjC = new MonsterClass("CellObject");
|
gameObjC = new MonsterClass("GameObject");
|
||||||
doorC = new MonsterClass("Door");
|
doorC = new MonsterClass("Door");
|
||||||
lightC = new MonsterClass("Light");
|
lightC = new MonsterClass("Light");
|
||||||
lockedC = new MonsterClass("LockedObject");
|
lockedC = new MonsterClass("LockedObject");
|
||||||
|
@ -310,7 +310,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveStatic ls;
|
LiveStatic ls;
|
||||||
ls.m = s;
|
ls.m = s;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
statics.insert(ls);
|
statics.insert(ls);
|
||||||
stat = true;
|
stat = true;
|
||||||
|
@ -320,7 +320,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveMisc ls;
|
LiveMisc ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
miscItems.insert(ls);
|
miscItems.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveActivator ls;
|
LiveActivator ls;
|
||||||
ls.m = a;
|
ls.m = a;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
activators.insert(ls);
|
activators.insert(ls);
|
||||||
activator = true;
|
activator = true;
|
||||||
|
@ -376,7 +376,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveNPC ls;
|
LiveNPC ls;
|
||||||
ls.m = n;
|
ls.m = n;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
npcs.insert(ls);
|
npcs.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LivePotion ls;
|
LivePotion ls;
|
||||||
ls.m = p;
|
ls.m = p;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
potions.insert(ls);
|
potions.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveApparatus ls;
|
LiveApparatus ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
appas.insert(ls);
|
appas.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -400,7 +400,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveIngredient ls;
|
LiveIngredient ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
ingredients.insert(ls);
|
ingredients.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveArmor ls;
|
LiveArmor ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
armors.insert(ls);
|
armors.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveWeapon ls;
|
LiveWeapon ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
weapons.insert(ls);
|
weapons.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -424,7 +424,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveBook ls;
|
LiveBook ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
books.insert(ls);
|
books.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveClothing ls;
|
LiveClothing ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
clothes.insert(ls);
|
clothes.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveTool ls;
|
LiveTool ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
tools.insert(ls);
|
tools.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveTool ls;
|
LiveTool ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
tools.insert(ls);
|
tools.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveTool ls;
|
LiveTool ls;
|
||||||
ls.m = m;
|
ls.m = m;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
tools.insert(ls);
|
tools.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ class CellData
|
||||||
{
|
{
|
||||||
LiveCreature ls;
|
LiveCreature ls;
|
||||||
ls.m = c;
|
ls.m = c;
|
||||||
ls.obj = cellObjC.createObject;
|
ls.obj = gameObjC.createObject;
|
||||||
mo = ls.obj;
|
mo = ls.obj;
|
||||||
creatures.insert(ls);
|
creatures.insert(ls);
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@ class CellData
|
||||||
ls.m = l.instCreature(playerData.level);
|
ls.m = l.instCreature(playerData.level);
|
||||||
if(ls.m != null)
|
if(ls.m != null)
|
||||||
{
|
{
|
||||||
ls.obj = cellObjC.createObject; mo = ls.obj;
|
ls.obj = gameObjC.createObject; mo = ls.obj;
|
||||||
creatures.insert(ls);
|
creatures.insert(ls);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue