Index: proj/include/ent.h
===================================================================
--- proj/include/ent.h	(revision 354)
+++ proj/include/ent.h	(nonexistent)
@@ -1,417 +0,0 @@
-#ifndef ENT_H_INCLUDED
-#define ENT_H_INCLUDED
-
-/**
- * @defgroup ent ent
- * @brief Entities module
- *
- * @{
- */
-
-#include "libs.h"
-
-/**
- * @brief Set scale.
- * @param   n   Scale
- */
-void (ent_set_scale) (double n);
-/**
- * @brief Set origin of screen (upper-left corner) in game referential coordinates.
- * @param   x   X-position of the upper-left corner of the screen
- * @param   y   Y-position of the upper-left corner of the screen
- */
-void (ent_set_origin)(double x, double y);
-/**
- * @brief Get scale.
- * @return  Scale
- */
-double (ent_get_scale)  (void);
-/**
- * @brief Get X-length of the screen in game referencial coordinates.
- * @return X-length
- */
-double (ent_get_XLength)(void);
-/**
- * @brief Get Y-length of the screen in game referencial coordinates.
- * @return Y-length
- */
-double (ent_get_YLength)(void);
-
-/**
- * @}
- */
-
-/**
- * @defgroup gunner_t gunner_t
- * @ingroup ent
- * @brief Gunner module.
- *
- * @{
- */
-
-/// @brief Identifier of a melee gunner
-#define GUNNER_MELEE    BIT(0)
-/// @brief Identifier of a ranged gunner
-#define GUNNER_RANGED   BIT(1)
-/// @brief Identifier of a player-controlled gunner
-#define GUNNER_PLAYER   BIT(2)
-/// @brief Identifier of an automatic follower gunner
-#define GUNNER_FOLLOW   BIT(3)
-
-/**
- * @brief Gunner.
- */
-typedef struct gunner gunner_t;
-/**
- * @brief Construct gunner.
- * @param   dude    Basic sprite representing the gunner
- * @param   weapon  Basic sprite representing the weapon of the gunner
- * @param   type    Type of gunner. Can be one of the identifier macros and also the OR-merge of any combination of them
- * @param   team    Team of the gunner. 1 for player 1, 2 for player 2, 3 for opponents and 0 for no team (temporary gunner)
- */
-gunner_t* (gunner_ctor)(basic_sprite_t *dude, basic_sprite_t *weapon, uint16_t type, int team);
-/**
- * @brief Destruct gunner.
- * @param   p   Pointer to gunner to be destructed
- */
-void      (gunner_dtor)(gunner_t *p);
-/**
- * @brief   Set gunner position.
- * @param   p   Pointer to gunner
- * @param   x   X-position of the gunner in game coordinates
- * @param   y   Y-position of the gunner in game coordinates
- */
-void (gunner_set_pos)               (gunner_t *p, double x, double y);
-/**
- * @brief   Set gunner spawn position.
- * @param   p   Pointer to gunner
- * @param   x   Spawn X-position of the gunner in game coordinates
- * @param   y   Spawn Y-position of the gunner in game coordinates
- */
-void (gunner_set_spawn)             (gunner_t *p, double x, double y);
-/**
- * @brief   Set gunner angle.
- * @param   p       Pointer to gunner
- * @param   angle   Angle in radians
- */
-void (gunner_set_angle)             (gunner_t *p, double angle);
-/**
- * @brief   Set gunner health (total, max health).
- * @param   p       Pointer to gunner
- * @param   health  Health
- */
-void (gunner_set_health)            (gunner_t *p, double health);
-/**
- * @brief   Set gunner current health.
- * @param   p       Pointer to gunner
- * @param   health  Current health
- */
-void (gunner_set_curr_health)       (gunner_t *p, double health);
-/**
- * @brief   Get gunner X-position.
- * @param   p   Pointer to gunner
- * @return  X-position of the gunner
- */
-double  (gunner_get_x)              (const gunner_t *p);
-/**
- * @brief   Get gunner Y-position.
- * @param   p   Pointer to gunner
- * @return  Y-position of the gunner
- */
-double  (gunner_get_y)              (const gunner_t *p);
-/**
- * @brief   Get gunner spawn X-position.
- * @param   p   Pointer to gunner
- * @return  Spawn X-position of the gunner
- */
-double  (gunner_get_spawn_x)        (const gunner_t *p);
-/**
- * @brief   Get gunner spawn Y-position.
- * @param   p   Pointer to gunner
- * @return  Spawn Y-position of the gunner
- */
-double  (gunner_get_spawn_y)        (const gunner_t *p);
-/**
- * @brief   Get gunner angle.
- * @param   p   Pointer to gunner
- * @return  Angle of the gunner
- */
-double  (gunner_get_angle)          (const gunner_t *p);
-/**
- * @brief   Get gunner max health.
- * @param   p   Pointer to gunner
- * @return  Max health of the gunner
- */
-double  (gunner_get_health)         (const gunner_t *p);
-/**
- * @brief   Get gunner current health.
- * @param   p   Pointer to gunner
- * @return  Current health of the gunner
- */
-double  (gunner_get_curr_health)    (const gunner_t *p);
-/**
- * @brief   Get gunner X-position in screen coordinates.
- * @param   p   Pointer to gunner
- * @return  X-position of the gunner in screen coordinates
- */
-int16_t (gunner_get_x_screen)       (const gunner_t *p);
-/**
- * @brief   Get gunner Y-position in screen coordinates.
- * @param   p   Pointer to gunner
- * @return  Y-position of the gunner in screen coordinates
- */
-int16_t (gunner_get_y_screen)       (const gunner_t *p);
-/**
- * @brief   Get gunner type.
- * @param   p   Pointer to gunner
- * @return  Type of gunner
- */
-uint16_t (gunner_get_type)          (const gunner_t *p);
-/**
- * @brief   Get gunner team.
- * @param   p   Pointer to gunner
- * @return  Team of gunner
- */
-int     (gunner_get_team)           (const gunner_t *p);
-/**
- * @brief   Draw gunner on screen buffer.
- * @param   p   Pointer to gunner
- */
-void (gunner_draw)(gunner_t *p);
-/**
- * @brief   Draw gunner health bar on screen buffer.
- * @param   p   Pointer to gunner
- */
-void (gunner_draw_health)(const gunner_t *p);
-/**
- * @brief   Draw list of gunners on screen buffer.
- * @param   shooter_list    List of gunners
- */
-void (gunner_draw_list)(list_t *shooter_list);
-/**
- * @brief Get distance between two gunners.
- * @param   p1  Gunner 1
- * @param   p2  Gunner 2
- * @return  Euclidian distance between the two gunners
- */
-double (gunner_distance)(const gunner_t *p1, const gunner_t *p2);
-/**
- * @brief Check if two gunners are colliding.
- * @param   p1  Gunner 1
- * @param   p2  Gunner 2
- * @return  true if the two gunners are colliding, false otherwise
- */
-int (gunner_collides_gunner)(const gunner_t *p1, const gunner_t *p2);
-
-/**
- * @}
- */
-
-/**
- * @defgroup bullet_t bullet_t
- * @ingroup ent
- * @brief Bullet module.
- *
- * @{
- */
-
-/**
- * @brief Bullet.
- */
-typedef struct bullet bullet_t;
-/**
- * @brief Construct bullet.
- * @param   shooter Pointer to gunner that shot that bullet
- * @param   b       Basic sprite of the bullet
- * @param   x       X-position
- * @param   y       Y-position
- * @param   vx      X-speed
- * @param   vy      Y-speed
- * @return Pointer to constructed bullet, or NULL if failed
- */
-bullet_t* (bullet_ctor)(const gunner_t *shooter, const basic_sprite_t *b, double x, double y, double vx, double vy);
-/**
- * @brief Destruct bullet.
- * @param   p   Pointer to bullet to be destructed
- */
-void      (bullet_dtor)(bullet_t *p);
-/**
- * @brief   Get bullet X-position.
- * @param   p   Pointer to bullet
- * @return  X-position of the bullet
- */
-double  (bullet_get_x)       (const bullet_t *p);
-/**
- * @brief   Get bullet Y-position.
- * @param   p   Pointer to bullet
- * @return  Y-position of the bullet
- */
-double  (bullet_get_y)       (const bullet_t *p);
-/**
- * @brief   Get bullet X-speed.
- * @param   p   Pointer to bullet
- * @return  X-speed of the bullet
- */
-double  (bullet_get_vx)      (const bullet_t *p);
-/**
- * @brief   Get bullet Y-speed.
- * @param   p   Pointer to bullet
- * @return  Y-speed of the bullet
- */
-double  (bullet_get_vy)      (const bullet_t *p);
-/**
- * @brief   Get bullet X-position in screen coordinates.
- * @param   p   Pointer to bullet
- * @return  X-position of the bullet in screen coordinates
- */
-int16_t (bullet_get_x_screen)(const bullet_t *p);
-/**
- * @brief   Get bullet Y-position in screen coordinates.
- * @param   p   Pointer to bullet
- * @return  Y-position of the bullet in screen coordinates
- */
-int16_t (bullet_get_y_screen)(const bullet_t *p);
-/**
- * @brief   Get bullet damage.
- * @param   p   Pointer to bullet
- * @return  Damage
- */
-double  (bullet_get_damage)  (const bullet_t *p);
-/**
- * @brief   Set bullet damage.
- * @param   p   Pointer to bullet
- * @param   damage  Damage
- */
-void    (bullet_set_damage)  (bullet_t *p, double damage);
-/**
- * @brief Get gunner that shot the bullet.
- * @param   p   Pointer to bullet
- * @return  Pointer to gunner that shot the bullet
- */
-const gunner_t* (bullet_get_shooter)(const bullet_t *p);
-/**
- * @brief Update bullet position (i.e., advance it according to its speed).
- * @param   p   Pointer to bullet
- */
-void (bullet_update_movement)(bullet_t *p);
-/**
- * @brief Update movement of bullets in a list.
- * @param   bullet_list     Pointer to bullet list
- */
-void (bullet_update_movement_list)(list_t *bullet_list);
-/**
- * @brief Draw bullet on screen buffer.
- * @param   p   Pointer to bullet
- */
-void (bullet_draw)(bullet_t *p);
-/**
- * @brief Draw bullets in list on screen buffer.
- * @param   bullet_list     Pointer to bullet list
- */
-void (bullet_draw_list)(list_t *bullet_list);
-
-/**
- * @}
- */
-
-/**
- * @defgroup map_t map_t
- * @ingroup ent
- * @brief Bullet module.
- *
- * @{
- */
-
-/**
- * @brief Map.
- */
-typedef struct map map_t;
-/**
- * @brief Construct map.
- * @param   background  XPM describing map as it should be rendered
- * @param   collide     XPM with transparency describing what parts of the map will cause collision
- * @return  Pointer to constructed map, or NULL if failed
- */
-map_t* (map_ctor)(const char *const *background, const char *const *collide);
-/**
- * @brief Destruct map.
- * @param   p   Pointer to map to be destructed
- */
-void   (map_dtor)(map_t *p);
-/**
- * @brief Get map width.
- * @param   p   Pointer to map
- * @return      Width of map
- */
-uint16_t (map_get_width)   (const map_t *p);
-/**
- * @brief Get map height.
- * @param   p   Pointer to map
- * @return      Height of map
- */
-uint16_t (map_get_height)  (const map_t *p);
-/**
- * @brief Use Dijkstra's path-finding algorithm.
- *
- * Allows a follower to know where to move so it gets closer to a given target.
- *
- * This function is implemented in a clever way that reduces the time of execution.
- * On the other hand, it might not always give the shortest path, but it is
- * guaranteeed to provide a decent, valid path to the target.
- *
- * @param   p   Pointer to map
- * @param   x_  X-position of the target
- * @param   y_  Y-position of the target
- * @return  SUCCESS if operation is successful, false otherwise
- */
-int (map_make_dijkstra)(map_t *p, double x_, double y_);
-/**
- * @brief Get the direction a follower should move to get closer to the target.
- * @param   p       Pointer to map
- * @param   x       X-position of the follower
- * @param   y       Y-position of the follower
- * @param   theta   Pointer to angle that will be updated
- * @return SUCCESS if operation was successful, other value otherwise
- */
-int (map_where_to_follow)(const map_t *p, double x, double y, double *theta);
-/**
- * @brief Draw map on screen buffer.
- * @param   p   Pointer to map
- */
-void   (map_draw)(map_t *p);
-/**
- * @brief Evaluate if point collides with map.
- * @param   p   Pointer to map
- * @param   x   X-position of the point
- * @param   y   Y-position of the point
- * @return true if the point collides with the map, false otherwise
- */
-int    (map_collides_point)(const map_t *p, double x, double y);
-
-/**
- * @}
- */
-
-/**
- * @brief Evaluate if gunner is colliding with map.
- * @param   p       Pointer to map
- * @param   gunner  Pointer to gunner
- * @return true if the gunner collides with the map, false otherwise
- */
-int    (map_collides_gunner)(const map_t *p, const gunner_t *gunner);
-/**
- * @brief Evaluate if bullet is colliding with map.
- * @param   p       Pointer to map
- * @param   bullet  Pointer to bullet
- * @return true if the bullet collides with the map, false otherwise
- */
-int    (map_collides_bullet)(const map_t *p, const bullet_t *bullet);
-/**
- * @brief Evaluate if bullet is colliding with gunner.
- * @param   shooter     Pointer to gunner
- * @param   bull        Pointer to bullet
- * @return true if the bullet collides with the gunner, false otherwise
- */
-int (gunner_collides_bullet)(const gunner_t *shooter, const bullet_t *bull);
-
-#endif //ENT_H_INCLUDED

Property changes on: proj/include/ent.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/scoreboards.h
===================================================================
--- proj/include/scoreboards.h	(revision 354)
+++ proj/include/scoreboards.h	(nonexistent)
@@ -1,60 +0,0 @@
-#ifndef SCOREBOARD_H_INCLUDED
-#define SCOREBOARD_H_INCLUDED
-
-/**
- * @defgroup scoreboards scoreboards
- * @brief Scoreboards module.
- *
- * @{
- */
-
-#include "libs.h"
-#include <stdint.h>
-
-/**
- * @brief Score.
- */
-typedef struct  score_info score_info_t;
-
-/**
- * @brief Table of highscores.
- */
-typedef struct highscores highscores_t;
-/**
- * @brief Construct score.
- * @param   score           Game score.
- * @param   time_played     Time elapsed on game.
- * @return      Pointer to constructed score, or NULL if failed.
- */
-score_info_t* (score_ctor)(int score, int time_played);
-
-/**
- * @brief Destruct score.
- * @param   p   Pointer to score to destruct
- */
-void (score_dtor)(score_info_t *p);
-
-/**
- * @brief Construct highscores.
- * @param   fnt     Font to use when rendering highscores text
- * @param   path    Path to file to be read with highscores values.
- * @return      Pointer to constructed highscores, or NULL if failed.
- */
-highscores_t* (highscores_ctor)(const font_t *fnt, const char *path);
-/**
- * @brief Save highscore into file.
- * @param f     Path to file to be written
- */
-void (highscores_save)(const highscores_t *p, const char *path);
-/**
- * @brief Destruct menu.
- * @param   p   Pointer to menu to destruct
- */
-void (highscores_dtor)(highscores_t *p);
-
-/**
- * @}
- */
-
-
-#endif /* end of include guard: SCOREBOARD_H_INCLUDED */

Property changes on: proj/include/scoreboards.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/zombies.h
===================================================================
--- proj/include/zombies.h	(revision 354)
+++ proj/include/zombies.h	(nonexistent)
@@ -1,6 +0,0 @@
-#ifndef ZOMBIES_H_INCLUDED
-#define ZOMBIES_H_INCLUDED
-
-int (zombies)(void);
-
-#endif //ZOMBIES_H_INCLUDED

Property changes on: proj/include/zombies.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/interrupts_func.h
===================================================================
--- proj/include/interrupts_func.h	(revision 354)
+++ proj/include/interrupts_func.h	(nonexistent)
@@ -1,48 +0,0 @@
-#ifndef INTERRUPTS_FUNC_H_INCLUDED
-#define INTERRUPTS_FUNC_H_INCLUDED
-
-/**
- * @defgroup interrupts_func interrupts_func
- * @brief Interrupts functions.
- *
- * @{
- */
-
-#include "libs.h"
-
-/**
- * @brief Subscribes all drivers used (timer->keyboard->mouse)
- * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
- * @see {_ERRORS_H_::errors}
- */
-int (subscribe_all)(void);
-
-/**
- * @brief Unsubscribes all subscribed interrupts
- * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
- * @see {_ERRORS_H_::errors}
- */
-int (unsubscribe_all)(void);
-
-/**
- * @brief Calls interrupt handler corresponding to the bit specified by the argument.
- * @param handler Interrupt handler to call
- */
-void interrupt_handler(uint8_t handler);
-
-/**
- * @brief Blocking function that waits for an interrupt to occur.
- *
- * Rewrites the provided argument with the interrupt vector it gets.
- *
- * This function decisively reduces the complexity of an interrupt cycle, allowing
- * for each menu to have its own, simplified interrupt cycle.
- * @param   p   Pointer where interrupt vector will be saved
- */
-int get_interrupts_vector(uint64_t *p);
-
-/**
- * @}
- */
-
-#endif /* end of include guard: INTERRUPTS_FUNC_H_INCLUDED */

Property changes on: proj/include/interrupts_func.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/proj.h
===================================================================
--- proj/include/proj.h	(revision 354)
+++ proj/include/proj.h	(nonexistent)
@@ -1,17 +0,0 @@
-#ifndef PROJ_H_INCLUDED
-#define PROJ_H_INCLUDED
-
-#include "libs.h"
-
-#include "ent.h"
-
-basic_sprite_t       *bsp_crosshair;
-basic_sprite_t       *bsp_shooter  ;
-basic_sprite_t       *bsp_zombie   ;
-basic_sprite_t       *bsp_pistol   ;
-basic_sprite_t       *bsp_nothing  ;
-basic_sprite_t       *bsp_bullet   ;
-map_t                *map1         ;
-sprite_t             *sp_crosshair ;
-
-#endif //PROJ_H_INCLUDED

Property changes on: proj/include/proj.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/proj_structures.h
===================================================================
--- proj/include/proj_structures.h	(revision 354)
+++ proj/include/proj_structures.h	(nonexistent)
@@ -1,183 +0,0 @@
-#ifndef PROJ_STRUCTURES_H_INCLUDED
-#define PROJ_STRUCTURES_H_INCLUDED
-
-/**
- * @defgroup proj_structures proj_structures
- * @brief Project structures.
- *
- * @{
- */
-
-#include <stdint.h>
-#include "ent.h"
-
-/**
- * @}
- */
-
-/**
- * @defgroup keys_t keys_t
- * @ingroup proj_structures
- * @brief Keys pressed module.
- *
- * @{
- */
-
-/**
- * @brief Keys pressed.
- */
-typedef struct {
-    /// @brief W is pressed when 1
-    uint8_t w_pressed       : 1;
-    /// @brief A is pressed when 1
-    uint8_t a_pressed       : 1;
-    /// @brief S is pressed when 1
-    uint8_t s_pressed       : 1;
-    /// @brief D is pressed when 1
-    uint8_t d_pressed       : 1;
-    /// @brief Ctrl is pressed when 1
-    uint8_t ctrl_pressed    : 1;
-    /// @brief Plus (+) is pressed when 1
-    uint8_t plus_pressed    : 1;
-    /// @brief Minus (-) is pressed when 1
-    uint8_t minus_pressed   : 1;
-    /// @brief Mouse left button is pressed when 1
-    uint8_t lb_pressed      : 1;
-} keys_t;
-
-/**
- * @}
- */
-
-/**
-* @defgroup host_info_t host_info_t
-* @ingroup proj_structures
-* @brief Host info module.
-*
-* @{
-*/
-
-/**
- * @brief Information to transmit from host to remote.
- */
-typedef struct {
-    // host
-    /// @brief Host player X-position
-    int16_t    host_x;
-    /// @brief Host player Y-postition
-    int16_t    host_y;
-    /// @brief Host player angle
-    float      host_angle;
-    /// @brief Host player health
-    int16_t    host_health;
-    /// @brief Host player current health
-    int16_t    host_current_health;
-
-    // remote
-    /// @brief Remote player X-position
-    int16_t    remote_x;
-    /// @brief Remote player Y-postition
-    int16_t    remote_y;
-    /// @brief Remote player angle
-    float      remote_angle;
-    /// @brief Remote player health
-    int16_t    remote_health;
-    /// @brief Remote player current health
-    int16_t    remote_current_health;
-    /*
-    // bullets
-    /// @brief Number of bullets
-    uint8_t    no_bullets;
-    /// @brief X-position of the bullets
-    int16_t   *bullets_x;
-    /// @brief Y-position of the bullets
-    int16_t   *bullets_y;
-    /// @brief X-speed of the bullets
-    int16_t   *bullets_vx;
-    /// @brief Y-speed of the bullets
-    int16_t   *bullets_vy;
-    /// @brief Who shot each bullet
-    bool      *bullets_shooter; // false for host, true for remote
-    */
-} host_info_t;
-/**
- * @brief Construct host information.
- * @param   host    Pointer to host gunner
- * @param   remote  Pointer to remote gunner
- * @return  Pointer to constructed host information, or NULL if failed
- */
-host_info_t* host_info_ctor(gunner_t *host, gunner_t *remote);
-/**
- * @brief Destruct host information.
- * @param   p   Pointer to host information to be destructed
- */
-void host_info_dtor(host_info_t *p);
-
-/**
- * @}
- */
-
-/**
-* @defgroup remote_info_t remote_info_t
-* @ingroup proj_structures
-* @brief Remote info module.
-*
-* @{
-*/
-
-/**
- * @brief Information to transmit from remote to host.
- */
-typedef struct {
-    /// @brief Remote keys that are pressed
-    keys_t  remote_keys_pressed;
-    /// @brief Remote player angle
-    double  remote_angle;
-} remote_info_t;
-/**
- * @brief Construct remote information.
- * @return  Pointer to constructed remote information, or NULL if failed
- */
-remote_info_t* remote_info_ctor(void);
-/**
- * @brief Destruct remote information.
- * @param   p   Pointer to remote information to be destructed
- */
-void remote_info_dtor(remote_info_t *p);
-
-/**
- * @}
- */
-
-/**
-* @defgroup bullet_info_t bullet_info_t
-* @ingroup proj_structures
-* @brief Bullet event module.
-*
-* @{
-*/
-
-
-/**
- * @brief Bullet event to transmit from remote to host.
- */
-typedef struct {
-    /// @brief New bullet signal from remote
-    bool   new_bullet;
-} bullet_info_t;
-/**
- * @brief Construct bullet event.
- * @return  Pointer to constructed bullet event, or NULL if failed
- */
-bullet_info_t* bullet_info_ctor(void);
-/**
- * @brief Destruct bullet event.
- * @param   p   Pointer to bullet event to be destructed
- */
-void bullet_info_dtor(bullet_info_t *p);
-
-/**
- * @}
- */
-
-#endif /* end of include guard: PROJ_STRUCTURES_H_INCLUDED */

Property changes on: proj/include/proj_structures.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/singleplayer.h
===================================================================
--- proj/include/singleplayer.h	(revision 354)
+++ proj/include/singleplayer.h	(nonexistent)
@@ -1,6 +0,0 @@
-#ifndef SINGLEPLAYER_H_INCLUDED
-#define SINGLEPLAYER_H_INCLUDED
-
-int (singleplayer)(void);
-
-#endif //SINGLEPLAYER_H_INCLUDED

Property changes on: proj/include/singleplayer.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/proj_macros.h
===================================================================
--- proj/include/proj_macros.h	(revision 354)
+++ proj/include/proj_macros.h	(nonexistent)
@@ -1,62 +0,0 @@
-#ifndef PROJ_MACROS_H_INCLUDED
-#define PROJ_MACROS_H_INCLUDED
-
-/**
- * @defgroup proj_macros proj_macros
- * @brief Project macros.
- *
- * @{
- */
-
-// Movement Directions
-/** @brief Moving to the top side of screen */
-#define UP      -1
-/** @brief Moving to the bottom side of screen */
-#define DOWN    1
-/** @brief Moving to the left side of screen */
-#define LEFT    -1
-/** @brief Moving to the right side of screen */
-#define RIGHT   1
-/** @brief Not moving */
-#define REST    0
-
-// Movement Constants
-/** @brief Shooter speed */
-#define SHOOTER_SPEED   5
-/** @brief Bullet speet */
-#define BULLET_SPEED    8
-
-// Refresh Rate
-/** @brief Screen refresh rate */
-#define REFRESH_RATE    60
-
-//Graphics mode
-/** @brief Graphic mode used */
-#define GRAPH_MODE      DIRECT_1024_768_888
-/** @brief Minimum zoom */
-#define MIN_SCALE       0.2
-/** @brief Default zoom */
-#define DEFAULT_SCALE   0.5
-/** @brief Maximum zoom */
-#define MAX_SCALE       10.0
-
-// Colors
-/** @brief Text color */
-#define TEXT_COLOR              0xFFFFFF
-/** @brief Highlight color */
-#define HIGHLIGHT_COLOR         0x404040
-/** @brief Delimiter color */
-#define DELIMITER_COLOR         0x404040
-
-/** @brief Melee attacks range */
-#define MELEE_RANGE    80
-/** @brief Melee attack damage (for zombies). */
-#define MELEE_DAMAGE   1
-/** @brief Zombie speed */
-#define ZOMBIE_SPEED    1.0
-
-/**
- * @}
- */
-
-#endif /* end of include guard: PROJ_MACROS_H_INCLUDED */

Property changes on: proj/include/proj_macros.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/campaign.h
===================================================================
--- proj/include/campaign.h	(revision 354)
+++ proj/include/campaign.h	(nonexistent)
@@ -1,6 +0,0 @@
-#ifndef CAMPAIGN_H_INCLUDED
-#define CAMPAIGN_H_INCLUDED
-
-int (campaign)(void);
-
-#endif //CAMPAIGN_H_INCLUDED

Property changes on: proj/include/campaign.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/chat.h
===================================================================
--- proj/include/chat.h	(revision 354)
+++ proj/include/chat.h	(nonexistent)
@@ -1,6 +0,0 @@
-#ifndef CHAT_H_INCLUDED
-#define CHAT_H_INCLUDED
-
-int (chat)(void);
-
-#endif //CHAT_H_INCLUDED

Property changes on: proj/include/chat.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/proj_func.h
===================================================================
--- proj/include/proj_func.h	(revision 354)
+++ proj/include/proj_func.h	(nonexistent)
@@ -1,157 +0,0 @@
-#ifndef PROJ_FUNC_H_INCLUDED
-#define PROJ_FUNC_H_INCLUDED
-
-/**
- * @defgroup proj_func proj_func
- * @brief Project helper functions.
- *
- * @{
- */
-
-#include "libs.h"
-#include "proj_structures.h"
-
-//#include <stdint.h>
-
-/**
- * @brief Cleans up all memory, unsubscribes interrupts.
- * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
- * @see {_ERRORS_H_::errors}
- */
-int cleanup(void);
-
-/**
- * @brief Update key presses.
- */
-void update_key_presses(void);
-/**
- * @brief Get key presses.
- * @return  keys_t containing key presses
- */
-keys_t* (get_key_presses)(void);
-
-/**
- * @brief Update mouse.
- */
-void update_mouse(struct packet *p);
-/**
- * @brief Get pointer to mouse X-position.
- * @return  Pointer to mouse X-position.
- */
-int16_t* get_mouse_X(void);
-/**
- * @brief Get pointer to mouse Y-position.
- * @return  Pointer to mouse Y-position.
- */
-int16_t* get_mouse_Y(void);
-/**
- * @brief Get cursor angle relative to a gunner in the screen.
- * @param   p   Pointer to gunner
- * @return      Angle of the mouse relative to the gunner
- */
-double get_mouse_angle(gunner_t *p);
-
-/**
- * @brief Updates movement variables.
- */
-void update_movement(map_t *map, gunner_t *p, keys_t *keys, list_t *shooter_list);
-
-/**
- * @brief Get random spawn (actually, position) for new gunner.
- *
- * The new position cannot collide with the map, nor with any of the gunners
- * already in the list.
- * @param   map     Pointer to map
- * @param   p       Pointer to new gunner
- * @param   l       List of gunners that already exist
- */
-void (get_random_spawn)(const map_t *map, gunner_t *p, list_t *l);
-
-/**
- * @brief Update scale if the keys were pressed to change scale.
- */
-void update_scale(void);
-
-/**
- * @brief Shoot a bullet.
- * @param   shooter     Pointer to gunner that shot the bullet
- * @param   bullet_list List of the bullets in the map
- * @param   bsp_bullet  Basic sprite that will be used to render the bullet
- */
-void (shoot_bullet)(const gunner_t *shooter, list_t *bullet_list, const basic_sprite_t *bsp_bullet);
-/**
- * @brief Update game state.
- *
- * This includes moving bullets accordingly, processing damages, collisions of
- * bullets with walls, melee damage for the gunners that have autonomous melee.
- * @param   map             Pointer to map
- * @param   shooter_list    List of shooters
- * @param   bullet_list     List of bullets in the map
- */
-void (update_game_state)(const map_t *map, list_t *shooter_list, list_t *bullet_list);
-
-/**
- * @brief Wrapper to easen filling of the host_info_t.
- * @param   p       Host info to fill
- * @param   host    Host gunner
- * @param   remote  Remote gunner
- */
-void build_host_structure(host_info_t *p, gunner_t *host, gunner_t *remote);
-/**
- * @brief Wrapper to easen filling of the remote_info_t.
- * @param   p       Remote info to fill
- * @param   keys    Key presses of remote
- * @param   angle   Mouse angle of remote
- */
-void build_remote_structure(remote_info_t *p, keys_t *keys, double angle);
-
-
-
-/**
- * @}
- */
-
-/**
- * @defgroup text_timer_t text_timer_t
- * @ingroup proj_func
- * @brief Text timer.
- *
- * @{
- */
-
-/**
- * @brief Text timer.
- */
-typedef struct {
-    /// @brief Time since construction.
-    int time;
-    /// @brief Text.
-    text_t *text;
-} text_timer_t;
-/**
- * @brief Construct timer
- * @param   fnt Font used to render timer text
- * @return      Pointer to constructed timer, or NULL if failed
- */
-text_timer_t* (text_timer_ctor)(const font_t *fnt);
-/**
- * @brief Destruct timer.
- * @param   p   Pointer to timer to be destructed
- */
-void (text_timer_dtor)(text_timer_t *p);
-/**
- * @brief   Update timer, by incrementing the number of seconds.
- * @param   p   Pointer to timer
- */
-void (text_timer_update)(text_timer_t *p);
-/**
- * @brief   Reset timer to 0.
- * @param   p   Pointer to timer
- */
-void (text_timer_reset)(text_timer_t *p);
-
-/**
- * @}
- */
-
-#endif /* end of include guard: PROJ_FUNC_H_INCLUDED */

Property changes on: proj/include/proj_func.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/include/makecode_map.h
===================================================================
--- proj/include/makecode_map.h	(revision 354)
+++ proj/include/makecode_map.h	(nonexistent)
@@ -1,27 +0,0 @@
-#ifndef MAKE_CODE_MAP_H_
-#define MAKE_CODE_MAP_H_
-
-/**
- * @defgroup makecode_map makecode_map
- * @brief Makecode map.
- *
- * @{
- */
-
-#include <stdint.h>
-
-/// @brief Error code
-#define ERROR_CODE      0
-
-/**
- * @brief Maps make code into char
- * @param code      Make code to map.
- * @return ERROR_CODE if code char isn't valid, otherwise the character.
- */
-char (map_makecode)(uint8_t code);
-
-/**
- * @}
- */
-
-#endif /* end of include guard: MAKE_CODE_MAP_H_ */

Property changes on: proj/include/makecode_map.h
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/chat.c
===================================================================
--- proj/src/chat.c	(revision 354)
+++ proj/src/chat.c	(nonexistent)
@@ -1,186 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "chat.h"
-
-#include "proj.h"
-
-#include "proj_macros.h"
-#include "proj_func.h"
-#include "ent.h"
-#include "interrupts_func.h"
-#include "libs.h"
-#include "makecode_map.h"
-#include <math.h>
-
-#include "hltp.h"
-
-#define CHAT_MAX_SIZE   75
-#define CHAT_MAX_NUM    19
-static text_t      *t_text[CHAT_MAX_NUM] = {NULL};
-static rectangle_t *r_text               =  NULL;
-
-static void chat_process(const uint8_t *p, const size_t sz){
-    char buffer2[CHAT_MAX_NUM+3];
-    void *dest = NULL;
-    hltp_type tp = hltp_interpret(p, sz, &dest);
-    switch(tp){
-        case hltp_type_string:
-        strcpy(buffer2, dest);
-        strncat(buffer2, " <", 2);
-        for(size_t i = CHAT_MAX_NUM-1; i; --i)
-        text_set_string(t_text[i], text_get_string(t_text[i-1]));
-        text_set_string(t_text[0], buffer2);
-        for(size_t i = 0; i < CHAT_MAX_NUM; ++i){
-            if(text_get_string(t_text[i])[0] == '>'){
-                text_set_pos(t_text[i], rectangle_get_x(r_text)+50, text_get_y(t_text[i]));
-                text_set_halign(t_text[i], text_halign_left);
-            }else{
-                text_set_pos(t_text[i], rectangle_get_x(r_text)+rectangle_get_w(r_text)-50, text_get_y(t_text[i]));
-                text_set_halign(t_text[i], text_halign_right);
-            }
-        }
-        break;
-        case hltp_type_invalid: break;
-        case hltp_type_bullet : break;
-        case hltp_type_host   : break;
-        case hltp_type_remote : break;
-    }
-}
-
-int (chat)(void){
-    int r;
-
-    nctp_dump();
-    nctp_set_processor(chat_process);
-
-    struct packet pp;
-
-    char buffer[CHAT_MAX_SIZE] = "";
-    rectangle_t *r_buffer = NULL; {
-        r_buffer = rectangle_ctor(0,0,900,70);
-        rectangle_set_pos(r_buffer, graph_get_XRes()/2  -rectangle_get_w(r_buffer)/2,
-        (int16_t)(graph_get_YRes()*0.87-rectangle_get_h(r_buffer)/2));
-        rectangle_set_fill_color   (r_buffer, GRAPH_BLACK);
-        rectangle_set_outline_width(r_buffer, 2);
-        rectangle_set_outline_color(r_buffer, GRAPH_WHITE);
-        rectangle_set_fill_trans(r_buffer, GRAPH_TRANSPARENT);
-    }
-    text_t      *t_buffer = NULL; {
-        t_buffer = text_ctor(font_get_default(), "");
-        text_set_pos(t_buffer, rectangle_get_x(r_buffer)+50,
-        rectangle_get_y(r_buffer)+rectangle_get_h(r_buffer)/2);
-        text_set_halign(t_buffer, text_halign_left);
-        text_set_valign(t_buffer, text_valign_center);
-        text_set_color (t_buffer, TEXT_COLOR);
-    }
-    text_t      *t_size   = NULL; {
-        t_size = text_ctor(font_get_default(), "");
-        text_set_pos(t_size, rectangle_get_x(r_buffer)+rectangle_get_w(r_buffer)-5,
-        rectangle_get_y(r_buffer)+rectangle_get_h(r_buffer)-5);
-        text_set_halign(t_size, text_halign_right);
-        text_set_valign(t_size, text_valign_bottom);
-        text_set_color (t_size, TEXT_COLOR);
-        text_set_size  (t_size, 18);
-        char buffer2[20];
-        sprintf(buffer2, "%d/%d", strlen(buffer), CHAT_MAX_SIZE);
-        text_set_string(t_size, buffer2);
-    }
-
-    /** r_text */ {
-    r_text = rectangle_ctor(0,0,900,550);
-    rectangle_set_pos(r_text, graph_get_XRes()/2  -rectangle_get_w(r_buffer)/2,
-    (int16_t)(graph_get_YRes()*0.09));
-    rectangle_set_fill_color   (r_text, GRAPH_BLACK);
-    rectangle_set_outline_width(r_text, 2);
-    rectangle_set_outline_color(r_text, GRAPH_WHITE);
-    rectangle_set_fill_trans(r_text, GRAPH_TRANSPARENT);
-    }
-    /** t_text */ {
-    for(uint16_t i = 0; i < CHAT_MAX_NUM; ++i){
-        t_text[i] = text_ctor(font_get_default(), " ");
-        text_set_pos(t_text[i], rectangle_get_x(r_text)+50,
-        rectangle_get_y(r_text)+rectangle_get_h(r_text)-30-25*i);
-        text_set_halign(t_text[i], text_halign_left);
-        text_set_valign(t_text[i], text_valign_bottom);
-        text_set_color (t_text[i], TEXT_COLOR);
-    }
-}
-
-/// loop stuff
-uint64_t int_vector = 0;
-int good = true;
-while (good) {
-    /* Get a request message. */
-    if((r = get_interrupts_vector(&int_vector))) return r;
-    uint32_t n = 1;
-    for (uint8_t i = 0; i < 32; i++, n <<= 1) {
-        if (int_vector & n) {
-            interrupt_handler(i);
-            switch (i) {
-                case TIMER0_IRQ:
-                graph_clear_screen();
-                sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
-
-                rectangle_draw(r_buffer);
-                text_draw(t_buffer);
-                text_draw(t_size);
-
-                rectangle_draw(r_text);
-                for(size_t j = 0; j < CHAT_MAX_NUM; ++j) text_draw(t_text[j]);
-
-                sprite_draw(sp_crosshair);
-                graph_draw();
-                break;
-                case KBC_IRQ:
-                if      (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
-                else if (keyboard_get_scancode()[0] == ENTER_MAKE_CODE) {
-                    hltp_send_string(buffer);
-                    char buffer2[CHAT_MAX_SIZE+3] = "> ";
-                    strncat(buffer2, buffer, strlen(buffer));
-                    for(size_t j = CHAT_MAX_NUM-1; j; --j) text_set_string(t_text[i], text_get_string(t_text[i-1]));
-                    text_set_string(t_text[0], buffer2);
-                    for(size_t j = 0; j < CHAT_MAX_NUM; ++j){
-                        if(text_get_string(t_text[j])[0] == '>'){
-                            text_set_pos(t_text[j], rectangle_get_x(r_text)+50, text_get_y(t_text[j]));
-                            text_set_halign(t_text[j], text_halign_left);
-                        }else{
-                            text_set_pos(t_text[j], rectangle_get_x(r_text)+rectangle_get_w(r_text)-50, text_get_y(t_text[j]));
-                            text_set_halign(t_text[j], text_halign_right);
-                        }
-                    }
-                    buffer[0] = '\0';
-                } else if(keyboard_get_scancode()[0] == BACKSPACE_MAKE_CODE){
-                    buffer[strlen(buffer)-1] = '\0';
-                } else {
-                    char c = map_makecode(keyboard_get_scancode()[0]);
-                    if (c == ERROR_CODE) break;
-                    if(strlen(buffer) < CHAT_MAX_SIZE) strncat(buffer, &c, 1);
-                    else                               printf("Char limit exceeded\n");
-                }
-                text_set_string(t_buffer, buffer);
-                char buffer2[20];
-                sprintf(buffer2, "%d/%d", strlen(buffer), CHAT_MAX_SIZE);
-                text_set_string(t_size, buffer2);
-                case MOUSE_IRQ:
-                if (mouse_get_counter_mouse_ih() >= 3) {
-                    mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
-                    update_mouse(&pp);
-                    mouse_set_counter_mouse_ih(0);
-                }
-                break;
-                case COM1_IRQ: nctp_ih(); break;
-            }
-        }
-    }
-}
-
-rectangle_dtor(r_buffer);
-text_dtor     (t_buffer);
-
-rectangle_dtor(r_text);
-for(size_t i = 0; i < CHAT_MAX_NUM; ++i) text_dtor(t_text[i]);
-
-nctp_set_processor(NULL);
-
-return SUCCESS;
-}

Property changes on: proj/src/chat.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/campaign.c
===================================================================
--- proj/src/campaign.c	(revision 354)
+++ proj/src/campaign.c	(nonexistent)
@@ -1,121 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "campaign.h"
-
-#include "proj.h"
-
-#include "proj_macros.h"
-#include "proj_func.h"
-#include "ent.h"
-#include "interrupts_func.h"
-
-#include "libs.h"
-
-#include <math.h>
-
-int (campaign)(void){
-
-    int r;
-
-    ent_set_scale(DEFAULT_SCALE);
-    text_timer_t *in_game_timer = text_timer_ctor(font_get_default());
-
-    list_t *shooter_list = list_ctor();
-
-    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
-    gunner_set_spawn(shooter1, 75, 75);
-    gunner_set_pos(shooter1, 75, 75);
-
-    gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing, GUNNER_PLAYER, 2);
-    gunner_set_spawn(shooter2, 975, 75);
-    gunner_set_pos(shooter2, 775, 75);
-
-    list_insert(shooter_list, list_end(shooter_list), shooter1);
-    list_insert(shooter_list, list_end(shooter_list), shooter2);
-
-    list_t *bullet_list  = list_ctor();
-
-    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
-    uint8_t last_lb = 0;
-    struct packet pp;
-    keys_t *keys = get_key_presses();
-
-    /// loop stuff
-    uint64_t int_vector = 0;
-    int good = true;
-    while (good) {
-        /* Get a request message. */
-        if((r = get_interrupts_vector(&int_vector))) return r;
-        uint32_t n = 1;
-        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
-            if(!good) break;
-            if (int_vector & n) {
-                interrupt_handler(i);
-                switch (i) {
-                    case TIMER0_IRQ:
-
-                    if (timer_get_no_interrupts() % 60 == 0) text_timer_update(in_game_timer);
-                    update_movement(map1, shooter1, keys, shooter_list);
-
-                    update_game_state(map1, shooter_list, bullet_list);
-
-                    //update_scale();
-                    double angle = get_mouse_angle(shooter1);
-                    gunner_set_angle(shooter1, angle - M_PI_2);
-
-                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-                    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-                    graph_clear_screen();
-                    map_draw   (map1);
-                    bullet_draw_list(bullet_list);
-                    gunner_draw_list(shooter_list);
-
-                    text_draw(in_game_timer->text);
-
-                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
-                    sprite_draw(sp_crosshair);
-                    graph_draw();
-
-                    break;
-                    case KBC_IRQ:
-                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
-                        good = false;
-                    }
-                    break;
-                    case MOUSE_IRQ:
-                    if (mouse_get_counter_mouse_ih() >= 3) {
-                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
-                        update_mouse(&pp);
-                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed)
-                        shoot_bullet(shooter1, bullet_list, bsp_bullet);
-                        last_lb = keys->lb_pressed;
-                        mouse_set_counter_mouse_ih(0);
-
-                    }
-                    break;
-                    case COM1_IRQ: nctp_ih(); break;
-                }
-            }
-        }
-    }
-
-    while(list_size(shooter_list) > 0){
-        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
-        gunner_dtor(p);
-    }
-    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
-
-    while(list_size(bullet_list) > 0){
-        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
-        bullet_dtor(p);
-    }
-    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
-
-    text_timer_dtor(in_game_timer); in_game_timer = NULL;
-
-    return SUCCESS;
-}

Property changes on: proj/src/campaign.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/proj_func.c
===================================================================
--- proj/src/proj_func.c	(revision 354)
+++ proj/src/proj_func.c	(nonexistent)
@@ -1,372 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "proj_func.h"
-
-#include "interrupts_func.h"
-#include "libs.h"
-#include "proj_macros.h"
-#include "ent.h"
-
-#include <math.h>
-
-int cleanup(void) {
-    int r = SUCCESS;
-    if ((r = unsubscribe_all()))
-        printf("%s: failed to unsubscribe drivers.\n", __func__);
-    if ((r = graph_cleanup()))
-        printf("%s: graph cleanup failed\n", __func__);
-
-    return r;
-}
-
-static keys_t key_presses;
-void update_key_presses(void) {
-    if (keyboard_get_size() == 1) {
-        switch(keyboard_get_scancode()[0]) {
-        case W_MAKE_CODE        : key_presses.w_pressed     = 1;        break;
-        case W_BREAK_CODE       : key_presses.w_pressed     = 0;        break;
-        case A_MAKE_CODE        : key_presses.a_pressed     = 1;        break;
-        case A_BREAK_CODE       : key_presses.a_pressed     = 0;        break;
-        case S_MAKE_CODE        : key_presses.s_pressed     = 1;        break;
-        case S_BREAK_CODE       : key_presses.s_pressed     = 0;        break;
-        case D_MAKE_CODE        : key_presses.d_pressed     = 1;        break;
-        case D_BREAK_CODE       : key_presses.d_pressed     = 0;        break;
-        case CTRL_MAKE_CODE     : key_presses.ctrl_pressed  = 1;        break;
-        case CTRL_BREAK_CODE    : key_presses.ctrl_pressed  = 0;        break;
-        case PLUS_MAKE_CODE     : key_presses.plus_pressed  = 1;    update_scale();        break;
-        case PLUS_BREAK_CODE    : key_presses.plus_pressed  = 0;    update_scale();        break;
-        case MINUS_MAKE_CODE    : key_presses.minus_pressed = 1;    update_scale();        break;
-        case MINUS_BREAK_CODE   : key_presses.minus_pressed = 0;    update_scale();        break;
-        }
-    }
-}
-keys_t* (get_key_presses)(void) {
-    return &key_presses;
-}
-
-static int16_t mouse_x = 0, mouse_y = 0;
-void (update_mouse)(struct packet *p) {
-    mouse_x = max_16(0, mouse_x + p->delta_x);
-    mouse_x = min_16(mouse_x, (int16_t)graph_get_XRes() - 1);
-
-    mouse_y = max_16(0, mouse_y - p->delta_y);
-    mouse_y = min_16(mouse_y, (int16_t)graph_get_YRes() - 1);
-
-    key_presses.lb_pressed = p->lb;
-}
-int16_t* get_mouse_X(void) { return &mouse_x; }
-int16_t* get_mouse_Y(void) { return &mouse_y; }
-double get_mouse_angle(gunner_t *p) {
-    return atan2(gunner_get_y_screen(p) - mouse_y, mouse_x - gunner_get_x_screen(p));
-}
-
-void update_movement(map_t *map, gunner_t *p, keys_t *keys, list_t *shooter_list) {
-    /** Player movement */{
-        int ver_mov = keys->s_pressed - keys->w_pressed;
-        int hor_mov = keys->d_pressed - keys->a_pressed;
-        double x = gunner_get_x(p);
-        double y = gunner_get_y(p);
-
-        gunner_set_pos(p, x + SHOOTER_SPEED * hor_mov, y);
-        if (map_collides_gunner(map, p)) gunner_set_pos(p, x, y);
-        else {
-            list_node_t *it = list_begin(shooter_list);
-            while (it != list_end(shooter_list)) {
-                gunner_t *p2 = *(gunner_t**)list_node_val(it);
-                if (p != p2 && gunner_collides_gunner(p, p2)) {
-                    gunner_set_pos(p, x, y);
-                    break;
-                }
-                it = list_node_next(it);
-            }
-        }
-        x = gunner_get_x(p);
-        gunner_set_pos(p, x, y + SHOOTER_SPEED * ver_mov);
-        if (map_collides_gunner(map, p)) gunner_set_pos(p, x, y);
-        else {
-            list_node_t *it = list_begin(shooter_list);
-            while (it != list_end(shooter_list)) {
-                gunner_t *p2 = *(gunner_t**)list_node_val(it);
-                if (p != p2 && gunner_collides_gunner(p, p2)) {
-                    gunner_set_pos(p, x, y);
-                    break;
-                }
-                it = list_node_next(it);
-            }
-        }
-    }
-    /** Followers movement */ {
-        list_node_t *it = list_begin(shooter_list);
-        while(it != list_end(shooter_list)){
-            gunner_t *g = *(gunner_t**)list_node_val(it);
-            if(gunner_get_type(g) & GUNNER_FOLLOW){
-                double theta = 0.0;
-                map_where_to_follow(map, gunner_get_x(g), gunner_get_y(g), &theta);
-                double c = fm_cos(theta), s = fm_sin(theta);
-                double dx = ZOMBIE_SPEED*c, dy = -ZOMBIE_SPEED*s;
-                double x = gunner_get_x(g);
-                double y = gunner_get_y(g);
-                gunner_set_pos(g, x+dx, y+dy);
-                if (map_collides_gunner(map, g)){
-                    gunner_set_pos(g, x, y);
-                } else {
-                    list_node_t *it2 = list_begin(shooter_list);
-                    while (it2 != list_end(shooter_list)) {
-                        gunner_t *p2 = *(gunner_t**)list_node_val(it2);
-                        if (g != p2 && gunner_collides_gunner(g, p2)) {
-                            gunner_set_pos(g, x, y);
-                            break;
-                        }
-                        it2 = list_node_next(it2);
-                    }
-                }
-                gunner_set_angle(g, theta-M_PI_2);
-            }
-            it = list_node_next(it);
-        }
-    }
-}
-
-void (get_random_spawn)(const map_t *map, gunner_t *p, list_t *l) {
-    uint16_t w = map_get_width(map), h = map_get_height(map);
-    double x, y;
-
-    while(true){
-        x = rand() % w;
-        y = rand() % h;
-        gunner_set_pos(p, x, y);
-        if(map_collides_gunner(map, p)) continue;
-        int collides = false;
-        list_node_t *it = list_begin(l);
-        while(it != list_end(l)){
-            if(gunner_collides_gunner(p, *list_node_val(it))){
-                collides = true;
-                break;
-            }
-            it = list_node_next(it);
-        }
-        if(!collides) return;
-    }
-}
-
-void update_scale(void) {
-    static uint8_t last_plus = 0, last_minus = 0;
-    if (key_presses.ctrl_pressed) {
-        if (key_presses.plus_pressed && !last_plus) {
-            double scale = ent_get_scale();
-            scale *= 1.1;
-            if (scale <= MAX_SCALE) ent_set_scale(scale);
-        }
-        else if (key_presses.minus_pressed && !last_minus) {
-            double scale = ent_get_scale();
-            scale /= 1.1;
-            if (scale >= MIN_SCALE) ent_set_scale(scale);
-        }
-
-        //printf("SCALE: %d\n", (int)(ent_get_scale()*1000));
-    }
-
-    last_plus = key_presses.plus_pressed;
-    last_minus = key_presses.minus_pressed;
-}
-
-void (shoot_bullet)(const gunner_t *shooter, list_t *bullet_list, const basic_sprite_t *bsp_bullet) {
-    double angle = gunner_get_angle(shooter);
-    double vx = -BULLET_SPEED * fm_sin(angle);
-    double vy = -BULLET_SPEED * fm_cos(angle);
-    bullet_t *bullet = bullet_ctor(shooter, bsp_bullet, gunner_get_x(shooter), gunner_get_y(shooter), vx, vy);
-    list_insert(bullet_list, list_end(bullet_list), bullet);
-}
-
-void (update_game_state)(const map_t *map, list_t *shooter_list, list_t *bullet_list) {
-    /// BULLETS
-    bullet_update_movement_list(bullet_list);
-    list_node_t *bullet_it = list_begin(bullet_list);
-    while (bullet_it != list_end(bullet_list)) {
-        /// Collision with walls
-        bullet_t *bullet = *(bullet_t**)list_node_val(bullet_it);
-        if (map_collides_bullet(map, bullet)) {
-            list_node_t *aux = list_node_next(bullet_it);
-            /// Delete bullet
-            bullet_dtor(list_erase(bullet_list, bullet_it));
-            /// Advance iterator
-            bullet_it = aux;
-            continue;
-        }
-        /// Collision with shooters
-        list_node_t *shooter_it = list_begin(shooter_list);
-        int deleted_bullet = false;
-        while(shooter_it != list_end(shooter_list)){
-            gunner_t *shooter = *(gunner_t**)list_node_val(shooter_it);
-            if(gunner_collides_bullet(shooter, bullet) &&
-               gunner_get_team(shooter) != gunner_get_team(bullet_get_shooter(bullet))) {
-                list_node_t *aux = list_node_next(bullet_it);
-                /// Change health
-                gunner_set_curr_health(shooter, gunner_get_curr_health(shooter) - bullet_get_damage(bullet));
-                if (gunner_get_curr_health(shooter) <= 0) {
-                    gunner_dtor(list_erase(shooter_list, shooter_it));
-                }
-                /// Delete bullet
-                bullet_dtor(list_erase(bullet_list, bullet_it)); deleted_bullet = true;
-                /// Advance iterator
-                bullet_it = aux;
-                break;
-            } else shooter_it = list_node_next(shooter_it);
-        }
-        if(deleted_bullet) continue;
-        /// Advance iterator if necessary
-        bullet_it = list_node_next(bullet_it);
-    }
-    /// MELEE
-    list_node_t *it1 = list_begin(shooter_list);
-    while(it1 != list_end(shooter_list)){
-        gunner_t *s1 = *list_node_val(it1);
-        if(!(gunner_get_type(s1) & GUNNER_MELEE)){ it1 = list_node_next(it1); continue; }
-        list_node_t *it2 = list_begin(shooter_list);
-        while(it2 != list_end(shooter_list)){
-            gunner_t *s2 = *list_node_val(it2);
-            if(gunner_get_team(s1) != gunner_get_team(s2) &&
-               gunner_distance(s1, s2) < MELEE_RANGE)
-                gunner_set_curr_health(s2, gunner_get_curr_health(s2) - MELEE_DAMAGE);
-            if(gunner_get_curr_health(s2) <= 0){
-                list_node_t *aux = list_node_next(it2);
-                gunner_dtor(list_erase(shooter_list, it2));
-                it2 = aux;
-            }else it2 = list_node_next(it2);
-        }
-        it1 = list_node_next(it1);
-    }
-}
-
-text_timer_t* (text_timer_ctor)(const font_t *fnt){
-    if(fnt == NULL) return NULL;
-    text_timer_t *ret = malloc(sizeof(timer_t));
-    if (ret == NULL) return NULL;
-    ret->time = 0;
-    ret->text = text_ctor(fnt, "000s");
-    text_set_color(ret->text, TEXT_COLOR);
-    return ret;
-}
-void (text_timer_update)(text_timer_t *p){
-    if (p->time >= 999) return;
-    p->time++;
-    char buffer[100];
-    sprintf(buffer, "%03ds", p->time);
-    text_set_string(p->text, buffer);
-}
-void (text_timer_reset)(text_timer_t *p){
-    text_set_string(p->text, "000s");
-}
-void (text_timer_dtor)(text_timer_t *p){
-    if (p == NULL) return;
-    text_dtor(p->text);
-    free(p);
-}
-
-host_info_t* host_info_ctor(gunner_t *host, gunner_t *remote) {
-    host_info_t *ret = (host_info_t*)malloc(sizeof(host_info_t));
-    if (ret == NULL) return ret;
-
-    ret->host_x               = (int16_t)gunner_get_x          (host);
-    ret->host_y               = (int16_t)gunner_get_y          (host);
-    ret->host_angle           = (float)  gunner_get_angle      (host);
-    ret->host_health          = (int16_t)gunner_get_health     (host);
-    ret->host_current_health  = (int16_t)gunner_get_curr_health(host);
-
-    // remote
-    ret->remote_x               = (int16_t)gunner_get_x          (remote);
-    ret->remote_y               = (int16_t)gunner_get_y          (remote);
-    ret->remote_angle           = (float)  gunner_get_angle      (remote);
-    ret->remote_health          = (int16_t)gunner_get_health     (remote);
-    ret->remote_current_health  = (int16_t)gunner_get_curr_health(remote);
-
-    //ret->no_bullets = 0;
-
-    return ret;
-}
-void host_info_dtor(host_info_t *p) {
-    if (p==NULL) return;
-    /*
-    if ((p->bullets_x) != NULL){ free(p->bullets_x); p->bullets_x = NULL; }
-
-    if ((p->bullets_y) != NULL){ free(p->bullets_y); p->bullets_y = NULL; }
-
-    if ((p->bullets_vx) != NULL){ free(p->bullets_vx); p->bullets_vx = NULL; }
-
-    if ((p->bullets_vy) != NULL){ free(p->bullets_vy); p->bullets_vy = NULL; }
-
-    if ((p->bullets_shooter) != NULL){ free(p->bullets_shooter); p->bullets_shooter = NULL; }
-    */
-    free(p);
-}
-
-remote_info_t* remote_info_ctor(void) {
-    remote_info_t *ret = (remote_info_t*)malloc(sizeof(remote_info_t));
-    if (ret == NULL) return ret;
-
-    memset(&(ret->remote_keys_pressed), 0, sizeof(keys_t));
-
-    ret->remote_angle = 0;
-
-    return ret;
-}
-void remote_info_dtor(remote_info_t *p) {
-    if (p==NULL) return;
-    free(p);
-}
-
-bullet_info_t* bullet_info_ctor(void) {
-    bullet_info_t *ret = (bullet_info_t*)malloc(sizeof(bullet_info_t));
-    if (ret == NULL) return ret;
-
-    ret->new_bullet = false;
-
-    return ret;
-}
-void bullet_info_dtor(bullet_info_t *p) {
-    if (p == NULL) return;
-    free(p);
-}
-
-void build_host_structure(host_info_t *p, gunner_t *host, gunner_t *remote) {
-    // host
-    p->host_x               = (int16_t)gunner_get_x          (host);
-    p->host_y               = (int16_t)gunner_get_y          (host);
-    p->host_angle           = (float)  gunner_get_angle      (host);
-    p->host_health          = (int16_t)gunner_get_health     (host);
-    p->host_current_health  = (int16_t)gunner_get_curr_health(host);
-
-    // remote
-    p->remote_x               = (int16_t)gunner_get_x          (remote);
-    p->remote_y               = (int16_t)gunner_get_y          (remote);
-    p->remote_angle           = (float)  gunner_get_angle      (remote);
-    p->remote_health          = (int16_t)gunner_get_health     (remote);
-    p->remote_current_health  = (int16_t)gunner_get_curr_health(remote);
-    /*
-    // bullets
-    size_t sz = list_size(bullet_list);
-    p->no_bullets = sz;
-    p->bullets_x        = (int16_t*)realloc(p->bullets_x         , sz * sizeof(int16_t));
-    p->bullets_y        = (int16_t*)realloc(p->bullets_y         , sz * sizeof(int16_t));
-    p->bullets_vx       = (int16_t*)realloc(p->bullets_vx        , sz * sizeof(int16_t));
-    p->bullets_vy       = (int16_t*)realloc(p->bullets_vy        , sz * sizeof(int16_t));
-    p->bullets_shooter  = (bool*)   realloc(p->bullets_shooter   , sz * sizeof(bool ));
-
-    list_node_t *it = list_begin(bullet_list);
-    size_t i = 0;
-    while (it != list_end(bullet_list)) {
-        bullet_t *bullet = *list_node_val(it);
-        p->bullets_x        [i] = (int16_t)bullet_get_x                      (bullet);
-        p->bullets_y        [i] = (int16_t)bullet_get_y                      (bullet);
-        p->bullets_vx       [i] = (int16_t)bullet_get_vx                     (bullet);
-        p->bullets_vy       [i] = (int16_t)bullet_get_vy                     (bullet);
-        p->bullets_shooter  [i] = gunner_get_team(bullet_get_shooter(bullet)) != gunner_get_team(host);
-        it = list_node_next(it);
-        i++;
-    }
-    */
-}
-void build_remote_structure(remote_info_t *p, keys_t *keys, double angle) {
-    memcpy(&(p->remote_keys_pressed), keys, sizeof(keys_t));
-    p->remote_angle = angle;
-}

Property changes on: proj/src/proj_func.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/makecode_map.c
===================================================================
--- proj/src/makecode_map.c	(revision 354)
+++ proj/src/makecode_map.c	(nonexistent)
@@ -1,15 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "makecode_map.h"
-
-static const char makecode_map[] = {ERROR_CODE, ERROR_CODE, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', ERROR_CODE /*«*/, ERROR_CODE /*escape*/,
-                                    ERROR_CODE /*tab*/, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '+', ERROR_CODE /* ´ */, ERROR_CODE /*enter*/,
-                                    ERROR_CODE /*ctrl*/, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ERROR_CODE /* Ç */, ERROR_CODE /* º */, '\\', ERROR_CODE /*lshift*/, '~',
-                                    'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', '-', ERROR_CODE /*rshift*/, ERROR_CODE /*unkown*/, ERROR_CODE /*alt*/, ' ' /*space*/};
-
-static const int size = sizeof(makecode_map);
-
-char (map_makecode)(uint8_t code) {
-    if (code < 0 || code >= size) return ERROR_CODE;
-    return makecode_map[code];
-}

Property changes on: proj/src/makecode_map.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/ent.c
===================================================================
--- proj/src/ent.c	(revision 354)
+++ proj/src/ent.c	(nonexistent)
@@ -1,377 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "ent.h"
-
-#include "libs.h"
-#include <math.h>
-
-#define GREEN_HEALTH_COLOR      0x009900
-
-static double scale = 1.0;
-static double x_origin = 0;
-static double y_origin = 0;
-
-void (ent_set_scale) (double n){ scale = n; }
-void (ent_set_origin)(double x, double y){ x_origin = x; y_origin = y; }
-double (ent_get_scale)  (void){ return scale; }
-double (ent_get_XLength)(void){ return graph_get_XRes()/scale; }
-double (ent_get_YLength)(void){ return graph_get_YRes()/scale; }
-
-struct gunner{
-    double x, y; //real position
-    double spawn_x, spawn_y;
-    sprite_t *dude;
-    sprite_t *weapon;
-    double health, current_health;
-    rectangle_t *green_bar, *red_bar;
-    text_t *txt;
-    uint16_t type;
-    int team;
-};
-gunner_t* (gunner_ctor)(basic_sprite_t *dude, basic_sprite_t *weapon, uint16_t type, int team){
-    gunner_t *ret = malloc(sizeof(gunner_t));
-    if(ret == NULL) return NULL;
-    ret->spawn_x = 0.0;
-    ret->spawn_y = 0.0;
-    ret->x = 0.0;
-    ret->y = 0.0;
-    ret->health = 100;
-    ret->current_health = ret->health;
-    ret->green_bar = rectangle_ctor(0,0,0,0);
-    ret->red_bar   = rectangle_ctor(0,0,0,0);
-    ret->txt = text_ctor(font_get_default(), "");
-    ret->type = type;
-    ret->team = team;
-    ret->dude   = sprite_ctor(dude  );
-    ret->weapon = sprite_ctor(weapon);
-    if(ret->txt == NULL || ret->dude == NULL || ret->weapon == NULL || ret->green_bar == NULL || ret->red_bar == NULL){
-        gunner_dtor(ret);
-        return NULL;
-    }
-    rectangle_set_fill_color(ret->green_bar, GREEN_HEALTH_COLOR);
-    rectangle_set_fill_color(ret->red_bar  , GRAPH_RED         );
-    text_set_size(ret->txt, 15);
-    text_set_valign(ret->txt, text_valign_center);
-    text_set_halign(ret->txt, text_halign_center);
-    text_set_color(ret->txt, GRAPH_WHITE);
-    return ret;
-}
-void (gunner_dtor)(gunner_t *p){
-    if(p == NULL) return;
-    sprite_dtor(p->dude);
-    sprite_dtor(p->weapon);
-    rectangle_dtor(p->green_bar);
-    rectangle_dtor(p->red_bar);
-    text_dtor(p->txt);
-    free(p);
-}
-void (gunner_set_pos)  (gunner_t *p, double x, double y){ p->x = x; p->y = y; }
-void (gunner_set_spawn)  (gunner_t *p, double x, double y){ p->spawn_x = x; p->spawn_y = y; }
-void (gunner_set_angle)(gunner_t *p, double angle      ){
-    sprite_set_angle(p->dude  , angle);
-    sprite_set_angle(p->weapon, angle);
-}
-void (gunner_set_health)        (gunner_t *p, double health) {
-    if (health < 0) health = 0;
-    p->health = health;
-}
-void (gunner_set_curr_health)   (gunner_t *p, double health) {
-    if (health < 0) health = 0;
-    p->current_health = health;
-}
-double  (gunner_get_x)              (const gunner_t *p){ return p->x; }
-double  (gunner_get_y)              (const gunner_t *p){ return p->y; }
-double  (gunner_get_spawn_x)        (const gunner_t *p){ return p->spawn_x; }
-double  (gunner_get_spawn_y)        (const gunner_t *p){ return p->spawn_y; }
-double  (gunner_get_angle)          (const gunner_t *p){ return sprite_get_angle(p->dude); }
-double  (gunner_get_health)         (const gunner_t *p){ return p->health; }
-double  (gunner_get_curr_health)    (const gunner_t *p){ return p->current_health; }
-int16_t (gunner_get_x_screen)       (const gunner_t *p){ return (int16_t)((p->x-x_origin)*scale); }
-int16_t (gunner_get_y_screen)       (const gunner_t *p){ return (int16_t)((p->y-y_origin)*scale); }
-uint16_t (gunner_get_type)          (const gunner_t *p){ return p->type; }
-int     (gunner_get_team)           (const gunner_t *p){ return p->team; }
-void (gunner_draw)(gunner_t *p){
-    const int16_t x_screen = gunner_get_x_screen(p);
-    const int16_t y_screen = gunner_get_y_screen(p);
-    sprite_set_pos  (p->dude  , x_screen, y_screen);
-    sprite_set_pos  (p->weapon, x_screen, y_screen);
-    sprite_set_scale(p->dude  , scale);
-    sprite_set_scale(p->weapon, scale);
-    sprite_draw     (p->weapon);
-    sprite_draw     (p->dude  );
-    gunner_draw_health(p);
-}
-void (gunner_draw_health)(const gunner_t *p) {
-    const uint16_t w = sprite_get_w(p->dude);
-    const uint16_t h = sprite_get_h(p->dude);
-    int16_t x = gunner_get_x_screen(p) - w/2;
-    int16_t y = gunner_get_y_screen(p) - h/2 - 10;
-    double curr_health = gunner_get_curr_health(p);
-    double health = gunner_get_health(p);
-    double perc = curr_health/health;
-    rectangle_set_pos(p->green_bar, x, y); rectangle_set_size(p->green_bar, (uint16_t)(w*perc), 10);
-    rectangle_set_pos(p->red_bar, x+(int16_t)(w*perc), y); rectangle_set_size(p->red_bar, (uint16_t)(w*(1.0-perc)), 10);
-    char buf[20]; sprintf(buf, "%d/%d", (int)p->current_health, (int)p->health);
-    text_set_string(p->txt, buf);
-    text_set_pos(p->txt, x+w/2, y+10/2);
-    rectangle_draw(p->green_bar);
-    rectangle_draw(p->red_bar);
-    text_draw(p->txt);
-}
-void (gunner_draw_list)(list_t *shooter_list) {
-    if (list_size(shooter_list) == 0) return;
-
-    list_node_t *it = list_begin(shooter_list);
-    while (it != list_end(shooter_list)) {
-        gunner_draw(*(gunner_t**)list_node_val(it));
-        it = list_node_next(it);
-    }
-}
-double (gunner_distance)(const gunner_t *p1, const gunner_t *p2){
-    double dx = gunner_get_x(p1) - gunner_get_x(p2);
-    double dy = gunner_get_y(p1) - gunner_get_y(p2);
-    return sqrt(dx*dx+dy*dy);
-}
-int (gunner_collides_gunner)(const gunner_t *p1, const gunner_t *p2) {
-    if (p1 == p2) return false;
-    double p1_radius = max_d(sprite_get_w(p1->dude), sprite_get_h(p1->dude))/2.0;
-    double p2_radius = max_d(sprite_get_w(p2->dude), sprite_get_h(p2->dude))/2.0;
-    double distance = gunner_distance(p1, p2);
-    return distance <= p1_radius+p2_radius;
-}
-
-struct bullet{
-    const gunner_t *shooter;
-    double x, y; //real position
-    double vx, vy;
-    sprite_t *b;
-    double damage;
-};
-bullet_t* (bullet_ctor)(const gunner_t *shooter, const basic_sprite_t *b, double x, double y, double vx, double vy){
-    bullet_t *ret = malloc(sizeof(bullet_t));
-    if(ret == NULL) return NULL;
-    ret->shooter = shooter;
-    ret-> x =  x;
-    ret-> y =  y;
-    ret->vx = vx;
-    ret->vy = vy;
-    ret->damage = 10;
-    ret->b = sprite_ctor(b);
-    if(ret->b == NULL){
-        bullet_dtor(ret);
-        return NULL;
-    }
-    double angle = atan2(-ret->vy, ret->vx);
-    sprite_set_angle(ret->b, angle-M_PI_2);
-    return ret;
-}
-void (bullet_dtor)(bullet_t *p){
-    if(p == NULL) return;
-    sprite_dtor(p->b);
-    free(p);
-}
-double  (bullet_get_x)       (const bullet_t *p){ return p->x; }
-double  (bullet_get_y)       (const bullet_t *p){ return p->y; }
-double  (bullet_get_vx)      (const bullet_t *p){ return p->vx; }
-double  (bullet_get_vy)      (const bullet_t *p){ return p->vy; }
-int16_t (bullet_get_x_screen)(const bullet_t *p){ return (int16_t)((p->x-x_origin)*scale); }
-int16_t (bullet_get_y_screen)(const bullet_t *p){ return (int16_t)((p->y-y_origin)*scale); }
-double  (bullet_get_damage)  (const bullet_t *p){ return p->damage; }
-void    (bullet_set_damage)  (bullet_t *p, double damage) {
-    if (damage < 0) damage = 0;
-    p->damage = damage;
-}
-const gunner_t* (bullet_get_shooter)(const bullet_t *p){ return p->shooter; }
-void (bullet_update_movement)(bullet_t *p){
-    p->x += p->vx;
-    p->y += p->vy;
-}
-void (bullet_update_movement_list)(list_t *bullet_list){
-    if (list_size(bullet_list) == 0) return;
-
-    list_node_t *it = list_begin(bullet_list);
-    while (it != list_end(bullet_list)) {
-        bullet_update_movement(*(bullet_t**)list_node_val(it));
-        it = list_node_next(it);
-    }
-}
-void (bullet_draw)(bullet_t *p){
-    const int16_t x_screen = bullet_get_x_screen(p);
-    const int16_t y_screen = bullet_get_y_screen(p);
-    sprite_set_pos  (p->b, x_screen, y_screen);
-    sprite_set_scale(p->b, scale);
-    sprite_draw     (p->b);
-}
-void (bullet_draw_list)(list_t *bullet_list) {
-    if (list_size(bullet_list) == 0) return;
-
-    list_node_t *it = list_begin(bullet_list);
-    while (it != list_end(bullet_list)) {
-        bullet_draw(*(bullet_t**)list_node_val(it));
-        it = list_node_next(it);
-    }
-}
-
-struct map{
-    basic_sprite_t *bsp_background;
-    sprite_t *background;
-    uint8_t *collide;
-    uint8_t *collide_gunner;
-    int32_t *prev;
-    uint8_t *visited;
-};
-static int (map_collides_gunner_pos)(const map_t *p, double shooter_x, double shooter_y, double radius) {
-    for (double x = -radius; x <= radius; x += 1) {
-        double y1 = sqrt(radius*radius - x*x);
-        double y2 = -y1;
-        if (map_collides_point(p, shooter_x + x, shooter_y + y1) || map_collides_point(p, shooter_x + x, shooter_y + y2)) return 1;
-    }
-    return 0;
-}
-static int16_t (map_get_x_screen)(const map_t *p){ (void)p; return (int16_t)((-x_origin)*scale); }
-static int16_t (map_get_y_screen)(const map_t *p){ (void)p; return (int16_t)((-y_origin)*scale); }
-map_t* (map_ctor)(const char *const *background, const char *const *collide){
-    map_t *ret = malloc(sizeof(map_t));
-    if(ret == NULL) return NULL;
-
-    ret->bsp_background = NULL;
-    ret->background     = NULL;
-    ret->collide        = NULL;
-    ret->prev           = NULL;
-    ret->visited        = NULL;
-
-    ret->bsp_background = basic_sprite_ctor(background, 0, 0);
-    ret->background     = sprite_ctor(ret->bsp_background);
-    if(ret->bsp_background == NULL ||
-       ret->background     == NULL){ map_dtor(ret); return NULL; }
-
-    basic_sprite_t *bsp_collide = basic_sprite_ctor(collide, 0, 0);
-    if(bsp_collide == NULL){ map_dtor(ret); return NULL; }
-    const uint16_t W = basic_sprite_get_w(bsp_collide);
-    const uint16_t H = basic_sprite_get_h(bsp_collide);
-    ret->collide = malloc(W*H*sizeof(uint8_t));
-    if(ret->collide == NULL){ map_dtor(ret); return NULL; }
-    const uint8_t *m = basic_sprite_get_map(bsp_collide);
-    for(unsigned i = 0; i < W*H; ++i){
-        ret->collide[i] = (m[4*i+3] < ALPHA_THRESHOLD ? 1 : 0);
-    }
-    basic_sprite_dtor(bsp_collide);
-
-    ret->collide_gunner = malloc(W*H*sizeof(uint8_t));
-    if(ret->collide_gunner == NULL){ map_dtor(ret); return NULL; }
-    for(size_t i = 0; i < W*H; ++i){
-        uint16_t x = i%W, y = (uint16_t)(i/W);
-        ret->collide_gunner[i] = (map_collides_gunner_pos(ret, x, y, 36) ? 1 : 0);
-    }
-
-    ret->prev = malloc(W*H*sizeof(int32_t));
-    ret->visited = malloc(W*H*sizeof(uint8_t));
-
-    if(ret->prev == NULL || ret->visited == NULL){
-        map_dtor(ret);
-        return NULL;
-    }
-    return ret;
-}
-void (map_dtor)(map_t *p){
-    if(p == NULL) return;
-    sprite_dtor(p->background);
-    basic_sprite_dtor(p->bsp_background);
-    free(p->collide);
-    free(p->prev);
-    free(p->visited);
-    free(p);
-}
-uint16_t (map_get_width)   (const map_t *p){ return sprite_get_w(p->background); }
-uint16_t (map_get_height)  (const map_t *p){ return sprite_get_h(p->background); }
-int (map_make_dijkstra)(map_t *p, double x_, double y_){
-    int16_t x = (int16_t)x_, y = (int16_t)y_;
-
-    const uint16_t W = basic_sprite_get_w(p->bsp_background),
-                   H = basic_sprite_get_h(p->bsp_background);
-
-    static uint8_t first_time = true;
-    if(first_time){
-        for(size_t i = 0; i < W*H; ++i) p->prev[i] = -1;
-        first_time = false;
-    }
-    /// ACTUAL DIJKSTRA
-    queue_t *q = queue_ctor();
-
-    memset(p->visited, false, W*H*sizeof(uint8_t));
-
-    int *ptr;
-    int32_t c, pos;
-    c = y*W+x; p->prev[c] = c; ptr = malloc(sizeof(int)); *ptr = c; queue_push(q, ptr);
-
-    while(!queue_empty(q)){
-        c = *(int*)queue_top(q); free(queue_top(q)); queue_pop(q);
-        x = (int16_t)(c%W), y = (int16_t)(c/W);
-        if(p->visited[c]) continue;
-        p->visited[c] = true;
-        if(p->collide_gunner[c]) continue;
-        if(0   <= x-1){ pos = y*W+(x-1); if(!p->visited[pos] && p->prev[pos] != c){ p->prev[pos] = c; ptr = malloc(sizeof(int)); *ptr = pos; queue_push(q, ptr); }}
-        if(x+1 <  W  ){ pos = y*W+(x+1); if(!p->visited[pos] && p->prev[pos] != c){ p->prev[pos] = c; ptr = malloc(sizeof(int)); *ptr = pos; queue_push(q, ptr); }}
-        if(0   <= y-1){ pos = (y-1)*W+x; if(!p->visited[pos] && p->prev[pos] != c){ p->prev[pos] = c; ptr = malloc(sizeof(int)); *ptr = pos; queue_push(q, ptr); }}
-        if(y+1 <  H  ){ pos = (y+1)*W+x; if(!p->visited[pos] && p->prev[pos] != c){ p->prev[pos] = c; ptr = malloc(sizeof(int)); *ptr = pos; queue_push(q, ptr); }}
-    }
-
-    queue_dtor(q);
-
-    return SUCCESS;
-}
-int (map_where_to_follow)(const map_t *p, double x, double y, double *theta){
-    const uint16_t W = basic_sprite_get_w(p->bsp_background);
-    int16_t x_ = (int16_t)x, y_ = (int16_t)y;
-    int32_t pos = y_*W+x_;
-    int16_t newx = (int16_t)(p->prev[pos]%W), newy = (int16_t)(p->prev[pos]/W);
-    *theta = atan2(-(newy-y_), newx-x_);
-    return SUCCESS;
-}
-void   (map_draw)(map_t *p){
-    const int16_t x_screen = map_get_x_screen(p);
-    const int16_t y_screen = map_get_y_screen(p);
-    sprite_set_pos  (p->background, x_screen, y_screen);
-    sprite_set_scale(p->background, scale);
-    sprite_draw     (p->background);
-}
-int (map_collides_point)(const map_t *p, double x, double y){
-    const uint16_t w = sprite_get_w(p->background), h = sprite_get_h(p->background);
-    int16_t x_ = (int16_t)x, y_ = (int16_t)y;
-    if(x_ < 0 || w <= x_ || y_ < 0 || h <= y_) return 0;
-    int32_t pos = x_ + y_*w;
-    if(0 <= pos && pos < w*h) return p->collide[pos];
-    else return false;
-}
-
-int (map_collides_gunner)(const map_t *p, const gunner_t *shooter) {
-    double radius = max_d(sprite_get_w(shooter->dude), sprite_get_h(shooter->dude))/2.0;
-    return map_collides_gunner_pos(p, gunner_get_x(shooter), gunner_get_y(shooter), radius);
-}
-int (map_collides_bullet)(const map_t *p, const bullet_t *bull){
-    double radius = max_d(sprite_get_w(bull->b), sprite_get_h(bull->b))/2.0;
-    double bullet_x = bullet_get_x(bull);
-    double bullet_y = bullet_get_y(bull);
-    for (double x = -radius; x < radius; x += 1){
-        double y1 = sqrt(radius*radius - x*x);
-        double y2 = -y1;
-        if (map_collides_point(p, bullet_x + x, bullet_y + y1) || map_collides_point(p, bullet_x + x, bullet_y + y2)) return 1;
-    }
-    return 0;
-}
-int (gunner_collides_bullet)(const gunner_t *shooter, const bullet_t *bull){
-    if(bull->shooter == shooter) return false;
-
-    double shooter_radius = max_d(sprite_get_w(shooter->dude), sprite_get_h(shooter->dude))/2.0;
-    double shooter_x = gunner_get_x(shooter);
-    double shooter_y = gunner_get_y(shooter);
-
-    double bullet_radius = max_d(sprite_get_w(bull->b), sprite_get_h(bull->b))/2.0;
-    double bullet_x = bullet_get_x(bull);
-    double bullet_y = bullet_get_y(bull);
-
-    double dx = shooter_x - bullet_x;
-    double dy = shooter_y - bullet_y;
-    double distance = sqrt(dx*dx + dy*dy);
-    return distance <= shooter_radius+bullet_radius;
-}

Property changes on: proj/src/ent.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/scoreboards.c
===================================================================
--- proj/src/scoreboards.c	(revision 354)
+++ proj/src/scoreboards.c	(nonexistent)
@@ -1,103 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "scoreboards.h"
-
-#include "graph.h"
-#include "rectangle.h"
-#include "proj_func.h"
-#include "proj_macros.h"
-#include "rtc.h"
-#include "errors.h"
-
-#include <stdio.h>
-
-#define MAX_HIGHSCORES   3 /** @brief Number of scores saved */
-
-struct  score_info {
-    int day;
-    int month;
-    int year;
-    int hour;
-    int min;
-    int sec;
-    int score;
-    int time_played;
-};
-
-struct highscores {
-    score_info_t *highscores[MAX_HIGHSCORES];
-
-    const font_t *fnt;
-    rectangle_t *r[(MAX_HIGHSCORES+1)*3 + 1];
-    text_t      *t[(MAX_HIGHSCORES+1)*3 + 1];
-    rectangle_t *frame;
-};
-
-score_info_t* (score_ctor)(int score, int time_played){
-    score_info_t *ret = (score_info_t*)malloc(sizeof(score_info_t));
-    if (ret == NULL) return NULL;
-    uint8_t score_date[4];
-    if (rtc_read_date(score_date)) return NULL;
-    ret->sec = score_date[0];
-    ret->min = score_date[1];
-    ret->hour = score_date[2];
-
-    if (rtc_read_time(score_date)) return NULL;
-
-    ret->day = score_date[1];
-    ret->month = score_date[2];
-    ret->year = score_date[3];
-
-    ret->score = score;
-    ret->time_played = time_played;
-
-    return ret;
-}
-
-void (score_dtor)(score_info_t *p){
-    if (p != NULL) free(p);
-}
-
-highscores_t* (highscores_ctor)(const font_t *fnt, const char *path) {
-    if(fnt == NULL || path == NULL) return NULL;
-
-    FILE *f = fopen(path, "r");
-    if (f == NULL) return NULL;
-    highscores_t *ret = (highscores_t*)malloc(sizeof(highscores_t));
-    if (ret == NULL) return NULL;
-    char line[30];
-    for (int i = 0; i < MAX_HIGHSCORES; i++) {
-        fgets(line, 30, f);
-        score_info_t *score = (score_info_t*)malloc(sizeof(score_info_t));
-
-        sscanf(line, "%d/%d/%d %d:%d:%d - %d - %d\n",
-                    &(score->day), &(score->month), &(score->year),
-                    &(score->hour), &(score->month), &(score->sec),
-                    &(score->score), &(score->time_played));
-        ret->highscores[i] = score;
-    }
-    fclose(f);
-
-    return ret;
-}
-
-void (highscores_save)(const highscores_t *p, const char *path) {
-    if(p == NULL || path == NULL) return;
-
-    FILE *f = fopen(path, "w");
-    if (f == NULL) return;
-    for (int i = 0; i < MAX_HIGHSCORES; i++) {
-        score_info_t *score = p->highscores[i];
-        fprintf(f, "%d/%d/%d %d:%d:%d - %d - %d\n",
-                    (score->day), (score->month), (score->year),
-                    (score->hour), (score->month), (score->sec),
-                    (score->score), (score->time_played));
-    }
-    fclose(f);
-}
-
-void (highscores_dtor)(highscores_t *p) {
-    for (int i = 0; i < MAX_HIGHSCORES; i++) {
-        score_dtor(p->highscores[i]);
-    }
-}

Property changes on: proj/src/scoreboards.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/zombies.c
===================================================================
--- proj/src/zombies.c	(revision 354)
+++ proj/src/zombies.c	(nonexistent)
@@ -1,144 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "zombies.h"
-
-#include "proj.h"
-
-#include "libs.h"
-
-#include "proj_macros.h"
-#include "proj_func.h"
-#include "ent.h"
-#include "interrupts_func.h"
-#include <math.h>
-
-#define ZOMBIES_NUM             5
-#define ZOMBIE_HEALTH_FACTOR    1.1
-int (zombies)(void){
-
-    int r;
-
-    ent_set_scale(DEFAULT_SCALE);
-    text_timer_t *in_game_timer = text_timer_ctor(font_get_default());
-
-    list_t *shooter_list = list_ctor();
-
-    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
-    gunner_set_spawn(shooter1, 980, 790);
-    gunner_set_pos(shooter1, 980, 790);
-
-    list_insert(shooter_list, list_end(shooter_list), shooter1);
-
-    list_t *bullet_list  = list_ctor();
-
-    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
-    uint8_t last_lb = 0;
-    struct packet pp;
-    keys_t *keys = get_key_presses();
-
-    /// loop stuff
-    uint64_t int_vector = 0;
-    int good = true;
-    int dead = false;
-
-    int health = 50;
-
-    map_make_dijkstra(map1, gunner_get_x(shooter1), gunner_get_y(shooter1));
-
-    while (good && !dead) {
-        /* Get a request message. */
-        if((r = get_interrupts_vector(&int_vector))) return r;
-        uint32_t n = 1;
-        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
-            if(!good || dead) break;
-            if (int_vector & n) {
-                interrupt_handler(i);
-                switch (i) {
-                    case TIMER0_IRQ:
-                    if (timer_get_no_interrupts() % 60 == 0) text_timer_update(in_game_timer);
-                    if (timer_get_no_interrupts() %  6 == 0){
-                        map_make_dijkstra(map1, gunner_get_x(shooter1), gunner_get_y(shooter1));
-                    }
-
-                    update_movement(map1, shooter1, keys, shooter_list);
-
-                    update_game_state(map1, shooter_list, bullet_list);
-
-                    if(list_find(shooter_list, shooter1) == list_end(shooter_list)){
-                        good = false;
-                        dead = true;
-                        break;
-                    }
-
-                    double angle = get_mouse_angle(shooter1);
-                    gunner_set_angle(shooter1, angle - M_PI_2);
-
-                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-                    while(list_size(shooter_list) < ZOMBIES_NUM+1){
-                        gunner_t *zombie = gunner_ctor(bsp_zombie, bsp_nothing, GUNNER_MELEE | GUNNER_FOLLOW, 3);
-                        gunner_set_health(zombie, health);
-                        gunner_set_curr_health(zombie, health);
-                        health *= ZOMBIE_HEALTH_FACTOR;
-                        get_random_spawn(map1, zombie, shooter_list);
-                        list_push_back(shooter_list, zombie);
-                    }
-
-                    graph_clear_screen();
-                    map_draw   (map1);
-                    bullet_draw_list(bullet_list);
-                    gunner_draw_list(shooter_list);
-
-                    text_draw(in_game_timer->text);
-
-                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
-                    sprite_draw(sp_crosshair);
-                    graph_draw();
-
-                    break;
-                    case KBC_IRQ:
-                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
-                        good = false;
-                    }
-                    break;
-                    case MOUSE_IRQ:
-                    if (mouse_get_counter_mouse_ih() >= 3) {
-                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
-                        update_mouse(&pp);
-                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed)
-                        shoot_bullet(shooter1, bullet_list, bsp_bullet);
-                        last_lb = keys->lb_pressed;
-                        mouse_set_counter_mouse_ih(0);
-
-                    }
-                    break;
-                    case COM1_IRQ: nctp_ih(); break;
-                }
-            }
-        }
-    }
-
-    while(list_size(shooter_list) > 0){
-        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
-        gunner_dtor(p);
-    }
-    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
-
-    while(list_size(bullet_list) > 0){
-        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
-        bullet_dtor(p);
-    }
-    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
-
-    if(dead){
-        printf("YOU DIED\n");
-    }
-
-    text_timer_dtor(in_game_timer); in_game_timer = NULL;
-
-    return SUCCESS;
-}

Property changes on: proj/src/zombies.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/proj.c
===================================================================
--- proj/src/proj.c	(revision 354)
+++ proj/src/proj.c	(nonexistent)
@@ -1,535 +0,0 @@
-#include <lcom/lcf.h>
-#include <lcom/proj.h>
-#include <lcom/liblm.h>
-
-#include "proj.h"
-
-#include <math.h>
-
-#include "proj_macros.h"
-#include "proj_func.h"
-
-#include "interrupts_func.h"
-#include "makecode_map.h"
-
-#include "crosshair.h"
-#include "shooter.h"
-#include "zombie.h"
-#include "pistol.h"
-#include "nothing.h"
-#include "bullet.h"
-#include "map1.h"
-
-#include "hltp.h"
-
-
-int main(int argc, char* argv[]) {
-
-    lcf_set_language("EN-US");
-
-    lcf_trace_calls("/home/lcom/labs/proj/trace.txt");
-
-    lcf_log_output("/home/lcom/labs/proj/output.txt");
-
-    if (lcf_start(argc, argv)) return 1;
-
-    lcf_cleanup();
-
-    return 0;
-}
-
-#include "singleplayer.h"
-static int (multiplayer)(void);
-#include "chat.h"
-int(proj_main_loop)(int argc, char *argv[]) {
-    (void)argc; (void)argv;
-
-    int r;
-
-    if(font_init()){ printf("Failed to initialize fonts\n"); return 1; }
-
-    /// subscribe interrupts
-    if (subscribe_all()) { return 1; }
-
-    /// initialize graphics
-    if(graph_init(GRAPH_MODE)){
-        printf("%s: failed to initalize graphics.\n", __func__);
-        if (cleanup()) printf("%s: failed to cleanup.\n", __func__);
-        return 1;
-    }
-
-    /// Load stuff
-    {
-        graph_clear_screen();
-        text_t *txt = text_ctor(font_get_default(), "Loading...");
-        text_set_pos(txt, graph_get_XRes()/2, graph_get_YRes()/2);
-        text_set_valign(txt, text_valign_center);
-        text_set_halign(txt, text_halign_center);
-        text_set_color(txt, TEXT_COLOR);
-        text_draw(txt);
-        text_dtor(txt);
-        graph_draw();
-
-        bsp_crosshair = get_crosshair(); if(bsp_crosshair == NULL) printf("Failed to get crosshair\n");
-        bsp_shooter   = get_shooter  (); if(bsp_shooter   == NULL) printf("Failed to get shooter\n");
-        bsp_zombie    = get_zombie   (); if(bsp_zombie    == NULL) printf("Failed to get zombie\n");
-        bsp_pistol    = get_pistol   (); if(bsp_pistol    == NULL) printf("Failed to get pistol\n");
-        bsp_nothing   = get_nothing  (); if(bsp_nothing   == NULL) printf("Failed to get nothing\n");
-        bsp_bullet    = get_bullet   (); if(bsp_bullet    == NULL) printf("Failed to get bullet\n");
-        map1          = get_map1     (); if(map1          == NULL) printf("Failed to get map1\n");
-
-        sp_crosshair = sprite_ctor(bsp_crosshair); if(sp_crosshair == NULL) printf("Failed to get crosshair sprite\n");
-    }
-
-    menu_t *main_menu = menu_ctor(font_get_default());
-    menu_add_item(main_menu, "Single player");
-    menu_add_item(main_menu, "Multiplayer");
-    menu_add_item(main_menu, "Chat");
-    menu_add_item(main_menu, "Exit");
-
-    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
-    uint8_t last_lb = 0;
-    struct packet pp;
-    keys_t *keys = get_key_presses();
-
-    /// loop stuff
-    int click = 0;
-    uint64_t int_vector = 0;
-    int good = true;
-    while (good) {
-        /* Get a request message. */
-        if((r = get_interrupts_vector(&int_vector))) return r;
-        uint32_t n = 1;
-        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
-            if (int_vector & n) {
-                interrupt_handler(i);
-                switch (i) {
-                    case TIMER0_IRQ:
-
-                    graph_clear_screen();
-                    switch(menu_update_state(main_menu, click)){
-                        case -1: break;
-                        case  0: singleplayer(); break; //campaign(); break;
-                        case  1: multiplayer() ; break;
-                        case  2: chat(); break;
-                        case  3: good = false; break;
-                    }
-                    menu_draw(main_menu);
-
-                    click = 0;
-
-                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
-                    sprite_draw(sp_crosshair);
-                    graph_draw();
-
-                    break;
-                    case KBC_IRQ:
-                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
-                    case MOUSE_IRQ:
-                    if (mouse_get_counter_mouse_ih() >= 3) {
-                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
-                        update_mouse(&pp);
-                        if (!click) click = last_lb ^ keys->lb_pressed && keys->lb_pressed;
-                        last_lb = keys->lb_pressed;
-                        mouse_set_counter_mouse_ih(0);
-                    }
-                    break;
-                    case COM1_IRQ: nctp_ih(); break;
-                }
-            }
-        }
-    }
-
-    basic_sprite_dtor      (bsp_crosshair); bsp_crosshair = NULL;
-    basic_sprite_dtor      (bsp_shooter  ); bsp_shooter   = NULL;
-    basic_sprite_dtor      (bsp_zombie   ); bsp_zombie    = NULL;
-    sprite_dtor            (sp_crosshair ); sp_crosshair  = NULL;
-    basic_sprite_dtor      (bsp_pistol   ); bsp_pistol    = NULL;
-    basic_sprite_dtor      (bsp_nothing  ); bsp_nothing   = NULL;
-    map_dtor               (map1         ); map1          = NULL;
-    font_free();
-
-    // Unsubscribe interrupts
-    if (unsubscribe_all()) {
-        if (cleanup())
-        printf("%s: failed to cleanup.\n", __func__);
-        return 1;
-    }
-
-    if (cleanup()) {
-        printf("%s: failed to cleanup.\n", __func__);
-        return 1;
-    }
-
-    return 0;
-}
-
-static host_info_t     *host_info   = NULL;
-static remote_info_t   *remote_info = NULL;
-static bullet_info_t   *bullet_info = NULL;
-
-static void multiplayer_process(const uint8_t *p, const size_t sz) {
-    void *dest = NULL;
-    hltp_type tp = hltp_interpret(p, sz, &dest);
-    if (dest == NULL) return;
-    switch(tp){
-        case hltp_type_host:
-            host_info = (host_info_t*)dest;
-            break;
-        case hltp_type_remote:
-            remote_info = (remote_info_t*)dest;
-            break;
-        case hltp_type_bullet:
-            bullet_info = (bullet_info_t*)dest;
-            break;
-        case hltp_type_invalid: break;
-        case hltp_type_string : break;
-    }
-}
-static int (multiplayer_host)(void);
-static int (multiplayer_remote)(void);
-static int (multiplayer)(void) {
-    int r;
-
-    menu_t *main_menu = menu_ctor(font_get_default());
-    menu_add_item(main_menu, "Create");
-    menu_add_item(main_menu, "Connect");
-    menu_add_item(main_menu, "Back");
-
-    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
-    uint8_t last_lb = 0;
-    struct packet pp;
-    keys_t *keys = get_key_presses();
-
-    /// loop stuff
-    int click = 0;
-    uint64_t int_vector = 0;
-    int good = true;
-    while (good) {
-        /* Get a request message. */
-        if((r = get_interrupts_vector(&int_vector))) return r;
-        uint32_t n = 1;
-        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
-            if (int_vector & n) {
-                interrupt_handler(i);
-                switch (i) {
-                    case TIMER0_IRQ:
-
-                    graph_clear_screen();
-                    switch(menu_update_state(main_menu, click)){
-                        case -1: break;
-                        case  0: multiplayer_host(); break;
-                        case  1: multiplayer_remote(); break;
-                        case  2: good = false; break;
-                    }
-                    menu_draw(main_menu);
-
-                    click = 0;
-
-                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
-                    sprite_draw(sp_crosshair);
-                    graph_draw();
-
-                    break;
-                    case KBC_IRQ:
-                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
-                    case MOUSE_IRQ:
-                    if (mouse_get_counter_mouse_ih() >= 3) {
-                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
-                        update_mouse(&pp);
-                        if (!click) click = last_lb ^ keys->lb_pressed && keys->lb_pressed;
-                        last_lb = keys->lb_pressed;
-                        mouse_set_counter_mouse_ih(0);
-                    }
-                    break;
-                    case COM1_IRQ: nctp_ih(); break;
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-static int (multiplayer_host)(void) {
-    int r;
-
-    nctp_dump();
-    nctp_set_processor(multiplayer_process);
-
-    ent_set_scale(DEFAULT_SCALE);
-    text_timer_t *in_game_timer = text_timer_ctor(font_get_default());
-
-    list_t *shooter_list = list_ctor();
-
-    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
-    gunner_set_spawn(shooter1, 75, 75);
-
-    gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 2); if(shooter2 == NULL) printf("Failed to get shooter2\n");
-    gunner_set_spawn(shooter2, 975, 75);
-
-    list_insert(shooter_list, list_end(shooter_list), shooter1);
-    list_insert(shooter_list, list_end(shooter_list), shooter2);
-
-    do {
-        get_random_spawn(map1, shooter1, shooter_list);
-        get_random_spawn(map1, shooter2, shooter_list);
-    } while (gunner_distance(shooter1, shooter2) < 500);
-
-    host_info = host_info_ctor(shooter1, shooter2);
-    remote_info = remote_info_ctor();
-    bullet_info = bullet_info_ctor();
-
-    list_t *bullet_list  = list_ctor();
-
-    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
-    uint8_t last_lb = 0;
-    struct packet pp;
-    keys_t *keys = get_key_presses();
-    /// loop stuff
-    uint64_t int_vector = 0;
-    int good = true;
-    int state = 0; // -1 for remote win, 0 for draw, 1 for host win
-    list_node_t *p1, *p2; // player states
-    int state_1, state_2;
-    while (good) {
-        if ((r = get_interrupts_vector(&int_vector))) return r;
-        uint32_t n = 1;
-        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
-            if (int_vector & n) {
-                interrupt_handler(i);
-                switch (i) {
-                    case TIMER0_IRQ:
-                    if (timer_get_no_interrupts() % 60 == 0) text_timer_update(in_game_timer);
-                    update_movement(map1, shooter1, keys, shooter_list);
-                    update_movement(map1, shooter2, &(remote_info->remote_keys_pressed), shooter_list);
-
-                    update_game_state(map1, shooter_list, bullet_list);
-
-                    p1 = list_find(shooter_list, shooter1);
-                    p2 = list_find(shooter_list, shooter2);
-
-                    if ((state_1 = (p1 == list_end(shooter_list))) || (state_2 = (p2 == list_end(shooter_list)))) {
-                        state = state_1 - state_2;
-                        good = false;
-                        break;
-                    }
-
-                    double angle = get_mouse_angle(shooter1);
-                    gunner_set_angle(shooter1, angle - M_PI_2);
-
-                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-                    gunner_set_angle(shooter2, remote_info->remote_angle);
-                    build_host_structure(host_info, shooter1, shooter2);
-
-                    hltp_send_host_info(host_info);
-
-                    graph_clear_screen();
-                    map_draw   (map1);
-                    bullet_draw_list(bullet_list);
-                    gunner_draw_list(shooter_list);
-
-                    text_draw(in_game_timer->text);
-
-                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
-                    sprite_draw(sp_crosshair);
-                    graph_draw();
-
-                    break;
-                    case KBC_IRQ:
-                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
-                        good = false;
-                    }
-                    break;
-                    case MOUSE_IRQ:
-                    if (mouse_get_counter_mouse_ih() >= 3) {
-                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
-                        update_mouse(&pp);
-                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed)
-                        shoot_bullet(shooter1, bullet_list, bsp_bullet);
-                        last_lb = keys->lb_pressed;
-                        mouse_set_counter_mouse_ih(0);
-                    }
-                    break;
-
-                    case COM1_IRQ:
-                        nctp_ih();
-                        if (bullet_info->new_bullet) {
-                            shoot_bullet(shooter2, bullet_list, bsp_bullet);
-                            bullet_info->new_bullet = false;
-                        }
-                        break;
-                }
-            }
-        }
-    }
-
-    while(list_size(shooter_list) > 0){
-        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
-        gunner_dtor(p);
-    }
-    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
-
-    while(list_size(bullet_list) > 0){
-        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
-        bullet_dtor(p);
-    }
-    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
-
-    host_info_dtor(host_info);
-    remote_info_dtor(remote_info);
-    bullet_info_dtor(bullet_info);
-
-    nctp_set_processor(NULL);
-
-    text_timer_dtor(in_game_timer); in_game_timer = NULL;
-
-    return 0;
-}
-static int (multiplayer_remote)(void) {
-    int r;
-
-    nctp_dump();
-    nctp_set_processor(multiplayer_process);
-
-    ent_set_scale(DEFAULT_SCALE);
-    text_timer_t *in_game_timer = text_timer_ctor(font_get_default());
-
-    list_t *shooter_list = list_ctor();
-
-    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 2); if(shooter1 == NULL) printf("Failed to get shooter1\n");
-    gunner_set_spawn(shooter1, 75, 75);
-
-    gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter2 == NULL) printf("Failed to get shooter2\n");
-    gunner_set_spawn(shooter2, 975, 75);
-
-    list_insert(shooter_list, list_end(shooter_list), shooter1);
-    list_insert(shooter_list, list_end(shooter_list), shooter2);
-
-    host_info = host_info_ctor(shooter2, shooter1);
-    remote_info = remote_info_ctor();
-    bullet_info = bullet_info_ctor();
-
-    list_t *bullet_list  = list_ctor();
-
-    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
-    uint8_t last_lb = 0;
-    struct packet pp;
-    keys_t *keys = get_key_presses();
-
-    /// loop stuff
-    uint64_t int_vector = 0;
-    int good = true;
-    while (good) {
-        if ((r = get_interrupts_vector(&int_vector))) return r;
-        uint32_t n = 1;
-        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
-            if (int_vector & n) {
-                interrupt_handler(i);
-                switch (i) {
-                    case TIMER0_IRQ:
-                    if (timer_get_no_interrupts() % 60 == 0) text_timer_update(in_game_timer);
-
-                    double angle = get_mouse_angle(shooter1) - M_PI_2;
-
-                    build_remote_structure(remote_info, keys, angle);
-
-
-                    //hltp_send_remote_info(remote_info);
-                    gunner_set_pos(shooter1, (double)host_info->remote_x, (double)host_info->remote_y);
-                    gunner_set_angle(shooter1, (double)host_info->remote_angle);
-                    gunner_set_health(shooter1, (double)host_info->remote_health);
-                    gunner_set_curr_health(shooter1, (double)host_info->remote_current_health);
-
-                    gunner_set_pos(shooter2, (double)host_info->host_x, (double)host_info->host_y);
-                    gunner_set_angle(shooter2, (double)host_info->host_angle);
-                    gunner_set_health(shooter2, (double)host_info->host_health);
-                    gunner_set_curr_health(shooter2, (double)host_info->host_current_health);
-
-                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-                    /*
-                    for (size_t j = 0; j < host_info->no_bullets; j++) {
-                        if (host_info->bullets_shooter[j]) { // remote
-                            bullet_t *bullet = bullet_ctor(shooter1, bsp_bullet, (double)host_info->bullets_x[j], (double)host_info->bullets_y[j], (double)host_info->bullets_vx[j], (double)host_info->bullets_vy[j]);
-                            list_insert(bullet_list, list_end(bullet_list), bullet);
-                        } else { // host
-                            bullet_t *bullet = bullet_ctor(shooter2, bsp_bullet, (double)host_info->bullets_x[j], (double)host_info->bullets_y[j], (double)host_info->bullets_vx[j], (double)host_info->bullets_vy[j]);
-                            list_insert(bullet_list, list_end(bullet_list), bullet);
-                        }
-                    }*/
-
-                    graph_clear_screen();
-                    map_draw   (map1);
-                    bullet_draw_list(bullet_list);
-                    gunner_draw_list(shooter_list);
-
-                    text_draw(in_game_timer->text);
-
-                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
-                    sprite_draw(sp_crosshair);
-                    graph_draw();
-                    /*
-                    while(list_size(bullet_list) > 0){
-                        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
-                        bullet_dtor(p);
-                    }
-                    */
-
-                    break;
-                    case KBC_IRQ:
-                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
-                        good = false;
-                    }
-                    break;
-                    case MOUSE_IRQ:
-                    if (mouse_get_counter_mouse_ih() >= 3) {
-                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
-                        update_mouse(&pp);
-                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed) {
-                            bullet_info->new_bullet = true;
-                            //hltp_send_bullet_info(bullet_info);
-                        }
-                        last_lb = keys->lb_pressed;
-                        mouse_set_counter_mouse_ih(0);
-                    }
-                    break;
-
-                    case COM1_IRQ:
-                        nctp_ih();
-                        break;
-                }
-            }
-        }
-    }
-
-    while(list_size(shooter_list) > 0){
-        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
-        gunner_dtor(p);
-    }
-    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
-
-    while(list_size(bullet_list) > 0){
-        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
-        bullet_dtor(p);
-    }
-    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
-
-    host_info_dtor(host_info);
-    remote_info_dtor(remote_info);
-    bullet_info_dtor(bullet_info);
-
-    nctp_set_processor(NULL);
-
-    text_timer_dtor(in_game_timer); in_game_timer = NULL;
-
-    return 0;
-}

Property changes on: proj/src/proj.c
___________________________________________________________________
Deleted: svn:executable
Index: proj/src/interrupts_func.c
===================================================================
--- proj/src/interrupts_func.c	(revision 354)
+++ proj/src/interrupts_func.c	(nonexistent)
@@ -1,214 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "interrupts_func.h"
-#include "timer.h"
-#include "keyboard.h"
-#include "mouse.h"
-#include "hltp.h"
-#include "utils.h"
-#include "errors.h"
-
-static int timer_subscribed = 0, timer_id;
-
-static int keyboard_subscribed = 0, kbc_id;
-
-static int mouse_subscribed = 0, mouse_id;
-
-static int uart_subscribed = 0, uart_id;
-
-static void (*const ih[])(void) =   {    timer_int_handler,
-                                         kbc_ih,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         mouse_ih,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                         NULL,
-                                     };
-/*
-static void process_received(const uint8_t *p, const size_t sz){
-    void *q = NULL;
-    hltp_type t = hltp_interpret(p, sz, &q);
-    switch(t){
-        case hltp_type_string:{
-            char *s = q;
-            printf("%s\n", s);
-        } break;
-        default: break;
-    }
-}
-*/
-int (subscribe_all)(void) {
-
-    /// Timer interrupt handling
-    timer_id = 0;
-    if(subscribe_timer_interrupt(TIMER0_IRQ, &timer_id)) {
-        printf("%s: failed to subscribe timer interrupts.\n", __func__);
-        return SBCR_ERROR;
-    }
-    timer_subscribed = 1;
-
-    /// Keyboard interrupt handling
-    kbc_id = 0;
-    if (subscribe_kbc_interrupt(KBC_IRQ, &kbc_id)) {
-        printf("%s: failed to subscribe keyboard interrupts.\n", __func__);
-        if (unsubscribe_all())
-            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
-        return SBCR_ERROR;
-    }
-    keyboard_subscribed = 1;
-
-    /// Mouse interrupt handling
-    mouse_id = 0;
-    if (subscribe_mouse_interrupt(MOUSE_IRQ, &mouse_id)) { // subscribes mouse interrupts in exclusive mode
-        printf("%s: failed to subscribe mouse interrupts.\n", __func__);
-        if (unsubscribe_all())
-            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
-        return SBCR_ERROR;
-    }
-    mouse_subscribed = 1;
-    if (sys_irqdisable(&mouse_id)) { // temporarily disables our interrupts notifications
-        printf("%s: failed to disable mouse interrupts.\n", __func__);
-        if (unsubscribe_all())
-            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
-        return SBCR_ERROR;
-    }
-    if (mouse_set_data_report(true)) { // enables mouse data reporting
-        printf("%s: failed to enable mouse data reporting.\n", __func__);
-        if (unsubscribe_all())
-            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
-        return SBCR_ERROR;
-    }
-    if (sys_irqenable(&mouse_id)) { // re-enables our interrupts notifications
-        printf("%s: failed to enable mouse interrupts.\n", __func__);
-        if (unsubscribe_all())
-            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
-        return SBCR_ERROR;
-    }
-
-    /// UART interrupt handling
-    uart_id = 0;
-    uart_set_bits_per_character(COM1_ADDR, 8);
-    uart_set_stop_bits         (COM1_ADDR, 2);
-    uart_set_parity            (COM1_ADDR, uart_parity_even);
-    uart_set_bit_rate          (COM1_ADDR, 115200);
-    uart_enable_int_rx (COM1_ADDR);
-    uart_enable_int_tx(COM1_ADDR);
-    if(subscribe_uart_interrupt(COM1_IRQ, &uart_id)) {
-        printf("%s: failed to subscribe UART interrupts.\n", __func__);
-        return SBCR_ERROR;
-    }
-    uart_subscribed = 1;
-    nctp_init();
-
-    return SUCCESS;
-}
-
-int (unsubscribe_all)(void) {
-    int r = SUCCESS;
-
-    // Unsubscribe Timer Interrupts
-    if (timer_subscribed) {
-        if (unsubscribe_interrupt(&timer_id)) {
-            printf("%s: failed to unsubcribe timer interrupts.\n", __func__);
-            r = UNSBCR_ERROR;
-        }
-        timer_subscribed = 0;
-    }
-
-    // Unsubscribe Keyboard interrupts
-    if (keyboard_subscribed) {
-        if (unsubscribe_interrupt(&kbc_id)) {
-            printf("%s: failed to unsubcribe keyboard interrupts.\n", __func__);
-            r = UNSBCR_ERROR;
-        }
-        keyboard_subscribed = 0;
-    }
-
-    // Unsubscribe Mouse Interrupts
-    if (mouse_subscribed) {
-        if (sys_irqdisable(&mouse_id)) { // temporarily disables our interrupts notifications
-            printf("%s: failed to disable mouse interrupts.\n", __func__);
-            r = UNSBCR_ERROR;
-        }
-        if (mouse_set_data_report(false)) { // disables mouse data reporting
-            printf("%s: failed to disable mouse data reporting.\n", __func__);
-            r = UNSBCR_ERROR;
-        }
-        if (sys_irqenable(&mouse_id)) { // re-enables our interrupts notifications
-            printf("%s: failed to enable mouse interrupts.\n", __func__);
-            r = UNSBCR_ERROR;
-        }
-        if (unsubscribe_interrupt(&mouse_id)) { // unsubscribes interrupts
-            printf("%s: failed to unsubcribe mouse interrupts.\n", __func__);
-            r = UNSBCR_ERROR;
-        }
-        mouse_subscribed = 0;
-    }
-
-    // Unsubscribe UART interrupts
-    if (uart_subscribed) {
-        if (unsubscribe_interrupt(&uart_id)) {
-            printf("%s: failed to unsubcribe UART interrupts.\n", __func__);
-            r = UNSBCR_ERROR;
-        }
-        uart_enable_int_rx(COM1_ADDR);
-        uart_enable_int_tx(COM1_ADDR);
-        uart_subscribed = 0;
-    }
-    nctp_free();
-
-    return r;
-}
-
-void (interrupt_handler)(uint8_t handler) {
-    if (handler >= 32)              return;
-    if ((ih[handler]) == NULL)      return;
-    (*ih[handler])();
-}
-
-int get_interrupts_vector(uint64_t *p){
-    int r;
-
-    *p = 0;
-
-    int ipc_status;
-    message msg;
-    if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
-        printf("driver_receive failed with %d", r);
-        return OTHER_ERROR;
-    }
-    if (is_ipc_notify(ipc_status)) { /* received notification */
-        switch (_ENDPOINT_P(msg.m_source)) {
-            case HARDWARE: /* hardware interrupt notification */
-                *p = msg.m_notify.interrupts;
-                return SUCCESS;
-            default: break; /* no other notifications expected: do nothing */
-        }
-    }
-    return SUCCESS;
-}

Property changes on: proj/src/interrupts_func.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/src/singleplayer.c
===================================================================
--- proj/src/singleplayer.c	(revision 354)
+++ proj/src/singleplayer.c	(nonexistent)
@@ -1,79 +0,0 @@
-#include <lcom/lcf.h>
-
-#include "singleplayer.h"
-
-#include "proj.h"
-
-#include "proj_macros.h"
-#include "proj_func.h"
-#include "ent.h"
-#include "interrupts_func.h"
-
-#include "libs.h"
-
-#include "campaign.h"
-#include "zombies.h"
-
-int (singleplayer)(void) {
-
-    int r;
-
-    menu_t *main_menu = menu_ctor(font_get_default());
-    menu_add_item(main_menu, "Campaign");
-    menu_add_item(main_menu, "Zombies");
-    menu_add_item(main_menu, "Back");
-
-    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
-    uint8_t last_lb = 0;
-    struct packet pp;
-    keys_t *keys = get_key_presses();
-
-    /// loop stuff
-    int click = 0;
-    uint64_t int_vector = 0;
-    int good = true;
-    while (good) {
-        /* Get a request message. */
-        if((r = get_interrupts_vector(&int_vector))) return r;
-        uint32_t n = 1;
-        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
-            if (int_vector & n) {
-                interrupt_handler(i);
-                switch (i) {
-                    case TIMER0_IRQ:
-
-                    graph_clear_screen();
-                    switch(menu_update_state(main_menu, click)){
-                        case -1: break;
-                        case  0: campaign(); break;
-                        case  1: zombies(); break;
-                        case  2: good = false; break;
-                    }
-                    menu_draw(main_menu);
-
-                    click = 0;
-
-                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
-                    sprite_draw(sp_crosshair);
-                    graph_draw();
-
-                    break;
-                    case KBC_IRQ:
-                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
-                    case MOUSE_IRQ:
-                    if (mouse_get_counter_mouse_ih() >= 3) {
-                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
-                        update_mouse(&pp);
-                        if (!click) click = last_lb ^ keys->lb_pressed && keys->lb_pressed;
-                        last_lb = keys->lb_pressed;
-                        mouse_set_counter_mouse_ih(0);
-                    }
-                    break;
-                    case COM1_IRQ: nctp_ih(); break;
-                }
-            }
-        }
-    }
-
-    return 0;
-}

Property changes on: proj/src/singleplayer.c
___________________________________________________________________
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: proj/project/include/campaign.h
===================================================================
--- proj/project/include/campaign.h	(nonexistent)
+++ proj/project/include/campaign.h	(revision 355)
@@ -0,0 +1,6 @@
+#ifndef CAMPAIGN_H_INCLUDED
+#define CAMPAIGN_H_INCLUDED
+
+int (campaign)(void);
+
+#endif //CAMPAIGN_H_INCLUDED

Property changes on: proj/project/include/campaign.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/chat.h
===================================================================
--- proj/project/include/chat.h	(nonexistent)
+++ proj/project/include/chat.h	(revision 355)
@@ -0,0 +1,6 @@
+#ifndef CHAT_H_INCLUDED
+#define CHAT_H_INCLUDED
+
+int (chat)(void);
+
+#endif //CHAT_H_INCLUDED

Property changes on: proj/project/include/chat.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/ent.h
===================================================================
--- proj/project/include/ent.h	(nonexistent)
+++ proj/project/include/ent.h	(revision 355)
@@ -0,0 +1,417 @@
+#ifndef ENT_H_INCLUDED
+#define ENT_H_INCLUDED
+
+/**
+ * @defgroup ent ent
+ * @brief Entities module
+ *
+ * @{
+ */
+
+#include "libs.h"
+
+/**
+ * @brief Set scale.
+ * @param   n   Scale
+ */
+void (ent_set_scale) (double n);
+/**
+ * @brief Set origin of screen (upper-left corner) in game referential coordinates.
+ * @param   x   X-position of the upper-left corner of the screen
+ * @param   y   Y-position of the upper-left corner of the screen
+ */
+void (ent_set_origin)(double x, double y);
+/**
+ * @brief Get scale.
+ * @return  Scale
+ */
+double (ent_get_scale)  (void);
+/**
+ * @brief Get X-length of the screen in game referencial coordinates.
+ * @return X-length
+ */
+double (ent_get_XLength)(void);
+/**
+ * @brief Get Y-length of the screen in game referencial coordinates.
+ * @return Y-length
+ */
+double (ent_get_YLength)(void);
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup gunner_t gunner_t
+ * @ingroup ent
+ * @brief Gunner module.
+ *
+ * @{
+ */
+
+/// @brief Identifier of a melee gunner
+#define GUNNER_MELEE    BIT(0)
+/// @brief Identifier of a ranged gunner
+#define GUNNER_RANGED   BIT(1)
+/// @brief Identifier of a player-controlled gunner
+#define GUNNER_PLAYER   BIT(2)
+/// @brief Identifier of an automatic follower gunner
+#define GUNNER_FOLLOW   BIT(3)
+
+/**
+ * @brief Gunner.
+ */
+typedef struct gunner gunner_t;
+/**
+ * @brief Construct gunner.
+ * @param   dude    Basic sprite representing the gunner
+ * @param   weapon  Basic sprite representing the weapon of the gunner
+ * @param   type    Type of gunner. Can be one of the identifier macros and also the OR-merge of any combination of them
+ * @param   team    Team of the gunner. 1 for player 1, 2 for player 2, 3 for opponents and 0 for no team (temporary gunner)
+ */
+gunner_t* (gunner_ctor)(basic_sprite_t *dude, basic_sprite_t *weapon, uint16_t type, int team);
+/**
+ * @brief Destruct gunner.
+ * @param   p   Pointer to gunner to be destructed
+ */
+void      (gunner_dtor)(gunner_t *p);
+/**
+ * @brief   Set gunner position.
+ * @param   p   Pointer to gunner
+ * @param   x   X-position of the gunner in game coordinates
+ * @param   y   Y-position of the gunner in game coordinates
+ */
+void (gunner_set_pos)               (gunner_t *p, double x, double y);
+/**
+ * @brief   Set gunner spawn position.
+ * @param   p   Pointer to gunner
+ * @param   x   Spawn X-position of the gunner in game coordinates
+ * @param   y   Spawn Y-position of the gunner in game coordinates
+ */
+void (gunner_set_spawn)             (gunner_t *p, double x, double y);
+/**
+ * @brief   Set gunner angle.
+ * @param   p       Pointer to gunner
+ * @param   angle   Angle in radians
+ */
+void (gunner_set_angle)             (gunner_t *p, double angle);
+/**
+ * @brief   Set gunner health (total, max health).
+ * @param   p       Pointer to gunner
+ * @param   health  Health
+ */
+void (gunner_set_health)            (gunner_t *p, double health);
+/**
+ * @brief   Set gunner current health.
+ * @param   p       Pointer to gunner
+ * @param   health  Current health
+ */
+void (gunner_set_curr_health)       (gunner_t *p, double health);
+/**
+ * @brief   Get gunner X-position.
+ * @param   p   Pointer to gunner
+ * @return  X-position of the gunner
+ */
+double  (gunner_get_x)              (const gunner_t *p);
+/**
+ * @brief   Get gunner Y-position.
+ * @param   p   Pointer to gunner
+ * @return  Y-position of the gunner
+ */
+double  (gunner_get_y)              (const gunner_t *p);
+/**
+ * @brief   Get gunner spawn X-position.
+ * @param   p   Pointer to gunner
+ * @return  Spawn X-position of the gunner
+ */
+double  (gunner_get_spawn_x)        (const gunner_t *p);
+/**
+ * @brief   Get gunner spawn Y-position.
+ * @param   p   Pointer to gunner
+ * @return  Spawn Y-position of the gunner
+ */
+double  (gunner_get_spawn_y)        (const gunner_t *p);
+/**
+ * @brief   Get gunner angle.
+ * @param   p   Pointer to gunner
+ * @return  Angle of the gunner
+ */
+double  (gunner_get_angle)          (const gunner_t *p);
+/**
+ * @brief   Get gunner max health.
+ * @param   p   Pointer to gunner
+ * @return  Max health of the gunner
+ */
+double  (gunner_get_health)         (const gunner_t *p);
+/**
+ * @brief   Get gunner current health.
+ * @param   p   Pointer to gunner
+ * @return  Current health of the gunner
+ */
+double  (gunner_get_curr_health)    (const gunner_t *p);
+/**
+ * @brief   Get gunner X-position in screen coordinates.
+ * @param   p   Pointer to gunner
+ * @return  X-position of the gunner in screen coordinates
+ */
+int16_t (gunner_get_x_screen)       (const gunner_t *p);
+/**
+ * @brief   Get gunner Y-position in screen coordinates.
+ * @param   p   Pointer to gunner
+ * @return  Y-position of the gunner in screen coordinates
+ */
+int16_t (gunner_get_y_screen)       (const gunner_t *p);
+/**
+ * @brief   Get gunner type.
+ * @param   p   Pointer to gunner
+ * @return  Type of gunner
+ */
+uint16_t (gunner_get_type)          (const gunner_t *p);
+/**
+ * @brief   Get gunner team.
+ * @param   p   Pointer to gunner
+ * @return  Team of gunner
+ */
+int     (gunner_get_team)           (const gunner_t *p);
+/**
+ * @brief   Draw gunner on screen buffer.
+ * @param   p   Pointer to gunner
+ */
+void (gunner_draw)(gunner_t *p);
+/**
+ * @brief   Draw gunner health bar on screen buffer.
+ * @param   p   Pointer to gunner
+ */
+void (gunner_draw_health)(const gunner_t *p);
+/**
+ * @brief   Draw list of gunners on screen buffer.
+ * @param   shooter_list    List of gunners
+ */
+void (gunner_draw_list)(list_t *shooter_list);
+/**
+ * @brief Get distance between two gunners.
+ * @param   p1  Gunner 1
+ * @param   p2  Gunner 2
+ * @return  Euclidian distance between the two gunners
+ */
+double (gunner_distance)(const gunner_t *p1, const gunner_t *p2);
+/**
+ * @brief Check if two gunners are colliding.
+ * @param   p1  Gunner 1
+ * @param   p2  Gunner 2
+ * @return  true if the two gunners are colliding, false otherwise
+ */
+int (gunner_collides_gunner)(const gunner_t *p1, const gunner_t *p2);
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup bullet_t bullet_t
+ * @ingroup ent
+ * @brief Bullet module.
+ *
+ * @{
+ */
+
+/**
+ * @brief Bullet.
+ */
+typedef struct bullet bullet_t;
+/**
+ * @brief Construct bullet.
+ * @param   shooter Pointer to gunner that shot that bullet
+ * @param   b       Basic sprite of the bullet
+ * @param   x       X-position
+ * @param   y       Y-position
+ * @param   vx      X-speed
+ * @param   vy      Y-speed
+ * @return Pointer to constructed bullet, or NULL if failed
+ */
+bullet_t* (bullet_ctor)(const gunner_t *shooter, const basic_sprite_t *b, double x, double y, double vx, double vy);
+/**
+ * @brief Destruct bullet.
+ * @param   p   Pointer to bullet to be destructed
+ */
+void      (bullet_dtor)(bullet_t *p);
+/**
+ * @brief   Get bullet X-position.
+ * @param   p   Pointer to bullet
+ * @return  X-position of the bullet
+ */
+double  (bullet_get_x)       (const bullet_t *p);
+/**
+ * @brief   Get bullet Y-position.
+ * @param   p   Pointer to bullet
+ * @return  Y-position of the bullet
+ */
+double  (bullet_get_y)       (const bullet_t *p);
+/**
+ * @brief   Get bullet X-speed.
+ * @param   p   Pointer to bullet
+ * @return  X-speed of the bullet
+ */
+double  (bullet_get_vx)      (const bullet_t *p);
+/**
+ * @brief   Get bullet Y-speed.
+ * @param   p   Pointer to bullet
+ * @return  Y-speed of the bullet
+ */
+double  (bullet_get_vy)      (const bullet_t *p);
+/**
+ * @brief   Get bullet X-position in screen coordinates.
+ * @param   p   Pointer to bullet
+ * @return  X-position of the bullet in screen coordinates
+ */
+int16_t (bullet_get_x_screen)(const bullet_t *p);
+/**
+ * @brief   Get bullet Y-position in screen coordinates.
+ * @param   p   Pointer to bullet
+ * @return  Y-position of the bullet in screen coordinates
+ */
+int16_t (bullet_get_y_screen)(const bullet_t *p);
+/**
+ * @brief   Get bullet damage.
+ * @param   p   Pointer to bullet
+ * @return  Damage
+ */
+double  (bullet_get_damage)  (const bullet_t *p);
+/**
+ * @brief   Set bullet damage.
+ * @param   p   Pointer to bullet
+ * @param   damage  Damage
+ */
+void    (bullet_set_damage)  (bullet_t *p, double damage);
+/**
+ * @brief Get gunner that shot the bullet.
+ * @param   p   Pointer to bullet
+ * @return  Pointer to gunner that shot the bullet
+ */
+const gunner_t* (bullet_get_shooter)(const bullet_t *p);
+/**
+ * @brief Update bullet position (i.e., advance it according to its speed).
+ * @param   p   Pointer to bullet
+ */
+void (bullet_update_movement)(bullet_t *p);
+/**
+ * @brief Update movement of bullets in a list.
+ * @param   bullet_list     Pointer to bullet list
+ */
+void (bullet_update_movement_list)(list_t *bullet_list);
+/**
+ * @brief Draw bullet on screen buffer.
+ * @param   p   Pointer to bullet
+ */
+void (bullet_draw)(bullet_t *p);
+/**
+ * @brief Draw bullets in list on screen buffer.
+ * @param   bullet_list     Pointer to bullet list
+ */
+void (bullet_draw_list)(list_t *bullet_list);
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup map_t map_t
+ * @ingroup ent
+ * @brief Bullet module.
+ *
+ * @{
+ */
+
+/**
+ * @brief Map.
+ */
+typedef struct map map_t;
+/**
+ * @brief Construct map.
+ * @param   background  XPM describing map as it should be rendered
+ * @param   collide     XPM with transparency describing what parts of the map will cause collision
+ * @return  Pointer to constructed map, or NULL if failed
+ */
+map_t* (map_ctor)(const char *const *background, const char *const *collide);
+/**
+ * @brief Destruct map.
+ * @param   p   Pointer to map to be destructed
+ */
+void   (map_dtor)(map_t *p);
+/**
+ * @brief Get map width.
+ * @param   p   Pointer to map
+ * @return      Width of map
+ */
+uint16_t (map_get_width)   (const map_t *p);
+/**
+ * @brief Get map height.
+ * @param   p   Pointer to map
+ * @return      Height of map
+ */
+uint16_t (map_get_height)  (const map_t *p);
+/**
+ * @brief Use Dijkstra's path-finding algorithm.
+ *
+ * Allows a follower to know where to move so it gets closer to a given target.
+ *
+ * This function is implemented in a clever way that reduces the time of execution.
+ * On the other hand, it might not always give the shortest path, but it is
+ * guaranteeed to provide a decent, valid path to the target.
+ *
+ * @param   p   Pointer to map
+ * @param   x_  X-position of the target
+ * @param   y_  Y-position of the target
+ * @return  SUCCESS if operation is successful, false otherwise
+ */
+int (map_make_dijkstra)(map_t *p, double x_, double y_);
+/**
+ * @brief Get the direction a follower should move to get closer to the target.
+ * @param   p       Pointer to map
+ * @param   x       X-position of the follower
+ * @param   y       Y-position of the follower
+ * @param   theta   Pointer to angle that will be updated
+ * @return SUCCESS if operation was successful, other value otherwise
+ */
+int (map_where_to_follow)(const map_t *p, double x, double y, double *theta);
+/**
+ * @brief Draw map on screen buffer.
+ * @param   p   Pointer to map
+ */
+void   (map_draw)(map_t *p);
+/**
+ * @brief Evaluate if point collides with map.
+ * @param   p   Pointer to map
+ * @param   x   X-position of the point
+ * @param   y   Y-position of the point
+ * @return true if the point collides with the map, false otherwise
+ */
+int    (map_collides_point)(const map_t *p, double x, double y);
+
+/**
+ * @}
+ */
+
+/**
+ * @brief Evaluate if gunner is colliding with map.
+ * @param   p       Pointer to map
+ * @param   gunner  Pointer to gunner
+ * @return true if the gunner collides with the map, false otherwise
+ */
+int    (map_collides_gunner)(const map_t *p, const gunner_t *gunner);
+/**
+ * @brief Evaluate if bullet is colliding with map.
+ * @param   p       Pointer to map
+ * @param   bullet  Pointer to bullet
+ * @return true if the bullet collides with the map, false otherwise
+ */
+int    (map_collides_bullet)(const map_t *p, const bullet_t *bullet);
+/**
+ * @brief Evaluate if bullet is colliding with gunner.
+ * @param   shooter     Pointer to gunner
+ * @param   bull        Pointer to bullet
+ * @return true if the bullet collides with the gunner, false otherwise
+ */
+int (gunner_collides_bullet)(const gunner_t *shooter, const bullet_t *bull);
+
+#endif //ENT_H_INCLUDED

Property changes on: proj/project/include/ent.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/interrupts_func.h
===================================================================
--- proj/project/include/interrupts_func.h	(nonexistent)
+++ proj/project/include/interrupts_func.h	(revision 355)
@@ -0,0 +1,48 @@
+#ifndef INTERRUPTS_FUNC_H_INCLUDED
+#define INTERRUPTS_FUNC_H_INCLUDED
+
+/**
+ * @defgroup interrupts_func interrupts_func
+ * @brief Interrupts functions.
+ *
+ * @{
+ */
+
+#include "libs.h"
+
+/**
+ * @brief Subscribes all drivers used (timer->keyboard->mouse)
+ * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
+ * @see {_ERRORS_H_::errors}
+ */
+int (subscribe_all)(void);
+
+/**
+ * @brief Unsubscribes all subscribed interrupts
+ * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
+ * @see {_ERRORS_H_::errors}
+ */
+int (unsubscribe_all)(void);
+
+/**
+ * @brief Calls interrupt handler corresponding to the bit specified by the argument.
+ * @param handler Interrupt handler to call
+ */
+void interrupt_handler(uint8_t handler);
+
+/**
+ * @brief Blocking function that waits for an interrupt to occur.
+ *
+ * Rewrites the provided argument with the interrupt vector it gets.
+ *
+ * This function decisively reduces the complexity of an interrupt cycle, allowing
+ * for each menu to have its own, simplified interrupt cycle.
+ * @param   p   Pointer where interrupt vector will be saved
+ */
+int get_interrupts_vector(uint64_t *p);
+
+/**
+ * @}
+ */
+
+#endif /* end of include guard: INTERRUPTS_FUNC_H_INCLUDED */

Property changes on: proj/project/include/interrupts_func.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/makecode_map.h
===================================================================
--- proj/project/include/makecode_map.h	(nonexistent)
+++ proj/project/include/makecode_map.h	(revision 355)
@@ -0,0 +1,27 @@
+#ifndef MAKE_CODE_MAP_H_
+#define MAKE_CODE_MAP_H_
+
+/**
+ * @defgroup makecode_map makecode_map
+ * @brief Makecode map.
+ *
+ * @{
+ */
+
+#include <stdint.h>
+
+/// @brief Error code
+#define ERROR_CODE      0
+
+/**
+ * @brief Maps make code into char
+ * @param code      Make code to map.
+ * @return ERROR_CODE if code char isn't valid, otherwise the character.
+ */
+char (map_makecode)(uint8_t code);
+
+/**
+ * @}
+ */
+
+#endif /* end of include guard: MAKE_CODE_MAP_H_ */

Property changes on: proj/project/include/makecode_map.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/proj.h
===================================================================
--- proj/project/include/proj.h	(nonexistent)
+++ proj/project/include/proj.h	(revision 355)
@@ -0,0 +1,17 @@
+#ifndef PROJ_H_INCLUDED
+#define PROJ_H_INCLUDED
+
+#include "libs.h"
+
+#include "ent.h"
+
+basic_sprite_t       *bsp_crosshair;
+basic_sprite_t       *bsp_shooter  ;
+basic_sprite_t       *bsp_zombie   ;
+basic_sprite_t       *bsp_pistol   ;
+basic_sprite_t       *bsp_nothing  ;
+basic_sprite_t       *bsp_bullet   ;
+map_t                *map1         ;
+sprite_t             *sp_crosshair ;
+
+#endif //PROJ_H_INCLUDED

Property changes on: proj/project/include/proj.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/proj_func.h
===================================================================
--- proj/project/include/proj_func.h	(nonexistent)
+++ proj/project/include/proj_func.h	(revision 355)
@@ -0,0 +1,157 @@
+#ifndef PROJ_FUNC_H_INCLUDED
+#define PROJ_FUNC_H_INCLUDED
+
+/**
+ * @defgroup proj_func proj_func
+ * @brief Project helper functions.
+ *
+ * @{
+ */
+
+#include "libs.h"
+#include "proj_structures.h"
+
+//#include <stdint.h>
+
+/**
+ * @brief Cleans up all memory, unsubscribes interrupts.
+ * @return ERROR_CODE code representing the result of the operation, SUCCESS code is returned if everything is OK
+ * @see {_ERRORS_H_::errors}
+ */
+int cleanup(void);
+
+/**
+ * @brief Update key presses.
+ */
+void update_key_presses(void);
+/**
+ * @brief Get key presses.
+ * @return  keys_t containing key presses
+ */
+keys_t* (get_key_presses)(void);
+
+/**
+ * @brief Update mouse.
+ */
+void update_mouse(struct packet *p);
+/**
+ * @brief Get pointer to mouse X-position.
+ * @return  Pointer to mouse X-position.
+ */
+int16_t* get_mouse_X(void);
+/**
+ * @brief Get pointer to mouse Y-position.
+ * @return  Pointer to mouse Y-position.
+ */
+int16_t* get_mouse_Y(void);
+/**
+ * @brief Get cursor angle relative to a gunner in the screen.
+ * @param   p   Pointer to gunner
+ * @return      Angle of the mouse relative to the gunner
+ */
+double get_mouse_angle(gunner_t *p);
+
+/**
+ * @brief Updates movement variables.
+ */
+void update_movement(map_t *map, gunner_t *p, keys_t *keys, list_t *shooter_list);
+
+/**
+ * @brief Get random spawn (actually, position) for new gunner.
+ *
+ * The new position cannot collide with the map, nor with any of the gunners
+ * already in the list.
+ * @param   map     Pointer to map
+ * @param   p       Pointer to new gunner
+ * @param   l       List of gunners that already exist
+ */
+void (get_random_spawn)(const map_t *map, gunner_t *p, list_t *l);
+
+/**
+ * @brief Update scale if the keys were pressed to change scale.
+ */
+void update_scale(void);
+
+/**
+ * @brief Shoot a bullet.
+ * @param   shooter     Pointer to gunner that shot the bullet
+ * @param   bullet_list List of the bullets in the map
+ * @param   bsp_bullet  Basic sprite that will be used to render the bullet
+ */
+void (shoot_bullet)(const gunner_t *shooter, list_t *bullet_list, const basic_sprite_t *bsp_bullet);
+/**
+ * @brief Update game state.
+ *
+ * This includes moving bullets accordingly, processing damages, collisions of
+ * bullets with walls, melee damage for the gunners that have autonomous melee.
+ * @param   map             Pointer to map
+ * @param   shooter_list    List of shooters
+ * @param   bullet_list     List of bullets in the map
+ */
+void (update_game_state)(const map_t *map, list_t *shooter_list, list_t *bullet_list);
+
+/**
+ * @brief Wrapper to easen filling of the host_info_t.
+ * @param   p       Host info to fill
+ * @param   host    Host gunner
+ * @param   remote  Remote gunner
+ */
+void build_host_structure(host_info_t *p, gunner_t *host, gunner_t *remote);
+/**
+ * @brief Wrapper to easen filling of the remote_info_t.
+ * @param   p       Remote info to fill
+ * @param   keys    Key presses of remote
+ * @param   angle   Mouse angle of remote
+ */
+void build_remote_structure(remote_info_t *p, keys_t *keys, double angle);
+
+
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup text_timer_t text_timer_t
+ * @ingroup proj_func
+ * @brief Text timer.
+ *
+ * @{
+ */
+
+/**
+ * @brief Text timer.
+ */
+typedef struct {
+    /// @brief Time since construction.
+    int time;
+    /// @brief Text.
+    text_t *text;
+} text_timer_t;
+/**
+ * @brief Construct timer
+ * @param   fnt Font used to render timer text
+ * @return      Pointer to constructed timer, or NULL if failed
+ */
+text_timer_t* (text_timer_ctor)(const font_t *fnt);
+/**
+ * @brief Destruct timer.
+ * @param   p   Pointer to timer to be destructed
+ */
+void (text_timer_dtor)(text_timer_t *p);
+/**
+ * @brief   Update timer, by incrementing the number of seconds.
+ * @param   p   Pointer to timer
+ */
+void (text_timer_update)(text_timer_t *p);
+/**
+ * @brief   Reset timer to 0.
+ * @param   p   Pointer to timer
+ */
+void (text_timer_reset)(text_timer_t *p);
+
+/**
+ * @}
+ */
+
+#endif /* end of include guard: PROJ_FUNC_H_INCLUDED */

Property changes on: proj/project/include/proj_func.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/proj_macros.h
===================================================================
--- proj/project/include/proj_macros.h	(nonexistent)
+++ proj/project/include/proj_macros.h	(revision 355)
@@ -0,0 +1,62 @@
+#ifndef PROJ_MACROS_H_INCLUDED
+#define PROJ_MACROS_H_INCLUDED
+
+/**
+ * @defgroup proj_macros proj_macros
+ * @brief Project macros.
+ *
+ * @{
+ */
+
+// Movement Directions
+/** @brief Moving to the top side of screen */
+#define UP      -1
+/** @brief Moving to the bottom side of screen */
+#define DOWN    1
+/** @brief Moving to the left side of screen */
+#define LEFT    -1
+/** @brief Moving to the right side of screen */
+#define RIGHT   1
+/** @brief Not moving */
+#define REST    0
+
+// Movement Constants
+/** @brief Shooter speed */
+#define SHOOTER_SPEED   5
+/** @brief Bullet speet */
+#define BULLET_SPEED    8
+
+// Refresh Rate
+/** @brief Screen refresh rate */
+#define REFRESH_RATE    60
+
+//Graphics mode
+/** @brief Graphic mode used */
+#define GRAPH_MODE      DIRECT_1024_768_888
+/** @brief Minimum zoom */
+#define MIN_SCALE       0.2
+/** @brief Default zoom */
+#define DEFAULT_SCALE   0.5
+/** @brief Maximum zoom */
+#define MAX_SCALE       10.0
+
+// Colors
+/** @brief Text color */
+#define TEXT_COLOR              0xFFFFFF
+/** @brief Highlight color */
+#define HIGHLIGHT_COLOR         0x404040
+/** @brief Delimiter color */
+#define DELIMITER_COLOR         0x404040
+
+/** @brief Melee attacks range */
+#define MELEE_RANGE    80
+/** @brief Melee attack damage (for zombies). */
+#define MELEE_DAMAGE   1
+/** @brief Zombie speed */
+#define ZOMBIE_SPEED    1.0
+
+/**
+ * @}
+ */
+
+#endif /* end of include guard: PROJ_MACROS_H_INCLUDED */

Property changes on: proj/project/include/proj_macros.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/proj_structures.h
===================================================================
--- proj/project/include/proj_structures.h	(nonexistent)
+++ proj/project/include/proj_structures.h	(revision 355)
@@ -0,0 +1,183 @@
+#ifndef PROJ_STRUCTURES_H_INCLUDED
+#define PROJ_STRUCTURES_H_INCLUDED
+
+/**
+ * @defgroup proj_structures proj_structures
+ * @brief Project structures.
+ *
+ * @{
+ */
+
+#include <stdint.h>
+#include "ent.h"
+
+/**
+ * @}
+ */
+
+/**
+ * @defgroup keys_t keys_t
+ * @ingroup proj_structures
+ * @brief Keys pressed module.
+ *
+ * @{
+ */
+
+/**
+ * @brief Keys pressed.
+ */
+typedef struct {
+    /// @brief W is pressed when 1
+    uint8_t w_pressed       : 1;
+    /// @brief A is pressed when 1
+    uint8_t a_pressed       : 1;
+    /// @brief S is pressed when 1
+    uint8_t s_pressed       : 1;
+    /// @brief D is pressed when 1
+    uint8_t d_pressed       : 1;
+    /// @brief Ctrl is pressed when 1
+    uint8_t ctrl_pressed    : 1;
+    /// @brief Plus (+) is pressed when 1
+    uint8_t plus_pressed    : 1;
+    /// @brief Minus (-) is pressed when 1
+    uint8_t minus_pressed   : 1;
+    /// @brief Mouse left button is pressed when 1
+    uint8_t lb_pressed      : 1;
+} keys_t;
+
+/**
+ * @}
+ */
+
+/**
+* @defgroup host_info_t host_info_t
+* @ingroup proj_structures
+* @brief Host info module.
+*
+* @{
+*/
+
+/**
+ * @brief Information to transmit from host to remote.
+ */
+typedef struct {
+    // host
+    /// @brief Host player X-position
+    int16_t    host_x;
+    /// @brief Host player Y-postition
+    int16_t    host_y;
+    /// @brief Host player angle
+    float      host_angle;
+    /// @brief Host player health
+    int16_t    host_health;
+    /// @brief Host player current health
+    int16_t    host_current_health;
+
+    // remote
+    /// @brief Remote player X-position
+    int16_t    remote_x;
+    /// @brief Remote player Y-postition
+    int16_t    remote_y;
+    /// @brief Remote player angle
+    float      remote_angle;
+    /// @brief Remote player health
+    int16_t    remote_health;
+    /// @brief Remote player current health
+    int16_t    remote_current_health;
+    /*
+    // bullets
+    /// @brief Number of bullets
+    uint8_t    no_bullets;
+    /// @brief X-position of the bullets
+    int16_t   *bullets_x;
+    /// @brief Y-position of the bullets
+    int16_t   *bullets_y;
+    /// @brief X-speed of the bullets
+    int16_t   *bullets_vx;
+    /// @brief Y-speed of the bullets
+    int16_t   *bullets_vy;
+    /// @brief Who shot each bullet
+    bool      *bullets_shooter; // false for host, true for remote
+    */
+} host_info_t;
+/**
+ * @brief Construct host information.
+ * @param   host    Pointer to host gunner
+ * @param   remote  Pointer to remote gunner
+ * @return  Pointer to constructed host information, or NULL if failed
+ */
+host_info_t* host_info_ctor(gunner_t *host, gunner_t *remote);
+/**
+ * @brief Destruct host information.
+ * @param   p   Pointer to host information to be destructed
+ */
+void host_info_dtor(host_info_t *p);
+
+/**
+ * @}
+ */
+
+/**
+* @defgroup remote_info_t remote_info_t
+* @ingroup proj_structures
+* @brief Remote info module.
+*
+* @{
+*/
+
+/**
+ * @brief Information to transmit from remote to host.
+ */
+typedef struct {
+    /// @brief Remote keys that are pressed
+    keys_t  remote_keys_pressed;
+    /// @brief Remote player angle
+    double  remote_angle;
+} remote_info_t;
+/**
+ * @brief Construct remote information.
+ * @return  Pointer to constructed remote information, or NULL if failed
+ */
+remote_info_t* remote_info_ctor(void);
+/**
+ * @brief Destruct remote information.
+ * @param   p   Pointer to remote information to be destructed
+ */
+void remote_info_dtor(remote_info_t *p);
+
+/**
+ * @}
+ */
+
+/**
+* @defgroup bullet_info_t bullet_info_t
+* @ingroup proj_structures
+* @brief Bullet event module.
+*
+* @{
+*/
+
+
+/**
+ * @brief Bullet event to transmit from remote to host.
+ */
+typedef struct {
+    /// @brief New bullet signal from remote
+    bool   new_bullet;
+} bullet_info_t;
+/**
+ * @brief Construct bullet event.
+ * @return  Pointer to constructed bullet event, or NULL if failed
+ */
+bullet_info_t* bullet_info_ctor(void);
+/**
+ * @brief Destruct bullet event.
+ * @param   p   Pointer to bullet event to be destructed
+ */
+void bullet_info_dtor(bullet_info_t *p);
+
+/**
+ * @}
+ */
+
+#endif /* end of include guard: PROJ_STRUCTURES_H_INCLUDED */

Property changes on: proj/project/include/proj_structures.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/scoreboards.h
===================================================================
--- proj/project/include/scoreboards.h	(nonexistent)
+++ proj/project/include/scoreboards.h	(revision 355)
@@ -0,0 +1,60 @@
+#ifndef SCOREBOARD_H_INCLUDED
+#define SCOREBOARD_H_INCLUDED
+
+/**
+ * @defgroup scoreboards scoreboards
+ * @brief Scoreboards module.
+ *
+ * @{
+ */
+
+#include "libs.h"
+#include <stdint.h>
+
+/**
+ * @brief Score.
+ */
+typedef struct  score_info score_info_t;
+
+/**
+ * @brief Table of highscores.
+ */
+typedef struct highscores highscores_t;
+/**
+ * @brief Construct score.
+ * @param   score           Game score.
+ * @param   time_played     Time elapsed on game.
+ * @return      Pointer to constructed score, or NULL if failed.
+ */
+score_info_t* (score_ctor)(int score, int time_played);
+
+/**
+ * @brief Destruct score.
+ * @param   p   Pointer to score to destruct
+ */
+void (score_dtor)(score_info_t *p);
+
+/**
+ * @brief Construct highscores.
+ * @param   fnt     Font to use when rendering highscores text
+ * @param   path    Path to file to be read with highscores values.
+ * @return      Pointer to constructed highscores, or NULL if failed.
+ */
+highscores_t* (highscores_ctor)(const font_t *fnt, const char *path);
+/**
+ * @brief Save highscore into file.
+ * @param f     Path to file to be written
+ */
+void (highscores_save)(const highscores_t *p, const char *path);
+/**
+ * @brief Destruct menu.
+ * @param   p   Pointer to menu to destruct
+ */
+void (highscores_dtor)(highscores_t *p);
+
+/**
+ * @}
+ */
+
+
+#endif /* end of include guard: SCOREBOARD_H_INCLUDED */

Property changes on: proj/project/include/scoreboards.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/singleplayer.h
===================================================================
--- proj/project/include/singleplayer.h	(nonexistent)
+++ proj/project/include/singleplayer.h	(revision 355)
@@ -0,0 +1,6 @@
+#ifndef SINGLEPLAYER_H_INCLUDED
+#define SINGLEPLAYER_H_INCLUDED
+
+int (singleplayer)(void);
+
+#endif //SINGLEPLAYER_H_INCLUDED

Property changes on: proj/project/include/singleplayer.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/include/zombies.h
===================================================================
--- proj/project/include/zombies.h	(nonexistent)
+++ proj/project/include/zombies.h	(revision 355)
@@ -0,0 +1,6 @@
+#ifndef ZOMBIES_H_INCLUDED
+#define ZOMBIES_H_INCLUDED
+
+int (zombies)(void);
+
+#endif //ZOMBIES_H_INCLUDED

Property changes on: proj/project/include/zombies.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/campaign.c
===================================================================
--- proj/project/src/campaign.c	(nonexistent)
+++ proj/project/src/campaign.c	(revision 355)
@@ -0,0 +1,121 @@
+#include <lcom/lcf.h>
+
+#include "campaign.h"
+
+#include "proj.h"
+
+#include "proj_macros.h"
+#include "proj_func.h"
+#include "ent.h"
+#include "interrupts_func.h"
+
+#include "libs.h"
+
+#include <math.h>
+
+int (campaign)(void){
+
+    int r;
+
+    ent_set_scale(DEFAULT_SCALE);
+    text_timer_t *in_game_timer = text_timer_ctor(font_get_default());
+
+    list_t *shooter_list = list_ctor();
+
+    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
+    gunner_set_spawn(shooter1, 75, 75);
+    gunner_set_pos(shooter1, 75, 75);
+
+    gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing, GUNNER_PLAYER, 2);
+    gunner_set_spawn(shooter2, 975, 75);
+    gunner_set_pos(shooter2, 775, 75);
+
+    list_insert(shooter_list, list_end(shooter_list), shooter1);
+    list_insert(shooter_list, list_end(shooter_list), shooter2);
+
+    list_t *bullet_list  = list_ctor();
+
+    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+
+    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
+    uint8_t last_lb = 0;
+    struct packet pp;
+    keys_t *keys = get_key_presses();
+
+    /// loop stuff
+    uint64_t int_vector = 0;
+    int good = true;
+    while (good) {
+        /* Get a request message. */
+        if((r = get_interrupts_vector(&int_vector))) return r;
+        uint32_t n = 1;
+        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
+            if(!good) break;
+            if (int_vector & n) {
+                interrupt_handler(i);
+                switch (i) {
+                    case TIMER0_IRQ:
+
+                    if (timer_get_no_interrupts() % 60 == 0) text_timer_update(in_game_timer);
+                    update_movement(map1, shooter1, keys, shooter_list);
+
+                    update_game_state(map1, shooter_list, bullet_list);
+
+                    //update_scale();
+                    double angle = get_mouse_angle(shooter1);
+                    gunner_set_angle(shooter1, angle - M_PI_2);
+
+                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+                    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+
+                    graph_clear_screen();
+                    map_draw   (map1);
+                    bullet_draw_list(bullet_list);
+                    gunner_draw_list(shooter_list);
+
+                    text_draw(in_game_timer->text);
+
+                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
+                    sprite_draw(sp_crosshair);
+                    graph_draw();
+
+                    break;
+                    case KBC_IRQ:
+                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
+                        good = false;
+                    }
+                    break;
+                    case MOUSE_IRQ:
+                    if (mouse_get_counter_mouse_ih() >= 3) {
+                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
+                        update_mouse(&pp);
+                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed)
+                        shoot_bullet(shooter1, bullet_list, bsp_bullet);
+                        last_lb = keys->lb_pressed;
+                        mouse_set_counter_mouse_ih(0);
+
+                    }
+                    break;
+                    case COM1_IRQ: nctp_ih(); break;
+                }
+            }
+        }
+    }
+
+    while(list_size(shooter_list) > 0){
+        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
+        gunner_dtor(p);
+    }
+    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
+
+    while(list_size(bullet_list) > 0){
+        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
+        bullet_dtor(p);
+    }
+    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
+
+    text_timer_dtor(in_game_timer); in_game_timer = NULL;
+
+    return SUCCESS;
+}

Property changes on: proj/project/src/campaign.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/chat.c
===================================================================
--- proj/project/src/chat.c	(nonexistent)
+++ proj/project/src/chat.c	(revision 355)
@@ -0,0 +1,186 @@
+#include <lcom/lcf.h>
+
+#include "chat.h"
+
+#include "proj.h"
+
+#include "proj_macros.h"
+#include "proj_func.h"
+#include "ent.h"
+#include "interrupts_func.h"
+#include "libs.h"
+#include "makecode_map.h"
+#include <math.h>
+
+#include "hltp.h"
+
+#define CHAT_MAX_SIZE   75
+#define CHAT_MAX_NUM    19
+static text_t      *t_text[CHAT_MAX_NUM] = {NULL};
+static rectangle_t *r_text               =  NULL;
+
+static void chat_process(const uint8_t *p, const size_t sz){
+    char buffer2[CHAT_MAX_NUM+3];
+    void *dest = NULL;
+    hltp_type tp = hltp_interpret(p, sz, &dest);
+    switch(tp){
+        case hltp_type_string:
+        strcpy(buffer2, dest);
+        strncat(buffer2, " <", 2);
+        for(size_t i = CHAT_MAX_NUM-1; i; --i)
+        text_set_string(t_text[i], text_get_string(t_text[i-1]));
+        text_set_string(t_text[0], buffer2);
+        for(size_t i = 0; i < CHAT_MAX_NUM; ++i){
+            if(text_get_string(t_text[i])[0] == '>'){
+                text_set_pos(t_text[i], rectangle_get_x(r_text)+50, text_get_y(t_text[i]));
+                text_set_halign(t_text[i], text_halign_left);
+            }else{
+                text_set_pos(t_text[i], rectangle_get_x(r_text)+rectangle_get_w(r_text)-50, text_get_y(t_text[i]));
+                text_set_halign(t_text[i], text_halign_right);
+            }
+        }
+        break;
+        case hltp_type_invalid: break;
+        case hltp_type_bullet : break;
+        case hltp_type_host   : break;
+        case hltp_type_remote : break;
+    }
+}
+
+int (chat)(void){
+    int r;
+
+    nctp_dump();
+    nctp_set_processor(chat_process);
+
+    struct packet pp;
+
+    char buffer[CHAT_MAX_SIZE] = "";
+    rectangle_t *r_buffer = NULL; {
+        r_buffer = rectangle_ctor(0,0,900,70);
+        rectangle_set_pos(r_buffer, graph_get_XRes()/2  -rectangle_get_w(r_buffer)/2,
+        (int16_t)(graph_get_YRes()*0.87-rectangle_get_h(r_buffer)/2));
+        rectangle_set_fill_color   (r_buffer, GRAPH_BLACK);
+        rectangle_set_outline_width(r_buffer, 2);
+        rectangle_set_outline_color(r_buffer, GRAPH_WHITE);
+        rectangle_set_fill_trans(r_buffer, GRAPH_TRANSPARENT);
+    }
+    text_t      *t_buffer = NULL; {
+        t_buffer = text_ctor(font_get_default(), "");
+        text_set_pos(t_buffer, rectangle_get_x(r_buffer)+50,
+        rectangle_get_y(r_buffer)+rectangle_get_h(r_buffer)/2);
+        text_set_halign(t_buffer, text_halign_left);
+        text_set_valign(t_buffer, text_valign_center);
+        text_set_color (t_buffer, TEXT_COLOR);
+    }
+    text_t      *t_size   = NULL; {
+        t_size = text_ctor(font_get_default(), "");
+        text_set_pos(t_size, rectangle_get_x(r_buffer)+rectangle_get_w(r_buffer)-5,
+        rectangle_get_y(r_buffer)+rectangle_get_h(r_buffer)-5);
+        text_set_halign(t_size, text_halign_right);
+        text_set_valign(t_size, text_valign_bottom);
+        text_set_color (t_size, TEXT_COLOR);
+        text_set_size  (t_size, 18);
+        char buffer2[20];
+        sprintf(buffer2, "%d/%d", strlen(buffer), CHAT_MAX_SIZE);
+        text_set_string(t_size, buffer2);
+    }
+
+    /** r_text */ {
+    r_text = rectangle_ctor(0,0,900,550);
+    rectangle_set_pos(r_text, graph_get_XRes()/2  -rectangle_get_w(r_buffer)/2,
+    (int16_t)(graph_get_YRes()*0.09));
+    rectangle_set_fill_color   (r_text, GRAPH_BLACK);
+    rectangle_set_outline_width(r_text, 2);
+    rectangle_set_outline_color(r_text, GRAPH_WHITE);
+    rectangle_set_fill_trans(r_text, GRAPH_TRANSPARENT);
+    }
+    /** t_text */ {
+    for(uint16_t i = 0; i < CHAT_MAX_NUM; ++i){
+        t_text[i] = text_ctor(font_get_default(), " ");
+        text_set_pos(t_text[i], rectangle_get_x(r_text)+50,
+        rectangle_get_y(r_text)+rectangle_get_h(r_text)-30-25*i);
+        text_set_halign(t_text[i], text_halign_left);
+        text_set_valign(t_text[i], text_valign_bottom);
+        text_set_color (t_text[i], TEXT_COLOR);
+    }
+}
+
+/// loop stuff
+uint64_t int_vector = 0;
+int good = true;
+while (good) {
+    /* Get a request message. */
+    if((r = get_interrupts_vector(&int_vector))) return r;
+    uint32_t n = 1;
+    for (uint8_t i = 0; i < 32; i++, n <<= 1) {
+        if (int_vector & n) {
+            interrupt_handler(i);
+            switch (i) {
+                case TIMER0_IRQ:
+                graph_clear_screen();
+                sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
+
+                rectangle_draw(r_buffer);
+                text_draw(t_buffer);
+                text_draw(t_size);
+
+                rectangle_draw(r_text);
+                for(size_t j = 0; j < CHAT_MAX_NUM; ++j) text_draw(t_text[j]);
+
+                sprite_draw(sp_crosshair);
+                graph_draw();
+                break;
+                case KBC_IRQ:
+                if      (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
+                else if (keyboard_get_scancode()[0] == ENTER_MAKE_CODE) {
+                    hltp_send_string(buffer);
+                    char buffer2[CHAT_MAX_SIZE+3] = "> ";
+                    strncat(buffer2, buffer, strlen(buffer));
+                    for(size_t j = CHAT_MAX_NUM-1; j; --j) text_set_string(t_text[i], text_get_string(t_text[i-1]));
+                    text_set_string(t_text[0], buffer2);
+                    for(size_t j = 0; j < CHAT_MAX_NUM; ++j){
+                        if(text_get_string(t_text[j])[0] == '>'){
+                            text_set_pos(t_text[j], rectangle_get_x(r_text)+50, text_get_y(t_text[j]));
+                            text_set_halign(t_text[j], text_halign_left);
+                        }else{
+                            text_set_pos(t_text[j], rectangle_get_x(r_text)+rectangle_get_w(r_text)-50, text_get_y(t_text[j]));
+                            text_set_halign(t_text[j], text_halign_right);
+                        }
+                    }
+                    buffer[0] = '\0';
+                } else if(keyboard_get_scancode()[0] == BACKSPACE_MAKE_CODE){
+                    buffer[strlen(buffer)-1] = '\0';
+                } else {
+                    char c = map_makecode(keyboard_get_scancode()[0]);
+                    if (c == ERROR_CODE) break;
+                    if(strlen(buffer) < CHAT_MAX_SIZE) strncat(buffer, &c, 1);
+                    else                               printf("Char limit exceeded\n");
+                }
+                text_set_string(t_buffer, buffer);
+                char buffer2[20];
+                sprintf(buffer2, "%d/%d", strlen(buffer), CHAT_MAX_SIZE);
+                text_set_string(t_size, buffer2);
+                case MOUSE_IRQ:
+                if (mouse_get_counter_mouse_ih() >= 3) {
+                    mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
+                    update_mouse(&pp);
+                    mouse_set_counter_mouse_ih(0);
+                }
+                break;
+                case COM1_IRQ: nctp_ih(); break;
+            }
+        }
+    }
+}
+
+rectangle_dtor(r_buffer);
+text_dtor     (t_buffer);
+
+rectangle_dtor(r_text);
+for(size_t i = 0; i < CHAT_MAX_NUM; ++i) text_dtor(t_text[i]);
+
+nctp_set_processor(NULL);
+
+return SUCCESS;
+}

Property changes on: proj/project/src/chat.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/ent.c
===================================================================
--- proj/project/src/ent.c	(nonexistent)
+++ proj/project/src/ent.c	(revision 355)
@@ -0,0 +1,377 @@
+#include <lcom/lcf.h>
+
+#include "ent.h"
+
+#include "libs.h"
+#include <math.h>
+
+#define GREEN_HEALTH_COLOR      0x009900
+
+static double scale = 1.0;
+static double x_origin = 0;
+static double y_origin = 0;
+
+void (ent_set_scale) (double n){ scale = n; }
+void (ent_set_origin)(double x, double y){ x_origin = x; y_origin = y; }
+double (ent_get_scale)  (void){ return scale; }
+double (ent_get_XLength)(void){ return graph_get_XRes()/scale; }
+double (ent_get_YLength)(void){ return graph_get_YRes()/scale; }
+
+struct gunner{
+    double x, y; //real position
+    double spawn_x, spawn_y;
+    sprite_t *dude;
+    sprite_t *weapon;
+    double health, current_health;
+    rectangle_t *green_bar, *red_bar;
+    text_t *txt;
+    uint16_t type;
+    int team;
+};
+gunner_t* (gunner_ctor)(basic_sprite_t *dude, basic_sprite_t *weapon, uint16_t type, int team){
+    gunner_t *ret = malloc(sizeof(gunner_t));
+    if(ret == NULL) return NULL;
+    ret->spawn_x = 0.0;
+    ret->spawn_y = 0.0;
+    ret->x = 0.0;
+    ret->y = 0.0;
+    ret->health = 100;
+    ret->current_health = ret->health;
+    ret->green_bar = rectangle_ctor(0,0,0,0);
+    ret->red_bar   = rectangle_ctor(0,0,0,0);
+    ret->txt = text_ctor(font_get_default(), "");
+    ret->type = type;
+    ret->team = team;
+    ret->dude   = sprite_ctor(dude  );
+    ret->weapon = sprite_ctor(weapon);
+    if(ret->txt == NULL || ret->dude == NULL || ret->weapon == NULL || ret->green_bar == NULL || ret->red_bar == NULL){
+        gunner_dtor(ret);
+        return NULL;
+    }
+    rectangle_set_fill_color(ret->green_bar, GREEN_HEALTH_COLOR);
+    rectangle_set_fill_color(ret->red_bar  , GRAPH_RED         );
+    text_set_size(ret->txt, 15);
+    text_set_valign(ret->txt, text_valign_center);
+    text_set_halign(ret->txt, text_halign_center);
+    text_set_color(ret->txt, GRAPH_WHITE);
+    return ret;
+}
+void (gunner_dtor)(gunner_t *p){
+    if(p == NULL) return;
+    sprite_dtor(p->dude);
+    sprite_dtor(p->weapon);
+    rectangle_dtor(p->green_bar);
+    rectangle_dtor(p->red_bar);
+    text_dtor(p->txt);
+    free(p);
+}
+void (gunner_set_pos)  (gunner_t *p, double x, double y){ p->x = x; p->y = y; }
+void (gunner_set_spawn)  (gunner_t *p, double x, double y){ p->spawn_x = x; p->spawn_y = y; }
+void (gunner_set_angle)(gunner_t *p, double angle      ){
+    sprite_set_angle(p->dude  , angle);
+    sprite_set_angle(p->weapon, angle);
+}
+void (gunner_set_health)        (gunner_t *p, double health) {
+    if (health < 0) health = 0;
+    p->health = health;
+}
+void (gunner_set_curr_health)   (gunner_t *p, double health) {
+    if (health < 0) health = 0;
+    p->current_health = health;
+}
+double  (gunner_get_x)              (const gunner_t *p){ return p->x; }
+double  (gunner_get_y)              (const gunner_t *p){ return p->y; }
+double  (gunner_get_spawn_x)        (const gunner_t *p){ return p->spawn_x; }
+double  (gunner_get_spawn_y)        (const gunner_t *p){ return p->spawn_y; }
+double  (gunner_get_angle)          (const gunner_t *p){ return sprite_get_angle(p->dude); }
+double  (gunner_get_health)         (const gunner_t *p){ return p->health; }
+double  (gunner_get_curr_health)    (const gunner_t *p){ return p->current_health; }
+int16_t (gunner_get_x_screen)       (const gunner_t *p){ return (int16_t)((p->x-x_origin)*scale); }
+int16_t (gunner_get_y_screen)       (const gunner_t *p){ return (int16_t)((p->y-y_origin)*scale); }
+uint16_t (gunner_get_type)          (const gunner_t *p){ return p->type; }
+int     (gunner_get_team)           (const gunner_t *p){ return p->team; }
+void (gunner_draw)(gunner_t *p){
+    const int16_t x_screen = gunner_get_x_screen(p);
+    const int16_t y_screen = gunner_get_y_screen(p);
+    sprite_set_pos  (p->dude  , x_screen, y_screen);
+    sprite_set_pos  (p->weapon, x_screen, y_screen);
+    sprite_set_scale(p->dude  , scale);
+    sprite_set_scale(p->weapon, scale);
+    sprite_draw     (p->weapon);
+    sprite_draw     (p->dude  );
+    gunner_draw_health(p);
+}
+void (gunner_draw_health)(const gunner_t *p) {
+    const uint16_t w = sprite_get_w(p->dude);
+    const uint16_t h = sprite_get_h(p->dude);
+    int16_t x = gunner_get_x_screen(p) - w/2;
+    int16_t y = gunner_get_y_screen(p) - h/2 - 10;
+    double curr_health = gunner_get_curr_health(p);
+    double health = gunner_get_health(p);
+    double perc = curr_health/health;
+    rectangle_set_pos(p->green_bar, x, y); rectangle_set_size(p->green_bar, (uint16_t)(w*perc), 10);
+    rectangle_set_pos(p->red_bar, x+(int16_t)(w*perc), y); rectangle_set_size(p->red_bar, (uint16_t)(w*(1.0-perc)), 10);
+    char buf[20]; sprintf(buf, "%d/%d", (int)p->current_health, (int)p->health);
+    text_set_string(p->txt, buf);
+    text_set_pos(p->txt, x+w/2, y+10/2);
+    rectangle_draw(p->green_bar);
+    rectangle_draw(p->red_bar);
+    text_draw(p->txt);
+}
+void (gunner_draw_list)(list_t *shooter_list) {
+    if (list_size(shooter_list) == 0) return;
+
+    list_node_t *it = list_begin(shooter_list);
+    while (it != list_end(shooter_list)) {
+        gunner_draw(*(gunner_t**)list_node_val(it));
+        it = list_node_next(it);
+    }
+}
+double (gunner_distance)(const gunner_t *p1, const gunner_t *p2){
+    double dx = gunner_get_x(p1) - gunner_get_x(p2);
+    double dy = gunner_get_y(p1) - gunner_get_y(p2);
+    return sqrt(dx*dx+dy*dy);
+}
+int (gunner_collides_gunner)(const gunner_t *p1, const gunner_t *p2) {
+    if (p1 == p2) return false;
+    double p1_radius = max_d(sprite_get_w(p1->dude), sprite_get_h(p1->dude))/2.0;
+    double p2_radius = max_d(sprite_get_w(p2->dude), sprite_get_h(p2->dude))/2.0;
+    double distance = gunner_distance(p1, p2);
+    return distance <= p1_radius+p2_radius;
+}
+
+struct bullet{
+    const gunner_t *shooter;
+    double x, y; //real position
+    double vx, vy;
+    sprite_t *b;
+    double damage;
+};
+bullet_t* (bullet_ctor)(const gunner_t *shooter, const basic_sprite_t *b, double x, double y, double vx, double vy){
+    bullet_t *ret = malloc(sizeof(bullet_t));
+    if(ret == NULL) return NULL;
+    ret->shooter = shooter;
+    ret-> x =  x;
+    ret-> y =  y;
+    ret->vx = vx;
+    ret->vy = vy;
+    ret->damage = 10;
+    ret->b = sprite_ctor(b);
+    if(ret->b == NULL){
+        bullet_dtor(ret);
+        return NULL;
+    }
+    double angle = atan2(-ret->vy, ret->vx);
+    sprite_set_angle(ret->b, angle-M_PI_2);
+    return ret;
+}
+void (bullet_dtor)(bullet_t *p){
+    if(p == NULL) return;
+    sprite_dtor(p->b);
+    free(p);
+}
+double  (bullet_get_x)       (const bullet_t *p){ return p->x; }
+double  (bullet_get_y)       (const bullet_t *p){ return p->y; }
+double  (bullet_get_vx)      (const bullet_t *p){ return p->vx; }
+double  (bullet_get_vy)      (const bullet_t *p){ return p->vy; }
+int16_t (bullet_get_x_screen)(const bullet_t *p){ return (int16_t)((p->x-x_origin)*scale); }
+int16_t (bullet_get_y_screen)(const bullet_t *p){ return (int16_t)((p->y-y_origin)*scale); }
+double  (bullet_get_damage)  (const bullet_t *p){ return p->damage; }
+void    (bullet_set_damage)  (bullet_t *p, double damage) {
+    if (damage < 0) damage = 0;
+    p->damage = damage;
+}
+const gunner_t* (bullet_get_shooter)(const bullet_t *p){ return p->shooter; }
+void (bullet_update_movement)(bullet_t *p){
+    p->x += p->vx;
+    p->y += p->vy;
+}
+void (bullet_update_movement_list)(list_t *bullet_list){
+    if (list_size(bullet_list) == 0) return;
+
+    list_node_t *it = list_begin(bullet_list);
+    while (it != list_end(bullet_list)) {
+        bullet_update_movement(*(bullet_t**)list_node_val(it));
+        it = list_node_next(it);
+    }
+}
+void (bullet_draw)(bullet_t *p){
+    const int16_t x_screen = bullet_get_x_screen(p);
+    const int16_t y_screen = bullet_get_y_screen(p);
+    sprite_set_pos  (p->b, x_screen, y_screen);
+    sprite_set_scale(p->b, scale);
+    sprite_draw     (p->b);
+}
+void (bullet_draw_list)(list_t *bullet_list) {
+    if (list_size(bullet_list) == 0) return;
+
+    list_node_t *it = list_begin(bullet_list);
+    while (it != list_end(bullet_list)) {
+        bullet_draw(*(bullet_t**)list_node_val(it));
+        it = list_node_next(it);
+    }
+}
+
+struct map{
+    basic_sprite_t *bsp_background;
+    sprite_t *background;
+    uint8_t *collide;
+    uint8_t *collide_gunner;
+    int32_t *prev;
+    uint8_t *visited;
+};
+static int (map_collides_gunner_pos)(const map_t *p, double shooter_x, double shooter_y, double radius) {
+    for (double x = -radius; x <= radius; x += 1) {
+        double y1 = sqrt(radius*radius - x*x);
+        double y2 = -y1;
+        if (map_collides_point(p, shooter_x + x, shooter_y + y1) || map_collides_point(p, shooter_x + x, shooter_y + y2)) return 1;
+    }
+    return 0;
+}
+static int16_t (map_get_x_screen)(const map_t *p){ (void)p; return (int16_t)((-x_origin)*scale); }
+static int16_t (map_get_y_screen)(const map_t *p){ (void)p; return (int16_t)((-y_origin)*scale); }
+map_t* (map_ctor)(const char *const *background, const char *const *collide){
+    map_t *ret = malloc(sizeof(map_t));
+    if(ret == NULL) return NULL;
+
+    ret->bsp_background = NULL;
+    ret->background     = NULL;
+    ret->collide        = NULL;
+    ret->prev           = NULL;
+    ret->visited        = NULL;
+
+    ret->bsp_background = basic_sprite_ctor(background, 0, 0);
+    ret->background     = sprite_ctor(ret->bsp_background);
+    if(ret->bsp_background == NULL ||
+       ret->background     == NULL){ map_dtor(ret); return NULL; }
+
+    basic_sprite_t *bsp_collide = basic_sprite_ctor(collide, 0, 0);
+    if(bsp_collide == NULL){ map_dtor(ret); return NULL; }
+    const uint16_t W = basic_sprite_get_w(bsp_collide);
+    const uint16_t H = basic_sprite_get_h(bsp_collide);
+    ret->collide = malloc(W*H*sizeof(uint8_t));
+    if(ret->collide == NULL){ map_dtor(ret); return NULL; }
+    const uint8_t *m = basic_sprite_get_map(bsp_collide);
+    for(unsigned i = 0; i < W*H; ++i){
+        ret->collide[i] = (m[4*i+3] < ALPHA_THRESHOLD ? 1 : 0);
+    }
+    basic_sprite_dtor(bsp_collide);
+
+    ret->collide_gunner = malloc(W*H*sizeof(uint8_t));
+    if(ret->collide_gunner == NULL){ map_dtor(ret); return NULL; }
+    for(size_t i = 0; i < W*H; ++i){
+        uint16_t x = i%W, y = (uint16_t)(i/W);
+        ret->collide_gunner[i] = (map_collides_gunner_pos(ret, x, y, 36) ? 1 : 0);
+    }
+
+    ret->prev = malloc(W*H*sizeof(int32_t));
+    ret->visited = malloc(W*H*sizeof(uint8_t));
+
+    if(ret->prev == NULL || ret->visited == NULL){
+        map_dtor(ret);
+        return NULL;
+    }
+    return ret;
+}
+void (map_dtor)(map_t *p){
+    if(p == NULL) return;
+    sprite_dtor(p->background);
+    basic_sprite_dtor(p->bsp_background);
+    free(p->collide);
+    free(p->prev);
+    free(p->visited);
+    free(p);
+}
+uint16_t (map_get_width)   (const map_t *p){ return sprite_get_w(p->background); }
+uint16_t (map_get_height)  (const map_t *p){ return sprite_get_h(p->background); }
+int (map_make_dijkstra)(map_t *p, double x_, double y_){
+    int16_t x = (int16_t)x_, y = (int16_t)y_;
+
+    const uint16_t W = basic_sprite_get_w(p->bsp_background),
+                   H = basic_sprite_get_h(p->bsp_background);
+
+    static uint8_t first_time = true;
+    if(first_time){
+        for(size_t i = 0; i < W*H; ++i) p->prev[i] = -1;
+        first_time = false;
+    }
+    /// ACTUAL DIJKSTRA
+    queue_t *q = queue_ctor();
+
+    memset(p->visited, false, W*H*sizeof(uint8_t));
+
+    int *ptr;
+    int32_t c, pos;
+    c = y*W+x; p->prev[c] = c; ptr = malloc(sizeof(int)); *ptr = c; queue_push(q, ptr);
+
+    while(!queue_empty(q)){
+        c = *(int*)queue_top(q); free(queue_top(q)); queue_pop(q);
+        x = (int16_t)(c%W), y = (int16_t)(c/W);
+        if(p->visited[c]) continue;
+        p->visited[c] = true;
+        if(p->collide_gunner[c]) continue;
+        if(0   <= x-1){ pos = y*W+(x-1); if(!p->visited[pos] && p->prev[pos] != c){ p->prev[pos] = c; ptr = malloc(sizeof(int)); *ptr = pos; queue_push(q, ptr); }}
+        if(x+1 <  W  ){ pos = y*W+(x+1); if(!p->visited[pos] && p->prev[pos] != c){ p->prev[pos] = c; ptr = malloc(sizeof(int)); *ptr = pos; queue_push(q, ptr); }}
+        if(0   <= y-1){ pos = (y-1)*W+x; if(!p->visited[pos] && p->prev[pos] != c){ p->prev[pos] = c; ptr = malloc(sizeof(int)); *ptr = pos; queue_push(q, ptr); }}
+        if(y+1 <  H  ){ pos = (y+1)*W+x; if(!p->visited[pos] && p->prev[pos] != c){ p->prev[pos] = c; ptr = malloc(sizeof(int)); *ptr = pos; queue_push(q, ptr); }}
+    }
+
+    queue_dtor(q);
+
+    return SUCCESS;
+}
+int (map_where_to_follow)(const map_t *p, double x, double y, double *theta){
+    const uint16_t W = basic_sprite_get_w(p->bsp_background);
+    int16_t x_ = (int16_t)x, y_ = (int16_t)y;
+    int32_t pos = y_*W+x_;
+    int16_t newx = (int16_t)(p->prev[pos]%W), newy = (int16_t)(p->prev[pos]/W);
+    *theta = atan2(-(newy-y_), newx-x_);
+    return SUCCESS;
+}
+void   (map_draw)(map_t *p){
+    const int16_t x_screen = map_get_x_screen(p);
+    const int16_t y_screen = map_get_y_screen(p);
+    sprite_set_pos  (p->background, x_screen, y_screen);
+    sprite_set_scale(p->background, scale);
+    sprite_draw     (p->background);
+}
+int (map_collides_point)(const map_t *p, double x, double y){
+    const uint16_t w = sprite_get_w(p->background), h = sprite_get_h(p->background);
+    int16_t x_ = (int16_t)x, y_ = (int16_t)y;
+    if(x_ < 0 || w <= x_ || y_ < 0 || h <= y_) return 0;
+    int32_t pos = x_ + y_*w;
+    if(0 <= pos && pos < w*h) return p->collide[pos];
+    else return false;
+}
+
+int (map_collides_gunner)(const map_t *p, const gunner_t *shooter) {
+    double radius = max_d(sprite_get_w(shooter->dude), sprite_get_h(shooter->dude))/2.0;
+    return map_collides_gunner_pos(p, gunner_get_x(shooter), gunner_get_y(shooter), radius);
+}
+int (map_collides_bullet)(const map_t *p, const bullet_t *bull){
+    double radius = max_d(sprite_get_w(bull->b), sprite_get_h(bull->b))/2.0;
+    double bullet_x = bullet_get_x(bull);
+    double bullet_y = bullet_get_y(bull);
+    for (double x = -radius; x < radius; x += 1){
+        double y1 = sqrt(radius*radius - x*x);
+        double y2 = -y1;
+        if (map_collides_point(p, bullet_x + x, bullet_y + y1) || map_collides_point(p, bullet_x + x, bullet_y + y2)) return 1;
+    }
+    return 0;
+}
+int (gunner_collides_bullet)(const gunner_t *shooter, const bullet_t *bull){
+    if(bull->shooter == shooter) return false;
+
+    double shooter_radius = max_d(sprite_get_w(shooter->dude), sprite_get_h(shooter->dude))/2.0;
+    double shooter_x = gunner_get_x(shooter);
+    double shooter_y = gunner_get_y(shooter);
+
+    double bullet_radius = max_d(sprite_get_w(bull->b), sprite_get_h(bull->b))/2.0;
+    double bullet_x = bullet_get_x(bull);
+    double bullet_y = bullet_get_y(bull);
+
+    double dx = shooter_x - bullet_x;
+    double dy = shooter_y - bullet_y;
+    double distance = sqrt(dx*dx + dy*dy);
+    return distance <= shooter_radius+bullet_radius;
+}

Property changes on: proj/project/src/ent.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/interrupts_func.c
===================================================================
--- proj/project/src/interrupts_func.c	(nonexistent)
+++ proj/project/src/interrupts_func.c	(revision 355)
@@ -0,0 +1,214 @@
+#include <lcom/lcf.h>
+
+#include "interrupts_func.h"
+#include "timer.h"
+#include "keyboard.h"
+#include "mouse.h"
+#include "hltp.h"
+#include "utils.h"
+#include "errors.h"
+
+static int timer_subscribed = 0, timer_id;
+
+static int keyboard_subscribed = 0, kbc_id;
+
+static int mouse_subscribed = 0, mouse_id;
+
+static int uart_subscribed = 0, uart_id;
+
+static void (*const ih[])(void) =   {    timer_int_handler,
+                                         kbc_ih,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         mouse_ih,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                         NULL,
+                                     };
+/*
+static void process_received(const uint8_t *p, const size_t sz){
+    void *q = NULL;
+    hltp_type t = hltp_interpret(p, sz, &q);
+    switch(t){
+        case hltp_type_string:{
+            char *s = q;
+            printf("%s\n", s);
+        } break;
+        default: break;
+    }
+}
+*/
+int (subscribe_all)(void) {
+
+    /// Timer interrupt handling
+    timer_id = 0;
+    if(subscribe_timer_interrupt(TIMER0_IRQ, &timer_id)) {
+        printf("%s: failed to subscribe timer interrupts.\n", __func__);
+        return SBCR_ERROR;
+    }
+    timer_subscribed = 1;
+
+    /// Keyboard interrupt handling
+    kbc_id = 0;
+    if (subscribe_kbc_interrupt(KBC_IRQ, &kbc_id)) {
+        printf("%s: failed to subscribe keyboard interrupts.\n", __func__);
+        if (unsubscribe_all())
+            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
+        return SBCR_ERROR;
+    }
+    keyboard_subscribed = 1;
+
+    /// Mouse interrupt handling
+    mouse_id = 0;
+    if (subscribe_mouse_interrupt(MOUSE_IRQ, &mouse_id)) { // subscribes mouse interrupts in exclusive mode
+        printf("%s: failed to subscribe mouse interrupts.\n", __func__);
+        if (unsubscribe_all())
+            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
+        return SBCR_ERROR;
+    }
+    mouse_subscribed = 1;
+    if (sys_irqdisable(&mouse_id)) { // temporarily disables our interrupts notifications
+        printf("%s: failed to disable mouse interrupts.\n", __func__);
+        if (unsubscribe_all())
+            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
+        return SBCR_ERROR;
+    }
+    if (mouse_set_data_report(true)) { // enables mouse data reporting
+        printf("%s: failed to enable mouse data reporting.\n", __func__);
+        if (unsubscribe_all())
+            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
+        return SBCR_ERROR;
+    }
+    if (sys_irqenable(&mouse_id)) { // re-enables our interrupts notifications
+        printf("%s: failed to enable mouse interrupts.\n", __func__);
+        if (unsubscribe_all())
+            printf("%s: failed to unsubcribe driver, unexpected behaviour is expected.\n", __func__);
+        return SBCR_ERROR;
+    }
+
+    /// UART interrupt handling
+    uart_id = 0;
+    uart_set_bits_per_character(COM1_ADDR, 8);
+    uart_set_stop_bits         (COM1_ADDR, 2);
+    uart_set_parity            (COM1_ADDR, uart_parity_even);
+    uart_set_bit_rate          (COM1_ADDR, 115200);
+    uart_enable_int_rx (COM1_ADDR);
+    uart_enable_int_tx(COM1_ADDR);
+    if(subscribe_uart_interrupt(COM1_IRQ, &uart_id)) {
+        printf("%s: failed to subscribe UART interrupts.\n", __func__);
+        return SBCR_ERROR;
+    }
+    uart_subscribed = 1;
+    nctp_init();
+
+    return SUCCESS;
+}
+
+int (unsubscribe_all)(void) {
+    int r = SUCCESS;
+
+    // Unsubscribe Timer Interrupts
+    if (timer_subscribed) {
+        if (unsubscribe_interrupt(&timer_id)) {
+            printf("%s: failed to unsubcribe timer interrupts.\n", __func__);
+            r = UNSBCR_ERROR;
+        }
+        timer_subscribed = 0;
+    }
+
+    // Unsubscribe Keyboard interrupts
+    if (keyboard_subscribed) {
+        if (unsubscribe_interrupt(&kbc_id)) {
+            printf("%s: failed to unsubcribe keyboard interrupts.\n", __func__);
+            r = UNSBCR_ERROR;
+        }
+        keyboard_subscribed = 0;
+    }
+
+    // Unsubscribe Mouse Interrupts
+    if (mouse_subscribed) {
+        if (sys_irqdisable(&mouse_id)) { // temporarily disables our interrupts notifications
+            printf("%s: failed to disable mouse interrupts.\n", __func__);
+            r = UNSBCR_ERROR;
+        }
+        if (mouse_set_data_report(false)) { // disables mouse data reporting
+            printf("%s: failed to disable mouse data reporting.\n", __func__);
+            r = UNSBCR_ERROR;
+        }
+        if (sys_irqenable(&mouse_id)) { // re-enables our interrupts notifications
+            printf("%s: failed to enable mouse interrupts.\n", __func__);
+            r = UNSBCR_ERROR;
+        }
+        if (unsubscribe_interrupt(&mouse_id)) { // unsubscribes interrupts
+            printf("%s: failed to unsubcribe mouse interrupts.\n", __func__);
+            r = UNSBCR_ERROR;
+        }
+        mouse_subscribed = 0;
+    }
+
+    // Unsubscribe UART interrupts
+    if (uart_subscribed) {
+        if (unsubscribe_interrupt(&uart_id)) {
+            printf("%s: failed to unsubcribe UART interrupts.\n", __func__);
+            r = UNSBCR_ERROR;
+        }
+        uart_enable_int_rx(COM1_ADDR);
+        uart_enable_int_tx(COM1_ADDR);
+        uart_subscribed = 0;
+    }
+    nctp_free();
+
+    return r;
+}
+
+void (interrupt_handler)(uint8_t handler) {
+    if (handler >= 32)              return;
+    if ((ih[handler]) == NULL)      return;
+    (*ih[handler])();
+}
+
+int get_interrupts_vector(uint64_t *p){
+    int r;
+
+    *p = 0;
+
+    int ipc_status;
+    message msg;
+    if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
+        printf("driver_receive failed with %d", r);
+        return OTHER_ERROR;
+    }
+    if (is_ipc_notify(ipc_status)) { /* received notification */
+        switch (_ENDPOINT_P(msg.m_source)) {
+            case HARDWARE: /* hardware interrupt notification */
+                *p = msg.m_notify.interrupts;
+                return SUCCESS;
+            default: break; /* no other notifications expected: do nothing */
+        }
+    }
+    return SUCCESS;
+}

Property changes on: proj/project/src/interrupts_func.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/makecode_map.c
===================================================================
--- proj/project/src/makecode_map.c	(nonexistent)
+++ proj/project/src/makecode_map.c	(revision 355)
@@ -0,0 +1,15 @@
+#include <lcom/lcf.h>
+
+#include "makecode_map.h"
+
+static const char makecode_map[] = {ERROR_CODE, ERROR_CODE, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '\'', ERROR_CODE /*«*/, ERROR_CODE /*escape*/,
+                                    ERROR_CODE /*tab*/, 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '+', ERROR_CODE /* ´ */, ERROR_CODE /*enter*/,
+                                    ERROR_CODE /*ctrl*/, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ERROR_CODE /* Ç */, ERROR_CODE /* º */, '\\', ERROR_CODE /*lshift*/, '~',
+                                    'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', '-', ERROR_CODE /*rshift*/, ERROR_CODE /*unkown*/, ERROR_CODE /*alt*/, ' ' /*space*/};
+
+static const int size = sizeof(makecode_map);
+
+char (map_makecode)(uint8_t code) {
+    if (code < 0 || code >= size) return ERROR_CODE;
+    return makecode_map[code];
+}

Property changes on: proj/project/src/makecode_map.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/proj.c
===================================================================
--- proj/project/src/proj.c	(nonexistent)
+++ proj/project/src/proj.c	(revision 355)
@@ -0,0 +1,535 @@
+#include <lcom/lcf.h>
+#include <lcom/proj.h>
+#include <lcom/liblm.h>
+
+#include "proj.h"
+
+#include <math.h>
+
+#include "proj_macros.h"
+#include "proj_func.h"
+
+#include "interrupts_func.h"
+#include "makecode_map.h"
+
+#include "crosshair.h"
+#include "shooter.h"
+#include "zombie.h"
+#include "pistol.h"
+#include "nothing.h"
+#include "bullet.h"
+#include "map1.h"
+
+#include "hltp.h"
+
+
+int main(int argc, char* argv[]) {
+
+    lcf_set_language("EN-US");
+
+    lcf_trace_calls("/home/lcom/labs/proj/trace.txt");
+
+    lcf_log_output("/home/lcom/labs/proj/output.txt");
+
+    if (lcf_start(argc, argv)) return 1;
+
+    lcf_cleanup();
+
+    return 0;
+}
+
+#include "singleplayer.h"
+static int (multiplayer)(void);
+#include "chat.h"
+int(proj_main_loop)(int argc, char *argv[]) {
+    (void)argc; (void)argv;
+
+    int r;
+
+    if(font_init()){ printf("Failed to initialize fonts\n"); return 1; }
+
+    /// subscribe interrupts
+    if (subscribe_all()) { return 1; }
+
+    /// initialize graphics
+    if(graph_init(GRAPH_MODE)){
+        printf("%s: failed to initalize graphics.\n", __func__);
+        if (cleanup()) printf("%s: failed to cleanup.\n", __func__);
+        return 1;
+    }
+
+    /// Load stuff
+    {
+        graph_clear_screen();
+        text_t *txt = text_ctor(font_get_default(), "Loading...");
+        text_set_pos(txt, graph_get_XRes()/2, graph_get_YRes()/2);
+        text_set_valign(txt, text_valign_center);
+        text_set_halign(txt, text_halign_center);
+        text_set_color(txt, TEXT_COLOR);
+        text_draw(txt);
+        text_dtor(txt);
+        graph_draw();
+
+        bsp_crosshair = get_crosshair(); if(bsp_crosshair == NULL) printf("Failed to get crosshair\n");
+        bsp_shooter   = get_shooter  (); if(bsp_shooter   == NULL) printf("Failed to get shooter\n");
+        bsp_zombie    = get_zombie   (); if(bsp_zombie    == NULL) printf("Failed to get zombie\n");
+        bsp_pistol    = get_pistol   (); if(bsp_pistol    == NULL) printf("Failed to get pistol\n");
+        bsp_nothing   = get_nothing  (); if(bsp_nothing   == NULL) printf("Failed to get nothing\n");
+        bsp_bullet    = get_bullet   (); if(bsp_bullet    == NULL) printf("Failed to get bullet\n");
+        map1          = get_map1     (); if(map1          == NULL) printf("Failed to get map1\n");
+
+        sp_crosshair = sprite_ctor(bsp_crosshair); if(sp_crosshair == NULL) printf("Failed to get crosshair sprite\n");
+    }
+
+    menu_t *main_menu = menu_ctor(font_get_default());
+    menu_add_item(main_menu, "Single player");
+    menu_add_item(main_menu, "Multiplayer");
+    menu_add_item(main_menu, "Chat");
+    menu_add_item(main_menu, "Exit");
+
+    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
+    uint8_t last_lb = 0;
+    struct packet pp;
+    keys_t *keys = get_key_presses();
+
+    /// loop stuff
+    int click = 0;
+    uint64_t int_vector = 0;
+    int good = true;
+    while (good) {
+        /* Get a request message. */
+        if((r = get_interrupts_vector(&int_vector))) return r;
+        uint32_t n = 1;
+        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
+            if (int_vector & n) {
+                interrupt_handler(i);
+                switch (i) {
+                    case TIMER0_IRQ:
+
+                    graph_clear_screen();
+                    switch(menu_update_state(main_menu, click)){
+                        case -1: break;
+                        case  0: singleplayer(); break; //campaign(); break;
+                        case  1: multiplayer() ; break;
+                        case  2: chat(); break;
+                        case  3: good = false; break;
+                    }
+                    menu_draw(main_menu);
+
+                    click = 0;
+
+                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
+                    sprite_draw(sp_crosshair);
+                    graph_draw();
+
+                    break;
+                    case KBC_IRQ:
+                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
+                    case MOUSE_IRQ:
+                    if (mouse_get_counter_mouse_ih() >= 3) {
+                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
+                        update_mouse(&pp);
+                        if (!click) click = last_lb ^ keys->lb_pressed && keys->lb_pressed;
+                        last_lb = keys->lb_pressed;
+                        mouse_set_counter_mouse_ih(0);
+                    }
+                    break;
+                    case COM1_IRQ: nctp_ih(); break;
+                }
+            }
+        }
+    }
+
+    basic_sprite_dtor      (bsp_crosshair); bsp_crosshair = NULL;
+    basic_sprite_dtor      (bsp_shooter  ); bsp_shooter   = NULL;
+    basic_sprite_dtor      (bsp_zombie   ); bsp_zombie    = NULL;
+    sprite_dtor            (sp_crosshair ); sp_crosshair  = NULL;
+    basic_sprite_dtor      (bsp_pistol   ); bsp_pistol    = NULL;
+    basic_sprite_dtor      (bsp_nothing  ); bsp_nothing   = NULL;
+    map_dtor               (map1         ); map1          = NULL;
+    font_free();
+
+    // Unsubscribe interrupts
+    if (unsubscribe_all()) {
+        if (cleanup())
+        printf("%s: failed to cleanup.\n", __func__);
+        return 1;
+    }
+
+    if (cleanup()) {
+        printf("%s: failed to cleanup.\n", __func__);
+        return 1;
+    }
+
+    return 0;
+}
+
+static host_info_t     *host_info   = NULL;
+static remote_info_t   *remote_info = NULL;
+static bullet_info_t   *bullet_info = NULL;
+
+static void multiplayer_process(const uint8_t *p, const size_t sz) {
+    void *dest = NULL;
+    hltp_type tp = hltp_interpret(p, sz, &dest);
+    if (dest == NULL) return;
+    switch(tp){
+        case hltp_type_host:
+            host_info = (host_info_t*)dest;
+            break;
+        case hltp_type_remote:
+            remote_info = (remote_info_t*)dest;
+            break;
+        case hltp_type_bullet:
+            bullet_info = (bullet_info_t*)dest;
+            break;
+        case hltp_type_invalid: break;
+        case hltp_type_string : break;
+    }
+}
+static int (multiplayer_host)(void);
+static int (multiplayer_remote)(void);
+static int (multiplayer)(void) {
+    int r;
+
+    menu_t *main_menu = menu_ctor(font_get_default());
+    menu_add_item(main_menu, "Create");
+    menu_add_item(main_menu, "Connect");
+    menu_add_item(main_menu, "Back");
+
+    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
+    uint8_t last_lb = 0;
+    struct packet pp;
+    keys_t *keys = get_key_presses();
+
+    /// loop stuff
+    int click = 0;
+    uint64_t int_vector = 0;
+    int good = true;
+    while (good) {
+        /* Get a request message. */
+        if((r = get_interrupts_vector(&int_vector))) return r;
+        uint32_t n = 1;
+        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
+            if (int_vector & n) {
+                interrupt_handler(i);
+                switch (i) {
+                    case TIMER0_IRQ:
+
+                    graph_clear_screen();
+                    switch(menu_update_state(main_menu, click)){
+                        case -1: break;
+                        case  0: multiplayer_host(); break;
+                        case  1: multiplayer_remote(); break;
+                        case  2: good = false; break;
+                    }
+                    menu_draw(main_menu);
+
+                    click = 0;
+
+                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
+                    sprite_draw(sp_crosshair);
+                    graph_draw();
+
+                    break;
+                    case KBC_IRQ:
+                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
+                    case MOUSE_IRQ:
+                    if (mouse_get_counter_mouse_ih() >= 3) {
+                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
+                        update_mouse(&pp);
+                        if (!click) click = last_lb ^ keys->lb_pressed && keys->lb_pressed;
+                        last_lb = keys->lb_pressed;
+                        mouse_set_counter_mouse_ih(0);
+                    }
+                    break;
+                    case COM1_IRQ: nctp_ih(); break;
+                }
+            }
+        }
+    }
+    return 0;
+}
+
+static int (multiplayer_host)(void) {
+    int r;
+
+    nctp_dump();
+    nctp_set_processor(multiplayer_process);
+
+    ent_set_scale(DEFAULT_SCALE);
+    text_timer_t *in_game_timer = text_timer_ctor(font_get_default());
+
+    list_t *shooter_list = list_ctor();
+
+    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
+    gunner_set_spawn(shooter1, 75, 75);
+
+    gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 2); if(shooter2 == NULL) printf("Failed to get shooter2\n");
+    gunner_set_spawn(shooter2, 975, 75);
+
+    list_insert(shooter_list, list_end(shooter_list), shooter1);
+    list_insert(shooter_list, list_end(shooter_list), shooter2);
+
+    do {
+        get_random_spawn(map1, shooter1, shooter_list);
+        get_random_spawn(map1, shooter2, shooter_list);
+    } while (gunner_distance(shooter1, shooter2) < 500);
+
+    host_info = host_info_ctor(shooter1, shooter2);
+    remote_info = remote_info_ctor();
+    bullet_info = bullet_info_ctor();
+
+    list_t *bullet_list  = list_ctor();
+
+    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+
+    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
+    uint8_t last_lb = 0;
+    struct packet pp;
+    keys_t *keys = get_key_presses();
+    /// loop stuff
+    uint64_t int_vector = 0;
+    int good = true;
+    int state = 0; // -1 for remote win, 0 for draw, 1 for host win
+    list_node_t *p1, *p2; // player states
+    int state_1, state_2;
+    while (good) {
+        if ((r = get_interrupts_vector(&int_vector))) return r;
+        uint32_t n = 1;
+        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
+            if (int_vector & n) {
+                interrupt_handler(i);
+                switch (i) {
+                    case TIMER0_IRQ:
+                    if (timer_get_no_interrupts() % 60 == 0) text_timer_update(in_game_timer);
+                    update_movement(map1, shooter1, keys, shooter_list);
+                    update_movement(map1, shooter2, &(remote_info->remote_keys_pressed), shooter_list);
+
+                    update_game_state(map1, shooter_list, bullet_list);
+
+                    p1 = list_find(shooter_list, shooter1);
+                    p2 = list_find(shooter_list, shooter2);
+
+                    if ((state_1 = (p1 == list_end(shooter_list))) || (state_2 = (p2 == list_end(shooter_list)))) {
+                        state = state_1 - state_2;
+                        good = false;
+                        break;
+                    }
+
+                    double angle = get_mouse_angle(shooter1);
+                    gunner_set_angle(shooter1, angle - M_PI_2);
+
+                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+
+                    gunner_set_angle(shooter2, remote_info->remote_angle);
+                    build_host_structure(host_info, shooter1, shooter2);
+
+                    hltp_send_host_info(host_info);
+
+                    graph_clear_screen();
+                    map_draw   (map1);
+                    bullet_draw_list(bullet_list);
+                    gunner_draw_list(shooter_list);
+
+                    text_draw(in_game_timer->text);
+
+                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
+                    sprite_draw(sp_crosshair);
+                    graph_draw();
+
+                    break;
+                    case KBC_IRQ:
+                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
+                        good = false;
+                    }
+                    break;
+                    case MOUSE_IRQ:
+                    if (mouse_get_counter_mouse_ih() >= 3) {
+                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
+                        update_mouse(&pp);
+                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed)
+                        shoot_bullet(shooter1, bullet_list, bsp_bullet);
+                        last_lb = keys->lb_pressed;
+                        mouse_set_counter_mouse_ih(0);
+                    }
+                    break;
+
+                    case COM1_IRQ:
+                        nctp_ih();
+                        if (bullet_info->new_bullet) {
+                            shoot_bullet(shooter2, bullet_list, bsp_bullet);
+                            bullet_info->new_bullet = false;
+                        }
+                        break;
+                }
+            }
+        }
+    }
+
+    while(list_size(shooter_list) > 0){
+        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
+        gunner_dtor(p);
+    }
+    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
+
+    while(list_size(bullet_list) > 0){
+        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
+        bullet_dtor(p);
+    }
+    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
+
+    host_info_dtor(host_info);
+    remote_info_dtor(remote_info);
+    bullet_info_dtor(bullet_info);
+
+    nctp_set_processor(NULL);
+
+    text_timer_dtor(in_game_timer); in_game_timer = NULL;
+
+    return 0;
+}
+static int (multiplayer_remote)(void) {
+    int r;
+
+    nctp_dump();
+    nctp_set_processor(multiplayer_process);
+
+    ent_set_scale(DEFAULT_SCALE);
+    text_timer_t *in_game_timer = text_timer_ctor(font_get_default());
+
+    list_t *shooter_list = list_ctor();
+
+    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 2); if(shooter1 == NULL) printf("Failed to get shooter1\n");
+    gunner_set_spawn(shooter1, 75, 75);
+
+    gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter2 == NULL) printf("Failed to get shooter2\n");
+    gunner_set_spawn(shooter2, 975, 75);
+
+    list_insert(shooter_list, list_end(shooter_list), shooter1);
+    list_insert(shooter_list, list_end(shooter_list), shooter2);
+
+    host_info = host_info_ctor(shooter2, shooter1);
+    remote_info = remote_info_ctor();
+    bullet_info = bullet_info_ctor();
+
+    list_t *bullet_list  = list_ctor();
+
+    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+
+    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
+    uint8_t last_lb = 0;
+    struct packet pp;
+    keys_t *keys = get_key_presses();
+
+    /// loop stuff
+    uint64_t int_vector = 0;
+    int good = true;
+    while (good) {
+        if ((r = get_interrupts_vector(&int_vector))) return r;
+        uint32_t n = 1;
+        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
+            if (int_vector & n) {
+                interrupt_handler(i);
+                switch (i) {
+                    case TIMER0_IRQ:
+                    if (timer_get_no_interrupts() % 60 == 0) text_timer_update(in_game_timer);
+
+                    double angle = get_mouse_angle(shooter1) - M_PI_2;
+
+                    build_remote_structure(remote_info, keys, angle);
+
+
+                    //hltp_send_remote_info(remote_info);
+                    gunner_set_pos(shooter1, (double)host_info->remote_x, (double)host_info->remote_y);
+                    gunner_set_angle(shooter1, (double)host_info->remote_angle);
+                    gunner_set_health(shooter1, (double)host_info->remote_health);
+                    gunner_set_curr_health(shooter1, (double)host_info->remote_current_health);
+
+                    gunner_set_pos(shooter2, (double)host_info->host_x, (double)host_info->host_y);
+                    gunner_set_angle(shooter2, (double)host_info->host_angle);
+                    gunner_set_health(shooter2, (double)host_info->host_health);
+                    gunner_set_curr_health(shooter2, (double)host_info->host_current_health);
+
+                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+
+                    /*
+                    for (size_t j = 0; j < host_info->no_bullets; j++) {
+                        if (host_info->bullets_shooter[j]) { // remote
+                            bullet_t *bullet = bullet_ctor(shooter1, bsp_bullet, (double)host_info->bullets_x[j], (double)host_info->bullets_y[j], (double)host_info->bullets_vx[j], (double)host_info->bullets_vy[j]);
+                            list_insert(bullet_list, list_end(bullet_list), bullet);
+                        } else { // host
+                            bullet_t *bullet = bullet_ctor(shooter2, bsp_bullet, (double)host_info->bullets_x[j], (double)host_info->bullets_y[j], (double)host_info->bullets_vx[j], (double)host_info->bullets_vy[j]);
+                            list_insert(bullet_list, list_end(bullet_list), bullet);
+                        }
+                    }*/
+
+                    graph_clear_screen();
+                    map_draw   (map1);
+                    bullet_draw_list(bullet_list);
+                    gunner_draw_list(shooter_list);
+
+                    text_draw(in_game_timer->text);
+
+                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
+                    sprite_draw(sp_crosshair);
+                    graph_draw();
+                    /*
+                    while(list_size(bullet_list) > 0){
+                        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
+                        bullet_dtor(p);
+                    }
+                    */
+
+                    break;
+                    case KBC_IRQ:
+                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
+                        good = false;
+                    }
+                    break;
+                    case MOUSE_IRQ:
+                    if (mouse_get_counter_mouse_ih() >= 3) {
+                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
+                        update_mouse(&pp);
+                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed) {
+                            bullet_info->new_bullet = true;
+                            //hltp_send_bullet_info(bullet_info);
+                        }
+                        last_lb = keys->lb_pressed;
+                        mouse_set_counter_mouse_ih(0);
+                    }
+                    break;
+
+                    case COM1_IRQ:
+                        nctp_ih();
+                        break;
+                }
+            }
+        }
+    }
+
+    while(list_size(shooter_list) > 0){
+        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
+        gunner_dtor(p);
+    }
+    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
+
+    while(list_size(bullet_list) > 0){
+        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
+        bullet_dtor(p);
+    }
+    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
+
+    host_info_dtor(host_info);
+    remote_info_dtor(remote_info);
+    bullet_info_dtor(bullet_info);
+
+    nctp_set_processor(NULL);
+
+    text_timer_dtor(in_game_timer); in_game_timer = NULL;
+
+    return 0;
+}

Property changes on: proj/project/src/proj.c
___________________________________________________________________
Added: svn:executable
Index: proj/project/src/proj_func.c
===================================================================
--- proj/project/src/proj_func.c	(nonexistent)
+++ proj/project/src/proj_func.c	(revision 355)
@@ -0,0 +1,372 @@
+#include <lcom/lcf.h>
+
+#include "proj_func.h"
+
+#include "interrupts_func.h"
+#include "libs.h"
+#include "proj_macros.h"
+#include "ent.h"
+
+#include <math.h>
+
+int cleanup(void) {
+    int r = SUCCESS;
+    if ((r = unsubscribe_all()))
+        printf("%s: failed to unsubscribe drivers.\n", __func__);
+    if ((r = graph_cleanup()))
+        printf("%s: graph cleanup failed\n", __func__);
+
+    return r;
+}
+
+static keys_t key_presses;
+void update_key_presses(void) {
+    if (keyboard_get_size() == 1) {
+        switch(keyboard_get_scancode()[0]) {
+        case W_MAKE_CODE        : key_presses.w_pressed     = 1;        break;
+        case W_BREAK_CODE       : key_presses.w_pressed     = 0;        break;
+        case A_MAKE_CODE        : key_presses.a_pressed     = 1;        break;
+        case A_BREAK_CODE       : key_presses.a_pressed     = 0;        break;
+        case S_MAKE_CODE        : key_presses.s_pressed     = 1;        break;
+        case S_BREAK_CODE       : key_presses.s_pressed     = 0;        break;
+        case D_MAKE_CODE        : key_presses.d_pressed     = 1;        break;
+        case D_BREAK_CODE       : key_presses.d_pressed     = 0;        break;
+        case CTRL_MAKE_CODE     : key_presses.ctrl_pressed  = 1;        break;
+        case CTRL_BREAK_CODE    : key_presses.ctrl_pressed  = 0;        break;
+        case PLUS_MAKE_CODE     : key_presses.plus_pressed  = 1;    update_scale();        break;
+        case PLUS_BREAK_CODE    : key_presses.plus_pressed  = 0;    update_scale();        break;
+        case MINUS_MAKE_CODE    : key_presses.minus_pressed = 1;    update_scale();        break;
+        case MINUS_BREAK_CODE   : key_presses.minus_pressed = 0;    update_scale();        break;
+        }
+    }
+}
+keys_t* (get_key_presses)(void) {
+    return &key_presses;
+}
+
+static int16_t mouse_x = 0, mouse_y = 0;
+void (update_mouse)(struct packet *p) {
+    mouse_x = max_16(0, mouse_x + p->delta_x);
+    mouse_x = min_16(mouse_x, (int16_t)graph_get_XRes() - 1);
+
+    mouse_y = max_16(0, mouse_y - p->delta_y);
+    mouse_y = min_16(mouse_y, (int16_t)graph_get_YRes() - 1);
+
+    key_presses.lb_pressed = p->lb;
+}
+int16_t* get_mouse_X(void) { return &mouse_x; }
+int16_t* get_mouse_Y(void) { return &mouse_y; }
+double get_mouse_angle(gunner_t *p) {
+    return atan2(gunner_get_y_screen(p) - mouse_y, mouse_x - gunner_get_x_screen(p));
+}
+
+void update_movement(map_t *map, gunner_t *p, keys_t *keys, list_t *shooter_list) {
+    /** Player movement */{
+        int ver_mov = keys->s_pressed - keys->w_pressed;
+        int hor_mov = keys->d_pressed - keys->a_pressed;
+        double x = gunner_get_x(p);
+        double y = gunner_get_y(p);
+
+        gunner_set_pos(p, x + SHOOTER_SPEED * hor_mov, y);
+        if (map_collides_gunner(map, p)) gunner_set_pos(p, x, y);
+        else {
+            list_node_t *it = list_begin(shooter_list);
+            while (it != list_end(shooter_list)) {
+                gunner_t *p2 = *(gunner_t**)list_node_val(it);
+                if (p != p2 && gunner_collides_gunner(p, p2)) {
+                    gunner_set_pos(p, x, y);
+                    break;
+                }
+                it = list_node_next(it);
+            }
+        }
+        x = gunner_get_x(p);
+        gunner_set_pos(p, x, y + SHOOTER_SPEED * ver_mov);
+        if (map_collides_gunner(map, p)) gunner_set_pos(p, x, y);
+        else {
+            list_node_t *it = list_begin(shooter_list);
+            while (it != list_end(shooter_list)) {
+                gunner_t *p2 = *(gunner_t**)list_node_val(it);
+                if (p != p2 && gunner_collides_gunner(p, p2)) {
+                    gunner_set_pos(p, x, y);
+                    break;
+                }
+                it = list_node_next(it);
+            }
+        }
+    }
+    /** Followers movement */ {
+        list_node_t *it = list_begin(shooter_list);
+        while(it != list_end(shooter_list)){
+            gunner_t *g = *(gunner_t**)list_node_val(it);
+            if(gunner_get_type(g) & GUNNER_FOLLOW){
+                double theta = 0.0;
+                map_where_to_follow(map, gunner_get_x(g), gunner_get_y(g), &theta);
+                double c = fm_cos(theta), s = fm_sin(theta);
+                double dx = ZOMBIE_SPEED*c, dy = -ZOMBIE_SPEED*s;
+                double x = gunner_get_x(g);
+                double y = gunner_get_y(g);
+                gunner_set_pos(g, x+dx, y+dy);
+                if (map_collides_gunner(map, g)){
+                    gunner_set_pos(g, x, y);
+                } else {
+                    list_node_t *it2 = list_begin(shooter_list);
+                    while (it2 != list_end(shooter_list)) {
+                        gunner_t *p2 = *(gunner_t**)list_node_val(it2);
+                        if (g != p2 && gunner_collides_gunner(g, p2)) {
+                            gunner_set_pos(g, x, y);
+                            break;
+                        }
+                        it2 = list_node_next(it2);
+                    }
+                }
+                gunner_set_angle(g, theta-M_PI_2);
+            }
+            it = list_node_next(it);
+        }
+    }
+}
+
+void (get_random_spawn)(const map_t *map, gunner_t *p, list_t *l) {
+    uint16_t w = map_get_width(map), h = map_get_height(map);
+    double x, y;
+
+    while(true){
+        x = rand() % w;
+        y = rand() % h;
+        gunner_set_pos(p, x, y);
+        if(map_collides_gunner(map, p)) continue;
+        int collides = false;
+        list_node_t *it = list_begin(l);
+        while(it != list_end(l)){
+            if(gunner_collides_gunner(p, *list_node_val(it))){
+                collides = true;
+                break;
+            }
+            it = list_node_next(it);
+        }
+        if(!collides) return;
+    }
+}
+
+void update_scale(void) {
+    static uint8_t last_plus = 0, last_minus = 0;
+    if (key_presses.ctrl_pressed) {
+        if (key_presses.plus_pressed && !last_plus) {
+            double scale = ent_get_scale();
+            scale *= 1.1;
+            if (scale <= MAX_SCALE) ent_set_scale(scale);
+        }
+        else if (key_presses.minus_pressed && !last_minus) {
+            double scale = ent_get_scale();
+            scale /= 1.1;
+            if (scale >= MIN_SCALE) ent_set_scale(scale);
+        }
+
+        //printf("SCALE: %d\n", (int)(ent_get_scale()*1000));
+    }
+
+    last_plus = key_presses.plus_pressed;
+    last_minus = key_presses.minus_pressed;
+}
+
+void (shoot_bullet)(const gunner_t *shooter, list_t *bullet_list, const basic_sprite_t *bsp_bullet) {
+    double angle = gunner_get_angle(shooter);
+    double vx = -BULLET_SPEED * fm_sin(angle);
+    double vy = -BULLET_SPEED * fm_cos(angle);
+    bullet_t *bullet = bullet_ctor(shooter, bsp_bullet, gunner_get_x(shooter), gunner_get_y(shooter), vx, vy);
+    list_insert(bullet_list, list_end(bullet_list), bullet);
+}
+
+void (update_game_state)(const map_t *map, list_t *shooter_list, list_t *bullet_list) {
+    /// BULLETS
+    bullet_update_movement_list(bullet_list);
+    list_node_t *bullet_it = list_begin(bullet_list);
+    while (bullet_it != list_end(bullet_list)) {
+        /// Collision with walls
+        bullet_t *bullet = *(bullet_t**)list_node_val(bullet_it);
+        if (map_collides_bullet(map, bullet)) {
+            list_node_t *aux = list_node_next(bullet_it);
+            /// Delete bullet
+            bullet_dtor(list_erase(bullet_list, bullet_it));
+            /// Advance iterator
+            bullet_it = aux;
+            continue;
+        }
+        /// Collision with shooters
+        list_node_t *shooter_it = list_begin(shooter_list);
+        int deleted_bullet = false;
+        while(shooter_it != list_end(shooter_list)){
+            gunner_t *shooter = *(gunner_t**)list_node_val(shooter_it);
+            if(gunner_collides_bullet(shooter, bullet) &&
+               gunner_get_team(shooter) != gunner_get_team(bullet_get_shooter(bullet))) {
+                list_node_t *aux = list_node_next(bullet_it);
+                /// Change health
+                gunner_set_curr_health(shooter, gunner_get_curr_health(shooter) - bullet_get_damage(bullet));
+                if (gunner_get_curr_health(shooter) <= 0) {
+                    gunner_dtor(list_erase(shooter_list, shooter_it));
+                }
+                /// Delete bullet
+                bullet_dtor(list_erase(bullet_list, bullet_it)); deleted_bullet = true;
+                /// Advance iterator
+                bullet_it = aux;
+                break;
+            } else shooter_it = list_node_next(shooter_it);
+        }
+        if(deleted_bullet) continue;
+        /// Advance iterator if necessary
+        bullet_it = list_node_next(bullet_it);
+    }
+    /// MELEE
+    list_node_t *it1 = list_begin(shooter_list);
+    while(it1 != list_end(shooter_list)){
+        gunner_t *s1 = *list_node_val(it1);
+        if(!(gunner_get_type(s1) & GUNNER_MELEE)){ it1 = list_node_next(it1); continue; }
+        list_node_t *it2 = list_begin(shooter_list);
+        while(it2 != list_end(shooter_list)){
+            gunner_t *s2 = *list_node_val(it2);
+            if(gunner_get_team(s1) != gunner_get_team(s2) &&
+               gunner_distance(s1, s2) < MELEE_RANGE)
+                gunner_set_curr_health(s2, gunner_get_curr_health(s2) - MELEE_DAMAGE);
+            if(gunner_get_curr_health(s2) <= 0){
+                list_node_t *aux = list_node_next(it2);
+                gunner_dtor(list_erase(shooter_list, it2));
+                it2 = aux;
+            }else it2 = list_node_next(it2);
+        }
+        it1 = list_node_next(it1);
+    }
+}
+
+text_timer_t* (text_timer_ctor)(const font_t *fnt){
+    if(fnt == NULL) return NULL;
+    text_timer_t *ret = malloc(sizeof(timer_t));
+    if (ret == NULL) return NULL;
+    ret->time = 0;
+    ret->text = text_ctor(fnt, "000s");
+    text_set_color(ret->text, TEXT_COLOR);
+    return ret;
+}
+void (text_timer_update)(text_timer_t *p){
+    if (p->time >= 999) return;
+    p->time++;
+    char buffer[100];
+    sprintf(buffer, "%03ds", p->time);
+    text_set_string(p->text, buffer);
+}
+void (text_timer_reset)(text_timer_t *p){
+    text_set_string(p->text, "000s");
+}
+void (text_timer_dtor)(text_timer_t *p){
+    if (p == NULL) return;
+    text_dtor(p->text);
+    free(p);
+}
+
+host_info_t* host_info_ctor(gunner_t *host, gunner_t *remote) {
+    host_info_t *ret = (host_info_t*)malloc(sizeof(host_info_t));
+    if (ret == NULL) return ret;
+
+    ret->host_x               = (int16_t)gunner_get_x          (host);
+    ret->host_y               = (int16_t)gunner_get_y          (host);
+    ret->host_angle           = (float)  gunner_get_angle      (host);
+    ret->host_health          = (int16_t)gunner_get_health     (host);
+    ret->host_current_health  = (int16_t)gunner_get_curr_health(host);
+
+    // remote
+    ret->remote_x               = (int16_t)gunner_get_x          (remote);
+    ret->remote_y               = (int16_t)gunner_get_y          (remote);
+    ret->remote_angle           = (float)  gunner_get_angle      (remote);
+    ret->remote_health          = (int16_t)gunner_get_health     (remote);
+    ret->remote_current_health  = (int16_t)gunner_get_curr_health(remote);
+
+    //ret->no_bullets = 0;
+
+    return ret;
+}
+void host_info_dtor(host_info_t *p) {
+    if (p==NULL) return;
+    /*
+    if ((p->bullets_x) != NULL){ free(p->bullets_x); p->bullets_x = NULL; }
+
+    if ((p->bullets_y) != NULL){ free(p->bullets_y); p->bullets_y = NULL; }
+
+    if ((p->bullets_vx) != NULL){ free(p->bullets_vx); p->bullets_vx = NULL; }
+
+    if ((p->bullets_vy) != NULL){ free(p->bullets_vy); p->bullets_vy = NULL; }
+
+    if ((p->bullets_shooter) != NULL){ free(p->bullets_shooter); p->bullets_shooter = NULL; }
+    */
+    free(p);
+}
+
+remote_info_t* remote_info_ctor(void) {
+    remote_info_t *ret = (remote_info_t*)malloc(sizeof(remote_info_t));
+    if (ret == NULL) return ret;
+
+    memset(&(ret->remote_keys_pressed), 0, sizeof(keys_t));
+
+    ret->remote_angle = 0;
+
+    return ret;
+}
+void remote_info_dtor(remote_info_t *p) {
+    if (p==NULL) return;
+    free(p);
+}
+
+bullet_info_t* bullet_info_ctor(void) {
+    bullet_info_t *ret = (bullet_info_t*)malloc(sizeof(bullet_info_t));
+    if (ret == NULL) return ret;
+
+    ret->new_bullet = false;
+
+    return ret;
+}
+void bullet_info_dtor(bullet_info_t *p) {
+    if (p == NULL) return;
+    free(p);
+}
+
+void build_host_structure(host_info_t *p, gunner_t *host, gunner_t *remote) {
+    // host
+    p->host_x               = (int16_t)gunner_get_x          (host);
+    p->host_y               = (int16_t)gunner_get_y          (host);
+    p->host_angle           = (float)  gunner_get_angle      (host);
+    p->host_health          = (int16_t)gunner_get_health     (host);
+    p->host_current_health  = (int16_t)gunner_get_curr_health(host);
+
+    // remote
+    p->remote_x               = (int16_t)gunner_get_x          (remote);
+    p->remote_y               = (int16_t)gunner_get_y          (remote);
+    p->remote_angle           = (float)  gunner_get_angle      (remote);
+    p->remote_health          = (int16_t)gunner_get_health     (remote);
+    p->remote_current_health  = (int16_t)gunner_get_curr_health(remote);
+    /*
+    // bullets
+    size_t sz = list_size(bullet_list);
+    p->no_bullets = sz;
+    p->bullets_x        = (int16_t*)realloc(p->bullets_x         , sz * sizeof(int16_t));
+    p->bullets_y        = (int16_t*)realloc(p->bullets_y         , sz * sizeof(int16_t));
+    p->bullets_vx       = (int16_t*)realloc(p->bullets_vx        , sz * sizeof(int16_t));
+    p->bullets_vy       = (int16_t*)realloc(p->bullets_vy        , sz * sizeof(int16_t));
+    p->bullets_shooter  = (bool*)   realloc(p->bullets_shooter   , sz * sizeof(bool ));
+
+    list_node_t *it = list_begin(bullet_list);
+    size_t i = 0;
+    while (it != list_end(bullet_list)) {
+        bullet_t *bullet = *list_node_val(it);
+        p->bullets_x        [i] = (int16_t)bullet_get_x                      (bullet);
+        p->bullets_y        [i] = (int16_t)bullet_get_y                      (bullet);
+        p->bullets_vx       [i] = (int16_t)bullet_get_vx                     (bullet);
+        p->bullets_vy       [i] = (int16_t)bullet_get_vy                     (bullet);
+        p->bullets_shooter  [i] = gunner_get_team(bullet_get_shooter(bullet)) != gunner_get_team(host);
+        it = list_node_next(it);
+        i++;
+    }
+    */
+}
+void build_remote_structure(remote_info_t *p, keys_t *keys, double angle) {
+    memcpy(&(p->remote_keys_pressed), keys, sizeof(keys_t));
+    p->remote_angle = angle;
+}

Property changes on: proj/project/src/proj_func.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/scoreboards.c
===================================================================
--- proj/project/src/scoreboards.c	(nonexistent)
+++ proj/project/src/scoreboards.c	(revision 355)
@@ -0,0 +1,103 @@
+#include <lcom/lcf.h>
+
+#include "scoreboards.h"
+
+#include "graph.h"
+#include "rectangle.h"
+#include "proj_func.h"
+#include "proj_macros.h"
+#include "rtc.h"
+#include "errors.h"
+
+#include <stdio.h>
+
+#define MAX_HIGHSCORES   3 /** @brief Number of scores saved */
+
+struct  score_info {
+    int day;
+    int month;
+    int year;
+    int hour;
+    int min;
+    int sec;
+    int score;
+    int time_played;
+};
+
+struct highscores {
+    score_info_t *highscores[MAX_HIGHSCORES];
+
+    const font_t *fnt;
+    rectangle_t *r[(MAX_HIGHSCORES+1)*3 + 1];
+    text_t      *t[(MAX_HIGHSCORES+1)*3 + 1];
+    rectangle_t *frame;
+};
+
+score_info_t* (score_ctor)(int score, int time_played){
+    score_info_t *ret = (score_info_t*)malloc(sizeof(score_info_t));
+    if (ret == NULL) return NULL;
+    uint8_t score_date[4];
+    if (rtc_read_date(score_date)) return NULL;
+    ret->sec = score_date[0];
+    ret->min = score_date[1];
+    ret->hour = score_date[2];
+
+    if (rtc_read_time(score_date)) return NULL;
+
+    ret->day = score_date[1];
+    ret->month = score_date[2];
+    ret->year = score_date[3];
+
+    ret->score = score;
+    ret->time_played = time_played;
+
+    return ret;
+}
+
+void (score_dtor)(score_info_t *p){
+    if (p != NULL) free(p);
+}
+
+highscores_t* (highscores_ctor)(const font_t *fnt, const char *path) {
+    if(fnt == NULL || path == NULL) return NULL;
+
+    FILE *f = fopen(path, "r");
+    if (f == NULL) return NULL;
+    highscores_t *ret = (highscores_t*)malloc(sizeof(highscores_t));
+    if (ret == NULL) return NULL;
+    char line[30];
+    for (int i = 0; i < MAX_HIGHSCORES; i++) {
+        fgets(line, 30, f);
+        score_info_t *score = (score_info_t*)malloc(sizeof(score_info_t));
+
+        sscanf(line, "%d/%d/%d %d:%d:%d - %d - %d\n",
+                    &(score->day), &(score->month), &(score->year),
+                    &(score->hour), &(score->month), &(score->sec),
+                    &(score->score), &(score->time_played));
+        ret->highscores[i] = score;
+    }
+    fclose(f);
+
+    return ret;
+}
+
+void (highscores_save)(const highscores_t *p, const char *path) {
+    if(p == NULL || path == NULL) return;
+
+    FILE *f = fopen(path, "w");
+    if (f == NULL) return;
+    for (int i = 0; i < MAX_HIGHSCORES; i++) {
+        score_info_t *score = p->highscores[i];
+        fprintf(f, "%d/%d/%d %d:%d:%d - %d - %d\n",
+                    (score->day), (score->month), (score->year),
+                    (score->hour), (score->month), (score->sec),
+                    (score->score), (score->time_played));
+    }
+    fclose(f);
+}
+
+void (highscores_dtor)(highscores_t *p) {
+    for (int i = 0; i < MAX_HIGHSCORES; i++) {
+        score_dtor(p->highscores[i]);
+    }
+}

Property changes on: proj/project/src/scoreboards.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/singleplayer.c
===================================================================
--- proj/project/src/singleplayer.c	(nonexistent)
+++ proj/project/src/singleplayer.c	(revision 355)
@@ -0,0 +1,79 @@
+#include <lcom/lcf.h>
+
+#include "singleplayer.h"
+
+#include "proj.h"
+
+#include "proj_macros.h"
+#include "proj_func.h"
+#include "ent.h"
+#include "interrupts_func.h"
+
+#include "libs.h"
+
+#include "campaign.h"
+#include "zombies.h"
+
+int (singleplayer)(void) {
+
+    int r;
+
+    menu_t *main_menu = menu_ctor(font_get_default());
+    menu_add_item(main_menu, "Campaign");
+    menu_add_item(main_menu, "Zombies");
+    menu_add_item(main_menu, "Back");
+
+    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
+    uint8_t last_lb = 0;
+    struct packet pp;
+    keys_t *keys = get_key_presses();
+
+    /// loop stuff
+    int click = 0;
+    uint64_t int_vector = 0;
+    int good = true;
+    while (good) {
+        /* Get a request message. */
+        if((r = get_interrupts_vector(&int_vector))) return r;
+        uint32_t n = 1;
+        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
+            if (int_vector & n) {
+                interrupt_handler(i);
+                switch (i) {
+                    case TIMER0_IRQ:
+
+                    graph_clear_screen();
+                    switch(menu_update_state(main_menu, click)){
+                        case -1: break;
+                        case  0: campaign(); break;
+                        case  1: zombies(); break;
+                        case  2: good = false; break;
+                    }
+                    menu_draw(main_menu);
+
+                    click = 0;
+
+                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
+                    sprite_draw(sp_crosshair);
+                    graph_draw();
+
+                    break;
+                    case KBC_IRQ:
+                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
+                    case MOUSE_IRQ:
+                    if (mouse_get_counter_mouse_ih() >= 3) {
+                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
+                        update_mouse(&pp);
+                        if (!click) click = last_lb ^ keys->lb_pressed && keys->lb_pressed;
+                        last_lb = keys->lb_pressed;
+                        mouse_set_counter_mouse_ih(0);
+                    }
+                    break;
+                    case COM1_IRQ: nctp_ih(); break;
+                }
+            }
+        }
+    }
+
+    return 0;
+}

Property changes on: proj/project/src/singleplayer.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/project/src/zombies.c
===================================================================
--- proj/project/src/zombies.c	(nonexistent)
+++ proj/project/src/zombies.c	(revision 355)
@@ -0,0 +1,144 @@
+#include <lcom/lcf.h>
+
+#include "zombies.h"
+
+#include "proj.h"
+
+#include "libs.h"
+
+#include "proj_macros.h"
+#include "proj_func.h"
+#include "ent.h"
+#include "interrupts_func.h"
+#include <math.h>
+
+#define ZOMBIES_NUM             5
+#define ZOMBIE_HEALTH_FACTOR    1.1
+int (zombies)(void){
+
+    int r;
+
+    ent_set_scale(DEFAULT_SCALE);
+    text_timer_t *in_game_timer = text_timer_ctor(font_get_default());
+
+    list_t *shooter_list = list_ctor();
+
+    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
+    gunner_set_spawn(shooter1, 980, 790);
+    gunner_set_pos(shooter1, 980, 790);
+
+    list_insert(shooter_list, list_end(shooter_list), shooter1);
+
+    list_t *bullet_list  = list_ctor();
+
+    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+    gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+
+    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
+    uint8_t last_lb = 0;
+    struct packet pp;
+    keys_t *keys = get_key_presses();
+
+    /// loop stuff
+    uint64_t int_vector = 0;
+    int good = true;
+    int dead = false;
+
+    int health = 50;
+
+    map_make_dijkstra(map1, gunner_get_x(shooter1), gunner_get_y(shooter1));
+
+    while (good && !dead) {
+        /* Get a request message. */
+        if((r = get_interrupts_vector(&int_vector))) return r;
+        uint32_t n = 1;
+        for (uint8_t i = 0; i < 32; i++, n <<= 1) {
+            if(!good || dead) break;
+            if (int_vector & n) {
+                interrupt_handler(i);
+                switch (i) {
+                    case TIMER0_IRQ:
+                    if (timer_get_no_interrupts() % 60 == 0) text_timer_update(in_game_timer);
+                    if (timer_get_no_interrupts() %  6 == 0){
+                        map_make_dijkstra(map1, gunner_get_x(shooter1), gunner_get_y(shooter1));
+                    }
+
+                    update_movement(map1, shooter1, keys, shooter_list);
+
+                    update_game_state(map1, shooter_list, bullet_list);
+
+                    if(list_find(shooter_list, shooter1) == list_end(shooter_list)){
+                        good = false;
+                        dead = true;
+                        break;
+                    }
+
+                    double angle = get_mouse_angle(shooter1);
+                    gunner_set_angle(shooter1, angle - M_PI_2);
+
+                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+
+                    while(list_size(shooter_list) < ZOMBIES_NUM+1){
+                        gunner_t *zombie = gunner_ctor(bsp_zombie, bsp_nothing, GUNNER_MELEE | GUNNER_FOLLOW, 3);
+                        gunner_set_health(zombie, health);
+                        gunner_set_curr_health(zombie, health);
+                        health *= ZOMBIE_HEALTH_FACTOR;
+                        get_random_spawn(map1, zombie, shooter_list);
+                        list_push_back(shooter_list, zombie);
+                    }
+
+                    graph_clear_screen();
+                    map_draw   (map1);
+                    bullet_draw_list(bullet_list);
+                    gunner_draw_list(shooter_list);
+
+                    text_draw(in_game_timer->text);
+
+                    sprite_set_pos(sp_crosshair, *get_mouse_X(), *get_mouse_Y());
+                    sprite_draw(sp_crosshair);
+                    graph_draw();
+
+                    break;
+                    case KBC_IRQ:
+                    if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
+                        good = false;
+                    }
+                    break;
+                    case MOUSE_IRQ:
+                    if (mouse_get_counter_mouse_ih() >= 3) {
+                        mouse_parse_packet(mouse_get_packet_mouse_ih(), &pp);
+                        update_mouse(&pp);
+                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed)
+                        shoot_bullet(shooter1, bullet_list, bsp_bullet);
+                        last_lb = keys->lb_pressed;
+                        mouse_set_counter_mouse_ih(0);
+
+                    }
+                    break;
+                    case COM1_IRQ: nctp_ih(); break;
+                }
+            }
+        }
+    }
+
+    while(list_size(shooter_list) > 0){
+        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
+        gunner_dtor(p);
+    }
+    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
+
+    while(list_size(bullet_list) > 0){
+        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
+        bullet_dtor(p);
+    }
+    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
+
+    if(dead){
+        printf("YOU DIED\n");
+    }
+
+    text_timer_dtor(in_game_timer); in_game_timer = NULL;
+
+    return SUCCESS;
+}

Property changes on: proj/project/src/zombies.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/Makefile
===================================================================
--- proj/Makefile	(revision 354)
+++ proj/Makefile	(revision 355)
@@ -1,6 +1,6 @@
 PROG=proj
 
-.PATH: ${.CURDIR}/src
+.PATH: ${.CURDIR}/project/src
 .PATH: ${.CURDIR}/libs/graph/src
 .PATH: ${.CURDIR}/libs/kbc/src
 .PATH: ${.CURDIR}/libs/rtc/src
@@ -10,7 +10,7 @@
 .PATH: ${.CURDIR}/libs/utils/src
 
 SRCS= list.c queue.c graph.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c fast_math.c xpm_utils.c rtc.c uart.c makecode_map.c menu.c proj_func.c rectangle.c font.c ent.c proj.c hltp.c zombies.c campaign.c singleplayer.c chat.c scoreboards.c
-IPATHS=-I./include -I./libs -I./libs/graph/include -I./libs/kbc/include -I./libs/rtc/include -I./libs/timer/include -I./libs/uart/include -I./libs/classes/include -I./libs/utils/include -I./maps -I./media/xpm
+IPATHS=-I./project/include -I./libs -I./libs/graph/include -I./libs/kbc/include -I./libs/rtc/include -I./libs/timer/include -I./libs/uart/include -I./libs/classes/include -I./libs/utils/include -I./maps -I./media/xpm
 
 CPPFLAGS += -pedantic ${IPATHS} -D LCOM_MACRO -D __LCOM_OPTIMIZED__ -Wall -Wextra -Wshadow -Wunreachable-code #-Weverything -Wno-padded -Wno-unused-macros
 
