void plResponderModifier::read(hsStream* S, plResManager* mgr) { plSingleModifier::read(S, mgr); clearStates(); fStates.setSizeNull(S->readByte()); for (size_t i=0; i<fStates.getSize(); i++) { fStates[i] = new plResponderState(); fStates[i]->fNumCallbacks = S->readByte(); fStates[i]->fSwitchToState = S->readByte(); fStates[i]->fCmds.setSizeNull(S->readByte()); for (size_t j=0; j<fStates[i]->fCmds.getSize(); j++) { plMessage* msg = plMessage::Convert(mgr->ReadCreatable(S)); int8_t waitOn = S->readByte(); fStates[i]->fCmds[j] = new plResponderCmd(msg, waitOn); if (msg == NULL) throw hsNotImplementedException(__FILE__, __LINE__, "Responder Message"); } size_t count = S->readByte(); for (size_t j=0; j<count; j++) { int8_t wait = S->readByte(); fStates[i]->fWaitToCmd[wait] = S->readByte(); } } int8_t state = S->readByte(); if (state >= 0 && (size_t)state < fStates.getSize()) { fCurState = state; } else { plDebug::Warning("Invalid state %d found, will default to 0", state); fCurState = 0; } fEnabled = S->readBool(); fFlags = S->readByte(); }
void plWaveSet6::write(hsStream* S, plResManager* mgr) { plMultiModifier::write(S, mgr); throw hsNotImplementedException(__FILE__, __LINE__); }
void plWaveSet6::IPrcParse(const pfPrcTag* tag, plResManager* mgr) { throw hsNotImplementedException(__FILE__, __LINE__); }
void plGenericPhysical::IWritePXPhysical(hsStream* S, plResManager* mgr) { S->writeFloat(fMass); S->writeFloat(fFriction); S->writeFloat(fRestitution); S->writeByte(fBounds); S->writeByte(plPXSimDefs::toGroup(fMemberGroup, fCollideGroup)); S->writeInt(plPXSimDefs::setReportsOn(fReportGroup)); S->writeShort(fLOSDBs); mgr->writeKey(S, fObjectKey); mgr->writeKey(S, fSceneNode); mgr->writeKey(S, fSubWorld); mgr->writeKey(S, fSoundGroup); fPos.write(S); fRot.write(S); fProps.write(S); if (fBounds == plSimDefs::kSphereBounds) { S->writeFloat(fRadius); fOffset.write(S); } else if (fBounds == plSimDefs::kBoxBounds) { fDimensions.write(S); fOffset.write(S); } else if (fBounds == plSimDefs::kHullBounds) { #ifdef HAVE_PX_SDK if (!sPhysxWasInit) { NxInitCooking(); sPhysxWasInit = true; } NxConvexMeshDesc convexDesc; convexDesc.numVertices = fVerts.size(); convexDesc.pointStrideBytes = sizeof(hsVector3); convexDesc.points = &fVerts[0]; convexDesc.flags = NX_CF_COMPUTE_CONVEX; plPXStream buf(S); if (!NxCookConvexMesh(convexDesc, buf)) throw hsBadParamException(__FILE__, __LINE__, "Incorrect data for PhysX Hull Bake"); #else throw hsNotImplementedException(__FILE__, __LINE__, "PhysX HullBounds"); #endif } else { // Proxy or Explicit #ifdef HAVE_PX_SDK if (!sPhysxWasInit) { NxInitCooking(); sPhysxWasInit = true; } NxTriangleMeshDesc triDesc; triDesc.numVertices = fVerts.size(); triDesc.pointStrideBytes = sizeof(hsVector3); triDesc.points = &fVerts[0]; triDesc.numTriangles = fIndices.size() / 3; triDesc.triangleStrideBytes = sizeof(unsigned int) * 3; triDesc.triangles = &fIndices[0]; triDesc.flags = 0; // 32-bit appears to be the default for index size plPXStream buf(S); if (!NxCookTriangleMesh(triDesc, buf)) throw hsBadParamException(__FILE__, __LINE__, "Incorrect data for a PhysX Trimesh Bake"); #else throw hsNotImplementedException(__FILE__, __LINE__, "PhysX TriangleMesh"); #endif } }