*/
#include "gui.h"
-#include "game.h"
#include "audio.h"
#include "config.h"
#include "demo.h"
+#include "keynames.h"
+
+#include "game_common.h"
+#include "game_server.h"
+#include "game_client.h"
-#include "st_shared.h"
#include "st_title.h"
#include "st_help.h"
+#include "st_shared.h"
/*---------------------------------------------------------------------------*/
-struct state st_help_demo;
-
-/*---------------------------------------------------------------------------*/
-
-#define HELP_BACK 0
-#define HELP_RULE 1
-#define HELP_CONT 2
-#define HELP_MODE 3
-#define HELP_TECH 4
-#define HELP_DEMO_1 6
-#define HELP_DEMO_2 7
+#define HELP_BACK 0
+#define HELP_RULES 1
+#define HELP_CONTROLS 2
+#define HELP_MODES 3
+#define HELP_TRICKS 4
+#define HELP_DEMO_1 6
+#define HELP_DEMO_2 7
-static int tab = HELP_RULE;
+static int tab = HELP_RULES;
/*---------------------------------------------------------------------------*/
switch (t)
{
case HELP_BACK:
- tab = HELP_RULE;
+ tab = HELP_RULES;
return goto_state(&st_title);
break;
case HELP_DEMO_1:
- demo_replay_init(config_data("gui/demo1.nbr"), NULL);
- return goto_state(&st_help_demo);
+ if (demo_replay_init("gui/demo1.nbr", NULL, NULL, NULL, NULL, NULL))
+ return goto_state(&st_help_demo);
break;
case HELP_DEMO_2:
- demo_replay_init(config_data("gui/demo2.nbr"), NULL);
- return goto_state(&st_help_demo);
+ if (demo_replay_init("gui/demo2.nbr", NULL, NULL, NULL, NULL, NULL))
+ return goto_state(&st_help_demo);
break;
default:
return goto_state(&st_help);
break;
}
- return 0;
+ return 1;
}
/* -------------------------------------------------------------------------- */
{
int jd;
+ gui_space(id);
+
if ((jd = gui_harray(id)))
{
- help_button(jd, _("Techniques"), HELP_TECH);
- help_button(jd, _("Modes"), HELP_MODE);
- help_button(jd, _("Controls"), HELP_CONT);
- help_button(jd, _("Rules"), HELP_RULE);
- help_button(jd, _("Back"), HELP_BACK);
+ help_button(jd, _("Tricks"), HELP_TRICKS);
+ help_button(jd, _("Modes"), HELP_MODES);
+ help_button(jd, _("Controls"), HELP_CONTROLS);
+ help_button(jd, _("Rules"), HELP_RULES);
+ help_button(jd, _("Back"), HELP_BACK);
}
return jd;
}
const char *s9 = _("Lazy View");
const char *sA = _("Manual View");
const char *sC = _("Screenshot");
- const char *sD = _("Toggle Fullscreen");
- const char *k0 = _("Spacebar");
- const char *k1 = _("Escape");
- const char *k2 = SDL_GetKeyName(config_get_d(CONFIG_KEY_CAMERA_1));
- const char *k3 = SDL_GetKeyName(config_get_d(CONFIG_KEY_CAMERA_2));
- const char *k4 = SDL_GetKeyName(config_get_d(CONFIG_KEY_CAMERA_3));
- const char *k6 = SDL_GetKeyName(SDLK_F10);
- const char *k7 = SDL_GetKeyName(SDLK_F11);
+ const char *k0 = pretty_keyname((SDLKey) config_get_d(CONFIG_KEY_PAUSE));
+ const char *k1 = pretty_keyname(SDLK_ESCAPE);
+ const char *k2 = pretty_keyname((SDLKey) config_get_d(CONFIG_KEY_CAMERA_1));
+ const char *k3 = pretty_keyname((SDLKey) config_get_d(CONFIG_KEY_CAMERA_2));
+ const char *k4 = pretty_keyname((SDLKey) config_get_d(CONFIG_KEY_CAMERA_3));
+ const char *k6 = pretty_keyname(SDLK_F10);
int jd;
}
if ((jd = gui_harray(id)))
{
- gui_label(jd, sC, GUI_SML, 0, gui_wht, gui_wht);
- gui_label(jd, k6, GUI_SML, 0, gui_yel, gui_yel);
- }
- if ((jd = gui_harray(id)))
- {
- gui_label(jd, sD, GUI_SML, GUI_SE, gui_wht, gui_wht);
- gui_label(jd, k7, GUI_SML, GUI_SW, gui_yel, gui_yel);
+ gui_label(jd, sC, GUI_SML, GUI_SE, gui_wht, gui_wht);
+ gui_label(jd, k6, GUI_SML, GUI_SW, gui_yel, gui_yel);
}
gui_space(id);
gui_space(kd);
- gui_label(kd, _("Practice Mode"), GUI_SML, GUI_TOP, 0, 0);
- gui_multi(kd,
- _("Play without time limit or coin constraint.\\"
- "Levels cannot be unlocked in this mode."),
- GUI_SML, GUI_BOT, gui_wht, gui_wht);
-
- gui_space(kd);
-
gui_label(kd, _("Challenge Mode"), GUI_SML, GUI_TOP, 0, 0);
gui_multi(kd,
_("Start playing from the first level of the set.\\"
- "You start with only four balls, do not lose them.\\"
+ "You start with only three balls, do not lose them.\\"
"Earn an extra ball for each 100 coins collected."),
GUI_SML, GUI_BOT, gui_wht, gui_wht);
}
return id;
}
-static int help_techniques(int id)
+static int help_tricks(int id)
{
const char *s0 = _(
"Corners can be used to jump.\\"
if ((ld = gui_vstack(kd)))
{
gui_space(ld);
- gui_multi(ld, s0, GUI_SML, GUI_ALL, gui_wht, gui_wht);
+ gui_image(ld, "gui/help3.jpg", w / 4, h / 4);
+ gui_state(ld, _("Watch demo"), GUI_SML, 0, 0);
gui_filler(ld);
+
+ gui_active(ld, HELP_DEMO_1, 0);
}
if ((ld = gui_vstack(kd)))
{
gui_space(ld);
- gui_multi(ld, s1, GUI_SML, GUI_ALL, gui_wht, gui_wht);
+ gui_image(ld, "gui/help4.jpg", w / 4, h / 4);
+ gui_state(ld, _("Watch demo"), GUI_SML, 0, 0);
gui_filler(ld);
+
+ gui_active(ld, HELP_DEMO_2, 0);
}
}
if ((ld = gui_vstack(kd)))
{
gui_space(ld);
- gui_image(ld, "gui/help3.jpg", w / 4, h / 4);
- gui_state(ld, _("Watch demo"), GUI_SML, 0, 0);
+ gui_multi(ld, s0, GUI_SML, GUI_ALL, gui_wht, gui_wht);
gui_filler(ld);
-
- gui_active(ld, HELP_DEMO_1, 0);
}
if ((ld = gui_vstack(kd)))
{
gui_space(ld);
- gui_image(ld, "gui/help4.jpg", w / 4, h / 4);
- gui_state(ld, _("Watch demo"), GUI_SML, 0, 0);
+ gui_multi(ld, s1, GUI_SML, GUI_ALL, gui_wht, gui_wht);
gui_filler(ld);
-
- gui_active(ld, HELP_DEMO_2, 0);
}
}
-
+
gui_filler(jd);
}
return id;
/* -------------------------------------------------------------------------- */
-static int help_enter(void)
+static int help_gui(void)
{
int id;
switch (tab)
{
- case HELP_RULE:
- help_rules(id);
- break;
-
- case HELP_CONT:
- help_controls(id);
- break;
-
- case HELP_MODE:
- help_modes(id);
- break;
-
- case HELP_TECH:
- help_techniques(id);
- break;
+ case HELP_RULES: help_rules(id); break;
+ case HELP_CONTROLS: help_controls(id); break;
+ case HELP_MODES: help_modes(id); break;
+ case HELP_TRICKS: help_tricks(id); break;
default:
break;
}
+
gui_layout(id, 0, +1);
}
+
return id;
}
+static int help_enter(struct state *st, struct state *prev)
+{
+ return help_gui();
+}
+
static int help_buttn(int b, int d)
{
if (d)
/*---------------------------------------------------------------------------*/
-static float real_time;
-static float demo_time;
-
-static int help_demo_enter(void)
+static int help_demo_enter(struct state *st, struct state *prev)
{
- real_time = -1.f;
- demo_time = 0.f;
-
- game_set_fly(0.f);
-
+ game_client_fly(0.0f);
return 0;
}
-static void help_demo_leave(int id)
+static void help_demo_leave(struct state *st, struct state *next, int id)
{
demo_replay_stop(0);
}
-static void help_demo_paint(int id, float st)
+static void help_demo_paint(int id, float t)
{
- game_draw(0, st);
+ game_client_draw(0, t, demo_play_blend());
}
static void help_demo_timer(int id, float dt)
{
- float t;
-
- real_time += dt;
-
game_step_fade(dt);
- while (demo_time < real_time)
- if (demo_replay_step(&t))
- demo_time += t;
- else
- {
- goto_state(&st_help);
- break;
- }
+ if (!demo_replay_step(dt))
+ goto_state(&st_help);
}
static int help_demo_buttn(int b, int d)
shared_timer,
shared_point,
shared_stick,
+ shared_angle,
shared_click,
NULL,
- help_buttn,
- 1, 0
+ help_buttn
};
struct state st_help_demo = {
NULL,
NULL,
NULL,
- help_demo_buttn,
- 1, 0
+ NULL,
+ help_demo_buttn
};