General refactoring...
This commit is contained in:
parent
910480a2d4
commit
cb15e79674
@ -6,7 +6,7 @@ package chad is
|
||||
|
||||
type codex is (
|
||||
ognjen, richard, eric, linus, ada, marina,
|
||||
angela, wouter, john
|
||||
kethleen, wouter, john
|
||||
);
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
@ -36,7 +36,7 @@ package chad is
|
||||
("Linus Benedict Torvalds ", faction.tower, (attribute.attack => 2, others => 1), (skill.necromancy => 6, others => 3), (others => 0)),
|
||||
("Ada Augusta King ", faction.conflux, (attribute.defense => 2, others => 1), (skill.sorcery => 6, others => 3), (others => 0)),
|
||||
("Marina Ann Hantzis ", faction.necropolis, (attribute.attack => 2, others => 1), (skill.first_aid => 6, others => 3), (others => 0)),
|
||||
("Angela <> Collier ", faction.rampart, (attribute.knowledge => 2, others => 1), (skill.mysticism => 6, others => 3), (others => 0)),
|
||||
("Kathleen Hylda Britten ", faction.rampart, (attribute.knowledge => 2, others => 1), (skill.mysticism => 6, others => 3), (others => 0)),
|
||||
("Wouter van Oortmerssen ", faction.fortress, (attribute.power => 2, others => 1), (skill.offense => 6, others => 3), (others => 0)),
|
||||
("John Warner Backus ", faction.dungeon, (attribute.knowledge => 2, others => 1), (skill.intelligence => 6, others => 3), (others => 0))
|
||||
);
|
||||
|
@ -60,7 +60,6 @@ package construction is
|
||||
count : constant natural := codex'pos (codex'last) + 1;
|
||||
|
||||
trait : constant trait_array := (
|
||||
-- Remove me later... Lv Gr Gold Wd Mr Or Sl Cr Gm
|
||||
("Boar Glen ", faction.neutral, 1, 1, ( 90, 0, 0, 0, 0, 0, 0), 1, effect.none),
|
||||
("Enchanter's Hollow ", faction.neutral, 1, 1, (120, 0, 0, 0, 0, 0, 0), 1, effect.none),
|
||||
("Hovel ", faction.neutral, 2, 1, (180, 0, 0, 0, 0, 0, 0), 1, effect.none),
|
||||
|
@ -161,7 +161,7 @@ package body core is
|
||||
|
||||
procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#) is
|
||||
begin
|
||||
render_string (c_string (text), x, y, colour, false);
|
||||
render_string (c_string (text), x, y, colour, 0);
|
||||
end write;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
@ -70,9 +70,9 @@ package core is
|
||||
function window_width return integer with import => true, convention => c;
|
||||
function window_height return integer with import => true, convention => c;
|
||||
|
||||
procedure render_sprite (sprite, x, y, u, v, width, height : in integer) with import => true, convention => c;
|
||||
procedure render_string (text : in string; x, y, colour : in integer; monospace : in boolean) with import => true, convention => c;
|
||||
procedure render_vector (x1, y1, x2, y2 : in integer) with import => true, convention => c;
|
||||
procedure render_sprite (sprite, x, y, u, v, width, height : in integer) with import => true, convention => c;
|
||||
procedure render_string (text : in string; x, y, colour, choose : in integer) with import => true, convention => c;
|
||||
procedure render_vector (x1, y1, x2, y2 : in integer) with import => true, convention => c;
|
||||
|
||||
function import_sprite (file_path : in string) return integer with import => true, convention => c;
|
||||
function sprite_width (index : in integer) return integer with import => true, convention => c;
|
||||
@ -82,7 +82,7 @@ package core is
|
||||
|
||||
-- Fortran
|
||||
|
||||
procedure fairy_synchronize (level : in integer) with import => true, convention => fortran;
|
||||
procedure ai_synchronize (level : in integer) with import => true, convention => fortran;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -6,10 +6,6 @@ package body effect is
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
sprite : core.sprite;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw (value : in codex; x, y : in integer) is
|
||||
begin
|
||||
null;
|
||||
|
@ -7,10 +7,6 @@ procedure main is
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--~world_active : world.codex := world.ashland;
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
side_panel : integer := 480;
|
||||
preview_x : integer := 24;
|
||||
preview_y : integer := 24;
|
||||
@ -19,11 +15,9 @@ procedure main is
|
||||
|
||||
player : chad.information := chad.trait (chad.ognjen);
|
||||
|
||||
begin
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--~for index in attribute.codex loop put_line (attribute.trait (index).name & integer'image (player.attributes (index))); end loop;
|
||||
--~for index in skill.codex loop put_line (skill.trait (index).name & integer'image (player.skills (index))); end loop;
|
||||
--~for index in resource.codex loop put_line (resource.trait (index).name & integer'image (player.resources (index))); end loop;
|
||||
begin
|
||||
|
||||
core.configure;
|
||||
ui.configure;
|
||||
@ -38,22 +32,18 @@ begin
|
||||
chad.configure;
|
||||
world.configure;
|
||||
|
||||
core.fairy_synchronize (6); -- CALLING SUBROUTINE DEFINED IN FORTRAN
|
||||
core.ai_synchronize (6);
|
||||
|
||||
world.make (world.swamp, 80, 40);
|
||||
|
||||
preview_width := core.window_width - side_panel;
|
||||
preview_height := core.window_height;
|
||||
ui.active := ui.steam;
|
||||
|
||||
gameplay: loop
|
||||
exit when core.engine_active = false;
|
||||
--
|
||||
core.synchronize;
|
||||
--
|
||||
--~if core.cursor_mode = 1 then
|
||||
--~world_active := world.codex'val ((world.codex'pos (world_active) + 1) mod 6);
|
||||
--~delay duration (0.333);
|
||||
--~end if;
|
||||
exit when core.engine_active = false;
|
||||
--
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_a) then preview_width := preview_width - 60; end if;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_d) then preview_width := preview_width + 60; end if;
|
||||
@ -70,39 +60,12 @@ begin
|
||||
--
|
||||
world.draw (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y, core.cursor_mode = 2);
|
||||
--
|
||||
ui.active := ui.steam;
|
||||
if core.cursor_mode = 3 then
|
||||
--~ui.active := ui.style'val (ui.style'pos (ui.active) mod 4);
|
||||
--~case ui.active is
|
||||
--~when ui.default => ui.active := ui.gothic;
|
||||
--~when ui.gothic => ui.active := ui.yd;
|
||||
--~when ui.yd => ui.active := ui.default;
|
||||
--~end case;
|
||||
ui.active := ui.default;
|
||||
--~ui.active := ui.steam;
|
||||
end if;
|
||||
--~core.draw_central_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--~core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--~core.draw_hexagon_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--
|
||||
--~for this in might.codex
|
||||
--~loop
|
||||
--~might.draw (this, 112 * (might.codex'pos (this) / 7) + 64, 112 * (might.codex'pos (this) mod 7) + 64);
|
||||
--~end loop;
|
||||
--
|
||||
--~for this in unit.pikeman .. unit.ghost_dragon
|
||||
--~loop
|
||||
--~unit.render (this, unit.idle, 96 * (unit.codex'pos (this) / 7) + 32, 96 * (unit.codex'pos (this) mod 7) + 32);
|
||||
--~end loop;
|
||||
--
|
||||
--~for this in construction.codex
|
||||
--~loop
|
||||
--~construction.draw (this, 128 * (construction.codex'pos (this) mod 12) + 32, 128 * (construction.codex'pos (this) / 12) + 32);
|
||||
--~end loop;
|
||||
--
|
||||
core.draw_central_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
core.draw_hexagon_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--
|
||||
--~ui.draw_menu (0, 0, preview_width, preview_height, false);
|
||||
--~ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height, true);
|
||||
ui.draw_menu (0, 0, preview_width, preview_height, false);
|
||||
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height, true);
|
||||
--
|
||||
--~for this in magic.blow_away .. magic.thunderclap loop magic.draw (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.chain_magic_arrow)) - 60, 112 * 0 + 64); end loop;
|
||||
--~for this in magic.agony_mass .. magic.weakness loop magic.draw (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.thunderclap)) - 60, 112 * 1 + 64); end loop;
|
||||
|
@ -52,7 +52,7 @@ extern int window_width (void);
|
||||
extern int window_height (void);
|
||||
|
||||
extern void render_sprite (int sprite, int x, int y, int u, int v, int width, int height);
|
||||
extern void render_string (char * string, int x, int y, int colour, char monospace);
|
||||
extern void render_string (char * string, int x, int y, int colour, int choose);
|
||||
|
||||
extern void render_vector (int x1, int y1, int x2, int y2);
|
||||
|
||||
@ -91,7 +91,7 @@ void render_sprite (int sprite, int x, int y, int u, int v, int width, int heigh
|
||||
DrawTexturePro (render_texture [sprite], source, destination, dump, 0.0, tint);
|
||||
}
|
||||
|
||||
void render_string (char * string, int x, int y, int colour, char monospace) {
|
||||
void render_string (char * string, int x, int y, int colour, int choose) {
|
||||
Vector2 position = { 4, 4 };
|
||||
Color new_tint = { 255, 255, 255, 255 };
|
||||
|
||||
@ -102,7 +102,7 @@ void render_string (char * string, int x, int y, int colour, char monospace) {
|
||||
new_tint.g = ((colour & 0X00FF00) >> 8) % 256;
|
||||
new_tint.b = ((colour & 0X0000FF) >> 0) % 256;
|
||||
|
||||
DrawTextPro ((monospace != 0) ? mono : font, string, position, dump, 0.0, 18, 3, new_tint);
|
||||
DrawTextPro ((choose != 0) ? mono : font, string, position, dump, 0.0, 18, 3, new_tint);
|
||||
}
|
||||
|
||||
void render_vector (int x1, int y1, int x2, int y2) {
|
||||
|
@ -48,7 +48,6 @@ enum {
|
||||
signal_count
|
||||
};
|
||||
|
||||
static void in (void * data, int size);
|
||||
static void out (void * data, int size);
|
||||
|
||||
extern void echo (char * data);
|
||||
@ -135,13 +134,6 @@ static char * syntax_escape = null;
|
||||
static int * syntax_colour = null;
|
||||
static int * syntax_effect = null;
|
||||
|
||||
void in (void * data, int size) {
|
||||
fatal_failure (data == null, "in: Failed to read from standard input, data is null pointer.");
|
||||
fatal_failure (size == 0, "in: Failed to read from standard input, size is zero.");
|
||||
|
||||
(void) read (STDIN_FILENO, data, (unsigned long int) size);
|
||||
}
|
||||
|
||||
void out (void * data, int size) {
|
||||
fatal_failure (data == null, "out: Failed to write to standard output, data is null pointer.");
|
||||
fatal_failure (size == 0, "out: Failed to write to standard output, size is zero.");
|
||||
|
@ -9,7 +9,7 @@ package body unit is
|
||||
type sprite_array is array (codex) of core.sprite;
|
||||
|
||||
sprite : sprite_array;
|
||||
icon : sprite_array;
|
||||
--~icon : sprite_array;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user