control v1.

This commit is contained in:
oz
2020-12-19 17:49:31 +03:00
parent 12066963f0
commit a6425b54f3
8 changed files with 916 additions and 16 deletions

View File

@@ -93,6 +93,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<BufferSecurityCheck>true</BufferSecurityCheck>
<PreprocessToFile>false</PreprocessToFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -155,6 +156,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="control.h" />
<ClInclude Include="DatParser.h" />
<ClInclude Include="fullscrn.h" />
<ClInclude Include="gdrv.h" />
@@ -217,6 +219,7 @@
<ClInclude Include="zdrv.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="control.cpp" />
<ClCompile Include="DatParser.cpp" />
<ClCompile Include="fullscrn.cpp" />
<ClCompile Include="gdrv.cpp" />

View File

@@ -213,6 +213,9 @@
<ClInclude Include="high_score.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="control.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
@@ -392,6 +395,9 @@
<ClCompile Include="high_score.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="control.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Natvis Include="NatvisFile.natvis" />

View File

@@ -99,16 +99,11 @@ void TPinballComponent::port_draw()
{
}
void TPinballComponent::put_scoring(int score1, int score2)
void TPinballComponent::put_scoring(int scoreId, int value)
{
}
int TPinballComponent::get_scoring(int score1)
{
return 0;
}
void TPinballComponent::control_handler(int code, TPinballComponent* cmp)
{
}

View File

@@ -1,4 +1,6 @@
#pragma once
#include "control.h"
#include "render.h"
#include "TZmapList.h"
@@ -11,9 +13,8 @@ public:
virtual ~TPinballComponent();
virtual int Message(int code, float value);
virtual void port_draw();
virtual void put_scoring(int score1, int score2);
virtual void put_scoring(int scoreId, int value);
virtual int get_scoring(int score1);
static void control_handler(int code, TPinballComponent* cmp);
int VfTable;
__int8 UnknownBaseFlag1;
@@ -21,7 +22,7 @@ public:
int MessageField;
char* GroupName;
int Unknown4;
int Unknown5;
component_control* Control;
int GroupIndex;
render_sprite_type_struct* RenderSprite;
TPinballTable* PinballTable;

View File

@@ -2,6 +2,7 @@
#include "TPinballTable.h"
#include "control.h"
#include "loader.h"
#include "memory.h"
#include "pinball.h"
@@ -89,7 +90,7 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
{
case 1000:
case 1010:
new TWall( this, groupIndex);
new TWall(this, groupIndex);
break;
case 1001:
this->Plunger = new TPlunger(this, groupIndex);
@@ -183,9 +184,9 @@ TPinballTable::TPinballTable(): TPinballComponent(nullptr, -1, false)
}
//build_occlude_list();
pinball::InfoTextBox = static_cast<TTextBox*>(find_component("info_text_box"));
pinball::MissTextBox = static_cast<TTextBox*>(find_component("mission_text_box"));
//control_make_links(this);
pinball::InfoTextBox = dynamic_cast<TTextBox*>(find_component("info_text_box"));
pinball::MissTextBox = dynamic_cast<TTextBox*>(find_component("mission_text_box"));
control::make_links(this);
}
@@ -220,7 +221,7 @@ TPinballTable::~TPinballTable()
//if (i)
//(*(void(__thiscall**)(TLightGroup*, int))(*(_DWORD*)i + 16))(i, 1);
//if (!ListP1->Count())
break;
break;
}
delete ListP2;
delete ListP1;
@@ -270,4 +271,4 @@ void TPinballTable::port_draw()
{
static_cast<TPinballComponent*>(ListP1->Get(index))->port_draw();
}
}
}

View File

@@ -61,7 +61,7 @@ void TTextBox::TimerExpired(int timerId, void* caller)
delete message;
tb->Message1 = nextMessage;
tb->Draw();
control_handler(60, tb);
control::handler(60, tb);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,96 @@
#pragma once
class TPinballTable;
class TPinballComponent;
struct component_tag
{
LPCSTR Name;
TPinballComponent* Component;
};
struct component_control
{
void (* ControlFunc)(int, TPinballComponent*);
int ScoreCount;
int* Scores;
};
struct component_info
{
component_tag* Tag;
component_control Control;
};
class control
{
public:
static TPinballTable* TableG;
static component_info score_components[88];
static component_tag* simple_components[142];
static void make_links(TPinballTable* table);
static TPinballComponent* make_component_link(component_tag* tag);
static void handler(int code, TPinballComponent* cmp);
static void FlipperRebounderControl1(int code, TPinballComponent* caller);
static void FlipperRebounderControl2(int code, TPinballComponent* caller);
static void RebounderControl(int code, TPinballComponent* caller);
static void BumperControl(int code, TPinballComponent* caller);
static void LeftKickerControl(int code, TPinballComponent* caller);
static void RightKickerControl(int code, TPinballComponent* caller);
static void LeftKickerGateControl(int code, TPinballComponent* caller);
static void RightKickerGateControl(int code, TPinballComponent* caller);
static void DeploymentChuteToEscapeChuteOneWayControl(int code, TPinballComponent* caller);
static void DeploymentChuteToTableOneWayControl(int code, TPinballComponent* caller);
static void DrainBallBlockerControl(int code, TPinballComponent* caller);
static void LaunchRampControl(int code, TPinballComponent* caller);
static void LaunchRampHoleControl(int code, TPinballComponent* caller);
static void SpaceWarpRolloverControl(int code, TPinballComponent* caller);
static void ReentryLanesRolloverControl(int code, TPinballComponent* caller);
static void BumperGroupControl(int code, TPinballComponent* caller);
static void LaunchLanesRolloverControl(int code, TPinballComponent* caller);
static void OutLaneRolloverControl(int code, TPinballComponent* caller);
static void ExtraBallLightControl(int code, TPinballComponent* caller);
static void ReturnLaneRolloverControl(int code, TPinballComponent* caller);
static void BonusLaneRolloverControl(int code, TPinballComponent* caller);
static void FuelRollover1Control(int code, TPinballComponent* caller);
static void FuelRollover2Control(int code, TPinballComponent* caller);
static void FuelRollover3Control(int code, TPinballComponent* caller);
static void FuelRollover4Control(int code, TPinballComponent* caller);
static void FuelRollover5Control(int code, TPinballComponent* caller);
static void FuelRollover6Control(int code, TPinballComponent* caller);
static void HyperspaceLightGroupControl(int code, TPinballComponent* caller);
static void WormHoleControl(int code, TPinballComponent* caller);
static void LeftFlipperControl(int code, TPinballComponent* caller);
static void RightFlipperControl(int code, TPinballComponent* caller);
static void JackpotLightControl(int code, TPinballComponent* caller);
static void BonusLightControl(int code, TPinballComponent* caller);
static void BoosterTargetControl(int code, TPinballComponent* caller);
static void MedalLightGroupControl(int code, TPinballComponent* caller);
static void MultiplierLightGroupControl(int code, TPinballComponent* caller);
static void FuelSpotTargetControl(int code, TPinballComponent* caller);
static void MissionSpotTargetControl(int code, TPinballComponent* caller);
static void LeftHazardSpotTargetControl(int code, TPinballComponent* caller);
static void RightHazardSpotTargetControl(int code, TPinballComponent* caller);
static void WormHoleDestinationControl(int code, TPinballComponent* caller);
static void BlackHoleKickoutControl(int code, TPinballComponent* caller);
static void FlagControl(int code, TPinballComponent* caller);
static void GravityWellKickoutControl(int code, TPinballComponent* caller);
static void SkillShotGate1Control(int code, TPinballComponent* caller);
static void SkillShotGate2Control(int code, TPinballComponent* caller);
static void SkillShotGate3Control(int code, TPinballComponent* caller);
static void SkillShotGate4Control(int code, TPinballComponent* caller);
static void SkillShotGate5Control(int code, TPinballComponent* caller);
static void SkillShotGate6Control(int code, TPinballComponent* caller);
static void ShootAgainLightControl(int code, TPinballComponent* caller);
static void EscapeChuteSinkControl(int code, TPinballComponent* caller);
static void MissionControl(int code, TPinballComponent* caller);
static void HyperspaceKickOutControl(int code, TPinballComponent* caller);
static void PlungerControl(int code, TPinballComponent* caller);
static void MedalTargetControl(int code, TPinballComponent* caller);
static void MultiplierTargetControl(int code, TPinballComponent* caller);
static void BallDrainControl(int code, TPinballComponent* caller);
};