|
|
@@ -6,6 +6,17 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
#include <unistd.h> |
|
|
|
|
|
|
|
static void (* action_list [signal_count]) (void); |
|
|
|
|
|
|
|
static int menu_count = 0; |
|
|
|
|
|
|
|
static int menu_items [menu_limit]; |
|
|
|
static int menu_show [menu_limit]; |
|
|
|
|
|
|
|
static char * menu_text [menu_limit] [menu_item_limit]; |
|
|
|
static int menu_icon [menu_limit] [menu_item_limit]; |
|
|
|
static void (* menu_action [menu_limit] [menu_item_limit]) (void); |
|
|
|
|
|
|
|
static void limit (int * pointer, int minimum, int maximum) { |
|
|
|
if (* pointer < minimum) { * pointer = minimum; } |
|
|
|
if (* pointer > maximum) { * pointer = maximum; } |
|
|
@@ -20,10 +31,9 @@ static void camera_move_left (void) { camera_x--; limit (& camera_x, 0, world_w |
|
|
|
static void camera_move_down (void) { camera_y++; limit (& camera_y, 0, world_height - (render_height () / (int) (BASE_SIZE * render_zoom))); } |
|
|
|
static void camera_move_up (void) { camera_y--; limit (& camera_y, 0, world_height - (render_height () / (int) (BASE_SIZE * render_zoom))); } |
|
|
|
|
|
|
|
static void show_trait_menu (void) { menu_show [menu_traits] = menu_show [menu_traits] ? 0 : 1; } |
|
|
|
static void show_skill_menu (void) { menu_show [menu_skills] = menu_show [menu_skills] ? 0 : 1; } |
|
|
|
static void show_value_menu (void) { menu_show [menu_values] = menu_show [menu_values] ? 0 : 1; } |
|
|
|
static void show_resoo_menu (void) { menu_show [menu_resources] = menu_show [menu_resources] ? 0 : 1; } |
|
|
|
static void show_trait_menu (void) { menu_show [menu_traits] = menu_show [menu_traits] ? 0 : 1; } |
|
|
|
static void show_skill_menu (void) { menu_show [menu_skills] = menu_show [menu_skills] ? 0 : 1; } |
|
|
|
static void show_value_menu (void) { menu_show [menu_values] = menu_show [menu_values] ? 0 : 1; } |
|
|
|
|
|
|
|
static void view_hud (int x, int y, int width, int height, int small, int alpha) { |
|
|
|
int i, j, u, v; |
|
|
@@ -70,13 +80,26 @@ static void view_hud (int x, int y, int width, int height, int small, int alpha) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static void (* action_list [signal_count]) (void); |
|
|
|
static void define_minimenu (int menu, char * text, int icon, void (* action) (void)) { |
|
|
|
menu_text [menu] [menu_items [menu]] = text; |
|
|
|
menu_icon [menu] [menu_items [menu]] = icon; |
|
|
|
menu_action [menu] [menu_items [menu]] = action; |
|
|
|
|
|
|
|
menu_items [menu]++; |
|
|
|
} |
|
|
|
|
|
|
|
static void define_menu (int show) { |
|
|
|
menu_items [menu_count] = 0; |
|
|
|
menu_show [menu_count] = show; |
|
|
|
|
|
|
|
menu_count++; |
|
|
|
} |
|
|
|
|
|
|
|
int camera_x = 0; |
|
|
|
int camera_y = 0; |
|
|
|
|
|
|
|
void view_side (void) { |
|
|
|
view_map_overlay (); |
|
|
|
render_sprite (overui, ICON_SIZE, render_height () - 784 + ICON_SIZE, 0, 0, 1472, 784); |
|
|
|
|
|
|
|
view_hud (render_width () - SIDE_SIZE, 0, SIDE_SIZE, render_height (), 0, 0); |
|
|
|
view_hud (0, 0, render_width () - SIDE_SIZE, render_height (), 0, 1); |
|
|
@@ -138,14 +161,6 @@ void view_map (int offset_x, int offset_y) { |
|
|
|
}*/ |
|
|
|
} |
|
|
|
|
|
|
|
void view_map_overlay (void) { |
|
|
|
render_sprite (overui, ICON_SIZE, render_height () - 784 + ICON_SIZE, 0, 0, 1472, 784); |
|
|
|
} |
|
|
|
|
|
|
|
void view_side_hud (void) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
void bind (int signal_id, void (* action) (void)) { |
|
|
|
action_list [signal_id] = action; |
|
|
|
} |
|
|
@@ -168,10 +183,25 @@ void engine_configure (void) { |
|
|
|
bind (signal_left, camera_move_left); |
|
|
|
bind (signal_right, camera_move_right); |
|
|
|
|
|
|
|
bind (signal_r, show_resoo_menu); |
|
|
|
bind (signal_t, show_trait_menu); |
|
|
|
bind (signal_s, show_skill_menu); |
|
|
|
bind (signal_v, show_value_menu); |
|
|
|
|
|
|
|
define_menu (0); |
|
|
|
define_menu (0); |
|
|
|
define_menu (1); |
|
|
|
|
|
|
|
for (index = 0; index < trait_count; ++index) { |
|
|
|
define_minimenu (menu_traits, trait_name [index], index, 0); |
|
|
|
} |
|
|
|
|
|
|
|
for (index = 0; index < skill_count; ++index) { |
|
|
|
define_minimenu (menu_skills, skill_name [index], 3 + index, 0); |
|
|
|
} |
|
|
|
|
|
|
|
for (index = 0; index < value_count; ++index) { |
|
|
|
define_minimenu (menu_values, value_name [index], 27 + index, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void engine_synchronize (void) { |
|
|
|