Add CEnvPoint::MAX_CHANNELS constant

This commit is contained in:
Robert Müller 2023-01-24 20:11:33 +01:00
parent 3c42b224f5
commit 7ce143bd9e
2 changed files with 9 additions and 4 deletions

View file

@ -4955,21 +4955,21 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
ToolBar.VSplitLeft(15.0f, &Button, &ToolBar); ToolBar.VSplitLeft(15.0f, &Button, &ToolBar);
static const char *s_aapNames[4][4] = { static const char *s_aapNames[4][CEnvPoint::MAX_CHANNELS] = {
{"V", "", "", ""}, {"V", "", "", ""},
{"", "", "", ""}, {"", "", "", ""},
{"X", "Y", "R", ""}, {"X", "Y", "R", ""},
{"R", "G", "B", "A"}, {"R", "G", "B", "A"},
}; };
static const char *s_aapDescriptions[4][4] = { static const char *s_aapDescriptions[4][CEnvPoint::MAX_CHANNELS] = {
{"Volume of the envelope", "", "", ""}, {"Volume of the envelope", "", "", ""},
{"", "", "", ""}, {"", "", "", ""},
{"X-axis of the envelope", "Y-axis of the envelope", "Rotation of the envelope", ""}, {"X-axis of the envelope", "Y-axis of the envelope", "Rotation of the envelope", ""},
{"Red value of the envelope", "Green value of the envelope", "Blue value of the envelope", "Alpha value of the envelope"}, {"Red value of the envelope", "Green value of the envelope", "Blue value of the envelope", "Alpha value of the envelope"},
}; };
static int s_aChannelButtons[4] = {0}; static int s_aChannelButtons[CEnvPoint::MAX_CHANNELS] = {0};
int Bit = 1; int Bit = 1;
for(int i = 0; i < pEnvelope->m_Channels; i++, Bit <<= 1) for(int i = 0; i < pEnvelope->m_Channels; i++, Bit <<= 1)

View file

@ -342,9 +342,14 @@ struct CMapItemVersion
struct CEnvPoint struct CEnvPoint
{ {
enum
{
MAX_CHANNELS = 4,
};
int m_Time; // in ms int m_Time; // in ms
int m_Curvetype; int m_Curvetype;
int m_aValues[4]; // 1-4 depending on envelope (22.10 fixed point) int m_aValues[MAX_CHANNELS]; // 1-4 depending on envelope (22.10 fixed point)
bool operator<(const CEnvPoint &Other) const { return m_Time < Other.m_Time; } bool operator<(const CEnvPoint &Other) const { return m_Time < Other.m_Time; }
}; };