Changed screenWidth and screenHeight to #defines.

This commit is contained in:
Julie Marchant 2019-05-20 11:25:05 -04:00
parent e51c55b16b
commit aa9d673aab
5 changed files with 20 additions and 14 deletions

View File

@ -33,9 +33,15 @@ AC_ARG_VAR([SF_SCREEN_WIDTH], [The width of the game window in pixels])
AC_ARG_VAR([SF_SCREEN_HEIGHT], [The height of the game window in pixels]) AC_ARG_VAR([SF_SCREEN_HEIGHT], [The height of the game window in pixels])
AS_IF([test -n "$SF_SCREEN_WIDTH"], [ AS_IF([test -n "$SF_SCREEN_WIDTH"], [
STARFIGHTER_CFLAGS="$STARFIGHTER_CFLAGS -DSCREEN_WIDTH=$SF_SCREEN_WIDTH" STARFIGHTER_CFLAGS="$STARFIGHTER_CFLAGS -DSCREEN_WIDTH=$SF_SCREEN_WIDTH"
echo "Using default screen width of $SF_SCREEN_WIDTH"
], [
echo "Using built-in screen width default"
]) ])
AS_IF([test -n "$SF_SCREEN_HEIGHT"], [ AS_IF([test -n "$SF_SCREEN_HEIGHT"], [
STARFIGHTER_CFLAGS="$STARFIGHTER_CFLAGS -DSCREEN_HEIGHT=$SF_SCREEN_HEIGHT" STARFIGHTER_CFLAGS="$STARFIGHTER_CFLAGS -DSCREEN_HEIGHT=$SF_SCREEN_HEIGHT"
echo "Using default screen height of $SF_SCREEN_HEIGHT"
], [
echo "Using built-in screen height default"
]) ])
AC_SUBST([STARFIGHTER_CFLAGS]) AC_SUBST([STARFIGHTER_CFLAGS])

View File

@ -59,7 +59,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FULLSCREEN SDL_WINDOW_FULLSCREEN #define FULLSCREEN SDL_WINDOW_FULLSCREEN
#define DEFAULT_SCREEN_WIDTH MAX(SCREEN_WIDTH, 640)
#define DEFAULT_SCREEN_HEIGHT MAX(SCREEN_HEIGHT, 480)
#define STARS_NUM 200 #define STARS_NUM 200
const int xViewBorder = 100;
const int yViewBorder = 100;
const float cameraMaxSpeed = 3.;
const int maxHoming = 20;
const int maxDoubleHoming = 15;
const int maxMicroHoming = 10;
const int rayDamageDelay = 10;
// Object Flags // Object Flags
#define FL_WEAPCO 1 #define FL_WEAPCO 1
@ -755,15 +765,5 @@ const char * const systemBackground[] = {
}; };
const int rate2reload[6] = {15, 15, 13, 11, 9, 7}; const int rate2reload[6] = {15, 15, 13, 11, 9, 7};
const int screenWidth = MAX(SCREEN_WIDTH, 640);
const int screenHeight = MAX(SCREEN_HEIGHT, 480);
const int xViewBorder = 100;
const int yViewBorder = 100;
const float cameraMaxSpeed = 3.;
const int maxHoming = 20;
const int maxDoubleHoming = 15;
const int maxMicroHoming = 10;
const int rayDamageDelay = 10;
#endif #endif

View File

@ -267,11 +267,11 @@ void engine_setMode()
engine.useMusic = useMusic; engine.useMusic = useMusic;
engine.autoPause = autoPause; engine.autoPause = autoPause;
screen = SDL_CreateRGBSurface(0, screenWidth, screenHeight, 32, 0xff0000, 0xff00, 0xff, 0xff000000); screen = SDL_CreateRGBSurface(0, DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
if (!screen) if (!screen)
{ {
printf("Couldn't create %ix%ix32 surface: %s\n", screenWidth, screenHeight, SDL_GetError()); printf("Couldn't create %ix%ix32 surface: %s\n", DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, SDL_GetError());
exit(1); exit(1);
} }

View File

@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern Planet intermission_planets[MAX_PLANETS]; extern Planet intermission_planets[MAX_PLANETS];
const int intermission_ycenter = 50 + (screenHeight - 150) / 2; const int intermission_ycenter = 50 + (DEFAULT_SCREEN_HEIGHT - 150) / 2;
void intermission_initPlanets(int system); void intermission_initPlanets(int system);
void intermission_unlockPlanets(); void intermission_unlockPlanets();

View File

@ -44,7 +44,7 @@ typedef struct ShopItem_ {
} ShopItem; } ShopItem;
static const int shop_w = 600; static const int shop_w = 600;
static const int shop_x = screenWidth / 2 - shop_w / 2; static const int shop_x = DEFAULT_SCREEN_WIDTH / 2 - shop_w / 2;
static const int shop_h = 336; static const int shop_h = 336;
static const int shop_y = intermission_ycenter - shop_h / 2; static const int shop_y = intermission_ycenter - shop_h / 2;