mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
Replaced GlobalAlloc with malloc.
WaveMix keeps GlobalAlloc for authenticity. Fixed float to double casts. Some cleanup.
This commit is contained in:
parent
55984fbb08
commit
98f234fce3
@ -49,7 +49,7 @@ int Sound::Init(HINSTANCE hInstance, int voices, void (* someFuncPtr)(int, MIXWA
|
|||||||
{
|
{
|
||||||
/*FT does not have the file, defaults work OK*/
|
/*FT does not have the file, defaults work OK*/
|
||||||
if (!pb::FullTiltMode)
|
if (!pb::FullTiltMode)
|
||||||
MessageBoxA(winmain::hwnd_frame, pinball::get_rc_string(42, 0), pinball::WindowName, 0x2000u);
|
MessageBoxA(winmain::hwnd_frame, pinball::get_rc_string(42, 0), "", 0x2000u);
|
||||||
}
|
}
|
||||||
|
|
||||||
WndClass.style = 0;
|
WndClass.style = 0;
|
||||||
|
@ -16,18 +16,18 @@
|
|||||||
#include "winmain.h"
|
#include "winmain.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
// Testing with UI
|
// Testing with UI
|
||||||
char cmdLine[1]{};
|
char cmdLine[1]{};
|
||||||
WinMain(GetModuleHandleA(nullptr), 0, cmdLine, 10);
|
WinMain(GetModuleHandleA(nullptr), nullptr, cmdLine, 10);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Hello World!\n";
|
std::cout << "Hello World!\n";
|
||||||
gdrv::init(0, 0);
|
gdrv::init(nullptr, nullptr);
|
||||||
auto dib = gdrv::DibCreate(8, 1, 1);
|
auto dib = gdrv::DibCreate(8, 1, 1);
|
||||||
gdrv::DibSetUsage(dib, 0, 1);
|
gdrv::DibSetUsage(dib, nullptr, 1);
|
||||||
|
|
||||||
auto d = objlist_class<void>(2, 4);
|
auto d = objlist_class<void>(2, 4);
|
||||||
for (size_t i = 0; i < 100; i++)
|
for (size_t i = 0; i < 100; i++)
|
||||||
|
@ -57,7 +57,7 @@ int TBlocker::Message(int code, float value)
|
|||||||
timer::kill(Timer);
|
timer::kill(Timer);
|
||||||
|
|
||||||
float timerTime;
|
float timerTime;
|
||||||
if (value <= 0.0)
|
if (value <= 0.0f)
|
||||||
timerTime = 0.0;
|
timerTime = 0.0;
|
||||||
else
|
else
|
||||||
timerTime = value;
|
timerTime = value;
|
||||||
|
@ -70,7 +70,7 @@ int TCollisionComponent::DefaultCollision(TBall* ball, vector_type* nextPosition
|
|||||||
auto projSpeed = maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, Threshold, Boost);
|
auto projSpeed = maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, Threshold, Boost);
|
||||||
if (projSpeed <= Threshold)
|
if (projSpeed <= Threshold)
|
||||||
{
|
{
|
||||||
if (projSpeed > 0.2)
|
if (projSpeed > 0.2f)
|
||||||
{
|
{
|
||||||
if (SoftHitSoundId)
|
if (SoftHitSoundId)
|
||||||
loader::play_sound(SoftHitSoundId);
|
loader::play_sound(SoftHitSoundId);
|
||||||
@ -92,7 +92,7 @@ void TCollisionComponent::Collision(TBall* ball, vector_type* nextPosition, vect
|
|||||||
maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, 1000000000.0, 0.0);
|
maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, 1000000000.0, 0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
double projSpeed = maths::basic_collision(
|
auto projSpeed = maths::basic_collision(
|
||||||
ball,
|
ball,
|
||||||
nextPosition,
|
nextPosition,
|
||||||
direction,
|
direction,
|
||||||
@ -102,7 +102,7 @@ void TCollisionComponent::Collision(TBall* ball, vector_type* nextPosition, vect
|
|||||||
Boost);
|
Boost);
|
||||||
if (projSpeed <= Threshold)
|
if (projSpeed <= Threshold)
|
||||||
{
|
{
|
||||||
if (projSpeed <= 0.2)
|
if (projSpeed <= 0.2f)
|
||||||
return;
|
return;
|
||||||
soundIndex = SoftHitSoundId;
|
soundIndex = SoftHitSoundId;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ int TComponentGroup::Message(int code, float value)
|
|||||||
timer::kill(this->Timer);
|
timer::kill(this->Timer);
|
||||||
this->Timer = 0;
|
this->Timer = 0;
|
||||||
}
|
}
|
||||||
if (value > 0.0)
|
if (value > 0.0f)
|
||||||
this->Timer = timer::set(value, this, NotifyTimerExpired);
|
this->Timer = timer::set(value, this, NotifyTimerExpired);
|
||||||
}
|
}
|
||||||
else if (code <= 1007 || code > 1011 && code != 1020 && code != 1022)
|
else if (code <= 1007 || code > 1011 && code != 1020 && code != 1022)
|
||||||
|
@ -87,15 +87,15 @@ TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* c
|
|||||||
|
|
||||||
center.X = centerX1;
|
center.X = centerX1;
|
||||||
center.Y = centerY1;
|
center.Y = centerY1;
|
||||||
if (offset != 0.0)
|
if (offset != 0.0f)
|
||||||
{
|
{
|
||||||
vec1.X = centerX1 - prevCenter.X;
|
vec1.X = centerX1 - prevCenter.X;
|
||||||
vec1.Y = center.Y - prevCenter.Y;
|
vec1.Y = center.Y - prevCenter.Y;
|
||||||
vec2.X = centerX2 - centerX1;
|
vec2.X = centerX2 - centerX1;
|
||||||
vec2.Y = centerY2 - center.Y;
|
vec2.Y = centerY2 - center.Y;
|
||||||
maths::cross(&vec1, &vec2, &dstVec);
|
maths::cross(&vec1, &vec2, &dstVec);
|
||||||
if (dstVec.Z > 0.0 && offset > 0.0 ||
|
if (dstVec.Z > 0.0f && offset > 0.0f ||
|
||||||
dstVec.Z < 0.0 && offset < 0.0)
|
dstVec.Z < 0.0f && offset < 0.0f)
|
||||||
{
|
{
|
||||||
float radius = offset * 1.001f;
|
float radius = offset * 1.001f;
|
||||||
auto circle = new TCircle(collComp, activeFlagPtr, collisionGroup, ¢er, radius);
|
auto circle = new TCircle(collComp, activeFlagPtr, collisionGroup, ¢er, radius);
|
||||||
|
@ -82,7 +82,7 @@ void TFlagSpinner::Collision(TBall* ball, vector_type* nextPosition, vector_type
|
|||||||
ball->not_again(edge);
|
ball->not_again(edge);
|
||||||
|
|
||||||
SpinDirection = 2 * (PrevCollider != edge) - 1;
|
SpinDirection = 2 * (PrevCollider != edge) - 1;
|
||||||
if (ball->Speed == 0.0)
|
if (ball->Speed == 0.0f)
|
||||||
Speed = MinSpeed;
|
Speed = MinSpeed;
|
||||||
else
|
else
|
||||||
Speed = ball->Speed * 20.0f;
|
Speed = ball->Speed * 20.0f;
|
||||||
|
@ -97,7 +97,7 @@ int TFlipper::Message(int code, float value)
|
|||||||
{
|
{
|
||||||
auto v10 = value - FlipperEdge->InputTime;
|
auto v10 = value - FlipperEdge->InputTime;
|
||||||
timerTime = v10 - floor(v10 / TimerTime) * TimerTime;
|
timerTime = v10 - floor(v10 / TimerTime) * TimerTime;
|
||||||
if (timerTime < 0.0)
|
if (timerTime < 0.0f)
|
||||||
timerTime = 0.0;
|
timerTime = 0.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -48,7 +48,7 @@ TFlipperEdge::TFlipperEdge(TCollisionComponent* collComp, char* activeFlag, unsi
|
|||||||
|
|
||||||
AngleMax = acos(maths::DotProduct(&vecDir1, &vecDir2));
|
AngleMax = acos(maths::DotProduct(&vecDir1, &vecDir2));
|
||||||
maths::cross(&vecDir1, &vecDir2, &crossProd);
|
maths::cross(&vecDir1, &vecDir2, &crossProd);
|
||||||
if (crossProd.Z < 0.0)
|
if (crossProd.Z < 0.0f)
|
||||||
AngleMax = -AngleMax;
|
AngleMax = -AngleMax;
|
||||||
FlipperFlag = 0;
|
FlipperFlag = 0;
|
||||||
Angle1 = 0.0;
|
Angle1 = 0.0;
|
||||||
@ -67,7 +67,7 @@ TFlipperEdge::TFlipperEdge(TCollisionComponent* collComp, char* activeFlag, unsi
|
|||||||
B2Src.X = dirY1 * CircleT1Radius + vecT1->X;
|
B2Src.X = dirY1 * CircleT1Radius + vecT1->X;
|
||||||
B2Src.Y = dirX1 * CircleT1Radius + vecT1->Y;
|
B2Src.Y = dirX1 * CircleT1Radius + vecT1->Y;
|
||||||
|
|
||||||
if (AngleMax < 0.0)
|
if (AngleMax < 0.0f)
|
||||||
{
|
{
|
||||||
maths::vswap(&A1Src, &B1Src);
|
maths::vswap(&A1Src, &B1Src);
|
||||||
maths::vswap(&A2Src, &B2Src);
|
maths::vswap(&A2Src, &B2Src);
|
||||||
@ -122,7 +122,7 @@ float TFlipperEdge::FindCollisionDistance(ray_type* ray)
|
|||||||
srcRay.MaxDistance = ogRay->MaxDistance;
|
srcRay.MaxDistance = ogRay->MaxDistance;
|
||||||
srcRay.Origin = ogRay->Origin;
|
srcRay.Origin = ogRay->Origin;
|
||||||
auto distance = maths::distance_to_flipper(&srcRay, &dstRay);
|
auto distance = maths::distance_to_flipper(&srcRay, &dstRay);
|
||||||
if (distance == 0.0)
|
if (distance == 0.0f)
|
||||||
{
|
{
|
||||||
NextBallPosition = dstRay.Origin;
|
NextBallPosition = dstRay.Origin;
|
||||||
NextBallPosition.X -= srcRay.Direction.X * 1e-05f;
|
NextBallPosition.X -= srcRay.Direction.X * 1e-05f;
|
||||||
@ -167,14 +167,14 @@ float TFlipperEdge::FindCollisionDistance(ray_type* ray)
|
|||||||
srcRay.Origin.X = ogRay->Origin.X - srcRay.Direction.X * 5.0f;
|
srcRay.Origin.X = ogRay->Origin.X - srcRay.Direction.X * 5.0f;
|
||||||
srcRay.Origin.Y = ogRay->Origin.Y - srcRay.Direction.Y * 5.0f;
|
srcRay.Origin.Y = ogRay->Origin.Y - srcRay.Direction.Y * 5.0f;
|
||||||
srcRay.MaxDistance = ogRay->MaxDistance + 10.0f;
|
srcRay.MaxDistance = ogRay->MaxDistance + 10.0f;
|
||||||
if (maths::distance_to_flipper(&srcRay, &dstRay) >= 1e+09)
|
if (maths::distance_to_flipper(&srcRay, &dstRay) >= 1e+09f)
|
||||||
{
|
{
|
||||||
srcRay.Direction.X = RotOrigin.X - ogRay->Origin.X;
|
srcRay.Direction.X = RotOrigin.X - ogRay->Origin.X;
|
||||||
srcRay.Direction.Y = RotOrigin.Y - ogRay->Origin.Y;
|
srcRay.Direction.Y = RotOrigin.Y - ogRay->Origin.Y;
|
||||||
maths::normalize_2d(&srcRay.Direction);
|
maths::normalize_2d(&srcRay.Direction);
|
||||||
srcRay.Origin.X = ogRay->Origin.X - srcRay.Direction.X * 5.0f;
|
srcRay.Origin.X = ogRay->Origin.X - srcRay.Direction.X * 5.0f;
|
||||||
srcRay.Origin.Y = ogRay->Origin.Y - srcRay.Direction.Y * 5.0f;
|
srcRay.Origin.Y = ogRay->Origin.Y - srcRay.Direction.Y * 5.0f;
|
||||||
if (maths::distance_to_flipper(&srcRay, &dstRay) >= 1e+09)
|
if (maths::distance_to_flipper(&srcRay, &dstRay) >= 1e+09f)
|
||||||
{
|
{
|
||||||
return 1e+09;
|
return 1e+09;
|
||||||
}
|
}
|
||||||
@ -221,7 +221,7 @@ float TFlipperEdge::FindCollisionDistance(ray_type* ray)
|
|||||||
srcRay.Origin.X = posX - srcRay.Direction.X * 5.0f;
|
srcRay.Origin.X = posX - srcRay.Direction.X * 5.0f;
|
||||||
srcRay.Origin.Y = posY - srcRay.Direction.Y * 5.0f;
|
srcRay.Origin.Y = posY - srcRay.Direction.Y * 5.0f;
|
||||||
srcRay.MaxDistance = ogRay->MaxDistance + 10.0f;
|
srcRay.MaxDistance = ogRay->MaxDistance + 10.0f;
|
||||||
if (maths::distance_to_flipper(&srcRay, &dstRay) >= 1e+09)
|
if (maths::distance_to_flipper(&srcRay, &dstRay) >= 1e+09f)
|
||||||
{
|
{
|
||||||
NextBallPosition.X = posX;
|
NextBallPosition.X = posX;
|
||||||
NextBallPosition.Y = posY;
|
NextBallPosition.Y = posY;
|
||||||
@ -252,7 +252,7 @@ float TFlipperEdge::FindCollisionDistance(ray_type* ray)
|
|||||||
srcRay.MaxDistance = ogRay->MaxDistance + 10.0f;
|
srcRay.MaxDistance = ogRay->MaxDistance + 10.0f;
|
||||||
auto distance = maths::distance_to_flipper(&srcRay, &dstRay);
|
auto distance = maths::distance_to_flipper(&srcRay, &dstRay);
|
||||||
CollisionDirection = dstRay.Direction;
|
CollisionDirection = dstRay.Direction;
|
||||||
if (distance >= 1e+09)
|
if (distance >= 1e+09f)
|
||||||
{
|
{
|
||||||
return 1e+09;
|
return 1e+09;
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ float TFlipperEdge::FindCollisionDistance(ray_type* ray)
|
|||||||
srcRay.Origin = ogRay->Origin;
|
srcRay.Origin = ogRay->Origin;
|
||||||
srcRay.MaxDistance = rayMaxDistance;
|
srcRay.MaxDistance = rayMaxDistance;
|
||||||
auto distance = maths::distance_to_flipper(&srcRay, &dstRay);
|
auto distance = maths::distance_to_flipper(&srcRay, &dstRay);
|
||||||
if (distance < 1e+09)
|
if (distance < 1e+09f)
|
||||||
{
|
{
|
||||||
NextBallPosition = dstRay.Origin;
|
NextBallPosition = dstRay.Origin;
|
||||||
NextBallPosition.X -= srcRay.Direction.X * 1e-05f;
|
NextBallPosition.X -= srcRay.Direction.X * 1e-05f;
|
||||||
@ -276,11 +276,11 @@ float TFlipperEdge::FindCollisionDistance(ray_type* ray)
|
|||||||
if (FlipperFlag == 2)
|
if (FlipperFlag == 2)
|
||||||
{
|
{
|
||||||
linePtr = &lineB.PerpendicularL;
|
linePtr = &lineB.PerpendicularL;
|
||||||
CollisionFlag1 = AngleMax <= 0.0;
|
CollisionFlag1 = AngleMax <= 0.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CollisionFlag1 = AngleMax > 0.0;
|
CollisionFlag1 = AngleMax > 0.0f;
|
||||||
linePtr = &lineA.PerpendicularL;
|
linePtr = &lineA.PerpendicularL;
|
||||||
}
|
}
|
||||||
CollisionLinePerp = *linePtr;
|
CollisionLinePerp = *linePtr;
|
||||||
@ -310,12 +310,12 @@ void TFlipperEdge::EdgeCollision(TBall* ball, float coef)
|
|||||||
float dx = NextBallPosition.X - RotOrigin.X;
|
float dx = NextBallPosition.X - RotOrigin.X;
|
||||||
float dy = NextBallPosition.Y - RotOrigin.Y;
|
float dy = NextBallPosition.Y - RotOrigin.Y;
|
||||||
float distance = dy * dy + dx * dx;
|
float distance = dy * dy + dx * dx;
|
||||||
if (circlebase.RadiusSq * 1.01 < distance)
|
if (circlebase.RadiusSq * 1.01f < distance)
|
||||||
{
|
{
|
||||||
float v11;
|
float v11;
|
||||||
float v20 = sqrt(distance / DistanceDivSq) * (fabs(AngleMax) / AngleMult);
|
float v20 = sqrt(distance / DistanceDivSq) * (fabs(AngleMax) / AngleMult);
|
||||||
float dot1 = maths::DotProduct(&CollisionLinePerp, &CollisionDirection);
|
float dot1 = maths::DotProduct(&CollisionLinePerp, &CollisionDirection);
|
||||||
if (dot1 >= 0.0)
|
if (dot1 >= 0.0f)
|
||||||
v11 = dot1 * v20;
|
v11 = dot1 * v20;
|
||||||
else
|
else
|
||||||
v11 = 0.0;
|
v11 = 0.0;
|
||||||
@ -323,7 +323,7 @@ void TFlipperEdge::EdgeCollision(TBall* ball, float coef)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float threshold = boost <= 0.0 ? 1000000000.0f : -1.0f;
|
float threshold = boost <= 0.0f ? 1000000000.0f : -1.0f;
|
||||||
maths::basic_collision(
|
maths::basic_collision(
|
||||||
ball,
|
ball,
|
||||||
&NextBallPosition,
|
&NextBallPosition,
|
||||||
@ -339,7 +339,7 @@ void TFlipperEdge::EdgeCollision(TBall* ball, float coef)
|
|||||||
float dx = NextBallPosition.X - RotOrigin.X;
|
float dx = NextBallPosition.X - RotOrigin.X;
|
||||||
float dy = NextBallPosition.Y - RotOrigin.Y;
|
float dy = NextBallPosition.Y - RotOrigin.Y;
|
||||||
float distance = dy * dy + dx * dx;
|
float distance = dy * dy + dx * dx;
|
||||||
if (circlebase.RadiusSq * 1.01 < distance)
|
if (circlebase.RadiusSq * 1.01f < distance)
|
||||||
elasticity = (1.0f - sqrt(distance / DistanceDivSq)) * Elasticity;
|
elasticity = (1.0f - sqrt(distance / DistanceDivSq)) * Elasticity;
|
||||||
else
|
else
|
||||||
elasticity = Elasticity;
|
elasticity = Elasticity;
|
||||||
@ -420,10 +420,10 @@ float TFlipperEdge::flipper_angle(float timeNow)
|
|||||||
if (!FlipperFlag)
|
if (!FlipperFlag)
|
||||||
return Angle1;
|
return Angle1;
|
||||||
float angle = (Angle1 - Angle2) / AngleMax * AngleMult;
|
float angle = (Angle1 - Angle2) / AngleMax * AngleMult;
|
||||||
if (angle < 0.0)
|
if (angle < 0.0f)
|
||||||
angle = -angle;
|
angle = -angle;
|
||||||
|
|
||||||
if (angle >= 0.0000001)
|
if (angle >= 0.0000001f)
|
||||||
angle = (timeNow - InputTime) / angle;
|
angle = (timeNow - InputTime) / angle;
|
||||||
else
|
else
|
||||||
angle = 1.0;
|
angle = 1.0;
|
||||||
@ -446,11 +446,11 @@ int TFlipperEdge::is_ball_inside(float x, float y)
|
|||||||
dy * dy + dx * dx <= CirclebaseRadiusSq ||
|
dy * dy + dx * dx <= CirclebaseRadiusSq ||
|
||||||
(T1.Y - y) * (T1.Y - y) + (T1.X - x) * (T1.X - x) < CircleT1RadiusSq)
|
(T1.Y - y) * (T1.Y - y) + (T1.X - x) * (T1.X - x) < CircleT1RadiusSq)
|
||||||
{
|
{
|
||||||
float flipperLR = AngleMax < 0.0 ? -1.0f : 1.0f;
|
float flipperLR = AngleMax < 0.0f ? -1.0f : 1.0f;
|
||||||
if (FlipperFlag == 1)
|
if (FlipperFlag == 1)
|
||||||
testPoint = AngleMax < 0.0 ? B1 : B2;
|
testPoint = AngleMax < 0.0f ? B1 : B2;
|
||||||
else if (FlipperFlag == 2)
|
else if (FlipperFlag == 2)
|
||||||
testPoint = AngleMax < 0.0 ? A2 : A1;
|
testPoint = AngleMax < 0.0f ? A2 : A1;
|
||||||
else
|
else
|
||||||
testPoint = T1;
|
testPoint = T1;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ THole::THole(TPinballTable* table, int groupIndex) : TCollisionComponent(table,
|
|||||||
Circle.Center.X = visual.FloatArr[0];
|
Circle.Center.X = visual.FloatArr[0];
|
||||||
Circle.Center.Y = visual.FloatArr[1];
|
Circle.Center.Y = visual.FloatArr[1];
|
||||||
Circle.RadiusSq = *loader::query_float_attribute(groupIndex, 0, 306) * visual.FloatArr[2];
|
Circle.RadiusSq = *loader::query_float_attribute(groupIndex, 0, 306) * visual.FloatArr[2];
|
||||||
if (Circle.RadiusSq == 0.0)
|
if (Circle.RadiusSq == 0.0f)
|
||||||
Circle.RadiusSq = 0.001f;
|
Circle.RadiusSq = 0.001f;
|
||||||
|
|
||||||
auto tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
auto tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
||||||
|
@ -33,7 +33,7 @@ TKickout::TKickout(TPinballTable* table, int groupIndex, bool someFlag): TCollis
|
|||||||
Circle.Center.X = visual.FloatArr[0];
|
Circle.Center.X = visual.FloatArr[0];
|
||||||
Circle.Center.Y = visual.FloatArr[1];
|
Circle.Center.Y = visual.FloatArr[1];
|
||||||
Circle.RadiusSq = *loader::query_float_attribute(groupIndex, 0, 306) * visual.FloatArr[2];
|
Circle.RadiusSq = *loader::query_float_attribute(groupIndex, 0, 306) * visual.FloatArr[2];
|
||||||
if (Circle.RadiusSq == 0.0)
|
if (Circle.RadiusSq == 0.0f)
|
||||||
Circle.RadiusSq = 0.001f;
|
Circle.RadiusSq = 0.001f;
|
||||||
auto tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
auto tCircle = new TCircle(this, &ActiveFlag, visual.CollisionGroup,
|
||||||
reinterpret_cast<vector_type*>(visual.FloatArr), Circle.RadiusSq);
|
reinterpret_cast<vector_type*>(visual.FloatArr), Circle.RadiusSq);
|
||||||
@ -67,7 +67,7 @@ int TKickout::Message(int code, float value)
|
|||||||
case 55:
|
case 55:
|
||||||
if (KickFlag1)
|
if (KickFlag1)
|
||||||
{
|
{
|
||||||
if (value < 0.0)
|
if (value < 0.0f)
|
||||||
value = TimerTime1;
|
value = TimerTime1;
|
||||||
Timer = timer::set(value, this, TimerExpired);
|
Timer = timer::set(value, this, TimerExpired);
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ void TLight::schedule_timeout(float time)
|
|||||||
if (Timer1)
|
if (Timer1)
|
||||||
timer::kill(Timer1);
|
timer::kill(Timer1);
|
||||||
Timer1 = 0;
|
Timer1 = 0;
|
||||||
if (time > 0.0)
|
if (time > 0.0f)
|
||||||
Timer1 = timer::set(time, this, TimerExpired);
|
Timer1 = timer::set(time, this, TimerExpired);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ int TLightGroup::Message(int code, float value)
|
|||||||
if (NotifyTimer)
|
if (NotifyTimer)
|
||||||
timer::kill(NotifyTimer);
|
timer::kill(NotifyTimer);
|
||||||
NotifyTimer = 0;
|
NotifyTimer = 0;
|
||||||
if (value > 0.0)
|
if (value > 0.0f)
|
||||||
NotifyTimer = timer::set(value, this, NotifyTimerExpired);
|
NotifyTimer = timer::set(value, this, NotifyTimerExpired);
|
||||||
break;
|
break;
|
||||||
case 44:
|
case 44:
|
||||||
@ -447,7 +447,7 @@ void TLightGroup::reschedule_animation(float time)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer1Time = time > 0.0 ? time : Timer1TimeDefault;
|
Timer1Time = time > 0.0f ? time : Timer1TimeDefault;
|
||||||
Timer = timer::set(Timer1Time, this, TimerExpired);
|
Timer = timer::set(Timer1Time, this, TimerExpired);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ void TOneway::Collision(TBall* ball, vector_type* nextPosition, vector_type* dir
|
|||||||
Elasticity,
|
Elasticity,
|
||||||
Smoothness,
|
Smoothness,
|
||||||
Threshold,
|
Threshold,
|
||||||
Boost) > 0.2)
|
Boost) > 0.2f)
|
||||||
{
|
{
|
||||||
if (SoftHitSoundId)
|
if (SoftHitSoundId)
|
||||||
loader::play_sound(SoftHitSoundId);
|
loader::play_sound(SoftHitSoundId);
|
||||||
|
@ -34,7 +34,7 @@ int TSink::Message(int code, float value)
|
|||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 56:
|
case 56:
|
||||||
if (value < 0.0)
|
if (value < 0.0f)
|
||||||
value = TimerTime;
|
value = TimerTime;
|
||||||
Timer = timer::set(value, this, TimerExpired);
|
Timer = timer::set(value, this, TimerExpired);
|
||||||
break;
|
break;
|
||||||
|
@ -219,45 +219,45 @@ void TTableLayer::edges_insert_circle(circle_type* circle, TEdgeSegment* edge, f
|
|||||||
ray.Direction.X = 1.0;
|
ray.Direction.X = 1.0;
|
||||||
ray.Direction.Y = 0.0;
|
ray.Direction.Y = 0.0;
|
||||||
ray.MaxDistance = edge_manager->AdvanceX;
|
ray.MaxDistance = edge_manager->AdvanceX;
|
||||||
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0)
|
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ray.Direction.X = -1.0;
|
ray.Direction.X = -1.0;
|
||||||
ray.Origin.X = ray.Origin.X + edge_manager->AdvanceX;
|
ray.Origin.X = ray.Origin.X + edge_manager->AdvanceX;
|
||||||
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0)
|
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ray.Direction.X = 0.0;
|
ray.Direction.X = 0.0;
|
||||||
ray.Direction.Y = 1.0;
|
ray.Direction.Y = 1.0;
|
||||||
ray.MaxDistance = edge_manager->AdvanceY;
|
ray.MaxDistance = edge_manager->AdvanceY;
|
||||||
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0)
|
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ray.Direction.Y = -1.0;
|
ray.Direction.Y = -1.0;
|
||||||
ray.Origin.Y = ray.Origin.Y + edge_manager->AdvanceY;
|
ray.Origin.Y = ray.Origin.Y + edge_manager->AdvanceY;
|
||||||
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0)
|
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ray.Direction.Y = 0.0;
|
ray.Direction.Y = 0.0;
|
||||||
ray.Direction.X = -1.0;
|
ray.Direction.X = -1.0;
|
||||||
ray.MaxDistance = edge_manager->AdvanceX;
|
ray.MaxDistance = edge_manager->AdvanceX;
|
||||||
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0)
|
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ray.Direction.X = 1.0;
|
ray.Direction.X = 1.0;
|
||||||
ray.Origin.X = ray.Origin.X - edge_manager->AdvanceX;
|
ray.Origin.X = ray.Origin.X - edge_manager->AdvanceX;
|
||||||
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0)
|
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ray.Direction.X = 0.0;
|
ray.Direction.X = 0.0;
|
||||||
ray.Direction.Y = -1.0;
|
ray.Direction.Y = -1.0;
|
||||||
ray.MaxDistance = edge_manager->AdvanceY;
|
ray.MaxDistance = edge_manager->AdvanceY;
|
||||||
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0)
|
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ray.Direction.Y = 1.0;
|
ray.Direction.Y = 1.0;
|
||||||
ray.Origin.Y = ray.Origin.Y - edge_manager->AdvanceY;
|
ray.Origin.Y = ray.Origin.Y - edge_manager->AdvanceY;
|
||||||
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0)
|
if (maths::ray_intersect_circle(&ray, circle) < 1000000000.0f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
collision = false;
|
collision = false;
|
||||||
|
@ -121,7 +121,7 @@ void TTextBox::Display(char* text, float time)
|
|||||||
{
|
{
|
||||||
if (Timer && Timer != -1)
|
if (Timer && Timer != -1)
|
||||||
timer::kill(Timer);
|
timer::kill(Timer);
|
||||||
if (time == -1.0)
|
if (time == -1.0f)
|
||||||
Timer = -1;
|
Timer = -1;
|
||||||
else
|
else
|
||||||
Timer = timer::set(time, this, TimerExpired);
|
Timer = timer::set(time, this, TimerExpired);
|
||||||
@ -172,7 +172,7 @@ void TTextBox::Draw()
|
|||||||
bool display = false;
|
bool display = false;
|
||||||
while (Message1)
|
while (Message1)
|
||||||
{
|
{
|
||||||
if (Message1->Time == -1.0)
|
if (Message1->Time == -1.0f)
|
||||||
{
|
{
|
||||||
if (!Message1->NextMessage)
|
if (!Message1->NextMessage)
|
||||||
{
|
{
|
||||||
|
@ -56,14 +56,14 @@ HANDLE WaveMix::ConfigureInit(MIXCONFIG* lpConfig)
|
|||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
{
|
{
|
||||||
wsprintfA(string_buffer, "This system does not have a valid wave output device.");
|
wsprintfA(string_buffer, "This system does not have a valid wave output device.");
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x40u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetPrivateProfileIntA("general", "ShowDevices", 0, FileName))
|
if (GetPrivateProfileIntA("general", "ShowDevices", 0, FileName))
|
||||||
ShowWaveOutDevices();
|
ShowWaveOutDevices();
|
||||||
auto globals = static_cast<GLOBALS*>(LocalAlloc(0x40u, sizeof(GLOBALS)));
|
auto globals = static_cast<GLOBALS*>(LocalAlloc(LMEM_ZEROINIT, sizeof(GLOBALS)));
|
||||||
Globals = globals;
|
Globals = globals;
|
||||||
if (!globals)
|
if (!globals)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -75,7 +75,7 @@ HANDLE WaveMix::ConfigureInit(MIXCONFIG* lpConfig)
|
|||||||
globals->DefaultVolume.L = 10;
|
globals->DefaultVolume.L = 10;
|
||||||
globals->DefaultVolume.R = 10;
|
globals->DefaultVolume.R = 10;
|
||||||
memset(globals->aChannel, 0xFFu, sizeof globals->aChannel);
|
memset(globals->aChannel, 0xFFu, sizeof globals->aChannel);
|
||||||
memmove(&globals->PCM, &gpFormat, 0x10u);
|
memmove(&globals->PCM, &gpFormat, sizeof(PCMWAVEFORMAT));
|
||||||
if (!ReadConfigSettings(&mixConfig))
|
if (!ReadConfigSettings(&mixConfig))
|
||||||
{
|
{
|
||||||
Globals->wMagic2 = 0;
|
Globals->wMagic2 = 0;
|
||||||
@ -245,7 +245,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
WAVEFORMATEX pwfx;
|
WAVEFORMATEX pwfx;
|
||||||
HMMIO hMmio = nullptr;
|
HMMIO hMmio = nullptr;
|
||||||
HGLOBAL hResData = nullptr;
|
HGLOBAL hResData = nullptr;
|
||||||
HPSTR wavBuffer3 = nullptr;
|
HPSTR lpData = nullptr;
|
||||||
auto globals = SessionToGlobalDataPtr(hMixSession);
|
auto globals = SessionToGlobalDataPtr(hMixSession);
|
||||||
pwfx.wFormatTag = globals->PCM.wf.wFormatTag;
|
pwfx.wFormatTag = globals->PCM.wf.wFormatTag;
|
||||||
pwfx.nChannels = globals->PCM.wf.nChannels;
|
pwfx.nChannels = globals->PCM.wf.nChannels;
|
||||||
@ -258,11 +258,11 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
if (waveOutOpen(&phwo, 0xFFFFFFFF, &pwfx, 0, 0, 1u))
|
if (waveOutOpen(&phwo, 0xFFFFFFFF, &pwfx, 0, 0, 1u))
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "The waveform device can't play this format.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "The waveform device can't play this format.", "WavMix32", MB_ICONWARNING);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto mixWave = static_cast<MIXWAVE*>(GlobalLock(GlobalAlloc(0x2040u, sizeof(MIXWAVE))));
|
auto mixWave = static_cast<MIXWAVE*>(GlobalLock(GlobalAlloc(GMEM_SHARE | GMEM_ZEROINIT, sizeof(MIXWAVE))));
|
||||||
if (!mixWave)
|
if (!mixWave)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
@ -270,7 +270,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
nullptr,
|
nullptr,
|
||||||
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
||||||
"WavMix32",
|
"WavMix32",
|
||||||
0x40u);
|
MB_ICONINFORMATION);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
else
|
else
|
||||||
wsprintfA(string_buffer, "Failed to open 'WAVE' resource %u.", LOWORD(szWaveFilename));
|
wsprintfA(string_buffer, "Failed to open 'WAVE' resource %u.", LOWORD(szWaveFilename));
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x30u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
if (!pmmioinfo.pchBuffer)
|
if (!pmmioinfo.pchBuffer)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Failed to lock 'WAVE' resource", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Failed to lock 'WAVE' resource", "WavMix32", MB_ICONWARNING);
|
||||||
FreeResource(hResData);
|
FreeResource(hResData);
|
||||||
hResData = nullptr;
|
hResData = nullptr;
|
||||||
break;
|
break;
|
||||||
@ -312,7 +312,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
wsprintfA(string_buffer,
|
wsprintfA(string_buffer,
|
||||||
"Failed to open resource, mmioOpen error=%u.\nMay need to make sure resource is marked read-write",
|
"Failed to open resource, mmioOpen error=%u.\nMay need to make sure resource is marked read-write",
|
||||||
pmmioinfo.wErrorRet);
|
pmmioinfo.wErrorRet);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x30u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONWARNING);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -328,7 +328,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
wsprintfA(string_buffer,
|
wsprintfA(string_buffer,
|
||||||
"Failed to open memory file, mmioOpen error=%u.\nMay need to make sure memory is read-write",
|
"Failed to open memory file, mmioOpen error=%u.\nMay need to make sure memory is read-write",
|
||||||
pmmioinfo.wErrorRet);
|
pmmioinfo.wErrorRet);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x30u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONWARNING);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -341,57 +341,57 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
{
|
{
|
||||||
wsprintfA(string_buffer, "Failed to open wave file %s.", szWaveFilename);
|
wsprintfA(string_buffer, "Failed to open wave file %s.", szWaveFilename);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x30u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONWARNING);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pmmcki.fccType = mmioFOURCC('W', 'A', 'V', 'E');
|
pmmcki.fccType = mmioFOURCC('W', 'A', 'V', 'E');
|
||||||
if (mmioDescend(hMmio, &pmmcki, nullptr, 0x20u))
|
if (mmioDescend(hMmio, &pmmcki, nullptr, MMIO_FINDRIFF))
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "This is not a WAVE file.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "This is not a WAVE file.", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmmFmt.ckid = mmioFOURCC('f', 'm', 't', ' ');
|
pmmFmt.ckid = mmioFOURCC('f', 'm', 't', ' ');
|
||||||
if (mmioDescend(hMmio, &pmmFmt, &pmmcki, 0x10u))
|
if (mmioDescend(hMmio, &pmmFmt, &pmmcki, MMIO_FINDCHUNK))
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "WAVE file is corrupted.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "WAVE file is corrupted.", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mmioRead(hMmio, (HPSTR)mixWave, 16) != 16)
|
if (mmioRead(hMmio, (HPSTR)mixWave, 16) != 16)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Failed to read format chunk.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Failed to read format chunk.", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mixWave->pcm.wf.wFormatTag != 1)
|
if (mixWave->pcm.wf.wFormatTag != 1)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "The file is not a PCM file.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "The file is not a PCM file.", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mmioAscend(hMmio, &pmmFmt, 0);
|
mmioAscend(hMmio, &pmmFmt, 0);
|
||||||
pmmFmt.ckid = mmioFOURCC('d', 'a', 't', 'a');
|
pmmFmt.ckid = mmioFOURCC('d', 'a', 't', 'a');
|
||||||
if (mmioDescend(hMmio, &pmmFmt, &pmmcki, 0x10u))
|
if (mmioDescend(hMmio, &pmmFmt, &pmmcki, MMIO_FINDCHUNK))
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "WAVE file has no data chunk.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "WAVE file has no data chunk.", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
auto dataSize = pmmFmt.cksize;
|
auto dataSize = pmmFmt.cksize;
|
||||||
if (!pmmFmt.cksize)
|
if (!pmmFmt.cksize)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "The data chunk has no data.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "The data chunk has no data.", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lpData = static_cast<HPSTR>(GlobalLock(GlobalAlloc(0x2002u, pmmFmt.cksize)));
|
lpData = static_cast<HPSTR>(GlobalLock(GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE, pmmFmt.cksize)));
|
||||||
if (!lpData)
|
if (!lpData)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
@ -399,7 +399,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
nullptr,
|
nullptr,
|
||||||
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
||||||
"WavMix32",
|
"WavMix32",
|
||||||
0x40u);
|
MB_ICONINFORMATION);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,14 +407,14 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
if (readCount != static_cast<LONG>(dataSize))
|
if (readCount != static_cast<LONG>(dataSize))
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Failed to read data chunk.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Failed to read data chunk.", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lpData = WaveFormatConvert(&Globals->PCM, &mixWave->pcm, lpData, &dataSize);
|
lpData = WaveFormatConvert(&Globals->PCM, &mixWave->pcm, lpData, &dataSize);
|
||||||
if (!lpData)
|
if (!lpData)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Failed to convert wave format.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Failed to convert wave format.", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mmioClose(hMmio, 0);
|
mmioClose(hMmio, 0);
|
||||||
@ -426,7 +426,7 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
mixWave->wh.dwLoops = 0;
|
mixWave->wh.dwLoops = 0;
|
||||||
mixWave->wh.dwUser = 0;
|
mixWave->wh.dwUser = 0;
|
||||||
mixWave->wMagic = 21554;
|
mixWave->wMagic = 21554;
|
||||||
memmove(mixWave, &Globals->PCM, 0x10u);
|
memmove(&mixWave->pcm, &Globals->PCM, sizeof(PCMWAVEFORMAT));
|
||||||
|
|
||||||
if (HIWORD(szWaveFilename))
|
if (HIWORD(szWaveFilename))
|
||||||
{
|
{
|
||||||
@ -446,10 +446,10 @@ MIXWAVE* WaveMix::OpenWave(HANDLE hMixSession, LPCSTR szWaveFilename, HINSTANCE
|
|||||||
mmioClose(hMmio, 0);
|
mmioClose(hMmio, 0);
|
||||||
GlobalUnlock(GlobalHandle(mixWave));
|
GlobalUnlock(GlobalHandle(mixWave));
|
||||||
GlobalFree(GlobalHandle(mixWave));
|
GlobalFree(GlobalHandle(mixWave));
|
||||||
if (wavBuffer3)
|
if (lpData)
|
||||||
{
|
{
|
||||||
GlobalUnlock(GlobalHandle(wavBuffer3));
|
GlobalUnlock(GlobalHandle(lpData));
|
||||||
GlobalFree(GlobalHandle(wavBuffer3));
|
GlobalFree(GlobalHandle(lpData));
|
||||||
}
|
}
|
||||||
if (hResData)
|
if (hResData)
|
||||||
FreeResource(hResData);
|
FreeResource(hResData);
|
||||||
@ -586,7 +586,7 @@ int WaveMix::Play(MIXPLAYPARAMS* lpMixPlayParams)
|
|||||||
if (!lpMixPlayParams)
|
if (!lpMixPlayParams)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "NULL parameters pointer passed to WaveMixPlay!", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "NULL parameters pointer passed to WaveMixPlay!", "WavMix32", MB_ICONWARNING);
|
||||||
result = 5;
|
result = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ int WaveMix::Play(MIXPLAYPARAMS* lpMixPlayParams)
|
|||||||
if (!globals)
|
if (!globals)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Invalid session handle passed to WaveMixPlay", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Invalid session handle passed to WaveMixPlay", "WavMix32", MB_ICONWARNING);
|
||||||
result = 5;
|
result = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -604,7 +604,7 @@ int WaveMix::Play(MIXPLAYPARAMS* lpMixPlayParams)
|
|||||||
if (!IsValidLPMIXWAVE(lpMixPlayParams->lpMixWave))
|
if (!IsValidLPMIXWAVE(lpMixPlayParams->lpMixWave))
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Invalid or NULL wave pointer passed to WaveMixPlay!", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Invalid or NULL wave pointer passed to WaveMixPlay!", "WavMix32", MB_ICONWARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +615,7 @@ int WaveMix::Play(MIXPLAYPARAMS* lpMixPlayParams)
|
|||||||
"The LPMIXWAVE 0x%lx is not in the current output format, close the wave and reopen it.",
|
"The LPMIXWAVE 0x%lx is not in the current output format, close the wave and reopen it.",
|
||||||
lpMixPlayParams->lpMixWave);
|
lpMixPlayParams->lpMixWave);
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x30u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONWARNING);
|
||||||
result = 8;
|
result = 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -623,14 +623,14 @@ int WaveMix::Play(MIXPLAYPARAMS* lpMixPlayParams)
|
|||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Wave device not allocated, call WaveMixActivate(hMixSession,TRUE)", "WavMix32",
|
MessageBoxA(nullptr, "Wave device not allocated, call WaveMixActivate(hMixSession,TRUE)", "WavMix32",
|
||||||
0x30u);
|
MB_ICONWARNING);
|
||||||
result = 4;
|
result = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!globals->iChannels)
|
if (!globals->iChannels)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "You must open a channel before you can play a wave!", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "You must open a channel before you can play a wave!", "WavMix32", MB_ICONWARNING);
|
||||||
result = 5;
|
result = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -829,7 +829,7 @@ GLOBALS* WaveMix::SessionToGlobalDataPtr(HANDLE hMixSession)
|
|||||||
return globals;
|
return globals;
|
||||||
MessageBeep(0xFFFFFFFF);
|
MessageBeep(0xFFFFFFFF);
|
||||||
wsprintfA(string_buffer, "Invalid session handle 0x%04X passed to WaveMix API", hMixSession);
|
wsprintfA(string_buffer, "Invalid session handle 0x%04X passed to WaveMix API", hMixSession);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x30u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONWARNING);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -915,7 +915,7 @@ void WaveMix::ShowWaveOutDevices()
|
|||||||
if (deviceCount)
|
if (deviceCount)
|
||||||
{
|
{
|
||||||
wsprintfA(string_buffer, "%d waveOut Devices have been detected on your system.", deviceCount);
|
wsprintfA(string_buffer, "%d waveOut Devices have been detected on your system.", deviceCount);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x40u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONINFORMATION);
|
||||||
for (auto uDeviceID = 0u; uDeviceID < deviceCount; ++uDeviceID)
|
for (auto uDeviceID = 0u; uDeviceID < deviceCount; ++uDeviceID)
|
||||||
{
|
{
|
||||||
if (!waveOutGetDevCapsA(uDeviceID, &pwoc, 0x34u) && RemoveInvalidIniNameCharacters(pwoc.szPname))
|
if (!waveOutGetDevCapsA(uDeviceID, &pwoc, 0x34u) && RemoveInvalidIniNameCharacters(pwoc.szPname))
|
||||||
@ -928,7 +928,7 @@ void WaveMix::ShowWaveOutDevices()
|
|||||||
LOBYTE(pwoc.vDriverVersion));
|
LOBYTE(pwoc.vDriverVersion));
|
||||||
else
|
else
|
||||||
wsprintfA(string_buffer, "waveOutGetDevCaps failed (err %u) for device %d", 1, uDeviceID);
|
wsprintfA(string_buffer, "waveOutGetDevCaps failed (err %u) for device %d", 1, uDeviceID);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x40u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1000,7 +1000,7 @@ int WaveMix::ReadConfigSettings(MIXCONFIG* lpConfig)
|
|||||||
wsprintfA(string_buffer,
|
wsprintfA(string_buffer,
|
||||||
"%s is a syncronous (blocking) wave output device. This will not permit audio to play while other applications are running.",
|
"%s is a syncronous (blocking) wave output device. This will not permit audio to play while other applications are running.",
|
||||||
Globals->WaveoutCaps.szPname);
|
Globals->WaveoutCaps.szPname);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x40u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONINFORMATION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (GetPrivateProfileIntA("not compatible", Globals->szDevicePName, 0, FileName))
|
if (GetPrivateProfileIntA("not compatible", Globals->szDevicePName, 0, FileName))
|
||||||
@ -1008,7 +1008,7 @@ int WaveMix::ReadConfigSettings(MIXCONFIG* lpConfig)
|
|||||||
if (!ShowDebugDialogs)
|
if (!ShowDebugDialogs)
|
||||||
return 0;
|
return 0;
|
||||||
wsprintfA(string_buffer, "%s is not compatible with the realtime wavemixer.", Globals->szDevicePName);
|
wsprintfA(string_buffer, "%s is not compatible with the realtime wavemixer.", Globals->szDevicePName);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x40u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONINFORMATION);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1435,7 +1435,7 @@ int WaveMix::ResetRemix(DWORD dwRemixSamplePos, CHANNELNODE* channel)
|
|||||||
if (waveOutWrite(Globals->hWaveOut, &xHDR->wh, sizeof(WAVEHDR)))
|
if (waveOutWrite(Globals->hWaveOut, &xHDR->wh, sizeof(WAVEHDR)))
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Failed to write block to device", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Failed to write block to device", "WavMix32", MB_ICONWARNING);
|
||||||
xHDR->fAvailable = 1;
|
xHDR->fAvailable = 1;
|
||||||
RemoveFromPlayingQueue(xHDR);
|
RemoveFromPlayingQueue(xHDR);
|
||||||
}
|
}
|
||||||
@ -1650,7 +1650,7 @@ int WaveMix::MixerPlay(XWAVEHDR* lpXWH, int fWriteBlocks)
|
|||||||
if (waveOutWrite(Globals->hWaveOut, &lpXWH->wh, sizeof(WAVEHDR)))
|
if (waveOutWrite(Globals->hWaveOut, &lpXWH->wh, sizeof(WAVEHDR)))
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Failed to write block to device", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Failed to write block to device", "WavMix32", MB_ICONWARNING);
|
||||||
lpXWH->fAvailable = 1;
|
lpXWH->fAvailable = 1;
|
||||||
RemoveFromPlayingQueue(lpXWH);
|
RemoveFromPlayingQueue(lpXWH);
|
||||||
}
|
}
|
||||||
@ -1862,7 +1862,7 @@ int WaveMix::Settings_OnInitDialog(HWND hWnd, WPARAM wParam, MIXCONFIG* lpMixcon
|
|||||||
if (getResult)
|
if (getResult)
|
||||||
{
|
{
|
||||||
wsprintfA(string_buffer, "waveOutGetDevCaps failed (err %u) for device %d", getResult, uDeviceID);
|
wsprintfA(string_buffer, "waveOutGetDevCaps failed (err %u) for device %d", getResult, uDeviceID);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x40u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2051,7 +2051,7 @@ void WaveMix::ShowCurrentSettings()
|
|||||||
Globals->PCM.wf.nSamplesPerSec,
|
Globals->PCM.wf.nSamplesPerSec,
|
||||||
Globals->PCM.wf.nChannels,
|
Globals->PCM.wf.nChannels,
|
||||||
Globals->PauseBlocks);
|
Globals->PauseBlocks);
|
||||||
MessageBoxA(nullptr, string_buffer, "WavMix32", 0x40u);
|
MessageBoxA(nullptr, string_buffer, "WavMix32", MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned WaveMix::GetWaveDevice()
|
unsigned WaveMix::GetWaveDevice()
|
||||||
@ -2060,14 +2060,14 @@ unsigned WaveMix::GetWaveDevice()
|
|||||||
|
|
||||||
if (Globals->hWaveOut)
|
if (Globals->hWaveOut)
|
||||||
return 0;
|
return 0;
|
||||||
HWND window = CreateWindowExA(0, "WavMix32", pinball::WindowName, 0x8000000u, 0, 0, 0, 0, nullptr, nullptr, HModule,
|
HWND window = CreateWindowExA(0, "WavMix32", "", 0x8000000u, 0, 0, 0, 0, nullptr, nullptr, HModule,
|
||||||
nullptr);
|
nullptr);
|
||||||
GLOBALS* globals = Globals;
|
GLOBALS* globals = Globals;
|
||||||
Globals->hWndApp = window;
|
Globals->hWndApp = window;
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Failed to create callback window.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Failed to create callback window.", "WavMix32", MB_ICONWARNING);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
pwfx.wFormatTag = globals->PCM.wf.wFormatTag;
|
pwfx.wFormatTag = globals->PCM.wf.wFormatTag;
|
||||||
@ -2128,7 +2128,7 @@ int WaveMix::AllocWaveBlocks(HWAVEOUT hwo, XWAVEHDR** waveBlocks)
|
|||||||
nullptr,
|
nullptr,
|
||||||
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
||||||
"WavMix32",
|
"WavMix32",
|
||||||
0x30u);
|
MB_ICONWARNING);
|
||||||
for (int j = i - 1; j >= 0; --j)
|
for (int j = i - 1; j >= 0; --j)
|
||||||
{
|
{
|
||||||
GlobalUnlock(GlobalHandle(waveBlocks[j]));
|
GlobalUnlock(GlobalHandle(waveBlocks[j]));
|
||||||
@ -2152,7 +2152,7 @@ int WaveMix::AllocWaveBlocks(HWAVEOUT hwo, XWAVEHDR** waveBlocks)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
MessageBoxA(nullptr, "Unable to prepare wave header.", "WavMix32", 0x30u);
|
MessageBoxA(nullptr, "Unable to prepare wave header.", "WavMix32", MB_ICONWARNING);
|
||||||
FreeWaveBlocks(hwo, waveBlocks);
|
FreeWaveBlocks(hwo, waveBlocks);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2207,7 +2207,7 @@ HPSTR WaveMix::BitsPerSampleAlign(HPSTR lpInData, WORD nInBPS, WORD nOutBPS, DWO
|
|||||||
DWORD dwNumSamples = *dwDataSize / (nInBPS / 8u);
|
DWORD dwNumSamples = *dwDataSize / (nInBPS / 8u);
|
||||||
*dwDataSize = dwNumSamples * (nOutBPS / 8u);
|
*dwDataSize = dwNumSamples * (nOutBPS / 8u);
|
||||||
|
|
||||||
dataBuf = GlobalLock(GlobalAlloc(0x2002u, *dwDataSize));
|
dataBuf = GlobalLock(GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE, *dwDataSize));
|
||||||
if (dataBuf)
|
if (dataBuf)
|
||||||
{
|
{
|
||||||
if (nInBPS / 8u <= nOutBPS / 8u)
|
if (nInBPS / 8u <= nOutBPS / 8u)
|
||||||
@ -2232,7 +2232,7 @@ HPSTR WaveMix::BitsPerSampleAlign(HPSTR lpInData, WORD nInBPS, WORD nOutBPS, DWO
|
|||||||
nullptr,
|
nullptr,
|
||||||
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
||||||
"WavMix32",
|
"WavMix32",
|
||||||
0x40u);
|
MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2248,7 +2248,7 @@ HPSTR WaveMix::ChannelAlign(HPSTR lpInData, WORD nInChannels, WORD nOutChannels,
|
|||||||
return lpInData;
|
return lpInData;
|
||||||
DWORD dwNumSamples = *dwDataSize / nBytesPerSample / nInChannels;
|
DWORD dwNumSamples = *dwDataSize / nBytesPerSample / nInChannels;
|
||||||
*dwDataSize = dwNumSamples * nBytesPerSample * nOutChannels;
|
*dwDataSize = dwNumSamples * nBytesPerSample * nOutChannels;
|
||||||
char* dataBuf = static_cast<char*>(GlobalLock(GlobalAlloc(0x2002u, *dwDataSize)));
|
char* dataBuf = static_cast<char*>(GlobalLock(GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE, *dwDataSize)));
|
||||||
if (dataBuf)
|
if (dataBuf)
|
||||||
{
|
{
|
||||||
if (nInChannels < nOutChannels)
|
if (nInChannels < nOutChannels)
|
||||||
@ -2303,7 +2303,7 @@ HPSTR WaveMix::ChannelAlign(HPSTR lpInData, WORD nInChannels, WORD nOutChannels,
|
|||||||
nullptr,
|
nullptr,
|
||||||
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
||||||
"WavMix32",
|
"WavMix32",
|
||||||
0x40u);
|
MB_ICONINFORMATION);
|
||||||
dataBuf = nullptr;
|
dataBuf = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2334,7 +2334,7 @@ HPSTR WaveMix::SamplesPerSecAlign(HPSTR lpInData, DWORD nInSamplesPerSec, DWORD
|
|||||||
}
|
}
|
||||||
*dwDataSize = sampleSize * dwNumSamples2;
|
*dwDataSize = sampleSize * dwNumSamples2;
|
||||||
|
|
||||||
auto dataBuf = static_cast<char*>(GlobalLock(GlobalAlloc(0x2002u, sampleSize * dwNumSamples2)));
|
auto dataBuf = static_cast<char*>(GlobalLock(GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE, sampleSize * dwNumSamples2)));
|
||||||
if (!dataBuf)
|
if (!dataBuf)
|
||||||
{
|
{
|
||||||
if (ShowDebugDialogs)
|
if (ShowDebugDialogs)
|
||||||
@ -2342,7 +2342,7 @@ HPSTR WaveMix::SamplesPerSecAlign(HPSTR lpInData, DWORD nInSamplesPerSec, DWORD
|
|||||||
nullptr,
|
nullptr,
|
||||||
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
"Unable to allocate memory for waveform data. Try making more memory available by closing other applications.",
|
||||||
"WavMix32",
|
"WavMix32",
|
||||||
0x40u);
|
MB_ICONINFORMATION);
|
||||||
GlobalUnlock(GlobalHandle(lpInData));
|
GlobalUnlock(GlobalHandle(lpInData));
|
||||||
GlobalFree(GlobalHandle(lpInData));
|
GlobalFree(GlobalHandle(lpInData));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -2503,7 +2503,7 @@ void WaveMix::FreePlayedBlocks()
|
|||||||
|
|
||||||
int WaveMix::HasCurrentOutputFormat(MIXWAVE* lpMixWave)
|
int WaveMix::HasCurrentOutputFormat(MIXWAVE* lpMixWave)
|
||||||
{
|
{
|
||||||
return memcmp(lpMixWave, &Globals->PCM, 0x10u) == 0;
|
return memcmp(&lpMixWave->pcm, &Globals->PCM, sizeof(PCMWAVEFORMAT)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHANNELNODE* WaveMix::GetChannelNode()
|
CHANNELNODE* WaveMix::GetChannelNode()
|
||||||
|
@ -323,17 +323,17 @@ void fullscrn::fillRect(int right, int bottom, int left, int top)
|
|||||||
if (brush)
|
if (brush)
|
||||||
{
|
{
|
||||||
auto dc = winmain::_GetDC(hWnd);
|
auto dc = winmain::_GetDC(hWnd);
|
||||||
auto prevBrush = SelectObject(dc, brush);
|
|
||||||
if (dc)
|
if (dc)
|
||||||
{
|
{
|
||||||
|
auto prevBrush = SelectObject(dc, brush);
|
||||||
rc.right = left + right + 1;
|
rc.right = left + right + 1;
|
||||||
rc.bottom = top + bottom + 1;
|
rc.bottom = top + bottom + 1;
|
||||||
rc.left = left;
|
rc.left = left;
|
||||||
rc.top = top;
|
rc.top = top;
|
||||||
FillRect(dc, &rc, brush);
|
FillRect(dc, &rc, brush);
|
||||||
|
SelectObject(dc, prevBrush);
|
||||||
ReleaseDC(hWnd, dc);
|
ReleaseDC(hWnd, dc);
|
||||||
}
|
}
|
||||||
SelectObject(dc, prevBrush);
|
|
||||||
DeleteObject(brush);
|
DeleteObject(brush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,12 +42,11 @@ void gdrv::get_focus()
|
|||||||
|
|
||||||
BITMAPINFO* gdrv::DibCreate(int16_t bpp, int width, int height)
|
BITMAPINFO* gdrv::DibCreate(int16_t bpp, int width, int height)
|
||||||
{
|
{
|
||||||
auto sizeBytes = height * (width * bpp / 8 + 3 & 0xFFFFFFFC);
|
auto sizeBytes = height * (width * bpp / 8 + 3 & (~3));
|
||||||
auto buf = GlobalAlloc(GHND, sizeBytes + sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
|
auto dib = memory::allocate<BITMAPINFO>(1, (256 - 1) * sizeof(RGBQUAD) + sizeBytes);
|
||||||
auto dib = static_cast<BITMAPINFO*>(GlobalLock(buf));
|
|
||||||
|
|
||||||
if (!dib)
|
if (!dib)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
dib->bmiHeader.biSizeImage = sizeBytes;
|
dib->bmiHeader.biSizeImage = sizeBytes;
|
||||||
dib->bmiHeader.biWidth = width;
|
dib->bmiHeader.biWidth = width;
|
||||||
dib->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
dib->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||||
@ -247,8 +246,7 @@ int gdrv::destroy_bitmap(gdrv_bitmap8* bmp)
|
|||||||
}
|
}
|
||||||
else if (bmp->BitmapType == BitmapType::DibBitmap)
|
else if (bmp->BitmapType == BitmapType::DibBitmap)
|
||||||
{
|
{
|
||||||
GlobalUnlock(GlobalHandle(bmp->Dib));
|
memory::free(bmp->Dib);
|
||||||
GlobalFree(GlobalHandle(bmp->Dib));
|
|
||||||
}
|
}
|
||||||
memset(bmp, 0, sizeof(gdrv_bitmap8));
|
memset(bmp, 0, sizeof(gdrv_bitmap8));
|
||||||
return 0;
|
return 0;
|
||||||
@ -433,7 +431,7 @@ int gdrv::StretchDIBitsScaled(HDC hdc, int xDest, int yDest, int DestWidth, int
|
|||||||
{
|
{
|
||||||
xSrc -= pad;
|
xSrc -= pad;
|
||||||
xDest -= pad;
|
xDest -= pad;
|
||||||
SrcWidth += padX2;
|
SrcWidth += padX2;
|
||||||
DestWidth += padX2;
|
DestWidth += padX2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,7 +439,7 @@ int gdrv::StretchDIBitsScaled(HDC hdc, int xDest, int yDest, int DestWidth, int
|
|||||||
{
|
{
|
||||||
ySrc -= pad;
|
ySrc -= pad;
|
||||||
yDest -= pad;
|
yDest -= pad;
|
||||||
SrcHeight += padX2;
|
SrcHeight += padX2;
|
||||||
DestHeight += padX2;
|
DestHeight += padX2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +54,12 @@ int high_score::read(high_score_struct* table, int* ptrToSmth)
|
|||||||
auto tablePtr = &table[position];
|
auto tablePtr = &table[position];
|
||||||
_itoa_s(position, Buffer, 10);
|
_itoa_s(position, Buffer, 10);
|
||||||
lstrcatA(Buffer, ".Name");
|
lstrcatA(Buffer, ".Name");
|
||||||
options::get_string(optPath, Buffer, buf1, pinball::WindowName, 32);
|
options::get_string(optPath, Buffer, buf1, "", 32);
|
||||||
buf1[32] = 0;
|
buf1[32] = 0;
|
||||||
lstrcpyA(tablePtr->Name, buf1);
|
lstrcpyA(tablePtr->Name, buf1);
|
||||||
_itoa_s(position, Buffer, 10);
|
_itoa_s(position, Buffer, 10);
|
||||||
lstrcatA(Buffer, ".Score");
|
lstrcatA(Buffer, ".Score");
|
||||||
options::get_string(optPath, Buffer, buf1, pinball::WindowName, 300);
|
options::get_string(optPath, Buffer, buf1, "", 300);
|
||||||
tablePtr->Score = atol(buf1);
|
tablePtr->Score = atol(buf1);
|
||||||
for (int i = lstrlenA(tablePtr->Name); --i >= 0; scoreSum += tablePtr->Name[i])
|
for (int i = lstrlenA(tablePtr->Name); --i >= 0; scoreSum += tablePtr->Name[i])
|
||||||
{
|
{
|
||||||
@ -68,7 +68,7 @@ int high_score::read(high_score_struct* table, int* ptrToSmth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
scramble_number_string(scoreSum, buf1);
|
scramble_number_string(scoreSum, buf1);
|
||||||
options::get_string(optPath, "Verification", buf2, pinball::WindowName, 300);
|
options::get_string(optPath, "Verification", buf2, "", 300);
|
||||||
if (lstrcmpA(buf1, buf2))
|
if (lstrcmpA(buf1, buf2))
|
||||||
clear_table(table);
|
clear_table(table);
|
||||||
memory::free(buf1);
|
memory::free(buf1);
|
||||||
|
@ -469,11 +469,11 @@ int loader::query_visual(int groupIndex, int groupIndexOffset, visualStruct* vis
|
|||||||
auto floatArr = reinterpret_cast<float*>(partman::field(loader_table, stateId, datFieldTypes::FloatArray));
|
auto floatArr = reinterpret_cast<float*>(partman::field(loader_table, stateId, datFieldTypes::FloatArray));
|
||||||
if (!floatArr)
|
if (!floatArr)
|
||||||
return 0;
|
return 0;
|
||||||
if (*floatArr != 600.0)
|
if (*floatArr != 600.0f)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
visual->FloatArrCount = partman::field_size(loader_table, stateId, datFieldTypes::FloatArray) / 4 / 2 - 2;
|
visual->FloatArrCount = partman::field_size(loader_table, stateId, datFieldTypes::FloatArray) / 4 / 2 - 2;
|
||||||
auto floatVal = static_cast<int>(floor(floatArr[1]) - 1.0);
|
auto floatVal = static_cast<int>(floor(floatArr[1]) - 1.0f);
|
||||||
switch (floatVal)
|
switch (floatVal)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -131,7 +131,7 @@ float maths::ray_intersect_circle(ray_type* ray, circle_type* circle)
|
|||||||
|
|
||||||
// Tca, L dot D, projection of L on D
|
// Tca, L dot D, projection of L on D
|
||||||
float Tca = Ly * ray->Direction.Y + Lx * ray->Direction.X;
|
float Tca = Ly * ray->Direction.Y + Lx * ray->Direction.X;
|
||||||
if (Tca < 0.0) // No intersection if Tca is negative
|
if (Tca < 0.0f) // No intersection if Tca is negative
|
||||||
return 1000000000.0f;
|
return 1000000000.0f;
|
||||||
|
|
||||||
// L dot L, distance from ray origin to circle center
|
// L dot L, distance from ray origin to circle center
|
||||||
@ -144,12 +144,12 @@ float maths::ray_intersect_circle(ray_type* ray, circle_type* circle)
|
|||||||
|
|
||||||
// Thc^2 = rad^2 - d = rad^2 - L dot L + Tca dot Tca
|
// Thc^2 = rad^2 - d = rad^2 - L dot L + Tca dot Tca
|
||||||
float ThcSq = circle->RadiusSq - LMagSq + Tca * Tca;
|
float ThcSq = circle->RadiusSq - LMagSq + Tca * Tca;
|
||||||
if (ThcSq < 0.0) // No intersection if Thc is negative
|
if (ThcSq < 0.0f) // No intersection if Thc is negative
|
||||||
return 1000000000.0f;
|
return 1000000000.0f;
|
||||||
|
|
||||||
// T0 = Tca - Thc, distance from origin to first intersection
|
// T0 = Tca - Thc, distance from origin to first intersection
|
||||||
float T0 = Tca - sqrt(ThcSq);
|
float T0 = Tca - sqrt(ThcSq);
|
||||||
if (T0 < 0.0 || T0 > ray->MaxDistance)
|
if (T0 < 0.0f || T0 > ray->MaxDistance)
|
||||||
return 1000000000.0f;
|
return 1000000000.0f;
|
||||||
return T0;
|
return T0;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ float maths::ray_intersect_circle(ray_type* ray, circle_type* circle)
|
|||||||
float maths::normalize_2d(vector_type* vec)
|
float maths::normalize_2d(vector_type* vec)
|
||||||
{
|
{
|
||||||
float mag = sqrt(vec->X * vec->X + vec->Y * vec->Y);
|
float mag = sqrt(vec->X * vec->X + vec->Y * vec->Y);
|
||||||
if (0.0 != mag)
|
if (mag != 0.0f)
|
||||||
{
|
{
|
||||||
vec->X = 1.0f / mag * vec->X;
|
vec->X = 1.0f / mag * vec->X;
|
||||||
vec->Y = 1.0f / mag * vec->Y;
|
vec->Y = 1.0f / mag * vec->Y;
|
||||||
@ -179,7 +179,7 @@ void maths::line_init(line_type* line, float x0, float y0, float x1, float y1)
|
|||||||
line->PerpendicularL.X = line->Direction.Y;
|
line->PerpendicularL.X = line->Direction.Y;
|
||||||
line->PerpendicularL.Y = -line->Direction.X;
|
line->PerpendicularL.Y = -line->Direction.X;
|
||||||
line->PreComp1 = -(line->Direction.Y * x0) + line->Direction.X * y0;
|
line->PreComp1 = -(line->Direction.Y * x0) + line->Direction.X * y0;
|
||||||
if (line->Direction.X >= 0.000000001 || line->Direction.X <= -0.000000001)
|
if (line->Direction.X >= 0.000000001f || line->Direction.X <= -0.000000001f)
|
||||||
{
|
{
|
||||||
v9 = x1;
|
v9 = x1;
|
||||||
lineDirection = x0 >= x1;
|
lineDirection = x0 >= x1;
|
||||||
@ -210,7 +210,7 @@ float maths::ray_intersect_line(ray_type* ray, line_type* line)
|
|||||||
bool v6;
|
bool v6;
|
||||||
|
|
||||||
float perpDot = line->PerpendicularL.Y * ray->Direction.Y + ray->Direction.X * line->PerpendicularL.X;
|
float perpDot = line->PerpendicularL.Y * ray->Direction.Y + ray->Direction.X * line->PerpendicularL.X;
|
||||||
if (perpDot < 0.0)
|
if (perpDot < 0.0f)
|
||||||
{
|
{
|
||||||
float result = -((ray->Origin.X * line->PerpendicularL.X + ray->Origin.Y * line->PerpendicularL.Y + line->
|
float result = -((ray->Origin.X * line->PerpendicularL.X + ray->Origin.Y * line->PerpendicularL.Y + line->
|
||||||
PreComp1)
|
PreComp1)
|
||||||
@ -220,7 +220,7 @@ float maths::ray_intersect_line(ray_type* ray, line_type* line)
|
|||||||
line->RayIntersect.X = result * ray->Direction.X + ray->Origin.X;
|
line->RayIntersect.X = result * ray->Direction.X + ray->Origin.X;
|
||||||
float v4 = result * ray->Direction.Y + ray->Origin.Y;
|
float v4 = result * ray->Direction.Y + ray->Origin.Y;
|
||||||
line->RayIntersect.Y = v4;
|
line->RayIntersect.Y = v4;
|
||||||
if (0.0 == line->Direction.X)
|
if (line->Direction.X == 0.0f)
|
||||||
{
|
{
|
||||||
if (v4 >= line->OriginX)
|
if (v4 >= line->OriginX)
|
||||||
{
|
{
|
||||||
@ -256,7 +256,7 @@ float maths::magnitude(vector_type* vec)
|
|||||||
{
|
{
|
||||||
float result;
|
float result;
|
||||||
auto magSq = vec->X * vec->X + vec->Y * vec->Y + vec->Z * vec->Z;
|
auto magSq = vec->X * vec->X + vec->Y * vec->Y + vec->Z * vec->Z;
|
||||||
if (magSq == 0.0)
|
if (magSq == 0.0f)
|
||||||
result = 0.0;
|
result = 0.0;
|
||||||
else
|
else
|
||||||
result = sqrt(magSq);
|
result = sqrt(magSq);
|
||||||
@ -342,7 +342,7 @@ float maths::distance_to_flipper(ray_type* ray1, ray_type* ray2)
|
|||||||
auto distance = 1000000000.0f;
|
auto distance = 1000000000.0f;
|
||||||
auto distanceType = -1;
|
auto distanceType = -1;
|
||||||
auto newDistance = ray_intersect_line(ray1, &TFlipperEdge::lineA);
|
auto newDistance = ray_intersect_line(ray1, &TFlipperEdge::lineA);
|
||||||
if (newDistance < 1000000000.0)
|
if (newDistance < 1000000000.0f)
|
||||||
{
|
{
|
||||||
distance = newDistance;
|
distance = newDistance;
|
||||||
distanceType = 0;
|
distanceType = 0;
|
||||||
@ -365,7 +365,7 @@ float maths::distance_to_flipper(ray_type* ray1, ray_type* ray2)
|
|||||||
distance = newDistance;
|
distance = newDistance;
|
||||||
distanceType = 1;
|
distanceType = 1;
|
||||||
}
|
}
|
||||||
if (!ray2 || distance >= 1000000000.0)
|
if (!ray2 || distance >= 1000000000.0f)
|
||||||
return distance;
|
return distance;
|
||||||
|
|
||||||
if (distanceType != -1)
|
if (distanceType != -1)
|
||||||
|
@ -167,7 +167,7 @@ int midi::load_file(midi_struct** midi_res, void* filePtrOrPath, int fileSizeP,
|
|||||||
returnCode = 1;
|
returnCode = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
midi->Magic = 'ISDM';
|
midi->Magic = mmioFOURCC('M', 'D', 'S', 'I');
|
||||||
midi->StreamHandle = nullptr;
|
midi->StreamHandle = nullptr;
|
||||||
midi->PreparedBlocksCount = 0;
|
midi->PreparedBlocksCount = 0;
|
||||||
|
|
||||||
@ -240,12 +240,12 @@ int midi::read_file(midi_struct* midi, riff_header* filePtr, unsigned fileSize)
|
|||||||
returnCode = 3;
|
returnCode = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (filePtr->Riff != 'FFIR')
|
if (filePtr->Riff != mmioFOURCC('R', 'I', 'F', 'F'))
|
||||||
{
|
{
|
||||||
returnCode = 3;
|
returnCode = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (filePtr->Mids != 'SDIM')
|
if (filePtr->Mids != mmioFOURCC('M', 'I', 'D', 'S'))
|
||||||
{
|
{
|
||||||
returnCode = 3;
|
returnCode = 3;
|
||||||
break;
|
break;
|
||||||
@ -260,7 +260,7 @@ int midi::read_file(midi_struct* midi, riff_header* filePtr, unsigned fileSize)
|
|||||||
returnCode = 3;
|
returnCode = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (filePtr->Fmt != ' tmf')
|
if (filePtr->Fmt != mmioFOURCC('f', 'm', 't', ' '))
|
||||||
{
|
{
|
||||||
returnCode = 3;
|
returnCode = 3;
|
||||||
break;
|
break;
|
||||||
@ -288,7 +288,7 @@ int midi::read_file(midi_struct* midi, riff_header* filePtr, unsigned fileSize)
|
|||||||
|
|
||||||
auto dataChunk = reinterpret_cast<riff_data*>(reinterpret_cast<char*>(&filePtr->dwTimeFormat) + filePtr->FmtSize
|
auto dataChunk = reinterpret_cast<riff_data*>(reinterpret_cast<char*>(&filePtr->dwTimeFormat) + filePtr->FmtSize
|
||||||
);
|
);
|
||||||
if (dataChunk->Data != 'atad')
|
if (dataChunk->Data != mmioFOURCC('d','a','t','a'))
|
||||||
{
|
{
|
||||||
returnCode = 3;
|
returnCode = 3;
|
||||||
break;
|
break;
|
||||||
@ -300,8 +300,8 @@ int midi::read_file(midi_struct* midi, riff_header* filePtr, unsigned fileSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
midi->BlockCount = dataChunk->BlocksPerChunk;
|
midi->BlockCount = dataChunk->BlocksPerChunk;
|
||||||
midi->DataPtr1 = static_cast<midihdr_tag*>(GlobalLock(GlobalAlloc(
|
midi->DataPtr1 = reinterpret_cast<midihdr_tag*>(memory::allocate(
|
||||||
GMEM_DDESHARE | GMEM_MOVEABLE, dataChunk->BlocksPerChunk * (midi->CbMaxBuffer + sizeof(midihdr_tag)))));
|
dataChunk->BlocksPerChunk * (midi->CbMaxBuffer + sizeof(midihdr_tag))));
|
||||||
if (!midi->DataPtr1)
|
if (!midi->DataPtr1)
|
||||||
{
|
{
|
||||||
returnCode = 1;
|
returnCode = 1;
|
||||||
@ -363,8 +363,7 @@ int midi::read_file(midi_struct* midi, riff_header* filePtr, unsigned fileSize)
|
|||||||
|
|
||||||
if (returnCode && midi->DataPtr1)
|
if (returnCode && midi->DataPtr1)
|
||||||
{
|
{
|
||||||
GlobalUnlock(GlobalHandle(midi->DataPtr1));
|
memory::free(midi->DataPtr1);
|
||||||
GlobalFree(GlobalHandle(midi->DataPtr1));
|
|
||||||
}
|
}
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
@ -405,16 +404,15 @@ int midi::stop_ft()
|
|||||||
|
|
||||||
int midi::unload_track(midi_struct* midi)
|
int midi::unload_track(midi_struct* midi)
|
||||||
{
|
{
|
||||||
if (midi->Magic != 'ISDM')
|
if (midi->Magic != mmioFOURCC('M', 'D', 'S', 'I'))
|
||||||
return 6;
|
return 6;
|
||||||
if (midi->StreamHandle)
|
if (midi->StreamHandle)
|
||||||
stream_close(midi);
|
stream_close(midi);
|
||||||
if (midi->DataPtr1)
|
if (midi->DataPtr1)
|
||||||
{
|
{
|
||||||
GlobalUnlock(GlobalHandle(midi->DataPtr1));
|
memory::free(midi->DataPtr1);
|
||||||
GlobalFree(GlobalHandle(midi->DataPtr1));
|
|
||||||
}
|
}
|
||||||
midi->Magic = 'atad';
|
midi->Magic = mmioFOURCC('d','a','t','a');
|
||||||
LocalFree(midi);
|
LocalFree(midi);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -422,7 +420,7 @@ int midi::unload_track(midi_struct* midi)
|
|||||||
int midi::stream_open(midi_struct* midi, char flags)
|
int midi::stream_open(midi_struct* midi, char flags)
|
||||||
{
|
{
|
||||||
auto returnCode = 0;
|
auto returnCode = 0;
|
||||||
if (midi->Magic != 'ISDM')
|
if (midi->Magic != mmioFOURCC('M', 'D', 'S', 'I'))
|
||||||
return 6;
|
return 6;
|
||||||
|
|
||||||
UINT puDeviceID = -1;
|
UINT puDeviceID = -1;
|
||||||
@ -473,7 +471,7 @@ int midi::stream_close(midi_struct* midi)
|
|||||||
{
|
{
|
||||||
int returnCode;
|
int returnCode;
|
||||||
|
|
||||||
if (midi->Magic != 'ISDM')
|
if (midi->Magic != mmioFOURCC('M', 'D', 'S', 'I'))
|
||||||
return 6;
|
return 6;
|
||||||
if (!midi->StreamHandle)
|
if (!midi->StreamHandle)
|
||||||
return 7;
|
return 7;
|
||||||
|
@ -80,12 +80,12 @@ void nudge::_nudge(float xDiff, float yDiff)
|
|||||||
ball->Acceleration.Y = ball->Acceleration.Y * ball->Speed;
|
ball->Acceleration.Y = ball->Acceleration.Y * ball->Speed;
|
||||||
maths::vector_add(&ball->Acceleration, &accelMod);
|
maths::vector_add(&ball->Acceleration, &accelMod);
|
||||||
ball->Speed = maths::normalize_2d(&ball->Acceleration);
|
ball->Speed = maths::normalize_2d(&ball->Acceleration);
|
||||||
if (0.0 == ball->Acceleration.X)
|
if (ball->Acceleration.X == 0.0f)
|
||||||
invAccelX = 1000000000.0;
|
invAccelX = 1000000000.0;
|
||||||
else
|
else
|
||||||
invAccelX = 1.0f / ball->Acceleration.X;
|
invAccelX = 1.0f / ball->Acceleration.X;
|
||||||
ball->InvAcceleration.X = invAccelX;
|
ball->InvAcceleration.X = invAccelX;
|
||||||
if (0.0 == ball->Acceleration.Y)
|
if (ball->Acceleration.Y == 0.0f)
|
||||||
invAccelY = 1000000000.0;
|
invAccelY = 1000000000.0;
|
||||||
else
|
else
|
||||||
invAccelY = 1.0f / ball->Acceleration.Y;
|
invAccelY = 1.0f / ball->Acceleration.Y;
|
||||||
@ -94,6 +94,6 @@ void nudge::_nudge(float xDiff, float yDiff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render::shift(static_cast<int>(floor(xDiff + 0.5)), static_cast<int>(floor(0.5 - yDiff)), 0, 0, table->Width,
|
render::shift(static_cast<int>(floor(xDiff + 0.5f)), static_cast<int>(floor(0.5f - yDiff)), 0, 0, table->Width,
|
||||||
table->Height);
|
table->Height);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ void options::init(HMENU menuHandle)
|
|||||||
auto tmpBuf = memory::allocate(0x1F4u);
|
auto tmpBuf = memory::allocate(0x1F4u);
|
||||||
if (tmpBuf)
|
if (tmpBuf)
|
||||||
{
|
{
|
||||||
get_string(nullptr, "Shell Exe", tmpBuf, pinball::WindowName, 500);
|
get_string(nullptr, "Shell Exe", tmpBuf, "", 500);
|
||||||
if (!*tmpBuf)
|
if (!*tmpBuf)
|
||||||
{
|
{
|
||||||
if (MenuHandle)
|
if (MenuHandle)
|
||||||
|
@ -239,7 +239,7 @@ int pb::frame(int time)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto nudgeDec = nudge::nudge_count - timeMul;
|
auto nudgeDec = nudge::nudge_count - timeMul;
|
||||||
if (nudgeDec <= 0.0)
|
if (nudgeDec <= 0.0f)
|
||||||
nudgeDec = 0.0;
|
nudgeDec = 0.0;
|
||||||
nudge::nudge_count = nudgeDec;
|
nudge::nudge_count = nudgeDec;
|
||||||
}
|
}
|
||||||
@ -248,11 +248,11 @@ int pb::frame(int time)
|
|||||||
score::update(MainTable->CurScoreStruct);
|
score::update(MainTable->CurScoreStruct);
|
||||||
if (!MainTable->TiltLockFlag)
|
if (!MainTable->TiltLockFlag)
|
||||||
{
|
{
|
||||||
if (nudge::nudge_count > 0.5)
|
if (nudge::nudge_count > 0.5f)
|
||||||
{
|
{
|
||||||
pinball::InfoTextBox->Display(pinball::get_rc_string(25, 0), 2.0);
|
pinball::InfoTextBox->Display(pinball::get_rc_string(25, 0), 2.0);
|
||||||
}
|
}
|
||||||
if (nudge::nudge_count > 1.0)
|
if (nudge::nudge_count > 1.0f)
|
||||||
MainTable->tilt(time_now);
|
MainTable->tilt(time_now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -288,13 +288,13 @@ void pb::timed_frame(float timeNow, float timeDelta, bool drawBalls)
|
|||||||
ball->Acceleration.Y = ball->Speed * ball->Acceleration.Y;
|
ball->Acceleration.Y = ball->Speed * ball->Acceleration.Y;
|
||||||
maths::vector_add(&ball->Acceleration, &vec2);
|
maths::vector_add(&ball->Acceleration, &vec2);
|
||||||
ball->Speed = maths::normalize_2d(&ball->Acceleration);
|
ball->Speed = maths::normalize_2d(&ball->Acceleration);
|
||||||
ball->InvAcceleration.X = ball->Acceleration.X == 0.0 ? 1000000000.0f : 1.0f / ball->Acceleration.X;
|
ball->InvAcceleration.X = ball->Acceleration.X == 0.0f ? 1000000000.0f : 1.0f / ball->Acceleration.X;
|
||||||
ball->InvAcceleration.Y = ball->Acceleration.Y == 0.0 ? 1000000000.0f : 1.0f / ball->Acceleration.Y;
|
ball->InvAcceleration.Y = ball->Acceleration.Y == 0.0f ? 1000000000.0f : 1.0f / ball->Acceleration.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto timeDelta2 = timeDelta;
|
auto timeDelta2 = timeDelta;
|
||||||
auto timeNow2 = timeNow;
|
auto timeNow2 = timeNow;
|
||||||
for (auto index = 10; timeDelta2 > 0.000001 && index; --index)
|
for (auto index = 10; timeDelta2 > 0.000001f && index; --index)
|
||||||
{
|
{
|
||||||
auto time = collide(timeNow2, timeDelta2, ball);
|
auto time = collide(timeNow2, timeDelta2, ball);
|
||||||
timeDelta2 -= time;
|
timeDelta2 -= time;
|
||||||
@ -632,7 +632,7 @@ float pb::collide(float timeNow, float timeDelta, TBall* ball)
|
|||||||
TEdgeSegment* edge = nullptr;
|
TEdgeSegment* edge = nullptr;
|
||||||
auto distance = TTableLayer::edge_manager->FindCollisionDistance(&ray, ball, &edge);
|
auto distance = TTableLayer::edge_manager->FindCollisionDistance(&ray, ball, &edge);
|
||||||
ball->EdgeCollisionCount = 0;
|
ball->EdgeCollisionCount = 0;
|
||||||
if (distance >= 1000000000.0)
|
if (distance >= 1000000000.0f)
|
||||||
{
|
{
|
||||||
maxDistance = timeDelta * ball->Speed;
|
maxDistance = timeDelta * ball->Speed;
|
||||||
ball->RayMaxDistance = maxDistance;
|
ball->RayMaxDistance = maxDistance;
|
||||||
@ -644,7 +644,7 @@ float pb::collide(float timeNow, float timeDelta, TBall* ball)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
edge->EdgeCollision(ball, distance);
|
edge->EdgeCollision(ball, distance);
|
||||||
if (ball->Speed > 0.000000001)
|
if (ball->Speed > 0.000000001f)
|
||||||
return fabs(distance / ball->Speed);
|
return fabs(distance / ball->Speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ TTextBox* pinball::InfoTextBox;
|
|||||||
TTextBox* pinball::MissTextBox;
|
TTextBox* pinball::MissTextBox;
|
||||||
char pinball::getRcBuffer[6 * 256];
|
char pinball::getRcBuffer[6 * 256];
|
||||||
int pinball::rc_string_slot = 0;
|
int pinball::rc_string_slot = 0;
|
||||||
char pinball::WindowName[2]{};
|
|
||||||
int pinball::LeftShift = -1;
|
int pinball::LeftShift = -1;
|
||||||
int pinball::RightShift = -1;
|
int pinball::RightShift = -1;
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ public:
|
|||||||
static int quickFlag;
|
static int quickFlag;
|
||||||
static TTextBox* InfoTextBox;
|
static TTextBox* InfoTextBox;
|
||||||
static TTextBox* MissTextBox;
|
static TTextBox* MissTextBox;
|
||||||
static char WindowName[2];
|
|
||||||
static int RightShift;
|
static int RightShift;
|
||||||
static int LeftShift;
|
static int LeftShift;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ void proj::xform_to_2d(vector_type* vec, int* dst)
|
|||||||
vector_type dstVec2{};
|
vector_type dstVec2{};
|
||||||
|
|
||||||
matrix_vector_multiply(&matrix, vec, &dstVec2);
|
matrix_vector_multiply(&matrix, vec, &dstVec2);
|
||||||
if (0.0 == dstVec2.Z)
|
if (dstVec2.Z == 0.0f)
|
||||||
projCoef = 999999.88f;
|
projCoef = 999999.88f;
|
||||||
else
|
else
|
||||||
projCoef = d_ / dstVec2.Z;
|
projCoef = d_ / dstVec2.Z;
|
||||||
|
@ -253,7 +253,7 @@ void score::update(scoreStruct* score)
|
|||||||
{
|
{
|
||||||
unsigned char curChar = scoreBuf[index];
|
unsigned char curChar = scoreBuf[index];
|
||||||
curChar -= '0';
|
curChar -= '0';
|
||||||
gdrv_bitmap8* bmp = score->CharBmp[curChar];
|
gdrv_bitmap8* bmp = score->CharBmp[curChar % 10];
|
||||||
x -= bmp->Width;
|
x -= bmp->Width;
|
||||||
int height = bmp->Height;
|
int height = bmp->Height;
|
||||||
int width = bmp->Width;
|
int width = bmp->Width;
|
||||||
|
@ -30,12 +30,12 @@ splash_struct* splash::splash_screen(HINSTANCE hInstance, LPCSTR bmpName1, LPCST
|
|||||||
WndClass.hIcon = nullptr;
|
WndClass.hIcon = nullptr;
|
||||||
WndClass.hCursor = LoadCursorA(nullptr, IDC_ARROW);
|
WndClass.hCursor = LoadCursorA(nullptr, IDC_ARROW);
|
||||||
WndClass.hbrBackground = nullptr;
|
WndClass.hbrBackground = nullptr;
|
||||||
WndClass.lpszMenuName = pinball::WindowName;
|
WndClass.lpszMenuName = "";
|
||||||
WndClass.lpszClassName = "3DPB_SPLASH_CLASS";
|
WndClass.lpszClassName = "3DPB_SPLASH_CLASS";
|
||||||
RegisterClassA(&WndClass);
|
RegisterClassA(&WndClass);
|
||||||
}
|
}
|
||||||
splashStruct->Bitmap = nullptr;
|
splashStruct->Bitmap = nullptr;
|
||||||
HWND windowHandle = CreateWindowExA(0, "3DPB_SPLASH_CLASS", pinball::WindowName, 0x80000000, -10, -10, 1, 1,
|
HWND windowHandle = CreateWindowExA(0, "3DPB_SPLASH_CLASS", "", 0x80000000, -10, -10, 1, 1,
|
||||||
nullptr, nullptr, HInstance, nullptr);
|
nullptr, nullptr, HInstance, nullptr);
|
||||||
splashStruct->WindowHandle = windowHandle;
|
splashStruct->WindowHandle = windowHandle;
|
||||||
if (!windowHandle)
|
if (!windowHandle)
|
||||||
@ -284,12 +284,15 @@ LRESULT splash::splash_message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LPARA
|
|||||||
BeginPaint(hWnd, &Paint);
|
BeginPaint(hWnd, &Paint);
|
||||||
EndPaint(hWnd, &Paint);
|
EndPaint(hWnd, &Paint);
|
||||||
auto dc = GetDC(hWnd);
|
auto dc = GetDC(hWnd);
|
||||||
if (dc && splashStruct)
|
if (dc)
|
||||||
{
|
{
|
||||||
BitBlt(dc, 0, 0, 10000, 10000, dc, 0, 0, BLACKNESS);
|
if (splashStruct)
|
||||||
splash_paint(splashStruct, dc);
|
{
|
||||||
|
BitBlt(dc, 0, 0, 10000, 10000, dc, 0, 0, BLACKNESS);
|
||||||
|
splash_paint(splashStruct, dc);
|
||||||
|
}
|
||||||
|
ReleaseDC(hWnd, dc);
|
||||||
}
|
}
|
||||||
ReleaseDC(hWnd, dc);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
|
@ -75,10 +75,10 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||||||
for (int i = 0; i < 32700; ++i)
|
for (int i = 0; i < 32700; ++i)
|
||||||
{
|
{
|
||||||
sprintf_s(Buffer, "Table%d", i);
|
sprintf_s(Buffer, "Table%d", i);
|
||||||
options::get_string(nullptr, Buffer, tmpBuf, pinball::WindowName, 500);
|
options::get_string(nullptr, Buffer, tmpBuf, "", 500);
|
||||||
if (!*tmpBuf)
|
if (!*tmpBuf)
|
||||||
break;
|
break;
|
||||||
options::get_string(tmpBuf, "Table Name", tmpBuf2, pinball::WindowName, 500);
|
options::get_string(tmpBuf, "Table Name", tmpBuf2, "", 500);
|
||||||
if (!lstrcmpA(tmpBuf2, pinball::get_rc_string(169, 0)))
|
if (!lstrcmpA(tmpBuf2, pinball::get_rc_string(169, 0)))
|
||||||
{
|
{
|
||||||
setOption = false;
|
setOption = false;
|
||||||
@ -102,7 +102,7 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||||||
options::path_uninit();
|
options::path_uninit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
options::get_string(regSpaceCadet, "Shell Exe", tmpBuf, pinball::WindowName, 500);
|
options::get_string(regSpaceCadet, "Shell Exe", tmpBuf, "", 500);
|
||||||
auto execRes = WinExec(tmpBuf, 5u);
|
auto execRes = WinExec(tmpBuf, 5u);
|
||||||
memory::free(tmpBuf);
|
memory::free(tmpBuf);
|
||||||
if (execRes >= 32)
|
if (execRes >= 32)
|
||||||
@ -578,7 +578,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
|
|||||||
if (tmpBuf)
|
if (tmpBuf)
|
||||||
{
|
{
|
||||||
char cmdLine[0x1F4u];
|
char cmdLine[0x1F4u];
|
||||||
options::get_string(nullptr, "Shell Exe", tmpBuf, pinball::WindowName, 500);
|
options::get_string(nullptr, "Shell Exe", tmpBuf, "", 500);
|
||||||
auto iHwnd = reinterpret_cast<size_t>(hwnd_frame);
|
auto iHwnd = reinterpret_cast<size_t>(hwnd_frame);
|
||||||
sprintf_s(
|
sprintf_s(
|
||||||
cmdLine,
|
cmdLine,
|
||||||
|
Loading…
Reference in New Issue
Block a user