umorna/source/engine.c

58 lines
1.6 KiB
C

#include <string.h>
#include <stdlib.h>
#include <raylib.h>
#define BASE_SIZE (16)
#define ICON_SIZE (32)
#define FONT_SIZE (24)
#define CHAD_TRAIT_LIMIT ( 3)
#define CHAD_SKILL_LIMIT (24)
#define CHAD_VALUE_LIMIT (10)
#define CHAD_EFFECT_LIMIT ( 3)
#define CHAD_MIGHT_LIMIT ( 1)
#define CHAD_MAGIC_LIMIT ( 1)
#define CHAD_RACE_LIMIT ( 3)
#define CHAD_ITEM_LIMIT ( 3)
#define CHAD_UNIT_LIMIT (54)
#define CHAD_HERO_LIMIT ( 1)
#define CHAD_BLOCK_LIMIT (28)
#define CHAD_WORLD_LIMIT ( 1)
#define CHAD_WORLD_WIDTH (90)
#define CHAD_WORLD_HEIGHT (90)
#include <xolatile/chads.h>
static Texture2D unit_data [3];
void render_unit (int race,
int unit,
int x,
int y) {
Rectangle source = { 0, (unit - race * 18) * BASE_SIZE, BASE_SIZE, BASE_SIZE };
Rectangle destination = { x, y, BASE_SIZE * zoom, BASE_SIZE * zoom };
Vector2 origin = { 0, 0 };
DrawTexturePro (unit_data [race], source, destination, origin, 0.0F, WHITE);
}
static Texture2D icons;
static Texture2D ashlands_data;
void render_map (void) {
int x, y;
for (x = 0; x < CHAD_WORLD_WIDTH; ++x) {
for (y = 0; y < CHAD_WORLD_HEIGHT; ++y) {
int index = chad_world [0] [x] [y];
int catch = (y * y + x + x / (y + 1) + y / (x + 1)) % chad_block_change [index];
Rectangle source = { catch * BASE_SIZE, index * BASE_SIZE, BASE_SIZE, BASE_SIZE };
Rectangle destination = { x * BASE_SIZE * zoom, y * BASE_SIZE * zoom, BASE_SIZE * zoom, BASE_SIZE * zoom };
DrawTexturePro (ashlands_data, source, destination, (Vector2) { 0, 0 }, 0.0F, WHITE);
}
}
}