bool hsSemaphore::TryWait() { DWORD result = ::WaitForSingleObject(fSemaH, 0); hsAssert(result != WAIT_ABANDONED, "hsSemaphore -> Abandoned Semaphore"); return result == WAIT_OBJECT_0; }
uint32_t pfConsoleContext::GetNumVars( void ) const { hsAssert( fVarValues.GetCount() == fVarNames.GetCount(), "Mismatch in console var context arrays" ); return fVarValues.GetCount(); }
//============================================================================ void pyVault::OfferLinkToPlayer( const pyAgeLinkStruct & link, uint32_t playerID ) { hsAssert(false, "eric, port me"); }
void plWin32VideoSound::SetStartPos(unsigned bytes) { //do nothing hsAssert(false, "unimplemented cause unnecessary for this class"); }
void plWin32VideoSound::ISetActualTime(double t) { hsAssert(false, "unimplemented cause unnecessary for this class"); }
PyObject* plPythonSDLModifier::ISDLVarIdxToPython(plSimpleStateVariable* var, int type, int idx) { switch (type) { case plVarDescriptor::kShort: case plVarDescriptor::kByte: case plVarDescriptor::kInt: { int v; var->Get(&v, idx); return PyInt_FromLong(v); } case plVarDescriptor::kFloat: case plVarDescriptor::kAgeTimeOfDay: { float v; var->Get(&v, idx); return PyFloat_FromDouble(v); } case plVarDescriptor::kBool: { bool v; var->Get(&v, idx); return PyLong_FromLong(v); } case plVarDescriptor::kString32: { char v[256]; var->Get(v, idx); return PyString_FromString(v); } case plVarDescriptor::kKey: { plKey v; var->Get(&v, idx); PyObject* keyObj = pyKey::New(v); return keyObj; } case plVarDescriptor::kDouble: { double v; var->Get(&v, idx); return PyFloat_FromDouble(v); } // case plVarDescriptor::kStateDescriptor: // case plVarDescriptor::kCreatable: // case plVarDescriptor::kVector3: // case plVarDescriptor::kPoint3: // case plVarDescriptor::kRGB: // case plVarDescriptor::kRGBA: // case plVarDescriptor::kQuaternion: default: hsAssert(0, "Not supported yet"); } PYTHON_RETURN_NONE; }
void pfGUIMenuItem::IUpdateSingleSkinBuffer( uint16_t y, hsBool sel ) { hsAssert( fSkin != nil && fDynTextMap != nil, "Invalid pointers in IUpdateSingleSkinBuffer()" ); // Note: add 1 to the visible height so we get enough overlap to take care of mipmapping issues uint16_t x = 0, totWidth = fDynTextMap->GetVisibleWidth(); uint16_t totHeight = y + fDynTextMap->GetVisibleHeight(); pfGUISkin::pfSRect element; totWidth -= fSkin->GetElement( pfGUISkin::kRightSpan ).fWidth; if( fHowToSkin == kTop ) { // Draw up-left corner element = fSkin->GetElement( pfGUISkin::kUpLeftCorner ); fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite ); x += element.fWidth; element = fSkin->GetElement( pfGUISkin::kTopSpan ); for( ; x < totWidth; ) { uint16_t wid = element.fWidth; if( x + wid > totWidth ) wid = totWidth - x; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite ); x += wid; } element = fSkin->GetElement( pfGUISkin::kUpRightCorner ); fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite ); y += element.fHeight; } else if( fHowToSkin == kBottom ) { // Clip some space for now totHeight -= fSkin->GetElement( pfGUISkin::kLowerLeftCorner ).fHeight; } // Group drawing by skin elements for caching performance uint16_t startY = y; x = 0; element = fSkin->GetElement( pfGUISkin::kLeftSpan ); for( ; y < totHeight; ) { uint16_t ht = element.fHeight; if( y + ht > totHeight ) ht = totHeight - y; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite ); y += ht; } x += element.fWidth; if( sel ) element = fSkin->GetElement( pfGUISkin::kSelectedFill ); else element = fSkin->GetElement( pfGUISkin::kMiddleFill ); for( ; x < totWidth; ) { uint16_t wid = element.fWidth; if( x + wid > totWidth ) wid = totWidth - x; for( y = startY; y < totHeight; ) { uint16_t ht = element.fHeight; if( y + ht > totHeight ) ht = totHeight - y; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, ht, plDynamicTextMap::kImgSprite ); y += ht; } x += wid; } element = fSkin->GetElement( pfGUISkin::kRightSpan ); for( y = startY; y < totHeight; ) { uint16_t ht = element.fHeight; if( y + ht > totHeight ) ht = totHeight - y; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, ht, plDynamicTextMap::kImgSprite ); y += ht; } if( fHowToSkin == kBottom ) { x = 0; // Draw lower-left corner element = fSkin->GetElement( pfGUISkin::kLowerLeftCorner ); fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite ); x += element.fWidth; element = fSkin->GetElement( pfGUISkin::kBottomSpan ); for( ; x < totWidth; ) { uint16_t wid = element.fWidth; if( x + wid > totWidth ) wid = totWidth - x; fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, wid, element.fHeight, plDynamicTextMap::kImgSprite ); x += wid; } element = fSkin->GetElement( pfGUISkin::kLowerRightCorner ); fDynTextMap->DrawClippedImage( x, y, fSkin->GetTexture(), element.fX, element.fY, element.fWidth, element.fHeight, plDynamicTextMap::kImgSprite ); y += element.fHeight; } }
bool plGBufferGroup::ReserveVertStorage( uint32_t numVerts, uint32_t *vbIndex, uint32_t *cell, uint32_t *offset, uint8_t flags ) { uint8_t *storagePtr = nil; uint32_t cStartIdx = 0, vStartIdx = 0; plGBufferColor *cStoragePtr = nil; int i; if( numVerts >= kMaxNumVertsPerBuffer ) { hsAssert( false, "Egad, why on earth are you adding that many verts???" ); return false; } /// Find a spot if( !(flags & kReserveIsolate) ) { for( i = 0; i < fVertBuffStorage.size(); i++ ) { if( GetNumVertsLeft( i ) >= numVerts ) break; } } else { i = fVertBuffStorage.size(); } if( i == fVertBuffStorage.size() ) { if( (flags & kReserveInterleaved) || (flags & kReserveSeparated) ) { fVertBuffStorage.push_back(nullptr); fVertBuffSizes.push_back(0); } fVertBuffStarts.push_back(0); fVertBuffEnds.push_back(-1); fColorBuffStorage.push_back(nullptr); fColorBuffCounts.push_back(0); fCells.emplace_back(); } *vbIndex = i; if( !(flags & kReserveInterleaved) ) { // Splitting the data into vertex and color storage if( flags & kReserveSeparated ) { /// Increase the storage size vStartIdx = fVertBuffSizes[ i ]; storagePtr = new uint8_t[ fVertBuffSizes[ i ] + numVerts * fLiteStride ]; if( fVertBuffSizes[ i ] > 0 ) memcpy( storagePtr, fVertBuffStorage[ i ], fVertBuffSizes[ i ] ); fVertBuffSizes[ i ] += numVerts * fLiteStride; plProfile_NewMem(MemBufGrpVertex, numVerts * fLiteStride); } /// Color too cStartIdx = fColorBuffCounts[ i ]; cStoragePtr = new plGBufferColor[ fColorBuffCounts[ i ] + numVerts ]; if( fColorBuffCounts[ i ] > 0 ) memcpy( cStoragePtr, fColorBuffStorage[ i ], fColorBuffCounts[ i ] * sizeof( plGBufferColor ) ); } else { // Interleaved /// Increase the storage size vStartIdx = fVertBuffSizes[ i ]; storagePtr = new uint8_t[ fVertBuffSizes[ i ] + numVerts * fStride ]; if( fVertBuffSizes[ i ] > 0 ) memcpy( storagePtr, fVertBuffStorage[ i ], fVertBuffSizes[ i ] ); fVertBuffSizes[ i ] += numVerts * fStride; plProfile_NewMem(MemBufGrpVertex, numVerts * fStride); } /// Switch over if (storagePtr) { if( fVertBuffStorage[ i ] != nil ) delete [] fVertBuffStorage[ i ]; fVertBuffStorage[ i ] = storagePtr; } if (cStoragePtr) { if (fColorBuffStorage[ i ]) delete [] fColorBuffStorage[ i ]; fColorBuffStorage[ i ] = cStoragePtr; fColorBuffCounts[ i ] += numVerts; plProfile_NewMem(MemBufGrpVertex, numVerts * sizeof(plGBufferColor)); } if (fVertexBufferRefs.size() > i && fVertexBufferRefs[i]) { hsRefCnt_SafeUnRef(fVertexBufferRefs[i]); fVertexBufferRefs[i] = nullptr; } /// Append a cell entry *cell = IMakeCell( i, flags, vStartIdx, cStartIdx, numVerts, offset ); /// All done! return true; }
void plGBufferGroup::StuffToVertStorage( plGeometrySpan *srcSpan, uint32_t vbIndex, uint32_t cell, uint32_t offset, uint8_t flags ) { uint8_t *tempPtr, stride; plGBufferColor *cPtr; int i, j, numVerts; plGBufferCell *cellPtr; hsAssert( vbIndex < fVertBuffStorage.size(), "Invalid vbIndex in StuffToVertStorage()" ); hsAssert( cell < fCells[ vbIndex ].size(), "Invalid cell in StuffToVertStorage()" ); IGetStartVtxPointer( vbIndex, cell, offset, tempPtr, cPtr ); cellPtr = &fCells[ vbIndex ][ cell ]; stride = ( cellPtr->fColorStart != (uint32_t)-1 ) ? fLiteStride : fStride; numVerts = srcSpan->fNumVerts; /// Copy the data over for( i = 0; i < numVerts; i++ ) { hsPoint3 pos; float weights[ 3 ]; uint32_t weightIndices; hsVector3 norm; uint32_t color, specColor; hsPoint3 uvs[ plGeometrySpan::kMaxNumUVChannels ]; float *fPtr; uint32_t *dPtr; // Gotta swap the data around, since plGeometrySpans store the data slightly differently if( flags & kReserveColors ) { /// Just do colors srcSpan->ExtractVertex( i, &pos, &norm, &color, &specColor ); cPtr->fDiffuse = color; cPtr->fSpecular = specColor; } else { /// Do verts, possibly colors as well srcSpan->ExtractVertex( i, &pos, &norm, &color, &specColor ); if( ( fFormat & kSkinWeightMask ) != kSkinNoWeights ) srcSpan->ExtractWeights( i, weights, &weightIndices ); for( j = 0; j < GetNumUVs(); j++ ) srcSpan->ExtractUv( i, j, &uvs[ j ] ); // Stuff it in now fPtr = (float *)tempPtr; fPtr[ 0 ] = pos.fX; fPtr[ 1 ] = pos.fY; fPtr[ 2 ] = pos.fZ; fPtr += 3; if( fNumSkinWeights > 0 ) { for( j = 0; j < fNumSkinWeights; j++ ) { *fPtr = weights[ j ]; fPtr++; } if( fNumSkinWeights > 1 ) { dPtr = (uint32_t *)fPtr; *dPtr = weightIndices; dPtr++; fPtr = (float *)dPtr; } } fPtr[ 0 ] = norm.fX; fPtr[ 1 ] = norm.fY; fPtr[ 2 ] = norm.fZ; fPtr += 3; if( flags & kReserveInterleaved ) { dPtr = (uint32_t *)fPtr; dPtr[ 0 ] = color; dPtr[ 1 ] = specColor; dPtr += 2; fPtr = (float *)dPtr; } else { cPtr->fDiffuse = color; cPtr->fSpecular = specColor; } for( j = 0; j < GetNumUVs(); j++ ) { fPtr[ 0 ] = uvs[ j ].fX; fPtr[ 1 ] = uvs[ j ].fY; fPtr[ 2 ] = uvs[ j ].fZ; fPtr += 3; } } tempPtr += stride; cPtr++; } if( ( vbIndex < fVertexBufferRefs.size() ) && fVertexBufferRefs[ vbIndex ] ) fVertexBufferRefs[ vbIndex ]->SetDirty( true ); }
void plGBufferGroup::Read( hsStream *s ) { uint32_t totalDynSize, i, count, temp = 0, j; uint8_t *vData; uint16_t *iData; plGBufferColor *cData; s->ReadLE( &fFormat ); totalDynSize = s->ReadLE32(); fStride = ICalcVertexSize( fLiteStride ); fVertBuffSizes.clear(); fVertBuffStarts.clear(); fVertBuffEnds.clear(); fColorBuffCounts.clear(); fIdxBuffCounts.clear(); fIdxBuffStarts.clear(); fIdxBuffEnds.clear(); fVertBuffStorage.clear(); fIdxBuffStorage.clear(); plVertCoder coder; /// Create buffers and read in as we go count = s->ReadLE32(); fVertBuffSizes.reserve(count); fVertBuffStarts.reserve(count); fVertBuffEnds.reserve(count); fVertBuffStorage.reserve(count); fColorBuffCounts.reserve(count); fColorBuffStorage.reserve(count); for( i = 0; i < count; i++ ) { if( fFormat & kEncoded ) { const uint16_t numVerts = s->ReadLE16(); const uint32_t size = numVerts * fStride; fVertBuffSizes.push_back(size); fVertBuffStarts.push_back(0); fVertBuffEnds.push_back(-1); vData = new uint8_t[size]; fVertBuffStorage.push_back( vData ); plProfile_NewMem(MemBufGrpVertex, temp); coder.Read(s, vData, fFormat, fStride, numVerts); fColorBuffCounts.push_back(0); fColorBuffStorage.push_back(nullptr); } else { temp = s->ReadLE32(); fVertBuffSizes.push_back( temp ); fVertBuffStarts.push_back(0); fVertBuffEnds.push_back(-1); vData = new uint8_t[ temp ]; hsAssert(vData, "Not enough memory to read in vertices"); s->Read( temp, (void *)vData ); fVertBuffStorage.push_back( vData ); plProfile_NewMem(MemBufGrpVertex, temp); temp = s->ReadLE32(); fColorBuffCounts.push_back( temp ); if( temp > 0 ) { cData = new plGBufferColor[ temp ]; s->Read( temp * sizeof( plGBufferColor ), (void *)cData ); plProfile_NewMem(MemBufGrpVertex, temp * sizeof(plGBufferColor)); } else cData = nil; fColorBuffStorage.push_back( cData ); } } count = s->ReadLE32(); fIdxBuffCounts.reserve(count); fIdxBuffStarts.reserve(count); fIdxBuffEnds.reserve(count); fIdxBuffStorage.reserve(count); for( i = 0; i < count; i++ ) { temp = s->ReadLE32(); fIdxBuffCounts.push_back(temp); fIdxBuffStarts.push_back(0); fIdxBuffEnds.push_back(-1); iData = new uint16_t[ temp ]; hsAssert( iData != nil, "Not enough memory to read in indices" ); s->ReadLE16( temp, (uint16_t *)iData ); fIdxBuffStorage.push_back( iData ); plProfile_NewMem(MemBufGrpIndex, temp * sizeof(uint16_t)); } /// Read in cell arrays, one per vBuffer fCells.resize(fVertBuffStorage.size()); for( i = 0; i < fVertBuffStorage.size(); i++ ) { temp = s->ReadLE32(); fCells[ i ].resize( temp ); for( j = 0; j < temp; j++ ) fCells[ i ][ j ].Read( s ); } }
void plGBufferGroup::Write( hsStream *s ) { uint32_t totalDynSize, i, j; #define MF_VERTCODE_ENABLED #ifdef MF_VERTCODE_ENABLED fFormat |= kEncoded; #endif // MF_VERTCODE_ENABLED #ifdef VERT_LOG hsUNIXStream log; log.Open("log\\GBuf.log", "ab"); #endif /// Calc total dynamic data size, for fun totalDynSize = 0; for (auto it : fVertBuffSizes) totalDynSize += it; for (auto it : fIdxBuffCounts) totalDynSize += sizeof( uint16_t ) * it; s->WriteLE( fFormat ); s->WriteLE32( totalDynSize ); plVertCoder coder; /// Write out dyanmic data s->WriteLE32( (uint32_t)fVertBuffStorage.size() ); for (i = 0; i < fVertBuffStorage.size(); ++i) { #ifdef MF_VERTCODE_ENABLED hsAssert(fCells[i].size() == 1, "Data must be interleaved for compression"); uint32_t numVerts = fVertBuffSizes[i] / fStride; s->WriteLE16((uint16_t)numVerts); coder.Write(s, fVertBuffStorage[i], fFormat, fStride, (uint16_t)numVerts); #ifdef VERT_LOG char buf[256]; sprintf(buf, "Vert Buff: %u bytes, idx=%u\r\n", fVertBuffSizes[i], i); log.WriteString(buf); for (int xx = 0; xx < fVertBuffSizes[i] / 4; xx++) { float* buff32 = (float*)fVertBuffStorage[i]; buff32 += xx; sprintf(buf, "[%d]%f\r\n", xx*4, *buff32); log.WriteString(buf); } #endif #else // MF_VERTCODE_ENABLED s->WriteLE32( fVertBuffSizes[ i ] ); s->Write( fVertBuffSizes[ i ], (void *)fVertBuffStorage[ i ] ); s->WriteLE32( fColorBuffCounts[ i ] ); s->Write( fColorBuffCounts[ i ] * sizeof( plGBufferColor ), (void *)fColorBuffStorage[ i ] ); #endif // MF_VERTCODE_ENABLED } s->WriteLE32( (uint32_t)fIdxBuffCounts.size() ); for( i = 0; i < fIdxBuffStorage.size(); i++ ) { s->WriteLE32( fIdxBuffCounts[ i ] ); s->WriteLE16( fIdxBuffCounts[ i ], fIdxBuffStorage[ i ] ); } /// Write out cell arrays for (i = 0; i < fVertBuffStorage.size(); i++) { s->WriteLE32( fCells[ i ].size() ); for( j = 0; j < fCells[ i ].size(); j++ ) fCells[ i ][ j ].Write( s ); } #ifdef VERT_LOG log.Close(); #endif // All done! }
plGBufferTriangle *plGBufferGroup::ConvertToTriList( int16_t spanIndex, uint32_t whichIdx, uint32_t whichVtx, uint32_t whichCell, uint32_t start, uint32_t numTriangles ) { plGBufferTriangle *array; uint16_t *storagePtr; uint8_t *vertStgPtr, stride; float *vertPtr; int i, j; hsPoint3 center; uint32_t offsetBy; plGBufferColor *wastePtr; /// Sanity checks hsAssert( whichIdx < fIdxBuffStorage.size(), "Invalid index buffer ID to ConvertToTriList()" ); hsAssert( whichVtx < fVertBuffStorage.size(), "Invalid vertex buffer ID to ConvertToTriList()" ); hsAssert( start < fIdxBuffCounts[ whichIdx ], "Invalid start index to ConvertToTriList()" ); hsAssert( start + numTriangles * 3 <= fIdxBuffCounts[ whichIdx ], "Invalid count to ConvertToTriList()" ); hsAssert( whichCell < fCells[ whichVtx ].size(), "Invalid cell to ConvertToTriList()" ); /// Create the array and fill it array = new plGBufferTriangle[ numTriangles ]; hsAssert( array != nil, "Not enough memory to create triangle data in ConvertToTriList()" ); storagePtr = fIdxBuffStorage[ whichIdx ]; IGetStartVtxPointer( whichVtx, whichCell, 0, vertStgPtr, wastePtr ); offsetBy = GetVertStartFromCell( whichVtx, whichCell, 0 ); stride = ( fCells[ whichVtx ][ whichCell ].fColorStart == (uint32_t)-1 ) ? fStride : fLiteStride; for( i = 0, j = 0; i < numTriangles; i++, j += 3 ) { center.fX = center.fY = center.fZ = 0; vertPtr = (float *)( vertStgPtr + stride * ( storagePtr[ start + j + 0 ] - offsetBy ) ); center.fX += vertPtr[ 0 ]; center.fY += vertPtr[ 1 ]; center.fZ += vertPtr[ 2 ]; vertPtr = (float *)( vertStgPtr + stride * ( storagePtr[ start + j + 1 ] - offsetBy ) ); center.fX += vertPtr[ 0 ]; center.fY += vertPtr[ 1 ]; center.fZ += vertPtr[ 2 ]; vertPtr = (float *)( vertStgPtr + stride * ( storagePtr[ start + j + 2 ] - offsetBy ) ); center.fX += vertPtr[ 0 ]; center.fY += vertPtr[ 1 ]; center.fZ += vertPtr[ 2 ]; center.fX /= 3.0f; center.fY /= 3.0f; center.fZ /= 3.0f; array[ i ].fSpanIndex = spanIndex; array[ i ].fIndex1 = storagePtr[ start + j + 0 ]; array[ i ].fIndex2 = storagePtr[ start + j + 1 ]; array[ i ].fIndex3 = storagePtr[ start + j + 2 ]; array[ i ].fCenter = center; } /// All done! return array; }
const pfConsoleCmdParam::CharPtr & pfConsoleCmdParam::IToString( void ) const { hsAssert( fType == kString || fType == kAny, "Trying to use a non-string parameter as a string!" ); return fValue.s; }
void pfConsoleCmd::ICreateSignature(const char *paramList ) { static char seps[] = " :-"; char params[ 256 ]; char *ptr, *nextPtr, *tok, *tok2; int i; /// Simple check if( paramList == nil ) { fSignature.Push( kAny ); fSigLabels.Push( (char *)nil ); return; } /// So we can do stuff to it hsAssert( strlen( paramList ) < sizeof( params ), "Make the (#*$& params string larger!" ); hsStrcpy( params, paramList ); fSignature.Reset(); fSigLabels.Reset(); /// Loop through all the types given in the list ptr = params; do { /// Find break nextPtr = strchr( ptr, ',' ); if( nextPtr != nil ) { *nextPtr = 0; nextPtr++; } /// Do this param tok = strtok( ptr, seps ); if( tok == nil && ptr == params ) break; hsAssert( tok != nil, "Bad parameter list for console command!" ); tok2 = strtok( nil, seps ); if( tok2 != nil ) { // Type and label: assume label second fSigLabels.Push( hsStrcpy( tok2 ) ); } else fSigLabels.Push( (char *)nil ); // Find type for( i = 0; i < kNumTypes; i++ ) { if( strcmp( fSigTypes[ i ], tok ) == 0 ) { fSignature.Push( (uint8_t)i ); break; } } hsAssert( i < kNumTypes, "Bad parameter type in console command parameter list!" ); } while( ( ptr = nextPtr ) != nil ); }
void plCreatableListHelper::Write( hsStream* s, hsResMgr* mgr ) { if ( !( fFlags&kWritten ) ) { // write items to ram stream hsRAMStream ram; uint16_t nItems = fItems.size(); ram.WriteLE( nItems ); for ( std::map<uint16_t,plCreatable*>::iterator ii=fItems.begin(); ii!=fItems.end(); ++ii ) { uint16_t id = ii->first; plCreatable * item = ii->second; uint16_t classIdx = item->ClassIndex(); ram.WriteLE( id ); ram.WriteLE( classIdx ); item->Write( &ram, mgr ); } // read ram stream into a buffer uint32_t bufSz = ram.GetPosition(); ram.Rewind(); std::string buf; buf.resize( bufSz ); ram.Read( bufSz, (void*)buf.data() ); // maybe compress the buffer if ( fFlags&kWantCompression && bufSz>fCompressionThreshold ) { plZlibCompress compressor; uint32_t zBufSz; std::string zBuf; zBuf.resize( bufSz ); bool ans = compressor.Compress( (uint8_t*)zBuf.data(), &zBufSz, (const uint8_t*)buf.data(), bufSz ); bool compressed = ( ans && zBufSz ); hsAssert( compressed, "plCreatableListHelper: Failed to compress buffer." ); if ( compressed ) { zBuf.resize( zBufSz ); buf = zBuf; fFlags |= kCompressed; hsLogEntry( plNetApp::StaticDebugMsg( "plCreatableListHelper: compressed from {} to {}", bufSz, zBufSz ) ); } } ram.Truncate(); ram.WriteLE( fFlags ); ram.WriteLE( bufSz ); if ( fFlags&kCompressed ) { uint32_t zBufSz = buf.size(); ram.WriteLE( zBufSz ); } ram.Write( buf.size(), buf.data() ); uint32_t sz = ram.GetPosition(); ram.Rewind(); fWritten.resize( sz ); ram.Read( sz, (void*)fWritten.data() ); fFlags |= kWritten; } s->Write( fWritten.size(), fWritten.data() ); }
void pyVaultNode::SetID( uint32_t v ) { hsAssert(false, "Why are you changing the node id?"); }
bool plPythonSDLModifier::IPythonVarIdxToSDL(plSimpleStateVariable* var, int varIdx, int type, PyObject* pyVar, const char* hintstring) { switch (type) { case plVarDescriptor::kShort: case plVarDescriptor::kByte: case plVarDescriptor::kBool: case plVarDescriptor::kInt: if (PyInt_Check(pyVar)) { int v = PyInt_AsLong(pyVar); var->Set(v, varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); return true; } else if (PyLong_Check(pyVar)) { int v = (int)PyLong_AsLong(pyVar); var->Set(v, varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); return true; } else if (PyFloat_Check(pyVar)) { int v = (int)PyFloat_AsDouble(pyVar); var->Set(v, varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); return true; } break; case plVarDescriptor::kFloat: if (PyFloat_Check(pyVar)) { float v = (float)PyFloat_AsDouble(pyVar); var->Set(v, varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); return true; } // does python think that its an integer? too bad, we'll make it a float anyhow! else if (PyInt_Check(pyVar)) { float v = (float)PyInt_AsLong(pyVar); var->Set(v, varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); return true; } break; case plVarDescriptor::kString32: if (PyString_Check(pyVar)) { char* v = PyString_AsString(pyVar); var->Set(v, varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); } break; case plVarDescriptor::kKey: { pyKey* key = PythonInterface::GetpyKeyFromPython(pyVar); if ( key ) var->Set(key->getKey(),varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); } break; case plVarDescriptor::kDouble: if (PyFloat_Check(pyVar)) { double v = PyFloat_AsDouble(pyVar); var->Set(v, varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); return true; } else if (PyInt_Check(pyVar)) { double v = (double)PyInt_AsLong(pyVar); var->Set(v, varIdx); if (hintstring) var->GetNotificationInfo().SetHintString(hintstring); return true; } break; case plVarDescriptor::kAgeTimeOfDay: break; default: hsAssert(0, "Not supported yet"); } return false; }
void pyVaultNode::SetOwnerNodeID( uint32_t v ) { hsAssert(false, "eric, implement me."); }
void pyVaultPlayerInfoListNode::Sort() { hsAssert(false, "eric, port me"); }
// Get the client ID from my Vault client. uint32_t pyVaultNode::GetClientID() { hsAssert(false, "eric, port me"); return 0; }
void plCubicEnvironmap::CopyToFace( plMipmap *mip, uint8_t face ) { hsAssert( face < 6, "Invalid face index in CopyToFace()" ); hsAssert( fFaces[ face ] != nil, "nil face in CopyToFace()" ); hsAssert( mip != nil, "nil source in CopyToFace()" ); if( !fInitialized ) { // Make sure our stuff matches fCompressionType = mip->fCompressionType; if( fCompressionType != kDirectXCompression ) fUncompressedInfo.fType = mip->fUncompressedInfo.fType; else { fDirectXInfo.fBlockSize = mip->fDirectXInfo.fBlockSize; fDirectXInfo.fCompressionType = mip->fDirectXInfo.fCompressionType; } fPixelSize = mip->GetPixelSize(); fSpace = kDirectSpace; fFlags = mip->GetFlags(); fInitialized = true; } else { // Check to make sure their stuff matches if( IsCompressed() != mip->IsCompressed() ) { hsAssert( false, "Compression types do not match in CopyToFace()" ); return; } if( !IsCompressed() ) { if( fUncompressedInfo.fType != mip->fUncompressedInfo.fType ) { hsAssert( false, "Compression formats do not match in CopyToFace()" ); return; } } else { if( fDirectXInfo.fBlockSize != mip->fDirectXInfo.fBlockSize || fDirectXInfo.fCompressionType != mip->fDirectXInfo.fCompressionType ) { hsAssert( false, "Compression formats do not match in CopyToFace()" ); return; } } if( fPixelSize != mip->GetPixelSize() ) { hsAssert( false, "Bitdepths do not match in CopyToFace()" ); return; } if( fFlags != mip->GetFlags() ) { hsAssert( false, "Flags do not match in CopyToFace()" ); } } // Copy the mipmap data fFaces[ face ]->CopyFrom( mip ); }
plString plGenericType::IToString( void ) const { hsAssert( fType == kString || fType == kAny, "Trying to use a non-string parameter as a string!" ); return fS; }
float plWin32VideoSound::GetActualTimeSec() { hsAssert(false, "unimplemented cause unnecessary for this class"); return 0; }
void plUpdatableClient::IGetUpdate() { // If the semaphore is signaled an update is ready if (fUpdateSignal && fUpdateSignal->Wait(0)) { hsNamedPipeStream s; s.Open(fPipeName, "r"); #ifdef LOG_SCENEVIWER fLog->Clear(); static int numUpdates = 0; numUpdates++; fLog->AddLineF(plStatusLog::kBlue, "SceneViewer Update #%d", numUpdates); #endif // LOG_SCENEVIWER uint8_t type = s.ReadByte(); if (type == ClientUpdate::kShutdown) { #ifdef LOG_SCENEVIWER fLog->AddLine("Client shutdown"); #endif // LOG_SCENEVIWER PostMessage(GetWindowHandle(), WM_SYSCOMMAND, SC_CLOSE, 0); } else if (type == ClientUpdate::kUpdate) { fDirty = true; IEnableProxies(false); int i; // // Delete the deleted keys // int numDeleted = s.ReadSwap32(); std::vector<plKey*> delKeys; delKeys.reserve(numDeleted); for (i = 0; i < numDeleted; i++) { plUoid uoid; uoid.Read(&s); plKey *key = hsgResMgr::ResMgr()->FindKey(uoid); hsAssert(key, "Key to delete not found"); if (key) { #ifdef LOG_SCENEVIWER fLog->AddLineF("Remove: %s", key->GetName()); #endif // LOG_SCENEVIWER GetResMgr()->RemoveObject(key, false); delKeys.push_back(key); } } GetResMgr()->DelayLoad(true); // // Read in the changed spans // hsStatusMessage("ReadChangedSpans\n"); GetResMgr()->ReadChangedSpans(&s); // // Read in the new keys and objects // int numNew = s.ReadSwap32(); for (i = 0; i < numNew; i++) { plCreatable *cre = GetResMgr()->ReadCreatable(&s); hsKeyedObject *ko = hsKeyedObject::ConvertNoRef(cre); #ifdef LOG_SCENEVIWER if (ko) fLog->AddLineF("Read: %s", ko->GetKey()->GetName()); else fLog->AddLine("Read: (null)"); #endif // LOG_SCENEVIWER } GetResMgr()->DelayLoad(false); // Clear out any objects that were never reloaded (really deleted) for (i = 0; i < delKeys.size(); i++) { plKey *key = delKeys[i]; if (!key->ObjectIsLoaded()) { #ifdef LOG_SCENEVIWER fLog->AddLineF("Key deleted: %s", key->GetName()); #endif // LOG_SCENEVIWER GetResMgr()->RemoveObject(key); } } IEnableProxies(true); } s.Close(); } }
bool plWin32VideoSound::LoadSound(bool is3D) { hsAssert(false, "unimplemented cause unnecessary for this class"); return false; }
static inline void CopyToPlasma( plUUID * dst, const uuid_t & src ) { hsAssert( sizeof(uuid_t)==sizeof(dst->fData), "sizeof(uuid_t)!=sizeof(plUUID)" ); memcpy( (void*)dst->fData, (const void *)src, sizeof( plUUID ) ); }
virtual NxAssertResponse reportAssertViolation(const char* message, const char* file, int line) { plSimulationMgr::Log("access violation : %s (%s(%d))", message, file, line); hsAssert(0, "PhysX assert, see simulation log for details"); return NX_AR_CONTINUE; }
static inline void CopyToNative( uuid_t & dst, const plUUID * src ) { hsAssert( sizeof(uuid_t)==sizeof(src->fData), "sizeof(uuid_t)!=sizeof(plUUID)" ); memcpy( (void*)dst, (const void *)src->fData, sizeof( plUUID ) ); }
void plRenderRequestAck::Write(hsStream* s, hsResMgr* mgr) { hsAssert(false, "Transmission/read/write of render requests not currently supported"); plMessage::IMsgWrite(s, mgr); }
void hsMutex::Unlock() { BOOL result = ::ReleaseMutex(fMutexH); hsAssert(result != 0, "hsMutex::Unlock Failed!"); }