ref: b44e8ef6381ebd4a2579a22bf8ff1b427ee9437f
parent: c75e4291d7a56380d858c5b3fbee8ec23026a233
author: Iliyas Jorio <iliyas@jor.io>
date: Wed Feb 2 16:36:10 EST 2022
Command line switches
--- a/src/SDLU.cpp
+++ b/src/SDLU.cpp
@@ -31,9 +31,6 @@
// for event loop
static MBoolean s_isForeground = true;
-extern MBoolean widescreen;
-extern MBoolean fullscreen;
-
// for checktyping
struct BufferedKey
{
--- a/src/hiscore.cpp
+++ b/src/hiscore.cpp
@@ -28,8 +28,6 @@
using std::min;
-extern MBoolean widescreen;
-
Combo defaultBest =
{
/*bestGrid[kGridAcross][kGridDown] = */
--- a/src/level.cpp
+++ b/src/level.cpp
@@ -85,7 +85,6 @@
const int kCursorHeight = 32;
extern MBoolean useNewTitle;
-extern MBoolean widescreen;
static void InsertCursor( MPoint mouseHere, SDL_Surface* scratch, SDL_Surface* surface )
{
binary files a/src/main.cpp b/src/main.cpp differ
--- a/src/main.h
+++ b/src/main.h
@@ -253,7 +253,7 @@
extern int chain[2];
extern int blobTime[2], startTime, endTime;
extern MBoolean finished, pauseKey, showStartMenu;
-extern MBoolean fullscreen;
+extern MBoolean fullscreen, widescreen, crispUpscaling;
extern signed char grid[2][kGridAcross][kGridDown], suction[2][kGridAcross][kGridDown],
charred[2][kGridAcross][kGridDown], glow[2][kGridAcross][kGridDown];
extern MRect playerWindowZRect, playerWindowRect[2];
--- a/src/prefs.cpp
+++ b/src/prefs.cpp
@@ -22,12 +22,14 @@
Preference prefList[] =
{
- { "MusicOn", &musicOn, sizeof(MBoolean ) },
- { "SoundOn", &soundOn, sizeof(MBoolean ) },
- { "KeyBindings", playerKeys, sizeof(playerKeys) },
- { "HighScores", scores, sizeof(scores ) },
- { "BestCombo", &best, sizeof(best ) },
- { "Fullscreen", &fullscreen, sizeof(fullscreen) },
+ { "MusicOn", &musicOn, sizeof(MBoolean ) },
+ { "SoundOn", &soundOn, sizeof(MBoolean ) },
+ { "KeyBindings", playerKeys, sizeof(playerKeys ) },
+ { "HighScores", scores, sizeof(scores ) },
+ { "BestCombo", &best, sizeof(best ) },
+ { "Fullscreen", &fullscreen, sizeof(fullscreen ) },
+ { "Widescreen", &widescreen, sizeof(widescreen ) },
+ { "CrispUpscaling", &crispUpscaling, sizeof(crispUpscaling ) },
};
static std::fstream GetPrefsStream(std::ios::openmode openmode)
@@ -109,5 +111,37 @@
stream.write(pref.keyName, strlen(pref.keyName));
stream.write((const char*)&pref.valueLength, sizeof(pref.valueLength));
stream.write((const char*)pref.valuePtr, pref.valueLength);
+ }
+}
+
+void ParseCommandLine(int argc, char* argv[])
+{
+ for (int i = 1; i < argc; i++)
+ {
+ const char* arg = argv[i];
+
+ if (!strcmp(arg, "--crisp")) crispUpscaling = true;
+ if (!strcmp(arg, "--fullscreen")) fullscreen = true;
+ if (!strcmp(arg, "--widescreen")) widescreen = true;
+
+ if (!strcmp(arg, "--no-crisp")) crispUpscaling = false;
+ if (!strcmp(arg, "--no-fullscreen")) fullscreen = false;
+ if (!strcmp(arg, "--no-widescreen")) widescreen = false;
+
+ if (!strcmp(arg, "--help") || !strcmp(arg, "-h"))
+ {
+ printf(
+ "Candy Crisis source port - https://github.com/jorio/candycrisis\n"
+ "\n"
+ " --crisp pixel-perfect upscaling\n"
+ " --no-crisp upscale with bilinear filtering\n"
+ " --fullscreen run the game fullscreen\n"
+ " --no-fullscreen run the game in a window\n"
+ " --widescreen crop viewport to 16:9 aspect ratio\n"
+ " --no-widescreen use original 4:3 aspect ratio\n"
+ "\n"
+ );
+ exit(0);
+ }
}
}
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -2,3 +2,4 @@
void LoadPrefs( void );
void SavePrefs( void );
+void ParseCommandLine(int argc, char* argv[]);