2020-11-01 16:45:29 +01:00
|
|
|
#include "pch.h"
|
|
|
|
#include "TLightGroup.h"
|
2021-01-05 10:02:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
#include "control.h"
|
|
|
|
#include "loader.h"
|
|
|
|
#include "objlist_class.h"
|
|
|
|
#include "timer.h"
|
|
|
|
#include "TLight.h"
|
|
|
|
#include "TPinballTable.h"
|
|
|
|
|
2021-01-07 17:00:38 +01:00
|
|
|
TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
|
2021-01-05 10:02:43 +01:00
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
List = new objlist_class<TLight>(4, 4);
|
2021-01-05 10:02:43 +01:00
|
|
|
Timer = 0;
|
|
|
|
NotifyTimer = 0;
|
|
|
|
Reset();
|
|
|
|
if (groupIndex > 0)
|
|
|
|
{
|
|
|
|
int count;
|
|
|
|
Timer1TimeDefault = *loader::query_float_attribute(groupIndex, 0, 903);
|
2021-02-16 17:03:45 +01:00
|
|
|
int16_t* groupIndArr = loader::query_iattribute(groupIndex, 1027, &count);
|
2021-01-05 10:02:43 +01:00
|
|
|
for (int index = 0; index < count; ++groupIndArr)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto comp = dynamic_cast<TLight*>(table->find_component(*groupIndArr));
|
2021-01-05 10:02:43 +01:00
|
|
|
if (comp)
|
|
|
|
List->Add(comp);
|
|
|
|
++index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TLightGroup::~TLightGroup()
|
|
|
|
{
|
|
|
|
delete List;
|
|
|
|
}
|
|
|
|
|
|
|
|
int TLightGroup::Message(int code, float value)
|
|
|
|
{
|
|
|
|
switch (code)
|
|
|
|
{
|
|
|
|
case 1011:
|
|
|
|
case 1022:
|
|
|
|
break;
|
|
|
|
case 1020:
|
|
|
|
{
|
|
|
|
auto playerPtr = &PlayerData[PinballTable->CurrentPlayer];
|
|
|
|
playerPtr->MessageField = MessageField;
|
|
|
|
playerPtr->MessageField2 = MessageField2;
|
|
|
|
playerPtr->Timer1Time = Timer1Time;
|
|
|
|
|
|
|
|
Reset();
|
|
|
|
|
|
|
|
playerPtr = &PlayerData[static_cast<int>(floor(value))];
|
|
|
|
MessageField = playerPtr->MessageField;
|
|
|
|
MessageField2 = playerPtr->MessageField2;
|
|
|
|
Timer1Time = playerPtr->Timer1Time;
|
|
|
|
if (!(MessageField == 0))
|
|
|
|
TimerExpired(0, this);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1024:
|
|
|
|
Reset();
|
|
|
|
for (auto index = 0; index < PinballTable->PlayerCount; index++)
|
|
|
|
{
|
|
|
|
auto playerPtr = &PlayerData[index];
|
|
|
|
playerPtr->MessageField = MessageField;
|
|
|
|
playerPtr->MessageField2 = MessageField2;
|
|
|
|
playerPtr->Timer1Time = Timer1Time;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 24:
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto count = List->GetCount();
|
|
|
|
auto lastLight = List->Get(count - 1);
|
2021-01-05 10:02:43 +01:00
|
|
|
if (lastLight->FlasherActive || lastLight->FlasherFlag2 || lastLight->FlasherFlag1)
|
|
|
|
break;
|
|
|
|
if (MessageField2)
|
|
|
|
{
|
|
|
|
TLightGroup::Message(34, 0.0);
|
|
|
|
}
|
|
|
|
AnimationFlag = 1;
|
|
|
|
MessageField2 = code;
|
|
|
|
auto lightMessageField = lastLight->MessageField;
|
|
|
|
auto bmpIndex1 = lastLight->BmpIndex1;
|
|
|
|
for (auto index = count - 1; index > 0; --index)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto lightCur = List->Get(index);
|
|
|
|
auto lightPrev = List->Get(index - 1);
|
2021-01-05 10:02:43 +01:00
|
|
|
lightCur->Message(lightPrev->BmpIndex1 != 0, 0.0);
|
|
|
|
lightCur->MessageField = lightPrev->MessageField;
|
|
|
|
}
|
2021-01-30 12:19:25 +01:00
|
|
|
auto firstLight = List->Get(0);
|
2021-01-05 10:02:43 +01:00
|
|
|
firstLight->Message(bmpIndex1 != 0, 0.0);
|
|
|
|
firstLight->MessageField = lightMessageField;
|
|
|
|
reschedule_animation(value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 25:
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto count = List->GetCount();
|
|
|
|
auto lastLight = List->Get(count - 1);
|
2021-01-05 10:02:43 +01:00
|
|
|
if (lastLight->FlasherActive || lastLight->FlasherFlag2 || lastLight->FlasherFlag1)
|
|
|
|
break;
|
|
|
|
if (MessageField2)
|
|
|
|
{
|
|
|
|
TLightGroup::Message(34, 0.0);
|
|
|
|
}
|
2021-01-30 12:19:25 +01:00
|
|
|
auto firstLight = List->Get(0);
|
2021-01-05 10:02:43 +01:00
|
|
|
AnimationFlag = 1;
|
|
|
|
MessageField2 = code;
|
|
|
|
auto lightMessageField = firstLight->MessageField;
|
|
|
|
auto bmpIndex1 = firstLight->BmpIndex1;
|
|
|
|
for (auto index = 0; index < count - 1; index++)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto lightCur = List->Get(index);
|
|
|
|
auto lightNext = List->Get(index + 1);
|
2021-01-05 10:02:43 +01:00
|
|
|
lightCur->Message(lightNext->BmpIndex1 != 0, 0.0);
|
|
|
|
lightCur->MessageField = lightNext->MessageField;
|
|
|
|
}
|
|
|
|
lastLight->Message(bmpIndex1 != 0, 0.0);
|
|
|
|
lastLight->MessageField = lightMessageField;
|
|
|
|
reschedule_animation(value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 26:
|
|
|
|
{
|
|
|
|
if (AnimationFlag || !MessageField2)
|
|
|
|
start_animation();
|
|
|
|
MessageField2 = code;
|
|
|
|
AnimationFlag = 0;
|
2021-01-30 12:19:25 +01:00
|
|
|
auto count = List->GetCount();
|
|
|
|
auto lastLight = List->Get(count - 1);
|
2021-01-05 10:02:43 +01:00
|
|
|
auto flasherFlag2 = lastLight->FlasherFlag2;
|
|
|
|
for (auto i = count - 1; i > 0; --i)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto lightCur = List->Get(i);
|
|
|
|
auto lightPrev = List->Get(i - 1);
|
2021-01-05 10:02:43 +01:00
|
|
|
lightCur->Message((lightPrev->FlasherFlag2 != 0) + 8, 0.0);
|
|
|
|
}
|
2021-01-30 12:19:25 +01:00
|
|
|
auto firstLight = List->Get(0);
|
2021-01-05 10:02:43 +01:00
|
|
|
firstLight->Message((flasherFlag2 != 0) + 8, 0);
|
|
|
|
reschedule_animation(value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 27:
|
|
|
|
{
|
|
|
|
if (AnimationFlag || !MessageField2)
|
|
|
|
start_animation();
|
|
|
|
MessageField2 = code;
|
|
|
|
AnimationFlag = 0;
|
2021-01-30 12:19:25 +01:00
|
|
|
auto count = List->GetCount();
|
|
|
|
auto firstLight = List->Get(0);
|
2021-01-05 10:02:43 +01:00
|
|
|
auto flasherFlag2 = firstLight->FlasherFlag2;
|
|
|
|
for (auto i = 0; i < count - 1; i++)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto lightCur = List->Get(i);
|
|
|
|
auto lightNext = List->Get(i + 1);
|
2021-01-05 10:02:43 +01:00
|
|
|
lightCur->Message((lightNext->FlasherFlag2 != 0) + 8, 0.0);
|
|
|
|
}
|
2021-01-30 12:19:25 +01:00
|
|
|
auto lastLight = List->Get(count - 1);
|
2021-01-05 10:02:43 +01:00
|
|
|
lastLight->Message((flasherFlag2 != 0) + 8, 0);
|
|
|
|
reschedule_animation(value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 28:
|
|
|
|
{
|
|
|
|
if (AnimationFlag || !MessageField2)
|
|
|
|
start_animation();
|
|
|
|
MessageField2 = code;
|
|
|
|
AnimationFlag = 0;
|
2021-01-30 12:19:25 +01:00
|
|
|
auto count = List->GetCount();
|
2021-01-05 10:02:43 +01:00
|
|
|
for (auto i = 0; i < count - 1; i++)
|
|
|
|
{
|
|
|
|
if (rand() % 100 > 70)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(i);
|
2021-01-05 10:02:43 +01:00
|
|
|
auto randVal = static_cast<float>(rand()) * 0.00003051850947599719f * value * 3.0f + 0.1f;
|
|
|
|
light->Message(9, randVal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
reschedule_animation(value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 29:
|
|
|
|
{
|
|
|
|
if (AnimationFlag || !MessageField2)
|
|
|
|
start_animation();
|
|
|
|
MessageField2 = code;
|
|
|
|
AnimationFlag = 0;
|
2021-01-30 12:19:25 +01:00
|
|
|
auto count = List->GetCount();
|
2021-01-05 10:02:43 +01:00
|
|
|
for (auto i = 0; i < count - 1; i++)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(i);
|
2021-01-05 10:02:43 +01:00
|
|
|
auto randVal = static_cast<float>(rand() % 100 > 70);
|
|
|
|
light->Message(18, randVal);
|
|
|
|
}
|
|
|
|
reschedule_animation(value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 30:
|
|
|
|
{
|
|
|
|
auto noBmpInd1Count = 0;
|
2021-01-30 12:19:25 +01:00
|
|
|
auto countSub1 = List->GetCount() - 1;
|
2021-01-05 10:02:43 +01:00
|
|
|
if (countSub1 < 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
for (auto i = countSub1; i >= 0; i--)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
if (!List->Get(i)->BmpIndex1)
|
2021-01-05 10:02:43 +01:00
|
|
|
++noBmpInd1Count;
|
|
|
|
}
|
|
|
|
if (!noBmpInd1Count)
|
|
|
|
break;
|
|
|
|
|
|
|
|
auto randModCount = rand() % noBmpInd1Count;
|
|
|
|
for (auto i = countSub1; i >= 0; i--)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(i);
|
2021-01-05 10:02:43 +01:00
|
|
|
if (!light->BmpIndex1 && randModCount-- == 0)
|
|
|
|
{
|
|
|
|
light->Message(1, 0.0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (MessageField2)
|
|
|
|
start_animation();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 31:
|
|
|
|
{
|
|
|
|
auto bmpInd1Count = 0;
|
2021-01-30 12:19:25 +01:00
|
|
|
auto countSub1 = List->GetCount() - 1;
|
2021-01-05 10:02:43 +01:00
|
|
|
if (countSub1 < 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
for (auto i = countSub1; i >= 0; i--)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
if (List->Get(i)->BmpIndex1)
|
2021-01-05 10:02:43 +01:00
|
|
|
++bmpInd1Count;
|
|
|
|
}
|
|
|
|
if (!bmpInd1Count)
|
|
|
|
break;
|
|
|
|
|
|
|
|
auto randModCount = rand() % bmpInd1Count;
|
|
|
|
for (auto i = countSub1; i >= 0; i--)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(i);
|
2021-01-05 10:02:43 +01:00
|
|
|
if (light->BmpIndex1 && randModCount-- == 0)
|
|
|
|
{
|
|
|
|
light->Message(0, 0.0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (MessageField2)
|
|
|
|
start_animation();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 32:
|
|
|
|
{
|
|
|
|
auto index = next_light_up();
|
|
|
|
if (index < 0)
|
|
|
|
break;
|
2021-01-30 12:19:25 +01:00
|
|
|
List->Get(index)->Message(1, 0.0);
|
2021-01-05 10:02:43 +01:00
|
|
|
if (MessageField2)
|
|
|
|
start_animation();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
case 33:
|
|
|
|
{
|
|
|
|
auto index = next_light_down();
|
|
|
|
if (index < 0)
|
|
|
|
break;
|
2021-01-30 12:19:25 +01:00
|
|
|
List->Get(index)->Message(0, 0.0);
|
2021-01-05 10:02:43 +01:00
|
|
|
if (MessageField2)
|
|
|
|
start_animation();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
case 34:
|
|
|
|
{
|
|
|
|
if (Timer)
|
|
|
|
timer::kill(Timer);
|
|
|
|
Timer = 0;
|
|
|
|
if (MessageField2 == 26 || MessageField2 == 27 || MessageField2 == 28)
|
|
|
|
TLightGroup::Message(14, 0.0);
|
|
|
|
MessageField2 = 0;
|
|
|
|
AnimationFlag = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 35:
|
|
|
|
{
|
|
|
|
auto index = static_cast<int>(floor(value));
|
2021-01-30 12:19:25 +01:00
|
|
|
if (index >= List->GetCount() || index < 0)
|
2021-01-05 10:02:43 +01:00
|
|
|
break;
|
|
|
|
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(index);
|
2021-01-05 10:02:43 +01:00
|
|
|
light->Message(1, 0.0);
|
|
|
|
if (MessageField2)
|
|
|
|
start_animation();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 36:
|
|
|
|
{
|
|
|
|
auto index = static_cast<int>(floor(value));
|
2021-01-30 12:19:25 +01:00
|
|
|
if (index >= List->GetCount() || index < 0)
|
2021-01-05 10:02:43 +01:00
|
|
|
break;
|
|
|
|
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(index);
|
2021-01-05 10:02:43 +01:00
|
|
|
light->Message(0, 0.0);
|
|
|
|
if (MessageField2)
|
|
|
|
start_animation();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 37:
|
|
|
|
{
|
|
|
|
auto bmp1Count = 0;
|
2021-01-30 12:19:25 +01:00
|
|
|
auto countSub1 = List->GetCount() - 1;
|
2021-01-05 10:02:43 +01:00
|
|
|
for (auto i = countSub1; i >= 0; i--)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
if (List->Get(i)->BmpIndex1)
|
2021-01-21 15:58:05 +01:00
|
|
|
++bmp1Count;
|
2021-01-05 10:02:43 +01:00
|
|
|
}
|
|
|
|
return bmp1Count;
|
|
|
|
}
|
|
|
|
case 38:
|
2021-01-30 12:19:25 +01:00
|
|
|
return List->GetCount();
|
2021-01-05 10:02:43 +01:00
|
|
|
case 39:
|
|
|
|
return MessageField2;
|
|
|
|
case 40:
|
|
|
|
return AnimationFlag;
|
|
|
|
case 41:
|
|
|
|
{
|
|
|
|
auto index = next_light_up();
|
|
|
|
if (index < 0)
|
|
|
|
break;
|
|
|
|
if (MessageField2 || AnimationFlag)
|
|
|
|
TLightGroup::Message(34, 0.0);
|
2021-01-30 12:19:25 +01:00
|
|
|
List->Get(index)->Message(15, value);
|
2021-01-05 10:02:43 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
case 42:
|
|
|
|
{
|
|
|
|
auto index = next_light_down();
|
|
|
|
if (index < 0)
|
|
|
|
break;
|
|
|
|
if (MessageField2 || AnimationFlag)
|
|
|
|
TLightGroup::Message(34, 0.0);
|
2021-01-30 12:19:25 +01:00
|
|
|
List->Get(index)->Message(16, value);
|
2021-01-05 10:02:43 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
case 43:
|
|
|
|
if (NotifyTimer)
|
|
|
|
timer::kill(NotifyTimer);
|
|
|
|
NotifyTimer = 0;
|
|
|
|
if (value > 0.0)
|
|
|
|
NotifyTimer = timer::set(value, this, NotifyTimerExpired);
|
|
|
|
break;
|
|
|
|
case 44:
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto countSub1 = List->GetCount() - 1;
|
2021-01-05 10:02:43 +01:00
|
|
|
for (auto index = countSub1; index >= 0; index--)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(index);
|
2021-01-05 10:02:43 +01:00
|
|
|
if (light->BmpIndex1)
|
|
|
|
{
|
|
|
|
light->Message(0, 0.0);
|
|
|
|
light->Message(16, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 45:
|
|
|
|
{
|
|
|
|
control::handler(code, this);
|
|
|
|
auto index = static_cast<int>(floor(value));
|
|
|
|
if (index >= 0)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto count = List->GetCount();
|
2021-01-05 10:02:43 +01:00
|
|
|
if (index <= count)
|
|
|
|
{
|
|
|
|
auto countSub1 = count - 1;
|
|
|
|
if (countSub1 > index)
|
|
|
|
{
|
|
|
|
countSub1 = index;
|
|
|
|
for (auto i = countSub1, k = countSub1 - index; k != 0; i--, k--)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(i);
|
2021-01-05 10:02:43 +01:00
|
|
|
light->Message(20, 0.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (countSub1 >= 0)
|
|
|
|
{
|
|
|
|
for (auto i = countSub1; i != 0; i--)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(i);
|
2021-01-05 10:02:43 +01:00
|
|
|
light->Message(19, 0.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 46:
|
|
|
|
{
|
|
|
|
auto index = next_light_down();
|
|
|
|
if (index >= 0)
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
List->Get(index)->Message(4, 0.0);
|
2021-01-05 10:02:43 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2021-01-30 12:19:25 +01:00
|
|
|
for (auto index = List->GetCount() - 1; index >= 0; index--)
|
2021-01-05 10:02:43 +01:00
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
List->Get(index)->Message(code, value);
|
2021-01-05 10:02:43 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TLightGroup::Reset()
|
|
|
|
{
|
|
|
|
if (Timer)
|
|
|
|
timer::kill(Timer);
|
|
|
|
Timer = 0;
|
|
|
|
if (NotifyTimer)
|
|
|
|
timer::kill(NotifyTimer);
|
|
|
|
NotifyTimer = 0;
|
|
|
|
MessageField2 = 0;
|
|
|
|
AnimationFlag = 0;
|
|
|
|
Timer1Time = Timer1TimeDefault;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TLightGroup::reschedule_animation(float time)
|
|
|
|
{
|
|
|
|
if (Timer)
|
|
|
|
timer::kill(Timer);
|
|
|
|
Timer = 0;
|
|
|
|
if (time == 0)
|
|
|
|
{
|
|
|
|
MessageField2 = 0;
|
|
|
|
AnimationFlag = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Timer1Time = time > 0.0 ? time : Timer1TimeDefault;
|
|
|
|
Timer = timer::set(Timer1Time, this, TimerExpired);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TLightGroup::start_animation()
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
for (int index = List->GetCount() - 1; index >= 0; --index)
|
2021-01-05 10:02:43 +01:00
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
auto light = List->Get(index);
|
2021-01-05 10:02:43 +01:00
|
|
|
if (light->BmpIndex1)
|
|
|
|
light->Message(9, 0.0);
|
|
|
|
else
|
|
|
|
light->Message(8, 0.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int TLightGroup::next_light_up()
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
for (int index = 0; index < List->GetCount(); ++index)
|
2021-01-05 10:02:43 +01:00
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
if (!List->Get(index)->BmpIndex1)
|
2021-01-05 10:02:43 +01:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int TLightGroup::next_light_down()
|
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
for (int index = List->GetCount() - 1; index >= 0; --index)
|
2021-01-05 10:02:43 +01:00
|
|
|
{
|
2021-01-30 12:19:25 +01:00
|
|
|
if (!List->Get(index)->BmpIndex1)
|
2021-01-05 10:02:43 +01:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TLightGroup::TimerExpired(int timerId, void* caller)
|
|
|
|
{
|
|
|
|
auto group = static_cast<TLightGroup*>(caller);
|
|
|
|
group->Timer = 0;
|
|
|
|
group->Message(group->MessageField2, group->Timer1Time);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TLightGroup::NotifyTimerExpired(int timerId, void* caller)
|
|
|
|
{
|
|
|
|
auto group = static_cast<TLightGroup*>(caller);
|
|
|
|
group->NotifyTimer = 0;
|
|
|
|
control::handler(61, group);
|
|
|
|
}
|