2020-11-01 16:45:29 +01:00
|
|
|
#include "pch.h"
|
|
|
|
#include "TGate.h"
|
2021-01-16 15:45:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
#include "control.h"
|
|
|
|
#include "loader.h"
|
|
|
|
#include "render.h"
|
|
|
|
|
2022-09-06 15:57:56 +02:00
|
|
|
TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
|
2021-01-16 15:45:29 +01:00
|
|
|
{
|
|
|
|
visualStruct visual{};
|
|
|
|
|
|
|
|
loader::query_visual(groupIndex, 0, &visual);
|
|
|
|
SoundIndex4 = visual.SoundIndex4;
|
|
|
|
SoundIndex3 = visual.SoundIndex3;
|
2021-01-28 16:01:26 +01:00
|
|
|
ActiveFlag = 1;
|
2022-09-22 16:46:00 +02:00
|
|
|
SpriteSet(0);
|
2022-09-07 15:01:38 +02:00
|
|
|
control::handler(MessageCode::Reset, this);
|
2021-01-16 15:45:29 +01:00
|
|
|
}
|
|
|
|
|
2022-09-06 15:57:56 +02:00
|
|
|
int TGate::Message(MessageCode code, float value)
|
2021-01-16 15:45:29 +01:00
|
|
|
{
|
2022-09-06 10:58:35 +02:00
|
|
|
switch (code)
|
2021-01-16 15:45:29 +01:00
|
|
|
{
|
2022-09-06 10:58:35 +02:00
|
|
|
case MessageCode::TGateDisable:
|
|
|
|
ActiveFlag = 0;
|
2022-09-22 16:46:00 +02:00
|
|
|
SpriteSet(-1);
|
2022-09-06 10:58:35 +02:00
|
|
|
loader::play_sound(SoundIndex3, this, "TGate1");
|
|
|
|
break;
|
|
|
|
case MessageCode::Reset:
|
|
|
|
case MessageCode::TGateEnable:
|
|
|
|
ActiveFlag = 1;
|
2022-09-22 16:46:00 +02:00
|
|
|
SpriteSet(0);
|
2022-09-06 10:58:35 +02:00
|
|
|
if (code == MessageCode::TGateEnable)
|
|
|
|
loader::play_sound(SoundIndex4, this, "TGate2");
|
|
|
|
break;
|
|
|
|
default: break;
|
2021-01-16 15:45:29 +01:00
|
|
|
}
|
2022-09-06 10:58:35 +02:00
|
|
|
|
2022-09-07 15:01:38 +02:00
|
|
|
control::handler(code, this);
|
2021-01-16 15:45:29 +01:00
|
|
|
return 0;
|
|
|
|
}
|