2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-12 20:46:09 +00:00

CFluidUVMotion: Return std::array by value from CalculateFluidTextureOffset()

Same behavior, but allows for easier use of API and makes it harder to
misuse. It also makes it easier for analysis to determine out of bounds,
given we leverage std::array rather than a pointer that causes arrays to
decay and lose their size information.
This commit is contained in:
Lioncash
2020-04-12 09:20:22 -04:00
parent 3c8619ba44
commit 14f6dd2cd8
4 changed files with 26 additions and 19 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <array>
#include "Runtime/RetroTypes.hpp"
#include "Runtime/rstl.hpp"
@@ -38,6 +40,8 @@ private:
float x50_orientation;
public:
using FluidOffsets = std::array<std::array<float, 2>, 3>;
CFluidUVMotion(float timeToWrap, float orientation, const SFluidLayerMotion& colorLayer,
const SFluidLayerMotion& pattern1Layer, const SFluidLayerMotion& pattern2Layer);
CFluidUVMotion(float timeToWrap, float orientation);
@@ -45,6 +49,8 @@ public:
const rstl::reserved_vector<SFluidLayerMotion, 3>& GetFluidLayers() const { return x0_fluidLayers; }
float GetOrientation() const { return x50_orientation; }
float GetOOTimeToWrapTexPage() const { return x4c_ooTimeToWrap; }
void CalculateFluidTextureOffset(float, float[3][2]) const;
// In game binaries this uses an out pointer instead of return by value.
FluidOffsets CalculateFluidTextureOffset(float t) const;
};
} // namespace urde