Enlightenment CVS committal

Author  : davemds
Project : e_modules
Module  : penguins

Dir     : e_modules/penguins


Modified Files:
        e_mod_main.c e_mod_main.h 


Log Message:
 * New action: angel 
 * Add angel animation to default theme
 * Make custom action also on the desktop floor


===================================================================
RCS file: /cvs/e/e_modules/penguins/e_mod_main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- e_mod_main.c        22 Nov 2007 03:09:57 -0000      1.15
+++ e_mod_main.c        22 Nov 2007 05:07:38 -0000      1.16
@@ -383,13 +383,13 @@
    
    // load standard actions
    _load_action(pop, pop->conf->theme, "Walker", ID_WALKER);
-   
    _load_action(pop, pop->conf->theme, "Faller", ID_FALLER);
    _load_action(pop, pop->conf->theme, "Climber", ID_CLIMBER);
    _load_action(pop, pop->conf->theme, "Floater", ID_FLOATER);
    _load_action(pop, pop->conf->theme, "Bomber", ID_BOMBER);
    _load_action(pop, pop->conf->theme, "Splatter", ID_SPLATTER);
    _load_action(pop, pop->conf->theme, "Flyer", ID_FLYER);
+   _load_action(pop, pop->conf->theme, "Angel", ID_ANGEL);
    
    // load custom actions
    i = 2;
@@ -474,7 +474,7 @@
    //printf("PENGUINS: Reborn :)\n");
    tux->reverse = random() % (2);
    tux->x = random() % (tux->pop->width);
-   tux->y = 0;
+   tux->y = -100;
    tux->custom = 0;
    evas_object_move(tux->obj, (int)tux->x, (int)tux->y);
    _start_falling_at(tux, tux->x);
@@ -503,7 +503,9 @@
          if (!_is_inside_any_win(pop,
                (int)tux->x+(tux->action->w/2),
                (int)tux->y+tux->action->h+1,
-               _RET_NONE_VALUE))
+               _RET_NONE_VALUE)
+            && (int)tux->y+tux->action->h+1 < pop->height
+            )
          {
             edje_object_signal_callback_del(tux->obj,"custom_done","edje", 
_cb_custom_end);
             _start_falling_at(tux, (int)tux->x+(tux->action->w/2));
@@ -603,7 +605,7 @@
          }
 
       }
-       // ******  FLYER  ********
+      // ******  FLYER  ********
       else if (tux->action->id == ID_FLYER)
       {
          tux->y -= ((double)tux->action->speed / 100);
@@ -613,6 +615,14 @@
             _start_falling_at(tux, (int)tux->x);
          }
       }
+      // ******  ANGEL  ********
+      else if (tux->action->id == ID_ANGEL)
+      {
+         tux->y -= ((double)tux->action->speed / 100);
+         tux->x += (random() % 3) - 1;
+         if (tux->y < -100)
+            _reborn(tux);
+      }
       // ******  CLIMBER  ********
       else if (tux->action->id == ID_CLIMBER)
       {
@@ -701,11 +711,9 @@
                default:
                   return 1;
             }
-            
          }
       }
    }   
-
    return 0;
 }
 
@@ -714,6 +722,7 @@
 {
    //printf("PENGUINS: Start walking...at %d\n", at_y);
    tux->action = evas_hash_find(tux->pop->actions, "Walker");
+   tux->custom = 0;
    
    tux->y = at_y - tux->action->h;
    evas_object_resize(tux->obj, tux->action->w, tux->action->h);
@@ -780,6 +789,7 @@
       }
    }
    tux->faller_h = (int)tux->y;
+   tux->custom = 0;
 }
 
 static void 
@@ -795,10 +805,32 @@
 }
 
 static void 
+_start_angel_at(Penguin *tux, int at_y)
+{
+   tux->x = tux->x + (tux->action->w /2);
+   tux->action = evas_hash_find(tux->pop->actions, "Angel");
+   if (!tux->action)
+   {
+      _reborn(tux);
+      return;
+   }
+   
+   tux->x = tux->x - (tux->action->w /2);
+   tux->y = at_y - 10;
+   
+   tux->custom = 0;
+   edje_object_signal_emit(tux->obj, "start_angel", "epenguins");
+   evas_object_move(tux->obj,(int)tux->x,(int)tux->y);
+   evas_object_resize(tux->obj, tux->action->w, tux->action->h);
+   
+}
+
+static void 
 _cb_splatter_end (void *data, Evas_Object *o, const char *emi, const char *src)
 {
-   _reborn((Penguin*)data);
+   Penguin *tux = data;
    edje_object_signal_callback_del(o,"splatting_done","edje", 
_cb_splatter_end);
+   _start_angel_at(tux, tux->y+tux->action->h+10);
 }
 
 static void 
@@ -825,13 +857,20 @@
 static void 
 _cb_bomber_end(void *data, Evas_Object *o, const char *emi, const char *src)
 {
+   Penguin *tux = data;
    edje_object_signal_callback_del(o,"bombing_done","edje", _cb_bomber_end);
-   _reborn((Penguin*)data);
+   _start_angel_at(tux, tux->y);
 }
 static void 
 _start_bombing_at(Penguin *tux, int at_y)
 {
    //printf("PENGUINS: Start bombing at %d...\n", at_y);
+   if (tux->action && (
+         (tux->action->id == ID_ANGEL) ||
+         (tux->action->id == ID_BOMBER) ||
+         (tux->action->id == ID_SPLATTER))
+      )
+      return;
    
    if (tux->reverse)
       edje_object_signal_emit(tux->obj, "start_bombing_left", "epenguins");
===================================================================
RCS file: /cvs/e/e_modules/penguins/e_mod_main.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_mod_main.h        13 Nov 2007 15:57:57 -0000      1.5
+++ e_mod_main.h        22 Nov 2007 05:07:38 -0000      1.6
@@ -16,6 +16,7 @@
 #define ID_SPLATTER 5
 #define ID_FLYER 6
 #define ID_BOMBER 7
+#define ID_ANGEL 8
 
 typedef struct _Config Config;
 typedef struct _Population Population;



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to