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:
@@ -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 |
@@ -0,0 +1 @@
|
|||||||
|
setupmenu.0.png -1 -1 0 0
|
||||||
+25
-53
@@ -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,48 +396,21 @@ 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)
|
|
||||||
{
|
|
||||||
RECT r;
|
|
||||||
COLOR bg, dark, medium;
|
|
||||||
int frame;
|
|
||||||
|
|
||||||
pInputState->anim_frame_count -= 3;
|
|
||||||
if (pInputState->anim_frame_count < 0)
|
|
||||||
{
|
|
||||||
pInputState->anim_frame_count = 0;
|
|
||||||
}
|
|
||||||
frame = pInputState->anim_frame_count;
|
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
int opt, cat;
|
|
||||||
MENU_CATEGORY *menu = cmdline_opts;
|
|
||||||
DrawMenu (pInputState);
|
DrawMenu (pInputState);
|
||||||
|
|
||||||
cat = pInputState->category;
|
cat = pInputState->category;
|
||||||
opt = pInputState->option;
|
opt = pInputState->option;
|
||||||
|
|
||||||
@@ -481,8 +455,12 @@ DoSetupMenu (PSETUP_MENU_STATE pInputState)
|
|||||||
{
|
{
|
||||||
cmdline_opts[cat].selected = opt;
|
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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user