Added linear filter option for vScreen texture.
Rollback blit to backing storage – its persistence is not guaranteed. Added project URL to About dialog. Added source ports table to readme.
This commit is contained in:
@@ -60,7 +60,6 @@ set(SOURCE_FILES
|
||||
SpaceCadetPinball/proj.h
|
||||
SpaceCadetPinball/render.cpp
|
||||
SpaceCadetPinball/render.h
|
||||
SpaceCadetPinball/resource.h
|
||||
SpaceCadetPinball/score.cpp
|
||||
SpaceCadetPinball/score.h
|
||||
SpaceCadetPinball/Sound.cpp
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
|
||||
**How to play:** Place compiled executable into a folder containing original game resources (not included).\
|
||||
Supports data files from Windows and Full Tilt versions of the game.
|
||||
|
||||
**Known source ports:**
|
||||
| Platform | Author | URL |
|
||||
| --- | --- | --- |
|
||||
| PS Vita | Axiom | <https://github.com/suicvne/SpaceCadetPinball_Vita> |
|
||||
Platforms covered by this project: desktop Windows and Linux.
|
||||
\
|
||||
\
|
||||
\
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "GroupData.h"
|
||||
#include "memory.h"
|
||||
#include "options.h"
|
||||
#include "partman.h"
|
||||
#include "pb.h"
|
||||
#include "score.h"
|
||||
@@ -16,26 +17,19 @@ SDL_Rect gdrv::DestinationRect{};
|
||||
|
||||
int gdrv::init(int width, int height)
|
||||
{
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
vScreenTex = SDL_CreateTexture
|
||||
(
|
||||
winmain::Renderer,
|
||||
SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_TEXTUREACCESS_STREAMING,
|
||||
width, height
|
||||
);
|
||||
{
|
||||
UsingSdlHint hint{SDL_HINT_RENDER_SCALE_QUALITY, options::Options.LinearFiltering ? "linear" : "nearest"};
|
||||
vScreenTex = SDL_CreateTexture
|
||||
(
|
||||
winmain::Renderer,
|
||||
SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_TEXTUREACCESS_STREAMING,
|
||||
width, height
|
||||
);
|
||||
}
|
||||
vScreenWidth = width;
|
||||
vScreenHeight = height;
|
||||
|
||||
int pitch = 0;
|
||||
SDL_LockTexture
|
||||
(
|
||||
vScreenTex,
|
||||
nullptr,
|
||||
reinterpret_cast<void**>(&vScreenPixels),
|
||||
&pitch
|
||||
);
|
||||
assertm(pitch = width* sizeof(ColorRgba), "gdrv: wrong pitch of SDL texture");
|
||||
vScreenPixels = new ColorRgba[width * height];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -43,6 +37,7 @@ int gdrv::init(int width, int height)
|
||||
int gdrv::uninit()
|
||||
{
|
||||
SDL_DestroyTexture(vScreenTex);
|
||||
delete[] vScreenPixels;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -322,15 +317,17 @@ int gdrv::StretchDIBitsScaled(int xSrc, int ySrc, int xDst, int yDst,
|
||||
void gdrv::BlitScreen()
|
||||
{
|
||||
int pitch = 0;
|
||||
SDL_UnlockTexture(vScreenTex);
|
||||
SDL_RenderCopy(winmain::Renderer, vScreenTex, nullptr, &DestinationRect);
|
||||
void* lockedPixels;
|
||||
SDL_LockTexture
|
||||
(
|
||||
vScreenTex,
|
||||
nullptr,
|
||||
reinterpret_cast<void**>(&vScreenPixels),
|
||||
&lockedPixels,
|
||||
&pitch
|
||||
);
|
||||
std::memcpy(lockedPixels, vScreenPixels, vScreenWidth * vScreenHeight * sizeof(ColorRgba));
|
||||
SDL_UnlockTexture(vScreenTex);
|
||||
SDL_RenderCopy(winmain::Renderer, vScreenTex, nullptr, &DestinationRect);
|
||||
}
|
||||
|
||||
void gdrv::ApplyPalette(gdrv_bitmap8& bmp)
|
||||
@@ -357,7 +354,6 @@ void gdrv::CreatePreview(gdrv_bitmap8& bmp)
|
||||
if (bmp.Texture)
|
||||
return;
|
||||
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||
auto texture = SDL_CreateTexture
|
||||
(
|
||||
winmain::Renderer,
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "memory.h"
|
||||
#include "midi.h"
|
||||
#include "pb.h"
|
||||
#include "pinball.h"
|
||||
#include "resource.h"
|
||||
#include "Sound.h"
|
||||
#include "winmain.h"
|
||||
|
||||
@@ -101,6 +99,7 @@ void options::init()
|
||||
Options.UniformScaling = get_int("Uniform scaling", Options.UniformScaling);
|
||||
ImGui::GetIO().FontGlobalScale = get_float("UI Scale", 1.0f);
|
||||
Options.Resolution = get_int("Screen Resolution", -1);
|
||||
Options.LinearFiltering = get_int("Linear Filtering", true);
|
||||
|
||||
Sound::Enable(0, 7, Options.Sounds);
|
||||
|
||||
@@ -125,6 +124,7 @@ void options::uninit()
|
||||
set_int("Screen Resolution", Options.Resolution);
|
||||
set_int("Uniform scaling", Options.UniformScaling);
|
||||
set_float("UI Scale", ImGui::GetIO().FontGlobalScale);
|
||||
set_int("Linear Filtering", Options.LinearFiltering);
|
||||
}
|
||||
|
||||
|
||||
@@ -161,17 +161,17 @@ void options::set_float(LPCSTR lpValueName, float data)
|
||||
}
|
||||
|
||||
|
||||
void options::toggle(uint32_t uIDCheckItem)
|
||||
void options::toggle(Menu1 uIDCheckItem)
|
||||
{
|
||||
int newValue;
|
||||
switch (uIDCheckItem)
|
||||
{
|
||||
case Menu1_Sounds:
|
||||
case Menu1::Sounds:
|
||||
newValue = Options.Sounds == 0;
|
||||
Options.Sounds = Options.Sounds == 0;
|
||||
Sound::Enable(0, 7, newValue);
|
||||
return;
|
||||
case Menu1_Music:
|
||||
case Menu1::Music:
|
||||
newValue = Options.Music == 0;
|
||||
Options.Music = Options.Music == 0;
|
||||
if (!newValue)
|
||||
@@ -179,25 +179,25 @@ void options::toggle(uint32_t uIDCheckItem)
|
||||
else
|
||||
midi::play_pb_theme(0);
|
||||
return;
|
||||
case Menu1_Full_Screen:
|
||||
case Menu1::Full_Screen:
|
||||
newValue = Options.FullScreen == 0;
|
||||
Options.FullScreen = Options.FullScreen == 0;
|
||||
fullscrn::set_screen_mode(newValue);
|
||||
return;
|
||||
case Menu1_1Player:
|
||||
case Menu1_2Players:
|
||||
case Menu1_3Players:
|
||||
case Menu1_4Players:
|
||||
Options.Players = uIDCheckItem - Menu1_1Player + 1;
|
||||
case Menu1::OnePlayer:
|
||||
case Menu1::TwoPlayers:
|
||||
case Menu1::ThreePlayers:
|
||||
case Menu1::FourPlayers:
|
||||
Options.Players = static_cast<int>(uIDCheckItem) - static_cast<int>(Menu1::OnePlayer) + 1;
|
||||
break;
|
||||
case Menu1_MaximumResolution:
|
||||
case Menu1_640x480:
|
||||
case Menu1_800x600:
|
||||
case Menu1_1024x768:
|
||||
case Menu1::MaximumResolution:
|
||||
case Menu1::R640x480:
|
||||
case Menu1::R800x600:
|
||||
case Menu1::R1024x768:
|
||||
{
|
||||
auto restart = false;
|
||||
int newResolution = uIDCheckItem - Menu1_640x480;
|
||||
if (uIDCheckItem == Menu1_MaximumResolution)
|
||||
int newResolution = static_cast<int>(uIDCheckItem) - static_cast<int>(Menu1::R640x480);
|
||||
if (uIDCheckItem == Menu1::MaximumResolution)
|
||||
{
|
||||
restart = fullscrn::GetResolution() != fullscrn::GetMaxResolution();
|
||||
Options.Resolution = -1;
|
||||
@@ -214,11 +214,15 @@ void options::toggle(uint32_t uIDCheckItem)
|
||||
winmain::Restart();
|
||||
break;
|
||||
}
|
||||
case Menu1_WindowUniformScale:
|
||||
case Menu1::WindowUniformScale:
|
||||
Options.UniformScaling ^= true;
|
||||
fullscrn::window_size_changed();
|
||||
pb::paint();
|
||||
break;
|
||||
case Menu1::WindowLinearFilter:
|
||||
Options.LinearFiltering ^= true;
|
||||
winmain::Restart();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,33 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
|
||||
enum class Menu1:int
|
||||
{
|
||||
New_Game = 101,
|
||||
About_Pinball = 102,
|
||||
High_Scores = 103,
|
||||
Exit = 105,
|
||||
Sounds = 201,
|
||||
Music = 202,
|
||||
Help_Topics = 301,
|
||||
Launch_Ball = 401,
|
||||
Pause_Resume_Game = 402,
|
||||
Full_Screen = 403,
|
||||
Demo = 404,
|
||||
Select_Table = 405,
|
||||
Player_Controls = 406,
|
||||
OnePlayer = 408,
|
||||
TwoPlayers = 409,
|
||||
ThreePlayers = 410,
|
||||
FourPlayers = 411,
|
||||
MaximumResolution = 500,
|
||||
R640x480 = 501,
|
||||
R800x600 = 502,
|
||||
R1024x768 = 503,
|
||||
WindowUniformScale = 600,
|
||||
WindowLinearFilter = 601,
|
||||
};
|
||||
|
||||
struct optionsStruct
|
||||
{
|
||||
int Sounds;
|
||||
@@ -21,6 +48,7 @@ struct optionsStruct
|
||||
int BottomTableBumpKeyDft;
|
||||
int Resolution;
|
||||
bool UniformScaling;
|
||||
bool LinearFiltering;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +65,7 @@ public:
|
||||
static void set_string(LPCSTR lpValueName, LPCSTR value);
|
||||
static float get_float(LPCSTR lpValueName, float defaultValue);
|
||||
static void set_float(LPCSTR lpValueName, float data);
|
||||
static void toggle(uint32_t uIDCheckItem);
|
||||
static void toggle(Menu1 uIDCheckItem);
|
||||
|
||||
static void keyboard();
|
||||
private:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "options.h"
|
||||
#include "timer.h"
|
||||
#include "winmain.h"
|
||||
#include "resource.h"
|
||||
#include "Sound.h"
|
||||
#include "TBall.h"
|
||||
#include "TDemo.h"
|
||||
|
||||
@@ -5,6 +5,30 @@ class TPinballTable;
|
||||
class DatFile;
|
||||
class TBall;
|
||||
|
||||
class UsingSdlHint
|
||||
{
|
||||
public:
|
||||
explicit UsingSdlHint(const char* name, const char* value)
|
||||
: HintName(name)
|
||||
{
|
||||
auto originalValue = SDL_GetHint(name);
|
||||
if (originalValue)
|
||||
strncpy(OriginalValue, originalValue, sizeof OriginalValue - 1);
|
||||
|
||||
SDL_SetHint(name, value);
|
||||
}
|
||||
|
||||
~UsingSdlHint()
|
||||
{
|
||||
if (OriginalValue[0])
|
||||
SDL_SetHint(HintName, OriginalValue);
|
||||
}
|
||||
|
||||
private:
|
||||
char OriginalValue[40]{};
|
||||
const char* HintName;
|
||||
};
|
||||
|
||||
class pb
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,253 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by SpaceCadetPinball.rc
|
||||
//
|
||||
#define IDS_STRING101 0
|
||||
#define IDS_STRING102 1
|
||||
#define DLG_HIGHSCORES_Ok 1
|
||||
#define KEYMAPPER_Ok 1
|
||||
#define IDS_STRING103 2
|
||||
#define DLG_HIGHSCORES_Cancel 2
|
||||
#define KEYMAPPER_Cancel 2
|
||||
#define IDS_STRING104 3
|
||||
#define IDS_STRING105 4
|
||||
#define IDS_STRING106 5
|
||||
#define IDS_STRING107 6
|
||||
#define IDS_STRING108 7
|
||||
#define IDS_STRING109 8
|
||||
#define IDS_STRING110 9
|
||||
#define IDS_STRING111 10
|
||||
#define IDS_STRING112 11
|
||||
#define IDS_STRING113 12
|
||||
#define IDS_STRING114 13
|
||||
#define IDS_STRING115 14
|
||||
#define IDS_STRING116 15
|
||||
#define IDS_STRING117 16
|
||||
#define IDS_STRING118 17
|
||||
#define IDS_STRING119 18
|
||||
#define IDS_STRING120 19
|
||||
#define IDS_STRING121 20
|
||||
#define IDS_STRING122 21
|
||||
#define IDS_STRING123 22
|
||||
#define IDS_STRING124 23
|
||||
#define IDS_STRING125 24
|
||||
#define IDS_STRING126 25
|
||||
#define IDS_STRING127 26
|
||||
#define IDS_STRING128 27
|
||||
#define IDS_STRING129 28
|
||||
#define IDS_STRING130 29
|
||||
#define IDS_STRING131 30
|
||||
#define IDS_STRING132 31
|
||||
#define IDS_STRING133 32
|
||||
#define IDS_STRING134 33
|
||||
#define IDS_STRING135 34
|
||||
#define IDS_STRING136 35
|
||||
#define IDS_STRING137 36
|
||||
#define IDS_STRING138 37
|
||||
#define IDS_STRING139 38
|
||||
#define IDS_STRING140 39
|
||||
#define IDS_STRING141 40
|
||||
#define IDS_STRING142 41
|
||||
#define IDS_STRING143 42
|
||||
#define IDS_STRING144 43
|
||||
#define IDS_STRING145 44
|
||||
#define IDS_STRING146 45
|
||||
#define IDS_STRING147 46
|
||||
#define IDS_STRING148 47
|
||||
#define IDS_STRING149 48
|
||||
#define IDS_STRING150 49
|
||||
#define IDS_STRING151 50
|
||||
#define IDS_STRING152 51
|
||||
#define IDS_STRING153 52
|
||||
#define IDS_STRING154 53
|
||||
#define IDS_STRING155 54
|
||||
#define IDS_STRING156 55
|
||||
#define IDS_STRING157 56
|
||||
#define IDS_STRING158 57
|
||||
#define IDS_STRING159 58
|
||||
#define IDS_STRING160 59
|
||||
#define IDS_STRING161 60
|
||||
#define IDS_STRING162 61
|
||||
#define IDS_STRING163 62
|
||||
#define IDS_STRING164 63
|
||||
#define IDS_STRING165 64
|
||||
#define IDS_STRING166 65
|
||||
#define IDS_STRING167 66
|
||||
#define IDS_STRING168 67
|
||||
#define IDS_STRING169 68
|
||||
#define IDS_STRING170 69
|
||||
#define IDS_STRING171 70
|
||||
#define IDS_STRING172 71
|
||||
#define IDS_STRING173 72
|
||||
#define IDS_STRING174 73
|
||||
#define IDS_STRING175 74
|
||||
#define IDS_STRING176 75
|
||||
#define IDS_STRING177 76
|
||||
#define IDS_STRING178 77
|
||||
#define IDS_STRING179 78
|
||||
#define IDS_STRING180 79
|
||||
#define IDS_STRING181 80
|
||||
#define IDS_STRING182 81
|
||||
#define IDS_STRING183 82
|
||||
#define IDS_STRING184 83
|
||||
#define IDS_STRING185 84
|
||||
#define IDS_STRING186 85
|
||||
#define IDS_STRING187 86
|
||||
#define IDS_STRING188 87
|
||||
#define IDS_STRING189 88
|
||||
#define IDS_STRING190 89
|
||||
#define IDS_STRING191 90
|
||||
#define IDS_STRING192 91
|
||||
#define IDS_STRING193 92
|
||||
#define IDS_STRING194 93
|
||||
#define IDS_STRING195 94
|
||||
#define IDS_STRING196 95
|
||||
#define IDS_STRING197 96
|
||||
#define IDS_STRING198 97
|
||||
#define IDS_STRING199 98
|
||||
#define IDS_STRING200 99
|
||||
#define IDS_STRING201 100
|
||||
#define IDS_STRING202 101
|
||||
#define Menu1_New_Game 101
|
||||
#define IDS_STRING203 102
|
||||
#define Menu1_About_Pinball 102
|
||||
#define IDS_STRING204 103
|
||||
#define Menu1_High_Scores 103
|
||||
#define IDS_STRING205 104
|
||||
#define IDS_STRING206 105
|
||||
#define Menu1_Exit 105
|
||||
#define IDS_STRING207 106
|
||||
#define IDS_STRING208 107
|
||||
#define IDS_STRING209 108
|
||||
#define IDS_STRING210 109
|
||||
#define IDS_STRING211 110
|
||||
#define IDS_STRING212 111
|
||||
#define IDS_STRING213 112
|
||||
#define DLG_HIGHSCORES_Clear 112
|
||||
#define IDS_STRING214 113
|
||||
#define IDS_STRING215 114
|
||||
#define IDS_STRING216 115
|
||||
#define IDS_STRING217 116
|
||||
#define IDS_STRING218 117
|
||||
#define IDS_STRING219 118
|
||||
#define IDS_STRING220 119
|
||||
#define IDS_STRING221 120
|
||||
#define IDS_STRING222 121
|
||||
#define IDS_STRING223 122
|
||||
#define IDS_STRING224 123
|
||||
#define IDS_STRING225 124
|
||||
#define IDS_STRING226 125
|
||||
#define IDS_STRING227 126
|
||||
#define IDS_STRING228 127
|
||||
#define IDS_STRING229 128
|
||||
#define IDS_STRING230 129
|
||||
#define IDS_STRING231 130
|
||||
#define IDS_STRING232 131
|
||||
#define IDS_STRING233 132
|
||||
#define IDS_STRING234 133
|
||||
#define IDS_STRING235 134
|
||||
#define IDS_STRING236 135
|
||||
#define IDS_STRING237 136
|
||||
#define IDS_STRING238 137
|
||||
#define IDS_STRING239 138
|
||||
#define IDS_STRING240 139
|
||||
#define IDS_STRING241 140
|
||||
#define IDS_STRING242 141
|
||||
#define IDS_STRING243 142
|
||||
#define IDS_STRING244 143
|
||||
#define IDS_STRING245 144
|
||||
#define IDS_STRING246 145
|
||||
#define IDS_STRING247 146
|
||||
#define IDS_STRING248 147
|
||||
#define IDS_STRING249 148
|
||||
#define IDS_STRING250 149
|
||||
#define IDS_STRING251 150
|
||||
#define IDS_STRING252 151
|
||||
#define IDS_STRING253 152
|
||||
#define IDS_STRING254 153
|
||||
#define IDS_STRING255 154
|
||||
#define IDS_STRING256 155
|
||||
#define IDS_STRING257 156
|
||||
#define IDS_STRING258 158
|
||||
#define IDS_STRING259 159
|
||||
#define IDS_STRING260 160
|
||||
#define IDS_STRING261 161
|
||||
#define IDS_STRING262 162
|
||||
#define IDS_STRING263 163
|
||||
#define IDS_STRING264 164
|
||||
#define IDS_STRING265 165
|
||||
#define IDS_STRING266 166
|
||||
#define IDS_STRING267 167
|
||||
#define IDS_STRING268 168
|
||||
#define IDS_STRING269 169
|
||||
#define IDS_STRING270 170
|
||||
#define IDS_STRING271 171
|
||||
#define IDS_STRING272 172
|
||||
#define IDS_STRING273 173
|
||||
#define IDS_STRING274 174
|
||||
#define IDS_STRING275 175
|
||||
#define IDS_STRING276 176
|
||||
#define IDS_STRING277 177
|
||||
#define IDS_STRING278 178
|
||||
#define IDS_STRING279 179
|
||||
#define IDS_STRING280 180
|
||||
#define IDS_STRING281 181
|
||||
#define IDS_STRING282 182
|
||||
#define IDS_STRING283 183
|
||||
#define IDS_STRING284 184
|
||||
#define IDS_STRING285 185
|
||||
#define IDS_STRING286 186
|
||||
#define IDS_STRING287 187
|
||||
#define IDS_STRING288 188
|
||||
#define IDS_STRING289 189
|
||||
#define Menu1_Sounds 201
|
||||
#define Menu1_Music 202
|
||||
#define Menu1_Help_Topics 301
|
||||
#define Menu1_Launch_Ball 401
|
||||
#define DLG_HIGHSCORES_StaticName1 401
|
||||
#define KEYMAPPER_FlipperL 401
|
||||
#define Menu1_Pause_Resume_Game 402
|
||||
#define DLG_HIGHSCORES_StaticName2 402
|
||||
#define KEYMAPPER_FlipperR 402
|
||||
#define Menu1_Full_Screen 403
|
||||
#define DLG_HIGHSCORES_StaticName3 403
|
||||
#define KEYMAPPER_Plunger 403
|
||||
#define Menu1_Demo 404
|
||||
#define DLG_HIGHSCORES_StaticName4 404
|
||||
#define KEYMAPPER_BumpLeft 404
|
||||
#define Menu1_Select_Table 405
|
||||
#define DLG_HIGHSCORES_StaticName5 405
|
||||
#define KEYMAPPER_BumpRight 405
|
||||
#define Menu1_Player_Controls 406
|
||||
#define KEYMAPPER_BumpBottom 406
|
||||
#define Menu1_1Player 408
|
||||
#define Menu1_2Players 409
|
||||
#define Menu1_3Players 410
|
||||
#define Menu1_4Players 411
|
||||
#define Menu1_MaximumResolution 500
|
||||
#define DLG_HIGHSCORES_Score1 501
|
||||
#define KEYMAPPER_Default 501
|
||||
#define Menu1_640x480 501
|
||||
#define DLG_HIGHSCORES_Score2 502
|
||||
#define Menu1_800x600 502
|
||||
#define DLG_HIGHSCORES_Score3 503
|
||||
#define Menu1_1024x768 503
|
||||
#define DLG_HIGHSCORES_Score4 504
|
||||
#define DLG_HIGHSCORES_Score5 505
|
||||
#define Menu1_WindowUniformScale 600
|
||||
#define DLG_HIGHSCORES_EditName1 601
|
||||
#define DLG_HIGHSCORES_EditName2 602
|
||||
#define DLG_HIGHSCORES_EditName3 603
|
||||
#define DLG_HIGHSCORES_EditName4 604
|
||||
#define DLG_HIGHSCORES_EditName5 605
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 204
|
||||
#define _APS_NEXT_COMMAND_VALUE 40006
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 104
|
||||
#endif
|
||||
#endif
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "pb.h"
|
||||
#include "render.h"
|
||||
#include "Sound.h"
|
||||
#include "resource.h"
|
||||
|
||||
const double TargetFps = 60, TargetFrameTime = 1000 / TargetFps;
|
||||
|
||||
@@ -42,6 +41,7 @@ bool winmain::LaunchBallEnabled = true;
|
||||
bool winmain::HighScoresEnabled = true;
|
||||
bool winmain::DemoActive = false;
|
||||
char* winmain::BasePath;
|
||||
std::string winmain::FpsDetails;
|
||||
|
||||
|
||||
uint32_t timeGetTimeAlt()
|
||||
@@ -109,6 +109,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
||||
return 1;
|
||||
}
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||
|
||||
// ImGui init
|
||||
IMGUI_CHECKVERSION();
|
||||
@@ -186,6 +187,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
||||
snprintf(buf, sizeof buf, "Updates/sec = %02.02f Frames/sec = %02.02f ",
|
||||
300.0f / elapsedSec, frameCounter / elapsedSec);
|
||||
SDL_SetWindowTitle(window, buf);
|
||||
FpsDetails = buf;
|
||||
frameCounter = 0;
|
||||
|
||||
if (DispGRhistory)
|
||||
@@ -366,28 +368,28 @@ void winmain::RenderUi()
|
||||
{
|
||||
if (ImGui::MenuItem("Full Screen", "F4", options::Options.FullScreen))
|
||||
{
|
||||
options::toggle(Menu1_Full_Screen);
|
||||
options::toggle(Menu1::Full_Screen);
|
||||
}
|
||||
if (ImGui::BeginMenu("Select Players"))
|
||||
{
|
||||
if (ImGui::MenuItem("1 Player", nullptr, options::Options.Players == 1))
|
||||
{
|
||||
options::toggle(Menu1_1Player);
|
||||
options::toggle(Menu1::OnePlayer);
|
||||
new_game();
|
||||
}
|
||||
if (ImGui::MenuItem("2 Players", nullptr, options::Options.Players == 2))
|
||||
{
|
||||
options::toggle(Menu1_2Players);
|
||||
options::toggle(Menu1::TwoPlayers);
|
||||
new_game();
|
||||
}
|
||||
if (ImGui::MenuItem("3 Players", nullptr, options::Options.Players == 3))
|
||||
{
|
||||
options::toggle(Menu1_3Players);
|
||||
options::toggle(Menu1::ThreePlayers);
|
||||
new_game();
|
||||
}
|
||||
if (ImGui::MenuItem("4 Players", nullptr, options::Options.Players == 4))
|
||||
{
|
||||
options::toggle(Menu1_4Players);
|
||||
options::toggle(Menu1::FourPlayers);
|
||||
new_game();
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
@@ -396,11 +398,11 @@ void winmain::RenderUi()
|
||||
|
||||
if (ImGui::MenuItem("Sound", nullptr, options::Options.Sounds))
|
||||
{
|
||||
options::toggle(Menu1_Sounds);
|
||||
options::toggle(Menu1::Sounds);
|
||||
}
|
||||
if (ImGui::MenuItem("Music", nullptr, options::Options.Music))
|
||||
{
|
||||
options::toggle(Menu1_Music);
|
||||
options::toggle(Menu1::Music);
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
@@ -416,7 +418,7 @@ void winmain::RenderUi()
|
||||
auto maxResText = pinball::get_rc_string(fullscrn::GetMaxResolution() + 2030, 0);
|
||||
if (ImGui::MenuItem(maxResText, nullptr, options::Options.Resolution == -1))
|
||||
{
|
||||
options::toggle(Menu1_MaximumResolution);
|
||||
options::toggle(Menu1::MaximumResolution);
|
||||
}
|
||||
for (auto i = 0; i <= fullscrn::GetMaxResolution(); i++)
|
||||
{
|
||||
@@ -424,7 +426,7 @@ void winmain::RenderUi()
|
||||
snprintf(buffer, sizeof buffer - 1, "%d x %d", res.ScreenWidth, res.ScreenHeight);
|
||||
if (ImGui::MenuItem(buffer, nullptr, options::Options.Resolution == i))
|
||||
{
|
||||
options::toggle(Menu1_640x480 + i);
|
||||
options::toggle(static_cast<Menu1>(static_cast<int>(Menu1::R640x480) + i));
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
@@ -433,7 +435,11 @@ void winmain::RenderUi()
|
||||
{
|
||||
if (ImGui::MenuItem("Uniform Scaling", nullptr, options::Options.UniformScaling))
|
||||
{
|
||||
options::toggle(Menu1_WindowUniformScale);
|
||||
options::toggle(Menu1::WindowUniformScale);
|
||||
}
|
||||
if (ImGui::MenuItem("Linear Filtering", nullptr, options::Options.LinearFiltering))
|
||||
{
|
||||
options::toggle(Menu1::WindowLinearFilter);
|
||||
}
|
||||
ImGui::DragFloat("", &ImIO->FontGlobalScale, 0.005f, 0.8f, 5,
|
||||
"UI Scale %.2f", ImGuiSliderFlags_AlwaysClamp);
|
||||
@@ -457,12 +463,6 @@ void winmain::RenderUi()
|
||||
pause();
|
||||
ShowSpriteViewer ^= true;
|
||||
}
|
||||
if (ImGui::MenuItem("Help Topics", "F1"))
|
||||
{
|
||||
if (!single_step)
|
||||
pause();
|
||||
help_introduction();
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::MenuItem("About Pinball"))
|
||||
@@ -473,6 +473,9 @@ void winmain::RenderUi()
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (DispFrameRate && !FpsDetails.empty())
|
||||
if (ImGui::BeginMenu(FpsDetails.c_str()))
|
||||
ImGui::EndMenu();
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
@@ -533,12 +536,9 @@ int winmain::event_handler(const SDL_Event* event)
|
||||
{
|
||||
case SDLK_ESCAPE:
|
||||
if (options::Options.FullScreen)
|
||||
options::toggle(Menu1_Full_Screen);
|
||||
options::toggle(Menu1::Full_Screen);
|
||||
SDL_MinimizeWindow(MainWindow);
|
||||
break;
|
||||
case SDLK_F1:
|
||||
help_introduction();
|
||||
break;
|
||||
case SDLK_F2:
|
||||
new_game();
|
||||
break;
|
||||
@@ -546,13 +546,13 @@ int winmain::event_handler(const SDL_Event* event)
|
||||
pause();
|
||||
break;
|
||||
case SDLK_F4:
|
||||
options::toggle(Menu1_Full_Screen);
|
||||
options::toggle(Menu1::Full_Screen);
|
||||
break;
|
||||
case SDLK_F5:
|
||||
options::toggle(Menu1_Sounds);
|
||||
options::toggle(Menu1::Sounds);
|
||||
break;
|
||||
case SDLK_F6:
|
||||
options::toggle(Menu1_Music);
|
||||
options::toggle(Menu1::Music);
|
||||
break;
|
||||
case SDLK_F8:
|
||||
if (!single_step)
|
||||
@@ -717,7 +717,14 @@ void winmain::a_dialog()
|
||||
if (ImGui::BeginPopupModal("About", &unused_open, ImGuiWindowFlags_AlwaysAutoResize))
|
||||
{
|
||||
ImGui::TextUnformatted("3D Pinball for Windows - Space Cadet");
|
||||
ImGui::TextUnformatted("Original game by Cinematronics, Microsoft");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::TextUnformatted("Decompiled -> Ported to SDL");
|
||||
if (ImGui::SmallButton("Project home: https://github.com/k4zmu2a/SpaceCadetPinball"))
|
||||
{
|
||||
SDL_OpenURL("https://github.com/k4zmu2a/SpaceCadetPinball");
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Button("Ok"))
|
||||
@@ -749,10 +756,6 @@ void winmain::pause()
|
||||
no_time_loss = 1;
|
||||
}
|
||||
|
||||
void winmain::help_introduction()
|
||||
{
|
||||
}
|
||||
|
||||
void winmain::Restart()
|
||||
{
|
||||
restart = true;
|
||||
|
||||
@@ -22,7 +22,6 @@ public:
|
||||
static void end_pause();
|
||||
static void new_game();
|
||||
static void pause();
|
||||
static void help_introduction();
|
||||
static void Restart();
|
||||
static bool RestartRequested() { return restart; }
|
||||
private:
|
||||
@@ -30,6 +29,7 @@ private:
|
||||
static int has_focus, mouse_down, last_mouse_x, last_mouse_y, no_time_loss;
|
||||
static DWORD then, now;
|
||||
static gdrv_bitmap8 gfr_display;
|
||||
static std::string FpsDetails;
|
||||
static bool restart;
|
||||
static bool ShowAboutDialog;
|
||||
static bool ShowImGuiDemo;
|
||||
|
||||
@@ -130,16 +130,11 @@ void zdrv::CreatePreview(zmap_header_type& zMap)
|
||||
color.rgba.peRed = depth;
|
||||
color.rgba.peGreen = depth;
|
||||
color.rgba.peBlue = depth;
|
||||
|
||||
/*auto depth = static_cast<float>(*src++) /0xffff;
|
||||
color.rgba.peRed = (1-depth) * 0xff;
|
||||
color.rgba.peBlue = (depth) * 0xff;*/
|
||||
*dst++ = color;
|
||||
}
|
||||
src += zMap.Stride - zMap.Width;
|
||||
}
|
||||
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||
auto texture = SDL_CreateTexture
|
||||
(
|
||||
winmain::Renderer,
|
||||
@@ -158,7 +153,7 @@ void zdrv::FlipZMapHorizontally(const zmap_header_type& zMap)
|
||||
auto dst = zMap.ZPtr1;
|
||||
auto src = zMap.ZPtr1 + zMap.Stride * (zMap.Height - 1);
|
||||
for (auto y = zMap.Height - 1; y >= zMap.Height / 2; y--)
|
||||
{
|
||||
{
|
||||
for (auto x = 0; x < zMap.Width; x++)
|
||||
{
|
||||
std::swap(*dst++, *src++);
|
||||
|
||||
Reference in New Issue
Block a user