mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-25 12:12:32 +01:00
TLightGroup ready.
This commit is contained in:
parent
230c981144
commit
8b1f6f4cfa
1
.gitignore
vendored
1
.gitignore
vendored
@ -260,3 +260,4 @@ paket-files/
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
/Ida
|
/Ida
|
||||||
|
/Export
|
||||||
|
5084
Doc/.dat dump.txt
Normal file
5084
Doc/.dat dump.txt
Normal file
File diff suppressed because it is too large
Load Diff
12193
Doc/.pdb dump.txt
Normal file
12193
Doc/.pdb dump.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -27,218 +27,213 @@ TLight::TLight(TPinballTable* table, int groupIndex) : TPinballComponent(table,
|
|||||||
int TLight::Message(int code, float value)
|
int TLight::Message(int code, float value)
|
||||||
{
|
{
|
||||||
int bmpIndex;
|
int bmpIndex;
|
||||||
auto this2 = this;
|
|
||||||
if (code > 1020)
|
|
||||||
{
|
|
||||||
if (code == 1024)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
for (auto index = 0; index < this2->PinballTable->PlayerCount; ++index)
|
|
||||||
{
|
|
||||||
auto playerPtr = &this2->PlayerData[index];
|
|
||||||
playerPtr->FlasherActive = this2->FlasherActive;
|
|
||||||
playerPtr->BmpIndex2 = this2->BmpIndex2;
|
|
||||||
playerPtr->BmpIndex1 = this2->BmpIndex1;
|
|
||||||
playerPtr->MessageField = this2->MessageField;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (code == 1020)
|
|
||||||
{
|
|
||||||
auto playerPtr = &this2->PlayerData[PinballTable->CurrentPlayer];
|
|
||||||
playerPtr->FlasherActive = this2->FlasherActive;
|
|
||||||
playerPtr->BmpIndex2 = this2->BmpIndex2;
|
|
||||||
playerPtr->BmpIndex1 = this2->BmpIndex1;
|
|
||||||
playerPtr->MessageField = this2->MessageField;
|
|
||||||
|
|
||||||
Reset();
|
|
||||||
|
|
||||||
playerPtr = &this2->PlayerData[static_cast<int>(floor(value))];
|
|
||||||
this2->FlasherActive = playerPtr->FlasherActive;
|
|
||||||
this2->BmpIndex2 = playerPtr->BmpIndex2;
|
|
||||||
this2->BmpIndex1 = playerPtr->BmpIndex1;
|
|
||||||
this2->MessageField = playerPtr->MessageField;
|
|
||||||
if (this2->BmpIndex2)
|
|
||||||
{
|
|
||||||
this2->Message(11, static_cast<float>(this2->BmpIndex2));
|
|
||||||
}
|
|
||||||
if (this2->BmpIndex1)
|
|
||||||
this2->Message(1, 0.0);
|
|
||||||
if (this2->FlasherActive)
|
|
||||||
this2->Message(4, 0.0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 0:
|
case 1024:
|
||||||
this->BmpIndex1 = 0;
|
Reset();
|
||||||
if (this->FlasherActive == 0 && !this->FlasherFlag1 && !this->FlasherFlag2)
|
for (auto index = 0; index < PinballTable->PlayerCount; ++index)
|
||||||
render::sprite_set_bitmap(this->RenderSprite, this->Flasher.BmpArr[0]);
|
{
|
||||||
return 0;
|
auto playerPtr = &PlayerData[index];
|
||||||
case 1:
|
playerPtr->FlasherActive = FlasherActive;
|
||||||
this->BmpIndex1 = 1;
|
playerPtr->BmpIndex2 = BmpIndex2;
|
||||||
if (this->FlasherActive == 0 && !this->FlasherFlag1 && !this->FlasherFlag2)
|
playerPtr->BmpIndex1 = BmpIndex1;
|
||||||
render::sprite_set_bitmap(this->RenderSprite, this->Flasher.BmpArr[1]);
|
playerPtr->MessageField = MessageField;
|
||||||
return 0;
|
}
|
||||||
case 2:
|
|
||||||
break;
|
break;
|
||||||
|
case 1020:
|
||||||
|
{
|
||||||
|
auto playerPtr = &PlayerData[PinballTable->CurrentPlayer];
|
||||||
|
playerPtr->FlasherActive = FlasherActive;
|
||||||
|
playerPtr->BmpIndex2 = BmpIndex2;
|
||||||
|
playerPtr->BmpIndex1 = BmpIndex1;
|
||||||
|
playerPtr->MessageField = MessageField;
|
||||||
|
|
||||||
|
Reset();
|
||||||
|
|
||||||
|
playerPtr = &PlayerData[static_cast<int>(floor(value))];
|
||||||
|
FlasherActive = playerPtr->FlasherActive;
|
||||||
|
BmpIndex2 = playerPtr->BmpIndex2;
|
||||||
|
BmpIndex1 = playerPtr->BmpIndex1;
|
||||||
|
MessageField = playerPtr->MessageField;
|
||||||
|
if (BmpIndex2)
|
||||||
|
{
|
||||||
|
Message(11, static_cast<float>(BmpIndex2));
|
||||||
|
}
|
||||||
|
if (BmpIndex1)
|
||||||
|
Message(1, 0.0);
|
||||||
|
if (FlasherActive)
|
||||||
|
Message(4, 0.0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0:
|
||||||
|
BmpIndex1 = 0;
|
||||||
|
if (FlasherActive == 0 && !FlasherFlag1 && !FlasherFlag2)
|
||||||
|
render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[0]);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
BmpIndex1 = 1;
|
||||||
|
if (FlasherActive == 0 && !FlasherFlag1 && !FlasherFlag2)
|
||||||
|
render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[1]);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return BmpIndex1;
|
||||||
case 3:
|
case 3:
|
||||||
return this->FlasherActive;
|
return FlasherActive;
|
||||||
case 4:
|
case 4:
|
||||||
schedule_timeout(0.0);
|
schedule_timeout(0.0);
|
||||||
if (!this2->FlasherActive || !this2->Flasher.Timer)
|
if (!FlasherActive || !Flasher.Timer)
|
||||||
{
|
{
|
||||||
this2->FlasherActive = 1;
|
FlasherActive = 1;
|
||||||
this2->FlasherFlag2 = 0;
|
FlasherFlag2 = 0;
|
||||||
this2->FlasherFlag1 = 0;
|
FlasherFlag1 = 0;
|
||||||
this2->Unknown13 = 0;
|
Unknown13 = 0;
|
||||||
flasher_start(&this2->Flasher, this2->BmpIndex1);
|
flasher_start(&Flasher, BmpIndex1);
|
||||||
}
|
}
|
||||||
return 0;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this->Flasher.TimerDelay[0] = value * this->FlasherDelay[0];
|
Flasher.TimerDelay[0] = value * FlasherDelay[0];
|
||||||
this->Flasher.TimerDelay[1] = value * this->FlasherDelay[1];
|
Flasher.TimerDelay[1] = value * FlasherDelay[1];
|
||||||
return 0;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
this->Flasher.TimerDelay[0] = this->FlasherDelay[0];
|
Flasher.TimerDelay[0] = FlasherDelay[0];
|
||||||
this->Flasher.TimerDelay[1] = this->FlasherDelay[1];
|
Flasher.TimerDelay[1] = FlasherDelay[1];
|
||||||
return 0;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (!this->FlasherActive)
|
if (!FlasherActive)
|
||||||
flasher_start(&this->Flasher, this->BmpIndex1);
|
flasher_start(&Flasher, BmpIndex1);
|
||||||
this2->FlasherActive = 1;
|
FlasherActive = 1;
|
||||||
this2->FlasherFlag2 = 0;
|
FlasherFlag2 = 0;
|
||||||
this2->Unknown13 = 0;
|
Unknown13 = 0;
|
||||||
this2->FlasherFlag1 = 0;
|
FlasherFlag1 = 0;
|
||||||
schedule_timeout(value);
|
schedule_timeout(value);
|
||||||
return 0;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (!this->FlasherFlag1)
|
if (!FlasherFlag1)
|
||||||
{
|
{
|
||||||
if (this->FlasherActive)
|
if (FlasherActive)
|
||||||
{
|
{
|
||||||
flasher_stop(&this->Flasher, 0);
|
flasher_stop(&Flasher, 0);
|
||||||
this2->FlasherActive = 0;
|
FlasherActive = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
render::sprite_set_bitmap(this->RenderSprite, this->Flasher.BmpArr[0]);
|
render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[0]);
|
||||||
}
|
}
|
||||||
this2->FlasherFlag1 = 1;
|
FlasherFlag1 = 1;
|
||||||
this2->FlasherFlag2 = 0;
|
FlasherFlag2 = 0;
|
||||||
}
|
}
|
||||||
schedule_timeout(value);
|
schedule_timeout(value);
|
||||||
return 0;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
if (!this->FlasherFlag2)
|
if (!FlasherFlag2)
|
||||||
{
|
{
|
||||||
if (this->FlasherActive)
|
if (FlasherActive)
|
||||||
{
|
{
|
||||||
flasher_stop(&this->Flasher, 1);
|
flasher_stop(&Flasher, 1);
|
||||||
this2->FlasherActive = 0;
|
FlasherActive = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
render::sprite_set_bitmap(this->RenderSprite, this->Flasher.BmpArr[1]);
|
render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[1]);
|
||||||
}
|
}
|
||||||
this2->FlasherFlag2 = 1;
|
FlasherFlag2 = 1;
|
||||||
this2->FlasherFlag1 = 0;
|
FlasherFlag1 = 0;
|
||||||
}
|
}
|
||||||
schedule_timeout(value);
|
schedule_timeout(value);
|
||||||
return 0;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
this2->BmpIndex2 = static_cast<int>(floor(value));
|
BmpIndex2 = static_cast<int>(floor(value));
|
||||||
if (this2->BmpIndex2 > this2->ListBitmap->Count())
|
if (BmpIndex2 > ListBitmap->Count())
|
||||||
this2->BmpIndex2 = this2->ListBitmap->Count();
|
BmpIndex2 = ListBitmap->Count();
|
||||||
bmpIndex = 0;
|
bmpIndex = 0;
|
||||||
if (this2->BmpIndex2 < 0)
|
if (BmpIndex2 < 0)
|
||||||
this2->BmpIndex2 = 0;
|
BmpIndex2 = 0;
|
||||||
this2->Flasher.BmpArr[0] = nullptr;
|
Flasher.BmpArr[0] = nullptr;
|
||||||
this2->Flasher.BmpArr[1] = static_cast<gdrv_bitmap8*>(this2->ListBitmap->Get(this2->BmpIndex2));
|
Flasher.BmpArr[1] = static_cast<gdrv_bitmap8*>(ListBitmap->Get(BmpIndex2));
|
||||||
if (this2->FlasherActive == 0)
|
if (FlasherActive == 0)
|
||||||
{
|
{
|
||||||
if (!this2->FlasherFlag1)
|
if (!FlasherFlag1)
|
||||||
{
|
{
|
||||||
if (this2->FlasherFlag2)
|
if (FlasherFlag2)
|
||||||
bmpIndex = 1;
|
bmpIndex = 1;
|
||||||
else
|
else
|
||||||
bmpIndex = this2->BmpIndex1;
|
bmpIndex = BmpIndex1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bmpIndex = this2->Flasher.BmpIndex;
|
bmpIndex = Flasher.BmpIndex;
|
||||||
}
|
}
|
||||||
render::sprite_set_bitmap(this2->RenderSprite, this2->Flasher.BmpArr[bmpIndex]);
|
render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[bmpIndex]);
|
||||||
return 0;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
bmpIndex = this->BmpIndex2 + 1;
|
bmpIndex = BmpIndex2 + 1;
|
||||||
if (bmpIndex > this->ListBitmap->Count())
|
if (bmpIndex > ListBitmap->Count())
|
||||||
bmpIndex = this->ListBitmap->Count();
|
bmpIndex = ListBitmap->Count();
|
||||||
Message(11, static_cast<float>(bmpIndex));
|
Message(11, static_cast<float>(bmpIndex));
|
||||||
return 0;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
bmpIndex = this->BmpIndex2 - 1;
|
bmpIndex = BmpIndex2 - 1;
|
||||||
if (bmpIndex < 0)
|
if (bmpIndex < 0)
|
||||||
bmpIndex = 0;
|
bmpIndex = 0;
|
||||||
Message(11, static_cast<float>(bmpIndex));
|
Message(11, static_cast<float>(bmpIndex));
|
||||||
return 0;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
if (this->Timer1)
|
if (Timer1)
|
||||||
timer::kill(this->Timer1);
|
timer::kill(Timer1);
|
||||||
this2->Timer1 = 0;
|
Timer1 = 0;
|
||||||
if (this2->FlasherActive != 0)
|
if (FlasherActive != 0)
|
||||||
flasher_stop(&this2->Flasher, -1);
|
flasher_stop(&Flasher, -1);
|
||||||
this2->FlasherActive = 0;
|
FlasherActive = 0;
|
||||||
this2->FlasherFlag1 = 0;
|
FlasherFlag1 = 0;
|
||||||
this2->FlasherFlag2 = 0;
|
FlasherFlag2 = 0;
|
||||||
render::sprite_set_bitmap(this2->RenderSprite, this2->Flasher.BmpArr[this2->BmpIndex1]);
|
render::sprite_set_bitmap(RenderSprite, Flasher.BmpArr[BmpIndex1]);
|
||||||
return 0;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
this->Unknown13 = 0;
|
Unknown13 = 0;
|
||||||
if (this->Timer2)
|
if (Timer2)
|
||||||
timer::kill(this->Timer2);
|
timer::kill(Timer2);
|
||||||
this2->Timer2 = 0;
|
Timer2 = 0;
|
||||||
Message(1, 0.0);
|
Message(1, 0.0);
|
||||||
Message(7, value);
|
Message(7, value);
|
||||||
return 0;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
if (this->Timer2)
|
if (Timer2)
|
||||||
timer::kill(this->Timer2);
|
timer::kill(Timer2);
|
||||||
this2->Timer2 = 0;
|
Timer2 = 0;
|
||||||
Message(7, value);
|
Message(7, value);
|
||||||
this2->Unknown13 = 1;
|
Unknown13 = 1;
|
||||||
return 0;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
Message(static_cast<int>(floor(value)) != 0, 0.0);
|
Message(static_cast<int>(floor(value)) != 0, 0.0);
|
||||||
break;
|
return BmpIndex1;
|
||||||
case 18:
|
case 18:
|
||||||
Message(17, value);
|
Message(17, value);
|
||||||
Message(14, 0.0);
|
Message(14, 0.0);
|
||||||
break;
|
return BmpIndex1;
|
||||||
case 19:
|
case 19:
|
||||||
Message(1, 0.0);
|
Message(1, 0.0);
|
||||||
Message(14, 0.0);
|
Message(14, 0.0);
|
||||||
return 0;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
Message(0, 0.0);
|
Message(0, 0.0);
|
||||||
Message(14, 0.0);
|
Message(14, 0.0);
|
||||||
return 0;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
Message(17, static_cast<float>(this->BmpIndex1 == 0));
|
Message(17, static_cast<float>(BmpIndex1 == 0));
|
||||||
break;
|
return BmpIndex1;
|
||||||
case 22:
|
case 22:
|
||||||
Message(18, static_cast<float>(this->BmpIndex1 == 0));
|
Message(18, static_cast<float>(BmpIndex1 == 0));
|
||||||
break;
|
return BmpIndex1;
|
||||||
case 23:
|
case 23:
|
||||||
this->MessageField = static_cast<int>(floor(value));
|
MessageField = static_cast<int>(floor(value));
|
||||||
return 0;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this2->BmpIndex1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TLight::Reset()
|
void TLight::Reset()
|
||||||
|
@ -1,2 +1,498 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "TLightGroup.h"
|
#include "TLightGroup.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "control.h"
|
||||||
|
#include "loader.h"
|
||||||
|
#include "objlist_class.h"
|
||||||
|
#include "timer.h"
|
||||||
|
#include "TLight.h"
|
||||||
|
#include "TPinballTable.h"
|
||||||
|
|
||||||
|
TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballComponent(table, -1, false)
|
||||||
|
{
|
||||||
|
List = new objlist_class(4, 4);
|
||||||
|
Timer = 0;
|
||||||
|
NotifyTimer = 0;
|
||||||
|
Reset();
|
||||||
|
if (groupIndex > 0)
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
Timer1TimeDefault = *loader::query_float_attribute(groupIndex, 0, 903);
|
||||||
|
__int16* groupIndArr = loader::query_iattribute(groupIndex, 1027, &count);
|
||||||
|
for (int index = 0; index < count; ++groupIndArr)
|
||||||
|
{
|
||||||
|
auto comp = table->find_component(*groupIndArr);
|
||||||
|
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:
|
||||||
|
{
|
||||||
|
auto count = List->Count();
|
||||||
|
auto lastLight = static_cast<TLight*>(List->Get(count - 1));
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
auto lightCur = static_cast<TLight*>(List->Get(index));
|
||||||
|
auto lightPrev = static_cast<TLight*>(List->Get(index - 1));
|
||||||
|
lightCur->Message(lightPrev->BmpIndex1 != 0, 0.0);
|
||||||
|
lightCur->MessageField = lightPrev->MessageField;
|
||||||
|
}
|
||||||
|
auto firstLight = static_cast<TLight*>(List->Get(0));
|
||||||
|
firstLight->Message(bmpIndex1 != 0, 0.0);
|
||||||
|
firstLight->MessageField = lightMessageField;
|
||||||
|
reschedule_animation(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 25:
|
||||||
|
{
|
||||||
|
auto count = List->Count();
|
||||||
|
auto lastLight = static_cast<TLight*>(List->Get(count - 1));
|
||||||
|
if (lastLight->FlasherActive || lastLight->FlasherFlag2 || lastLight->FlasherFlag1)
|
||||||
|
break;
|
||||||
|
if (MessageField2)
|
||||||
|
{
|
||||||
|
TLightGroup::Message(34, 0.0);
|
||||||
|
}
|
||||||
|
auto firstLight = static_cast<TLight*>(List->Get(0));
|
||||||
|
AnimationFlag = 1;
|
||||||
|
MessageField2 = code;
|
||||||
|
auto lightMessageField = firstLight->MessageField;
|
||||||
|
auto bmpIndex1 = firstLight->BmpIndex1;
|
||||||
|
for (auto index = 0; index < count - 1; index++)
|
||||||
|
{
|
||||||
|
auto lightCur = static_cast<TLight*>(List->Get(index));
|
||||||
|
auto lightNext = static_cast<TLight*>(List->Get(index + 1));
|
||||||
|
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;
|
||||||
|
auto count = List->Count();
|
||||||
|
auto lastLight = static_cast<TLight*>(List->Get(count - 1));
|
||||||
|
auto flasherFlag2 = lastLight->FlasherFlag2;
|
||||||
|
for (auto i = count - 1; i > 0; --i)
|
||||||
|
{
|
||||||
|
auto lightCur = static_cast<TLight*>(List->Get(i));
|
||||||
|
auto lightPrev = static_cast<TLight*>(List->Get(i - 1));
|
||||||
|
lightCur->Message((lightPrev->FlasherFlag2 != 0) + 8, 0.0);
|
||||||
|
}
|
||||||
|
auto firstLight = static_cast<TLight*>(List->Get(0));
|
||||||
|
firstLight->Message((flasherFlag2 != 0) + 8, 0);
|
||||||
|
reschedule_animation(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 27:
|
||||||
|
{
|
||||||
|
if (AnimationFlag || !MessageField2)
|
||||||
|
start_animation();
|
||||||
|
MessageField2 = code;
|
||||||
|
AnimationFlag = 0;
|
||||||
|
auto count = List->Count();
|
||||||
|
auto firstLight = static_cast<TLight*>(List->Get(0));
|
||||||
|
auto flasherFlag2 = firstLight->FlasherFlag2;
|
||||||
|
for (auto i = 0; i < count - 1; i++)
|
||||||
|
{
|
||||||
|
auto lightCur = static_cast<TLight*>(List->Get(i));
|
||||||
|
auto lightNext = static_cast<TLight*>(List->Get(i + 1));
|
||||||
|
lightCur->Message((lightNext->FlasherFlag2 != 0) + 8, 0.0);
|
||||||
|
}
|
||||||
|
auto lastLight = static_cast<TLight*>(List->Get(count - 1));
|
||||||
|
lastLight->Message((flasherFlag2 != 0) + 8, 0);
|
||||||
|
reschedule_animation(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 28:
|
||||||
|
{
|
||||||
|
if (AnimationFlag || !MessageField2)
|
||||||
|
start_animation();
|
||||||
|
MessageField2 = code;
|
||||||
|
AnimationFlag = 0;
|
||||||
|
auto count = List->Count();
|
||||||
|
for (auto i = 0; i < count - 1; i++)
|
||||||
|
{
|
||||||
|
if (rand() % 100 > 70)
|
||||||
|
{
|
||||||
|
auto light = static_cast<TLight*>(List->Get(i));
|
||||||
|
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;
|
||||||
|
auto count = List->Count();
|
||||||
|
for (auto i = 0; i < count - 1; i++)
|
||||||
|
{
|
||||||
|
auto light = static_cast<TLight*>(List->Get(i));
|
||||||
|
auto randVal = static_cast<float>(rand() % 100 > 70);
|
||||||
|
light->Message(18, randVal);
|
||||||
|
}
|
||||||
|
reschedule_animation(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 30:
|
||||||
|
{
|
||||||
|
auto noBmpInd1Count = 0;
|
||||||
|
auto countSub1 = List->Count() - 1;
|
||||||
|
if (countSub1 < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (auto i = countSub1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (!static_cast<TLight*>(List->Get(i))->BmpIndex1)
|
||||||
|
++noBmpInd1Count;
|
||||||
|
}
|
||||||
|
if (!noBmpInd1Count)
|
||||||
|
break;
|
||||||
|
|
||||||
|
auto randModCount = rand() % noBmpInd1Count;
|
||||||
|
for (auto i = countSub1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
auto light = static_cast<TLight*>(List->Get(i));
|
||||||
|
if (!light->BmpIndex1 && randModCount-- == 0)
|
||||||
|
{
|
||||||
|
light->Message(1, 0.0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageField2)
|
||||||
|
start_animation();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
auto bmpInd1Count = 0;
|
||||||
|
auto countSub1 = List->Count() - 1;
|
||||||
|
if (countSub1 < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (auto i = countSub1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (static_cast<TLight*>(List->Get(i))->BmpIndex1)
|
||||||
|
++bmpInd1Count;
|
||||||
|
}
|
||||||
|
if (!bmpInd1Count)
|
||||||
|
break;
|
||||||
|
|
||||||
|
auto randModCount = rand() % bmpInd1Count;
|
||||||
|
for (auto i = countSub1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
auto light = static_cast<TLight*>(List->Get(i));
|
||||||
|
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;
|
||||||
|
static_cast<TLight*>(List->Get(index))->Message(1, 0.0);
|
||||||
|
if (MessageField2)
|
||||||
|
start_animation();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
case 33:
|
||||||
|
{
|
||||||
|
auto index = next_light_down();
|
||||||
|
if (index < 0)
|
||||||
|
break;
|
||||||
|
static_cast<TLight*>(List->Get(index))->Message(0, 0.0);
|
||||||
|
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));
|
||||||
|
if (index >= List->Count() || index < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
auto light = static_cast<TLight*>(List->Get(index));
|
||||||
|
light->Message(1, 0.0);
|
||||||
|
if (MessageField2)
|
||||||
|
start_animation();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 36:
|
||||||
|
{
|
||||||
|
auto index = static_cast<int>(floor(value));
|
||||||
|
if (index >= List->Count() || index < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
auto light = static_cast<TLight*>(List->Get(index));
|
||||||
|
light->Message(0, 0.0);
|
||||||
|
if (MessageField2)
|
||||||
|
start_animation();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 37:
|
||||||
|
{
|
||||||
|
auto bmp1Count = 0;
|
||||||
|
auto countSub1 = List->Count() - 1;
|
||||||
|
for (auto i = countSub1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (static_cast<TLight*>(List->Get(i))->BmpIndex1)
|
||||||
|
++countSub1;
|
||||||
|
}
|
||||||
|
return bmp1Count;
|
||||||
|
}
|
||||||
|
case 38:
|
||||||
|
return List->Count();
|
||||||
|
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);
|
||||||
|
static_cast<TLight*>(List->Get(index))->Message(15, value);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
case 42:
|
||||||
|
{
|
||||||
|
auto index = next_light_down();
|
||||||
|
if (index < 0)
|
||||||
|
break;
|
||||||
|
if (MessageField2 || AnimationFlag)
|
||||||
|
TLightGroup::Message(34, 0.0);
|
||||||
|
static_cast<TLight*>(List->Get(index))->Message(16, value);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
case 43:
|
||||||
|
if (NotifyTimer)
|
||||||
|
timer::kill(NotifyTimer);
|
||||||
|
NotifyTimer = 0;
|
||||||
|
if (value > 0.0)
|
||||||
|
NotifyTimer = timer::set(value, this, NotifyTimerExpired);
|
||||||
|
break;
|
||||||
|
case 44:
|
||||||
|
{
|
||||||
|
auto countSub1 = List->Count() - 1;
|
||||||
|
for (auto index = countSub1; index >= 0; index--)
|
||||||
|
{
|
||||||
|
auto light = static_cast<TLight*>(List->Get(index));
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
auto count = List->Count();
|
||||||
|
if (index <= count)
|
||||||
|
{
|
||||||
|
auto countSub1 = count - 1;
|
||||||
|
if (countSub1 > index)
|
||||||
|
{
|
||||||
|
countSub1 = index;
|
||||||
|
for (auto i = countSub1, k = countSub1 - index; k != 0; i--, k--)
|
||||||
|
{
|
||||||
|
auto light = static_cast<TLight*>(List->Get(i));
|
||||||
|
light->Message(20, 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (countSub1 >= 0)
|
||||||
|
{
|
||||||
|
for (auto i = countSub1; i != 0; i--)
|
||||||
|
{
|
||||||
|
auto light = static_cast<TLight*>(List->Get(i));
|
||||||
|
light->Message(19, 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 46:
|
||||||
|
{
|
||||||
|
auto index = next_light_down();
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
static_cast<TLight*>(List->Get(index))->Message(4, 0.0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
for (auto index = List->Count() - 1; index >= 0; index--)
|
||||||
|
{
|
||||||
|
static_cast<TLight*>(List->Get(index))->Message(code, value);
|
||||||
|
}
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
for (int index = List->Count() - 1; index >= 0; --index)
|
||||||
|
{
|
||||||
|
auto light = static_cast<TLight*>(List->Get(index));
|
||||||
|
if (light->BmpIndex1)
|
||||||
|
light->Message(9, 0.0);
|
||||||
|
else
|
||||||
|
light->Message(8, 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int TLightGroup::next_light_up()
|
||||||
|
{
|
||||||
|
for (int index = 0; index < List->Count(); ++index)
|
||||||
|
{
|
||||||
|
if (!static_cast<TLight*>(List->Get(index))->BmpIndex1)
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TLightGroup::next_light_down()
|
||||||
|
{
|
||||||
|
for (int index = List->Count() - 1; index >= 0; --index)
|
||||||
|
{
|
||||||
|
if (!static_cast<TLight*>(List->Get(index))->BmpIndex1)
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
@ -1,11 +1,38 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "TPinballComponent.h"
|
#include "TPinballComponent.h"
|
||||||
|
class objlist_class;
|
||||||
|
|
||||||
|
struct TLightGroup_player_backup
|
||||||
|
{
|
||||||
|
int MessageField;
|
||||||
|
int MessageField2;
|
||||||
|
float Timer1Time;
|
||||||
|
int Unknown3;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class TLightGroup :
|
class TLightGroup :
|
||||||
public TPinballComponent
|
public TPinballComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TLightGroup(TPinballTable* table,int ind) : TPinballComponent(table, -1, false)
|
TLightGroup(TPinballTable* table, int groupIndex);
|
||||||
{
|
~TLightGroup() override;
|
||||||
}
|
int Message(int code, float value) override;
|
||||||
};
|
void Reset();
|
||||||
|
void reschedule_animation(float time);
|
||||||
|
void start_animation();
|
||||||
|
int next_light_up();
|
||||||
|
int next_light_down();
|
||||||
|
|
||||||
|
static void TimerExpired(int timerId, void* caller);
|
||||||
|
static void NotifyTimerExpired(int timerId, void* caller);
|
||||||
|
|
||||||
|
objlist_class* List;
|
||||||
|
float Timer1Time;
|
||||||
|
float Timer1TimeDefault;
|
||||||
|
int MessageField2;
|
||||||
|
int AnimationFlag;
|
||||||
|
int NotifyTimer;
|
||||||
|
int Timer;
|
||||||
|
TLightGroup_player_backup PlayerData[4];
|
||||||
|
};
|
||||||
|
@ -101,8 +101,7 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
|
|||||||
Plunger = new TPlunger(this, groupIndex);
|
Plunger = new TPlunger(this, groupIndex);
|
||||||
break;
|
break;
|
||||||
case 1002:
|
case 1002:
|
||||||
new TLight(this, groupIndex);
|
LightGroup->List->Add(new TLight(this, groupIndex));
|
||||||
//((objlist_class*)(LightGroup + 42))->Add(light);
|
|
||||||
break;
|
break;
|
||||||
case 1003:
|
case 1003:
|
||||||
FlipperL = new TFlipper(this, groupIndex);
|
FlipperL = new TFlipper(this, groupIndex);
|
||||||
@ -259,26 +258,26 @@ TPinballComponent* TPinballTable::find_component(int groupIndex)
|
|||||||
|
|
||||||
int TPinballTable::AddScore(int score)
|
int TPinballTable::AddScore(int score)
|
||||||
{
|
{
|
||||||
if (this->ScoreSpecial3Flag)
|
if (ScoreSpecial3Flag)
|
||||||
{
|
{
|
||||||
this->ScoreSpecial3 += score;
|
ScoreSpecial3 += score;
|
||||||
if (this->ScoreSpecial3 > 5000000)
|
if (ScoreSpecial3 > 5000000)
|
||||||
this->ScoreSpecial3 = 5000000;
|
ScoreSpecial3 = 5000000;
|
||||||
}
|
}
|
||||||
if (this->ScoreSpecial2Flag)
|
if (ScoreSpecial2Flag)
|
||||||
{
|
{
|
||||||
this->ScoreSpecial2 += score;
|
ScoreSpecial2 += score;
|
||||||
if (this->ScoreSpecial2 > 5000000)
|
if (ScoreSpecial2 > 5000000)
|
||||||
this->ScoreSpecial2 = 5000000;
|
ScoreSpecial2 = 5000000;
|
||||||
}
|
}
|
||||||
int addedScore = this->ScoreAdded + score * score_multipliers[this->ScoreMultiplier];
|
int addedScore = ScoreAdded + score * score_multipliers[ScoreMultiplier];
|
||||||
this->CurScore += addedScore;
|
CurScore += addedScore;
|
||||||
if (this->CurScore > 1000000000)
|
if (CurScore > 1000000000)
|
||||||
{
|
{
|
||||||
++this->CurScoreE9;
|
++CurScoreE9;
|
||||||
this->CurScore = this->CurScore - 1000000000;
|
CurScore = CurScore - 1000000000;
|
||||||
}
|
}
|
||||||
score::set(this->CurScoreStruct, this->CurScore);
|
score::set(CurScoreStruct, CurScore);
|
||||||
return addedScore;
|
return addedScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,21 +297,20 @@ void TPinballTable::ChangeBallCount(int count)
|
|||||||
|
|
||||||
void TPinballTable::tilt(float time)
|
void TPinballTable::tilt(float time)
|
||||||
{
|
{
|
||||||
TPinballTable* this2 = this;
|
if (!TiltLockFlag && !UnknownP10)
|
||||||
if (!this->TiltLockFlag && !this->UnknownP10)
|
|
||||||
{
|
{
|
||||||
pinball::InfoTextBox->Clear();
|
pinball::InfoTextBox->Clear();
|
||||||
pinball::MissTextBox->Clear();
|
pinball::MissTextBox->Clear();
|
||||||
pinball::InfoTextBox->Display(pinball::get_rc_string(35, 0), -1.0);
|
pinball::InfoTextBox->Display(pinball::get_rc_string(35, 0), -1.0);
|
||||||
loader::play_sound(this2->SoundIndex3);
|
loader::play_sound(SoundIndex3);
|
||||||
this2->TiltTimeoutTimer = timer::set(30.0, this2, tilt_timeout);
|
TiltTimeoutTimer = timer::set(30.0, this, tilt_timeout);
|
||||||
|
|
||||||
for (int i = 0; i < ComponentList->Count(); i++)
|
for (int i = 0; i < ComponentList->Count(); i++)
|
||||||
{
|
{
|
||||||
static_cast<TPinballComponent*>(ComponentList->Get(i))->Message(1011, time);
|
static_cast<TPinballComponent*>(ComponentList->Get(i))->Message(1011, time);
|
||||||
}
|
}
|
||||||
this2->LightGroup->Message(8, 0);
|
LightGroup->Message(8, 0);
|
||||||
this2->TiltLockFlag = 1;
|
TiltLockFlag = 1;
|
||||||
control::table_control_handler(1011);
|
control::table_control_handler(1011);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,6 @@ void TTextBox::Display(char* text, float time)
|
|||||||
void TTextBox::Draw()
|
void TTextBox::Draw()
|
||||||
{
|
{
|
||||||
TTextBoxMessage* nextMessage = nullptr;
|
TTextBoxMessage* nextMessage = nullptr;
|
||||||
auto this2 = this;
|
|
||||||
|
|
||||||
auto bmp = BgBmp;
|
auto bmp = BgBmp;
|
||||||
if (bmp)
|
if (bmp)
|
||||||
@ -169,41 +168,41 @@ void TTextBox::Draw()
|
|||||||
else
|
else
|
||||||
gdrv::fill_bitmap(&render::vscreen, Width, Height, OffsetX, OffsetY, 0);
|
gdrv::fill_bitmap(&render::vscreen, Width, Height, OffsetX, OffsetY, 0);
|
||||||
|
|
||||||
while (this2->Message1)
|
while (Message1)
|
||||||
{
|
{
|
||||||
auto message = this2->Message1;
|
auto message = Message1;
|
||||||
if (message->Time == -1.0)
|
if (message->Time == -1.0)
|
||||||
{
|
{
|
||||||
nextMessage = message->NextMessage;
|
nextMessage = message->NextMessage;
|
||||||
if (!message->NextMessage)
|
if (!message->NextMessage)
|
||||||
{
|
{
|
||||||
this2->Timer = -1;
|
Timer = -1;
|
||||||
LABEL_18:
|
LABEL_18:
|
||||||
auto font = this2->Font;
|
auto font = Font;
|
||||||
if (!font)
|
if (!font)
|
||||||
{
|
{
|
||||||
gdrv::blit(
|
gdrv::blit(
|
||||||
&render::vscreen,
|
&render::vscreen,
|
||||||
this2->OffsetX,
|
OffsetX,
|
||||||
this2->OffsetY,
|
OffsetY,
|
||||||
this2->OffsetX + render::vscreen.XPosition,
|
OffsetX + render::vscreen.XPosition,
|
||||||
this2->OffsetY + render::vscreen.YPosition,
|
OffsetY + render::vscreen.YPosition,
|
||||||
this2->Width,
|
Width,
|
||||||
this2->Height);
|
Height);
|
||||||
gdrv::grtext_draw_ttext_in_box(
|
gdrv::grtext_draw_ttext_in_box(
|
||||||
this2->Message1->Text,
|
Message1->Text,
|
||||||
render::vscreen.XPosition + this2->OffsetX,
|
render::vscreen.XPosition + OffsetX,
|
||||||
render::vscreen.YPosition + this2->OffsetY,
|
render::vscreen.YPosition + OffsetY,
|
||||||
this2->Width,
|
Width,
|
||||||
this2->Height,
|
Height,
|
||||||
255);
|
255);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto text = this2->Message1->Text;
|
auto text = Message1->Text;
|
||||||
for (auto y = this2->OffsetY; ; y += font->Height)
|
for (auto y = OffsetY; ; y += font->Height)
|
||||||
{
|
{
|
||||||
auto curChar = *text;
|
auto curChar = *text;
|
||||||
if (!curChar || y + font->Height > this2->OffsetY + this2->Height)
|
if (!curChar || y + font->Height > OffsetY + Height)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto totalWidth = 0;
|
auto totalWidth = 0;
|
||||||
@ -218,7 +217,7 @@ void TTextBox::Draw()
|
|||||||
if (charBmp)
|
if (charBmp)
|
||||||
{
|
{
|
||||||
auto width = charBmp->Width + font->GapWidth + totalWidth;
|
auto width = charBmp->Width + font->GapWidth + totalWidth;
|
||||||
if (width > this2->Width)
|
if (width > Width)
|
||||||
{
|
{
|
||||||
if (textEndSpace)
|
if (textEndSpace)
|
||||||
textEnd = textEndSpace;
|
textEnd = textEndSpace;
|
||||||
@ -236,7 +235,7 @@ void TTextBox::Draw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto offX = this2->OffsetX;
|
auto offX = OffsetX;
|
||||||
while (text < textEnd)
|
while (text < textEnd)
|
||||||
{
|
{
|
||||||
auto charBmp = font->Chars[*text++ & 0x7F];
|
auto charBmp = font->Chars[*text++ & 0x7F];
|
||||||
@ -245,10 +244,11 @@ void TTextBox::Draw()
|
|||||||
auto height = charBmp->Height;
|
auto height = charBmp->Height;
|
||||||
auto width = charBmp->Width;
|
auto width = charBmp->Width;
|
||||||
if (render::background_bitmap)
|
if (render::background_bitmap)
|
||||||
gdrv::copy_bitmap_w_transparency(&render::vscreen, width, height, offX, y, charBmp, 0, 0);
|
gdrv::copy_bitmap_w_transparency(&render::vscreen, width, height, offX, y, charBmp, 0,
|
||||||
|
0);
|
||||||
else
|
else
|
||||||
gdrv::copy_bitmap(&render::vscreen, width, height, offX, y, charBmp, 0, 0);
|
gdrv::copy_bitmap(&render::vscreen, width, height, offX, y, charBmp, 0, 0);
|
||||||
font = this2->Font;
|
font = Font;
|
||||||
offX += charBmp->Width + font->GapWidth;
|
offX += charBmp->Width + font->GapWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,33 +262,33 @@ void TTextBox::Draw()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto timeLeft = (this2->Message1->TimeLeft());
|
auto timeLeft = (Message1->TimeLeft());
|
||||||
if (timeLeft >= -2.0f)
|
if (timeLeft >= -2.0f)
|
||||||
{
|
{
|
||||||
int timer;
|
int timer;
|
||||||
if (timeLeft >= 0.25f)
|
if (timeLeft >= 0.25f)
|
||||||
{
|
{
|
||||||
timer = timer::set(timeLeft, this2, TimerExpired);
|
timer = timer::set(timeLeft, this, TimerExpired);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
timer = timer::set(0.25, this2, TimerExpired);
|
timer = timer::set(0.25, this, TimerExpired);
|
||||||
}
|
}
|
||||||
this2->Timer = timer;
|
Timer = timer;
|
||||||
goto LABEL_18;
|
goto LABEL_18;
|
||||||
}
|
}
|
||||||
nextMessage = message->NextMessage;
|
nextMessage = message->NextMessage;
|
||||||
}
|
}
|
||||||
delete message;
|
delete message;
|
||||||
this2->Message1 = nextMessage;
|
Message1 = nextMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdrv::blit(
|
gdrv::blit(
|
||||||
&render::vscreen,
|
&render::vscreen,
|
||||||
this2->OffsetX,
|
OffsetX,
|
||||||
this2->OffsetY,
|
OffsetY,
|
||||||
this2->OffsetX + render::vscreen.XPosition,
|
OffsetX + render::vscreen.XPosition,
|
||||||
this2->OffsetY + render::vscreen.YPosition,
|
OffsetY + render::vscreen.YPosition,
|
||||||
this2->Width,
|
Width,
|
||||||
this2->Height);
|
Height);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user