mirror of https://github.com/AxioDL/metaforce.git
ITweakPlayerRes: Make use of std::array where applicable
Performs the same changes that were recently applied to ITweakGunRes for consistency. Also eliminates some sign conversion warnings and deduplicates some array sizes.
This commit is contained in:
parent
08604d770a
commit
3f3b0e6ba8
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "ITweak.hpp"
|
#include "ITweak.hpp"
|
||||||
#include "Runtime/IFactory.hpp"
|
#include "Runtime/IFactory.hpp"
|
||||||
#include "Runtime/CPlayerState.hpp"
|
#include "Runtime/CPlayerState.hpp"
|
||||||
|
@ -20,30 +22,31 @@ struct ITweakPlayerRes : ITweak {
|
||||||
ResId x1c_minesBreakSecondBottomIcon;
|
ResId x1c_minesBreakSecondBottomIcon;
|
||||||
|
|
||||||
/* N, U, UL, L, DL, D, DR, R, UR */
|
/* N, U, UL, L, DL, D, DR, R, UR */
|
||||||
ResId x24_lStick[9];
|
std::array<ResId, 9> x24_lStick;
|
||||||
ResId x4c_cStick[9];
|
std::array<ResId, 9> x4c_cStick;
|
||||||
|
|
||||||
/* Out, In */
|
/* Out, In */
|
||||||
ResId x74_lTrigger[2];
|
std::array<ResId, 2> x74_lTrigger;
|
||||||
ResId x80_rTrigger[2];
|
std::array<ResId, 2> x80_rTrigger;
|
||||||
ResId x8c_startButton[2];
|
std::array<ResId, 2> x8c_startButton;
|
||||||
ResId x98_aButton[2];
|
std::array<ResId, 2> x98_aButton;
|
||||||
ResId xa4_bButton[2];
|
std::array<ResId, 2> xa4_bButton;
|
||||||
ResId xb0_xButton[2];
|
std::array<ResId, 2> xb0_xButton;
|
||||||
ResId xbc_yButton[2];
|
std::array<ResId, 2> xbc_yButton;
|
||||||
|
|
||||||
ResId xc4_ballTransitionsANCS;
|
ResId xc4_ballTransitionsANCS;
|
||||||
|
|
||||||
/* Power, Ice, Wave, Plasma, Phazon */
|
/* Power, Ice, Wave, Plasma, Phazon */
|
||||||
ResId xc8_ballTransitions[5];
|
std::array<ResId, 5> xc8_ballTransitions;
|
||||||
ResId xc8_cineGun[5];
|
std::array<ResId, 5> xc8_cineGun;
|
||||||
|
|
||||||
float xf0_cinematicMoveOutofIntoPlayerDistance;
|
float xf0_cinematicMoveOutofIntoPlayerDistance;
|
||||||
|
|
||||||
ResId GetBeamBallTransitionModel(EBeamId beam) const {
|
ResId GetBeamBallTransitionModel(EBeamId beam) const {
|
||||||
int b = int(beam);
|
auto b = size_t(beam);
|
||||||
if (b < 0 || b > 4)
|
if (b >= xc8_ballTransitions.size()) {
|
||||||
b = 0;
|
b = 0;
|
||||||
|
}
|
||||||
switch (EBeamId(b)) {
|
switch (EBeamId(b)) {
|
||||||
case EBeamId::Power:
|
case EBeamId::Power:
|
||||||
default:
|
default:
|
||||||
|
@ -60,9 +63,10 @@ struct ITweakPlayerRes : ITweak {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResId GetBeamCineModel(EBeamId beam) const {
|
ResId GetBeamCineModel(EBeamId beam) const {
|
||||||
int b = int(beam);
|
auto b = size_t(beam);
|
||||||
if (b < 0 || b > 4)
|
if (b >= xc8_cineGun.size()) {
|
||||||
b = 0;
|
b = 0;
|
||||||
|
}
|
||||||
switch (EBeamId(b)) {
|
switch (EBeamId(b)) {
|
||||||
case EBeamId::Power:
|
case EBeamId::Power:
|
||||||
default:
|
default:
|
||||||
|
@ -88,40 +92,51 @@ struct ITweakPlayerRes : ITweak {
|
||||||
x18_minesBreakSecondTopIcon = factory.GetResourceIdByName(_GetMinesBreakSecondTopIcon())->id;
|
x18_minesBreakSecondTopIcon = factory.GetResourceIdByName(_GetMinesBreakSecondTopIcon())->id;
|
||||||
x1c_minesBreakSecondBottomIcon = factory.GetResourceIdByName(_GetMinesBreakSecondBottomIcon())->id;
|
x1c_minesBreakSecondBottomIcon = factory.GetResourceIdByName(_GetMinesBreakSecondBottomIcon())->id;
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i)
|
for (size_t i = 0; i < x24_lStick.size(); ++i) {
|
||||||
x24_lStick[i] = factory.GetResourceIdByName(_GetLStick(i))->id;
|
x24_lStick[i] = factory.GetResourceIdByName(_GetLStick(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i)
|
for (size_t i = 0; i < x4c_cStick.size(); ++i) {
|
||||||
x4c_cStick[i] = factory.GetResourceIdByName(_GetCStick(i))->id;
|
x4c_cStick[i] = factory.GetResourceIdByName(_GetCStick(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (size_t i = 0; i < x74_lTrigger.size(); ++i) {
|
||||||
x74_lTrigger[i] = factory.GetResourceIdByName(_GetLTrigger(i))->id;
|
x74_lTrigger[i] = factory.GetResourceIdByName(_GetLTrigger(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (size_t i = 0; i < x80_rTrigger.size(); ++i) {
|
||||||
x80_rTrigger[i] = factory.GetResourceIdByName(_GetRTrigger(i))->id;
|
x80_rTrigger[i] = factory.GetResourceIdByName(_GetRTrigger(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (size_t i = 0; i < x8c_startButton.size(); ++i) {
|
||||||
x8c_startButton[i] = factory.GetResourceIdByName(_GetStartButton(i))->id;
|
x8c_startButton[i] = factory.GetResourceIdByName(_GetStartButton(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (size_t i = 0; i < x98_aButton.size(); ++i) {
|
||||||
x98_aButton[i] = factory.GetResourceIdByName(_GetAButton(i))->id;
|
x98_aButton[i] = factory.GetResourceIdByName(_GetAButton(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (size_t i = 0; i < xa4_bButton.size(); ++i) {
|
||||||
xa4_bButton[i] = factory.GetResourceIdByName(_GetBButton(i))->id;
|
xa4_bButton[i] = factory.GetResourceIdByName(_GetBButton(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (size_t i = 0; i < xb0_xButton.size(); ++i) {
|
||||||
xb0_xButton[i] = factory.GetResourceIdByName(_GetXButton(i))->id;
|
xb0_xButton[i] = factory.GetResourceIdByName(_GetXButton(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; ++i)
|
for (size_t i = 0; i < xbc_yButton.size(); ++i) {
|
||||||
xbc_yButton[i] = factory.GetResourceIdByName(_GetYButton(i))->id;
|
xbc_yButton[i] = factory.GetResourceIdByName(_GetYButton(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
xc4_ballTransitionsANCS = factory.GetResourceIdByName(_GetBallTransitionsANCS())->id;
|
xc4_ballTransitionsANCS = factory.GetResourceIdByName(_GetBallTransitionsANCS())->id;
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i)
|
for (size_t i = 0; i < xc8_ballTransitions.size(); ++i) {
|
||||||
xc8_ballTransitions[i] = factory.GetResourceIdByName(_GetBallTransitionBeamRes(i))->id;
|
xc8_ballTransitions[i] = factory.GetResourceIdByName(_GetBallTransitionBeamRes(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i)
|
for (size_t i = 0; i < xc8_cineGun.size(); ++i) {
|
||||||
xc8_cineGun[i] = factory.GetResourceIdByName(_GetBeamCineModel(i))->id;
|
xc8_cineGun[i] = factory.GetResourceIdByName(_GetBeamCineModel(i))->id;
|
||||||
|
}
|
||||||
|
|
||||||
xf0_cinematicMoveOutofIntoPlayerDistance = _GetCinematicMoveOutofIntoPlayerDistance();
|
xf0_cinematicMoveOutofIntoPlayerDistance = _GetCinematicMoveOutofIntoPlayerDistance();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue