1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-11-22 17:00:18 +01:00

Compare commits

..

No commits in common. "5d7d7c0822d59a3058f4fc7e058122e10ce29d15" and "cfe26918923934e219d3644ac44f82926bcb259d" have entirely different histories.

32 changed files with 97 additions and 222 deletions

View file

@ -1,7 +1,5 @@
#include "options.h"
#include "pch.h"
#include "Sound.h"
#include "maths.h"
int Sound::num_channels;
bool Sound::enabled_flag = false;
@ -43,7 +41,7 @@ void Sound::Close()
Mix_Quit();
}
void Sound::PlaySound(Mix_Chunk* wavePtr, int time, TPinballComponent *soundSource, const char* info)
void Sound::PlaySound(Mix_Chunk* wavePtr, int time)
{
if (wavePtr && enabled_flag)
{
@ -54,91 +52,8 @@ void Sound::PlaySound(Mix_Chunk* wavePtr, int time, TPinballComponent *soundSour
}
auto channel = Mix_PlayChannel(-1, wavePtr, 0);
if (channel != -1) {
if (channel != -1)
TimeStamps[channel] = time;
if (options::Options.SoundStereo) {
/* Think 3D sound positioning, where:
* - x goes from 0 to 1, left to right on the screen,
* - y goes from 0 to 1, top to bottom on the screen,
* - z goes from 0 to infinity, from table-level to the sky.
*
* We position the listener at the bottom center of the table,
* at 0.5 height, so roughly a table half-length. Coords of
* the listener are thus {0.5, 1.0, 0.5}.
*
* We use basic trigonometry to calculate the angle and distance
* from a sound source to the listener.
*
* Mix_SetPosition expects an angle in (Sint16)degrees, where
* 0 degrees is in front, 90 degrees is to the right, and so on.
* Mix_SetPosition expects a (Uint8)distance from 0 (near) to 255 (far).
*/
/* Get the sound source position. */
vector2 coordinates;
/* Some sounds are unpositioned; for that case the caller sends
* a NULL pointer as a soundSource; in those cases we position
* the sound at the center top of the table.
*/
if (!soundSource) {
coordinates.X = 0.5f;
coordinates.Y = 0.0f;
}
else {
coordinates = soundSource->get_coordinates();
};
/* Player position. */
auto pX = 0.5f;
auto pY = 1.0f;
auto pZ = 0.5f;
/* Calculate lengths of three sides of a triangle.
* ptos (Player-to-sound): distance from listener to the sound source,
* ptom (player-to-middle): distance from listener to the sound source
* when the latter is repositioned to the
* X center,
* stom (sound-to-middle): distance from ptos to ptom.
*/
auto ptos = sqrt(((coordinates.X - pX) * (coordinates.X - pX)) + ((coordinates.Y - pY) * (coordinates.Y - pY)) + (pZ * pZ));
auto ptom = sqrt(((coordinates.Y - pY) * (coordinates.Y - pY)) + (pZ * pZ));
auto stom = fabs(coordinates.X - 0.5);
/* Calculate the angle using the law of cosines and acos().
* That will return an angle in radians, e.g. in the [0,PI] range;
* we remap to [0,180], and cast to an integer.
*/
Sint16 angle = (Sint16)(acos(((stom * stom) - (ptos * ptos) - (ptom * ptom)) / (-2.0f * ptos * ptom)) * 180.0f / IM_PI);
/* Because we are using distances to calculate the angle,
* we now have no clue if the sound is to the right or the
* left. If the sound is to the right, the current value
* is good, but to the left, we need substract it from 360.
*/
if (coordinates.X < 0.5) {
angle = (360 - angle);
}
/* Distance from listener to the ball (ptos) is roughly
* in the [0.5,1.55] range; remap to 50-155 by multiplying
* by 100 and cast to an integer. */
Uint8 distance = (Uint8)(100.0f * ptos);
Mix_SetPosition(channel, angle, distance);
/* Output position of each sound emitted so we can verify
* the sanity of the implementation.
*/
/*
printf("X: %3.3f Y: %3.3f Angle: %3d Distance: %3d, Object: %s\n",
coordinates.X,
coordinates.Y,
angle,
distance,
info
);
*/
}
}
}
}

View file

@ -1,5 +1,4 @@
#pragma once
#include "TPinballComponent.h"
class Sound
@ -10,7 +9,7 @@ public:
static void Activate();
static void Deactivate();
static void Close();
static void PlaySound(Mix_Chunk* wavePtr, int time, TPinballComponent *soundSource, const char* info);
static void PlaySound(Mix_Chunk* wavePtr, int time);
static Mix_Chunk* LoadWaveFile(const std::string& lpName);
static void FreeSound(Mix_Chunk* wave);
static void SetChannels(int channels);

View file

@ -135,12 +135,3 @@ void TBall::throw_ball(TBall* ball, vector3* direction, float angleMult, float s
rnd = RandFloat();
ball->Speed = (1.0f - (rnd + rnd)) * (speedMult1 * speedMult2) + speedMult1;
}
vector2 TBall::get_coordinates()
{
vector2 coordinates;
vector2i pos2D = proj::xform_to_2d(Position);
coordinates.X = (float)pos2D.X / PinballTable->Width;
coordinates.Y = (float)pos2D.Y / PinballTable->Height;
return coordinates;
}

View file

@ -13,7 +13,6 @@ public :
void not_again(TEdgeSegment* edge);
bool already_hit(TEdgeSegment* edge);
int Message(int code, float value) override;
vector2 get_coordinates() override;
static void throw_ball(TBall* ball, vector3* direction, float angleMult, float speedMult1,
float speedMult2);

View file

@ -40,11 +40,11 @@ int TBlocker::Message(int code, float value)
ActiveFlag = 0;
render::sprite_set_bitmap(RenderSprite, nullptr);
if (code == 51)
loader::play_sound(SoundIndex3, this, "TBlocker1");
loader::play_sound(SoundIndex3);
return 0;
case 52:
ActiveFlag = 1;
loader::play_sound(SoundIndex4, this, "TBlocker2");
loader::play_sound(SoundIndex4);
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
break;
case 59:

View file

@ -36,9 +36,9 @@ int TBumper::Message(int code, float value)
if (nextBmp != BmpIndex)
{
if (nextBmp >= BmpIndex)
loader::play_sound(SoundIndex4, this, "TBumper1");
loader::play_sound(SoundIndex4);
if (nextBmp < BmpIndex)
loader::play_sound(SoundIndex3, this, "TBumper2");
loader::play_sound(SoundIndex3);
BmpIndex = nextBmp;
Fire();
control::handler(11, this);

View file

@ -4,7 +4,6 @@
#include "maths.h"
#include "TEdgeSegment.h"
#include "TPinballTable.h"
#include "TBall.h"
TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, bool createWall) :
@ -62,9 +61,9 @@ bool TCollisionComponent::DefaultCollision(TBall* ball, vector2* nextPosition, v
auto projSpeed = maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, Threshold, Boost);
if (projSpeed > Threshold)
loader::play_sound(HardHitSoundId, ball, "TCollisionComponent1");
loader::play_sound(HardHitSoundId);
else if (projSpeed > 0.2f)
loader::play_sound(SoftHitSoundId, ball, "TCollisionComponent2");
loader::play_sound(SoftHitSoundId);
else
return false;
return true;
@ -88,9 +87,9 @@ void TCollisionComponent::Collision(TBall* ball, vector2* nextPosition, vector2*
Threshold,
Boost);
if (projSpeed > Threshold)
loader::play_sound(HardHitSoundId, ball, "TCollisionComponent3");
loader::play_sound(HardHitSoundId);
else if (projSpeed > 0.2f)
loader::play_sound(SoftHitSoundId, ball, "TCollisionComponent4");
loader::play_sound(SoftHitSoundId);
}
int TCollisionComponent::FieldEffect(TBall* ball, vector2* vecDst)

View file

@ -117,7 +117,7 @@ void TFlagSpinner::NextFrame()
{
control::handler(63, this);
if (SoftHitSoundId)
loader::play_sound(SoftHitSoundId, this, "TFlagSpinner");
loader::play_sound(SoftHitSoundId);
if (!BmpIndex)
control::handler(62, this);
}

View file

@ -73,12 +73,12 @@ int TFlipper::Message(int code, float value)
{
control::handler(1, this);
TimerTime = ExtendAnimationFrameTime;
loader::play_sound(HardHitSoundId, this, "TFlipper1");
loader::play_sound(HardHitSoundId);
}
else if (code == 2)
{
TimerTime = RetractAnimationFrameTime;
loader::play_sound(SoftHitSoundId, this, "TFlipper2");
loader::play_sound(SoftHitSoundId);
}
else
{

View file

@ -26,14 +26,14 @@ int TGate::Message(int code, float value)
{
ActiveFlag = 0;
render::sprite_set_bitmap(RenderSprite, nullptr);
loader::play_sound(SoundIndex3, this, "TGate1");
loader::play_sound(SoundIndex3);
}
else if (code == 54 || code == 1024)
{
ActiveFlag = 1;
render::sprite_set_bitmap(RenderSprite, ListBitmap->at(0));
if (code == 54)
loader::play_sound(SoundIndex4, this, "TGate2");
loader::play_sound(SoundIndex4);
}
control::handler(code, this);
}

View file

@ -87,7 +87,7 @@ void THole::Collision(TBall* ball, vector2* nextPosition, vector2* direction, fl
if (!PinballTable->TiltLockFlag)
{
loader::play_sound(HardHitSoundId, ball, "THole1");
loader::play_sound(HardHitSoundId);
control::handler(57, this);
}
}
@ -115,7 +115,7 @@ int THole::FieldEffect(TBall* ball, vector2* vecDst)
ball->CollisionComp = nullptr;
ball->Direction.X = 0.0;
ball->Speed = 0.0;
loader::play_sound(SoftHitSoundId, ball, "THole2");
loader::play_sound(SoftHitSoundId);
control::handler(58, this);
}
}

View file

@ -62,7 +62,7 @@ void TKickback::TimerExpired(int timerId, void* caller)
{
kick->Threshold = 0.0;
kick->Timer = timer::set(kick->TimerTime2, kick, TimerExpired);
loader::play_sound(kick->HardHitSoundId, kick, "TKickback");
loader::play_sound(kick->HardHitSoundId);
if (kick->ListBitmap)
{
auto bmp = kick->ListBitmap->at(1);

View file

@ -122,7 +122,7 @@ void TKickout::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
}
else
{
loader::play_sound(SoftHitSoundId, ball, "TKickout1");
loader::play_sound(SoftHitSoundId);
control::handler(63, this);
}
}
@ -153,12 +153,12 @@ void TKickout::TimerExpired(int timerId, void* caller)
kick->Timer = timer::set(kick->TimerTime2, kick, ResetTimerExpired);
if (kick->Ball)
{
loader::play_sound(kick->HardHitSoundId, kick->Ball, "TKickout2");
kick->Ball->Position.Z = kick->OriginalBallZ;
TBall::throw_ball(kick->Ball, &kick->BallThrowDirection, kick->ThrowAngleMult, kick->ThrowSpeedMult1,
kick->ThrowSpeedMult2);
kick->ActiveFlag = 0;
kick->Ball = nullptr;
loader::play_sound(kick->HardHitSoundId);
}
}
}

View file

@ -53,7 +53,7 @@ void TLightRollover::Collision(TBall* ball, vector2* nextPosition, vector2* dire
}
else
{
loader::play_sound(SoftHitSoundId, this, "TLightRollover");
loader::play_sound(SoftHitSoundId);
control::handler(63, this);
RolloverFlag = RolloverFlag == 0;
if (ListBitmap)

View file

@ -51,7 +51,7 @@ void TOneway::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
if (!PinballTable->TiltLockFlag)
{
if (HardHitSoundId)
loader::play_sound(HardHitSoundId, ball, "TOneway1");
loader::play_sound(HardHitSoundId);
control::handler(63, this);
}
}
@ -69,7 +69,7 @@ void TOneway::Collision(TBall* ball, vector2* nextPosition, vector2* direction,
Boost) > 0.2f)
{
if (SoftHitSoundId)
loader::play_sound(SoftHitSoundId, ball, "TOneway2");
loader::play_sound(SoftHitSoundId);
}
}

View file

@ -17,8 +17,6 @@ TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool
ListZMap = nullptr;
GroupName = nullptr;
Control = nullptr;
VisualPosNormX= -1.0f;
VisualPosNormY = -1.0f;
if (table)
table->ComponentList.push_back(this);
if (groupIndex >= 0)
@ -71,10 +69,6 @@ TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool
rootBmp->XPosition - table->XOffset,
rootBmp->YPosition - table->YOffset,
&bmp1Rect);
auto& rect = RenderSprite->BmpRect;
VisualPosNormX = (rect.XPosition + (rect.Width / 2.0f)) / PinballTable->Width;
VisualPosNormY = (rect.YPosition + (rect.Height / 2.0f)) / PinballTable->Height;
}
}
GroupIndex = groupIndex;
@ -117,8 +111,3 @@ int TPinballComponent::get_scoring(int index)
{
return 0;
}
vector2 TPinballComponent::get_coordinates()
{
return {VisualPosNormX, VisualPosNormY};
}

View file

@ -4,7 +4,6 @@ struct zmap_header_type;
struct gdrv_bitmap8;
struct render_sprite_type_struct;
struct component_control;
struct vector2;
class TPinballTable;
enum class message_code
@ -24,7 +23,6 @@ public:
virtual void port_draw();
virtual void put_scoring(int index, int score);
virtual int get_scoring(int index);
virtual vector2 get_coordinates();
char UnusedBaseFlag;
char ActiveFlag;
@ -36,7 +34,4 @@ public:
TPinballTable* PinballTable;
std::vector<gdrv_bitmap8*>* ListBitmap;
std::vector<zmap_header_type*>* ListZMap;
private:
float VisualPosNormX;
float VisualPosNormY;
};

View file

@ -292,7 +292,7 @@ void TPinballTable::tilt(float time)
pinball::InfoTextBox->Clear();
pinball::MissTextBox->Clear();
pinball::InfoTextBox->Display(pinball::get_rc_string(35, 0), -1.0);
loader::play_sound(SoundIndex3, nullptr, "TPinballTable1");
loader::play_sound(SoundIndex3);
TiltTimeoutTimer = timer::set(30.0, this, tilt_timeout);
for (auto component : ComponentList)
@ -446,7 +446,7 @@ int TPinballTable::Message(int code, float value)
pinball::InfoTextBox->Clear();
pinball::MissTextBox->Clear();
LightGroup->Message(28, 0.2f);
auto time = loader::play_sound(SoundIndex1, nullptr, "TPinballTable2");
auto time = loader::play_sound(SoundIndex1);
LightShowTimer = timer::set(time, this, LightShow_timeout);
}
@ -543,7 +543,7 @@ int TPinballTable::Message(int code, float value)
}
break;
case 1022:
loader::play_sound(SoundIndex2, nullptr, "TPinballTable3");
loader::play_sound(SoundIndex2);
pinball::MissTextBox->Clear();
pinball::InfoTextBox->Display(pinball::get_rc_string(34, 0), -1.0);
EndGameTimeoutTimer = timer::set(3.0, this, EndGame_timeout);

View file

@ -50,7 +50,7 @@ int TPlunger::Message(int code, float value)
{
Boost = 0.0;
Threshold = 1000000000.0;
loader::play_sound(HardHitSoundId, this, "TPlunger1");
loader::play_sound(HardHitSoundId);
PullbackTimer(0, this);
}
return 0;
@ -70,7 +70,7 @@ int TPlunger::Message(int code, float value)
if (BallFeedTimer_)
timer::kill(BallFeedTimer_);
BallFeedTimer_ = timer::set(0.95999998f, this, BallFeedTimer);
loader::play_sound(SoundIndexP1, this, "TPlunger2");
loader::play_sound(SoundIndexP1);
control::handler(code, this);
return 0;
case 1017:
@ -95,7 +95,7 @@ int TPlunger::Message(int code, float value)
timer::kill(PullbackTimer_);
PullbackTimer_ = 0;
if (code == 1005)
loader::play_sound(SoundIndexP2, this, "TPlunger3");
loader::play_sound(SoundIndexP2);
auto bmp = ListBitmap->at(0);
auto zMap = ListZMap->at(0);
render::sprite_set(

View file

@ -79,7 +79,7 @@ void TPopupTarget::Collision(TBall* ball, vector2* nextPosition, vector2* direct
this->Boost) > this->Threshold)
{
if (this->HardHitSoundId)
loader::play_sound(this->HardHitSoundId, this, "TPopupTarget1");
loader::play_sound(this->HardHitSoundId);
this->Message(49, 0.0);
control::handler(63, this);
}
@ -94,6 +94,6 @@ void TPopupTarget::TimerExpired(int timerId, void* caller)
if (timerId)
{
if (target->SoftHitSoundId)
loader::play_sound(target->SoftHitSoundId, target, "TPopupTarget2");
loader::play_sound(target->SoftHitSoundId);
}
}

View file

@ -164,7 +164,7 @@ void TRamp::Collision(TBall* ball, vector2* nextPosition, vector2* direction, fl
{
if (!PinballTable->TiltLockFlag)
{
loader::play_sound(SoftHitSoundId, ball, "TRamp");
loader::play_sound(SoftHitSoundId);
control::handler(63, this);
}
}

View file

@ -54,7 +54,7 @@ void TRollover::Collision(TBall* ball, vector2* nextPosition, vector2* direction
}
else
{
loader::play_sound(SoftHitSoundId, ball, "TRollover");
loader::play_sound(SoftHitSoundId);
control::handler(63, this);
}
RolloverFlag = RolloverFlag == 0;

View file

@ -86,7 +86,7 @@ void TSink::Collision(TBall* ball, vector2* nextPosition, vector2* direction, fl
{
ball->ActiveFlag = 0;
render::sprite_set_bitmap(ball->RenderSprite, nullptr);
loader::play_sound(SoundIndex4, ball, "TSink1");
loader::play_sound(SoundIndex4);
control::handler(63, this);
}
}
@ -102,6 +102,6 @@ void TSink::TimerExpired(int timerId, void* caller)
TBall::throw_ball(ball, &sink->BallThrowDirection, sink->ThrowAngleMult, sink->ThrowSpeedMult1,
sink->ThrowSpeedMult2);
if (sink->SoundIndex3)
loader::play_sound(sink->SoundIndex3, ball, "TSink2");
loader::play_sound(sink->SoundIndex3);
sink->Timer = 0;
}

View file

@ -10,7 +10,7 @@ TSound::TSound(TPinballTable* table, int groupIndex) : TPinballComponent(table,
this->SoundIndex = visual.SoundIndex4;
}
float TSound::Play(TPinballComponent *soundSource, const char* info)
float TSound::Play()
{
return loader::play_sound(this->SoundIndex, soundSource, info);
return loader::play_sound(this->SoundIndex);
}

View file

@ -6,7 +6,7 @@ class TSound :
{
public:
TSound(TPinballTable* table, int groupIndex);
float Play(TPinballComponent *soundSource, const char* info);
float Play();
int SoundIndex;
};

View file

@ -19,7 +19,7 @@ void TTripwire::Collision(TBall* ball, vector2* nextPosition, vector2* direction
ball->not_again(edge);
if (!PinballTable->TiltLockFlag)
{
loader::play_sound(SoftHitSoundId, ball, "TTripwire");
loader::play_sound(SoftHitSoundId);
control::handler(63, this);
}
}

View file

@ -932,7 +932,7 @@ void control::pbctrl_bdoor_controller(char key)
void control::table_add_extra_ball(float count)
{
++TableG->ExtraBalls;
soundwave28->Play(nullptr, "table_add_extra_ball");
soundwave28->Play();
auto msg = pinball::get_rc_string(9, 0);
info_text_box->Display(msg, count);
}
@ -981,7 +981,7 @@ void control::table_bump_ball_sink_lock()
else
{
TableG->BallLockedCounter = TableG->BallLockedCounter + 1;
soundwave44->Play(nullptr, "table_bump_ball_sink_lock");
soundwave44->Play();
info_text_box->Display(pinball::get_rc_string(1, 0), 2.0);
TableG->Plunger->Message(1016, 0.0);
}
@ -1004,7 +1004,7 @@ void control::cheat_bump_rank()
auto rankText = pinball::get_rc_string(RankRcArray[rank], 1);
snprintf(Buffer,sizeof Buffer, pinball::get_rc_string(83, 0), rankText);
mission_text_box->Display(Buffer, 8.0);
soundwave10->Play(nullptr, "cheat_bump_rank");
soundwave10->Play();
}
}
@ -1055,7 +1055,7 @@ int control::AddRankProgress(int rank)
auto rankText = pinball::get_rc_string(RankRcArray[midActiveCount], 1);
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(83, 0), rankText);
mission_text_box->Display(Buffer, 8.0);
soundwave10->Play(nullptr, "AddRankProgress");
soundwave10->Play();
}
}
else if (activeCount >= 3 * totalCount / 4)
@ -1175,7 +1175,7 @@ void control::DeploymentChuteToEscapeChuteOneWayControl(int code, TPinballCompon
int count = skill_shot_lights->Message(37, 0.0);
if (count)
{
soundwave3->Play(nullptr, "DeploymentChuteToEscapeChuteOneWayControl");
soundwave3->Play();
int score = TableG->AddScore(caller->get_scoring(count - 1));
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(21, 0), score);
info_text_box->Display(Buffer, 2.0);
@ -1267,7 +1267,7 @@ void control::LaunchRampControl(int code, TPinballComponent* caller)
TableG->AddScore(caller->get_scoring(0));
sound = soundwave30;
}
sound->Play(lite198, "LaunchRampControl");
sound->Play();
}
}
@ -1404,7 +1404,7 @@ void control::OutLaneRolloverControl(int code, TPinballComponent* caller)
}
else
{
soundwave26->Play(caller, "OutLaneRolloverControl");
soundwave26->Play();
}
if (roll4 == caller)
{
@ -1483,12 +1483,12 @@ void control::BonusLaneRolloverControl(int code, TPinballComponent* caller)
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(3, 0), addedScore);
info_text_box->Display(Buffer, 2.0);
lite16->Message(20, 0.0);
soundwave50_1->Play(caller, "BonusLaneRolloverControl1");
soundwave50_1->Play();
}
else
{
TableG->AddScore(caller->get_scoring(0));
soundwave25->Play(caller, "BonusLaneRolloverControl2");
soundwave25->Play();
info_text_box->Display(pinball::get_rc_string(44, 0), 2.0);
}
fuel_bargraph->Message(45, 11.0);
@ -1756,7 +1756,7 @@ void control::BoosterTargetControl(int code, TPinballComponent* caller)
}
}
if (sound)
sound->Play(caller, "BoosterTargetControl");
sound->Play();
target1->MessageField = 0;
target1->Message(50, 0.0);
@ -1844,12 +1844,12 @@ void control::FuelSpotTargetControl(int code, TPinballComponent* caller)
{
top_circle_tgt_lights->Message(16, 2.0);
fuel_bargraph->Message(45, 11.0);
soundwave25->Play(caller, "FuelSpotTargetControl1");
soundwave25->Play();
info_text_box->Display(pinball::get_rc_string(44, 0), 2.0);
}
else
{
soundwave49D->Play(caller, "FuelSpotTargetControl2");
soundwave49D->Play();
}
}
}
@ -1883,7 +1883,7 @@ void control::MissionSpotTargetControl(int code, TPinballComponent* caller)
}
else
sound = soundwave49D;
sound->Play(caller, "MissionSpotTargetControl");
sound->Play();
TableG->AddScore(caller->get_scoring(0));
if (ramp_tgt_lights->Message(37, 0.0) == 3)
ramp_tgt_lights->Message(16, 2.0);
@ -1915,13 +1915,13 @@ void control::LeftHazardSpotTargetControl(int code, TPinballComponent* caller)
TableG->AddScore(caller->get_scoring(0));
if (lchute_tgt_lights->Message(37, 0.0) == 3)
{
soundwave14_1->Play(caller, "LeftHazardSpotTargetControl1");
soundwave14_1->Play();
gate1->Message(53, 0.0);
lchute_tgt_lights->Message(16, 2.0);
}
else
{
soundwave49D->Play(caller, "LeftHazardSpotTargetControl2");
soundwave49D->Play();
}
}
}
@ -1951,13 +1951,13 @@ void control::RightHazardSpotTargetControl(int code, TPinballComponent* caller)
TableG->AddScore(caller->get_scoring(0));
if (bpr_solotgt_lights->Message(37, 0.0) == 3)
{
soundwave14_1->Play(caller, "RightHazardSpotTargetControl1");
soundwave14_1->Play();
gate2->Message(53, 0.0);
bpr_solotgt_lights->Message(16, 2.0);
}
else
{
soundwave49D->Play(caller, "RightHazardSpotTargetControl2");
soundwave49D->Play();
}
}
}
@ -2015,7 +2015,7 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
info_text_box->Display(Buffer, 2.0);
lite62->Message(20, 0.0);
caller->ActiveFlag = 0;
auto duration = soundwave7->Play(lite62, "GravityWellKickoutControl");
auto duration = soundwave7->Play();
caller->Message(55, duration);
break;
}
@ -2054,7 +2054,7 @@ void control::SkillShotGate1Control(int code, TPinballComponent* caller)
lite54->Message(7, 5.0);
lite25->Message(7, 5.0);
fuel_bargraph->Message(45, 11.0);
soundwave14_2->Play(lite67, "SkillShotGate1Control");
soundwave14_2->Play();
}
}
}
@ -2066,7 +2066,7 @@ void control::SkillShotGate2Control(int code, TPinballComponent* caller)
if (light_on(&control_lite67_tag))
{
lite68->Message(19, 0.0);
soundwave14_2->Play(lite68, "SkillShotGate2Control");
soundwave14_2->Play();
}
}
}
@ -2078,7 +2078,7 @@ void control::SkillShotGate3Control(int code, TPinballComponent* caller)
if (light_on(&control_lite67_tag))
{
lite69->Message(19, 0.0);
soundwave14_2->Play(lite69, "SkillShotGate3Control");
soundwave14_2->Play();
}
}
}
@ -2090,7 +2090,7 @@ void control::SkillShotGate4Control(int code, TPinballComponent* caller)
if (light_on(&control_lite67_tag))
{
lite131->Message(19, 0.0);
soundwave14_2->Play(lite131, "SkillShotGate4Control");
soundwave14_2->Play();
}
}
}
@ -2102,7 +2102,7 @@ void control::SkillShotGate5Control(int code, TPinballComponent* caller)
if (light_on(&control_lite67_tag))
{
lite132->Message(19, 0.0);
soundwave14_2->Play(lite132, "SkillShotGate5Control");
soundwave14_2->Play();
}
}
}
@ -2114,7 +2114,7 @@ void control::SkillShotGate6Control(int code, TPinballComponent* caller)
if (light_on(&control_lite67_tag))
{
lite133->Message(19, 0.0);
soundwave14_2->Play(lite133, "SkillShotGate6Control");
soundwave14_2->Play();
}
}
}
@ -2384,9 +2384,9 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
{
if (someFlag < 1 || someFlag > 3)
{
auto duration = soundwave41->Play(lite24, "HyperspaceKickOutControl1");
soundwave36_1->Play(lite24, "HyperspaceKickOutControl2");
soundwave50_2->Play(lite24, "HyperspaceKickOutControl3");
auto duration = soundwave41->Play();
soundwave36_1->Play();
soundwave50_2->Play();
lite25->Message(7, 5.0);
caller->Message(55, duration);
return;
@ -2415,7 +2415,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
break;
}
}
auto duration = sound->Play(lite24, "HyperspaceKickOutControl4");
auto duration = sound->Play();
lite25->Message(7, 5.0);
caller->Message(55, duration);
}
@ -2550,7 +2550,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller)
TableG->Message(1022, 0.0);
if (pb::chk_highscore())
{
soundwave3->Play(nullptr, "BallDrainControl1");
soundwave3->Play();
TableG->LightGroup->Message(16, 3.0);
char* v11 = pinball::get_rc_string(177, 0);
mission_text_box->Display(v11, -1.0);
@ -2578,23 +2578,23 @@ void control::BallDrainControl(int code, TPinballComponent* caller)
}
if (light_on(&control_lite200_tag))
{
soundwave27->Play(nullptr, "BallDrainControl2");
soundwave27->Play();
lite200->Message(19, 0.0);
info_text_box->Display(pinball::get_rc_string(96, 0), -1.0);
soundwave59->Play(nullptr, "BallDrainControl3");
soundwave59->Play();
}
else if (light_on(&control_lite199_tag))
{
soundwave27->Play(nullptr, "BallDrainControl4");
soundwave27->Play();
lite199->Message(20, 0.0);
lite200->Message(19, 0.0);
info_text_box->Display(pinball::get_rc_string(95, 0), 2.0);
soundwave59->Play(nullptr, "BallDrainControl5");
soundwave59->Play();
--TableG->UnknownP78;
}
else if (TableG->UnknownP75)
{
soundwave27->Play(nullptr, "BallDrainControl6");
soundwave27->Play();
--TableG->UnknownP75;
}
else
@ -2610,7 +2610,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller)
TableG->ExtraBalls--;
char* shootAgainText;
soundwave59->Play(nullptr, "BallDrainControl7");
soundwave59->Play();
switch (TableG->CurrentPlayer)
{
case 0:
@ -2641,7 +2641,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller)
{
lite199->MessageField = 1;
}
soundwave27->Play(nullptr, "BallDrainControl8");
soundwave27->Play();
}
bmpr_inc_lights->Message(20, 0.0);
ramp_bmpr_inc_lights->Message(20, 0.0);
@ -2812,7 +2812,7 @@ void control::AlienMenacePartTwoController(int code, TPinballComponent* caller)
if (!AddRankProgress(7))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "AlienMenacePartTwoController");
soundwave9->Play();
}
}
}
@ -2844,7 +2844,7 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller)
if (!AddRankProgress(8))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "BlackHoleThreatController");
soundwave9->Play();
}
}
}
@ -2969,7 +2969,7 @@ void control::BugHuntController(int code, TPinballComponent* caller)
if (!AddRankProgress(7))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "BugHuntController");
soundwave9->Play();
}
}
}
@ -3044,7 +3044,7 @@ void control::CosmicPlaguePartTwoController(int code, TPinballComponent* caller)
if (!AddRankProgress(11))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "CosmicPlaguePartTwoController");
soundwave9->Play();
}
}
}
@ -3088,7 +3088,7 @@ void control::DoomsdayMachineController(int code, TPinballComponent* caller)
if (!AddRankProgress(9))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "DoomsdayMachineController");
soundwave9->Play();
}
}
}
@ -3229,7 +3229,7 @@ void control::LaunchTrainingController(int code, TPinballComponent* caller)
if (!AddRankProgress(6))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "LaunchTrainingController");
soundwave9->Play();
}
}
}
@ -3312,7 +3312,7 @@ void control::MaelstromPartEightController(int code, TPinballComponent* caller)
if (!AddRankProgress(18))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "MaelstromPartEightController");
soundwave9->Play();
}
}
}
@ -3573,7 +3573,7 @@ void control::PracticeMissionController(int code, TPinballComponent* caller)
if (!AddRankProgress(6))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "PracticeMissionController");
soundwave9->Play();
}
}
}
@ -3636,7 +3636,7 @@ void control::ReconnaissanceController(int code, TPinballComponent* caller)
if (!AddRankProgress(9))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "ReconnaissanceController");
soundwave9->Play();
}
}
}
@ -3687,7 +3687,7 @@ void control::ReentryTrainingController(int code, TPinballComponent* caller)
if (!AddRankProgress(6))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "ReentryTrainingController");
soundwave9->Play();
}
}
}
@ -3728,7 +3728,7 @@ void control::RescueMissionController(int code, TPinballComponent* caller)
if (!AddRankProgress(7))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "RescueMissionController");
soundwave9->Play();
}
break;
}
@ -3801,7 +3801,7 @@ void control::SatelliteController(int code, TPinballComponent* caller)
if (!AddRankProgress(9))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "SatelliteController");
soundwave9->Play();
}
}
}
@ -3874,7 +3874,7 @@ void control::ScienceMissionController(int code, TPinballComponent* caller)
if (!AddRankProgress(9))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "ScienceMissionController");
soundwave9->Play();
}
}
}
@ -3911,7 +3911,7 @@ void control::SecretMissionGreenController(int code, TPinballComponent* caller)
if (!AddRankProgress(10))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "SecretMissionGreenController");
soundwave9->Play();
}
}
}
@ -4219,7 +4219,7 @@ void control::SpaceRadiationController(int code, TPinballComponent* caller)
if (!AddRankProgress(8))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "SpaceRadiationController");
soundwave9->Play();
}
}
}
@ -4272,7 +4272,7 @@ void control::StrayCometController(int code, TPinballComponent* caller)
if (!AddRankProgress(8))
{
mission_text_box->Display(Buffer, 8.0);
soundwave9->Play(nullptr, "StrayCometController");
soundwave9->Play();
}
}
}
@ -4381,7 +4381,7 @@ void control::TimeWarpPartTwoController(int code, TPinballComponent* caller)
if (!AddRankProgress(12))
{
mission_text_box->Display(Buffer, 8.0);
soundwave10->Play(nullptr, "TimeWarpPartTwoController");
soundwave10->Play();
}
}
SpecialAddScore(2000000);

View file

@ -1,7 +1,6 @@
#include "pch.h"
#include "loader.h"
#include "GroupData.h"
#include "TPinballComponent.h"
#include "pb.h"
#include "pinball.h"
#include "Sound.h"
@ -327,11 +326,12 @@ int loader::material(int groupIndex, visualStruct* visual)
return 0;
}
float loader::play_sound(int soundIndex, TPinballComponent *soundSource, const char *info)
float loader::play_sound(int soundIndex)
{
if (soundIndex <= 0)
return 0.0;
Sound::PlaySound(sound_list[soundIndex].WavePtr, pb::time_ticks, soundSource, info);
Sound::PlaySound(sound_list[soundIndex].WavePtr, pb::time_ticks);
return sound_list[soundIndex].Duration;
}

View file

@ -2,7 +2,6 @@
#include "gdrv.h"
#include "maths.h"
#include "zdrv.h"
#include "TPinballComponent.h"
class DatFile;
@ -100,7 +99,7 @@ public:
static float* query_float_attribute(int groupIndex, int groupIndexOffset, int firstValue);
static float query_float_attribute(int groupIndex, int groupIndexOffset, int firstValue, float defVal);
static int16_t* query_iattribute(int groupIndex, int firstValue, int* arraySize);
static float play_sound(int soundIndex, TPinballComponent *soundSource, const char* info);
static float play_sound(int soundIndex);
static DatFile* loader_table;
private:
static errorMsg loader_errors[];

View file

@ -102,7 +102,6 @@ void options::InitPrimary()
Options.HybridSleep = get_int("HybridSleep", false);
Options.Prefer3DPBGameData = get_int("Prefer 3DPB Game Data", false);
Options.IntegerScaling = get_int("Integer Scaling", false);
Options.SoundStereo = get_int("Stereo Sound Effects", false);
Options.SoundVolume = Clamp(get_int("Sound Volume", DefVolume), MinVolume, MaxVolume);
Options.MusicVolume = Clamp(get_int("Music Volume", DefVolume), MinVolume, MaxVolume);
Options.DebugOverlay = get_int("Debug Overlay", false);
@ -148,7 +147,6 @@ void options::uninit()
set_int("HybridSleep", Options.HybridSleep);
set_int("Prefer 3DPB Game Data", Options.Prefer3DPBGameData);
set_int("Integer Scaling", Options.IntegerScaling);
set_int("Stereo Sound Effects", Options.SoundStereo);
set_int("Sound Volume", Options.SoundVolume);
set_int("Music Volume", Options.MusicVolume);
set_int("Debug Overlay", Options.DebugOverlay);
@ -223,9 +221,6 @@ void options::toggle(Menu1 uIDCheckItem)
Options.Sounds ^= true;
Sound::Enable(Options.Sounds);
return;
case Menu1::SoundStereo:
Options.SoundStereo ^= true;
return;
case Menu1::Music:
Options.Music ^= true;
if (!Options.Music)

View file

@ -8,7 +8,6 @@ enum class Menu1:int
Exit = 105,
Sounds = 201,
Music = 202,
SoundStereo = 203,
Help_Topics = 301,
Launch_Ball = 401,
Pause_Resume_Game = 402,
@ -81,7 +80,6 @@ struct optionsStruct
bool IntegerScaling;
int SoundVolume;
int MusicVolume;
bool SoundStereo;
bool DebugOverlay;
bool DebugOverlayGrid;
bool DebugOverlayAllEdges;

View file

@ -454,10 +454,6 @@ void winmain::RenderUi()
{
options::toggle(Menu1::Sounds);
}
if (ImGui::MenuItem("Stereo Sound Effects", nullptr, Options.SoundStereo))
{
options::toggle(Menu1::SoundStereo);
}
ImGui::TextUnformatted("Sound Volume");
if (ImGui::SliderInt("##Sound Volume", &Options.SoundVolume, options::MinVolume, options::MaxVolume, "%d",
ImGuiSliderFlags_AlwaysClamp))