Index: proj/include/proj_func.h
===================================================================
--- proj/include/proj_func.h	(revision 290)
+++ proj/include/proj_func.h	(revision 291)
@@ -56,16 +56,6 @@
  */
 double get_mouse_angle(gunner_t *p);
 
-typedef struct menu menu_t;
-
-menu_t* (menu_ctor)(const font_t *fnt);
-
-int (menu_update_state)(menu_t *menu, int click);
-
-void (menu_draw)(menu_t *menu);
-
-void (menu_dtor)(menu_t *p);
-
 typedef struct timer {
     int time;
     text_t *text;
Index: proj/libs/graph/include/menu.h
===================================================================
--- proj/libs/graph/include/menu.h	(nonexistent)
+++ proj/libs/graph/include/menu.h	(revision 291)
@@ -0,0 +1,16 @@
+#ifndef MENU_H_INCLUDED
+#define MENU_H_INCLUDED
+
+#include "font.h"
+
+typedef struct menu menu_t;
+
+menu_t* (menu_ctor)(const font_t *fnt);
+
+int (menu_update_state)(menu_t *menu, int click);
+
+void (menu_draw)(menu_t *menu);
+
+void (menu_dtor)(menu_t *p);
+
+#endif //MENU_H_INCLUDED

Property changes on: proj/libs/graph/include/menu.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/libs/graph/src/menu.c
===================================================================
--- proj/libs/graph/src/menu.c	(nonexistent)
+++ proj/libs/graph/src/menu.c	(revision 291)
@@ -0,0 +1,162 @@
+#include <lcom/lcf.h>
+
+#include "menu.h"
+
+#include "graph.h"
+#include "rectangle.h"
+#include "proj_func.h"
+#include "proj_macros.h"
+
+struct menu {
+    size_t sz;
+    rectangle_t **r;
+    text_t      **t;
+    rectangle_t *frame;
+};
+
+menu_t* (menu_ctor)(const font_t *fnt){
+    if(fnt == NULL) return NULL;
+    menu_t *ret = (menu_t*)malloc(sizeof(menu_t));
+    if (ret == NULL) return NULL;
+    ret->sz = 0;
+    ret->r = NULL;
+    ret->t = NULL;
+
+    ret->frame = rectangle_ctor(0, 0, 800, 500);
+    rectangle_set_fill_color(ret->frame, GRAPH_BLACK);
+    rectangle_set_outline_width(ret->frame, 6);
+    rectangle_set_outline_color(ret->frame, GRAPH_WHITE);
+    rectangle_set_fill_trans(ret->frame, GRAPH_TRANSPARENT);
+
+
+    ret->sz = 3;
+    ret->r = realloc(ret->r, ret->sz*sizeof(rectangle_t*));
+    ret->t = realloc(ret->t, ret->sz*sizeof(text_t     *));
+    ret->r[0] = rectangle_ctor(0, 0, 400, 100);
+    ret->r[1] = rectangle_ctor(0, 0, 400, 100);
+    ret->r[2] = rectangle_ctor(0, 0, 400, 100);
+    ret->t[0] = text_ctor(fnt, "Play");
+    ret->t[1] = text_ctor(fnt, "Test");
+    ret->t[2] = text_ctor(fnt, "Exit");
+
+    if (ret->r[0] == NULL || ret->r[1] == NULL || ret->r[2] == NULL ||
+        ret->t[0] == NULL || ret->t[1] == NULL || ret->t[2] == NULL ||
+        ret->frame == NULL) return NULL;
+    // VISUAL
+    rectangle_set_fill_color(ret->r[0], GRAPH_BLACK);
+    rectangle_set_outline_width(ret->r[0], 2);
+    rectangle_set_outline_color(ret->r[0], GRAPH_WHITE);
+    rectangle_set_fill_trans(ret->r[0], GRAPH_TRANSPARENT);
+
+    rectangle_set_fill_color(ret->r[1], GRAPH_BLACK);
+    rectangle_set_outline_width(ret->r[1], 2);
+    rectangle_set_outline_color(ret->r[1], GRAPH_WHITE);
+    rectangle_set_fill_trans(ret->r[1], GRAPH_TRANSPARENT);
+
+    rectangle_set_fill_color(ret->r[2], GRAPH_BLACK);
+    rectangle_set_outline_width(ret->r[2], 2);
+    rectangle_set_outline_color(ret->r[2], GRAPH_WHITE);
+    rectangle_set_fill_trans(ret->r[2], GRAPH_TRANSPARENT);
+
+    text_set_valign(ret->t[0], text_valign_center);
+    text_set_halign(ret->t[0], text_halign_center);
+    text_set_color(ret->t[0], TEXT_COLOR);
+
+    text_set_valign(ret->t[1], text_valign_center);
+    text_set_halign(ret->t[1], text_halign_center);
+    text_set_color(ret->t[1], TEXT_COLOR);
+
+    text_set_valign(ret->t[2], text_valign_center);
+    text_set_halign(ret->t[2], text_halign_center);
+    text_set_color(ret->t[2], TEXT_COLOR);
+    // POSITIONS
+    rectangle_set_pos(ret->r[0],
+                      graph_get_XRes()/2    - rectangle_get_w(ret->r[0])/2,
+                      graph_get_YRes()*0.35 - rectangle_get_h(ret->r[0])/2);
+
+
+    rectangle_set_pos(ret->r[1],
+                    graph_get_XRes()/2    - rectangle_get_w(ret->r[1])/2,
+                    graph_get_YRes()*0.5 - rectangle_get_h(ret->r[1])/2);
+
+
+    rectangle_set_pos(ret->r[2],
+                  graph_get_XRes()/2    - rectangle_get_w(ret->r[2])/2,
+                  graph_get_YRes()*0.65 - rectangle_get_h(ret->r[2])/2);
+
+    text_set_pos(ret->t[0], rectangle_get_x(ret->r[0])+rectangle_get_w(ret->r[0])/2,
+                          rectangle_get_y(ret->r[0])+rectangle_get_h(ret->r[0])/2);
+
+    text_set_pos(ret->t[1], rectangle_get_x(ret->r[1])+rectangle_get_w(ret->r[1])/2,
+                          rectangle_get_y(ret->r[1])+rectangle_get_h(ret->r[1])/2);
+
+    text_set_pos(ret->t[2], rectangle_get_x(ret->r[2])+rectangle_get_w(ret->r[2])/2,
+                          rectangle_get_y(ret->r[2])+rectangle_get_h(ret->r[2])/2);
+
+    rectangle_set_pos(ret->frame,
+                  graph_get_XRes()/2    - rectangle_get_w(ret->frame)/2,
+                  graph_get_YRes()*0.5 - rectangle_get_h(ret->frame)/2);
+    return ret;
+}
+
+static int highlighted = -1;
+
+int (menu_update_state)(menu_t *menu, int click) {
+
+    if (rectangle_collide_point(menu->r[0], *get_mouse_X(), *get_mouse_Y())) {
+        highlighted = GAME;
+        if (click) return GAME;
+    } else if (rectangle_collide_point(menu->r[1], *get_mouse_X(), *get_mouse_Y())) {
+        highlighted = TEST;
+        if (click) return TEST;
+    } else if (rectangle_collide_point(menu->r[2], *get_mouse_X(), *get_mouse_Y())) {
+        highlighted = EXIT;
+        if (click) return EXIT;
+    } else {
+        highlighted = -1;
+    }
+    return MENU;
+}
+
+void (menu_draw)(menu_t *menu) {
+    rectangle_draw(menu->frame);
+    switch (highlighted) {
+    case GAME:
+        rectangle_set_fill_color(menu->r[0], HIGHLIGHT_COLOR);
+        rectangle_draw(menu->r[0]);
+        rectangle_draw(menu->r[1]);
+        rectangle_draw(menu->r[2]);
+        rectangle_set_fill_color(menu->r[0], GRAPH_BLACK);
+        break;
+    case TEST:
+        rectangle_set_fill_color(menu->r[1], HIGHLIGHT_COLOR);
+        rectangle_draw(menu->r[0]);
+        rectangle_draw(menu->r[1]);
+        rectangle_draw(menu->r[2]);
+        rectangle_set_fill_color(menu->r[1], GRAPH_BLACK);
+        break;
+    case EXIT:
+        rectangle_set_fill_color(menu->r[2], HIGHLIGHT_COLOR);
+        rectangle_draw(menu->r[0]);
+        rectangle_draw(menu->r[1]);
+        rectangle_draw(menu->r[2]);
+        rectangle_set_fill_color(menu->r[2], GRAPH_BLACK);
+        break;
+    default:
+        rectangle_draw(menu->r[0]);
+        rectangle_draw(menu->r[1]);
+        rectangle_draw(menu->r[2]);
+        break;
+    }
+    for(size_t i = 0; i < menu->sz; ++i)
+        text_draw(menu->t[i]);
+}
+
+void (menu_dtor)(menu_t *p){
+    for(size_t i = 0; i < p->sz; ++i){
+        rectangle_dtor(p->r[i]);
+        text_dtor     (p->t[i]);
+    }
+    rectangle_dtor(p->frame);
+    free(p);
+}

Property changes on: proj/libs/graph/src/menu.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/src/proj.c
===================================================================
--- proj/src/proj.c	(revision 290)
+++ proj/src/proj.c	(revision 291)
@@ -11,6 +11,7 @@
 #include "keyboard.h"
 #include "mouse.h"
 #include "graph.h"
+#include "menu.h"
 #include "rtc.h"
 #include "hltp.h"
 #include "interrupts_func.h"
Index: proj/src/proj_func.c
===================================================================
--- proj/src/proj_func.c	(revision 290)
+++ proj/src/proj_func.c	(revision 291)
@@ -189,147 +189,6 @@
     return atan2(gunner_get_y_screen(p) - mouse_y, mouse_x - gunner_get_x_screen(p));
 }
 
-struct menu {
-    rectangle_t *r0, *r1, *r2;
-    text_t      *t0, *t1, *t2;
-    rectangle_t *frame;
-};
-
-menu_t* (menu_ctor)(const font_t *fnt){
-    if(fnt == NULL) return NULL;
-    menu_t *ret = (menu_t*)malloc(sizeof(menu_t));
-    if (ret == NULL) return NULL;
-    ret->r0 = rectangle_ctor(0, 0, 400, 100);
-    ret->r1 = rectangle_ctor(0, 0, 400, 100);
-    ret->r2 = rectangle_ctor(0, 0, 400, 100);
-    ret->t0 = text_ctor(fnt, "PLAY");
-    ret->t1 = text_ctor(fnt, "TEST");
-    ret->t2 = text_ctor(fnt, "EXIT");
-    ret->frame = rectangle_ctor(0, 0, 800, 500);
-    if (ret->r0 == NULL || ret->r1 == NULL || ret->r2 == NULL ||
-        ret->t0 == NULL || ret->t1 == NULL || ret->t2 == NULL ||
-        ret->frame == NULL) return NULL;
-    // VISUAL
-    rectangle_set_fill_color(ret->r0, GRAPH_BLACK);
-    rectangle_set_outline_width(ret->r0, 2);
-    rectangle_set_outline_color(ret->r0, GRAPH_WHITE);
-    rectangle_set_fill_trans(ret->r0, GRAPH_TRANSPARENT);
-    rectangle_set_fill_color(ret->r1, GRAPH_BLACK);
-    rectangle_set_outline_width(ret->r1, 2);
-    rectangle_set_outline_color(ret->r1, GRAPH_WHITE);
-    rectangle_set_fill_trans(ret->r1, GRAPH_TRANSPARENT);
-    rectangle_set_fill_color(ret->r2, GRAPH_BLACK);
-    rectangle_set_outline_width(ret->r2, 2);
-    rectangle_set_outline_color(ret->r2, GRAPH_WHITE);
-    rectangle_set_fill_trans(ret->r2, GRAPH_TRANSPARENT);
-    text_set_valign(ret->t0, text_valign_center);
-    text_set_halign(ret->t0, text_halign_center);
-    text_set_color(ret->t0, TEXT_COLOR);
-    text_set_valign(ret->t1, text_valign_center);
-    text_set_halign(ret->t1, text_halign_center);
-    text_set_color(ret->t1, TEXT_COLOR);
-    text_set_valign(ret->t2, text_valign_center);
-    text_set_halign(ret->t2, text_halign_center);
-    text_set_color(ret->t2, TEXT_COLOR);
-    rectangle_set_fill_color(ret->frame, GRAPH_BLACK);
-    rectangle_set_outline_width(ret->frame, 6);
-    rectangle_set_outline_color(ret->frame, GRAPH_WHITE);
-    rectangle_set_fill_trans(ret->frame, GRAPH_TRANSPARENT);
-    // POSITIONS
-    rectangle_set_pos(ret->r0,
-                      graph_get_XRes()/2    - rectangle_get_w(ret->r0)/2,
-                      graph_get_YRes()*0.35 - rectangle_get_h(ret->r0)/2);
-
-
-    rectangle_set_pos(ret->r1,
-                    graph_get_XRes()/2    - rectangle_get_w(ret->r1)/2,
-                    graph_get_YRes()*0.5 - rectangle_get_h(ret->r1)/2);
-
-
-    rectangle_set_pos(ret->r2,
-                  graph_get_XRes()/2    - rectangle_get_w(ret->r2)/2,
-                  graph_get_YRes()*0.65 - rectangle_get_h(ret->r2)/2);
-
-    text_set_pos(ret->t0, rectangle_get_x(ret->r0)+rectangle_get_w(ret->r0)/2,
-                          rectangle_get_y(ret->r0)+rectangle_get_h(ret->r0)/2);
-
-    text_set_pos(ret->t1, rectangle_get_x(ret->r1)+rectangle_get_w(ret->r1)/2,
-                          rectangle_get_y(ret->r1)+rectangle_get_h(ret->r1)/2);
-
-    text_set_pos(ret->t2, rectangle_get_x(ret->r2)+rectangle_get_w(ret->r2)/2,
-                          rectangle_get_y(ret->r2)+rectangle_get_h(ret->r2)/2);
-
-    rectangle_set_pos(ret->frame,
-                  graph_get_XRes()/2    - rectangle_get_w(ret->frame)/2,
-                  graph_get_YRes()*0.5 - rectangle_get_h(ret->frame)/2);
-    return ret;
-}
-
-static int highlighted = -1;
-
-int (menu_update_state)(menu_t *menu, int click) {
-
-    if (rectangle_collide_point(menu->r0, mouse_x, mouse_y)) {
-        highlighted = GAME;
-        if (click) return GAME;
-    } else if (rectangle_collide_point(menu->r1, mouse_x, mouse_y)) {
-        highlighted = TEST;
-        if (click) return TEST;
-    } else if (rectangle_collide_point(menu->r2, mouse_x, mouse_y)) {
-        highlighted = EXIT;
-        if (click) return EXIT;
-    } else {
-        highlighted = -1;
-    }
-    return MENU;
-}
-
-void (menu_draw)(menu_t *menu) {
-    rectangle_draw(menu->frame);
-    switch (highlighted) {
-    case GAME:
-        rectangle_set_fill_color(menu->r0, HIGHLIGHT_COLOR);
-        rectangle_draw(menu->r0);
-        rectangle_draw(menu->r1);
-        rectangle_draw(menu->r2);
-        rectangle_set_fill_color(menu->r0, GRAPH_BLACK);
-        break;
-    case TEST:
-        rectangle_set_fill_color(menu->r1, HIGHLIGHT_COLOR);
-        rectangle_draw(menu->r0);
-        rectangle_draw(menu->r1);
-        rectangle_draw(menu->r2);
-        rectangle_set_fill_color(menu->r1, GRAPH_BLACK);
-        break;
-    case EXIT:
-        rectangle_set_fill_color(menu->r2, HIGHLIGHT_COLOR);
-        rectangle_draw(menu->r0);
-        rectangle_draw(menu->r1);
-        rectangle_draw(menu->r2);
-        rectangle_set_fill_color(menu->r2, GRAPH_BLACK);
-        break;
-    default:
-        rectangle_draw(menu->r0);
-        rectangle_draw(menu->r1);
-        rectangle_draw(menu->r2);
-        break;
-    }
-    text_draw(menu->t0);
-    text_draw(menu->t1);
-    text_draw(menu->t2);
-}
-
-void (menu_dtor)(menu_t *p){
-    rectangle_dtor(p->r0);
-    rectangle_dtor(p->r1);
-    rectangle_dtor(p->r2);
-    rectangle_dtor(p->frame);
-    text_dtor(p->t0);
-    text_dtor(p->t1);
-    text_dtor(p->t2);
-    free(p);
-}
-
 text_timer_t* (timer_ctor)(const font_t *fnt){
     if(fnt == NULL) return NULL;
     text_timer_t *ret = malloc(sizeof(timer_t));
Index: proj/DR.mk
===================================================================
--- proj/DR.mk	(revision 290)
+++ proj/DR.mk	(revision 291)
@@ -9,7 +9,7 @@
 .PATH: ${.CURDIR}/libs/classes/src
 .PATH: ${.CURDIR}/libs/utils/src
 
-SRCS= proj.c list.c queue.c graph.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c fast_math.c rectangle.c font.c xpm_utils.c ent.c rtc.c uart.c hltp.c makecode_map.c
+SRCS= proj.c list.c queue.c graph.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c fast_math.c rectangle.c font.c xpm_utils.c ent.c rtc.c uart.c hltp.c makecode_map.c menu.c
 IPATHS=-I./include -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_
Index: proj/Makefile
===================================================================
--- proj/Makefile	(revision 290)
+++ proj/Makefile	(revision 291)
@@ -9,7 +9,7 @@
 .PATH: ${.CURDIR}/libs/classes/src
 .PATH: ${.CURDIR}/libs/utils/src
 
-SRCS= proj.c list.c queue.c graph.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c fast_math.c rectangle.c font.c xpm_utils.c ent.c rtc.c uart.c hltp.c makecode_map.c
+SRCS= proj.c list.c queue.c graph.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c fast_math.c rectangle.c font.c xpm_utils.c ent.c rtc.c uart.c hltp.c makecode_map.c menu.c
 IPATHS=-I./include -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_
Index: proj/TB.mk
===================================================================
--- proj/TB.mk	(revision 290)
+++ proj/TB.mk	(revision 291)
@@ -9,7 +9,7 @@
 .PATH: ${.CURDIR}/libs/classes/src
 .PATH: ${.CURDIR}/libs/utils/src
 
-SRCS= proj.c list.c queue.c graph.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c fast_math.c rectangle.c font.c xpm_utils.c ent.c rtc.c uart.c makecode_map.c
+SRCS= proj.c list.c queue.c graph.c kbc.c keyboard.c mouse.c utils.c timer.c interrupts_func.c proj_func.c fast_math.c rectangle.c font.c xpm_utils.c ent.c rtc.c uart.c makecode_map.c menu.c
 IPATHS=-I./include -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_
Index: proj/tasks.md
===================================================================
--- proj/tasks.md	(revision 290)
+++ proj/tasks.md	(revision 291)
@@ -9,6 +9,7 @@
 - [ ] Implement zombie mode (single-player or co-op).
 - [ ] Implement algorithm to decide when gunner AI needs to shoot.
 - [ ] Implement campaign mode (single-player or co-op).
+- [ ] Visibility algorithm
 
 ### Low Priority
 - [ ] Change sprites.
