Made it so that the save and options sections work at 640x480.

This commit is contained in:
onpon4 2017-02-02 17:45:47 -05:00
parent e981acded2
commit b66d7c410d
3 changed files with 32 additions and 26 deletions

View File

@ -1153,7 +1153,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss
engine.commsSection = 1; engine.commsSection = 1;
} }
static void intermission_doComms(SDL_Surface *comms) static void intermission_doComms(SDL_Surface *comms, int x, int y)
{ {
if ((engine.keyState[KEY_FIRE])) if ((engine.keyState[KEY_FIRE]))
{ {
@ -1161,7 +1161,7 @@ static void intermission_doComms(SDL_Surface *comms)
{ {
for (int i = 0 ; i < 4 ; i++) for (int i = 0 ; i < 4 ; i++)
{ {
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 170, 180 + (i * 60), 430, 50)) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x, y + 110 + (i * 60), 430, 50))
{ {
intermission_createMissionDetailSurface(comms, i); intermission_createMissionDetailSurface(comms, i);
engine.keyState[KEY_FIRE] = 0; engine.keyState[KEY_FIRE] = 0;
@ -1170,7 +1170,7 @@ static void intermission_doComms(SDL_Surface *comms)
} }
else else
{ {
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 170, 440, 160, 20)) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x, y + 370, 160, 20))
{ {
intermission_createCommsSurface(comms); intermission_createCommsSurface(comms);
engine.keyState[KEY_FIRE] = 0; engine.keyState[KEY_FIRE] = 0;
@ -1221,30 +1221,30 @@ static void intermission_createOptions(SDL_Surface *optionsSurface)
gfx_renderString("FULLSCREEN", 30, 150, FONT_WHITE, 0, optionsSurface); gfx_renderString("FULLSCREEN", 30, 150, FONT_WHITE, 0, optionsSurface);
} }
static void intermission_doOptions(SDL_Surface *optionsSurface) static void intermission_doOptions(SDL_Surface *optionsSurface, int x, int y)
{ {
if ((engine.keyState[KEY_FIRE])) if ((engine.keyState[KEY_FIRE]))
{ {
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 172, 45, 22)) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 187, y + 42, 45, 22))
engine.useSound = 1; engine.useSound = 1;
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 478, 172, 45, 22)) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 248, y + 42, 45, 22))
engine.useSound = 0; engine.useSound = 0;
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 222, 45, 22)) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 187, y + 92, 45, 22))
{ {
engine.useMusic = 1; engine.useMusic = 1;
audio_playMusic("music/through_space.ogg", -1); audio_playMusic("music/through_space.ogg", -1);
} }
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 478, 222, 45, 22)) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 248, y + 92, 45, 22))
{ {
engine.useMusic = 0; engine.useMusic = 0;
audio_haltMusic(); audio_haltMusic();
} }
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 417, 272, 45, 22)) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 187, y + 142, 45, 22))
{ {
if (!engine.fullScreen) if (!engine.fullScreen)
{ {
@ -1253,7 +1253,7 @@ static void intermission_doOptions(SDL_Surface *optionsSurface)
} }
} }
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 478, 272, 45, 22)) if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 248, y + 142, 45, 22))
{ {
if (engine.fullScreen) if (engine.fullScreen)
{ {
@ -1566,8 +1566,10 @@ int intermission()
break; break;
case 3: case 3:
screen_blit(savesSurface, 200, 100); x = screen->w / 2 - savesSurface->w / 2;
saveSlot = save_showSlots(savesSurface, saveSlot); y = 50;
screen_blit(savesSurface, x, y);
saveSlot = save_showSlots(savesSurface, saveSlot, x, y);
break; break;
case 4: case 4:
@ -1575,13 +1577,17 @@ int intermission()
break; break;
case 5: case 5:
screen_blit(commsSurface, 170, 70); x = screen->w / 2 - commsSurface->w / 2;
intermission_doComms(commsSurface); y = 50;
screen_blit(commsSurface, x, y);
intermission_doComms(commsSurface, x, y);
break; break;
case 6: case 6:
screen_blit(optionsSurface, 230, 130); x = screen->w / 2 - optionsSurface->w / 2;
intermission_doOptions(optionsSurface); y = 50;
screen_blit(optionsSurface, x, y);
intermission_doOptions(optionsSurface, x, y);
break; break;
case 7: case 7:

View File

@ -419,13 +419,13 @@ Displays the save slot available. For use with an interface that
has the cursor enabled. It returns the index number of the slot clicked has the cursor enabled. It returns the index number of the slot clicked
so that the function invoking it can perform a load or save on that slot. so that the function invoking it can perform a load or save on that slot.
*/ */
int save_showSlots(SDL_Surface *savesSurface, int saveSlot) int save_showSlots(SDL_Surface *savesSurface, int saveSlot, int x, int y)
{ {
int clickedSlot = -1; int clickedSlot = -1;
SDL_Rect r; SDL_Rect r;
r.x = 201; r.x = x + 1;
r.y = 115; r.y = y + 15;
r.w = 348; r.w = 348;
r.h = 25; r.h = 25;
@ -442,19 +442,19 @@ int save_showSlots(SDL_Surface *savesSurface, int saveSlot)
r.y += 30; r.y += 30;
} }
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 215, if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6,
365, 100, 25)) x + 15, y + 265, 100, 25))
{ {
save(saveSlot); save(saveSlot);
save_createSurface(savesSurface, -10); save_createSurface(savesSurface, -10);
} }
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 335, if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6,
365, 100, 25)) x + 135, y + 265, 100, 25))
save_createSurface(savesSurface, -1); save_createSurface(savesSurface, -1);
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 453, if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6,
365, 100, 25)) x + 253, y + 265, 100, 25))
{ {
char filename[PATH_MAX]; char filename[PATH_MAX];
sprintf(filename, "%ssave%.2d.dat", engine.configDirectory, sprintf(filename, "%ssave%.2d.dat", engine.configDirectory,

View File

@ -29,6 +29,6 @@ int save_initSlots();
int save_load(int slot); int save_load(int slot);
void save(int slot); void save(int slot);
void save_createSurface(SDL_Surface *savesSurface, int clickedSlot); void save_createSurface(SDL_Surface *savesSurface, int clickedSlot);
int save_showSlots(SDL_Surface *savesSurface, int saveSlot); int save_showSlots(SDL_Surface *savesSurface, int saveSlot, int x, int y);
#endif #endif