Cleaned up objlist_class.
parent
5b9a1ff95d
commit
6ff457eb68
|
@ -29,7 +29,7 @@ int main()
|
|||
auto dib = gdrv::DibCreate(8, 1, 1);
|
||||
gdrv::DibSetUsage(dib, 0, 1);
|
||||
|
||||
objlist_class d = objlist_class(2, 4);
|
||||
auto d = objlist_class<void>(2, 4);
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
d.Add((void*)i);
|
||||
|
|
|
@ -219,7 +219,6 @@
|
|||
<ClInclude Include="TTimer.h" />
|
||||
<ClInclude Include="TTripwire.h" />
|
||||
<ClInclude Include="TWall.h" />
|
||||
<ClInclude Include="TZmapList.h" />
|
||||
<ClInclude Include="WaveMix.h" />
|
||||
<ClInclude Include="winmain.h" />
|
||||
<ClInclude Include="zdrv.h" />
|
||||
|
@ -234,7 +233,6 @@
|
|||
<ClCompile Include="memory.cpp" />
|
||||
<ClCompile Include="midi.cpp" />
|
||||
<ClCompile Include="nudge.cpp" />
|
||||
<ClCompile Include="objlist_class.cpp" />
|
||||
<ClCompile Include="options.cpp" />
|
||||
<ClCompile Include="partman.cpp" />
|
||||
<ClCompile Include="pb.cpp" />
|
||||
|
|
|
@ -81,9 +81,6 @@
|
|||
<ClInclude Include="TTimer.h">
|
||||
<Filter>Header Files\TPinballComponent</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TZmapList.h">
|
||||
<Filter>Header Files\TPinballComponent</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="memory.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -236,9 +233,6 @@
|
|||
<ClCompile Include="SpaceCadetPinball.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="objlist_class.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="partman.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "proj.h"
|
||||
#include "render.h"
|
||||
#include "TPinballTable.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TBall::TBall(TPinballTable* table) : TPinballComponent(table, -1, false)
|
||||
{
|
||||
|
@ -30,7 +29,7 @@ TBall::TBall(TPinballTable* table) : TPinballComponent(table, -1, false)
|
|||
Position.X = 0.0;
|
||||
Position.Y = 0.0;
|
||||
|
||||
ListBitmap = new TZmapList(0, 4);
|
||||
ListBitmap = new objlist_class<gdrv_bitmap8>(0, 4);
|
||||
auto groupIndex = loader::query_handle("ball");
|
||||
Offset = *loader::query_float_attribute(groupIndex, 0, 500);
|
||||
auto visualCount = loader::query_visual_states(groupIndex);
|
||||
|
@ -73,12 +72,12 @@ void TBall::Repaint()
|
|||
|
||||
auto zArrPtr = VisualZArray;
|
||||
int index;
|
||||
for (index = 0; index < ListBitmap->Count() - 1; ++index, zArrPtr++)
|
||||
for (index = 0; index < ListBitmap->GetCount() - 1; ++index, zArrPtr++)
|
||||
{
|
||||
if (*zArrPtr <= zDepth) break;
|
||||
}
|
||||
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(ListBitmap->Get(index));
|
||||
auto bmp = ListBitmap->Get(index);
|
||||
render::ball_set(
|
||||
RenderSprite,
|
||||
bmp,
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
#include "control.h"
|
||||
#include "loader.h"
|
||||
#include "objlist_class.h"
|
||||
#include "render.h"
|
||||
#include "timer.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TBlocker::TBlocker(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ int TBlocker::Message(int code, float value)
|
|||
case 52:
|
||||
ActiveFlag = 1;
|
||||
loader::play_sound(SoundIndex4);
|
||||
render::sprite_set_bitmap(RenderSprite, static_cast<gdrv_bitmap8*>(ListBitmap->Get(0)));
|
||||
render::sprite_set_bitmap(RenderSprite, ListBitmap->Get(0));
|
||||
break;
|
||||
case 59:
|
||||
break;
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
#include "control.h"
|
||||
#include "loader.h"
|
||||
#include "objlist_class.h"
|
||||
#include "render.h"
|
||||
#include "timer.h"
|
||||
#include "TPinballTable.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TBumper::TBumper(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
|
||||
{
|
||||
|
@ -29,8 +29,8 @@ int TBumper::Message(int code, float value)
|
|||
case 11:
|
||||
{
|
||||
auto nextBmp = static_cast<int>(floor(value));
|
||||
if (2 * nextBmp > ListBitmap->Count() - 1)
|
||||
nextBmp = (ListBitmap->Count() - 1) / 2;
|
||||
if (2 * nextBmp > ListBitmap->GetCount() - 1)
|
||||
nextBmp = (ListBitmap->GetCount() - 1) / 2;
|
||||
if (nextBmp < 0)
|
||||
nextBmp = 0;
|
||||
if (nextBmp != BmpIndex)
|
||||
|
@ -48,7 +48,7 @@ int TBumper::Message(int code, float value)
|
|||
case 12:
|
||||
{
|
||||
auto nextBmp = BmpIndex + 1;
|
||||
auto maxBmp = ListBitmap->Count() - 1;
|
||||
auto maxBmp = ListBitmap->GetCount() - 1;
|
||||
if (2 * nextBmp > maxBmp)
|
||||
nextBmp = maxBmp / 2;
|
||||
TBumper::Message(11, static_cast<float>(nextBmp));
|
||||
|
@ -124,8 +124,8 @@ int TBumper::get_scoring(int index)
|
|||
void TBumper::TimerExpired(int timerId, void* caller)
|
||||
{
|
||||
auto bump = static_cast<TBumper*>(caller);
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(bump->ListBitmap->Get(bump->BmpIndex * 2));
|
||||
auto zMap = static_cast<zmap_header_type*>(bump->ListZMap->Get(bump->BmpIndex * 2));
|
||||
auto bmp = bump->ListBitmap->Get(bump->BmpIndex * 2);
|
||||
auto zMap = bump->ListZMap->Get(bump->BmpIndex * 2);
|
||||
bump->Timer = 0;
|
||||
render::sprite_set(
|
||||
bump->RenderSprite,
|
||||
|
@ -139,8 +139,8 @@ void TBumper::TimerExpired(int timerId, void* caller)
|
|||
void TBumper::Fire()
|
||||
{
|
||||
int bmpIndex = 2 * BmpIndex + 1;
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(ListBitmap->Get(bmpIndex));
|
||||
auto zMap = static_cast<zmap_header_type*>(ListZMap->Get(bmpIndex));
|
||||
auto bmp = ListBitmap->Get(bmpIndex);
|
||||
auto zMap = ListZMap->Get(bmpIndex);
|
||||
render::sprite_set(
|
||||
RenderSprite,
|
||||
bmp,
|
||||
|
|
|
@ -12,7 +12,7 @@ TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, b
|
|||
{
|
||||
visualStruct visual{};
|
||||
|
||||
EdgeList = new objlist_class(4, 4);
|
||||
EdgeList = new objlist_class<TEdgeSegment>(4, 4);
|
||||
ActiveFlag = 1;
|
||||
if (GroupName != nullptr)
|
||||
UnusedBaseFlag = 1;
|
||||
|
@ -42,9 +42,9 @@ TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, b
|
|||
|
||||
TCollisionComponent::~TCollisionComponent()
|
||||
{
|
||||
for (TEdgeSegment* edge; EdgeList->Count() > 0;)
|
||||
for (TEdgeSegment* edge; EdgeList->GetCount() > 0;)
|
||||
{
|
||||
edge = static_cast<TEdgeSegment*>(EdgeList->Get(0));
|
||||
edge = EdgeList->Get(0);
|
||||
EdgeList->Delete(edge);
|
||||
delete edge;
|
||||
}
|
||||
|
@ -54,9 +54,9 @@ TCollisionComponent::~TCollisionComponent()
|
|||
|
||||
void TCollisionComponent::port_draw()
|
||||
{
|
||||
for (int index = EdgeList->Count() - 1; index >= 0; index--)
|
||||
for (int index = EdgeList->GetCount() - 1; index >= 0; index--)
|
||||
{
|
||||
static_cast<TEdgeSegment*>(EdgeList->Get(index))->port_draw();
|
||||
EdgeList->Get(index)->port_draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
#include "TPinballComponent.h"
|
||||
|
||||
class objlist_class;
|
||||
struct vector_type;
|
||||
class TEdgeSegment;
|
||||
class TBall;
|
||||
|
@ -9,7 +8,7 @@ class TBall;
|
|||
class TCollisionComponent : public TPinballComponent
|
||||
{
|
||||
public:
|
||||
objlist_class* EdgeList;
|
||||
objlist_class<TEdgeSegment>* EdgeList;
|
||||
float Elasticity;
|
||||
float Smoothness;
|
||||
float Boost;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
TComponentGroup::TComponentGroup(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
|
||||
{
|
||||
List = new objlist_class(4, 4);
|
||||
List = new objlist_class<TPinballComponent>(4, 4);
|
||||
Timer = 0;
|
||||
if (groupIndex > 0)
|
||||
{
|
||||
|
@ -50,9 +50,9 @@ int TComponentGroup::Message(int code, float value)
|
|||
}
|
||||
else if (code <= 1007 || code > 1011 && code != 1020 && code != 1022)
|
||||
{
|
||||
for (int i = 0; i < List->Count(); i++)
|
||||
for (int i = 0; i < List->GetCount(); i++)
|
||||
{
|
||||
static_cast<TPinballComponent*>(List->Get(i))->Message(code, value);
|
||||
List->Get(i)->Message(code, value);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
#include "TPinballComponent.h"
|
||||
|
||||
class objlist_class;
|
||||
|
||||
class TComponentGroup :
|
||||
public TPinballComponent
|
||||
|
@ -12,6 +11,6 @@ public:
|
|||
int Message(int code, float value) override;
|
||||
static void NotifyTimerExpired(int timerId, void* caller);
|
||||
|
||||
objlist_class* List;
|
||||
objlist_class<TPinballComponent>* List;
|
||||
int Timer;
|
||||
};
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
TEdgeBox::TEdgeBox()
|
||||
{
|
||||
EdgeList = new objlist_class(0, 4);
|
||||
FieldList = new objlist_class(0, 1);
|
||||
EdgeList = new objlist_class<TEdgeSegment>(0, 4);
|
||||
FieldList = new objlist_class<field_effect_type>(0, 1);
|
||||
}
|
||||
|
||||
TEdgeBox::~TEdgeBox()
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
#pragma once
|
||||
class objlist_class;
|
||||
#include "objlist_class.h"
|
||||
|
||||
|
||||
struct field_effect_type;
|
||||
class TEdgeSegment;
|
||||
|
||||
class TEdgeBox
|
||||
{
|
||||
|
@ -7,7 +11,7 @@ public:
|
|||
TEdgeBox();
|
||||
~TEdgeBox();
|
||||
|
||||
objlist_class* EdgeList;
|
||||
objlist_class* FieldList;
|
||||
objlist_class<TEdgeSegment>* EdgeList;
|
||||
objlist_class<field_effect_type>* FieldList;
|
||||
};
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ int TEdgeManager::TestGridBox(int x, int y, float* distPtr, TEdgeSegment** edgeD
|
|||
{
|
||||
TEdgeBox* edgeBox = &BoxArray[x + y * MaxBoxX];
|
||||
TEdgeSegment** edgePtr = &EdgeArray[edgeIndex];
|
||||
for (auto index = edgeBox->EdgeList->Count() - 1; index >= 0; --index)
|
||||
for (auto index = edgeBox->EdgeList->GetCount() - 1; index >= 0; --index)
|
||||
{
|
||||
auto edge = static_cast<TEdgeSegment*>(edgeBox->EdgeList->Get(index));
|
||||
auto edge = edgeBox->EdgeList->Get(index);
|
||||
if (!edge->ProcessedFlag && *edge->ActiveFlag && (edge->CollisionGroup & ray->FieldFlag))
|
||||
{
|
||||
if (!ball->already_hit(edge))
|
||||
|
@ -94,9 +94,9 @@ void TEdgeManager::FieldEffects(TBall* ball, vector_type* dstVec)
|
|||
TEdgeBox* edgeBox = &BoxArray[box_x(ball->Position.X) + box_y(ball->Position.Y) *
|
||||
MaxBoxX];
|
||||
|
||||
for (int index = edgeBox->FieldList->Count() - 1; index >= 0; --index)
|
||||
for (int index = edgeBox->FieldList->GetCount() - 1; index >= 0; --index)
|
||||
{
|
||||
auto field = static_cast<field_effect_type*>(edgeBox->FieldList->Get(index));
|
||||
auto field = edgeBox->FieldList->Get(index);
|
||||
if (*field->Flag2Ptr && ball->FieldFlag & field->Mask)
|
||||
{
|
||||
if (field->CollisionComp->FieldEffect(ball, &vec))
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "timer.h"
|
||||
#include "TLine.h"
|
||||
#include "TPinballTable.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TFlagSpinner::TFlagSpinner(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
|
||||
{
|
||||
|
@ -62,8 +61,8 @@ int TFlagSpinner::Message(int code, float value)
|
|||
Timer = 0;
|
||||
}
|
||||
BmpIndex = 0;
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(ListBitmap->Get(0));
|
||||
auto zMap = static_cast<zmap_header_type*>(ListZMap->Get(0));
|
||||
auto bmp = ListBitmap->Get(0);
|
||||
auto zMap = ListZMap->Get(0);
|
||||
render::sprite_set(
|
||||
RenderSprite,
|
||||
bmp,
|
||||
|
@ -109,7 +108,7 @@ void TFlagSpinner::NextFrame()
|
|||
{
|
||||
BmpIndex += SpinDirection;
|
||||
int bmpIndex = BmpIndex;
|
||||
int bmpCount = ListBitmap->Count();
|
||||
int bmpCount = ListBitmap->GetCount();
|
||||
if (bmpIndex >= bmpCount)
|
||||
BmpIndex = 0;
|
||||
else if (bmpIndex < 0)
|
||||
|
@ -124,8 +123,8 @@ void TFlagSpinner::NextFrame()
|
|||
control::handler(62, this);
|
||||
}
|
||||
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(ListBitmap->Get(BmpIndex));
|
||||
auto zMap = static_cast<zmap_header_type*>(ListZMap->Get(BmpIndex));
|
||||
auto bmp = ListBitmap->Get(BmpIndex);
|
||||
auto zMap = ListZMap->Get(BmpIndex);
|
||||
render::sprite_set(
|
||||
RenderSprite,
|
||||
bmp,
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#include "control.h"
|
||||
#include "loader.h"
|
||||
#include "objlist_class.h"
|
||||
#include "pb.h"
|
||||
#include "render.h"
|
||||
#include "TFlipperEdge.h"
|
||||
#include "timer.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TFlipper::TFlipper(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
|
||||
{
|
||||
|
@ -47,8 +47,8 @@ TFlipper::TFlipper(TPinballTable* table, int groupIndex) : TCollisionComponent(t
|
|||
FlipperEdge = flipperEdge;
|
||||
if (flipperEdge)
|
||||
{
|
||||
BmpCoef1 = flipperEdge->BmpCoef1 / static_cast<float>(ListBitmap->Count() - 1);
|
||||
BmpCoef2 = flipperEdge->BmpCoef2 / static_cast<float>(ListBitmap->Count() - 1);
|
||||
BmpCoef1 = flipperEdge->BmpCoef1 / static_cast<float>(ListBitmap->GetCount() - 1);
|
||||
BmpCoef2 = flipperEdge->BmpCoef2 / static_cast<float>(ListBitmap->GetCount() - 1);
|
||||
}
|
||||
BmpIndex = 0;
|
||||
InputTime = 0.0;
|
||||
|
@ -137,7 +137,7 @@ void TFlipper::TimerExpired(int timerId, void* caller)
|
|||
|
||||
bool bmpIndexOutOfBounds = false;
|
||||
auto bmpIndexAdvance = static_cast<int>(floor((pb::time_now - flip->InputTime) / flip->TimerTime + 0.5f));
|
||||
int bmpCount = flip->ListBitmap->Count();
|
||||
int bmpCount = flip->ListBitmap->GetCount();
|
||||
if (bmpIndexAdvance > bmpCount)
|
||||
bmpIndexAdvance = bmpCount;
|
||||
if (bmpIndexAdvance < 0)
|
||||
|
@ -149,7 +149,7 @@ void TFlipper::TimerExpired(int timerId, void* caller)
|
|||
if (flip->MessageField == 1)
|
||||
{
|
||||
flip->BmpIndex += bmpIndexAdvance;
|
||||
int countSub1 = flip->ListBitmap->Count() - 1;
|
||||
int countSub1 = flip->ListBitmap->GetCount() - 1;
|
||||
if (flip->BmpIndex >= countSub1)
|
||||
{
|
||||
flip->BmpIndex = countSub1;
|
||||
|
@ -177,8 +177,8 @@ void TFlipper::TimerExpired(int timerId, void* caller)
|
|||
timer = timer::set(flip->TimerTime, flip, TimerExpired);
|
||||
flip->Timer = timer;
|
||||
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(flip->ListBitmap->Get(flip->BmpIndex));
|
||||
auto zMap = static_cast<zmap_header_type*>(flip->ListZMap->Get(flip->BmpIndex));
|
||||
auto bmp = flip->ListBitmap->Get(flip->BmpIndex);
|
||||
auto zMap = flip->ListZMap->Get(flip->BmpIndex);
|
||||
render::sprite_set(
|
||||
flip->RenderSprite,
|
||||
bmp,
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include "control.h"
|
||||
#include "loader.h"
|
||||
#include "objlist_class.h"
|
||||
#include "render.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, true)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ TGate::TGate(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
|||
SoundIndex4 = visual.SoundIndex4;
|
||||
SoundIndex3 = visual.SoundIndex3;
|
||||
ActiveFlag = 1;
|
||||
render::sprite_set_bitmap(RenderSprite, static_cast<gdrv_bitmap8*>(ListBitmap->Get(0)));
|
||||
render::sprite_set_bitmap(RenderSprite, ListBitmap->Get(0));
|
||||
control::handler(1024, this);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ int TGate::Message(int code, float value)
|
|||
else if (code == 54 || code == 1024)
|
||||
{
|
||||
ActiveFlag = 1;
|
||||
render::sprite_set_bitmap(RenderSprite, static_cast<gdrv_bitmap8*>(ListBitmap->Get(0)));
|
||||
render::sprite_set_bitmap(RenderSprite, ListBitmap->Get(0));
|
||||
if (code == 54)
|
||||
loader::play_sound(SoundIndex4);
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#include "control.h"
|
||||
#include "loader.h"
|
||||
#include "maths.h"
|
||||
#include "objlist_class.h"
|
||||
#include "render.h"
|
||||
#include "timer.h"
|
||||
#include "TPinballTable.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TKickback::TKickback(TPinballTable* table, int groupIndex): TCollisionComponent(table, groupIndex, true)
|
||||
{
|
||||
|
@ -66,8 +66,8 @@ void TKickback::TimerExpired(int timerId, void* caller)
|
|||
loader::play_sound(kick->HardHitSoundId);
|
||||
if (kick->ListBitmap)
|
||||
{
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(kick->ListBitmap->Get(1));
|
||||
auto zMap = static_cast<zmap_header_type*>(kick->ListZMap->Get(1));
|
||||
auto bmp = kick->ListBitmap->Get(1);
|
||||
auto zMap = kick->ListZMap->Get(1);
|
||||
render::sprite_set(
|
||||
kick->RenderSprite,
|
||||
bmp,
|
||||
|
@ -80,8 +80,8 @@ void TKickback::TimerExpired(int timerId, void* caller)
|
|||
{
|
||||
if (kick->ListBitmap)
|
||||
{
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(kick->ListBitmap->Get(0));
|
||||
auto zMap = static_cast<zmap_header_type*>(kick->ListZMap->Get(0));
|
||||
auto bmp = kick->ListBitmap->Get(0);
|
||||
auto zMap = kick->ListZMap->Get(0);
|
||||
render::sprite_set(
|
||||
kick->RenderSprite,
|
||||
bmp,
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
#include "control.h"
|
||||
#include "loader.h"
|
||||
#include "objlist_class.h"
|
||||
#include "render.h"
|
||||
#include "timer.h"
|
||||
#include "TPinballTable.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TLight::TLight(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, true)
|
||||
{
|
||||
|
@ -144,13 +144,13 @@ int TLight::Message(int code, float value)
|
|||
break;
|
||||
case 11:
|
||||
BmpIndex2 = static_cast<int>(floor(value));
|
||||
if (BmpIndex2 > ListBitmap->Count())
|
||||
BmpIndex2 = ListBitmap->Count();
|
||||
if (BmpIndex2 > ListBitmap->GetCount())
|
||||
BmpIndex2 = ListBitmap->GetCount();
|
||||
bmpIndex = 0;
|
||||
if (BmpIndex2 < 0)
|
||||
BmpIndex2 = 0;
|
||||
Flasher.BmpArr[0] = nullptr;
|
||||
Flasher.BmpArr[1] = static_cast<gdrv_bitmap8*>(ListBitmap->Get(BmpIndex2));
|
||||
Flasher.BmpArr[1] = ListBitmap->Get(BmpIndex2);
|
||||
if (FlasherActive == 0)
|
||||
{
|
||||
if (!FlasherFlag1)
|
||||
|
@ -169,8 +169,8 @@ int TLight::Message(int code, float value)
|
|||
break;
|
||||
case 12:
|
||||
bmpIndex = BmpIndex2 + 1;
|
||||
if (bmpIndex > ListBitmap->Count())
|
||||
bmpIndex = ListBitmap->Count();
|
||||
if (bmpIndex > ListBitmap->GetCount())
|
||||
bmpIndex = ListBitmap->GetCount();
|
||||
Message(11, static_cast<float>(bmpIndex));
|
||||
break;
|
||||
case 13:
|
||||
|
@ -257,7 +257,7 @@ void TLight::Reset()
|
|||
Flasher.Sprite = RenderSprite;
|
||||
Flasher.BmpArr[0] = nullptr;
|
||||
if (ListBitmap)
|
||||
Flasher.BmpArr[1] = static_cast<gdrv_bitmap8*>(ListBitmap->Get(0));
|
||||
Flasher.BmpArr[1] = ListBitmap->Get(0);
|
||||
Flasher.Unknown4 = 0;
|
||||
Flasher.Unknown3 = 0;
|
||||
MessageField = 0;
|
||||
|
|
|
@ -18,7 +18,7 @@ TLightBargraph::TLightBargraph(TPinballTable* table, int groupIndex) : TLightGro
|
|||
float* floatArr = loader::query_float_attribute(groupIndex, 0, 904);
|
||||
if (floatArr)
|
||||
{
|
||||
int count = 2 * List->Count();
|
||||
int count = 2 * List->GetCount();
|
||||
TimerTimeArray = reinterpret_cast<float*>(memory::allocate(count * sizeof(float)));
|
||||
if (TimerTimeArray)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ int TLightBargraph::Message(int code, float value)
|
|||
TimerBargraph = 0;
|
||||
}
|
||||
auto timeIndex = static_cast<int>(floor(value));
|
||||
auto maxCount = 2 * List->Count();
|
||||
auto maxCount = 2 * List->GetCount();
|
||||
if (timeIndex >= maxCount)
|
||||
timeIndex = maxCount - 1;
|
||||
if (timeIndex >= 0)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballComponent(table, groupIndex, false)
|
||||
{
|
||||
List = new objlist_class(4, 4);
|
||||
List = new objlist_class<TLight>(4, 4);
|
||||
Timer = 0;
|
||||
NotifyTimer = 0;
|
||||
Reset();
|
||||
|
@ -22,7 +22,7 @@ TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballCompone
|
|||
__int16* groupIndArr = loader::query_iattribute(groupIndex, 1027, &count);
|
||||
for (int index = 0; index < count; ++groupIndArr)
|
||||
{
|
||||
auto comp = table->find_component(*groupIndArr);
|
||||
auto comp = dynamic_cast<TLight*>(table->find_component(*groupIndArr));
|
||||
if (comp)
|
||||
List->Add(comp);
|
||||
++index;
|
||||
|
@ -71,8 +71,8 @@ int TLightGroup::Message(int code, float value)
|
|||
break;
|
||||
case 24:
|
||||
{
|
||||
auto count = List->Count();
|
||||
auto lastLight = static_cast<TLight*>(List->Get(count - 1));
|
||||
auto count = List->GetCount();
|
||||
auto lastLight = List->Get(count - 1);
|
||||
if (lastLight->FlasherActive || lastLight->FlasherFlag2 || lastLight->FlasherFlag1)
|
||||
break;
|
||||
if (MessageField2)
|
||||
|
@ -85,12 +85,12 @@ int TLightGroup::Message(int code, float value)
|
|||
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));
|
||||
auto lightCur = List->Get(index);
|
||||
auto lightPrev = List->Get(index - 1);
|
||||
lightCur->Message(lightPrev->BmpIndex1 != 0, 0.0);
|
||||
lightCur->MessageField = lightPrev->MessageField;
|
||||
}
|
||||
auto firstLight = static_cast<TLight*>(List->Get(0));
|
||||
auto firstLight = List->Get(0);
|
||||
firstLight->Message(bmpIndex1 != 0, 0.0);
|
||||
firstLight->MessageField = lightMessageField;
|
||||
reschedule_animation(value);
|
||||
|
@ -98,23 +98,23 @@ int TLightGroup::Message(int code, float value)
|
|||
}
|
||||
case 25:
|
||||
{
|
||||
auto count = List->Count();
|
||||
auto lastLight = static_cast<TLight*>(List->Get(count - 1));
|
||||
auto count = List->GetCount();
|
||||
auto lastLight = 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));
|
||||
auto firstLight = 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));
|
||||
auto lightCur = List->Get(index);
|
||||
auto lightNext = List->Get(index + 1);
|
||||
lightCur->Message(lightNext->BmpIndex1 != 0, 0.0);
|
||||
lightCur->MessageField = lightNext->MessageField;
|
||||
}
|
||||
|
@ -129,16 +129,16 @@ int TLightGroup::Message(int code, float value)
|
|||
start_animation();
|
||||
MessageField2 = code;
|
||||
AnimationFlag = 0;
|
||||
auto count = List->Count();
|
||||
auto lastLight = static_cast<TLight*>(List->Get(count - 1));
|
||||
auto count = List->GetCount();
|
||||
auto lastLight = 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));
|
||||
auto lightCur = List->Get(i);
|
||||
auto lightPrev = List->Get(i - 1);
|
||||
lightCur->Message((lightPrev->FlasherFlag2 != 0) + 8, 0.0);
|
||||
}
|
||||
auto firstLight = static_cast<TLight*>(List->Get(0));
|
||||
auto firstLight = List->Get(0);
|
||||
firstLight->Message((flasherFlag2 != 0) + 8, 0);
|
||||
reschedule_animation(value);
|
||||
break;
|
||||
|
@ -149,16 +149,16 @@ int TLightGroup::Message(int code, float value)
|
|||
start_animation();
|
||||
MessageField2 = code;
|
||||
AnimationFlag = 0;
|
||||
auto count = List->Count();
|
||||
auto firstLight = static_cast<TLight*>(List->Get(0));
|
||||
auto count = List->GetCount();
|
||||
auto firstLight = 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));
|
||||
auto lightCur = List->Get(i);
|
||||
auto lightNext = List->Get(i + 1);
|
||||
lightCur->Message((lightNext->FlasherFlag2 != 0) + 8, 0.0);
|
||||
}
|
||||
auto lastLight = static_cast<TLight*>(List->Get(count - 1));
|
||||
auto lastLight = List->Get(count - 1);
|
||||
lastLight->Message((flasherFlag2 != 0) + 8, 0);
|
||||
reschedule_animation(value);
|
||||
break;
|
||||
|
@ -169,12 +169,12 @@ int TLightGroup::Message(int code, float value)
|
|||
start_animation();
|
||||
MessageField2 = code;
|
||||
AnimationFlag = 0;
|
||||
auto count = List->Count();
|
||||
auto count = List->GetCount();
|
||||
for (auto i = 0; i < count - 1; i++)
|
||||
{
|
||||
if (rand() % 100 > 70)
|
||||
{
|
||||
auto light = static_cast<TLight*>(List->Get(i));
|
||||
auto light = List->Get(i);
|
||||
auto randVal = static_cast<float>(rand()) * 0.00003051850947599719f * value * 3.0f + 0.1f;
|
||||
light->Message(9, randVal);
|
||||
}
|
||||
|
@ -188,10 +188,10 @@ int TLightGroup::Message(int code, float value)
|
|||
start_animation();
|
||||
MessageField2 = code;
|
||||
AnimationFlag = 0;
|
||||
auto count = List->Count();
|
||||
auto count = List->GetCount();
|
||||
for (auto i = 0; i < count - 1; i++)
|
||||
{
|
||||
auto light = static_cast<TLight*>(List->Get(i));
|
||||
auto light = List->Get(i);
|
||||
auto randVal = static_cast<float>(rand() % 100 > 70);
|
||||
light->Message(18, randVal);
|
||||
}
|
||||
|
@ -201,13 +201,13 @@ int TLightGroup::Message(int code, float value)
|
|||
case 30:
|
||||
{
|
||||
auto noBmpInd1Count = 0;
|
||||
auto countSub1 = List->Count() - 1;
|
||||
auto countSub1 = List->GetCount() - 1;
|
||||
if (countSub1 < 0)
|
||||
break;
|
||||
|
||||
for (auto i = countSub1; i >= 0; i--)
|
||||
{
|
||||
if (!static_cast<TLight*>(List->Get(i))->BmpIndex1)
|
||||
if (!List->Get(i)->BmpIndex1)
|
||||
++noBmpInd1Count;
|
||||
}
|
||||
if (!noBmpInd1Count)
|
||||
|
@ -216,7 +216,7 @@ int TLightGroup::Message(int code, float value)
|
|||
auto randModCount = rand() % noBmpInd1Count;
|
||||
for (auto i = countSub1; i >= 0; i--)
|
||||
{
|
||||
auto light = static_cast<TLight*>(List->Get(i));
|
||||
auto light = List->Get(i);
|
||||
if (!light->BmpIndex1 && randModCount-- == 0)
|
||||
{
|
||||
light->Message(1, 0.0);
|
||||
|
@ -231,13 +231,13 @@ int TLightGroup::Message(int code, float value)
|
|||
case 31:
|
||||
{
|
||||
auto bmpInd1Count = 0;
|
||||
auto countSub1 = List->Count() - 1;
|
||||
auto countSub1 = List->GetCount() - 1;
|
||||
if (countSub1 < 0)
|
||||
break;
|
||||
|
||||
for (auto i = countSub1; i >= 0; i--)
|
||||
{
|
||||
if (static_cast<TLight*>(List->Get(i))->BmpIndex1)
|
||||
if (List->Get(i)->BmpIndex1)
|
||||
++bmpInd1Count;
|
||||
}
|
||||
if (!bmpInd1Count)
|
||||
|
@ -246,7 +246,7 @@ int TLightGroup::Message(int code, float value)
|
|||
auto randModCount = rand() % bmpInd1Count;
|
||||
for (auto i = countSub1; i >= 0; i--)
|
||||
{
|
||||
auto light = static_cast<TLight*>(List->Get(i));
|
||||
auto light = List->Get(i);
|
||||
if (light->BmpIndex1 && randModCount-- == 0)
|
||||
{
|
||||
light->Message(0, 0.0);
|
||||
|
@ -263,7 +263,7 @@ int TLightGroup::Message(int code, float value)
|
|||
auto index = next_light_up();
|
||||
if (index < 0)
|
||||
break;
|
||||
static_cast<TLight*>(List->Get(index))->Message(1, 0.0);
|
||||
List->Get(index)->Message(1, 0.0);
|
||||
if (MessageField2)
|
||||
start_animation();
|
||||
return 1;
|
||||
|
@ -273,7 +273,7 @@ int TLightGroup::Message(int code, float value)
|
|||
auto index = next_light_down();
|
||||
if (index < 0)
|
||||
break;
|
||||
static_cast<TLight*>(List->Get(index))->Message(0, 0.0);
|
||||
List->Get(index)->Message(0, 0.0);
|
||||
if (MessageField2)
|
||||
start_animation();
|
||||
return 1;
|
||||
|
@ -292,10 +292,10 @@ int TLightGroup::Message(int code, float value)
|
|||
case 35:
|
||||
{
|
||||
auto index = static_cast<int>(floor(value));
|
||||
if (index >= List->Count() || index < 0)
|
||||
if (index >= List->GetCount() || index < 0)
|
||||
break;
|
||||
|
||||
auto light = static_cast<TLight*>(List->Get(index));
|
||||
auto light = List->Get(index);
|
||||
light->Message(1, 0.0);
|
||||
if (MessageField2)
|
||||
start_animation();
|
||||
|
@ -304,10 +304,10 @@ int TLightGroup::Message(int code, float value)
|
|||
case 36:
|
||||
{
|
||||
auto index = static_cast<int>(floor(value));
|
||||
if (index >= List->Count() || index < 0)
|
||||
if (index >= List->GetCount() || index < 0)
|
||||
break;
|
||||
|
||||
auto light = static_cast<TLight*>(List->Get(index));
|
||||
auto light = List->Get(index);
|
||||
light->Message(0, 0.0);
|
||||
if (MessageField2)
|
||||
start_animation();
|
||||
|
@ -316,16 +316,16 @@ int TLightGroup::Message(int code, float value)
|
|||
case 37:
|
||||
{
|
||||
auto bmp1Count = 0;
|
||||
auto countSub1 = List->Count() - 1;
|
||||
auto countSub1 = List->GetCount() - 1;
|
||||
for (auto i = countSub1; i >= 0; i--)
|
||||
{
|
||||
if (static_cast<TLight*>(List->Get(i))->BmpIndex1)
|
||||
if (List->Get(i)->BmpIndex1)
|
||||
++bmp1Count;
|
||||
}
|
||||
return bmp1Count;
|
||||
}
|
||||
case 38:
|
||||
return List->Count();
|
||||
return List->GetCount();
|
||||
case 39:
|
||||
return MessageField2;
|
||||
case 40:
|
||||
|
@ -337,7 +337,7 @@ int TLightGroup::Message(int code, float value)
|
|||
break;
|
||||
if (MessageField2 || AnimationFlag)
|
||||
TLightGroup::Message(34, 0.0);
|
||||
static_cast<TLight*>(List->Get(index))->Message(15, value);
|
||||
List->Get(index)->Message(15, value);
|
||||
return 1;
|
||||
}
|
||||
case 42:
|
||||
|
@ -347,7 +347,7 @@ int TLightGroup::Message(int code, float value)
|
|||
break;
|
||||
if (MessageField2 || AnimationFlag)
|
||||
TLightGroup::Message(34, 0.0);
|
||||
static_cast<TLight*>(List->Get(index))->Message(16, value);
|
||||
List->Get(index)->Message(16, value);
|
||||
return 1;
|
||||
}
|
||||
case 43:
|
||||
|
@ -359,10 +359,10 @@ int TLightGroup::Message(int code, float value)
|
|||
break;
|
||||
case 44:
|
||||
{
|
||||
auto countSub1 = List->Count() - 1;
|
||||
auto countSub1 = List->GetCount() - 1;
|
||||
for (auto index = countSub1; index >= 0; index--)
|
||||
{
|
||||
auto light = static_cast<TLight*>(List->Get(index));
|
||||
auto light = List->Get(index);
|
||||
if (light->BmpIndex1)
|
||||
{
|
||||
light->Message(0, 0.0);
|
||||
|
@ -378,7 +378,7 @@ int TLightGroup::Message(int code, float value)
|
|||
auto index = static_cast<int>(floor(value));
|
||||
if (index >= 0)
|
||||
{
|
||||
auto count = List->Count();
|
||||
auto count = List->GetCount();
|
||||
if (index <= count)
|
||||
{
|
||||
auto countSub1 = count - 1;
|
||||
|
@ -387,7 +387,7 @@ int TLightGroup::Message(int code, float value)
|
|||
countSub1 = index;
|
||||
for (auto i = countSub1, k = countSub1 - index; k != 0; i--, k--)
|
||||
{
|
||||
auto light = static_cast<TLight*>(List->Get(i));
|
||||
auto light = List->Get(i);
|
||||
light->Message(20, 0.0);
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ int TLightGroup::Message(int code, float value)
|
|||
{
|
||||
for (auto i = countSub1; i != 0; i--)
|
||||
{
|
||||
auto light = static_cast<TLight*>(List->Get(i));
|
||||
auto light = List->Get(i);
|
||||
light->Message(19, 0.0);
|
||||
}
|
||||
}
|
||||
|
@ -408,14 +408,14 @@ int TLightGroup::Message(int code, float value)
|
|||
auto index = next_light_down();
|
||||
if (index >= 0)
|
||||
{
|
||||
static_cast<TLight*>(List->Get(index))->Message(4, 0.0);
|
||||
List->Get(index)->Message(4, 0.0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
for (auto index = List->Count() - 1; index >= 0; index--)
|
||||
for (auto index = List->GetCount() - 1; index >= 0; index--)
|
||||
{
|
||||
static_cast<TLight*>(List->Get(index))->Message(code, value);
|
||||
List->Get(index)->Message(code, value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -453,9 +453,9 @@ void TLightGroup::reschedule_animation(float time)
|
|||
|
||||
void TLightGroup::start_animation()
|
||||
{
|
||||
for (int index = List->Count() - 1; index >= 0; --index)
|
||||
for (int index = List->GetCount() - 1; index >= 0; --index)
|
||||
{
|
||||
auto light = static_cast<TLight*>(List->Get(index));
|
||||
auto light = List->Get(index);
|
||||
if (light->BmpIndex1)
|
||||
light->Message(9, 0.0);
|
||||
else
|
||||
|
@ -465,9 +465,9 @@ void TLightGroup::start_animation()
|
|||
|
||||
int TLightGroup::next_light_up()
|
||||
{
|
||||
for (int index = 0; index < List->Count(); ++index)
|
||||
for (int index = 0; index < List->GetCount(); ++index)
|
||||
{
|
||||
if (!static_cast<TLight*>(List->Get(index))->BmpIndex1)
|
||||
if (!List->Get(index)->BmpIndex1)
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
|
@ -475,9 +475,9 @@ int TLightGroup::next_light_up()
|
|||
|
||||
int TLightGroup::next_light_down()
|
||||
{
|
||||
for (int index = List->Count() - 1; index >= 0; --index)
|
||||
for (int index = List->GetCount() - 1; index >= 0; --index)
|
||||
{
|
||||
if (!static_cast<TLight*>(List->Get(index))->BmpIndex1)
|
||||
if (!List->Get(index)->BmpIndex1)
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
#include "TPinballComponent.h"
|
||||
class objlist_class;
|
||||
|
||||
|
||||
class TLight;
|
||||
|
||||
struct TLightGroup_player_backup
|
||||
{
|
||||
|
@ -27,7 +29,7 @@ public:
|
|||
static void TimerExpired(int timerId, void* caller);
|
||||
static void NotifyTimerExpired(int timerId, void* caller);
|
||||
|
||||
objlist_class* List;
|
||||
objlist_class<TLight>* List;
|
||||
float Timer1Time;
|
||||
float Timer1TimeDefault;
|
||||
int MessageField2;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#include "control.h"
|
||||
#include "loader.h"
|
||||
#include "objlist_class.h"
|
||||
#include "render.h"
|
||||
#include "TBall.h"
|
||||
#include "timer.h"
|
||||
#include "TPinballTable.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
TLightRollover::TLightRollover(TPinballTable* table, int groupIndex) : TRollover(table, groupIndex, false)
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ void TLightRollover::Collision(TBall* ball, vector_type* nextPosition, vector_ty
|
|||
control::handler(63, this);
|
||||
RolloverFlag = RolloverFlag == 0;
|
||||
if (ListBitmap)
|
||||
render::sprite_set_bitmap(RenderSprite, static_cast<gdrv_bitmap8*>(ListBitmap->Get(0)));
|
||||
render::sprite_set_bitmap(RenderSprite, ListBitmap->Get(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "loader.h"
|
||||
#include "objlist_class.h"
|
||||
#include "render.h"
|
||||
#include "TZmapList.h"
|
||||
#include "TPinballTable.h"
|
||||
|
||||
TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool loadVisuals)
|
||||
|
@ -32,32 +31,32 @@ TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool
|
|||
if (visual.Bitmap)
|
||||
{
|
||||
if (!ListBitmap)
|
||||
ListBitmap = new TZmapList(visualCount, 4);
|
||||
ListBitmap = new objlist_class<gdrv_bitmap8>(visualCount, 4);
|
||||
if (ListBitmap)
|
||||
ListBitmap->Add(visual.Bitmap);
|
||||
}
|
||||
if (visual.ZMap)
|
||||
{
|
||||
if (!ListZMap)
|
||||
ListZMap = new TZmapList(visualCount, 4);
|
||||
ListZMap = new objlist_class<zmap_header_type>(visualCount, 4);
|
||||
if (ListZMap)
|
||||
ListZMap->Add(visual.ZMap);
|
||||
}
|
||||
}
|
||||
zmap_header_type* zMap = nullptr;
|
||||
if (ListZMap)
|
||||
zMap = static_cast<zmap_header_type*>(ListZMap->Get(0));
|
||||
zMap = ListZMap->Get(0);
|
||||
if (ListBitmap)
|
||||
{
|
||||
rectangle_type bmp1Rect{}, tmpRect{};
|
||||
auto rootBmp = static_cast<gdrv_bitmap8*>(ListBitmap->Get(0));
|
||||
auto rootBmp = ListBitmap->Get(0);
|
||||
bmp1Rect.XPosition = rootBmp->XPosition - table->XOffset;
|
||||
bmp1Rect.YPosition = rootBmp->YPosition - table->YOffset;
|
||||
bmp1Rect.Width = rootBmp->Width;
|
||||
bmp1Rect.Height = rootBmp->Height;
|
||||
for (int index = 1; index < ListBitmap->Count(); index++)
|
||||
for (int index = 1; index < ListBitmap->GetCount(); index++)
|
||||
{
|
||||
auto bmp = static_cast<gdrv_bitmap8*>(ListBitmap->Get(index));
|
||||
auto bmp = ListBitmap->Get(index);
|
||||
tmpRect.XPosition = bmp->XPosition - table->XOffset;
|
||||
tmpRect.YPosition = bmp->YPosition - table->YOffset;
|
||||
tmpRect.Width = bmp->Width;
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#pragma once
|
||||
#include "objlist_class.h"
|
||||
|
||||
struct zmap_header_type;
|
||||
struct gdrv_bitmap8;
|
||||
struct render_sprite_type_struct;
|
||||
struct component_control;
|
||||
class TPinballTable;
|
||||
class TZmapList;
|
||||
|
||||
enum class message_code
|
||||
{
|
||||
|
@ -35,6 +37,6 @@ public:
|
|||
int GroupIndex;
|
||||
render_sprite_type_struct* RenderSprite;
|
||||
TPinballTable* PinballTable;
|
||||
TZmapList* ListBitmap;
|
||||
TZmapList* ListZMap;
|
||||
objlist_class<gdrv_bitmap8>* ListBitmap;
|
||||
objlist_class<zmap_header_type>* ListZMap;
|
||||
};
|
||||
|
|
|
@ -48,8 +48,8 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
|
|||
{
|
||||
int shortArrLength;
|
||||
|
||||
ComponentList = new objlist_class(32, 16);
|
||||
BallList = new objlist_class(3, 1);
|
||||
ComponentList = new objlist_class<TPinballComponent>(32, 16);
|
||||
BallList = new objlist_class<TBall>(3, 1);
|
||||
CurScoreStruct = nullptr;
|
||||
ScoreBallcount = nullptr;
|
||||
ScorePlayerNumber1 = nullptr;
|
||||
|
@ -213,9 +213,9 @@ TPinballTable::~TPinballTable()
|
|||
ScoreBallcount = nullptr;
|
||||
}
|
||||
delete LightGroup;
|
||||
while (ComponentList->Count() > 0)
|
||||
while (ComponentList->GetCount() > 0)
|
||||
{
|
||||
delete static_cast<TPinballComponent*>(ComponentList->Get(0));
|
||||
delete ComponentList->Get(0);
|
||||
}
|
||||
delete BallList;
|
||||
delete ComponentList;
|
||||
|
@ -223,12 +223,12 @@ TPinballTable::~TPinballTable()
|
|||
|
||||
TPinballComponent* TPinballTable::find_component(LPCSTR componentName)
|
||||
{
|
||||
int objCount = ComponentList->Count();
|
||||
int objCount = ComponentList->GetCount();
|
||||
if (objCount > 0)
|
||||
{
|
||||
for (int index = 0; index < objCount; ++index)
|
||||
{
|
||||
TPinballComponent* obj = static_cast<TPinballComponent*>(ComponentList->Get(index));
|
||||
TPinballComponent* obj = ComponentList->Get(index);
|
||||
const CHAR* groupName = obj->GroupName;
|
||||
if (groupName && !lstrcmpA(groupName, componentName))
|
||||
{
|
||||
|
@ -243,12 +243,12 @@ TPinballComponent* TPinballTable::find_component(LPCSTR componentName)
|
|||
TPinballComponent* TPinballTable::find_component(int groupIndex)
|
||||
{
|
||||
char Buffer[40];
|
||||
int objCount = ComponentList->Count();
|
||||
int objCount = ComponentList->GetCount();
|
||||
if (objCount > 0)
|
||||
{
|
||||
for (int index = 0; index < objCount; ++index)
|
||||
{
|
||||
TPinballComponent* obj = static_cast<TPinballComponent*>(ComponentList->Get(index));
|
||||
TPinballComponent* obj = ComponentList->Get(index);
|
||||
if (obj->GroupIndex == groupIndex)
|
||||
return obj;
|
||||
}
|
||||
|
@ -307,9 +307,9 @@ void TPinballTable::tilt(float time)
|
|||
loader::play_sound(SoundIndex3);
|
||||
TiltTimeoutTimer = timer::set(30.0, this, tilt_timeout);
|
||||
|
||||
for (int i = 0; i < ComponentList->Count(); i++)
|
||||
for (int i = 0; i < ComponentList->GetCount(); i++)
|
||||
{
|
||||
static_cast<TPinballComponent*>(ComponentList->Get(i))->Message(1011, time);
|
||||
ComponentList->Get(i)->Message(1011, time);
|
||||
}
|
||||
LightGroup->Message(8, 0);
|
||||
TiltLockFlag = 1;
|
||||
|
@ -320,9 +320,9 @@ void TPinballTable::tilt(float time)
|
|||
|
||||
void TPinballTable::port_draw()
|
||||
{
|
||||
for (int index = ComponentList->Count() - 1; index >= 0; index--)
|
||||
for (int index = ComponentList->GetCount() - 1; index >= 0; index--)
|
||||
{
|
||||
static_cast<TPinballComponent*>(ComponentList->Get(index))->port_draw();
|
||||
ComponentList->Get(index)->port_draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,9 +362,9 @@ int TPinballTable::Message(int code, float value)
|
|||
case 1008:
|
||||
case 1009:
|
||||
case 1010:
|
||||
for (int i = 0; i < ComponentList->Count(); i++)
|
||||
for (int i = 0; i < ComponentList->GetCount(); i++)
|
||||
{
|
||||
static_cast<TPinballComponent*>(ComponentList->Get(i))->Message(code, value);
|
||||
ComponentList->Get(i)->Message(code, value);
|
||||
}
|
||||
break;
|
||||
case 1012:
|
||||
|
@ -406,7 +406,7 @@ int TPinballTable::Message(int code, float value)
|
|||
{
|
||||
CheatsUsed = 0;
|
||||
Message(1024, 0.0);
|
||||