mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
Cleaned up positional sound.
This commit is contained in:
parent
a4c6165094
commit
5d7d7c0822
@ -1,6 +1,7 @@
|
|||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
|
#include "maths.h"
|
||||||
|
|
||||||
int Sound::num_channels;
|
int Sound::num_channels;
|
||||||
bool Sound::enabled_flag = false;
|
bool Sound::enabled_flag = false;
|
||||||
|
@ -13,7 +13,7 @@ public :
|
|||||||
void not_again(TEdgeSegment* edge);
|
void not_again(TEdgeSegment* edge);
|
||||||
bool already_hit(TEdgeSegment* edge);
|
bool already_hit(TEdgeSegment* edge);
|
||||||
int Message(int code, float value) override;
|
int Message(int code, float value) override;
|
||||||
vector2 get_coordinates();
|
vector2 get_coordinates() override;
|
||||||
|
|
||||||
static void throw_ball(TBall* ball, vector3* direction, float angleMult, float speedMult1,
|
static void throw_ball(TBall* ball, vector3* direction, float angleMult, float speedMult1,
|
||||||
float speedMult2);
|
float speedMult2);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "maths.h"
|
#include "maths.h"
|
||||||
#include "TEdgeSegment.h"
|
#include "TEdgeSegment.h"
|
||||||
#include "TPinballTable.h"
|
#include "TPinballTable.h"
|
||||||
|
#include "TBall.h"
|
||||||
|
|
||||||
|
|
||||||
TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, bool createWall) :
|
TCollisionComponent::TCollisionComponent(TPinballTable* table, int groupIndex, bool createWall) :
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "TPinballComponent.h"
|
#include "TPinballComponent.h"
|
||||||
#include "TBall.h"
|
|
||||||
|
|
||||||
struct vector2;
|
struct vector2;
|
||||||
class TEdgeSegment;
|
class TEdgeSegment;
|
||||||
|
class TBall;
|
||||||
|
|
||||||
class TCollisionComponent : public TPinballComponent
|
class TCollisionComponent : public TPinballComponent
|
||||||
{
|
{
|
||||||
|
@ -17,8 +17,8 @@ TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool
|
|||||||
ListZMap = nullptr;
|
ListZMap = nullptr;
|
||||||
GroupName = nullptr;
|
GroupName = nullptr;
|
||||||
Control = nullptr;
|
Control = nullptr;
|
||||||
Coordinates.X = -1.0f;
|
VisualPosNormX= -1.0f;
|
||||||
Coordinates.Y = -1.0f;
|
VisualPosNormY = -1.0f;
|
||||||
if (table)
|
if (table)
|
||||||
table->ComponentList.push_back(this);
|
table->ComponentList.push_back(this);
|
||||||
if (groupIndex >= 0)
|
if (groupIndex >= 0)
|
||||||
@ -71,8 +71,10 @@ TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool
|
|||||||
rootBmp->XPosition - table->XOffset,
|
rootBmp->XPosition - table->XOffset,
|
||||||
rootBmp->YPosition - table->YOffset,
|
rootBmp->YPosition - table->YOffset,
|
||||||
&bmp1Rect);
|
&bmp1Rect);
|
||||||
Coordinates.X = (bmp1Rect.XPosition + (bmp1Rect.Width / 2.0f)) / PinballTable->Width;
|
|
||||||
Coordinates.Y = (bmp1Rect.YPosition + (bmp1Rect.Height / 2.0f)) / PinballTable->Height;
|
auto& rect = RenderSprite->BmpRect;
|
||||||
|
VisualPosNormX = (rect.XPosition + (rect.Width / 2.0f)) / PinballTable->Width;
|
||||||
|
VisualPosNormY = (rect.YPosition + (rect.Height / 2.0f)) / PinballTable->Height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GroupIndex = groupIndex;
|
GroupIndex = groupIndex;
|
||||||
@ -118,5 +120,5 @@ int TPinballComponent::get_scoring(int index)
|
|||||||
|
|
||||||
vector2 TPinballComponent::get_coordinates()
|
vector2 TPinballComponent::get_coordinates()
|
||||||
{
|
{
|
||||||
return this->Coordinates;
|
return {VisualPosNormX, VisualPosNormY};
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "maths.h"
|
|
||||||
|
|
||||||
struct zmap_header_type;
|
struct zmap_header_type;
|
||||||
struct gdrv_bitmap8;
|
struct gdrv_bitmap8;
|
||||||
struct render_sprite_type_struct;
|
struct render_sprite_type_struct;
|
||||||
struct component_control;
|
struct component_control;
|
||||||
|
struct vector2;
|
||||||
class TPinballTable;
|
class TPinballTable;
|
||||||
|
|
||||||
enum class message_code
|
enum class message_code
|
||||||
@ -36,5 +36,7 @@ public:
|
|||||||
TPinballTable* PinballTable;
|
TPinballTable* PinballTable;
|
||||||
std::vector<gdrv_bitmap8*>* ListBitmap;
|
std::vector<gdrv_bitmap8*>* ListBitmap;
|
||||||
std::vector<zmap_header_type*>* ListZMap;
|
std::vector<zmap_header_type*>* ListZMap;
|
||||||
vector2 Coordinates;
|
private:
|
||||||
|
float VisualPosNormX;
|
||||||
|
float VisualPosNormY;
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,6 @@ class TSound :
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TSound(TPinballTable* table, int groupIndex);
|
TSound(TPinballTable* table, int groupIndex);
|
||||||
float Play();
|
|
||||||
float Play(TPinballComponent *soundSource, const char* info);
|
float Play(TPinballComponent *soundSource, const char* info);
|
||||||
|
|
||||||
int SoundIndex;
|
int SoundIndex;
|
||||||
|
@ -102,7 +102,7 @@ void options::InitPrimary()
|
|||||||
Options.HybridSleep = get_int("HybridSleep", false);
|
Options.HybridSleep = get_int("HybridSleep", false);
|
||||||
Options.Prefer3DPBGameData = get_int("Prefer 3DPB Game Data", false);
|
Options.Prefer3DPBGameData = get_int("Prefer 3DPB Game Data", false);
|
||||||
Options.IntegerScaling = get_int("Integer Scaling", false);
|
Options.IntegerScaling = get_int("Integer Scaling", false);
|
||||||
Options.SoundStereo = get_int("Stereo Sound Effects", true);
|
Options.SoundStereo = get_int("Stereo Sound Effects", false);
|
||||||
Options.SoundVolume = Clamp(get_int("Sound Volume", DefVolume), MinVolume, MaxVolume);
|
Options.SoundVolume = Clamp(get_int("Sound Volume", DefVolume), MinVolume, MaxVolume);
|
||||||
Options.MusicVolume = Clamp(get_int("Music Volume", DefVolume), MinVolume, MaxVolume);
|
Options.MusicVolume = Clamp(get_int("Music Volume", DefVolume), MinVolume, MaxVolume);
|
||||||
Options.DebugOverlay = get_int("Debug Overlay", false);
|
Options.DebugOverlay = get_int("Debug Overlay", false);
|
||||||
|
Loading…
Reference in New Issue
Block a user