1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2025-09-09 09:20:15 +02:00

TBlocker, TBumper, TFlagSpinner, TGate, THole, TKickback, TWall ready.

This commit is contained in:
oz 2021-01-16 17:45:29 +03:00
parent 61fe0410b0
commit ffd626fbc1
17 changed files with 812 additions and 23 deletions

View file

@ -1,2 +1,73 @@
#include "pch.h"
#include "TBlocker.h"
#include "control.h"
#include "loader.h"
#include "render.h"
#include "timer.h"
#include "TZmapList.h"
TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
{
visualStruct visual{};
loader::query_visual(groupIndex, 0, &visual);
SoundIndex4 = visual.SoundIndex4;
SoundIndex3 = visual.SoundIndex3;
Unknown0 = 55;
Unknown1 = 5;
MaxCollisionSpeed = 1000000000.0f;
Timer = 0;
MessageField = 0;
UnknownBaseFlag2 = 0;
render::sprite_set_bitmap(RenderSprite, nullptr);
}
int TBlocker::Message(int code, float value)
{
switch (code)
{
case 1011:
case 1020:
case 1024:
case 51:
if (Timer)
{
timer::kill(Timer);
Timer = 0;
}
MessageField = 0;
UnknownBaseFlag2 = 0;
render::sprite_set_bitmap(RenderSprite, nullptr);
if (code == 51)
loader::play_sound(SoundIndex3);
return 0;
case 52:
UnknownBaseFlag2 = 1;
loader::play_sound(SoundIndex4);
render::sprite_set_bitmap(RenderSprite, static_cast<gdrv_bitmap8*>(ListBitmap->Get(0)));
break;
case 59:
break;
default:
return 0;
}
if (Timer)
timer::kill(Timer);
float timerTime;
if (value <= 0.0)
timerTime = 0.0;
else
timerTime = value;
Timer = timer::set(timerTime, this, TimerExpired);
return 0;
}
void TBlocker::TimerExpired(int timerId, void* caller)
{
auto blocker = static_cast<TBlocker*>(caller);
blocker->Timer = 0;
control::handler(60, blocker);
}