From 6490314fd7f265cddc7ada9d7ec85328148210bd Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 9 Oct 2023 14:56:48 -0400 Subject: [PATCH] Refactoring... --- xabina.adb | 62 +++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/xabina.adb b/xabina.adb index 27ddfac..2b3e4bc 100644 --- a/xabina.adb +++ b/xabina.adb @@ -20,7 +20,7 @@ function xabina return integer is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -- System ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ type subrange is record @@ -37,34 +37,14 @@ function xabina return integer is EFFECT_NORMAL, EFFECT_BOLD, EFFECT_ITALIC, EFFECT_UNDERLINE, EFFECT_BLINK, EFFECT_REVERSE ); - type entity_id is ( - ENTITY_NONE, ENTITY_MENU, ENTITY_MAP, ENTITY_ITEM, ENTITY_PLANT, ENTITY_ANIMAL, ENTITY_GOBLIN, ENTITY_PLAYER - ); - - type map_id is ( - MAP_NONE, MAP_VOID, MAP_WALL, MAP_FLOOR, MAP_HOLE, MAP_STAIRS_DOWN, MAP_STAIRS_UP, MAP_DOOR - ); - - type item_id is ( - ITEM_NONE, ITEM_AMMUNITION, ITEM_WEAPON, ITEM_ARMOUR, ITEM_SCROLL, ITEM_POTION, ITEM_CONSUMABLE, ITEM_NOTE - ); - - type plant_id is ( - PLANT_NONE, PLANT_GRASS, PLANT_REED, PLANT_BUSH, PLANT_APPLE_TREE, PLANT_LEMON_TREE, PLANT_OAK_TREE, PLANT_PINE_TREE - ); - - type animal_id is ( - ANIMAL_NONE, ANIMAL_RAT, ANIMAL_BAT, ANIMAL_SPIDER, ANIMAL_LIZARD, ANIMAL_SNAIL, ANIMAL_WORM, ANIMAL_MOLE - ); - - type goblin_id is ( - GOBLIN_NONE, GOBLIN_WORKER, GOBLIN_WARRIOR, GOBLIN_BOAR_RIDER, GOBLIN_SHAMAN, GOBLIN_CHIEF, GOBLIN_KING, GOBLIN_OGRE - ); - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -- Entity ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + type entity_id is ( + ENTITY_NONE, ENTITY_MENU, ENTITY_MAP, ENTITY_ITEM, ENTITY_PLANT, ENTITY_ANIMAL, ENTITY_GOBLIN, ENTITY_PLAYER + ); + type entity_constant_type is tagged record entity : entity_id := ENTITY_NONE; -- Entity identifier. @@ -86,6 +66,10 @@ function xabina return integer is -- -- Map data is only constant, not variable, since X and Y coordinates are determined by player, camera or global position. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + type map_id is ( + MAP_NONE, MAP_VOID, MAP_WALL, MAP_FLOOR, MAP_HOLE, MAP_STAIRS_DOWN, MAP_STAIRS_UP, MAP_DOOR + ); + type map_list_id is ( STONE_WALL, WOODEN_WALL, STONE_FLOOR, WOODEN_FLOOR ); @@ -106,9 +90,37 @@ function xabina return integer is ); ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +-- Item +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + type item_id is ( + ITEM_NONE, ITEM_AMMUNITION, ITEM_WEAPON, ITEM_ARMOUR, ITEM_SCROLL, ITEM_POTION, ITEM_CONSUMABLE, ITEM_NOTE + ); + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +-- Plant +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + type plant_id is ( + PLANT_NONE, PLANT_GRASS, PLANT_REED, PLANT_BUSH, PLANT_APPLE_TREE, PLANT_LEMON_TREE, PLANT_OAK_TREE, PLANT_PINE_TREE + ); + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +-- Animal +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + type animal_id is ( + ANIMAL_NONE, ANIMAL_RAT, ANIMAL_BAT, ANIMAL_SPIDER, ANIMAL_LIZARD, ANIMAL_SNAIL, ANIMAL_WORM, ANIMAL_MOLE + ); + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -- Goblin ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + type goblin_id is ( + GOBLIN_NONE, GOBLIN_WORKER, GOBLIN_WARRIOR, GOBLIN_BOAR_RIDER, GOBLIN_SHAMAN, GOBLIN_CHIEF, GOBLIN_KING, GOBLIN_OGRE + ); + type goblin_constant_type is new entity_constant_type with record attack_range : subrange := (0, 0, 0);