X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=bd5eb569e6954b7698e639910e039fb983d55afa;hb=dff0e0c8702770fe23992f07964ebe9ed54e9f7c;hp=c78cfd13bda9f9a3cf12372cea87f4ba3687e84f;hpb=462bca0782be497b984922afda26b5bf12bd3d75;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index c78cfd13..bd5eb569 100644 --- a/src/screens.c +++ b/src/screens.c @@ -23,6 +23,7 @@ #include "cartoons.h" #include "network.h" #include "init.h" +#include "config.h" /* screens in the setup menu */ #define SETUP_MODE_MAIN 0 @@ -54,9 +55,10 @@ #define INFO_MODE_MUSIC 3 #define INFO_MODE_CREDITS 4 #define INFO_MODE_PROGRAM 5 -#define INFO_MODE_LEVELSET 6 +#define INFO_MODE_VERSION 6 +#define INFO_MODE_LEVELSET 7 -#define MAX_INFO_MODES 7 +#define MAX_INFO_MODES 8 /* for various menu stuff */ #define MENU_SCREEN_START_XPOS 1 @@ -153,6 +155,7 @@ static void HandleInfoScreen_Elements(int); static void HandleInfoScreen_Music(int); static void HandleInfoScreen_Credits(int); static void HandleInfoScreen_Program(int); +static void HandleInfoScreen_Version(int); static void MapScreenMenuGadgets(int); static void MapScreenTreeGadgets(TreeInfo *); @@ -505,8 +508,8 @@ static void DrawCursorAndText_Main_Ext(int nr, boolean active_text, if (pos_text != NULL && text != NULL) { struct MenuPosInfo *pos = pos_text; - int x = mSX + ALIGNED_XPOS(pos->x, pos->width, pos->align); - int y = mSY + pos->y; + int x = mSX + ALIGNED_MENU_XPOS(pos); + int y = mSY + ALIGNED_MENU_YPOS(pos); DrawBackgroundForFont(x, y, pos->width, pos->height, font_text); DrawText(x, y, text, font_text); @@ -515,8 +518,8 @@ static void DrawCursorAndText_Main_Ext(int nr, boolean active_text, if (pos_input != NULL && input != NULL) { struct MenuPosInfo *pos = pos_input; - int x = mSX + ALIGNED_XPOS(pos->x, pos->width, pos->align); - int y = mSY + pos->y; + int x = mSX + ALIGNED_MENU_XPOS(pos); + int y = mSY + ALIGNED_MENU_YPOS(pos); DrawBackgroundForFont(x, y, pos->width, pos->height, font_input); DrawText(x, y, input, font_input); @@ -553,8 +556,8 @@ static boolean insideMenuPosRect(struct MenuPosInfo *rect, int x, int y) if (rect == NULL) return FALSE; - int rect_x = ALIGNED_XPOS(rect->x, rect->width, rect->align); - int rect_y = rect->y; + int rect_x = ALIGNED_MENU_XPOS(rect); + int rect_y = ALIGNED_MENU_YPOS(rect); return (x >= rect_x && x < rect_x + rect->width && y >= rect_y && y < rect_y + rect->height); @@ -809,7 +812,7 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) /* needed if last screen (level choice) changed graphics, sounds or music */ ReloadCustomArtwork(0); -#ifdef TARGET_SDL +#if defined(TARGET_SDL) SetDrawtoField(DRAW_BACKBUFFER); #endif @@ -1506,6 +1509,12 @@ static void execInfoProgram() DrawInfoScreen(); } +static void execInfoVersion() +{ + info_mode = INFO_MODE_VERSION; + DrawInfoScreen(); +} + static void execInfoLevelSet() { info_mode = INFO_MODE_LEVELSET; @@ -1525,6 +1534,7 @@ static struct TokenInfo info_info_main[] = { TYPE_ENTER_SCREEN, execInfoMusic, "Music Info" }, { TYPE_ENTER_SCREEN, execInfoCredits, "Credits" }, { TYPE_ENTER_SCREEN, execInfoProgram, "Program Info" }, + { TYPE_ENTER_SCREEN, execInfoVersion, "Version Info" }, { TYPE_ENTER_SCREEN, execInfoLevelSet, "Level Set Info" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execExitInfo, "Exit" }, @@ -1849,7 +1859,11 @@ static char *getHelpText(int element, int action, int direction) void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) { +#if 1 + int font_nr = FONT_INFO_ELEMENTS; +#else int font_nr = FONT_LEVEL_NUMBER; +#endif int font_width = getFontWidth(font_nr); int sx = mSX + MINI_TILEX + TILEX + MINI_TILEX; int sy = mSY + 65 + 2 * 32 + 1; @@ -2447,12 +2461,154 @@ void HandleInfoScreen_Program(int button) } } +void DrawInfoScreen_Version() +{ + int font_header = FONT_TEXT_3; + int font_text = FONT_TEXT_2; + int xstep = getFontWidth(font_text); + int ystep = getFontHeight(font_text); + int xstart1 = SX + 2 * xstep; + int xstart2 = SX + 18 * xstep; + int xstart3 = SX + 28 * xstep; + int ystart = 150; + int ybottom = SYSIZE - 20; +#if defined(TARGET_SDL) + SDL_version sdl_version_compiled; + const SDL_version *sdl_version_linked; +#endif + + SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_PROGRAM); + + FadeOut(REDRAW_FIELD); + + ClearWindow(); + DrawHeadline(); + + DrawTextSCentered(100, FONT_TEXT_1, "Version Information:"); + + DrawTextF(xstart1, ystart, font_header, "Name"); + DrawTextF(xstart2, ystart, font_text, PROGRAM_TITLE_STRING); + + ystart += ystep; + DrawTextF(xstart1, ystart, font_header, "Version"); + DrawTextF(xstart2, ystart, font_text, getProgramFullVersionString()); + + ystart += ystep; + DrawTextF(xstart1, ystart, font_header, "Platform"); + DrawTextF(xstart2, ystart, font_text, PLATFORM_STRING); + + ystart += ystep; + DrawTextF(xstart1, ystart, font_header, "Target"); + DrawTextF(xstart2, ystart, font_text, TARGET_STRING); + + ystart += ystep; + DrawTextF(xstart1, ystart, font_header, "Compile time"); + DrawTextF(xstart2, ystart, font_text, getCompileDateString()); + +#if defined(TARGET_SDL) + ystart += 3 * ystep; + DrawTextF(xstart1, ystart, font_header, "Library"); + DrawTextF(xstart2, ystart, font_header, "compiled"); + DrawTextF(xstart3, ystart, font_header, "linked"); + + SDL_VERSION(&sdl_version_compiled); + sdl_version_linked = SDL_Linked_Version(); + + ystart += 2 * ystep; + DrawTextF(xstart1, ystart, font_text, "SDL"); + DrawTextF(xstart2, ystart, font_text, "%d.%d.%d", + sdl_version_compiled.major, + sdl_version_compiled.minor, + sdl_version_compiled.patch); + DrawTextF(xstart3, ystart, font_text, "%d.%d.%d", + sdl_version_linked->major, + sdl_version_linked->minor, + sdl_version_linked->patch); + + SDL_IMAGE_VERSION(&sdl_version_compiled); +#if 0 + sdl_version_linked = IMG_Linked_Version(); +#else +#endif + + ystart += ystep; + DrawTextF(xstart1, ystart, font_text, "SDL_image"); + DrawTextF(xstart2, ystart, font_text, "%d.%d.%d", + sdl_version_compiled.major, + sdl_version_compiled.minor, + sdl_version_compiled.patch); +#if 0 + DrawTextF(xstart3, ystart, font_text, "%d.%d.%d", + sdl_version_linked->major, + sdl_version_linked->minor, + sdl_version_linked->patch); +#else + DrawTextF(xstart3, ystart, font_text, "?.?.?"); +#endif + + SDL_MIXER_VERSION(&sdl_version_compiled); + sdl_version_linked = Mix_Linked_Version(); + + ystart += ystep; + DrawTextF(xstart1, ystart, font_text, "SDL_mixer"); + DrawTextF(xstart2, ystart, font_text, "%d.%d.%d", + sdl_version_compiled.major, + sdl_version_compiled.minor, + sdl_version_compiled.patch); + DrawTextF(xstart3, ystart, font_text, "%d.%d.%d", + sdl_version_linked->major, + sdl_version_linked->minor, + sdl_version_linked->patch); + + ystart += ystep; + DrawTextF(xstart1, ystart, font_text, "SDL_net"); + DrawTextF(xstart2, ystart, font_text, "?.?.?"); + DrawTextF(xstart3, ystart, font_text, "?.?.?"); +#endif + + DrawTextSCentered(ybottom, FONT_TEXT_4, + "Press any key or button for info menu"); + + FadeIn(REDRAW_FIELD); +} + +void HandleInfoScreen_Version(int button) +{ + if (button == MB_MENU_LEAVE) + { + PlaySound(SND_MENU_ITEM_SELECTING); + + info_mode = INFO_MODE_MAIN; + DrawInfoScreen(); + + return; + } + else if (button == MB_MENU_CHOICE) + { + PlaySound(SND_MENU_ITEM_SELECTING); + + FadeSoundsAndMusic(); + FadeOut(REDRAW_FIELD); + + info_mode = INFO_MODE_MAIN; + DrawAndFadeInInfoScreen(REDRAW_FIELD); + } + else + { + PlayMenuSoundIfLoop(); + } +} + void DrawInfoScreen_LevelSet() { int ystart = 150; int ybottom = SYSIZE - 20; char *filename = getLevelSetInfoFilename(); +#if 1 + int font_nr = FONT_INFO_LEVELSET; +#else int font_nr = FONT_LEVEL_NUMBER; +#endif int font_width = getFontWidth(font_nr); int font_height = getFontHeight(font_nr); int pad_x = 32; @@ -2525,6 +2681,8 @@ static void DrawInfoScreenExt(int redraw_mask, boolean do_fading) DrawInfoScreen_Credits(); else if (info_mode == INFO_MODE_PROGRAM) DrawInfoScreen_Program(); + else if (info_mode == INFO_MODE_VERSION) + DrawInfoScreen_Version(); else if (info_mode == INFO_MODE_LEVELSET) DrawInfoScreen_LevelSet(); else @@ -2561,6 +2719,8 @@ void HandleInfoScreen(int mx, int my, int dx, int dy, int button) HandleInfoScreen_Credits(button); else if (info_mode == INFO_MODE_PROGRAM) HandleInfoScreen_Program(button); + else if (info_mode == INFO_MODE_VERSION) + HandleInfoScreen_Version(button); else if (info_mode == INFO_MODE_LEVELSET) HandleInfoScreen_LevelSet(button); else @@ -2579,8 +2739,8 @@ void HandleTypeName(int newxpos, Key key) struct MainControlInfo *mci = getMainControlInfo(MAIN_CONTROL_NAME); #if 1 struct MenuPosInfo *pos = mci->pos_input; - int startx = mSX + ALIGNED_XPOS(pos->x, pos->width, pos->align); - int starty = mSY + pos->y; + int startx = mSX + ALIGNED_MENU_XPOS(pos); + int starty = mSY + ALIGNED_MENU_YPOS(pos); #endif #if 1 static int xpos = 0; @@ -3407,6 +3567,7 @@ static struct TokenInfo setup_info_editor[] = { TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX-Boulderdash:" }, #endif { TYPE_SWITCH, &setup.editor.el_chars, "Text Characters:" }, + { TYPE_SWITCH, &setup.editor.el_steel_chars, "Text Characters (Steel):" }, { TYPE_SWITCH, &setup.editor.el_custom, "Custom & Group Elements:" }, #if 0 { TYPE_SWITCH, &setup.editor.el_headlines, "Headlines:" },