/* OpenMW - The completely unofficial reimplementation of Morrowind Copyright (C) 2008 Nicolay Korslund Email: < korslund@gmail.com > WWW: http://openmw.snaptoad.com/ This file (controller.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 nif.controller; import nif.record; // Time controller abstract class Controller : Record { Controller next; ushort flags; float frequency, phase; // Don't know what these do. float timeStart, timeStop; Controlled target; override: void read() {with(nifFile){ super.read(); debug(verbose) writef("Next controller "); getIndex(); flags = getUshort; frequency = getFloatIs(1); phase = getFloat; timeStart = getFloat; timeStop = getFloat; debug(verbose) writef("Target "); getIndex(); debug(verbose) { writefln("Flags: %x", flags); writefln("Frequency: ", frequency); writefln("Phase: ", phase); writefln("Start time: ", timeStart); writefln("Stop time: ", timeStop); } }} void sortOut(Record[] list) { super.sortOut(list); next = lookup!(Controller)(list); target = lookup!(Controlled)(list); } } alias NiBSPArrayController NiParticleSystemController; class NiBSPArrayController : Controller { override: void read() {with(nifFile){ super.read(); // At the moment, just skip it all //* // 23 floats = 92 bytes // 3 ints = 12 bytes // 3 shorts = 6 bytes // 1 byte = 1 byte // Total: 111 bytes seekCur(111); short s = wgetShort; seekCur(15 + s*40); /*/ float speed, speedRandom, angle, angleRandom; speed = wgetFloat; speedRandom = wgetFloat; angle = wgetFloat; angleRandom = wgetFloat; wgetFloat(); // Unknown wgetFloat(); // Sometimes pi for(int i; i<10; i++) wgetFloat(); wgetByte(); wgetFloat(); wgetFloat(); wgetFloat(); wgetShort(); wgetVector(); debug(verbose) writef("Emitter: "); wgetInt(); wgetShort(); wgetFloat(); wgetInt(); wgetInt(); wgetShort(); debug(verbose) writefln("begin particle group"); short s = wgetShort; wgetShort(); for(short i; i