void LoadViking() { IwGetResManager()->LoadGroup("viking/viking.group"); CIwResGroup* pGroup = IwGetResManager()->GetGroupNamed("viking"); ghostStore_Model[0] = (CIwModel*)pGroup->GetResNamed("viking", IW_GRAPHICS_RESTYPE_MODEL); ghostStoreCollision[0] = (GhostCollision*)pGroup->GetResNamed("viking", "GhostCollision"); ghostStore_Skin[0] = (CIwAnimSkin*)pGroup->GetResNamed("viking", IW_ANIM_RESTYPE_SKIN); ghostStore_Skel[0] = (CIwAnimSkel*)pGroup->GetResNamed("Armature", IW_ANIM_RESTYPE_SKELETON); ghostStore_Anims[0][GHOST_ANIM_IDLE] = (CIwAnim*)pGroup->GetResNamed("Armature_idle", IW_ANIM_RESTYPE_ANIMATION); ghostStore_Anims[0][GHOST_ANIM_AGRO] = (CIwAnim*)pGroup->GetResNamed("Armature_agro", IW_ANIM_RESTYPE_ANIMATION); ghostStore_Anims[0][GHOST_ANIM_DODGE] = (CIwAnim*)pGroup->GetResNamed("Armature_dodge", IW_ANIM_RESTYPE_ANIMATION); ghostStore_Anims[0][GHOST_ANIM_ATTACK] = (CIwAnim*)pGroup->GetResNamed("Armature_attack", IW_ANIM_RESTYPE_ANIMATION); ghostStore_Anims[0][GHOST_ANIM_CAPTURED] = (CIwAnim*)pGroup->GetResNamed("Armature_captured", IW_ANIM_RESTYPE_ANIMATION); }
void LoadSkelman() { IwGetResManager()->LoadGroup("Skelman/Skelman.group"); CIwResGroup* pGroup = IwGetResManager()->GetGroupNamed("Skelman"); ghostStore_Model[1] = (CIwModel*)pGroup->GetResNamed("GEO_For_Export", IW_GRAPHICS_RESTYPE_MODEL); ghostStoreCollision[1] = (GhostCollision*)pGroup->GetResNamed("GEO_For_Export", "GhostCollision"); ghostStore_Skin[1] = (CIwAnimSkin*)pGroup->GetResNamed("GEO_For_Export", IW_ANIM_RESTYPE_SKIN); ghostStore_Skel[1] = (CIwAnimSkel*)pGroup->GetResNamed("HIP01", IW_ANIM_RESTYPE_SKELETON); ghostStore_Anims[1][GHOST_ANIM_IDLE] = (CIwAnim*)pGroup->GetResNamed("Skelman_Idle", IW_ANIM_RESTYPE_ANIMATION); ghostStore_Anims[1][GHOST_ANIM_AGRO] = (CIwAnim*)pGroup->GetResNamed("Skelman_Idle", IW_ANIM_RESTYPE_ANIMATION); ghostStore_Anims[1][GHOST_ANIM_DODGE] = (CIwAnim*)pGroup->GetResNamed("Skelman_Miss", IW_ANIM_RESTYPE_ANIMATION); ghostStore_Anims[1][GHOST_ANIM_ATTACK] = (CIwAnim*)pGroup->GetResNamed("Skelman_Attack", IW_ANIM_RESTYPE_ANIMATION); ghostStore_Anims[1][GHOST_ANIM_CAPTURED] = (CIwAnim*)pGroup->GetResNamed("Skelman_Death", IW_ANIM_RESTYPE_ANIMATION); }
void ResourceManager::fireSound(const char* name) { if (!checkSound()) return; CIwResGroup* resGroup = IwGetResManager()->GetGroupNamed(SOUND_GROUP); CIwSoundSpec* SoundSpec = (CIwSoundSpec*)resGroup->GetResNamed(name, IW_SOUND_RESTYPE_SPEC); CIwSoundInst* SoundInstance = SoundSpec->Play(); }
void CLevel::Initialize(btDiscreteDynamicsWorld* pDynamicsWorld) { #if defined IW_DEBUG && (defined IW_BUILD_RESOURCES) if (IwGetResManager()->BuildResources()) return; // Register the model builder callbacks IwGetModelBuilder()->SetPostBuildFn(&BuildCollision); #endif CIwResGroup* pGroup = 0; m_iCurrentSegmentX = 0; m_iCurrentSegmentY = 0; m_pCurrentCollisionModel = NULL; m_pCurrentCollision = NULL; // allocating pointers m_apCollisionModel = new CIwModel*[NUM_SECTORS]; m_apCollision = new CCollision*[NUM_SECTORS]; m_apBodyGround = new btRigidBody*[NUM_SECTORS]; m_apGroundShape = new btBvhTriangleMeshShape*[NUM_SECTORS]; m_apMotionState = new btDefaultMotionState*[NUM_SECTORS]; m_apIndexVertexArrays = new btTriangleIndexVertexArray*[NUM_SECTORS]; m_apiColIndices = new int*[NUM_SECTORS]; m_apfColVertices = new float*[NUM_SECTORS]; m_pDynamicsWorld = pDynamicsWorld; btVector3 localInertia(0,0,0); pGroup = IwGetResManager()->LoadGroup("col3.group"); for (int i = 0; i < NUM_SECTORS; i++) { char strColFile[20]; sprintf(strColFile, "Box%d%d", i / 3, i % 3); m_apCollisionModel[i] = (CIwModel*)pGroup->GetResNamed(strColFile, IW_GRAPHICS_RESTYPE_MODEL); m_apCollision[i] = (CCollision*)pGroup->GetResNamed(strColFile, "CCollision"); // find some way to delete old unused trimeshes uint16 vertcount = m_apCollision[i]->GetVertCount(); m_apiColIndices[i] = (int*)malloc(vertcount * sizeof(int)); for (int j = 0; j < vertcount; j+=1) { m_apiColIndices[i][j] = j; //m_colIndices[i+1] = i+1; //m_colIndices[i+2] = i; } m_apfColVertices[i] = (btScalar*)malloc(vertcount*3 * sizeof(btScalar)); for (int j = 0; j<vertcount; j++) { m_apfColVertices[i][j*3] = m_apCollision[i]->GetVert(j).x; m_apfColVertices[i][j*3+1] = m_apCollision[i]->GetVert(j).y; m_apfColVertices[i][j*3+2] = m_apCollision[i]->GetVert(j).z; } // bullet m_apIndexVertexArrays[i] = new btTriangleIndexVertexArray(vertcount/3, m_apiColIndices[i], 3*sizeof(int), vertcount,(btScalar*) m_apfColVertices[i], 3*sizeof(btScalar)); m_apGroundShape[i] = new btBvhTriangleMeshShape(m_apIndexVertexArrays[i],true); m_pCollisionShapes.push_back(m_apGroundShape[i]); btTransform groundTransform; groundTransform.setIdentity(); groundTransform.setOrigin(btVector3(0,0,0)); //using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects m_apMotionState[i] = new btDefaultMotionState(groundTransform); btRigidBody::btRigidBodyConstructionInfo rbInfo(0.0f,m_apMotionState[i],m_apGroundShape[i],localInertia); m_apBodyGround[i] = new btRigidBody(rbInfo); //add the body to the dynamics world //body->setFriction(0.0f); m_apBodyGround[i]->setRestitution(0.9f); } m_pDynamicsWorld->addRigidBody(m_apBodyGround[0]); }