From fd9de493e6fcf2bf862e83f339032920ac210148 Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:16:58 +0300 Subject: [PATCH] =?UTF-8?q?Added=20linear=20filter=20option=20for=20vScree?= =?UTF-8?q?n=20texture.=20Rollback=20blit=20to=20backing=20storage=20?= =?UTF-8?q?=E2=80=93=20its=20persistence=20is=20not=20guaranteed.=20Added?= =?UTF-8?q?=20project=20URL=20to=20About=20dialog.=20Added=20source=20port?= =?UTF-8?q?s=20table=20to=20readme.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 - README.md | 6 + SpaceCadetPinball/SpaceCadetPinball.rc | 626 ------------------------- SpaceCadetPinball/gdrv.cpp | 40 +- SpaceCadetPinball/options.cpp | 40 +- SpaceCadetPinball/options.h | 30 +- SpaceCadetPinball/pb.cpp | 1 - SpaceCadetPinball/pb.h | 24 + SpaceCadetPinball/resource.h | 253 ---------- SpaceCadetPinball/winmain.cpp | 59 +-- SpaceCadetPinball/winmain.h | 2 +- SpaceCadetPinball/zdrv.cpp | 7 +- 12 files changed, 132 insertions(+), 957 deletions(-) delete mode 100644 SpaceCadetPinball/SpaceCadetPinball.rc delete mode 100644 SpaceCadetPinball/resource.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 09c5eb8..fd3585c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/README.md b/README.md index ca5c651..48af773 100644 --- a/README.md +++ b/README.md @@ -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 | | +Platforms covered by this project: desktop Windows and Linux. \ \ \ diff --git a/SpaceCadetPinball/SpaceCadetPinball.rc b/SpaceCadetPinball/SpaceCadetPinball.rc deleted file mode 100644 index 93754b9..0000000 --- a/SpaceCadetPinball/SpaceCadetPinball.rc +++ /dev/null @@ -1,626 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Russian (Russia) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Russian (Russia) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -MENU_1 MENU -BEGIN - POPUP "&Game" - BEGIN - MENUITEM "&New Game\tF2", Menu1_New_Game - MENUITEM "&Launch Ball", Menu1_Launch_Ball - MENUITEM "&Pause/Resume Game\tF3", Menu1_Pause_Resume_Game - MENUITEM SEPARATOR - MENUITEM "&High Scores...", Menu1_High_Scores - MENUITEM "&Demo", Menu1_Demo - MENUITEM "E&xit", Menu1_Exit - END - POPUP "&Options" - BEGIN - MENUITEM "&Full Screen\tF4", Menu1_Full_Screen - MENUITEM "Select &Table", Menu1_Select_Table - POPUP "Select &Players" - BEGIN - MENUITEM "&1 Player", Menu1_1Player - MENUITEM "&2 Players", Menu1_2Players - MENUITEM "&3 Players", Menu1_3Players - MENUITEM "&4 Players", Menu1_4Players - END - MENUITEM SEPARATOR - MENUITEM "&Sounds", Menu1_Sounds - MENUITEM "&Music", Menu1_Music - MENUITEM SEPARATOR - MENUITEM "P&layer Controls...\tF8", Menu1_Player_Controls - POPUP "Table &Resolution" - BEGIN - MENUITEM "Use &Maximum Resolution", Menu1_MaximumResolution - MENUITEM "&640 x 480", Menu1_640x480 - MENUITEM "&800 x 600", Menu1_800x600 - MENUITEM "&1024 x 768", Menu1_1024x768 - END - POPUP "&Window" - BEGIN - MENUITEM "&Uniform Scaling", Menu1_WindowUniformScale - END - END - POPUP "&Help" - BEGIN - MENUITEM "&Help Topics\tF1", Menu1_Help_Topics - MENUITEM SEPARATOR - MENUITEM "&About Pinball", Menu1_About_Pinball - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// RCDATA -// - -PBMSG_FT RCDATA "PB_MSGFT.bin" - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -ICON_1 ICON "icon_1.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -DIALOG_1 DIALOG 18, 18, 157, 78 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "About" -BEGIN - CTEXT "3D-Pinball for Windows",-1,11,6,135,8 - CTEXT "Version 1.0",-1,40,37,76,8 - ICON "ICON_1",-1,69,18,16,16 - DEFPUSHBUTTON "Ok",1,66,60,24,12 -END - -DLG_HIGHSCORES DIALOGEX 20, 22, 274, 141 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "High Scores" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - DEFPUSHBUTTON "OK",DLG_HIGHSCORES_Ok,109,120,50,14 - PUSHBUTTON "Cancel",DLG_HIGHSCORES_Cancel,163,120,50,14 - PUSHBUTTON "&Clear",DLG_HIGHSCORES_Clear,217,120,50,14 - LTEXT "Name",701,49,7,24,8 - LTEXT "Score",702,200,7,20,8 - LTEXT "Rank",703,13,7,20,8 - RTEXT "1",704,13,31,16,12 - RTEXT "2",705,13,47,16,12 - RTEXT "3",706,13,63,16,12 - RTEXT "4",707,13,79,16,12 - RTEXT "5",708,13,95,16,12 - LTEXT "",DLG_HIGHSCORES_StaticName1,49,31,120,12 - LTEXT "",DLG_HIGHSCORES_StaticName2,49,47,120,12 - LTEXT "",DLG_HIGHSCORES_StaticName3,49,63,120,12 - LTEXT "",DLG_HIGHSCORES_StaticName4,49,79,120,12 - LTEXT "",DLG_HIGHSCORES_StaticName5,49,95,120,12 - RTEXT "",DLG_HIGHSCORES_Score1,180,31,58,12 - RTEXT "",DLG_HIGHSCORES_Score2,180,47,58,12 - RTEXT "",DLG_HIGHSCORES_Score3,180,63,58,12 - RTEXT "",DLG_HIGHSCORES_Score4,180,79,58,12 - RTEXT "",DLG_HIGHSCORES_Score5,180,95,58,12 - EDITTEXT DLG_HIGHSCORES_EditName1,47,29,120,12,WS_DISABLED - EDITTEXT DLG_HIGHSCORES_EditName2,47,45,120,12,WS_DISABLED - EDITTEXT DLG_HIGHSCORES_EditName3,47,61,120,12,WS_DISABLED - EDITTEXT DLG_HIGHSCORES_EditName4,47,77,120,12,WS_DISABLED - EDITTEXT DLG_HIGHSCORES_EditName5,47,93,120,12,WS_DISABLED - CONTROL "",606,"Static",SS_BLACKFRAME,7,21,259,92 -END - -EDIT_COMPONENTS DIALOG 0, 0, 312, 94 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU -CAPTION "Edit Pinball Components FOR TESTING ONLY" -BEGIN - LISTBOX 100,1,12,68,79,LBS_SORT | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",1,81,75,41,14 - GROUPBOX "",103,136,0,175,93 - EDITTEXT 130,141,10,34,12 - EDITTEXT 131,141,23,34,12 - EDITTEXT 132,141,36,34,12 - EDITTEXT 133,141,49,34,12 - EDITTEXT 134,141,62,34,12 - EDITTEXT 135,141,75,34,12 - LTEXT "Text",136,178,12,130,8 - LTEXT "Text",137,178,25,130,8 - LTEXT "Text",138,178,38,130,8 - LTEXT "Text",139,178,51,130,8 - LTEXT "Text",140,178,64,130,8 - LTEXT "Text",141,178,77,130,8 - EDITTEXT 149,142,10,38,12 - EDITTEXT 150,142,23,38,12 - EDITTEXT 151,142,36,38,12 - EDITTEXT 152,142,49,38,12 - EDITTEXT 153,142,62,38,12 - EDITTEXT 154,142,75,38,12 - LTEXT "1",156,184,12,120,8 - LTEXT "2",157,184,25,120,8 - LTEXT "3",158,184,38,120,8 - LTEXT "4",159,184,51,120,8 - LTEXT "5",160,184,64,120,8 - LTEXT "6",161,184,77,120,8 - PUSHBUTTON "Reset",163,81,56,41,12 - LTEXT "Text",164,146,26,162,8 - LTEXT "Text",165,146,54,162,8 - LTEXT "Text",166,146,81,162,8 - PUSHBUTTON "Change...",167,245,10,62,14 - PUSHBUTTON "Change...",168,245,38,62,14 - PUSHBUTTON "Change...",169,245,65,62,14 - CONTROL "Sound Effects",170,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,74,10,58,10 - CONTROL "Physics",171,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,73,24,59,10 - CONTROL "Scoring",172,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,73,38,40,10 - LTEXT "Text",173,146,13,97,8 - LTEXT "Text",174,146,41,97,8 - LTEXT "Text",175,146,68,97,8 - LTEXT "Components:",176,2,3,43,8 -END - -KEYMAPPER DIALOGEX 2, 9, 284, 183 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU -CAPTION "3D Pinball: Player Controls" -FONT 8, "MS Shell Dlg", 0, 0, 0x0 -BEGIN - PUSHBUTTON "OK",KEYMAPPER_Ok,119,163,50,14 - PUSHBUTTON "Cancel",KEYMAPPER_Cancel,173,163,50,14 - PUSHBUTTON "&Default",KEYMAPPER_Default,227,163,50,14 - LTEXT "&Left Flipper",901,20,87,39,10 - COMBOBOX KEYMAPPER_FlipperL,66,85,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Right &Flipper",902,146,87,44,10 - COMBOBOX KEYMAPPER_FlipperR,192,85,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Left &Table Bump",904,20,107,34,17 - COMBOBOX KEYMAPPER_BumpLeft,66,108,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&Right Table Bump",905,146,107,38,19 - COMBOBOX KEYMAPPER_BumpRight,192,108,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&BottomTable Bump",906,20,131,41,18 - COMBOBOX KEYMAPPER_BumpBottom,66,133,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&Plunger",903,146,136,39,8 - COMBOBOX KEYMAPPER_Plunger,192,133,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "To change game controls, choose the control options you want, click the Arrow buttons to change specific keys, and then choose OK.",801,14,17,249,18 - LTEXT "To restore 3D Pinball to its original settings, choose Default, and then choose OK. To use the Arrow keys on the numeric keypad, make sure NUMLOCK is off.",802,14,38,256,25 - GROUPBOX "Control Options",908,7,71,269,87 - GROUPBOX "Instructions",909,7,5,269,61 -END - -XXDLG_HIGHSCORES DIALOG 20, 22, 211, 116 -STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "High Scores" -BEGIN - DEFPUSHBUTTON "OK",1,32,97,33,14,BS_LEFTTEXT - PUSHBUTTON "Cancel",2,89,97,33,14 - PUSHBUTTON "&Clear",112,146,97,33,14 - LTEXT "Name",-1,51,8,24,8 - LTEXT "Score",-1,160,8,20,8 - LTEXT "Rank",-1,15,8,20,8 - RTEXT "1",-1,15,28,16,12 - RTEXT "2",-1,15,40,16,12 - RTEXT "3",-1,15,52,16,12 - RTEXT "4",-1,15,64,16,12 - RTEXT "5",-1,15,76,16,12 - LTEXT "",401,51,28,88,12 - LTEXT "",402,51,40,88,12 - LTEXT "",403,51,52,88,12 - LTEXT "",404,51,64,88,12 - LTEXT "",405,51,76,88,12 - RTEXT "",501,140,28,58,12 - RTEXT "",502,140,40,58,12 - RTEXT "",503,140,52,58,12 - RTEXT "",504,140,64,58,12 - RTEXT "",505,140,76,58,12 - EDITTEXT 601,49,26,88,12,WS_DISABLED - EDITTEXT 602,49,38,88,12,WS_DISABLED - EDITTEXT 603,49,50,88,12,WS_DISABLED - EDITTEXT 604,49,62,88,12,WS_DISABLED - EDITTEXT 605,49,74,88,12,WS_DISABLED - CONTROL "",-1,"Static",SS_BLACKFRAME,9,22,195,69 -END - -XXKEYMAPPER DIALOG 2, 9, 277, 158 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU -CAPTION "3D Pinball: Player Controls" -FONT 8, "MS Shell Dlg" -BEGIN - PUSHBUTTON "OK",1,221,84,50,14 - PUSHBUTTON "Cancel",2,221,105,50,14 - PUSHBUTTON "Default",501,221,127,50,14 - COMBOBOX 401,50,82,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX 402,157,82,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX 404,50,105,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX 405,157,105,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX 406,50,130,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX 403,157,130,53,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - RTEXT "Plunger",811,114,133,39,8 - RTEXT "Right Flipper",807,107,84,46,10 - CTEXT "Left Table Bump",912,12,102,34,19 - CTEXT "Right Table Bump",914,115,102,38,19 - LTEXT "To change game controls, choose the control options you want, click the Arrow buttons to change specific keys, and then choose OK.",801,12,13,249,18 - LTEXT "To restore 3D Pinball to its original settings, choose Default, and then choose OK. To use the Arrow keys on the numeric keypad, make sure NUMLOCK is off.",802,12,32,256,25 - GROUPBOX "Control Options",908,5,67,214,87 - RTEXT "Left Flipper",803,9,84,39,10 - GROUPBOX "Instructions",909,5,1,265,61 - CTEXT "BottomTable Bump",916,7,127,41,19 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - "DIALOG_1", DIALOG - BEGIN - END - - "DLG_HIGHSCORES", DIALOG - BEGIN - END - - "KEYMAPPER", DIALOG - BEGIN - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// AFX_DIALOG_LAYOUT -// - -DLG_HIGHSCORES AFX_DIALOG_LAYOUT -BEGIN - 0 -END - -KEYMAPPER AFX_DIALOG_LAYOUT -BEGIN - 0 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Bitmap -// - -SPLASH_BITMAP BITMAP "splash_bitmap.bmp" - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_STRING101 "Replay Awarded" - IDS_STRING102 "Ball Locked" - IDS_STRING103 "Center Post\n%ld" - IDS_STRING104 "Bonus Awarded\n%ld" - IDS_STRING105 "Bonus Activated" - IDS_STRING106 "Weapons Upgraded" - IDS_STRING107 "Engine Upgraded" - IDS_STRING108 "Bonus up 1 Million" - IDS_STRING109 "Extra Ball Available\n%ld" - IDS_STRING110 "Extra Ball" - IDS_STRING111 "Reflex Shot Award\n%ld" - IDS_STRING112 "Final Battle Won" - IDS_STRING113 "Hyperspace Bonus\n%ld" - IDS_STRING114 "Hyperspace Bonus Available" - IDS_STRING115 "Jackpot Awarded\n%ld" - IDS_STRING116 "Jackpot Activated" -END - -STRINGTABLE -BEGIN - IDS_STRING117 "Multiball" - IDS_STRING118 "Ramp Bonus Awarded" - IDS_STRING119 "Light Added" - IDS_STRING120 "Ramp Bonus On" - IDS_STRING121 "Light Reset Off" - IDS_STRING122 "Skill Shot\n%ld" - IDS_STRING123 "Game Paused\nF3 to Resume" - IDS_STRING124 "Continue Play" - IDS_STRING125 "F2 Starts New Game" - IDS_STRING126 "Careful..." - IDS_STRING127 "Player 1" - IDS_STRING128 "Player 2" - IDS_STRING129 "Player 3" - IDS_STRING130 "Player 4" - IDS_STRING131 "Demo\nPlayer 1" - IDS_STRING132 "Demo\nPlayer 2" -END - -STRINGTABLE -BEGIN - IDS_STRING133 "Demo\nPlayer 3" - IDS_STRING134 "Demo\nPlayer 4" - IDS_STRING135 "Game Over" - IDS_STRING136 "TILT!" - IDS_STRING137 "This program requires an 80386 or later CPU." - IDS_STRING138 "80386 Required" - IDS_STRING139 "3D Pinball for Windows - Space Cadet" - IDS_STRING140 "One or more of the player controls is set to the same key,\nfor best performance use unique keys for each control." - IDS_STRING141 "Clear High Scores?" - IDS_STRING142 "Confirm" - IDS_STRING143 "WAVEMIX.INF is missing - it must be in the pinball directory!" - IDS_STRING144 "Warning:" - IDS_STRING145 "Ship Re-Fueled" - IDS_STRING146 "Gravity Well" - IDS_STRING147 "Time Warp Forward" - IDS_STRING148 "Time Warp Backward" -END - -STRINGTABLE -BEGIN - IDS_STRING149 "Maelstrom!" - IDS_STRING150 "Wormhole" - IDS_STRING151 "Awaiting Deployment" - IDS_STRING152 "Flags Upgraded" - IDS_STRING153 "Bonus Hold" - IDS_STRING154 "Level One Commendation" - IDS_STRING155 "Level Two Commendation" - IDS_STRING156 "Level Three Commendation" - IDS_STRING157 "Field Multiplier 2x" - IDS_STRING158 "Field Multiplier 3x" - IDS_STRING159 "Field Multiplier 5x" - IDS_STRING160 "Field Multiplier 10x" - IDS_STRING161 "Target Practice" - IDS_STRING162 "Launch Training" - IDS_STRING163 "Re-Entry Training" - IDS_STRING164 "Science" -END - -STRINGTABLE -BEGIN - IDS_STRING165 "Stray Comet" - IDS_STRING166 "Black Hole" - IDS_STRING167 "Space Radiation" - IDS_STRING168 "Bug Hunt" - IDS_STRING169 "Alien Menace" - IDS_STRING170 "Rescue" - IDS_STRING171 "Satellite Retrieval" - IDS_STRING172 "Recon" - IDS_STRING173 "Doomsday Machine" - IDS_STRING174 "Cosmic Plague" - IDS_STRING175 "Secret" - IDS_STRING176 "Time Warp" - IDS_STRING177 "Maelstrom" - IDS_STRING178 "Mission Accepted\n%ld" - IDS_STRING179 "Mission Completed\n%ld" - IDS_STRING180 "%s Mission Selected" -END - -STRINGTABLE -BEGIN - IDS_STRING181 "Black Hole\n%ld" - IDS_STRING182 "Gravity Normalized\n%ld" - IDS_STRING183 "Gravity Well\n%ld" - IDS_STRING184 "Promotion to %s" - IDS_STRING185 "Cadet" - IDS_STRING186 "Ensign" - IDS_STRING187 "Lieutenant" - IDS_STRING188 "Captain" - IDS_STRING189 "Lt Commander" - IDS_STRING190 "Commander" - IDS_STRING191 "Commodore" - IDS_STRING192 "Admiral" - IDS_STRING193 "Fleet Admiral" - IDS_STRING194 "Wormhole Opened" - IDS_STRING195 "Crash Bonus\n%ld" - IDS_STRING196 "Replay Ball" -END - -STRINGTABLE -BEGIN - IDS_STRING197 "Re-Deploy" - IDS_STRING198 "Player 1 Shoot Again" - IDS_STRING199 "Player 2 Shoot Again" - IDS_STRING200 "Player 3 Shoot Again" - IDS_STRING201 "Player 4 Shoot Again" - IDS_STRING202 "This 3D Pinball Table was created for Microsoft by Maxis.\nFor more information call (800)-336-2947\n(US and Canadian customers only).\nCopyright (c) 1995 Maxis." - IDS_STRING203 "3D Pinball Table created for Microsoft by Maxis. Copyright (c) 1995 Maxis." - IDS_STRING204 "About 3D Pinball" - IDS_STRING205 "Hit Mission Targets To Select Mission" - IDS_STRING206 "Re-Fuel Ship" - IDS_STRING207 "Launch Ramp To Accept %s Mission" - IDS_STRING208 "Attack Bumpers Hits\nLeft: %d" - IDS_STRING209 "Target Training Passed" - IDS_STRING210 "Mission Aborted" - IDS_STRING211 "Launches Left: %d" - IDS_STRING212 "Launch Training Passed" -END - -STRINGTABLE -BEGIN - IDS_STRING213 "Re-Entries Left: %d" - IDS_STRING214 "Re-Entry Training Passed" - IDS_STRING215 "Drop Targets\nLeft: %d" - IDS_STRING216 "Science Mission Completed" - IDS_STRING217 "Warning -- Low Fuel" - IDS_STRING218 "Fill Right Hazard Banks" - IDS_STRING219 "Hyperspace Launch" - IDS_STRING220 "Comet Destroyed" - IDS_STRING221 "Enter Wormhole" - IDS_STRING222 "Radiation Eliminated" - IDS_STRING223 "Upgrade Launch Bumpers" - IDS_STRING224 "Enter Black Hole" - IDS_STRING225 "Black Hole Eliminated" - IDS_STRING226 "Targets\nLeft: %d" - IDS_STRING227 "Xenomorphs Destroyed" - IDS_STRING228 "Upgrade Flags" -END - -STRINGTABLE -BEGIN - IDS_STRING229 "Hyperspace Launch" - IDS_STRING230 "Survivors Rescued" - IDS_STRING231 "Aliens Repelled" - IDS_STRING232 "Hit Fuel Targets" - IDS_STRING233 "Remote Attack Bumper Hits\nLeft: %d" - IDS_STRING234 "Satellite Repaired" - IDS_STRING235 "Lane Passes\nLeft: %d" - IDS_STRING236 "Shoot Ball Up Fuel Chute" - IDS_STRING237 "Survey Complete" - IDS_STRING238 "Out Lane Passes\nLeft: %d" - IDS_STRING239 "Doomsday Machine Destroyed" - IDS_STRING240 "Roll Flags: %d" - IDS_STRING241 "Hit Space Warp Rollover" - IDS_STRING242 "Plague Eliminated" - IDS_STRING243 "Hit Yellow Wormhole" - IDS_STRING244 "Hit Red Wormhole" -END - -STRINGTABLE -BEGIN - IDS_STRING245 "Hit Green Wormhole" - IDS_STRING246 "Plans Recovered" - IDS_STRING247 "Rebound Hits\nLeft: %d" - IDS_STRING248 "Hit Hyperspace Chute or Launch Ramp" - IDS_STRING249 "Drop Target Hits\nLeft: %d" - IDS_STRING250 "Spot Target Hits\nLeft: %d" - IDS_STRING251 "Lanes Passes\nLeft: %d" - IDS_STRING252 "Shoot Ball Up Fuel Chute" - IDS_STRING253 "Hit Launch Ramp" - IDS_STRING254 "Hit Flags" - IDS_STRING255 "Hit Worm Hole" - IDS_STRING256 "Hyperspace Chute to end Maelstrom" - IDS_STRING257 "pinball.mid" - IDS_STRING258 "1 UseBitmapFont" - IDS_STRING259 "90 Left Flipper Key" -END - -STRINGTABLE -BEGIN - IDS_STRING260 "191 Right Flipper Key" - IDS_STRING261 "32 Plunger Key" - IDS_STRING262 "88 Bump Left Key" - IDS_STRING263 "190 Bump Right Key" - IDS_STRING264 "38 Bump Bottom Key" - IDS_STRING265 "Software\\Microsoft\\Plus!\\Pinball" - IDS_STRING266 "SpaceCadet" - IDS_STRING267 "1c7c22a0-9576-11ce-bf80-444553540000" - IDS_STRING268 "PINBALL.DAT" - IDS_STRING269 "Space Cadet" - IDS_STRING270 "Error:" - IDS_STRING271 "Unable to find other tables." - IDS_STRING272 "3D Pinball\nSpace Cadet" - IDS_STRING273 "Promotion to %s" - IDS_STRING274 "Demotion to %s" - IDS_STRING275 "Upgrade Attack Bumpers" -END - -STRINGTABLE -BEGIN - IDS_STRING276 "Fill Left Hazard Banks" - IDS_STRING277 "HIGH SCORE" - IDS_STRING278 "pinball.chm" - IDS_STRING279 "Not enough memory to run 3D Pinball." - IDS_STRING280 "Player 1's Score\n%ld" - IDS_STRING281 "Player 2's Score\n%ld" - IDS_STRING282 "Player 3's Score\n%ld" - IDS_STRING283 "Player 4's Score\n%ld" - IDS_STRING284 "High Score 1\n%ld" - IDS_STRING285 "High Score 2\n%ld" - IDS_STRING286 "High Score 3\n%ld" - IDS_STRING287 "High Score 4\n%ld" - IDS_STRING288 "High Score 5\n%ld" - IDS_STRING289 "255 255 255 (R G B default font color)" -END - -STRINGTABLE -BEGIN - 2030 "Use &Maximum Resolution (640 x 480)" - 2031 "Use &Maximum Resolution (800 x 600)" -END - -STRINGTABLE -BEGIN - 2032 "Use &Maximum Resolution (1024 x 768)" -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/SpaceCadetPinball/gdrv.cpp b/SpaceCadetPinball/gdrv.cpp index 4cfe251..cc5475a 100644 --- a/SpaceCadetPinball/gdrv.cpp +++ b/SpaceCadetPinball/gdrv.cpp @@ -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(&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(&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, diff --git a/SpaceCadetPinball/options.cpp b/SpaceCadetPinball/options.cpp index baebbb9..cc7037b 100644 --- a/SpaceCadetPinball/options.cpp +++ b/SpaceCadetPinball/options.cpp @@ -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(uIDCheckItem) - static_cast(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(uIDCheckItem) - static_cast(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; } diff --git a/SpaceCadetPinball/options.h b/SpaceCadetPinball/options.h index c25f58c..3b32e5d 100644 --- a/SpaceCadetPinball/options.h +++ b/SpaceCadetPinball/options.h @@ -1,6 +1,33 @@ #pragma once #include +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: diff --git a/SpaceCadetPinball/pb.cpp b/SpaceCadetPinball/pb.cpp index c3401e0..d4a8ce6 100644 --- a/SpaceCadetPinball/pb.cpp +++ b/SpaceCadetPinball/pb.cpp @@ -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" diff --git a/SpaceCadetPinball/pb.h b/SpaceCadetPinball/pb.h index e85d5ee..b1e0dd5 100644 --- a/SpaceCadetPinball/pb.h +++ b/SpaceCadetPinball/pb.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: diff --git a/SpaceCadetPinball/resource.h b/SpaceCadetPinball/resource.h deleted file mode 100644 index 5ba7890..0000000 --- a/SpaceCadetPinball/resource.h +++ /dev/null @@ -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 diff --git a/SpaceCadetPinball/winmain.cpp b/SpaceCadetPinball/winmain.cpp index c7495f4..e5167d8 100644 --- a/SpaceCadetPinball/winmain.cpp +++ b/SpaceCadetPinball/winmain.cpp @@ -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(static_cast(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; diff --git a/SpaceCadetPinball/winmain.h b/SpaceCadetPinball/winmain.h index a929d5f..82dd8f2 100644 --- a/SpaceCadetPinball/winmain.h +++ b/SpaceCadetPinball/winmain.h @@ -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; diff --git a/SpaceCadetPinball/zdrv.cpp b/SpaceCadetPinball/zdrv.cpp index d8767f1..191400e 100644 --- a/SpaceCadetPinball/zdrv.cpp +++ b/SpaceCadetPinball/zdrv.cpp @@ -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(*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++);