#include "irrKlangSceneNode.h" // id for our scene node, 'ikng', short for 'irrklang'. // If this line doesn't work, you are probably using irrlicht 1.3 or earlier. // Then remove the MAKE_IRR_ID thing and replace it with a random number. const int IRRKLANG_SCENE_NODE_ID = MAKE_IRR_ID('i','k','n','g'); // type name for our scene node const char* irrKlangSceneNodeTypeName = "irrKlangSceneNode"; CIrrKlangSceneNode::CIrrKlangSceneNode(irrklang::ISoundEngine* soundEngine, scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id) : scene::ISceneNode(parent, mgr, id), SoundEngine(soundEngine) { setAutomaticCulling(scene::EAC_OFF); MinDistance = 20.0f; // a usual good value for irrlicht engine applications MaxDistance = -1.0f; PlayMode = EPM_RANDOM; TimeMsDelayFinished = 0; DeleteWhenFinished = false; MaxTimeMsInterval = 5000; MinTimeMsInterval = 1000; Sound = 0; PlayedCount = 0; if (SoundEngine) SoundEngine->grab();
bool CNPKReader::scanLocalHeader() { SNPKHeader header; // Read and validate the header File->read(&header, sizeof(header)); if (!isHeaderValid(header)) return false; // Seek to the table of contents #ifdef __BIG_ENDIAN__ header.Offset = os::Byteswap::byteswap(header.Offset); header.Length = os::Byteswap::byteswap(header.Length); #endif header.Offset += 8; core::stringc dirName; bool inTOC=true; // Loop through each entry in the table of contents while (inTOC && (File->getPos() < File->getSize())) { // read an entry char tag[4]={0}; SNPKFileEntry entry; File->read(tag, 4); const int numTag = MAKE_IRR_ID(tag[3],tag[2],tag[1],tag[0]); int size; bool isDir=true; switch (numTag) { case MAKE_IRR_ID('D','I','R','_'): { File->read(&size, 4); readString(entry.Name); entry.Length=0; entry.Offset=0; #ifdef IRR_DEBUG_NPK_READER os::Printer::log("Dir", entry.Name); #endif } break; case MAKE_IRR_ID('F','I','L','E'): { File->read(&size, 4); File->read(&entry.Offset, 4); File->read(&entry.Length, 4); readString(entry.Name); isDir=false; #ifdef IRR_DEBUG_NPK_READER os::Printer::log("File", entry.Name); #endif #ifdef __BIG_ENDIAN__ entry.Offset = os::Byteswap::byteswap(entry.Offset); entry.Length = os::Byteswap::byteswap(entry.Length); #endif } break; case MAKE_IRR_ID('D','E','N','D'): { File->read(&size, 4); entry.Name=""; entry.Length=0; entry.Offset=0; const s32 pos = dirName.findLast('/', dirName.size()-2); if (pos==-1) dirName=""; else dirName=dirName.subString(0, pos); #ifdef IRR_DEBUG_NPK_READER os::Printer::log("Dirend", dirName); #endif } break; default: inTOC=false; } // skip root dir if (isDir) { if (!entry.Name.size() || (entry.Name==".") || (entry.Name=="<noname>")) continue; dirName += entry.Name; dirName += "/"; } #ifdef IRR_DEBUG_NPK_READER os::Printer::log("Name", entry.Name); #endif addItem((isDir?dirName:dirName+entry.Name), entry.Offset+header.Offset, entry.Length, isDir); } return true; }
namespace scene { const int ESNT_PER_CAMERA_NODE = MAKE_IRR_ID('p','c','a','m'); }
namespace scene { const int ESNT_LOD_NODE = MAKE_IRR_ID('l','o','d','n'); }
#include "cAudioSceneNode.h" // id for our scene node, 'ikng', short for 'irrklang'. // If this line doesn't work, you are probably using irrlicht 1.3 or earlier. // Then remove the MAKE_IRR_ID thing and replace it with a random number. const int CAUDIO_SCENE_NODE_ID = MAKE_IRR_ID('c','a','u','d'); // type name for our scene node const char* cAudioSceneNodeTypeName = "cAudioSceneNode"; CcAudioSceneNode::CcAudioSceneNode(cAudio::IAudioManager* audioManager, scene::ISceneNode* parent, scene::ISceneManager* smgr, s32 id) : scene::ISceneNode(parent, smgr, id), audioManager(audioManager) { setAutomaticCulling(scene::EAC_OFF); deleteWhenFinished = true; MinDistance = 20.0f; // a usual good value for irrlicht engine applications MaxDistance = -1.0f; PlayMode = EPM_RANDOM; TimeMsDelayFinished = 0; MaxTimeMsInterval = 5000; MinTimeMsInterval = 1000; PlayedCount = 0; if (audioManager) { audioSource = audioManager->create("","",false); }