|
2 | 2 |
|
3 | 3 | #include <array>
|
4 | 4 | #include <cstdint>
|
| 5 | +#include <limits> |
5 | 6 | #include <string_view>
|
6 | 7 |
|
7 | 8 | #include <RED4ext/Buffer.hpp>
|
|
13 | 14 | #include <RED4ext/InstanceType.hpp>
|
14 | 15 | #include <RED4ext/NodeRef.hpp>
|
15 | 16 | #include <RED4ext/ResourceReference.hpp>
|
| 17 | +#include <RED4ext/Scripting/Natives/Generated/curve/EInterpolationType.hpp> |
| 18 | +#include <RED4ext/Scripting/Natives/Generated/curve/ESegmentsLinkType.hpp> |
16 | 19 |
|
17 | 20 | namespace RED4ext
|
18 | 21 | {
|
@@ -209,18 +212,55 @@ static_assert(sizeof(StaticArray<std::array<uint8_t, 5>, 32>) ==
|
209 | 212 | template<typename T, uint32_t MAX_LEN>
|
210 | 213 | using NativeArray = std::array<T, MAX_LEN>;
|
211 | 214 |
|
| 215 | +template<typename T> |
| 216 | +struct CurvePoint |
| 217 | +{ |
| 218 | + float point; |
| 219 | + T value; |
| 220 | +}; |
| 221 | + |
| 222 | +template<typename T> |
| 223 | +struct CurveBuffer |
| 224 | +{ |
| 225 | + [[nodiscard]] float* GetPoints() noexcept; |
| 226 | + [[nodiscard]] T* GetValues() noexcept; |
| 227 | + |
| 228 | + uint32_t size; // 00 |
| 229 | + uint32_t unk04; // 04 |
| 230 | + uint32_t offsetPoints; // 08 |
| 231 | + uint32_t offsetValues; // 12 |
| 232 | + // float points[size]; // 16 |
| 233 | + // T values[size]; // 16 + size * sizeof(float) |
| 234 | +}; |
| 235 | +RED4EXT_ASSERT_SIZE(CurveBuffer<float>, 0x10); |
| 236 | +RED4EXT_ASSERT_OFFSET(CurveBuffer<float>, size, 0x00); |
| 237 | +RED4EXT_ASSERT_OFFSET(CurveBuffer<float>, offsetPoints, 0x08); |
| 238 | +RED4EXT_ASSERT_OFFSET(CurveBuffer<float>, offsetValues, 0x0C); |
| 239 | + |
212 | 240 | template<typename T>
|
213 | 241 | struct CurveData
|
214 | 242 | {
|
215 |
| - uint64_t unk00; // 00 |
216 |
| - uint64_t unk08; // 08 |
217 |
| - uint64_t unk10; // 10 |
218 |
| - uint64_t unk18; // 18 |
219 |
| - uint64_t unk20; // 20 |
220 |
| - uint64_t unk28; // 28 |
221 |
| - uint64_t unk30; // 30 |
| 243 | + [[nodiscard]] CurveBuffer<T>* GetCurve() const noexcept; |
| 244 | + [[nodiscard]] uint32_t GetSize() const noexcept; |
| 245 | + |
| 246 | + [[nodiscard]] CurvePoint<T> GetPoint(uint32_t aIndex) const noexcept; |
| 247 | + void SetPoint(uint32_t aIndex, const CurvePoint<T>& acPoint) noexcept; |
| 248 | + void SetPoint(uint32_t aIndex, float aPoint, const T& acValue) noexcept; |
| 249 | + |
| 250 | + [[nodiscard]] inline CurvePoint<T> operator[](uint32_t aIndex) const noexcept; |
| 251 | + |
| 252 | + CName name; // 00 |
| 253 | + RawBuffer buffer; // 08 |
| 254 | + CBaseRTTIType* valueType; // 40 |
| 255 | + curve::EInterpolationType interpolationType; // 48 |
| 256 | + curve::ESegmentsLinkType linkType; // 49 |
222 | 257 | };
|
223 | 258 | RED4EXT_ASSERT_SIZE(CurveData<float>, 0x38);
|
| 259 | +RED4EXT_ASSERT_OFFSET(CurveData<float>, name, 0x00); |
| 260 | +RED4EXT_ASSERT_OFFSET(CurveData<float>, buffer, 0x08); |
| 261 | +RED4EXT_ASSERT_OFFSET(CurveData<float>, valueType, 0x28); |
| 262 | +RED4EXT_ASSERT_OFFSET(CurveData<float>, interpolationType, 0x30); |
| 263 | +RED4EXT_ASSERT_OFFSET(CurveData<float>, linkType, 0x31); |
224 | 264 |
|
225 | 265 | template<typename T>
|
226 | 266 | struct ScriptRef
|
|
0 commit comments