TPinballTable v2.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -259,3 +259,4 @@ paket-files/
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
/Ida
|
||||
|
||||
Binary file not shown.
@@ -39,3 +39,17 @@ int Sound::AddFactor(int a1, int a2)
|
||||
{
|
||||
return a1 + a2;
|
||||
}
|
||||
|
||||
void Sound::PlaySoundA(int a1, int a2, int a3, unsigned short a4, short a5)
|
||||
{
|
||||
}
|
||||
|
||||
CHAR* Sound::LoadWaveFile(LPCSTR lpName)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LPCVOID Sound::FreeSound(LPCVOID pMem)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -11,4 +11,7 @@ public:
|
||||
static void Close();
|
||||
static int SubFactor(int a1, int a2);
|
||||
static int AddFactor(int a1, int a2);
|
||||
static void PlaySound(int a1, int a2, int a3, unsigned __int16 a4, __int16 a5);
|
||||
static CHAR* LoadWaveFile(LPCSTR lpName);
|
||||
static LPCVOID FreeSound(LPCVOID pMem);
|
||||
};
|
||||
|
||||
@@ -1,2 +1,10 @@
|
||||
#include "pch.h"
|
||||
#include "TDemo.h"
|
||||
|
||||
#include "TPinballTable.h"
|
||||
|
||||
TDemo::TDemo(TPinballTable* table, int groupIndex)
|
||||
: TCollisionComponent(table, groupIndex, false)
|
||||
{
|
||||
table->Demo = this;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,5 @@ class TDemo :
|
||||
public TCollisionComponent
|
||||
{
|
||||
public:
|
||||
TDemo(TPinballTable* table, int groupIndex) : TCollisionComponent(table, groupIndex, false)
|
||||
{
|
||||
}
|
||||
TDemo(TPinballTable* table, int groupIndex);
|
||||
};
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "control.h"
|
||||
#include "render.h"
|
||||
#include "TZmapList.h"
|
||||
|
||||
struct render_sprite_type_struct;
|
||||
struct component_control;
|
||||
class TPinballTable;
|
||||
class TZmapList;
|
||||
|
||||
enum class message_code
|
||||
{
|
||||
};
|
||||
|
||||
class TPinballComponent
|
||||
{
|
||||
@@ -16,7 +19,6 @@ public:
|
||||
virtual void put_scoring(int scoreId, int value);
|
||||
virtual int get_scoring(int score1);
|
||||
|
||||
int VfTable;
|
||||
__int8 UnknownBaseFlag1;
|
||||
__int8 UnknownBaseFlag2;
|
||||
int MessageField;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,26 @@
|
||||
#pragma once
|
||||
#include "objlist_class.h"
|
||||
#include "score.h"
|
||||
#include "TDrain.h"
|
||||
#include "TFlipper.h"
|
||||
#include "TLightGroup.h"
|
||||
|
||||
#include "TPinballComponent.h"
|
||||
#include "TPlunger.h"
|
||||
|
||||
struct scoreStruct;
|
||||
class TFlipper;
|
||||
class TPlunger;
|
||||
class TDrain;
|
||||
class TDemo;
|
||||
class objlist_class;
|
||||
class TLightGroup;
|
||||
|
||||
struct score_struct_super
|
||||
{
|
||||
scoreStruct* ScoreStruct;
|
||||
int Score;
|
||||
int ScoreE9Part;
|
||||
int Unknown2;
|
||||
int BallCount;
|
||||
int ExtraBalls;
|
||||
int BallLockedCounter;
|
||||
};
|
||||
|
||||
|
||||
class TPinballTable : public TPinballComponent
|
||||
{
|
||||
@@ -14,56 +29,38 @@ public:
|
||||
~TPinballTable();
|
||||
TPinballComponent* find_component(LPCSTR componentName);
|
||||
TPinballComponent* find_component(int groupIndex);
|
||||
int AddScore(int score);
|
||||
void ChangeBallCount(int count);
|
||||
void tilt(float time);
|
||||
void port_draw() override;
|
||||
int Message(int code, float value) override;
|
||||
|
||||
static void EndGame_timeout(int timerId, void* caller);
|
||||
static void LightShow_timeout(int timerId, void* caller);
|
||||
static void replay_timer_callback(int timerId, void* caller);
|
||||
static void tilt_timeout(int timerId, void* caller);
|
||||
|
||||
TFlipper* FlipperL;
|
||||
TFlipper* FlipperR;
|
||||
scoreStruct* Score1;
|
||||
int* ScoreBallcount;
|
||||
int* ScorePlayerNumber1;
|
||||
scoreStruct* CurScoreStruct;
|
||||
scoreStruct* ScoreBallcount;
|
||||
scoreStruct* ScorePlayerNumber1;
|
||||
int UnknownP6;
|
||||
int SoundIndex1;
|
||||
int SoundIndex2;
|
||||
int SoundIndex3;
|
||||
int UnknownP10;
|
||||
int UnknownP11;
|
||||
int UnknownP12;
|
||||
int UnknownP13;
|
||||
int UnknownP14;
|
||||
int UnknownP15;
|
||||
scoreStruct* Score2;
|
||||
int UnknownP17;
|
||||
int UnknownP18;
|
||||
int UnknownP19;
|
||||
int UnknownP20;
|
||||
int UnknownP21;
|
||||
int UnknownP22;
|
||||
scoreStruct* Score3_x3_at7;
|
||||
int UnknownP24;
|
||||
int UnknownP25;
|
||||
int UnknownP26;
|
||||
int UnknownP27;
|
||||
int UnknownP28;
|
||||
int UnknownP29;
|
||||
int UnknownP30;
|
||||
int UnknownP31;
|
||||
int UnknownP32;
|
||||
int UnknownP33;
|
||||
int UnknownP34;
|
||||
int UnknownP35;
|
||||
int UnknownP36;
|
||||
int UnknownP37;
|
||||
int UnknownP38;
|
||||
int UnknownP39;
|
||||
int UnknownP40;
|
||||
int UnknownP41;
|
||||
int UnknownP42;
|
||||
int UnknownP43;
|
||||
int CurScore;
|
||||
int CurScoreE9;
|
||||
int LightShowTimer;
|
||||
int EndGameTimeoutTimer;
|
||||
int TiltTimeoutTimer;
|
||||
score_struct_super PlayerScores[4];
|
||||
int PlayerCount;
|
||||
int CurrentPlayer;
|
||||
TPlunger* Plunger;
|
||||
TDrain* Drain;
|
||||
int UnknownP48;
|
||||
TDemo* Demo;
|
||||
int XOffset;
|
||||
int YOffset;
|
||||
int Width;
|
||||
@@ -77,24 +74,27 @@ public:
|
||||
float CollisionCompOffset;
|
||||
int UnknownP62;
|
||||
int UnknownP63;
|
||||
int UnknownP64;
|
||||
int UnknownP65;
|
||||
int UnknownP66;
|
||||
int UnknownP67;
|
||||
int UnknownP68;
|
||||
int UnknownP69;
|
||||
int UnknownP70;
|
||||
int ScoreMultiplier;
|
||||
int ScoreAdded;
|
||||
int ScoreSpecial1;
|
||||
int ScoreSpecial2;
|
||||
int ScoreSpecial2Flag;
|
||||
int ScoreSpecial3;
|
||||
int ScoreSpecial3Flag;
|
||||
int UnknownP71;
|
||||
int UnknownP72;
|
||||
int UnknownP73;
|
||||
int UnknownP74;
|
||||
int BallCount;
|
||||
int MaxBallCount;
|
||||
int ExtraBalls;
|
||||
int UnknownP75;
|
||||
int UnknownP76;
|
||||
int UnknownP77;
|
||||
int BallLockedCounter;
|
||||
int MultiballFlag;
|
||||
int UnknownP78;
|
||||
int UnknownP79;
|
||||
int UnknownP80;
|
||||
int ReplayActiveFlag;
|
||||
int ReplayTimer;
|
||||
int UnknownP81;
|
||||
int UnknownP82;
|
||||
int UnknownP83;
|
||||
int TiltLockFlag;
|
||||
|
||||
private:
|
||||
static int score_multipliers[5];
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "loader.h"
|
||||
#include "proj.h"
|
||||
#include "render.h"
|
||||
#include "TLine.h"
|
||||
#include "TPinballTable.h"
|
||||
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
#include "TEdgeManager.h"
|
||||
|
||||
|
||||
|
||||
class TPinballTable;
|
||||
class TEdgeManager;
|
||||
struct gdrv_bitmap8;
|
||||
|
||||
class TTableLayer :
|
||||
public TCollisionComponent
|
||||
{
|
||||
public:
|
||||
static TEdgeManager *edge_manager;
|
||||
static TEdgeManager* edge_manager;
|
||||
|
||||
TTableLayer(TPinballTable* table);
|
||||
~TTableLayer() override;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "pch.h"
|
||||
#include "TTextBox.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "loader.h"
|
||||
#include "render.h"
|
||||
#include "score.h"
|
||||
#include "timer.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "control.h"
|
||||
|
||||
#include "objlist_class.h"
|
||||
#include "TPinballTable.h"
|
||||
|
||||
int control_bump_scores1[] = {500, 1000, 1500, 2000};
|
||||
@@ -500,6 +502,8 @@ component_tag* control::simple_components[142]
|
||||
&control_soundwave7_tag
|
||||
};
|
||||
|
||||
int control::table_control_flag;
|
||||
|
||||
|
||||
void control::make_links(TPinballTable* table)
|
||||
{
|
||||
@@ -558,7 +562,8 @@ void control::handler(int code, TPinballComponent* cmp)
|
||||
{
|
||||
cmp->put_scoring(scoreInd, control->Scores[scoreInd]);
|
||||
++scoreInd;
|
||||
} while (scoreInd < control->ScoreCount);
|
||||
}
|
||||
while (scoreInd < control->ScoreCount);
|
||||
}
|
||||
control->ControlFunc(code, cmp);
|
||||
}
|
||||
@@ -796,3 +801,12 @@ void control::MultiplierTargetControl(int code, TPinballComponent* caller)
|
||||
void control::BallDrainControl(int code, TPinballComponent* caller)
|
||||
{
|
||||
}
|
||||
|
||||
void control::table_control_handler(int code)
|
||||
{
|
||||
if (code == 1011)
|
||||
{
|
||||
table_control_flag = 0;
|
||||
control_lite77_tag.Component->Message(7, 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
static TPinballTable* TableG;
|
||||
static component_info score_components[88];
|
||||
static component_tag* simple_components[142];
|
||||
static int table_control_flag;
|
||||
|
||||
static void make_links(TPinballTable* table);
|
||||
static TPinballComponent* make_component_link(component_tag* tag);
|
||||
@@ -93,4 +94,6 @@ public:
|
||||
static void MedalTargetControl(int code, TPinballComponent* caller);
|
||||
static void MultiplierTargetControl(int code, TPinballComponent* caller);
|
||||
static void BallDrainControl(int code, TPinballComponent* caller);
|
||||
|
||||
static void table_control_handler(int code);
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "memory.h"
|
||||
#include "partman.h"
|
||||
#include "pinball.h"
|
||||
#include "Sound.h"
|
||||
#include "zdrv.h"
|
||||
|
||||
|
||||
@@ -132,7 +133,7 @@ void loader::unload()
|
||||
soundListStruct* soundListPtr = &sound_list[1];
|
||||
do
|
||||
{
|
||||
//Sound_FreeSound(soundListPtr->WavePtr);
|
||||
Sound::FreeSound(soundListPtr->WavePtr);
|
||||
++index;
|
||||
++soundListPtr;
|
||||
}
|
||||
@@ -166,7 +167,7 @@ int loader::get_sound_id(int groupIndex)
|
||||
if (!sound_list[soundIndex].Loaded && !sound_list[soundIndex].WavePtr)
|
||||
{
|
||||
int soundGroupId = sound_list[soundIndex].GroupIndex;
|
||||
sound_list[soundIndex].Volume = 0.0;
|
||||
sound_list[soundIndex].Duration = 0.0;
|
||||
if (soundGroupId > 0 && !pinball::quickFlag)
|
||||
{
|
||||
__int16* value = (__int16*)partman::field(loader_table, soundGroupId, datFieldTypes::ShortValue);
|
||||
@@ -174,9 +175,9 @@ int loader::get_sound_id(int groupIndex)
|
||||
{
|
||||
const CHAR* fileName = partman::field(loader_table, soundGroupId, datFieldTypes::String);
|
||||
HFILE hFile = _lopen(fileName, 0);
|
||||
sound_list[soundIndex].Volume = (float)((double)(_llseek(hFile, 0, 2)) * 0.0000909090909090909);
|
||||
sound_list[soundIndex].Duration = (float)((double)_llseek(hFile, 0, 2) * 0.0000909090909090909);
|
||||
_lclose(hFile);
|
||||
//sound_list[soundIndex4].WavePtr = Sound_LoadWaveFile(lpName);
|
||||
sound_list[soundIndex].WavePtr = Sound::LoadWaveFile(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,12 +321,12 @@ int loader::material(int groupIndex, visualStruct* visual)
|
||||
}
|
||||
|
||||
|
||||
double loader::play_sound(int soundIndex)
|
||||
float loader::play_sound(int soundIndex)
|
||||
{
|
||||
if (soundIndex <= 0)
|
||||
return 0.0;
|
||||
//Sound_PlaySound(sound_list[soundIndex].WavePtr, 0, 7, 5, 0);
|
||||
return sound_list[soundIndex].Volume;
|
||||
Sound::PlaySound((int)sound_list[soundIndex].WavePtr, 0, 7, 5, 0);
|
||||
return sound_list[soundIndex].Duration;
|
||||
}
|
||||
|
||||
int loader::state_id(int groupIndex, int groupIndexOffset)
|
||||
|
||||
@@ -16,7 +16,7 @@ struct soundListStruct
|
||||
char* WavePtr;
|
||||
int GroupIndex;
|
||||
int Loaded;
|
||||
float Volume;
|
||||
float Duration;
|
||||
char* PtrToSmth;
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
static char* query_name(int groupIndex);
|
||||
static float* query_float_attribute(int groupIndex, int groupIndexOffset, int firstValue);
|
||||
static __int16* query_iattribute(int groupIndex, int firstValue, int* arraySize);
|
||||
static double play_sound(int soundIndex);
|
||||
static float play_sound(int soundIndex);
|
||||
static datFileStruct* loader_table;
|
||||
private:
|
||||
static errorMsg loader_errors[];
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "timer.h"
|
||||
#include "winmain.h"
|
||||
#include "resource.h"
|
||||
#include "TLightGroup.h"
|
||||
#include "TPlunger.h"
|
||||
|
||||
TPinballTable* pb::MainTable = nullptr;
|
||||
datFileStruct* pb::record_table = nullptr;
|
||||
@@ -355,19 +357,19 @@ void pb::keydown(int key)
|
||||
}
|
||||
if (key == options::Options.LeftTableBumpKey)
|
||||
{
|
||||
if (!MainTable->UnknownP83)
|
||||
if (!MainTable->TiltLockFlag)
|
||||
nudge::nudge_right();
|
||||
return;
|
||||
}
|
||||
if (key == options::Options.RightTableBumpKey)
|
||||
{
|
||||
if (!MainTable->UnknownP83)
|
||||
if (!MainTable->TiltLockFlag)
|
||||
nudge::nudge_left();
|
||||
return;
|
||||
}
|
||||
if (key == options::Options.BottomTableBumpKey)
|
||||
{
|
||||
if (!MainTable->UnknownP83)
|
||||
if (!MainTable->TiltLockFlag)
|
||||
nudge::nudge_up();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "loader.h"
|
||||
#include "memory.h"
|
||||
#include "partman.h"
|
||||
#include "render.h"
|
||||
#include "TDrain.h"
|
||||
#include "winmain.h"
|
||||
|
||||
@@ -15,12 +16,13 @@ int score::init()
|
||||
|
||||
scoreStruct* score::create(LPCSTR fieldName, gdrv_bitmap8* renderBgBmp)
|
||||
{
|
||||
scoreStruct* score = (scoreStruct*)memory::allocate(sizeof(scoreStruct));
|
||||
auto score = reinterpret_cast<scoreStruct*>(memory::allocate(sizeof(scoreStruct)));
|
||||
if (!score)
|
||||
return nullptr;
|
||||
score->Score = -9999;
|
||||
score->BackgroundBmp = renderBgBmp;
|
||||
__int16* shortArr = (__int16*)partman::field_labeled(loader::loader_table, fieldName, datFieldTypes::ShortArray);
|
||||
auto shortArr = reinterpret_cast<__int16*>(partman::field_labeled(loader::loader_table, fieldName,
|
||||
datFieldTypes::ShortArray));
|
||||
if (!shortArr)
|
||||
{
|
||||
memory::free(score);
|
||||
|
||||
Reference in New Issue
Block a user