|
|
@@ -8,11 +8,8 @@ |
|
|
|
|
|
|
|
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 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); |
|
|
@@ -24,18 +21,18 @@ static void limit (int * pointer, int minimum, int maximum) { |
|
|
|
|
|
|
|
static void idle_game (void) { return; } |
|
|
|
|
|
|
|
static void exit_game (void) { render_active = 0; } |
|
|
|
static void exit_game (void) { engine_active = 0; } |
|
|
|
|
|
|
|
static void camera_move_right (void) { camera_x++; limit (& camera_x, 0, world_width - (render_width () / (int) (BASE_SIZE * render_zoom))); } |
|
|
|
static void camera_move_left (void) { camera_x--; limit (& camera_x, 0, world_width - (render_width () / (int) (BASE_SIZE * render_zoom))); } |
|
|
|
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 camera_move_right (void) { camera_x++; limit (& camera_x, 0, world_width - (window_width () / (int) (BASE_SIZE * render_zoom))); } |
|
|
|
static void camera_move_left (void) { camera_x--; limit (& camera_x, 0, world_width - (window_width () / (int) (BASE_SIZE * render_zoom))); } |
|
|
|
static void camera_move_down (void) { camera_y++; limit (& camera_y, 0, world_height - (window_height () / (int) (BASE_SIZE * render_zoom))); } |
|
|
|
static void camera_move_up (void) { camera_y--; limit (& camera_y, 0, world_height - (window_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 view_hud (int x, int y, int width, int height, int small, int alpha) { |
|
|
|
static void render_layout (int x, int y, int width, int height, int small, int alpha) { |
|
|
|
int i, j, u, v; |
|
|
|
|
|
|
|
u = width % ICON_SIZE; |
|
|
@@ -47,36 +44,36 @@ static void view_hud (int x, int y, int width, int height, int small, int alpha) |
|
|
|
if (alpha == 0) { |
|
|
|
for (i = 0; i < width - 1; ++i) { |
|
|
|
for (j = 0; j < height - 1; ++j) { |
|
|
|
render_sprite (neonui, x + i * ICON_SIZE + ICON_SIZE / 2, y + j * ICON_SIZE + ICON_SIZE / 2, 0, 0, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (menus, x + i * ICON_SIZE + ICON_SIZE / 2, y + j * ICON_SIZE + ICON_SIZE / 2, 0, 0, ICON_SIZE, ICON_SIZE); |
|
|
|
} |
|
|
|
render_sprite (neonui, x + i * ICON_SIZE + ICON_SIZE / 2, y + height * ICON_SIZE + ICON_SIZE / 2, 0, 0, u, ICON_SIZE); |
|
|
|
render_sprite (menus, x + i * ICON_SIZE + ICON_SIZE / 2, y + height * ICON_SIZE + ICON_SIZE / 2, 0, 0, u, ICON_SIZE); |
|
|
|
} |
|
|
|
render_sprite (neonui, x + width * ICON_SIZE + ICON_SIZE / 2, y + height * ICON_SIZE + ICON_SIZE / 2, 0, 0, ICON_SIZE, v); |
|
|
|
render_sprite (menus, x + width * ICON_SIZE + ICON_SIZE / 2, y + height * ICON_SIZE + ICON_SIZE / 2, 0, 0, ICON_SIZE, v); |
|
|
|
} |
|
|
|
|
|
|
|
for (i = (small == 0) + 1; i < width - (small != 0); ++i) { |
|
|
|
render_sprite (neonui, x + (i - (small == 0)) * ICON_SIZE, y, 560, 0, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (neonui, x + (i - (small == 0)) * ICON_SIZE, y + ICON_SIZE * (height - 1) + v, 560, 0, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (menus, x + (i - (small == 0)) * ICON_SIZE, y, 0, 544, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (menus, x + (i - (small == 0)) * ICON_SIZE, y + ICON_SIZE * (height - 1) + v, 0, 544, ICON_SIZE, ICON_SIZE); |
|
|
|
} |
|
|
|
|
|
|
|
for (i = (small == 0) + 1; i < height - (small != 0); ++i) { |
|
|
|
render_sprite (neonui, x, y + (i - (small == 0)) * ICON_SIZE, 256, 128, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (neonui, x + ICON_SIZE * (width - 1) + u, y + (i - (small == 0)) * ICON_SIZE + v, 256, 128, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (menus, x, y + (i - (small == 0)) * ICON_SIZE, 256, 128, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (menus, x + ICON_SIZE * (width - 1) + u, y + (i - (small == 0)) * ICON_SIZE + v, 256, 128, ICON_SIZE, ICON_SIZE); |
|
|
|
} |
|
|
|
|
|
|
|
u += ICON_SIZE * (width - 2 * (small == 0) - 1); |
|
|
|
v += ICON_SIZE * (height - 2 * (small == 0) - 1); |
|
|
|
u += ICON_SIZE * (width - 1 - ((small == 0) ? 2 : 1)); /* TOIDOI */ |
|
|
|
v += ICON_SIZE * (height - 1 - ((small == 0) ? 2 : 1)); |
|
|
|
|
|
|
|
if (small == 0) { |
|
|
|
render_sprite (neonui, x, y, 288, 0, 3 * ICON_SIZE, 3 * ICON_SIZE); |
|
|
|
render_sprite (neonui, x + u, y, 384, 0, 3 * ICON_SIZE, 3 * ICON_SIZE); |
|
|
|
render_sprite (neonui, x, y + v, 288, 96, 3 * ICON_SIZE, 3 * ICON_SIZE); |
|
|
|
render_sprite (neonui, x + u, y + v, 384, 96, 3 * ICON_SIZE, 3 * ICON_SIZE); |
|
|
|
render_sprite (menus, x, y, 0, 256, 3 * ICON_SIZE, 3 * ICON_SIZE); |
|
|
|
render_sprite (menus, x + u, y, 96, 256, 3 * ICON_SIZE, 3 * ICON_SIZE); |
|
|
|
render_sprite (menus, x, y + v, 0, 352, 3 * ICON_SIZE, 3 * ICON_SIZE); |
|
|
|
render_sprite (menus, x + u, y + v, 96, 352, 3 * ICON_SIZE, 3 * ICON_SIZE); |
|
|
|
} else { |
|
|
|
render_sprite (neonui, x, y, 288, 192, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (neonui, x + u, y, 320, 192, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (neonui, x, y + v, 288, 224, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (neonui, x + u, y + v, 320, 224, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (menus, x, y, 192, 256, 2 * ICON_SIZE, 2 * ICON_SIZE); |
|
|
|
render_sprite (menus, x + u, y, 256, 256, 2 * ICON_SIZE, 2 * ICON_SIZE); |
|
|
|
render_sprite (menus, x, y + v, 192, 320, 2 * ICON_SIZE, 2 * ICON_SIZE); |
|
|
|
render_sprite (menus, x + u, y + v, 256, 320, 2 * ICON_SIZE, 2 * ICON_SIZE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -88,24 +85,21 @@ static void define_minimenu (int menu, char * text, int icon, void (* action) (v |
|
|
|
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) { |
|
|
|
render_sprite (overui, ICON_SIZE, render_height () - 784 + ICON_SIZE, 0, 0, 1472, 784); |
|
|
|
void render_side (void) { |
|
|
|
int offset_x = window_width () - 512 + ICON_SIZE - SIDE_SIZE; |
|
|
|
int offset_y = window_height () - 512 + ICON_SIZE; |
|
|
|
|
|
|
|
render_sprite (menus, ICON_SIZE, offset_y, 512, 0, 512, 512); |
|
|
|
render_sprite (menus, offset_x, ICON_SIZE, 512, 512, 512, 512); |
|
|
|
|
|
|
|
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); |
|
|
|
render_layout (window_width () - SIDE_SIZE, 0, SIDE_SIZE, window_height (), 0, 0); |
|
|
|
render_layout (0, 0, window_width () - SIDE_SIZE, window_height (), 0, 1); |
|
|
|
} |
|
|
|
|
|
|
|
void view_menu (int menu, int x, int y, int small, int align, int alpha) { |
|
|
|
void render_menu (int menu, int x, int y, int small, int align, int alpha) { |
|
|
|
int item, aligned_x, aligned_y, i, j; |
|
|
|
|
|
|
|
if (menu_show [menu] == 0) { |
|
|
@@ -118,10 +112,10 @@ void view_menu (int menu, int x, int y, int small, int align, int alpha) { |
|
|
|
i += 2 * (small == 0) + 2; |
|
|
|
j += 2 * (small == 0) + 2; |
|
|
|
|
|
|
|
aligned_x = (align == 0) ? x : ((render_width () - ICON_SIZE * i) / 2); |
|
|
|
aligned_y = (align == 0) ? y : ((render_height () - ICON_SIZE * j) / 2); |
|
|
|
aligned_x = (align == 0) ? x : ((window_width () - ICON_SIZE * i) / 2); |
|
|
|
aligned_y = (align == 0) ? y : ((window_height () - ICON_SIZE * j) / 2); |
|
|
|
|
|
|
|
view_hud (aligned_x, aligned_y, i * ICON_SIZE, j * ICON_SIZE, small, alpha); |
|
|
|
render_layout (aligned_x, aligned_y, i * ICON_SIZE, j * ICON_SIZE, small, alpha); |
|
|
|
|
|
|
|
aligned_x += ICON_SIZE + (small == 0) * ICON_SIZE; |
|
|
|
aligned_y += ICON_SIZE + (small == 0) * ICON_SIZE; |
|
|
@@ -130,17 +124,17 @@ void view_menu (int menu, int x, int y, int small, int align, int alpha) { |
|
|
|
i = (menu_icon [menu] [item] / 10) * ICON_SIZE; |
|
|
|
j = (menu_icon [menu] [item] % 10) * ICON_SIZE; |
|
|
|
|
|
|
|
render_sprite (ui, aligned_x, aligned_y + item * ICON_SIZE, i, j, ICON_SIZE, ICON_SIZE); |
|
|
|
render_sprite (icons, aligned_x, aligned_y + item * ICON_SIZE, i, j, ICON_SIZE, ICON_SIZE); |
|
|
|
|
|
|
|
render_string (menu_text [menu] [item], aligned_x + ICON_SIZE, aligned_y + item * ICON_SIZE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void view_map (int offset_x, int offset_y) { |
|
|
|
void render_map (int offset_x, int offset_y) { |
|
|
|
int x, y, index; |
|
|
|
|
|
|
|
for (x = 0; (x < (render_width () - SIDE_SIZE) / (BASE_SIZE * render_zoom)) && (x < world_width); ++x) { |
|
|
|
for (y = 0; (y < render_height () / (BASE_SIZE * render_zoom)) && (y < world_height); ++y) { |
|
|
|
for (x = 0; (x < (window_width () - SIDE_SIZE) / (BASE_SIZE * render_zoom)) && (x < world_width); ++x) { |
|
|
|
for (y = 0; (y < window_height () / (BASE_SIZE * render_zoom)) && (y < world_height); ++y) { |
|
|
|
render_sprite (ashlands, (int) (x * BASE_SIZE * render_zoom), (int) (y * BASE_SIZE * render_zoom), |
|
|
|
0, |
|
|
|
world [0] [(offset_x + x) * world_height + offset_y + y] * BASE_SIZE, BASE_SIZE, BASE_SIZE); |
|
|
@@ -151,8 +145,8 @@ void view_map (int offset_x, int offset_y) { |
|
|
|
if (world_model_x [0] [index] < offset_x) continue; |
|
|
|
if (world_model_y [0] [index] < offset_y) continue; |
|
|
|
|
|
|
|
if (world_model_x [0] [index] > (render_width () - SIDE_SIZE) / (BASE_SIZE * render_zoom)) continue; |
|
|
|
if (world_model_y [0] [index] > render_height () / (BASE_SIZE * render_zoom)) continue; |
|
|
|
if (world_model_x [0] [index] > (window_width () - SIDE_SIZE) / (BASE_SIZE * render_zoom)) continue; |
|
|
|
if (world_model_y [0] [index] > window_height () / (BASE_SIZE * render_zoom)) continue; |
|
|
|
|
|
|
|
x = (int) ((world_model_x [0] [index] - offset_x) * BASE_SIZE * render_zoom); |
|
|
|
y = (int) ((world_model_y [0] [index] - offset_y) * BASE_SIZE * render_zoom); |
|
|
@@ -169,7 +163,7 @@ void unbind (int signal_id) { |
|
|
|
action_list [signal_id] = idle_game; |
|
|
|
} |
|
|
|
|
|
|
|
void engine_configure (void) { |
|
|
|
void layout_configure (void) { |
|
|
|
int index; |
|
|
|
|
|
|
|
for (index = 0; index < signal_count; ++index) { |
|
|
@@ -187,10 +181,6 @@ void engine_configure (void) { |
|
|
|
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); |
|
|
|
} |
|
|
@@ -204,6 +194,6 @@ void engine_configure (void) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void engine_synchronize (void) { |
|
|
|
void layout_synchronize (void) { |
|
|
|
action_list [signal] (); |
|
|
|
} |