diff options
author | majestic <majesticcoding@gmail.com> | 2020-10-08 03:43:50 +0200 |
---|---|---|
committer | majestic <majesticcoding@gmail.com> | 2020-10-08 14:59:08 +0200 |
commit | 7861992fe6c8bc02600917c80053e08d9dcaa501 (patch) | |
tree | 29d12a69b0817b3989bacb153e111484b0a043db /src/entities | |
parent | Merge branch 'miami' of https://github.com/GTAmodding/re3 into miami (diff) | |
download | re3-7861992fe6c8bc02600917c80053e08d9dcaa501.tar re3-7861992fe6c8bc02600917c80053e08d9dcaa501.tar.gz re3-7861992fe6c8bc02600917c80053e08d9dcaa501.tar.bz2 re3-7861992fe6c8bc02600917c80053e08d9dcaa501.tar.lz re3-7861992fe6c8bc02600917c80053e08d9dcaa501.tar.xz re3-7861992fe6c8bc02600917c80053e08d9dcaa501.tar.zst re3-7861992fe6c8bc02600917c80053e08d9dcaa501.zip |
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/Entity.cpp | 33 | ||||
-rw-r--r-- | src/entities/Entity.h | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index cf1dd9e7..d7159e8c 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -1207,4 +1207,37 @@ bool CEntity::IsEntityOccluded(void) { } return false; +} + +/* +0x487A10 - SetAtomicAlphaCB +0x4879E0 - SetClumpAlphaCB +*/ + +RpMaterial* SetAtomicAlphaCB(RpMaterial *material, void *data) { + ((RwRGBA*)RpMaterialGetColor(material))->alpha = (uint8)(uintptr)data; + return material; +} + +RpAtomic* SetClumpAlphaCB(RpAtomic *atomic, void *data) { + RpGeometry *geometry = RpAtomicGetGeometry(atomic); + RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR); + RpGeometryForAllMaterials(geometry, SetAtomicAlphaCB, (void*)data); + return atomic; +} + +void CEntity::SetRwObjectAlpha(int32 alpha) { + if (m_rwObject != nil) { + switch (RwObjectGetType(m_rwObject)) { + case rpATOMIC: { + RpGeometry *geometry = RpAtomicGetGeometry(GetFirstAtomic(GetClump())); + RpGeometrySetFlags(geometry, RpGeometryGetFlags(geometry) | rpGEOMETRYMODULATEMATERIALCOLOR); + RpGeometryForAllMaterials(geometry, SetAtomicAlphaCB, (void*)alpha); + break; + } + case rpCLUMP: + RpClumpForAllAtomics((RpClump*)m_rwObject, SetClumpAlphaCB, (void*)alpha); + break; + } + } }
\ No newline at end of file diff --git a/src/entities/Entity.h b/src/entities/Entity.h index fd01b6f8..fbf5cb3b 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -179,6 +179,7 @@ public: void ModifyMatrixForTreeInWind(void); void ModifyMatrixForBannerInWind(void); void ProcessLightsForEntity(void); + void SetRwObjectAlpha(int32 alpha); static void AddSteamsFromGround(CPtrList& list); }; |