2023-12-21 14:20:00 -05:00
|
|
|
#include "engine.h"
|
|
|
|
|
|
|
|
void view_unit (int race, int unit, int x, int y) {
|
|
|
|
int u = 0;
|
|
|
|
int v = (unit - race * 18) * BASE_SIZE;
|
|
|
|
int width = BASE_SIZE;
|
|
|
|
int height = BASE_SIZE;
|
|
|
|
|
|
|
|
switch (race) {
|
|
|
|
case orc: render_sprite (orcs, x, y, u, v, width, height); break;
|
|
|
|
case human: render_sprite (humans, x, y, u, v, width, height); break;
|
|
|
|
case elf: render_sprite (elves, x, y, u, v, width, height); break;
|
|
|
|
default: break;
|
|
|
|
}
|
2023-12-20 00:07:54 -05:00
|
|
|
}
|
|
|
|
|
2023-12-21 14:20:00 -05:00
|
|
|
void view_menu (int menu, int align, int x, int y) {
|
|
|
|
int width = (int) strlen (menu_text [menu] [0]) * ICON_SIZE;
|
|
|
|
int height = menu_items [menu] * ICON_SIZE;
|
|
|
|
|
|
|
|
int item;
|
|
|
|
|
|
|
|
if (menu_show [menu] == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//~if (menu_alpha [menu] != 0) {
|
|
|
|
//~DrawRectangle (x, y, width, height, BLACK);
|
|
|
|
//~}
|
2023-12-20 00:07:54 -05:00
|
|
|
|
2023-12-21 14:20:00 -05:00
|
|
|
for (item = 0; item < menu_items [menu]; ++item) {
|
|
|
|
int u = (menu_icon [menu] [item] / 10) * ICON_SIZE;
|
|
|
|
int v = (menu_icon [menu] [item] % 10) * ICON_SIZE;
|
|
|
|
int aligned_x = (align == 0) ? x : ((render_width () - width) / 2);
|
|
|
|
int aligned_y = (align == 0) ? y : ((render_height () - height) / 2);
|
2023-12-20 00:07:54 -05:00
|
|
|
|
2023-12-21 14:20:00 -05:00
|
|
|
render_sprite (ui, aligned_x, aligned_y + item * ICON_SIZE, u, v, ICON_SIZE, ICON_SIZE);
|
|
|
|
render_string (menu_text [menu] [item], aligned_x + ICON_SIZE, aligned_y + item * ICON_SIZE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void view_map (void) {
|
2023-12-20 00:07:54 -05:00
|
|
|
int x, y;
|
|
|
|
|
|
|
|
for (x = 0; x < CHAD_WORLD_WIDTH; ++x) {
|
|
|
|
for (y = 0; y < CHAD_WORLD_HEIGHT; ++y) {
|
2023-12-21 14:20:00 -05:00
|
|
|
int index = chad_world [0] [x] [y];
|
|
|
|
int catch = (y * y + x + x / (y + 1) + y / (x + 1)) % chad_block_change [index];
|
2023-12-20 00:07:54 -05:00
|
|
|
|
2023-12-21 14:20:00 -05:00
|
|
|
render_sprite (ashlands, x * BASE_SIZE, y * BASE_SIZE, catch * BASE_SIZE, index * BASE_SIZE, BASE_SIZE, BASE_SIZE);
|
2023-12-20 00:07:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|