player and ground cover

This commit is contained in:
marauder2k7 2025-06-19 14:10:00 +01:00
parent c6ec2fd6a1
commit 5d641929cf
5 changed files with 95 additions and 39 deletions

View file

@ -521,7 +521,7 @@ GroundCover::GroundCover()
mBillboardRects[i].point.set( 0.0f, 0.0f );
mBillboardRects[i].extent.set( 1.0f, 1.0f );
INIT_ASSET_ARRAY(Shape, i);
mShapeAsset[i].registerRefreshNotify(this);
mShapeInstances[i] = NULL;
@ -563,8 +563,7 @@ void GroundCover::initPersistFields()
addField( "billboardUVs", TypeRectUV, Offset( mBillboardRects, GroundCover ), MAX_COVERTYPES, "Subset material UV coordinates for this cover billboard." );
addField("shapeFilename", TypeFilename, Offset(mShapeName, GroundCover), MAX_COVERTYPES, "The cover shape filename. [Optional]", AbstractClassRep::FIELD_HideInInspectors);
INITPERSISTFIELD_SHAPEASSET_ARRAY(Shape, MAX_COVERTYPES, GroundCover, "The cover shape. [Optional]");
INITPERSISTFIELD_SHAPEASSET_ARRAY_REFACTOR(Shape, MAX_COVERTYPES, GroundCover, "The cover shape. [Optional]");
addField( "layer", TypeTerrainMaterialAssetId, Offset( mLayer, GroundCover ), MAX_COVERTYPES, "Terrain material assetId to limit coverage to, or blank to not limit." );
@ -767,10 +766,10 @@ U32 GroundCover::packUpdate( NetConnection *connection, U32 mask, BitStream *str
stream->write( mBillboardRects[i].point.y );
stream->write( mBillboardRects[i].extent.x );
stream->write( mBillboardRects[i].extent.y );
PACK_ASSET_ARRAY(connection, Shape, i);
}
PACK_ASSET_ARRAY_REFACTOR(connection, Shape, MAX_COVERTYPES)
stream->writeFlag( mDebugRenderCells );
stream->writeFlag( mDebugNoBillboards );
stream->writeFlag( mDebugNoShapes );
@ -838,10 +837,10 @@ void GroundCover::unpackUpdate( NetConnection *connection, BitStream *stream )
stream->read( &mBillboardRects[i].point.y );
stream->read( &mBillboardRects[i].extent.x );
stream->read( &mBillboardRects[i].extent.y );
UNPACK_ASSET_ARRAY(connection, Shape, i);
}
UNPACK_ASSET_ARRAY_REFACTOR(connection, Shape, MAX_COVERTYPES)
mDebugRenderCells = stream->readFlag();
mDebugNoBillboards = stream->readFlag();
mDebugNoShapes = stream->readFlag();
@ -887,17 +886,17 @@ void GroundCover::_initShapes()
for ( S32 i=0; i < MAX_COVERTYPES; i++ )
{
if ( mShapeAsset[i].isNull() || mShape[i] == nullptr)
if ( mShapeAsset[i].isNull() || getShape(i) == nullptr)
continue;
if ( isClientObject() && !mShape[i]->preloadMaterialList(mShape[i].getPath()) && NetConnection::filesWereDownloaded() )
if ( isClientObject() && !getShape(i)->preloadMaterialList(getShape(i).getPath()) && NetConnection::filesWereDownloaded() )
{
Con::warnf( "GroundCover::_initShapes() material preload failed for shape: %s", mShapeAssetId[i] );
Con::warnf( "GroundCover::_initShapes() material preload failed for shape: %s", _getShapeAssetId(i));
continue;
}
// Create the shape instance.
mShapeInstances[i] = new TSShapeInstance(mShape[i], isClientObject() );
mShapeInstances[i] = new TSShapeInstance(getShape(i), isClientObject() );
}
}