Index: proj/include/ent.h
===================================================================
--- proj/include/ent.h	(revision 225)
+++ proj/include/ent.h	(revision 226)
@@ -32,6 +32,7 @@
 double  (bullet_get_y)       (const bullet_t *p);
 int16_t (bullet_get_x_screen)(const bullet_t *p);
 int16_t (bullet_get_y_screen)(const bullet_t *p);
+void (bullet_update_movement)(bullet_t *p);
 void (bullet_draw)(bullet_t *p);
 
 struct map;
@@ -39,8 +40,8 @@
 map_t* (map_ctor)(const char **background, const char **collide);
 void   (map_dtor)(map_t *p);
 int    (map_collides_point)(const map_t *p, double x, double y);
-int    (map_collides_gunner)(const map_t *p, gunner_t *gunner);
-int    (map_collides_bullet)(const map_t *p, bullet_t *bullet);
+int    (map_collides_gunner)(const map_t *p, const gunner_t *gunner);
+int    (map_collides_bullet)(const map_t *p, const bullet_t *bullet);
 void   (map_draw)(map_t *p);
 
 #endif //ENT_H_INCLUDED
Index: proj/include/list.h
===================================================================
--- proj/include/list.h	(nonexistent)
+++ proj/include/list.h	(revision 226)
@@ -0,0 +1,24 @@
+#ifndef LIST_H_INCLUDED
+#define LIST_H_INCLUDED
+
+struct list_node;
+typedef struct list_node list_node_t;
+
+list_node_t* (list_node_ctor)(list_node_t *p, list_node_t *n, void *val);
+void         (list_node_dtor)(list_node_t *p);
+list_node_t* (list_node_next)(const list_node_t *p);
+list_node_t* (list_node_prev)(const list_node_t *p);
+void**       (list_node_val )(list_node_t *p);
+
+struct list;
+typedef struct list list_t;
+
+list_t* (list_ctor)(void);
+int     (list_dtor)(list_t *l);
+list_node_t* (list_begin )(list_t *l);
+list_node_t* (list_end   )(list_t *l);
+size_t       (list_size  )(const list_t *l);
+list_node_t* (list_insert)(list_t *l, list_node_t *position, void *val);
+void*        (list_erase )(list_t *l, list_node_t *position);
+
+#endif //LIST_H_INCLUDED

Property changes on: proj/include/list.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/src/ent.c
===================================================================
--- proj/src/ent.c	(revision 225)
+++ proj/src/ent.c	(revision 226)
@@ -4,7 +4,7 @@
 
 #include "graph.h"
 #include "sprite.h"
-
+#include "utils.h"
 #include <math.h>
 
 static double scale = 1.0;
@@ -62,13 +62,16 @@
 
 struct bullet{
     double x, y; //real position
+    double vx, vy;
     sprite_t *b;
 };
 bullet_t* (bullet_ctor)(basic_sprite_t *b){
     bullet_t *ret = malloc(sizeof(bullet_t));
     if(ret == NULL) return NULL;
-    ret->x = 0.0;
-    ret->y = 0.0;
+    ret-> x = 0.0;
+    ret-> y = 0.0;
+    ret->vx = 0.0;
+    ret->vy = 0.0;
     ret->b = sprite_ctor(b);
     if(ret->b == NULL){
         bullet_dtor(ret);
@@ -86,6 +89,10 @@
 double  (bullet_get_y)       (const bullet_t *p){ return p->y; }
 int16_t (bullet_get_x_screen)(const bullet_t *p){ return (p->x-x_origin)*scale; }
 int16_t (bullet_get_y_screen)(const bullet_t *p){ return (p->y-y_origin)*scale; }
+void (bullet_update_movement)(bullet_t *p){
+    p->x += p->vx;
+    p->y += p->vy;
+}
 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);
@@ -143,7 +150,7 @@
     return p->collide[pos];
 }
 
-int (map_collides_gunner)(const map_t *p, gunner_t *shooter) {
+int (map_collides_gunner)(const map_t *p, const gunner_t *shooter) {
     double radius = sprite_get_w(shooter->dude)/2.0;
     double shooter_x = gunner_get_x(shooter);
     double shooter_y = gunner_get_y(shooter);
@@ -155,7 +162,15 @@
     return 0;
 }
 
-int (map_collides_bullet)(const map_t *p, bullet_t *bullet) {
+int (map_collides_bullet)(const map_t *p, const bullet_t *bull){
+    double radius = max(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;
 }
 
Index: proj/src/list.c
===================================================================
--- proj/src/list.c	(nonexistent)
+++ proj/src/list.c	(revision 226)
@@ -0,0 +1,69 @@
+#include <lcom/lcf.h>
+
+#include "list.h"
+
+struct list_node{
+    list_node_t *p, *n;
+    void *val;
+};
+list_node_t* (list_node_ctor)(list_node_t *p, list_node_t *n, void *val){
+    list_node_t *ret = malloc(sizeof(list_node_t));
+    if(ret == NULL) return NULL;
+    ret->p = p;
+    ret->n = n;
+    ret->val = val;
+    return ret;
+}
+void (list_node_dtor)(list_node_t *p){
+    free(p);
+}
+list_node_t* (list_node_next)(const list_node_t *p){ return p->n; }
+list_node_t* (list_node_prev)(const list_node_t *p){ return p->p; }
+void**       (list_node_val )(list_node_t *p){ return &p->val; }
+
+struct list{
+    list_node_t *begin_;
+    list_node_t *end_;
+    size_t sz;
+};
+list_t* (list_ctor)(void){
+    list_t *ret = malloc(sizeof(list_t));
+    if(ret == NULL) return NULL;
+    ret->sz = 0;
+    ret->begin_ = NULL; ret->end_ = NULL;
+    ret->begin_ = list_node_ctor(NULL, NULL, NULL);
+    ret->end_   = list_node_ctor(NULL, NULL, NULL);
+    if(ret->begin_ == NULL || ret->end_ == NULL){
+        list_dtor(ret);
+        return NULL;
+    }
+    ret->begin_->n = ret->end_  ;
+    ret->end_  ->p = ret->begin_;
+    return ret;
+}
+int (list_dtor)(list_t *l){
+    if(l == NULL) return 0;
+    if(list_size(l) > 0) return 1;
+    list_node_dtor(l->begin_);
+    list_node_dtor(l->end_);
+    free(l);
+    return 0;
+}
+list_node_t* (list_begin )(      list_t *l){ return l->begin_->n; }
+list_node_t* (list_end   )(      list_t *l){ return l->end_; }
+size_t       (list_size  )(const list_t *l){ return l->sz; }
+list_node_t* (list_insert)(list_t *l, list_node_t *position, void *val){
+    list_node_t *node = list_node_ctor(position->p, position, val);
+    position->p->n = node;
+    position->p    = node;
+    ++l->sz;
+    return node;
+}
+void*        (list_erase )(list_t *l, list_node_t *position){
+    position->p->n = position->n;
+    position->n->p = position->p;
+    void *ret = position->val;
+    list_node_dtor(position);
+    --l->sz;
+    return ret;
+}

Property changes on: proj/src/list.c
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: proj/src/proj.c
===================================================================
--- proj/src/proj.c	(revision 225)
+++ proj/src/proj.c	(revision 226)
@@ -26,6 +26,8 @@
 #include "bullet.h"
 #include "map1.h"
 
+#include "list.h"
+
 int main(int argc, char* argv[]) {
 
     lcf_set_language("EN-US");
@@ -106,6 +108,30 @@
         graph_draw();
         rectangle_dtor(rect);
 
+        list_t *l = list_ctor();
+        int *p = NULL;
+        for(int i = 10; i < 20; ++i){
+            p = malloc(sizeof(int));
+            *p = i;
+            printf("INSERTING %d\n", i);
+            list_insert(l, list_end(l), p);
+            printf("INSERTED, SIZE=%d\n", list_size(l));
+        }
+        list_node_t *it = list_begin(l);
+        while(it != list_end(l)){
+            printf("%d\n", **(int**)list_node_val(it));
+            it = list_node_next(it);
+        }
+        while(list_size(l) > 0){
+            printf("ERASING\n");
+            void *p = list_erase(l, list_begin(l));
+            printf("ERASED %d, SIZE=%d\n", *(int*)p, list_size(l));
+            free(p);
+        }
+        printf("DONE\n");
+        if(list_dtor(l)) printf("COULD NOT DESTRUCT LIST\n");
+
+
         tickdelay(micros_to_ticks(1000000));
 
     #endif
Index: proj/DR.mk
===================================================================
--- proj/DR.mk	(revision 225)
+++ proj/DR.mk	(revision 226)
@@ -2,7 +2,7 @@
 
 .PATH: ${.CURDIR}/src
 
-SRCS= proj.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
+SRCS= proj.c list.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
 
 CPPFLAGS += -pedantic -I./include -I./maps -I./media/xpm -D LCOM_MACRO -D DIOGO -D __LCOM_OPTIMIZED_
 
Index: proj/Makefile
===================================================================
--- proj/Makefile	(revision 225)
+++ proj/Makefile	(revision 226)
@@ -2,7 +2,7 @@
 
 .PATH: ${.CURDIR}/src
 
-SRCS= proj.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
+SRCS= proj.c list.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
 
 CPPFLAGS += -pedantic -I./include -I./maps -I./media/xpm -D LCOM_MACRO -D __LCOM_OPTIMIZED_
 
Index: proj/TB.mk
===================================================================
--- proj/TB.mk	(revision 225)
+++ proj/TB.mk	(revision 226)
@@ -2,7 +2,7 @@
 
 .PATH: ${.CURDIR}/src
 
-SRCS= proj.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
+SRCS= proj.c list.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
 
 CPPFLAGS += -pedantic -I./include -I./maps -I./media/xpm -D LCOM_MACRO -D TELMO #-D __LCOM_OPTIMIZED_
 
