winmain v2.

fullscrn, pb v1.
This commit is contained in:
oz 2020-11-06 16:56:32 +03:00
parent 473ed6b9d9
commit 7db64ae1c6
21 changed files with 960 additions and 312 deletions

View File

@ -136,6 +136,7 @@ int main2(int argc, const char* argv[])
}
free(fdat);
return 0;
}

View File

@ -0,0 +1,6 @@
#include "pch.h"
#include "Sound.h"
void Sound::Enable(int a1, int a2, int a3)
{
}

View File

@ -0,0 +1,6 @@
#pragma once
class Sound
{public:
static void Enable(int a1, int a2, int a3);
};

View File

@ -19,7 +19,7 @@ int main()
pinball::hinst = GetModuleHandleA(nullptr);
char cmdLine[1];
WinMain(pinball::hinst, 0, cmdLine, 0);
WinMain(pinball::hinst, 0, cmdLine, 10);
objlist_class d = objlist_class(2, 4);
for (int i = 0; i < 100; i++)

View File

@ -55,6 +55,49 @@ END
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
MENU_1 MENU
BEGIN
POPUP "&Game"
BEGIN
MENUITEM "&New Game\tF2", 101
MENUITEM "&Launch Ball", 401
MENUITEM "&Pause/Resume Game\tF3", 402
MENUITEM SEPARATOR
MENUITEM "&High Scores...", 103
MENUITEM "&Demo", 404
MENUITEM "E&xit", 105
END
POPUP "&Options"
BEGIN
MENUITEM "&Full Screen\tF4", 403
MENUITEM "Select &Table", 405
POPUP "Select &Players"
BEGIN
MENUITEM "&1 Player", 408
MENUITEM "&2 Players", 409
MENUITEM "&3 Players", 410
MENUITEM "&4 Players", 411
END
MENUITEM SEPARATOR
MENUITEM "&Sounds", 201
MENUITEM "&Music", 202
MENUITEM SEPARATOR
MENUITEM "P&layer Controls...\tF8", 406
END
POPUP "&Help"
BEGIN
MENUITEM "&Help Topics\tF1", 301
MENUITEM SEPARATOR
MENUITEM "&About Pinball", 102
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
@ -62,195 +105,239 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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)"
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
#endif // English (United States) resources

View File

@ -96,7 +96,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>Comctl32.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -154,15 +154,19 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="DatParser.h" />
<ClInclude Include="fullscrn.h" />
<ClInclude Include="loader.h" />
<ClInclude Include="memory.h" />
<ClInclude Include="objlist_class.h" />
<ClInclude Include="options.h" />
<ClInclude Include="partman.h" />
<ClInclude Include="pb.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="pinball.h" />
<ClInclude Include="render.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="score.h" />
<ClInclude Include="Sound.h" />
<ClInclude Include="TBall.h" />
<ClInclude Include="TBlocker.h" />
<ClInclude Include="TBumper.h" />
@ -198,11 +202,13 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="DatParser.cpp" />
<ClCompile Include="fullscrn.cpp" />
<ClCompile Include="loader.cpp" />
<ClCompile Include="memory.cpp" />
<ClCompile Include="objlist_class.cpp" />
<ClCompile Include="options.cpp" />
<ClCompile Include="partman.cpp" />
<ClCompile Include="pb.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
@ -210,7 +216,9 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="pinball.cpp" />
<ClCompile Include="render.cpp" />
<ClCompile Include="score.cpp" />
<ClCompile Include="Sound.cpp" />
<ClCompile Include="SpaceCadetPinball.cpp" />
<ClCompile Include="TBall.cpp" />
<ClCompile Include="TBlocker.cpp" />

View File

@ -147,6 +147,18 @@
<ClInclude Include="options.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Sound.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="pb.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="render.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="fullscrn.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
@ -272,6 +284,18 @@
<ClCompile Include="options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Sound.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pb.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="render.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="fullscrn.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Natvis Include="NatvisFile.natvis" />

View File

@ -7,14 +7,14 @@
#include "TPinballComponent.h"
#include "TPlunger.h"
class TPinballTable:TPinballComponent
class TPinballTable : public TPinballComponent
{
public:
TPinballTable();
~TPinballTable();
TPinballComponent* find_component(LPCSTR componentName);
TPinballComponent* find_component(int groupIndex);
TFlipper* FlipperL;
TFlipper* FlipperR;
scoreStruct* Score1;
@ -97,4 +97,3 @@ public:
int UnknownP82;
int UnknownP83;
};

View File

@ -0,0 +1,159 @@
#include "pch.h"
#include "fullscrn.h"
int fullscrn::screen_mode;
HWND fullscrn::hWnd;
tagRECT fullscrn::PubRect1;
int fullscrn::fullscrn_flag1;
int fullscrn::display_changed;
int fullscrn::ChangeDisplay, fullscrn::SmthFullScrnFlag2;
int fullscrn::trick;
int fullscrn::MenuEnabled;
HMENU fullscrn::MenuHandle;
int fullscrn::xDest, fullscrn::yDest;
int fullscrn::set_screen_mode(int isFullscreen)
{
int result = isFullscreen;
if (isFullscreen == screen_mode)
return result;
screen_mode = isFullscreen;
if (isFullscreen)
{
if (IsWindowVisible(hWnd))
GetWindowRect(hWnd, &PubRect1);
enableFullscreen();
BYTE1(fullscrn_flag1) |= 0x80u;
InvalidateRect(hWnd, nullptr, 1);
set_menu_mode(0);
result = disableWindowFlagsDisDlg();
}
else
{
disableFullscreen();
BYTE1(fullscrn_flag1) |= 0x80u;
InvalidateRect(hWnd, nullptr, 1);
set_menu_mode(1);
result = RedrawWindow(nullptr, nullptr, nullptr, 0x185u);
}
return result;
}
int fullscrn::disableWindowFlagsDisDlg()
{
long style = GetWindowLongA(hWnd, -16);
return SetWindowLongA(hWnd, -16, style & 0xFF3FFFFF);
}
int fullscrn::setWindowFlagsDisDlg()
{
int style = GetWindowLongA(hWnd, -16);
return SetWindowLongA(hWnd, -16, style | 0xC00000);
}
int fullscrn::enableFullscreen()
{
tagRECT Rect{}; // [esp+Ch] [ebp-B0h]
DEVMODEA DevMode{}; // [esp+1Ch] [ebp-A0h]
if (ChangeDisplay && !display_changed)
{
DevMode.dmSize = 156;
DevMode.dmFields = 1835008;
DevMode.dmPelsWidth = 640;
DevMode.dmPelsHeight = 480;
DevMode.dmBitsPerPel = 8;
disableWindowFlagsDisDlg();
if (trick)
{
GetWindowRect(GetDesktopWindow(), &Rect);
SetWindowPos(hWnd, (HWND)((int)HWND_MESSAGE | 0x2), 0, 0, Rect.right - Rect.left + 1,
Rect.bottom - Rect.top + 1, 8u);
}
SmthFullScrnFlag2 = 1;
LONG changeDispResult = ChangeDisplaySettingsA(&DevMode, 4u);
if (changeDispResult == 1)
{
BYTE2(DevMode.dmFields) &= 0xFBu;
SmthFullScrnFlag2 = 1;
changeDispResult = ChangeDisplaySettingsA(&DevMode, 4u);
}
display_changed = changeDispResult == 0;
if (changeDispResult == 0)
return 1;
}
GetWindowRect(GetDesktopWindow(), &Rect);
disableWindowFlagsDisDlg();
SetWindowPos(hWnd, (HWND)0xFFFFFFFE, 0, 0, Rect.right - Rect.left + 1, Rect.bottom - Rect.top + 1, 8u);
return 0;
}
int fullscrn::disableFullscreen()
{
if (display_changed)
{
display_changed = 0;
SmthFullScrnFlag2 = 1;
ChangeDisplaySettingsA(nullptr, 4u);
if (trick)
SetWindowPos(hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x13u);
}
setWindowFlagsDisDlg();
SetWindowPos(
hWnd,
nullptr,
PubRect1.left,
PubRect1.top,
PubRect1.right - PubRect1.left,
PubRect1.bottom - PubRect1.top,
0x14u);
return 0;
}
bool fullscrn::set_menu_mode(int menuEnabled)
{
BOOL result; // eax
MenuEnabled = menuEnabled;
GetWindowCenter();
if (MenuEnabled)
{
fullscrn_flag1 |= 2u;
InvalidateRect(hWnd, nullptr, 1);
result = SetMenu(hWnd, MenuHandle);
}
else
{
fullscrn_flag1 |= 1u;
InvalidateRect(hWnd, nullptr, 1);
result = SetMenu(hWnd, nullptr);
}
return result;
}
void fullscrn::GetWindowCenter()
{
int yDestLoc; // eax
HWND v1; // eax
struct tagRECT Rect; // [esp+4h] [ebp-10h]
int dword_1025094 = 0, dword_1025098 = 0; // tmp, from render
if (screen_mode)
{
v1 = GetDesktopWindow();
GetWindowRect(v1, &Rect);
xDest = (Rect.right - dword_1025094 - Rect.left) / 2;
yDestLoc = (Rect.bottom - dword_1025098 - Rect.top) / 2;
}
else
{
xDest = 0;
yDestLoc = GetSystemMetrics(15);
}
yDest = yDestLoc;
if (MenuEnabled)
yDest -= GetSystemMetrics(15);
}

View File

@ -0,0 +1,31 @@
#pragma once
#define BYTEn(x, n) (*((unsigned char*)&(x)+n))
#define BYTE1(x) BYTEn(x, 1) // byte 1 (counting from 0)
#define BYTE2(x) BYTEn(x, 2)
class fullscrn
{
public:
static int screen_mode;
static HWND hWnd;
static tagRECT PubRect1;
static int fullscrn_flag1;
static int display_changed;
static int ChangeDisplay, SmthFullScrnFlag2;
static int trick;
static int set_screen_mode(int isFullscreen);
private :
static int MenuEnabled;
static HMENU MenuHandle;
static int xDest, yDest;
static void GetWindowCenter();
static int disableWindowFlagsDisDlg();
static int setWindowFlagsDisDlg();
static int enableFullscreen();
static int disableFullscreen();
static bool set_menu_mode(int menuEnabled);
};

View File

@ -1,9 +1,76 @@
#include "pch.h"
#include "options.h"
#include "memory.h"
#include "pinball.h"
#include "Sound.h"
LPCSTR options::OptionsRegPath;
LPSTR options::OptionsRegPathCur;
HMENU options::MenuHandle;
optionsStruct options::Options;
void options::init(HMENU menuHandle)
{
MenuHandle = menuHandle;
Options.Sounds = 1;
Options.Music = 0;
Options.FullScreen = 0;
Options.Average = 5;
Options.PriorityAdj = 2;
Options.LeftFlipperKey2 = 90;
Options.RightFlipperKey2 = 191;
Options.PlungerKey2 = 32;
Options.LeftTableBumpKey2 = 88;
Options.RightTableBumpKey2 = 190;
Options.BottomTableBumpKey2 = 38;
pinball::get_rc_int(159, &Options.LeftFlipperKey2);
pinball::get_rc_int(160, &Options.RightFlipperKey2);
pinball::get_rc_int(161, &Options.PlungerKey2);
pinball::get_rc_int(162, &Options.LeftTableBumpKey2);
pinball::get_rc_int(163, &Options.RightTableBumpKey2);
pinball::get_rc_int(164, &Options.BottomTableBumpKey2);
Options.LeftFlipperKey = Options.LeftFlipperKey2;
Options.RightFlipperKey = Options.RightFlipperKey2;
Options.PlungerKey = Options.PlungerKey2;
Options.LeftTableBumpKey = Options.LeftTableBumpKey2;
Options.RightTableBumpKey = Options.RightTableBumpKey2;
Options.Players = 1;
Options.BottomTableBumpKey = Options.BottomTableBumpKey2;
Options.Sounds = get_int(nullptr, "Sounds", Options.Sounds);
Options.Music = get_int(nullptr, "Music", Options.Music);
Options.Average = get_int(nullptr, "Average", Options.Average);
Options.FullScreen = get_int(nullptr, "FullScreen", Options.FullScreen);
Options.PriorityAdj = get_int(nullptr, "Priority_Adjustment", Options.PriorityAdj);
Options.Players = get_int(nullptr, "Players", Options.Players);
Options.LeftFlipperKey = get_int(nullptr, "Left Flippper key", Options.LeftFlipperKey);
Options.RightFlipperKey = get_int(nullptr, "Right Flipper key", Options.RightFlipperKey);
Options.PlungerKey = get_int(nullptr, "Plunger key", Options.PlungerKey);
Options.LeftTableBumpKey = get_int(nullptr, "Left Table Bump key", Options.LeftTableBumpKey);
Options.RightTableBumpKey = get_int(nullptr, "Right Table Bump key", Options.RightTableBumpKey);
Options.BottomTableBumpKey = get_int(nullptr, "Bottom Table Bump key", Options.BottomTableBumpKey);
menu_check(0xC9u, Options.Sounds);
Sound::Enable(0, 7, Options.Sounds);
menu_check(0xCAu, Options.Music);
menu_check(0x193u, Options.FullScreen);
menu_check(0x198u, Options.Players == 1);
menu_check(0x199u, Options.Players == 2);
menu_check(0x19Au, Options.Players == 3);
menu_check(0x19Bu, Options.Players == 4);
auto tmpBuf = memory::allocate(0x1F4u);
if (tmpBuf)
{
get_string(nullptr, "Shell Exe", tmpBuf, pinball::WindowName, 500);
if (!*tmpBuf)
{
if (MenuHandle)
{
DeleteMenu(MenuHandle, 0x195u, 0);
DrawMenuBar(pinball::hwnd_frame);
}
}
memory::free(tmpBuf);
}
}
void options::path_init(LPCSTR regPath)
{
@ -116,3 +183,12 @@ void options::set_string(LPCSTR optPath, LPCSTR lpValueName, LPCSTR value)
path_free();
}
}
HMENU options::menu_check(UINT uIDCheckItem, int value)
{
HMENU result = MenuHandle;
if (MenuHandle)
result = (HMENU)CheckMenuItem(MenuHandle, uIDCheckItem, value != 0 ? 8 : 0);
return result;
}

View File

@ -1,16 +1,45 @@
#pragma once
struct __declspec(align(4)) optionsStruct
{
int Sounds;
int Music;
int Average;
int FullScreen;
int PriorityAdj;
int Players;
int LeftFlipperKey;
int RightFlipperKey;
int PlungerKey;
int LeftTableBumpKey;
int RightTableBumpKey;
int BottomTableBumpKey;
int LeftFlipperKey2;
int RightFlipperKey2;
int PlungerKey2;
int LeftTableBumpKey2;
int RightTableBumpKey2;
int BottomTableBumpKey2;
};
class options
{
public:
static void init(HMENU menuHandle);
static void path_init(LPCSTR regPath);
static void path_uninit();
static int get_int(LPCSTR optPath, LPCSTR lpValueName, int defaultValue);
static void set_int(LPCSTR optPath, LPCSTR lpValueName, int data);
static void get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR lpString1, LPCSTR lpString2, int iMaxLength);
static void set_string(LPCSTR optPath, LPCSTR lpValueName, LPCSTR value);
static HMENU menu_check(UINT uIDCheckItem, int value);
static optionsStruct Options;
private:
static LPCSTR OptionsRegPath;
static LPSTR OptionsRegPathCur;
static LPCSTR path(LPCSTR regPath);
static void path_free();
static HMENU MenuHandle;
};

19
SpaceCadetPinball/pb.cpp Normal file
View File

@ -0,0 +1,19 @@
#include "pch.h"
#include "pb.h"
#include "render.h"
TPinballTable* pb::MainTable = nullptr;
void pb::reset_table()
{
if (MainTable)
MainTable->Message(1024, 0.0);
}
void pb::firsttime_setup()
{
render::blit = 0;
render::update();
render::blit = 1;
}

12
SpaceCadetPinball/pb.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
#include "TPinballTable.h"
class pb
{
public:
static void reset_table();
static void firsttime_setup();
private:
static TPinballTable* MainTable;
};

View File

@ -12,6 +12,11 @@ int pinball::rc_string_slot = 0;
HINSTANCE pinball::hinst;
char pinball::WindowName[2]{};
char pinball::DatFileName[300]{};
int pinball::LeftShift = -1;
int pinball::RightShift = -1;
HWND pinball::hwnd_frame = nullptr;
int pinball::has_focus = 1;
int pinball::single_step = 0;
char* pinball::get_rc_string(int uID, int a2)
@ -23,3 +28,82 @@ char* pinball::get_rc_string(int uID, int a2)
rc_string_slot = 0;
return result;
}
int pinball::get_rc_int(int uID, int* dst)
{
char buffer[50];
int result = LoadStringA(pinball::hinst, uID, buffer, 255);
if (!result)
return result;
*dst = atoi(buffer);
return 1;
}
void pinball::FindShiftKeys()
{
signed int i; // esi
int rightShift; // eax
CHAR stringBuf[10]; // [esp+Ch] [ebp-18h]
RightShift = -1;
LeftShift = -1;
for (i = 0; i < 256; ++i)
{
if (MapVirtualKeyA(i, 1u) == 16)
{
LeftShift = i;
break;
}
}
while (++i < 256)
{
if (MapVirtualKeyA(i, 1u) == 16)
{
RightShift = i;
break;
}
}
if (!GetKeyNameTextA(LeftShift << 16, stringBuf, 19) || !_strnicmp(stringBuf, "right", 5u))
{
rightShift = RightShift;
}
else
{
rightShift = LeftShift;
LeftShift = RightShift;
RightShift = rightShift;
}
if (GetKeyNameTextA(rightShift << 16, stringBuf, 19))
{
if (_strnicmp(stringBuf, "left", 4u) != 0)
{
auto tmp = LeftShift;
LeftShift = RightShift;
RightShift = tmp;
}
}
}
HANDLE pinball::adjust_priority(int priority)
{
HANDLE result = GetCurrentThread();
switch (priority)
{
case -2:
return (HANDLE)SetThreadPriority(result, -2);
case -1:
return (HANDLE)SetThreadPriority(result, -1);
case 0:
return (HANDLE)SetThreadPriority(result, 0);
case 1:
return (HANDLE)SetThreadPriority(result, 1);
case 2:
return (HANDLE)SetThreadPriority(result, 2);
case 3:
result = (HANDLE)SetThreadPriority(result, 15);
break;
}
return result;
}

View File

@ -11,7 +11,16 @@ public:
static HINSTANCE hinst;
static char WindowName[2];
static char DatFileName[300];
static int RightShift;
static int LeftShift;
static HWND hwnd_frame;
static int has_focus;
static int single_step;
static char* get_rc_string(int uID, int a2);
static int get_rc_int(int uID, int* dst);
static void FindShiftKeys();
static HANDLE adjust_priority(int priority);
private:
static char getRcBuffer[256 * 6];
static int rc_string_slot;

View File

@ -0,0 +1,8 @@
#include "pch.h"
#include "render.h"
int render::blit = 0;
void render::update()
{
}

View File

@ -0,0 +1,8 @@
#pragma once
class render
{
public:
static int blit;
static void update();
};

View File

@ -2,106 +2,106 @@
// Microsoft Visual C++ generated include file.
// Used by SpaceCadetPinball.rc
//
#define IDS_STRING101 0
#define IDS_STRING102 1
#define IDS_STRING103 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_STRING101 0
#define IDS_STRING102 1
#define IDS_STRING103 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 IDS_STRING203 102
@ -192,13 +192,12 @@
#define IDS_STRING288 188
#define IDS_STRING289 189
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -1,17 +1,13 @@
#include "pch.h"
#include "winmain.h"
#include "fullscrn.h"
#include "memory.h"
#include "pinball.h"
#include "options.h"
#include "pb.h"
int iFrostUniqueMsg;
//HWND, UINT, WPARAM, LPARAM
//typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM LPARAM)
{
return 0;
}
int iFrostUniqueMsg, return_value = 0, bQuit = 0;
int check_expiration_date()
{
@ -86,12 +82,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
--memory::critical_allocation;
pinball::quickFlag = strstr(lpCmdLine, "-quick") != 0;
pinball::quickFlag = strstr(lpCmdLine, "-quick") != nullptr;
pinball::hinst = hInstance;
options::get_string(regSpaceCadet, "Pinball Data", pinball::DatFileName, pinball::get_rc_string(168, 0), 300);
iFrostUniqueMsg = RegisterWindowMessageA("PinballThemeSwitcherUniqueMsgString");
auto windowHandle= FindWindowA(pinball::get_rc_string(167, 0), nullptr);
auto windowHandle = FindWindowA(pinball::get_rc_string(167, 0), nullptr);
if (windowHandle)
{
SendMessageA(windowHandle, iFrostUniqueMsg, 0, 0);
@ -106,19 +102,104 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
picce.dwICC = 5885;
InitCommonControlsEx(&picce);
WNDCLASSA WndClass;
auto windowClass = pinball::get_rc_string(167, 0);
WNDCLASSA WndClass{};
WndClass.style = 4104;
WndClass.lpfnWndProc = message_handler;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hInstance = hInstance;
WndClass.hIcon = LoadIconA(hInstance, "ICON_1");
WndClass.hCursor = LoadCursorA(0, (LPCSTR)0x7F00);
WndClass.hCursor = LoadCursorA(nullptr, (LPCSTR)0x7F00);
WndClass.hbrBackground = (HBRUSH)16;
WndClass.lpszMenuName = "MENU_1";
WndClass.lpszClassName = pinball::get_rc_string(167, 0);
//auto tmpBuf = splash_screen((int)hInstance, "splash_bitmap", "splash_bitmap");
WndClass.lpszClassName = windowClass;
//auto tmpBuf = splash_screen((int)hInstance, "splash_bitmap", "splash_bitmap"); // No splash for now
RegisterClassA(&WndClass);
pinball::FindShiftKeys();
char windowName[40];
lstrcpyA(windowName, pinball::get_rc_string(38, 0));
windowHandle = CreateWindowExA(0, windowClass, windowName, 0x3CA0000u, 0, 0, 640, 480, nullptr, nullptr, hInstance,
nullptr);
pinball::hwnd_frame = windowHandle;
if (!windowHandle)
{
PostQuitMessage(0);
return 0;
}
auto menuHandle = GetMenu(windowHandle);
options::init(menuHandle);
pb::reset_table();
pb::firsttime_setup();
if (strstr(lpCmdLine, "-fullscreen"))
{
options::Options.FullScreen = 1;
options::menu_check(0x193u, 1);
}
ShowWindow(pinball::hwnd_frame, nShowCmd);
fullscrn::set_screen_mode(options::Options.FullScreen);
UpdateWindow(pinball::hwnd_frame);
/*if (tmpBuf) //Close splash
{
splash_hide(tmpBuf);
splash_destroy(tmpBuf);
}*/
pinball::adjust_priority(options::Options.PriorityAdj);
auto getTimeFunc = timeGetTime;
const auto startTime = timeGetTime();
MSG wndMessage{};
while (timeGetTime() >= startTime && timeGetTime() - startTime < 2000)
PeekMessageA(&wndMessage, pinball::hwnd_frame, 0, 0, 1u);
while (true)
{
if (!ProcessWindowMessages() || bQuit)
break;
Sleep(8);
}
return return_value;
}
LRESULT CALLBACK message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
int ProcessWindowMessages()
{
MSG Msg{}; // [esp+8h] [ebp-1Ch]
if (pinball::has_focus && !pinball::single_step)
{
while (PeekMessageA(&Msg, nullptr, 0, 0, 1u))
{
TranslateMessage(&Msg);
DispatchMessageA(&Msg);
if (Msg.message == 18)
{
return_value = Msg.wParam;
return 0;
}
}
return 1;
}
GetMessageA(&Msg, pinball::hwnd_frame, 0, 0);
TranslateMessage(&Msg);
DispatchMessageA(&Msg);
if (Msg.message == 18)
{
return_value = Msg.wParam;
return 0;
}
return 1;
}
void winmain_memalloc_failure()

View File

@ -1,4 +1,6 @@
#pragma once
static int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd);
static void winmain_memalloc_failure();
static LRESULT CALLBACK message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
int ProcessWindowMessages();