Setup menu uses a background graphic now

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1532 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2005-02-11 08:52:52 +00:00
parent 09e5811bf2
commit 1bc33d31af
5 changed files with 62 additions and 89 deletions
+1
View File
@@ -1,4 +1,5 @@
Changes towards version 0.4: Changes towards version 0.4:
- Setup menu now uses a background contributed by Joffrey Smith
- If keys.cfg refers to a nonexistent joystick, the game will stil run - If keys.cfg refers to a nonexistent joystick, the game will stil run
(bug #660) -McMartin (bug #660) -McMartin
- Fixed support for languages other than English; loading font chars - Fixed support for languages other than English; loading font chars
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+1
View File
@@ -0,0 +1 @@
setupmenu.0.png -1 -1 0 0
+60 -88
View File
@@ -22,10 +22,12 @@
#include "options.h" #include "options.h"
#include "setup.h" #include "setup.h"
#include "sounds.h" #include "sounds.h"
#include "libs/gfxlib.h"
#include "libs/graphics/gfx_common.h" #include "libs/graphics/gfx_common.h"
#include "libs/graphics/widgets.h" #include "libs/graphics/widgets.h"
#include "libs/graphics/tfb_draw.h" #include "libs/graphics/tfb_draw.h"
#define MENU_BKG "lbm/setupmenu.ani"
typedef struct setup_menu_state { typedef struct setup_menu_state {
BOOLEAN (*InputFunc) (struct setup_menu_state *pInputState); BOOLEAN (*InputFunc) (struct setup_menu_state *pInputState);
@@ -52,6 +54,7 @@ typedef struct {
} MENU_CATEGORY; } MENU_CATEGORY;
static BOOLEAN DoSetupMenu (PSETUP_MENU_STATE pInputState); static BOOLEAN DoSetupMenu (PSETUP_MENU_STATE pInputState);
static STAMP bkgStamp = { {0, 0}, NULL };
static OPTION scaler_opts[] = { static OPTION scaler_opts[] = {
{ "None", { "None",
@@ -200,11 +203,6 @@ static OPTION resdriver_opts[] = {
}; };
static OPTION bpp_opts[] = { static OPTION bpp_opts[] = {
{ "8",
{ "8-bit paletted display.",
"",
""
} },
{ "16", { "16",
{ "16-bit color depth.", { "16-bit color depth.",
"", "",
@@ -237,7 +235,7 @@ static const char **tooltip;
static MENU_CATEGORY cmdline_opts[] = { static MENU_CATEGORY cmdline_opts[] = {
{ "Resolution", RES_OPTS, resdriver_opts, 0 }, { "Resolution", RES_OPTS, resdriver_opts, 0 },
{ "Color depth", 4, bpp_opts, 0 }, { "Color depth", 3, bpp_opts, 0 },
{ "Scaler", 5, scaler_opts, 0 }, { "Scaler", 5, scaler_opts, 0 },
{ "Scanlines", 2, scanlines_opts, 0 }, { "Scanlines", 2, scanlines_opts, 0 },
{ "Menu Style", 2, menu_opts, 0 }, { "Menu Style", 2, menu_opts, 0 },
@@ -290,7 +288,7 @@ static void
DrawMenu (PSETUP_MENU_STATE pInputState) DrawMenu (PSETUP_MENU_STATE pInputState)
{ {
RECT r; RECT r;
COLOR bg, dark, medium, title, oldtext; COLOR title, oldtext;
COLOR inactive, default_color, selected; COLOR inactive, default_color, selected;
FONT oldfont = SetContextFont (StarConFont); FONT oldfont = SetContextFont (StarConFont);
FONTEFFECT oldFontEffect = SetContextFontEffect (0, 0, 0); FONTEFFECT oldFontEffect = SetContextFontEffect (0, 0, 0);
@@ -303,16 +301,19 @@ DrawMenu (PSETUP_MENU_STATE pInputState)
r.extent.width = SCREEN_WIDTH - 4; r.extent.width = SCREEN_WIDTH - 4;
r.extent.height = SCREEN_HEIGHT - 4; r.extent.height = SCREEN_HEIGHT - 4;
dark = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x08), 0x01);
medium = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x10), 0x01);
bg = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x1A), 0x09);
title = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F); title = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F), 0x0F);
selected = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x00), 0x0E); selected = BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x00), 0x0E);
inactive = BUILD_COLOR (MAKE_RGB15 (0x18, 0x18, 0x18), 0x07); inactive = BUILD_COLOR (MAKE_RGB15 (0x18, 0x18, 0x1F), 0x07);
default_color = title; default_color = title;
DrawShadowedBox(&r, bg, dark, medium); if (!bkgStamp.frame)
{
bkgStamp.origin.x = 0;
bkgStamp.origin.y = 0;
bkgStamp.frame = CaptureDrawable (LoadCelFile (MENU_BKG));
}
DrawStamp (&bkgStamp);
oldtext = SetContextForeGroundColor (title); oldtext = SetContextForeGroundColor (title);
t.baseline.x = r.corner.x + (r.extent.width >> 1); t.baseline.x = r.corner.x + (r.extent.width >> 1);
@@ -344,7 +345,7 @@ DrawMenu (PSETUP_MENU_STATE pInputState)
} }
else else
{ {
SetContextForeGroundColor (inactive); SetContextForeGroundColor (title);
} }
font_DrawText (&t); font_DrawText (&t);
@@ -395,94 +396,71 @@ DrawMenu (PSETUP_MENU_STATE pInputState)
static BOOLEAN static BOOLEAN
DoSetupMenu (PSETUP_MENU_STATE pInputState) DoSetupMenu (PSETUP_MENU_STATE pInputState)
{ {
int opt, cat;
MENU_CATEGORY *menu = cmdline_opts;
if (!pInputState->initialized) if (!pInputState->initialized)
{ {
SetDefaultMenuRepeatDelay (); SetDefaultMenuRepeatDelay ();
pInputState->anim_frame_count = NUM_STEPS; SetTransitionSource (NULL);
pInputState->initialized = TRUE;
pInputState->NextTime = GetTimeCounter (); pInputState->NextTime = GetTimeCounter ();
pInputState->category = 0; pInputState->category = 0;
pInputState->option = 0;
SetDefaults (); SetDefaults ();
pInputState->option = menu[0].selected;
} }
BatchGraphics (); BatchGraphics ();
if (pInputState->anim_frame_count) DrawMenu (pInputState);
cat = pInputState->category;
opt = pInputState->option;
if (PulsedInputState.key[KEY_MENU_UP])
{ {
RECT r; cat--;
COLOR bg, dark, medium; if (cat < 0)
int frame;
pInputState->anim_frame_count -= 3;
if (pInputState->anim_frame_count < 0)
{ {
pInputState->anim_frame_count = 0; cat = NUM_OPTS-1;
} }
frame = pInputState->anim_frame_count; /* Preserve column if possible */
opt = menu[cat].selected;
r.corner.x = ((frame * X_STEP) >> 1) + 2;
r.corner.y = ((frame * Y_STEP) >> 1) + 2;
r.extent.width = X_STEP * (NUM_STEPS - frame) - 4;
r.extent.height = Y_STEP * (NUM_STEPS - frame) - 4;
dark = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x08), 0x01);
medium = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x10), 0x01);
bg = BUILD_COLOR (MAKE_RGB15 (0x00, 0x00, 0x1A), 0x09);
DrawShadowedBox (&r, bg, dark, medium);
} }
else else if (PulsedInputState.key[KEY_MENU_DOWN])
{ {
int opt, cat; cat++;
MENU_CATEGORY *menu = cmdline_opts; if (cat >= NUM_OPTS)
DrawMenu (pInputState);
cat = pInputState->category;
opt = pInputState->option;
if (PulsedInputState.key[KEY_MENU_UP])
{ {
cat--; cat = 0;
if (cat < 0)
{
cat = NUM_OPTS-1;
}
/* Preserve column if possible */
opt = menu[cat].selected;
} }
else if (PulsedInputState.key[KEY_MENU_DOWN]) opt = menu[cat].selected;
}
else if (PulsedInputState.key[KEY_MENU_LEFT])
{
opt--;
if (opt < 0)
{ {
cat++; opt = menu[cat].numopts - 1;
if (cat >= NUM_OPTS)
{
cat = 0;
}
opt = menu[cat].selected;
}
else if (PulsedInputState.key[KEY_MENU_LEFT])
{
opt--;
if (opt < 0)
{
opt = menu[cat].numopts - 1;
}
}
else if (PulsedInputState.key[KEY_MENU_RIGHT])
{
opt++;
if (opt >= menu[cat].numopts)
{
opt = 0;
}
}
pInputState->category = cat;
pInputState->option = opt;
if (PulsedInputState.key[KEY_MENU_SELECT])
{
cmdline_opts[cat].selected = opt;
} }
} }
else if (PulsedInputState.key[KEY_MENU_RIGHT])
{
opt++;
if (opt >= menu[cat].numopts)
{
opt = 0;
}
}
pInputState->category = cat;
pInputState->option = opt;
if (PulsedInputState.key[KEY_MENU_SELECT])
{
cmdline_opts[cat].selected = opt;
}
if (!pInputState->initialized)
{
pInputState->initialized = TRUE;
ScreenTransition (3, NULL);
}
UnbatchGraphics (); UnbatchGraphics ();
SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE); SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE);
pInputState->NextTime = GetTimeCounter (); pInputState->NextTime = GetTimeCounter ();
@@ -537,9 +515,6 @@ GetGlobalOptions (GLOBALOPTS *opts)
switch (ScreenColorDepth) switch (ScreenColorDepth)
{ {
case 8:
opts->depth = OPTVAL_8;
break;
case 16: case 16:
opts->depth = OPTVAL_16; opts->depth = OPTVAL_16;
break; break;
@@ -638,9 +613,6 @@ SetGlobalOptions (GLOBALOPTS *opts)
} }
switch (opts->depth) { switch (opts->depth) {
case OPTVAL_8:
NewDepth = 8;
break;
case OPTVAL_16: case OPTVAL_16:
NewDepth = 16; NewDepth = 16;
break; break;
-1
View File
@@ -47,7 +47,6 @@ typedef enum {
} OPT_RESDRIVERTYPE; } OPT_RESDRIVERTYPE;
typedef enum { typedef enum {
OPTVAL_8,
OPTVAL_16, OPTVAL_16,
OPTVAL_24, OPTVAL_24,
OPTVAL_32 OPTVAL_32