Revert "Adapt the menu properly when resizing the window."

This reverts commit 4b2811b56b.
This commit is contained in:
Julie Marchant 2019-05-30 18:02:33 -04:00
parent dabda7f436
commit 3c866fe150
1 changed files with 74 additions and 77 deletions

View File

@ -211,15 +211,12 @@ This is the main title screen, with the stars whirling past and the
*/
int title_show()
{
int continueSaveSlot = -1;
int continueSaveSlot;
int lastScreenW = -1;
int lastScreenH = -1;
int prx = 0;
int pry = 0;
int sfx = 0;
int sfy = 0;
int prx;
int pry;
int sfx;
int sfy;
int then;
int now;
@ -251,59 +248,14 @@ int title_show()
renderer_update();
screen_clear(black);
continueSaveSlot = save_initSlots();
gfx_loadBackground("gfx/spirit.jpg");
SDL_Surface *prlogo, *sflogo;
prlogo = gfx_loadImage("gfx/prlogo.png");
sflogo = gfx_loadImage("gfx/sflogo.png");
// Set the star motion
engine.ssx = -0.5;
engine.ssy = 0;
engine.smx = 0;
engine.smy = 0;
then = SDL_GetTicks();
for (int i = 0 ; i < 15 ; i++)
{
aliens[i] = alien_defs[rand() % 3];
if ((rand() % 5) == 0)
aliens[i] = alien_defs[CD_TRANSPORTSHIP];
if ((rand() % 5) == 0)
aliens[i] = alien_defs[CD_MINER];
aliens[i].x = rand() % screen->w;
aliens[i].y = rand() % (screen->h - 40);
aliens[i].dx = 1 + rand() % 3;
aliens[i].face = 0;
}
sprintf(buildVersion, "Version %s", VERSION );
SDL_Rect optionRec;
// Initializing is actually unnecessary as these will get
// overridden; these are just here to suppress compiler warnings.
optionRec.x = screen->w / 2 - 110;
optionRec.y = screen->h / 3 + 45;
optionRec.h = 22;
optionRec.w = 215;
screen_drawBackground();
engine.done = 0;
player_flushInput();
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
audio_playMusic("music/walking_among_androids.ogg", 1);
while (!engine.done)
{
if ((lastScreenW != screen->w) || (lastScreenH != screen->h))
{
lastScreenW = screen->w;
lastScreenH = screen->h;
prx = ((screen->w - prlogo->w) / 2);
pry = ((screen->h - prlogo->h) / 2);
@ -329,23 +281,58 @@ int title_show()
gfx_createTextObject(TS_QUIT, "QUIT",
-1, screen->h / 3 + 150, FONT_WHITE);
continueSaveSlot = save_initSlots();
createOptionsMenu();
createDifficultyMenu();
gfx_createTextObject(TS_BACK_TO_MAIN_MENU, "BACK TO MAIN MENU", -1, 0, FONT_WHITE);
createCheatMenu();
// Set the star motion
engine.ssx = -0.5;
engine.ssy = 0;
engine.smx = 0;
engine.smy = 0;
then = SDL_GetTicks();
for (int i = 0 ; i < 15 ; i++)
{
aliens[i] = alien_defs[rand() % 3];
if ((rand() % 5) == 0)
aliens[i] = alien_defs[CD_TRANSPORTSHIP];
if ((rand() % 5) == 0)
aliens[i] = alien_defs[CD_MINER];
aliens[i].x = rand() % screen->w;
aliens[i].y = rand() % (screen->h - 40);
aliens[i].dx = 1 + rand() % 3;
aliens[i].face = 0;
}
sprintf(buildVersion, "Version %s", VERSION );
SDL_Rect optionRec;
optionRec.x = screen->w / 2 - 110;
optionRec.y = screen->h / 3 + 45;
optionRec.h = 22;
optionRec.w = 215;
optionRec.y = screen->h / 3 + 26 + (20 * selectedOption);
if ((menuType > MENU_MAIN) && (selectedOption == listLength))
optionRec.y += 20;
if (continueSaveSlot != -1)
{
selectedOption = 3;
optionRec.y += 40;
}
screen_drawBackground();
engine.done = 0;
player_flushInput();
engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
audio_playMusic("music/walking_among_androids.ogg", 1);
while (!engine.done)
{
renderer_update();
screen_unBuffer();
@ -416,8 +403,9 @@ int title_show()
{
engine.keyState[KEY_UP] = 0;
WRAP_ADD(selectedOption, -1, 1, listLength + 1);
if ((menuType == MENU_MAIN) && (selectedOption == 3) &&
(continueSaveSlot == -1))
if (menuType == MENU_MAIN)
if (selectedOption == 3)
if (continueSaveSlot == -1)
selectedOption = 2;
}
if (engine.keyState[KEY_DOWN])
@ -431,24 +419,24 @@ int title_show()
}
optionRec.y = screen->h / 3 + 26 + (20 * selectedOption);
if ((menuType > MENU_MAIN) && (selectedOption == listLength))
if (menuType > MENU_MAIN)
if (selectedOption == listLength)
optionRec.y += 20;
if (!skip)
{
gfx_renderString("Copyright Parallel Realities 2003",
5, gfx_background->h - 60, FONT_WHITE, 0, gfx_background);
gfx_renderString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012",
5, gfx_background->h - 40, FONT_WHITE, 0, gfx_background);
gfx_renderString("Copyright 2015-2017 Julie Marchant",
5, gfx_background->h - 20, FONT_WHITE, 0, gfx_background);
gfx_renderString(buildVersion, gfx_background->w - 6 - strlen(buildVersion) * 9,
gfx_background->h - 20, FONT_WHITE, 0, gfx_background);
screen_addBuffer(0, 0, screen->w, screen->h);
skip = 1;
}
}
if (skip)
{
gfx_renderString("Copyright Parallel Realities 2003",
5, screen->h - 60, FONT_WHITE, 0, screen);
gfx_renderString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012",
5, screen->h - 40, FONT_WHITE, 0, screen);
gfx_renderString("Copyright 2015-2019 Julie Marchant",
5, screen->h - 20, FONT_WHITE, 0, screen);
gfx_renderString(buildVersion, screen->w - 6 - strlen(buildVersion) * 9,
screen->h - 20, FONT_WHITE, 0, screen);
screen_addBuffer(0, screen->h - 40, screen->w, 40);
}
player_getInput();
@ -457,6 +445,15 @@ int title_show()
{
if ((now - then <= 27500) && (!skip))
{
gfx_renderString("Copyright Parallel Realities 2003",
5, screen->h - 60, FONT_WHITE, 0, gfx_background);
gfx_renderString("Copyright Guus Sliepen, Astrid S. de Wijn and others 2012",
5, screen->h - 40, FONT_WHITE, 0, gfx_background);
gfx_renderString("Copyright 2015-2019 Julie Marchant",
5, screen->h - 20, FONT_WHITE, 0, gfx_background);
gfx_renderString(buildVersion, screen->w - 6 - strlen(buildVersion) * 9,
screen->h - 20, FONT_WHITE, 0, gfx_background);
screen_addBuffer(0, screen->h - 40, screen->w, 40);
skip = 1;
}
else