2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-10 00:27:43 +00:00

CMorphBall: Use std::array where applicable

Makes the arrays strongly-typed and impervious to implicit
array->pointer decay.

This also uncovered an out of bounds memory read within UpdateEffects
cause by said array->pointer decay.
This commit is contained in:
Lioncash
2019-09-16 15:04:22 -04:00
parent e4b22ea9d8
commit 96f035f24b
3 changed files with 204 additions and 85 deletions

View File

@@ -1,5 +1,7 @@
#pragma once
#include <array>
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Collision/CCollidableSphere.hpp"
#include "Runtime/Collision/CCollisionInfoList.hpp"
@@ -282,9 +284,11 @@ public:
bool IsInBoost() const { return x1de4_24_inBoost; }
float GetBoostChargeTime() const { return x1de8_boostChargeTime; }
static const u8 BallGlowColors[9][3];
static const u8 BallTransFlashColors[9][3];
static const u8 BallAuxGlowColors[9][3];
// Contains red, green, and blue channel values
using ColorArray = std::array<u8, 3>;
static const std::array<ColorArray, 9> BallGlowColors;
static const std::array<ColorArray, 9> BallTransFlashColors;
static const std::array<ColorArray, 9> BallAuxGlowColors;
};
} // namespace urde