mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
Fixed TLightGroup message 45 and 46, used by TLightBargraph.
Issue #25.
This commit is contained in:
parent
87e44b700b
commit
ac289c7f48
@ -54,9 +54,8 @@ int TLightBargraph::Message(int code, float value)
|
|||||||
TLightGroup::Message(45, static_cast<float>(timeIndex / 2));
|
TLightGroup::Message(45, static_cast<float>(timeIndex / 2));
|
||||||
if (!(timeIndex & 1))
|
if (!(timeIndex & 1))
|
||||||
TLightGroup::Message(46, 0.0);
|
TLightGroup::Message(46, 0.0);
|
||||||
float* timeArray = TimerTimeArray;
|
if (TimerTimeArray)
|
||||||
if (timeArray)
|
TimerBargraph = timer::set(TimerTimeArray[timeIndex], this, BargraphTimerExpired);
|
||||||
TimerBargraph = timer::set(timeArray[timeIndex], this, BargraphTimerExpired);
|
|
||||||
TimeIndex = timeIndex;
|
TimeIndex = timeIndex;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -30,7 +30,7 @@ TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballCompone
|
|||||||
|
|
||||||
int TLightGroup::Message(int code, float value)
|
int TLightGroup::Message(int code, float value)
|
||||||
{
|
{
|
||||||
auto count = static_cast<int>(List.size());
|
auto const count = static_cast<int>(List.size());
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 1011:
|
case 1011:
|
||||||
@ -352,24 +352,18 @@ int TLightGroup::Message(int code, float value)
|
|||||||
{
|
{
|
||||||
control::handler(code, this);
|
control::handler(code, this);
|
||||||
auto index = static_cast<int>(floor(value));
|
auto index = static_cast<int>(floor(value));
|
||||||
if (index >= 0)
|
if (index >= 0 && index < count)
|
||||||
{
|
{
|
||||||
if (index <= count)
|
// Turn off lights (index, end]
|
||||||
|
for (auto i = count - 1; i > index; i--)
|
||||||
{
|
{
|
||||||
auto countSub1 = count - 1;
|
List.at(i)->Message(20, 0.0);
|
||||||
if (countSub1 > index)
|
|
||||||
{
|
|
||||||
for (auto i = countSub1, k = countSub1 - index; k != 0; i--, k--)
|
|
||||||
{
|
|
||||||
auto light = List.at(i);
|
|
||||||
light->Message(20, 0.0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto it = List.rbegin(); it != List.rend(); ++it)
|
// Turn on lights [begin, index]
|
||||||
|
for (auto i = index; i >= 0; i--)
|
||||||
{
|
{
|
||||||
(*it)->Message(19, 0.0);
|
List.at(i)->Message(19, 0.0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -448,7 +442,7 @@ int TLightGroup::next_light_down()
|
|||||||
{
|
{
|
||||||
for (auto index = static_cast<int>(List.size()) - 1; index >= 0; --index)
|
for (auto index = static_cast<int>(List.size()) - 1; index >= 0; --index)
|
||||||
{
|
{
|
||||||
if (!List.at(index)->BmpIndex1)
|
if (List.at(index)->BmpIndex1)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user