From 9dacb5c6eee9f7c04d9cc992ad12069dad4c805f Mon Sep 17 00:00:00 2001 From: ghaushe Date: Tue, 7 Jan 2003 18:55:54 +0000 Subject: [PATCH] added settings menu to PCMenus, use correct font for PCMenus. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@535 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/ChangeLog | 3 +- sc2/TODO | 2 - sc2/src/sc2code/gameopt.c | 16 ++++- sc2/src/sc2code/planets/scan.c | 8 +-- sc2/src/sc2code/sis.c | 116 +++++++++++++++++++++++---------- 5 files changed, 100 insertions(+), 45 deletions(-) diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 9af373892..7ea2b4073 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,7 +1,8 @@ Changes towards version 0.2: +- PCMenus now suports 'settings', and menu font is correct -PhracturedBlue - Added '-b' option to get PC Menus -PhracturedBlue - Check for a deadlock in savedgames and try to continue -PhracturedBlue -- Added an option ('-a') to display 'PC-style' course-scan -PhracturedBlue +- Added an option ('-a') to display 'PC-style' coarse-scan -PhracturedBlue - Fixed deadlock races in new FlushGraphics method -PhracturedBlue - FlushGraphics now waits and notifies on a per-thread level - No longer using SHGetFolderPath on Windows - SvdB diff --git a/sc2/TODO b/sc2/TODO index de4c7ad10..3a542bb06 100644 --- a/sc2/TODO +++ b/sc2/TODO @@ -87,8 +87,6 @@ Implementation bugs (low priority): to disappear sometimes. The scaling should be made trilinear instead of nearest neighbor. - PC Menu still has some issues - - 3DO menu is still used for selecting game options - - Menu Font is wrong (the PC font doesn't appear to exist in UQM) - Still using 3DO menu hierarchy, so menu text isn't identical to PC Stuff still to do (large): - add some way to configure your keys diff --git a/sc2/src/sc2code/gameopt.c b/sc2/src/sc2code/gameopt.c index d472b8944..8bdbd9db8 100644 --- a/sc2/src/sc2code/gameopt.c +++ b/sc2/src/sc2code/gameopt.c @@ -19,6 +19,7 @@ #include #include "starcon.h" #include "commglue.h" +#include "options.h" #include "libs/graphics/gfx_common.h" //Added by Chris @@ -104,6 +105,7 @@ static void FeedbackSetting (BYTE which_setting) { UNICODE buf[20]; + char tmpstr[3]; buf[0] = '\0'; switch (which_setting) @@ -126,10 +128,20 @@ FeedbackSetting (BYTE which_setting) case CYBORG_NORMAL_SETTING: case CYBORG_DOUBLE_SETTING: case CYBORG_SUPER_SETTING: - wsprintf (buf, "%s %s", + if (optPCmenu && which_setting > CYBORG_NORMAL_SETTING) + { + if (which_setting == CYBORG_DOUBLE_SETTING) + strcpy (tmpstr, "+"); + else + strcpy (tmpstr, "++"); + } + else + tmpstr[0] = 0; + wsprintf (buf, "%s %s%s", GAME_STRING (OPTION_STRING_BASE + 2), !(GLOBAL (glob_flags) & CYBORG_ENABLED) - ? GAME_STRING (OPTION_STRING_BASE + 3) : GAME_STRING (OPTION_STRING_BASE + 4)); + ? GAME_STRING (OPTION_STRING_BASE + 3) : GAME_STRING (OPTION_STRING_BASE + 4), + tmpstr); break; case CHANGE_CAPTAIN_SETTING: case CHANGE_SHIP_SETTING: diff --git a/sc2/src/sc2code/planets/scan.c b/sc2/src/sc2code/planets/scan.c index ec3b0ab96..2b2037c7b 100644 --- a/sc2/src/sc2code/planets/scan.c +++ b/sc2/src/sc2code/planets/scan.c @@ -193,7 +193,7 @@ PrintCoarseScanPC (void) if (temp >= 10 * 100) wsprintf (buf, "%u.%u a.u.", temp / 100, (temp / 10) % 10); else - wsprintf (buf, "%u.%02u a.u", temp / 100, temp % 100); + wsprintf (buf, "%u.%02u a.u.", temp / 100, temp % 100); t.CharCount = (COUNT)~0; DrawText (&t); t.baseline.y += SCAN_LEADING_PC; @@ -267,9 +267,9 @@ PrintCoarseScanPC (void) / (DWORD)(100L * 100L)) == 0) tr = 1; if (tr >= 10 * 100) - wsprintf (buf, "%lu.%lu e.s", tr / 100, (tr / 10) % 10); + wsprintf (buf, "%lu.%lu e.s.", tr / 100, (tr / 10) % 10); else - wsprintf (buf, "%lu.%02lu e.s", tr / 100, tr % 100); + wsprintf (buf, "%lu.%02lu e.s.", tr / 100, tr % 100); } t.CharCount = (COUNT)~0; DrawText (&t); @@ -282,7 +282,7 @@ PrintCoarseScanPC (void) if ((temp = pSolarSysState->SysInfo.PlanetInfo.PlanetRadius) >= 10 * 100) wsprintf (buf, "%u.%u e.s.", temp / 100, (temp / 10) % 10); else - wsprintf (buf, "%u.%02u e.s", temp / 100, temp % 100); + wsprintf (buf, "%u.%02u e.s.", temp / 100, temp % 100); t.CharCount = (COUNT)~0; DrawText (&t); t.baseline.y += SCAN_LEADING_PC; diff --git a/sc2/src/sc2code/sis.c b/sc2/src/sc2code/sis.c index bfa896fba..88c9f9fc4 100644 --- a/sc2/src/sc2code/sis.c +++ b/sc2/src/sc2code/sis.c @@ -1111,38 +1111,45 @@ DrawPCMenuFrame (RECT *r) } static char menu_string[][11] = { - "SCAN", - "STARMAP", - "DEVICES", - "CARGO", - "ROSTER", - "GAME", - "NAVIGATE", + "scan", + "starmap", + "devices", + "cargo", + "roster", + "game", + "navigate", - "MINERAL", - "ENERGY", - "BIOLOGICAL", - "EXIT MENU", - "AUTO SCAN", - "DISPATCH", + "mineral", + "energy", + "biological", + "exit menu", + "autoscan", + "dispatch", - "SAVE GAME", - "LOAD GAME", - "SETTINGS", - "EXIT MENU", + "save game", + "load game", + "settings", + "exit menu", - "CONVERSE", - "ATTACK!", - "GAME", + "converse", + "attack!", + "game", - "FUEL", - "MODULE", - "GAME", - "EXIT MENU", + "fuel", + "module", + "game", + "exit menu", - "CREW", - "GAME", - "EXIT MENU", + "crew", + "game", + "exit menu", + + "sound", + "music", + "cyborg", + "captain", + "ship", + "exit menu" }; static void @@ -1151,24 +1158,24 @@ DrawPCMenu (BYTE beg_index, BYTE end_index, BYTE NewState, BYTE hilite, RECT *r) #define PC_MENU_HEIGHT 8 BYTE pos; COUNT i; - int num_items, offset; + int num_items; FONT OldFont; TEXT t; UNICODE buf[40]; pos = beg_index + NewState; num_items = 1 + end_index - beg_index; + r->corner.x -= 1; + r->extent.width += 1; DrawFilledRectangle (r); - r->corner.x += 1; - r->extent.width -= 1; if (num_items * PC_MENU_HEIGHT > r->extent.height) fprintf (stderr, "Warning, no room for all menu items!\n"); else r->corner.y += (r->extent.height - num_items * PC_MENU_HEIGHT) / 2; r->extent.height = num_items * PC_MENU_HEIGHT + 4; DrawPCMenuFrame (r); - OldFont = SetContextFont (TinyFont); + OldFont = SetContextFont (StarConFont); t.align = ALIGN_LEFT; - t.baseline.x = r->corner.x + 3; + t.baseline.x = r->corner.x + 2; t.baseline.y = r->corner.y + PC_MENU_HEIGHT -1; t.pStr = buf; t.CharCount = (COUNT)~0; @@ -1252,19 +1259,56 @@ DrawMenuStateStrings (BYTE beg_index, SWORD NewState) r.extent.width = RADAR_WIDTH + 2; BatchGraphics (); SetContextForeGroundColor (BUILD_COLOR (MAKE_RGB15 (0xA, 0xA, 0xA), 0x08)); - if (s.frame && optPCmenu && beg_index != PM_SOUND_ON) + if (s.frame && optPCmenu) { if (beg_index == PM_CREW) - sprintf (menu_string[PM_CREW], "CREW(%d)", GLOBAL (CrewCost)); + sprintf (menu_string[PM_CREW], "crew(%d)", GLOBAL (CrewCost)); if (beg_index == PM_FUEL) - sprintf (menu_string[PM_FUEL], "FUEL(%d)", GLOBAL (FuelCost)); + sprintf (menu_string[PM_FUEL], "fuel(%d)", GLOBAL (FuelCost)); + if (beg_index == PM_SOUND_ON) + { + end_index = beg_index + 5; + switch (beg_index + NewState) + { + case PM_SOUND_ON: + case PM_SOUND_OFF: + NewState = 0; + break; + case PM_MUSIC_ON: + case PM_MUSIC_OFF: + NewState = 1; + break; + case PM_CYBORG_OFF: + case PM_CYBORG_NORMAL: + case PM_CYBORG_DOUBLE: + case PM_CYBORG_SUPER: + NewState = 2; + break; + case PM_CHANGE_CAPTAIN: + NewState = 3; + break; + case PM_CHANGE_SHIP: + NewState = 4; + break; + case PM_EXIT_MENU4: + NewState = 5; + break; + } + } r.extent.height = RADAR_HEIGHT + 11; DrawPCMenu (beg_index, end_index, (BYTE)NewState, hilite, &r); s.frame = 0; } else { - r.extent.height = 11; + if(optPCmenu) + { + r.corner.x -= 1; + r.extent.width += 1; + r.extent.height = RADAR_HEIGHT + 11; + } + else + r.extent.height = 11; DrawFilledRectangle (&r); } if (s.frame)