;;-----------------------------LICENSE NOTICE------------------------------------
;;  This file is part of The Last Fungus: An Amstrad CPC Game 
;;  Copyright (C) 2021 Miguel Perez Tarruella / Antonio Jose Fernandez Belliure / 
;;                     David Martinez Garcia / Ocacho Games (@OcachoGames)
;;
;;  This program is free software: you can redistribute it and/or modify
;;  it under the terms of the GNU Lesser General Public License as published by
;;  the Free Software Foundation, either version 3 of the License, or
;;  (at your option) any later version.
;;
;;  This program is distributed in the hope that it will be useful,
;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;  GNU Lesser General Public License for more details.
;;
;;  You should have received a copy of the GNU Lesser General Public License
;;  along with this program.  If not, see <http://www.gnu.org/licenses/>.
;;------------------------------------------------------------------------------

;;====================================================================
;; GLOBL INCLUDES
;;====================================================================
;;Manager includes
.include "man/entity.h.s"

;;System inicludes
.include "sys/input.h.s"
.include "sys/ai.h.s"
.include "sys/collision.h.s"
.include "sys/physics.h.s"

;;Patrols
.include "man/patrol.h.s"

;;Resources includes
.include "resources/sprites.h.s"
.include "resources/players_animations.h.s"
.include "resources/enemies_animations.h.s"
.include "resources/static_entities_animations.h.s"
.include "resources/bullet_animations.h.s"

;;====================================================================
;; TEMPLATES
;;====================================================================

e_cmps_player				= e_cmp_render | e_cmp_input | e_cmp_movable | e_cmp_animation | e_cmp_collider | e_cmp_gravity
e_cmps_bullet				= e_cmp_render | e_cmp_movable  | e_cmp_collider | e_cmp_animation
e_cmps_enemy_walker			= e_cmp_render | e_cmp_movable  | e_cmp_ai | e_cmp_animation | e_cmp_collider | e_cmp_gravity
e_cmps_enemy_ghost			= e_cmp_render | e_cmp_movable  | e_cmp_ai | e_cmp_animation
e_cmps_platform				= e_cmp_render | e_cmp_platform | e_cmp_animation


;;====================================================================
;; PLAYER TEMPLATES
;;====================================================================

DEFINE_ENTITY_TEMPLATE player_tmpl, e_type_player1, e_cmps_player , 9, 174, 4, 16, 0, 0, _spr_p1_base_right, player1_idle_right, 8, 0x0000, 1, sys_input_behaviour_player1_no_shoot, sys_physics_behaviour_gravity, sys_collision_player_behaviour , 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 1, 174, 0

DEFINE_ENTITY_TEMPLATE player2_tmpl, e_type_player2, e_cmps_player , 67, 174, 4, 16, 0, 0, _spr_p2_base_left, player2_idle_left, 8, 0x0000, -1, sys_input_behaviour_player2_no_shoot, sys_physics_behaviour_gravity, sys_collision_player_behaviour , 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 1, 174, 0

;;====================================================================
;; BULLET TEMPLATE
;;====================================================================

DEFINE_ENTITY_TEMPLATE bullet_tmpl, e_type_bullet, e_cmps_bullet , 1, 1, 3,  6, 0, 0, _spr_p1_bullet_0, bullet_p1_idle, 1, 0x0000, 1, 0x0000, sys_physics_behaviour_bullet, sys_collision_bullet_behaviour ,0x0000, 1, 1, 0x0000,0x0000, 0, 1, 0, 1, 0

;;====================================================================
;; PLATFORMS TEMPLATES
;;====================================================================

DEFINE_ENTITY_TEMPLATE platform_grass_tmpl, e_type_platform, e_cmps_platform, 16, 115, 12, 8, 0, 0, _spr_platform_grass_0, platform_grass_idle, 1, 0x0000, 1, 0x0000, 0x0000, 0x0000, 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 0, 140, 0

DEFINE_ENTITY_TEMPLATE platform_grass_rocks_tmpl, e_type_platform, e_cmps_platform, 16, 115, 12, 8, 0, 0, _spr_platform_grass_rocks_0, platform_grass_rocks_idle, 1, 0x0000, 1, 0x0000, 0x0000, 0x0000, 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 0, 140, 0
DEFINE_ENTITY_TEMPLATE platform_grass_rocks_small_tmpl, e_type_platform, e_cmps_platform, 16, 115, 4, 8, 0, 0, _spr_platform_grass_rocks_small_0, platform_grass_rocks_small_idle, 1, 0x0000, 1, 0x0000, 0x0000, 0x0000, 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 0, 140, 0

DEFINE_ENTITY_TEMPLATE platform_rocks_grass_tmpl, e_type_platform, e_cmps_platform, 16, 115, 12, 8, 0, 0, _spr_platform_rocks_grass_0, platform_rocks_grass_idle, 1, 0x0000, 1, 0x0000, 0x0000, 0x0000, 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 0, 140, 0
DEFINE_ENTITY_TEMPLATE platform_rocks_grass_small_tmpl, e_type_platform, e_cmps_platform, 16, 115, 4, 8, 0, 0, _spr_platform_rocks_grass_small_0, platform_rocks_grass_small_idle, 1, 0x0000, 1, 0x0000, 0x0000, 0x0000, 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 0, 140, 0

DEFINE_ENTITY_TEMPLATE platform_rocks_tmpl, e_type_platform, e_cmps_platform, 16, 115, 12, 8, 0, 0, _spr_platform_rocks_0, platform_rocks_idle, 1, 0x0000, 1, 0x0000, 0x0000, 0x0000, 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 0, 140, 0
DEFINE_ENTITY_TEMPLATE platform_rocks_small_tmpl, e_type_platform, e_cmps_platform, 16, 115, 4, 8, 0, 0, _spr_platform_rocks_small_0, platform_rocks_small_idle, 1, 0x0000, 1, 0x0000, 0x0000, 0x0000, 0x0000, 1, 1, 0x0000, 0x0000, 0, 1, 0, 140, 0

;;====================================================================
;; ENEMIES TEMPLATES
;;====================================================================

DEFINE_ENTITY_TEMPLATE enemy_walker_tmpl, e_type_enemy, e_cmps_enemy_walker , 74, 174, 4, 16, 0, 0, _spr_walker_difficult_base_left, walker_difficult_idle_left, 1, 0x0000, -1, 0x0000, sys_physics_behaviour_gravity , sys_collision_player_behaviour ,sys_ai_behaviour_enemy_walker, 50, 174, patrol_01, 0x0000, 0, 1, 1, 174, 0

DEFINE_ENTITY_TEMPLATE enemy_walker_easy_tmpl, e_type_enemy, e_cmps_enemy_walker , 74, 174, 4, 16, 0, 0, _spr_walker_easy_base_left, walker_easy_idle_left, 1, 0x0000, -1, 0x0000, sys_physics_behaviour_gravity , sys_collision_player_behaviour ,sys_ai_behaviour_enemy_walker_easy, 50, 174, patrol_01, 0x0000, 0, 1, 1, 174, 0

DEFINE_ENTITY_TEMPLATE enemy_ghost_tmpl, e_type_enemy, e_cmps_enemy_ghost , 74, 174, 4, 16, 0, 0, _spr_ghost_difficult_base_left, ghost_difficult_idle_left, 1, 0x0000, -1, 0x0000, sys_physics_behaviour_no_gravity , sys_collision_player_behaviour ,sys_ai_behaviour_enemy_ghost, 50, 174, patrol_01, 0x0000, 0, 1, 0, 174, 0

DEFINE_ENTITY_TEMPLATE enemy_ghost_easy_tmpl, e_type_enemy, e_cmps_enemy_ghost , 74, 174, 4, 16, 0, 0, _spr_ghost_easy_base_left, ghost_easy_idle_left, 1, 0x0000, -1, 0x0000, sys_physics_behaviour_no_gravity , sys_collision_player_behaviour ,sys_ai_behaviour_enemy_ghost_easy, 50, 174, patrol_02, 0x0000, 0, 1, 0, 174, 0